Skip to content

Commit

Permalink
Merge pull request #2 from LUXROBO/release/0.1.0
Browse files Browse the repository at this point in the history
Release/0.1.0
  • Loading branch information
lego8421 authored Oct 5, 2018
2 parents 390b56a + d491a3b commit 18097da
Show file tree
Hide file tree
Showing 31 changed files with 758 additions and 862 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,8 @@ private ModiManager mModiManager = ModiManager.getInstance();
Initialize ModiManager ::

```java
mModiManager.init(getApplicationContext(),
new ManagerStateListener() {
@Override
public void onCompletedToInitialize() {
}

@Override
public void onCompletedToDeinitialize() {
}
});
```

Set ModiClient::
mModiManager.init(getApplicationContext(), mModiClient);

```java
private ModiClient mModiClient = new ModiClient() {

@Override
Expand Down Expand Up @@ -101,7 +88,7 @@ private ModiClient mModiClient = new ModiClient() {
}

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

}

Expand All @@ -115,7 +102,6 @@ private ModiClient mModiClient = new ModiClient() {

}
};
mModiManager.setClient(mModiClient);
```

Scan and Connect::
Expand All @@ -130,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
@@ -1,10 +1,10 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.callback;
Expand All @@ -14,15 +14,34 @@

public abstract class ConnectionCallback {

public static final int BLE_CONNECT_TRYING = 11; // 연결시도
public static final int BLE_CONNECT_DONE = 100; // 연결완료
public static final int BLE_DISCONNECT_TRYING = 98; // 해제시도
/**
* BLE connect trying
*/
public static final int BLE_CONNECT_TRYING = 11;
/**
* BLE connect done
*/
public static final int BLE_CONNECT_DONE = 100;
/**
* BLE disconnect trying
*/
public static final int BLE_DISCONNECT_TRYING = 98;
/**
* BLE disconnect done
*/
public static final int BLE_DISCONNECT_DONE = 99; // 해제완료

/**
* Callback when disconnect failure
*/
public abstract void onDisconnectFailure();

/**
* Callback when Bluetooth Device ConnectionState Changed
*
* @param connectionState connection state
*/
public void onChangedConnectionState(int connectionState) {

ModiLog.d("Bluetooth Device ConnectionState Changed to " + connectionState);
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.client;


public interface BluetoothClient {

/**
* Callback when Bluetooth enabled
*/
void onBluetoothEnabled();

/**
* Callback when Bluetooth disabled
*/
void onBluetoothDisabled();

/**
* Callback when Bluetooth connected
*/
void onBluetoothStateOnConnected();

/**
* Callback when Bluetooth disconnected
*/
void onBluetoothStateOnDisconnected();

/**
* Callback when Bluetooth error
*/
void onBluetoothError();

/**
* Callback when Bluetooth state unknown
*/
void onBluetoothStateUnknown(int state);
}
11 changes: 8 additions & 3 deletions api/src/main/java/com/luxrobo/modiplay/api/client/LogClient.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.client;


public interface LogClient {

/**
* Callback when received raw data from MODI Network Module
*
* @param data raw data
*/
void onReceivedRawData(String data);
}
51 changes: 29 additions & 22 deletions api/src/main/java/com/luxrobo/modiplay/api/client/ModiClient.java
Original file line number Diff line number Diff line change
@@ -1,79 +1,86 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.client;

import android.bluetooth.BluetoothDevice;

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

public interface ModiClient {

/**
* 디바이스를 찾으면 호출되는 메소드
* @param device
* @param rssi
* @param scanRecord
* Callback when found device
*
* @param device BluetoothDevice
* @param rssi RSSI
* @param scanRecord ScanResult ScanRecord
*/
void onFoundDevice(BluetoothDevice device, int rssi, byte[] scanRecord);

/**
* 서비스가 발견되면 호출되는 메소드
* Callback when service discovered
*/
void onDiscoveredService();

/**
* 연결이 되면 호출되는 메소드
* Callback when device connected
*/
void onConnected();

/**
* 연결이 해제 되면 호출되는 메소드
* Callback when device disconnected
*/
void onDisconnected();

/**
* 스캔 상태를 알려주는 메소드
* @param isScaning 스캔중이면 true, 아니면 false
* Callback when changed the scan state
*
* @param isScaning
*/
void onScanning(boolean isScaning);

/**
* 네트워크 모듈에서 데이터를 받으면 호출되는 메소드
* @param data Raw Data를 String으로 표시한 값
* Callback when received data from MODI Network Module
*
* @param data display converted raw data to ascii string
*/
void onReceivedData(String data);

/**
* 네트워크 모듈에서 데이터를 받으면 호출되는 메소드
* @param data Raw Data
* Callback when received data from MODI Network Module
*
* @param data raw data
*/
void onReceivedData(byte[] data);

/**
* MODI Studio상에서 Send Data를 통해 받은 값
* Callback when received user data from `Send Data` on MODI Studio
*
* @param data
*/
void onReceivedUserData(int data);

/**
* MODI Studio상에서 Buzzer의 값
* @param state on: 1, off: 0
* Callback when received buzzer state from MODI Studio
*
* @param state enum State.Buzzer
*/
void onBuzzerState(int state);
void onBuzzerState(State.Buzzer state);

/**
* evne가 꺼지면 호출되는 메소드
* Callback when event off
*/
void onOffEvent();

/**
* 네트워크 모듈이 전원이 꺼지면서 연결이 끊긴것을 감지하는 메소드
* Callback when disconnected MODI Network Module that power off
*/
void disconnectedByModulePowerOff();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.client;
Expand All @@ -14,5 +14,11 @@

public interface NotifyStateClient {

/**
* Callback when changed NotificationState
*
* @param characteristics Characteristics
* @param enable
*/
void onChangedNotificationState(Characteristics characteristics, boolean enable);
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
/*
* Developement Part, Luxrobo INC., SEOUL, KOREA
* Copyright(c) 2018 by Luxrobo Inc.
* Developement Part, LUXROBO INC., SEOUL, KOREA
* Copyright(c) 2018 by LUXROBO Inc.
*
* All rights reserved. No part of this work may be reproduced, stored in a
* retrieval system, or transmitted by any means without prior written
* Permission of Luxrobo Inc.
* Permission of LUXROBO Inc.
*/

package com.luxrobo.modiplay.api.client;


public interface ServiceStateClient {

/**
* Callback when Service bind
*/
void onBind();

/**
* Callback when Service unbind
*/
void onUnBind();
}
Loading

0 comments on commit 18097da

Please sign in to comment.