TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 17 of 36
Copyright © 2011-2015 Texas Instruments, Inc
Function cycling_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE message: Call function sensor_HandleKeys to handle key presses.
6.2.3 Callbacks
The application callback functions are as follows:
SensorGAPStateCB: This is the GAP event callback. It processes GAP events for
startup and link connect/disconnect.
SensorCB: This is the RSC service callback. It handles enabling or disabling periodic
RSC measurements when notifications of the RSC measurements are enabled or
disabled. Additionally, it informs the application when the peer device has updated a
sensor location or changed the cumulative distance traveled.
6.2.4 Sending Notifications
The application sends notifications of the RSC measurements when configured to do so by the
peer device. When the peer device configures the RSC measurements for notification the
application will receive a RSC service callback. The application starts a timer to begin periodic
simulated RSC measurements for a bicycle. When the timer expires the application calls
sensorMeasNotify to build and send a measurement using the RSC service API.
6.2.5 Confirming Indications
When the peer device writes to the sensors control point characteristic the peer device will
receive an indication in response. When the indication is received by the peer device, the device
must send an ATT_HandleValueConfirmation back to the server.
6.2.6 Reading from the Sensor
The RSC service has 2 readable characteristics: Features and Sensor Location. Sending a read
request to the Features characteristic triggers a response packet containing a byte array of the
feature capabilities of the sensor which are as follows:
Instantaneous Stride Length
Walking or Running Status
Total distance
Multiple sensor locations
Sensor Calibration Procedure Supported
Sending a read request to the Sensor Location characteristic triggers a response packet
containing the set position of the sensor on the body. This value may be set by writing to the
control point (see below), requesting a sensor location update.
6.2.7 Writing to the Sensor
The CSC service has one writeable characteristic: the Control Point. A write request can be set
with the following requests:
RSC_SET_CUMM_VAL: Set the total distance traveled field.
RSC_START_SENS_CALIB: Calibrate the sensor. Not supported under current
profile spec, but it is required.
RSC_UPDATE_SENS_LOC: Update the location of the sensor.
RSC_REQ_SUPP_SENS_LOC: Request the list of supported sensor locations.
A response will be sent as an indication to the peer device after a write response it received. The
indication includes the RSC_COMMAND_RSP code, the requested operation code, and a code
indicating success or failure. If the command was a request for a list of valid sensor locations,
then the indication will also include a byte array containing the valid sensor locations.