Android 4.3에서 Bluetooth 장치에 연결해야하는 응용 프로그램을 개발 중입니다.BLE 장치에 연결 한 후 배터리 잔량을 얻는 방법은 무엇입니까?
은 내가 BATTERY_LEVELBattery_Service 및 를 사용하여 배터리 수준을 싶어.
public class BluetoothLeService extends Service {
private static final UUID Battery_Service_UUID = UUID.fromString("0000180F-0000-1000-8000-00805f9b34fb");
private static final UUID Battery_Level_UUID = UUID.fromString("00002a19-0000-1000-8000-00805f9b34fb");
public void getbattery() {
BluetoothGattService batteryService = mBluetoothGatt.getService(Battery_Service_UUID);
if(batteryService == null) {
Log.d(TAG, "Battery service not found!");
return;
}
BluetoothGattCharacteristic batteryLevel = batteryService.getCharacteristic(Battery_Level_UUID);
if(batteryLevel == null) {
Log.d(TAG, "Battery level not found!");
return;
}
mBluetoothGatt.readCharacteristic(batteryLevel);
// What should I do that I can get the battery level ??
Log.d(TAG, "Battery level " + mBluetoothGatt.readCharacteristic(batteryLevel););
}
그러나 mBluetoothGatt.readCharacteristic(batteryLevel);
의 값이 배터리를 읽는 방법 배터리 레벨 값
가 아닌 ????
어떤 가치가 있습니까? –
값 mBluetoothGatt.readCharacteristic (batteryLevel); "사실" – Wun
죄송합니다. 제가 도와 드릴 수 있다고 생각하지 않습니다. 어쩌면 이럴 수 있습니다. http://developer.samsung.com/forum/board/thread/view.do?boardName=SDK&messageId=240110 –