The demo application provides a
description on how to use the demo application to connect two configured boards and
communicate over Bluetooth Low Energy (BLE). The included application registers a
custom service on a board when the stack is initialized.
Device 1 (Server)
setup on the demo application
- To start with one of the devices has to have the Phone Alert Status running on
it. It can be started by issuing the RegisterHTP command.
- Next, the device acting as a
Server needs to advertise to other devices. This can be done by issuing the
AdvertiseLE 1.
Device 2 (Client) setup on the demo applicationNote: Steps c and d are
optional if you already know the Bluetooth address of the device that you want to
connect to.
- The Client LE device can try to find which LE devices are in the vicinity
issuing the StartScanning command.
- Once you have found the device,
you can stop scanning by issuing the StopScanning command.
Initiating connection from device 2
- Once the application on the
Client side knows the Bluetooth address of the device that is advertising, it
can connect to that device issuing the ConnectLE <Bluetooth Address>
command.
Identify supported services
- After initialization, the Client
needs to find out whether HTS services are supported and what HTS features are
available. For this, the DiscoverHTS command is run on the Client. After the
service discovery operation is complete, the HTS Service Discovery Summary is
shown and list of supported features is shown.
- After getting the list of
supported features, the next step is to configure HTS on the Client. We can
enable support for various notifications by issuing the ConfigureRemoteHTS
<Temperature Measurement Indicate> <measurement Interval Indicate>
<Intermediate Termature Notify> command.
- In our case we enable all 3.
Temperature Measurement Indication
- After configuring, the Health
Thermometer Service is now active. We can indicate the temperature with by
issuing the IndicateTemperature <Exponent> <mantissa> <Units>
<Temperature Type> command.
Note: To set a temperature
of 100 F with a timestamp of 7/24/2012 9:50AM at the body we would give the
command as IndicateTemperature 0 100 1 201207240950002
The Client gets the temperature as follows: