BlueNRG-1 remote
control demo application
UM2264
32/55
DocID030868 Rev 1
9
BlueNRG-1 remote control demo application
The BlueNRG-1 BLE remote control application is supported on the SPBTLE-1S or
BlueNRG-1 development platforms (STEVAL-IDB007V1or STEVAL-IDB007V1M). It
demonstrates how to control a remote device (like an actuator) using a BlueNRG-1 device.
This application periodically broadcasts temperature values that can be read by any device.
The data is encapsulated in a manufacturer-specific AD type and the content (besides the
manufacturer ID, i.e., 0x0030 for STMicroelectronics) is as follows:
Table 7: BLE remote advertising data
Byte 0
Byte 1
Byte2
App ID (0x05)
Temperature value (little-endian)
The temperature value is given in tenths of degrees Celsius.
The device is also connectable and exposes a characteristic used to control LEDs DL1,
DL2 and DL3 on the BlueNRG-1 platform. The value of this characteristic is a bitmap of 1
byte. Each bit controls one of the LEDs:
bit 0 is the status of LED DL1
bit 1 is the status of LED DL2
bit 2 is the status of LED DL3
A remote device can therefore connect and write this byte to change or read the status of
these LEDs (1 for LED ON, 0 for LED OFF).
The peripheral disconnects after a timeout (
DISCONNECT_TIMEOUT
) to prevent a central
device remaining connected to the device indefinitely.
Security is not enabled by default, but this can be changed with
ENABLE_SECURITY
(refer
to file BLE_RC_main.h). When security is enabled, the central device must be
authenticated before reading or writing the device characteristic.
To interact with a device configured as a BlueNRG-1 BLE remote control, another BLE
device (a BlueNRG-1 or any Bluetooth
®
smart ready device) can be used to detect and
view broadcast data.
To control one of the LEDs, the device has to connect to a BlueNRG-1 BLE remote control
device and write in the exposed control point characteristic. The Service UUID is ed0ef62e-
9b0d-11e4-89d3-123b93f75cba. The control point characteristic UUID is ed0efb1a-9b0d-
11e4-89d3-123b93f75cba.
9.1
BLE remote control application setup
This section describes how to configure a BlueNRG-1 device to acting as a remote control
device.
9.1.1
Initialization
The BlueNRG-1 BLE stack must be correctly initialized before establishing a connection
with another Bluetooth LE device. This is done with two commands:
aci_gatt_init();
aci_gap_init(GAP_PERIPHERAL_ROLE, 0, 0x07, &service_handle, &dev_name_char_handle,
&appearance_char_handle);