2016 Microchip Technology Inc.
DS50002547A-page 25
Command
PC
expects three parameters. The first parameter is the UUID, the
second parameter is the characteristic property (refer to
in
C. “Bluetooth Low Energy Primer”
), and the third parameter is the size of the
data value of the characteristic.
4. Reboot the module using command
R,1
to ensure that the new GATT service
takes effect
5. Verify that the GATT service is correctly configured.
6. Enter Command mode (
$$$
) after rebooting the module.
7. Issue the
LS
command to list the GATT server services and their characteristics.
The response is illustrated in
.
FIGURE 3-10:
PRIVATE SERVICES DISPLAY FROM
LS
COMMAND
3.6
ACCESSING GATT SERVICE USING UART COMMANDS AND
SMARTDISCOVER APP
The result of the command
LS
is shown in
. A custom GATT service (UUID:
4D6963726F636869702D524E34383730) with three characteristics identified by
low-order bytes
C501
,
C502
and
C503
from the 128-bit UUID. A 16-bit handle is
assigned to each characteristic. Handles are used to reference and identify 128-bit
characteristic UUIDs more efficiently in the GATT service.
Note that there are two references for
C503
characteristic. In the first case, in reference
0076
, the property value
08
has the write property enabled (refer to
in
Appendix C. “Bluetooth Low Energy Primer”
). Likewise, reference
0077
has the
notification property
10
enabled. This means that to write a value to characteristic
C503
, reference
0076
is used. To enable Client notifications on this characteristic,
reference
0077
is used.
The following examples show how to read and write GATT characteristic values by
using UART commands:
1. To write a value to the GATT Server characteristic
C501
, use the Server Handle
Write (
SHW
) and the Server Handle Read (
SHR
) commands with reference
0072
as first parameter, following by hex-byte values as shown in
.