5.
Setting up and Handling Custom Service
The previous assignment describes the handling of Bluetooth Low Energy SIG defined device info
service, which is the predefined service available in ASF component. This assignment describes the
custom service. So, the service initialization needs to be implemented. In the context of customized
environment service, the following service description is pushed in ATBTLC1000 memory.
Figure 5-1. Custom Service
Custom Environment Service Description:
•
UUID type – Custom UUID (128-bit)
•
UUID –
1bc5d5a5-0200-a687-e511-3639c1ba5af0
Characteristic 0 (Temperature)
•
User Description – Temperature
•
UUID type – Custom UUID (128-bit)
•
UUID –
1bc5d5a5-0200-a687-e511-3639d8ba5af0
•
Properties – Read Notify
•
Value permission – No authorization required
•
Client config permission – No permission
•
Server config permission – No permission
Note:
In this definition, UUIDs are generated randomly. Custom services/characteristics are free to use
any 128-bit UUID less than the base UUID. There is no reserved space for vendors to use 16-bit or 32-bit
UUIDs.
With this definition, any temperature change is notified to the central. The notify mechanism allows the
central to know when the data changes. When "notify" property of the Client Characteristic Configuration
Descriptor is enabled by the central and the device writes the new value, then this updated value is
automatically sent to the central through a notification. The central is not required to send read
characteristic commands explicitly to the peripheral (GATT server).
To setup and handle the custom environment service in ATBTLC1000 module, the following steps are
added to the Host MCU application:
•
Configure and load the custom service
•
Update Temperature characteristic and notify to the central device
•
Receive and handle notification from the Host device
ATBTLC1000
Setting up and Handling Custom Service
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 37