首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取二级蓝牙网关服务android

获取二级蓝牙网关服务android
EN

Stack Overflow用户
提问于 2017-05-30 23:57:05
回答 1查看 622关注 0票数 0

从蓝牙android API获取android辅助蓝牙网关服务。

下面是我们获取服务的代码:

代码语言:javascript
复制
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);
            }
        }

甚至尝试独占获取辅助服务,但它返回空对象:

代码语言:javascript
复制
 BluetoothGattService bleServ = mBluetoothGatt.getService(UUID.fromString("22222222-0000-0000-0000-000000000000"));

有没有人可以指出如何在Android中搜索二级ble服务。

EN

回答 1

Stack Overflow用户

发布于 2017-05-31 01:11:22

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44266853

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档