Record Filter Configuration; Software Description; Initialization; Event Processing - Texas Instruments CC2540 Application Manual

Bluetooth low energy
Hide thumbs Also See for CC2540:
Table of Contents

Advertisement

TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1
To disconnect press Joystick Center again.
Joystick Center again.
7.1.3

Record Filter Configuration

Glucose record requests use filters to select the records that will be operated on by the request.
These filters are configured in the collector using compile time configuration.
In file glucoseCollector.c, macro GLUCOSE_FILTER_ENABLED controls whether filters are used.
When set to FALSE, operations that read, erase, or get the number of records will operate on all
records. When set to TRUE, these operations will use either a time filter or sequence number
filter,
as
configured
CTL_PNT_FILTER_SEQNUM the collector will filter on sequence number.
CTL_PNT_FILTER_TIME the collector will filter on time.
File glucoseCollector.c has hardcoded time and sequence number filter values. These are set in
variables filterTime1, filterTime2, filterSeqNum1, and filterSeqNum2.
7.2

Software Description

The application is implemented in the following files:
glucoseCollector.c: Main initialization, event handling and callback functions.
glucose_config.c: Characteristic configuration functions.
glucose_discovery.c: Service discovery functions.
glucose_ind.c: Indication and notification handling functions.
glucose_ctlpnt.c: Record access control point functions.
7.2.1

Initialization

The initialization of the application occurs in two phases: first, the GlucColl_Init function is called
by the OSAL. This function configures parameters in the central profile, GAP, and GAP bond
manager and also initializes GATT for client operation. It also sets up 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 GlucColl_ProcessEvent
function. During this phase, the GAPCentralRole_StartDevice function is called to set up the
GAP functions of the application. Then GAPBondMgr_Register is called to register with the
bond manager.
7.2.2

Event Processing

The application has two main event processing functions, GlucColl_ProcessEvent and
GlucColl_ProcessOSALMsg.
Function GlucColl_ProcessEvent handles events as follows:
SYS_EVENT_MSG: Service the OSAL queue and process OSAL messages.
START_DEVICE_EVT: Start the device, as described in the previous section.
START_DISCOVERY_EVT: Start service discovery.
PROCEDURE_TIMEOUT_EVT: A glucose record access procedure has timed out.
Function GlucColl_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE messages: Call function GlucColl_HandleKeys to handle keypresses.
GATT_MSG_EVENT messages:
messages from GATT.
7.2.3

Callbacks

The application callback functions are as follows:
GlucCollCentralEventCB: This is the GAP event callback. It processes GAP events for
initialization, device discovery, and link connect/disconnect.
To reconnect to the same device again press
in
macro
DEFAULT_FILTER_TYPE.
Call function GlucCollProcessGATTMsg to handle
Copyright © 2011-2015 Texas Instruments, Inc
SWRU297 Version 1.4.1
When
set
to
When set to
Page 19 of 36

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cc2541

Table of Contents