edgexfoundry-holding / device-bluetooth-c

Apache License 2.0
5 stars 4 forks source link

README: Please add details of pairing & GATT support #25

Open tonyespy opened 4 years ago

tonyespy commented 4 years ago

A few additional things need to be explained:

FraserG01 commented 4 years ago

@tonyespy

The README says very little about pairing/security of the BLE connections. I assume that the DS configures itself to indicate no keyboard/no display, so the only pairing supported would be "Just Works". I also assume the DS always acts as a BLE client, and will initiate pairing during discovery if a device is found that's listed in the configuration, correct? Does the device always have to be put into discovery mode, or if it's been paired once, will it autoconnect the next time?

This device service doesn’t pair with devices. The discovery uses BlueZ to look for any bluetooth devices around and logs their details. Once the discovery has completed and the device service initialisation is complete any read and write commands that come in will use the device's MAC address to perform a connection to the specified device. If this device was not logged by BlueZ during discovery then BlueZ will not be able to perform a connection to the device. If it does have the device logged then it will connect, perform the reading/writing and then disconnect again.

I have added an extra paragraph that explains the need for discovery.

Although the README mentions that the DS only supports the GATT profile, it doesn't say to what extent. Is there any discovery of services and characteristics, or is everything just statically configured in the device profile? Does someone just define a set of device resources that map to specific service/characteristics? Are notifications or indications supported? An example might be helpful.

BLE GATT device resources are statically configured in the device profile. These resources map their GATT characteristic UUID’s to read/write specific values.

Some GATT characteristics are vendor specific though, meaning they don't follow standard data types. Some Vendor-specific devices still return data in a final readable format, such as an Integer or a Float. However, some of these characteristics don't. In order to convert the data into a readable format that can be used within EdgeX, conversion options are available, these are very specific to each manufacturer however, more can be registered in conversion.c.

I have updated the README explaining this, giving examples.

Changes have been made in PR: https://github.com/edgexfoundry-holding/device-bluetooth-c/pull/26

Loris94 commented 3 years ago

The discovery uses BlueZ to look for any bluetooth devices around and logs their details.

@FraserG01 Does this mean that I should see some info printed on screen if devices are found during discovery? What would they look like? I'm checking with blmon during the discovery and I can see that my GATT server is found but I don't have any confirmation from the ds.