简体   繁体   中英

Connecting to BLE Peripheral with No Services

I am currently working with a MicroChip BLE module that I have no control over. It seems that the engineers behind this device set up a peripheral that is advertising characteristics, but no service (Is this even possible?)

My question is: Is there any general way to access/modify these characteristics without first attempting to discover the GATT service they belong to? I know that the characteristics exist because an iOS app I have been can identify them: 在此处输入图片说明

but when I "interrogate" the peripheral, I see plenty of information, including these characteristics:

在此处输入图片说明

Finally, I tried using some Google Store BLE Scanners in addition to the BluetoothLeGatt sample on my Nexus 5, and all of them can correctly identify that this peripheral exists. However, inside the sample the following piece of code:

  mBluetoothGatt = device.connectGatt(this, false, mGattCallback);

produces the following monitor output:

 12-01 21:01:03.888 32494-32516/com.example.android.bluetoothlegatt D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=6 device=D8:80:39:F0:0C:9C

and the device is never connected to. If I could just access the characteristics without the service, I believe I could get my code to function.

There can be a difference between the services that a device advertises and the services that the device offers . On the first screen you are seeing that the device isn't advertising any services. On the second screen you are seeing the service that the device offers , this is the service with the UUID 49535343-...E455 and is only visible to the central once it has initiated a connection to the peripheral. Below that you see the characteristics that this service has.

I found this which seems to confirm that the service is "49535343-FE7D-4AE5-8FA9-9FAFD205E455"

It is unfortunate it doesn't seem to advertise a service as this means you need to connect to the device and interrogate its available services to see if it is the device you are interested in; hardly efficient.

Unfortunately I don't know anything about BLE on Android, so I can't help with the second part of your question, but searching seems to indicate that status=133 is a kind of generic "something went wrong with GATT" error, but perhaps this ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM