मैं एक ऐसा एप्लीकेशन विकसित कर रहा हूं जहां मुझे एंड्रॉइड 4.3 पर ब्लूटूथ डिवाइस से कनेक्ट करना है।बीएलई डिवाइस से कनेक्ट करने के बाद बैटरी स्तर कैसे प्राप्त करें?
और मैं Battery_Service और का उपयोग कर Battery_Level द्वारा बैटरी स्तर प्राप्त करना चाहते हैं।
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 (बैटरी लेवेल) का मान; "सच" – Wun
क्षमा करें, मुझे नहीं लगता कि मैं मदद कर सकता हूं ... शायद यह होगा: http://developer.samsung.com/forum/board/thread/view.do?boardName=SDK&messageId=240110 –