Event Processing
www.ti.com
24
SWRU271H–October 2010–Revised April 2019
Submit Documentation Feedback
Copyright © 2010–2019, Texas Instruments Incorporated
The Application and Profiles
4.5.2 OSAL Messages
OSAL messages can come from various layers of the Bluetooth Low Energy stack. For example, these
messages can be from key presses sent by the HAL. The application has code specific to the Keyfob
reference hardware in the CC2540/41DK-MINI development kit. This code is surrounded by the
preprocessor directive #if defined (CC2540_MINIDK) and gets compiled when using the CC2540/41DK-
MINI Keyfob configuration. This code adds the TI-proprietary simple keys service to the GATT server and
handles key presses through the simple keys profile.
Each time you press or release a key on the keyfob, HAL sends an OSAL message to the application. As
Section 3.5 describes, this action causes a SYS_EVENT_MSG event to occur. This event is handled in
the application by the function simpleBLEperipheral_ProcessOSALMsg(). In the current
SimpleBLEPeripheral application, the KEY_CHANGE message is the only recognized OSAL message
type. You can define additional message types. The KEY_CHANGE message event processing calls the
calls the simpleBLEPeripheral_HandleKeys() function, which checks the state of the keys.
4.6 Callbacks
Other than processing events, application code can also within the callback functions defined by the
application such as simpleProfileChangeCB() and peripheralStateNotificationCB(). These callbacks
process in the context of the task that called them. Processing should be limited in these callbacks. If any
intensive processing must be done, send an event from the callback to the application so that processing
can occur. For more information, see Section 4.5.