EasyManuals Logo
Home>Texas Instruments>Microcontrollers>CC2541

Texas Instruments CC2541 Application Guide

Texas Instruments CC2541
36 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #31 background imageLoading...
Page #31 background image
TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 31 of 36
Copyright © 2011-2015 Texas Instruments, Inc
START_DEVICE_EVT: Start the device, as described in the previous section.
START_DISCOVERY_EVT: Start service discovery.
CLOCK_UPDATE_EVT: Update the clock display.
Function timeApp_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE messages: Call function timeApp_HandleKeys to handle keypresses.
GATT_MSG_EVENT messages: Call function timeAppProcessGATTMsg to handle
messages from GATT.
16.2.3 Callbacks
The application callback functions are as follows:
timeAppGapStateCB: This is the GAP event callback. It processes GAP events for
startup and link connect/disconnect.
timeAppPairStateCB: This is the GAP bond manager state callback. It displays the
status of pairing and bonding operations.
timeAppPasscodeCB: This is the GAP bond manager passcode callback. It generates
and displays a passcode.
16.2.4 Service Discovery
The application performs service discovery for several Bluetooth LE services. Discovery is
initiated when a connection is established to a peer device with which there is no existing bond.
Discovery starts when the discovery delay timer expires, which sets event
START_DISCOVERY_EVT. This will result in execution of function timeAppDiscStart. However
if a pairing procedure is in progress when the timer expires discovery will be postponed until
pairing completes. This is done in case the peer device requires security before its characteristics
are read or written.
A service discovery procedure is performed for each service until discovery has been attempted
on all services of interest. The service discovery procedure is generalized as follows:
1. Discovery the service by UUID.
2. If found, discover all characteristics of the service. Cache the handles of characteristics
of interest.
3. If a discovered characteristic uses a client characteristic configuration descriptor
(abbreviated as CCCD in the code), discover all descriptors of the characteristic.
If the mandatory characteristics and descriptors of the service are discovered then discovery of
the service is deemed successful.
The handles of discovered characteristics of interest are stored in array timeAppHdlCache.
The main service discovery function is timeAppDiscGattMsg. This function is executed when a
discovery-related GATT message response is received. This function then executes a separate
discovery function for each service. The service discovery state is maintained in variable
timeAppDiscState.
16.2.5 Service Configuration
When service discovery completes the service configuration procedure is initiated. This procedure
reads and writes characteristics of interest in the discovered services.
The main service configuration function is timeAppConfigNext. This function searches the
cached handle array for the next characteristic of interest, and once found it performs a read or
write on that characteristic.
When a GATT read response or write response is received, function timeAppConfigGattMsg is
called. This function processes the received response and performs an action, such as updating
the clock display, and then calls timeAppConfigNext to initiate the next read or write.

Table of Contents

Other manuals for Texas Instruments CC2541

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments CC2541 and is the answer not in the manual?

Texas Instruments CC2541 Specifications

General IconGeneral
BrandTexas Instruments
ModelCC2541
CategoryMicrocontrollers
LanguageEnglish

Related product manuals