BluetoothのLE ScanResultはNULLを返しているが、私は私の周辺は、心拍サービスUUIDを(サードパーティ製のアプリBLEによって検証される)ブロードキャストしている知っています。どうして?

エッシャー:

私はGATTサービスのUUID(すなわち戻っていない私のBLEスキャンのことでイライラしていscanRecord.getServiceUUIDs()リターンをnull)。しかし、私は私の心拍周辺)が作業し、心拍サービスは水色アプリによって発見(と読める)されているため、正常に広告している知っています。ここに私の関数は、私の中にありますScanCallbackオブジェクト:

override fun onScanResult(callbackType: Int, result: ScanResult?) {
    super.onScanResult(callbackType, result)
    // This log shows that result.mServiceUuids is null
    Log.i(TAG, "BLEDeviceManager.ScanCallback.onScanResult: ${result.toString()}")

    // TODO: handle null ScanResult
    val parcelUuids = if (result.getScanRecord() != null) result.getScanRecord()!!.getServiceUuids() else null
    if (parcelUuids == null) {
        Log.i(TAG, "parcelUUids was null for scanRecord = ${result.getScanRecord()!!.toString()}")
        return
    }
    val serviceList = ArrayList<UUID>()
    for (i in parcelUuids.indices) {
        val serviceUUID = parcelUuids.get(i).getUuid()
        if (!serviceList.contains(serviceUUID))
            serviceList.add(serviceUUID)
    }
    Log.i(TAG, "Here is a list of the service UUIDs: $serviceList")
}

ここでは、ログです:

I / BLEDeviceManager:parcelUUidsはscanRecord = ScanRecord [mAdvertiseFlags = 6、mServiceUuids =ヌル、mServiceSolicitationUuids =ヌル、mManufacturerSpecificData = {}、mServiceData = {}、mTxPowerLevel = 3、mDeviceName = blehr_sensor_1.0]にNULLでした

私はそれを間違ったように何をやっているmServiceUuids、常にnullですが?

マルタインバンWelie:

ScanRecordあなたの出力によると、お使いのデバイスは、任意のサービスのUUIDを宣伝されていません。それはそれはそれをアドバタイズしません....それは、そのサービスを持っていないという意味ではありません。

あなたはそれに接続し、それが本当に持っているサービスのリストを取得するには()discoverServicesを呼び出したいかもしれません...

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=320555&siteId=1
おすすめ