Files | Macros | Functions | Variables
SendAccelerometerDataOverBle

Demo application of Transmitting BMA280 Accelerometer data on BLE(Bluetooth Low Energy) every configured interval (APP_CONTROLLER_TX_DELAY) More...

+ Collaboration diagram for SendAccelerometerDataOverBle:

Files

file  AppController.c
 

Macros

#define APP_CONTROLLER_BLE_END_TRIGGER   UINT32_C(0)
 
#define APP_CONTROLLER_BLE_RX_BUFFER_SIZE   UINT8_C(20)
 
#define APP_CONTROLLER_BLE_SEND_TIMEOUT_IN_MS   UINT32_C(1000)
 
#define APP_CONTROLLER_BLE_START_TRIGGER   UINT32_C(1)
 
#define APP_CONTROLLER_BLE_TX_LEN   UINT8_C(16)
 
#define APP_TEMPERATURE_OFFSET_CORRECTION   (-3459)
 
#define BCDS_MODULE_ID   XDK_APP_MODULE_ID_APP_CONTROLLER
 

Functions

void AppController_Init (void *cmdProcessorHandle, uint32_t param2)
 Gives control to the Application controller. More...
 
static void AppControllerBleDataRxCB (uint8_t *rxBuffer, uint8_t rxDataLength, void *param)
 This is the BLE data receive callback function. More...
 
static void AppControllerBleStartOrEndMsgSend (void *param1, uint32_t param2)
 This will send start or stop message based on input parameter. More...
 
static void AppControllerEnable (void *param1, uint32_t param2)
 To enable the necessary modules for the application. More...
 
static void AppControllerFire (void *pvParameters)
 Responsible for controlling the BLE Example application control flow. More...
 
static void AppControllerSetup (void *param1, uint32_t param2)
 To setup the necessary modules for the application. More...
 

Variables

static CmdProcessor_TAppCmdProcessor
 
static bool AppControllerBleTransmitPayload = false
 
static xTaskHandle AppControllerHandle = NULL
 
static BLE_Setup_T BLESetupInfo
 
static Sensor_Setup_T SensorSetup
 

Detailed Description

This example demonstrates how to read sensor values from the BMA280 Acceleration sensor and streams them over Bluetooth Low Energy via custom Bi-Directional Service.
Either use your Android or iOS mobile phone (see Android or iOS App Store) to connect to XDK and receive the data. Send command start (HEX: 0x7374617274) to XDK via Bluetooth Low Energy, so that streaming of data begins. To stop the streaming send command end (HEX: 656e64)

This Application enables the bi-directional service in ble and sends Accelerometer Data over ble .
Bi-Directional Service :

Service Characteristic Attribute-Type UUID
BidirectionalService NA uint8_t b9e875c0-1cfa-11e6-b797-0002a5d5c51b
NA Rx uint8_t X[20] 0c68d100-266f-11e6-b388-0002a5d5c51b
NA Tx uint8_t X[20] 1ed9e2c0-266f-11e6-850b-0002a5d5c51b

Macro Definition Documentation

#define APP_CONTROLLER_BLE_END_TRIGGER   UINT32_C(0)

BLE end command send application logic

#define APP_CONTROLLER_BLE_RX_BUFFER_SIZE   UINT8_C(20)

Size of BLE receive buffer

#define APP_CONTROLLER_BLE_SEND_TIMEOUT_IN_MS   UINT32_C(1000)

Timeout for BLE send

#define APP_CONTROLLER_BLE_START_TRIGGER   UINT32_C(1)

BLE start command send application logic

#define APP_CONTROLLER_BLE_TX_LEN   UINT8_C(16)

Size of accelerometer complete payload in bytes with spaces in-between the axis values and NULL terminator

#define APP_TEMPERATURE_OFFSET_CORRECTION   (-3459)

Macro for static temperature offset correction. Self heating, temperature correction factor

#define BCDS_MODULE_ID   XDK_APP_MODULE_ID_APP_CONTROLLER

Function Documentation

void AppController_Init ( void *  cmdProcessorHandle,
uint32_t  param2 
)

This is a template function where the user can write his custom application.

Refer interface header for description

+ Here is the call graph for this function:

static void AppControllerBleDataRxCB ( uint8_t *  rxBuffer,
uint8_t  rxDataLength,
void *  param 
)
static

Callback function called on data reception over BLE.

Parameters
[in]rxBufferpointer to the received data buffer
[in]rxDataLengthLength of the received data
[in]paramunused
Note
Do not perform any heavy processing within this function and return ASAP.
Parameters
[in]rxBuffer: Buffer in which received data to be stored.
[in]rxDataLength: Length of received data.
[in]paramUnused

+ Here is the call graph for this function:

static void AppControllerBleStartOrEndMsgSend ( void *  param1,
uint32_t  param2 
)
static
Parameters
[in]param1Unused, Reserved for future use
[in]param2Differentiates start and stop command. APP_CONTROLLER_BLE_START_PAYLOAD for start. APP_CONTROLLER_BLE_END_PAYLOAD for stop.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppControllerEnable ( void *  param1,
uint32_t  param2 
)
static
  • BLE
  • Sensor
Parameters
[in]param1Unused
[in]param2Unused

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppControllerFire ( void *  pvParameters)
static
  • Check whether the BLE connection is available
  • Read the sampled Sensor data
  • Send sensor data via. BLE.
  • Wait for APP_CONTROLLER_BLE_TX_DELAY before proceeding to redoing the above steps
Parameters
[in]pvParametersUnused

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppControllerSetup ( void *  param1,
uint32_t  param2 
)
static
  • BLE
  • Sensor
Parameters
[in]param1Unused
[in]param2Unused

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

CmdProcessor_T* AppCmdProcessor
static

Handle to store the main Command processor handle to be used by run-time event driven threads

bool AppControllerBleTransmitPayload = false
static

Boolean representing if BLE needs to be streamed. Validate the repeated start flag

xTaskHandle AppControllerHandle = NULL
static

OS thread handle for Application controller to be used by run-time blocking threads

BLE_Setup_T BLESetupInfo
static
Initial value:
=
{
.IsMacAddrConfigured = false,
.MacAddr = 0UL,
.IsDeviceCharacteristicEnabled = false,
.CharacteristicValue =
{
.ModelNumber = NULL,
.Manufacturer = NULL,
.SoftwareRevision = NULL
},
.CustomServiceRegistryCB = NULL,
}
#define APP_CONTROLLER_BLE_DEVICE_NAME
Definition: AppController.h:106
#define NULL
Definition: BCDS_Basics.h:80
Definition: XDK_BLE.h:66
static void AppControllerBleDataRxCB(uint8_t *rxBuffer, uint8_t rxDataLength, void *param)
This is the BLE data receive callback function.
Definition: AppController.c:236

BLE setup parameters

Sensor_Setup_T SensorSetup
static

Sensor setup parameters


This documentation file has been automatically generated on Fri Oct 4 2019 03:47:43 by doxygen 1.8.8