2.3.1 Creating Custom GATT Services
To create a private GATT service, enter the following configuration commands:
- Power on the RNBD451 module by connecting the RNBD451 Add On Board using a USB Type-C cable to the host PC.
- Using the terminal emulator (Tera Term), open the COM port associated with the RNBD451 module with the following settings.
- Go to Setup > Terminal.
- Under the “New-line” section, from the drop-down list, select CR+LF (Carriage Return, Line Feed) for better reading of data.
- Enter into Command mode:
- Type the command mode
sequence
$$$
to enter Command mode. - Enter + for turn on ECHO.
- Type the command mode
sequence
- Set to factory default:
- Enter
SF,2
and verify the module is rebooted after entering the command. - Type the command mode
sequence
$$$
to enter Command mode.
Note: Use this command only to remove previously configured services and characteristics and to bring the device to factory reset. - Enter
- Create the private GATT service
with three characteristics by entering the following command.
PS,4D6963726F636869702D524E34383730 PC,BF3FBD80063F11E59E690002A5D5C501,02,02 PC,BF3FBD80063F11E59E690002A5D5C502,02,02 PC,BF3FBD80063F11E59E690002A5D5C503,18,04
- The
PS
command creates the GATT private service, identified by UUID 16-byte value4D6963726F636869702D524E34383730
. - The
PC
command creates the characteristics in the service. Each characteristic is identified by the following UUIDs:BF3FBD80063F11E59E690002A5D5C501
,BF3FBD80063F11E59E690002A5D5C502
,BF3FBD80063F11E59E690002A5D5C503
.- The second parameter is the characteristics property, and the third parameter is the size of the data value of the characteristics.
- The
- Reboot the module using the
R,1
command to ensure the new GATT details get stored in PDS. - To verify the GATT service is
configured correctly:
- Type the command mode
sequence
$$$
to enter Command mode. - Issue the
LS
command to list the services.
- Type the command mode
sequence