[英]Get secondary bluetooth gatt service android
Fetch android secondary bluetooth gatt service from bluetooth android API's. 从蓝牙android API获取android二级蓝牙gatt服务。
Currently below is the code where we fetch ble services : 目前,下面是我们获取服务的代码:
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
List<BluetoothGattService> gattServices = mBluetoothGatt.getServices();
Log.e("onServicesDiscovered", "Services count: "+gattServices.size());
BluetoothGattService bleServ = mBluetoothGatt.getService(UUID.fromString("22222222-0000-0000-0000-000000000000"));
for (BluetoothGattService gattService : gattServices) {
String serviceUUID = gattService.getUuid().toString();
Log.e("onServicesDiscovered", "Service uuid "+serviceUUID);
}
} else {
Log.w(TAG, "onServicesDiscovered received: " + status);
}
}
Even tried fetching exclusively the secondary service but it returns null object : 甚至尝试专门获取辅助服务,但它返回null对象:
BluetoothGattService bleServ = mBluetoothGatt.getService(UUID.fromString("22222222-0000-0000-0000-000000000000"));
Can someone point any pointers how to search secondary ble service in Android. 有人可以指出任何指针如何在Android中搜索辅助ble服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.