2016 Microchip Technology Inc. DS50002466A-page 41
2.8 SERVICE CONFIGURATION COMMANDS
The Bluetooth SIG defines public profiles, services and characteristics. The SIG pub-
lishes the specifications and requires conformance testing for any device using a public
profile to ensure interoperability between Bluetooth devices.
For use cases not covered by public service, Bluetooth allows the creation of a private
service. The RN4870 provides private and public services/characteristics in a GATT
server and can work with private service/characteristics in a GATT client role.
Note that all Bluetooth adopted public service/characteristics have a 16-bit short UUID.
All private services/characteristics use a 128-bit long UUID.
All service/characteristic configuration commands start with letter “P”. The main func-
tion of those commands is to define services and their characteristics. All definitions are
saved in NVM which can be restored after power cycle.
Command SS adjusts the default services. Any adjustment to the default service erases
all custom service configuration. In cases where the user prefers to use default and
custom services at the same time, default service must be defined first by command
SS, before any service configuration commands are used.
2.8.1
PC,<hex16/hex128>,<hex8>,<hex8>
Command PC sets private characteristic. It expects three parameters:
• The first parameter is a 16-bit UUID for public characteristic or a 128-bit UUID for
private characteristic. There are many ways to generate a 128-bit UUID with little
possibility of conflict. For more details on UUID, refer to Wikipedia
(http://en.wikipedia.org/wiki/Universally_unique_identifier).
• The second parameter is a 8-bit property bitmap of the characteristic. Refer to
Tabl e A- 1 in Appendix A. “Bluetooth Low Energy Fundamentals” for
characteristic property.
• The third parameter is an 8-bit value that indicates the maximum data size in octet
where the value of the characteristic holds in the range from 1 to 20 (01 to 14 in
hex format). The real data size can be smaller.
Command PC must be called after service UUID has been set by command PS. Refer
to Section 2.8.2 “PS,<hex16/hex128>” for command PS. If service UUID is set to be
a 16-bit public UUID in command PS, then the UUID input parameter for command PC
must also be a 16-bit public UUID. Similarly, if service UUID is set to be a 128-bit private
UUID by command PS, then the UUID input parameter must also be a 128-bit private
UUID by command PC. Calling this command adds one characteristic to the service at
a time. Calling this command later does not overwrite the previous settings, but adds
another characteristic instead.
Note: RN4870/71 supports up to five public services and four private characteris-
tics. Each service supports up to eight characteristics.
Example: PC,11223344556677889900AABBCCDDEEFF,1A,05
// Define a private characteristic with UUID
// 0x11223344556677889900AABBCCDDEEFF.
// It is readable, writable and can perform notification.
// Maximum data size for this characteristic is five octets.
Response: AOK
ERR
// Success
// Syntax error, invalid parameter or not enough space
// to add new characteristics