TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 7 of 36
Copyright © 2011-2015 Texas Instruments, Inc
The peer device may also discover the device information service for more information such as
mfg and serial number.
Once blood pressure measurements have been enabled the application will begin sending data to
the peer containing simulated measurement values. Pressing the left button cycles through
different data formats as follows:
MMHG | TIMESTAMP | PULSE | USER | STATUS
MMHG | TIMESTAMP
MMHG
KPA
KPA | TIMESTAMP
KPA |TIMESTAMP | PULSE
If the peer device initiates pairing, it will be done following Just Works model since MITM is not
set and DisplayOnly capability is available on the blood pressure sensor.
Upon termination, the BPM will not begin to advertising again until the button is pressed.
The peer device may also query the blood pressure for read only device information. Further
details on the supported items are listed in the GATT_DB excel sheet for this project. Examples
are model number, serial number, etc.
2.2 Software Description
The application is implemented in the file bloodpressure.c.
2.2.1 Initialization
The initialization of the application occurs in two phases: first, the Bloodpressure_Init function is
called by the OSAL. This function configures parameters in the peripheral profile, GAP, and GAP
bond manager. It also sets up the blood pressure service along with standard GATT and GAP
services in the attribute server. Then it sets an OSAL START_DEVICE_EVT event. This triggers
the second phase of the initialization, which can be found within the
Bloodpressure_ProcessEvent function. During this phase, the GAPRole_StartDevice function
is called to set up the GAP functions of the application. Then GAPBondMgr_Register is called to
register with the bond manager.
2.2.2 Event Processing
The application has two main event processing functions, Bloodpressure_ProcessEvent and
Bloodpressure_ProcessOSALMsg.
Function Bloodpressure_ProcessEvent handles events as follows:
SYS_EVENT_MSG: Service the OSAL queue and process OSAL messages.
BP_START_DEVICE_EVT: Start the device, as described in the previous section.
BP_START_DISCOVERY_EVT: Start discovery, search for time service on collector.
TIMER_BPMEAS_EVT: Perform final measurement
BP_TIMER_CUFF_EVT: Perform a cutoff measurement
BP_DISCONNECT_EVT: Disconnect after sending measurement
Function Bloodpressure_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE: Handle key presses.
GATT_MSG_EVENT: This will handle reception of time information from collector.
2.2.3 Callbacks
The application callback functions are as follows:
PeripheralStateNotificationCB: This is the GAP event callback. It processes GAP
events for startup and link connect/disconnect.