UM2264
BlueNRG-1 chat
demo application
DocID030868 Rev 1
27/55
7
BlueNRG-1 chat demo application
The BlueNRG-1 chat demo (server and client roles) is supported on the SPBTLE-1S or
BlueNRG-1 development platform (STEVAL-IDB007V1 or STEVAL-IDB007V1M). It
implements simple two-way communication between two BlueNRG-1 devices,
demonstrating point-to-point wireless communication using the BlueNRG-1 product.
This demo application exposes a single chat service with the following (20 byte max.)
characteristic values:
The TX characteristic, with which the client can enable notifications; when the server
has data to be sent, it sends notifications with the value of the TX characteristic.
The RX characteristic, is a writable characteristic; when the client has data to be sent
to the server, it writes a value in this characteristic.
There are two device roles which can be selected through the specific project workspace:
The Server that exposes the chat service (BLE peripheral device).
The Client that uses the chat service (BLE central device).
The application requires two devices to be programmed with respective server and client
roles. These must be connected to a PC via USB with an open serial terminal for each
device, with the following configurations:
Table 6: Serial port configuration
Parameter
value
Baudrate
115200 bit/s
Data bits
8
Parity bits
None
Stop bits
1
The application listens for keys typed in one device terminal and sends them to the remote
device when the return key is pressed; the remote device then outputs the received RF
messages to the serial port. Therefore, anything typed in one terminal becomes visible in
the other.
7.1
Peripheral and central device setup
This section describes how two BLE chat devices (server-peripheral and client-central)
interact with each other in order to set up a point-to-point wireless chat.
BlueNRG-1 must first be set up on both devices by sending a series of API commands to
the processor.
7.1.1
Initialization
The BlueNRG-1 BLE stack must be correctly initialized before establishing a connection
with another BLE device. This is done with
aci_gatt_init()
and
aci_gap_init()
APIs:
aci_gatt_init();
BLE Chat server role:
aci_gap_init(GAP_PERIPHERAL_ROLE, 0, 0x08, &service_handle, &dev_name_char_handle,
&appearance_char_handle);