相关疑难解决方法(0)

BLE获得在广告包中编码的uuid

我试图获得uUID的ble设备.我正在关注Android开发人员指南,到目前为止我只能得到设备名称和rssi.我试图得到Uuid的设备,扫描方法看起来像这样:

    public void onLeScan(final BluetoothDevice device, int rssi,byte[] scanRecord) {

        ParcelUuid[] myUUid =device.getUuids();
        for(ParcelUuid a :myUUid){
            Log.d("UUID",a.getUuid().toString());
        }
        String s = new String(scanRecord);
        int len = scanRecord.length;
        String scanRecords =new String(scanRecord) ;



        deviceMap.put(device.getName().toString(), rssi);
        Message msg = MainActivity.myHandler.obtainMessage();
        Bundle bundle = new Bundle();
        bundle.putCharSequence("dev_name", device.getName().toString());
        bundle.putCharSequence("rssi", Integer.toString(rssi));
        msg.setData(bundle);
        MainActivity.myHandler.sendMessage(msg);
   }
Run Code Online (Sandbox Code Playgroud)

返回 - btif_gattc_upstreams_evt:事件4096

android bluetooth

18
推荐指数
1
解决办法
3万
查看次数

标签 统计

android ×1

bluetooth ×1