# UniPlugin-Hello-AS **Repository Path**: wugemu_admin_admin/uni-plugin-hello-as ## Basic Information - **Project Name**: UniPlugin-Hello-AS - **Description**: No description available - **Primary Language**: Android - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-25 - **Last Updated**: 2026-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 请求方法 startScan() 开始扫描 connectDevice(String deviceMac) 连接设备 stopScan() 停止扫描 disconnect() 断开设备 startSensorData() 开始采集 stopSensorData() 结束采集 getBatteryLevel() 获取电量 getConnectState() 获取设备连接状态 回调方法 initSenSor 初始化回调 startScan 开始扫描回调 deviceListCallBack 设备列表回调 connectDevice 连接设备回调 onErrorCallback 设备错误回调 onStateChange 设备状态回调 initALL 设备初始化回调 getBatteryLevel 电量状态回调 setParam 设置参数回调 onDisconnected 设备断开链接回调 onSensorNotifyData 设备数据回调 stopScan 停止扫描回调 disconnect 断开设备回调 startSensorData 开始采集回调 stopSensorData 结束采集回调 startDataNotification 开始监测数据回调 stopDataNotification 停止监测数据回调 leakPermission 确少权限回调 getConnectState 设备连接状态回调 # Synchroni SDK + kotlin demo ## Brief Synchroni SDK is the software development kit for developers to access OYMotion Synchroni products. ## 1. Permission Application will obtain bluetooth permission by itself. ## 2. Import SDK ```kotlin dependencies { implementation files('../sdk/sensor.jar') } import com.sensor.* ``` ## 3. Initalize request bluetooth permissions ```kotlin //MainActivity.kt PermissionX.init(this) .permissions(permissions.asList()) .request { allGranted, grantedList, deniedList -> if (allGranted) { //setup scan delegate and scan SensorController.getInstance().startScan(6000); if (SensorController.getInstance().delegate == null){ SensorController.getInstance().delegate = SensorController.SensorControllerDelegate { bleDevices -> } } } } ``` ## 4. Start scan ```kotlin SensorController.getInstance().startScan(periodInMS); //returns array of BLEDevice SensorController.SensorControllerDelegate { bleDevices -> for (device in bleDevices) { if (!(device.name.startsWith("SYNC") || device.name.startsWith("OB"))) continue Log.d("DEMO", "found device: " + device.name); val sensor = SensorController.getInstance().getSensor(device.mac); } } ``` ## 5. Stop scan ```kotlin SensorController.getInstance().stopScan(); ``` ## 6. Connect device ```kotlin SensorProfile.connect() ``` ## 7. Disconnect ```kotlin SensorProfile.disconnect() ``` ## 8. Device status ### 8.1 Get device status ```kotlin SensorProfile.deviceState; ``` Please send command in 'BLEState.ready' ```kotlin public enum State {Disconnected, Connecting, Connected, Ready, Disconnecting, Invalid} ``` ### 8.2 Get device status change ```kotlin fun onStateChange(profile: SensorProfile, newState: BLEDevice.State) { Log.d("DEMO", "device : " + profile.device.name + " => " + newState.name ) } ``` ## 9. DataNotify ### 9.1 init data notify ```kotlin SensorProfile.initAll(PACKAGE_COUNT, timeoutInMS: TIMEOUT) ``` ### 9.2 Start data transfer For start data transfer, use `void startDataNotification(Callback cb)` to start. Process data in onSensorNotifyData. ```kotlin SensorProfile.startDataNotification() override fun onSensorNotifyData(profile: SensorProfile, rawData: SensorData) { Log.d("DEMO", profile.device.name + " got data type: " + rawData.dataType + " | " + rawData.channelSamples[0][0].sampleIndex ) if (rawData.dataType == SensorData.NTF_EEG){ } } ``` data type: ```kotlin typedef NS_ENUM(NSInteger, NotifyDataType) { NTF_ACC_DATA, NTF_GYO_DATA, NTF_EEG, NTF_ECG, NTF_BRTH, }; ``` ### 9.3 Stop data transfer ```kotlin sensor.stopDataNotification() ```