7.3.1 Creating Custom GATT Services
To create a private GATT service, enter the following configuration commands:
- Power on the RNBD350 module by connecting the RNBD350 Add On Board using a USB Type-C cable to the host PC.
- Using the terminal emulator (TeraTerm), open the COM port associated with the RNBD350 module with the following settings.
- Go to Setup>Terminal.
- Under the New-line section, select CR+LF (Carriage Return, Line Feed) from the drop-down lists for better reading of data.
Figure 7-21. TeraTerm Serial Port Setup Figure 7-22. TeraTerm Terminal Setup - Enter into Command mode:
- Type the Command mode sequence $$$ to enter the Command mode.
- Enter + to turn on ECHO.
- 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 a factory Reset. - Enter
- Create the private GATT service with three characteristics by entering the following command:
PS,4D6963726F636869702D524E34383730 PC,BF3FBD80063F11E59E690002A5D5C501,02,02 PC,BF3FBD80063F11E59E690002A5D5C502,08,02 PC,BF3FBD80063F11E59E690002A5D5C503,18,04
Figure 7-23. PS and PC Command - 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 second parameter in each command appears to represent a specific action or operation to be performed:
02 is used for reading
08 is used for writing
18 is used for combined write and notify operations
- 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 the Command mode.
- Issue the
LS
command to list the services.Figure 7-24. LS Command