Skip to content

Commit

Permalink
create modi play module(button, joystick, buzzer) enum
Browse files Browse the repository at this point in the history
com.luxrobo.modiplay.api.enums.State
  • Loading branch information
matt committed Oct 4, 2018
1 parent e11b53c commit c3a3b5a
Show file tree
Hide file tree
Showing 24 changed files with 254 additions and 153 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private ModiClient mModiClient = new ModiClient() {
}

@Override
public void onBuzzerState(int state) {
public void onBuzzerState(State.Buzzer state) {

}

Expand Down Expand Up @@ -116,13 +116,13 @@ mModiManager.connect(deviceAddress);
Send Button, Joystick State to MODI Network Module::
```java
// send joystick state
mModiManager.sendJoystickState(ModiManager.STATE_JOYSTICK_UP);
mModiManager.sendJoystickState(ModiManager.STATE_JOYSTICK_DOWN);
mModiManager.sendJoystickState(ModiManager.STATE_JOYSTICK_LEFT);
mModiManager.sendJoystickState(ModiManager.STATE_JOYSTICK_RIGHT);
mModiManager.sendJoystickState(ModiManager.STATE_JOYSTICK_UNPRESSED);
mModiManager.sendJoystickState(State.Joystick.UP);
mModiManager.sendJoystickState(State.Joystick.DOWN);
mModiManager.sendJoystickState(State.Joystick.LEFT);
mModiManager.sendJoystickState(State.Joystick.RIGHT);
mModiManager.sendJoystickState(State.Joystick.UNPRESSED);

// send button state
mModiManager.sendButtonState(ModiManager.STATE_BUTTON_PRESSED);
mModiManager.sendButtonState(ModiManager.STATE_BUTTON_UNPRESSED);
mModiManager.sendButtonState(State.Button.PRESSED);
mModiManager.sendButtonState(State.Button.UNPRESSED);
```
4 changes: 2 additions & 2 deletions api/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.luxrobo.modiplay.api" >
package="com.luxrobo.modiplay.api">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Expand All @@ -12,7 +12,7 @@
<service
android:name=".core.ModiService"
android:enabled="true"
android:exported="false"/>
android:exported="false" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public abstract class ConnectionCallback {

/**
* Callback when Bluetooth Device ConnectionState Changed
*
* @param connectionState connection state
*/
public void onChangedConnectionState(int connectionState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface LogClient {

/**
* Callback when received raw data from MODI Network Module
*
* @param data raw data
*/
void onReceivedRawData(String data);
Expand Down
15 changes: 11 additions & 4 deletions api/src/main/java/com/luxrobo/modiplay/api/client/ModiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

import android.bluetooth.BluetoothDevice;

import com.luxrobo.modiplay.api.enums.State;

public interface ModiClient {

/**
* Callback when found device
* @param device BluetoothDevice
* @param rssi RSSI
*
* @param device BluetoothDevice
* @param rssi RSSI
* @param scanRecord ScanResult ScanRecord
*/
void onFoundDevice(BluetoothDevice device, int rssi, byte[] scanRecord);
Expand All @@ -39,33 +41,38 @@ public interface ModiClient {

/**
* Callback when changed the scan state
*
* @param isScaning
*/
void onScanning(boolean isScaning);

/**
* Callback when received data from MODI Network Module
*
* @param data display converted raw data to ascii string
*/
void onReceivedData(String data);

/**
* Callback when received data from MODI Network Module
*
* @param data raw data
*/
void onReceivedData(byte[] data);

/**
* Callback when received user data from `Send Data` on MODI Studio
*
* @param data
*/
void onReceivedUserData(int data);

/**
* Callback when received buzzer state from MODI Studio
* @param state
*
* @param state enum ModiManager.State.Buzzer
*/
void onBuzzerState(int state);
void onBuzzerState(State.Buzzer state);

/**
* Callback when event off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public interface NotifyStateClient {

/**
* Callback when changed NotificationState
*
* @param characteristics Characteristics
* @param enable
*/
Expand Down
Loading

0 comments on commit c3a3b5a

Please sign in to comment.