XDK API  3.6.0
Documentation
Files | Macros | Functions | Variables
VirtualXdkDemo

Demo Application for Virtual XDK mobile application. More...

+ Collaboration diagram for VirtualXdkDemo:

Files

file  AppController.c
 

Macros

#define APP_CONTROLLER_STEP1   UINT32_C(0)
 
#define APP_CONTROLLER_STEP2   UINT32_C(1)
 
#define BCDS_MODULE_ID   XDK_APP_MODULE_ID_APP_CONTROLLER
 
#define BLE_SEND_TIMEOUT_IN_MS   UINT32_C(1000)
 
#define LEM_SENSOR_DATA_VOLTS_TO_MICROVOLTS   UINT32_C(1000000)
 
#define NOISE_RMS_ADC_SAMPLES   UINT32_C(30)
 
#define NOISE_RMS_AVG_RANGE_IN_MV   0.005f
 
#define NOISE_SAMPLING_FREQUENCY   (20000UL)
 
#define NOISE_SENSOR_DATA_VOLTS_TO_MILLIVOLTS   1000.0f
 

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)
 
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 Virtual XDK demo application control flow. More...
 
static void AppControllerSetup (void *param1, uint32_t param2)
 To setup the necessary modules for the application. More...
 
static void AppSpecificLedIndication (bool bleConnectionStatus)
 This function is to control the Application specific LED indication for BLE connection status. More...
 
static void Button1EventCallback (ButtonEvent_T buttonEvent)
 
static void Button2EventCallback (ButtonEvent_T buttonEvent)
 
static uint8_t * ConvertDecimalToSTring (uint8_t data, uint8_t *str)
 Convert Decimal/Hex value to String Format to display Version Information. More...
 
static void ConvertInteger32ToVersionString (uint32_t xdkVersion, uint8_t *str)
 This function is to convert the integer data into a string data. More...
 
static Retcode_T CurrentExternalHWConnected (ExternalSensor_Target_T *currentHw)
 
static void GetFwVersionInfo (void)
 This function to Get the Firmware Version by combining the XDK SW Release (i.e., Workbench Release) version (i.e., 3.2.0) More...
 
static void HandleExternalHwHotPlug (ExternalSensor_Target_T *connectedHw)
 
static void NoiseSensorTask (void *pvParameters)
 Responsible for reading the RMS voltage of noise sensor. More...
 
static Retcode_T SampleAndNotifyHighPriorityData (void)
 

Variables

static CmdProcessor_TAppCmdProcessor
 
static xTaskHandle AppControllerHandle = NULL
 
static BLE_Setup_T BLESetupInfo
 
static uint8_t Button1Status = 0
 
static uint8_t Button2Status = 0
 
static Button_Setup_T ButtonSetup
 
static uint32_t DataSampleRateInMs = 200
 
static ExternalSensor_Setup_T ExternalSensorSetup
 
ExternalSensor_Target_T ExtHwConnected = XDK_EXTERNAL_INVALID
 
static bool extTempHwConnectStatus = false
 
static uint8_t IsUseBuiltInSensorFusion = 1
 
static bool lemHwConnectStatus = false
 
static uint8_t ManufacturerCharacteristicValue [] = "Robert Bosch GmbH"
 
static uint8_t ModelNumberCharacteristicValue [] = "XDK110"
 
static volatile float NoiseRmsVoltage = 0.0f
 
static xTaskHandle NoiseSensorHandle = NULL
 
static uint16_t SampleCounter = 0
 
static bool SensorDataStartSampling = false
 
static Sensor_Setup_T SensorSetup
 
static uint8_t SoftwareRevisionCharacteristicValue [10U] = { 0 }
 
static Storage_Setup_T StorageSetup
 
const VirtualSensor_Enable_T VirtualSensors
 

Detailed Description

In this application, XDK is presented in a playful fashion on a mobile device that is connected to XDK via BLE. Interacting with the physical XDK will manipulate the virtual XDK.

The web links to get the Android/iOS App is given below:
Android App: Click_Here
iOS App: Click_Here
For further documentation please refer the page Virtual XDK Application Guide

Macro Definition Documentation

#define APP_CONTROLLER_STEP1   UINT32_C(0)
#define APP_CONTROLLER_STEP2   UINT32_C(1)
#define BCDS_MODULE_ID   XDK_APP_MODULE_ID_APP_CONTROLLER
#define BLE_SEND_TIMEOUT_IN_MS   UINT32_C(1000)
#define LEM_SENSOR_DATA_VOLTS_TO_MICROVOLTS   UINT32_C(1000000)
#define NOISE_RMS_ADC_SAMPLES   UINT32_C(30)
#define NOISE_RMS_AVG_RANGE_IN_MV   0.005f
#define NOISE_SAMPLING_FREQUENCY   (20000UL)

ADC sampling frequency in hertz (Hz)

#define NOISE_SENSOR_DATA_VOLTS_TO_MILLIVOLTS   1000.0f

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

+ Here is the call graph for this function:

static void AppControllerEnable ( void *  param1,
uint32_t  param2 
)
static
  • BLE
  • Sensor
    • Internal
    • External
    • Virtual
  • Storage
  • LED
  • Button

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppControllerFire ( void *  pvParameters)
static
  • Wait for BLE to be connected
  • Based on user need, sample the sensor and notify all the necessary sensor / high priority data
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
    • Internal
    • External
    • Virtual
  • Storage
  • LED
  • Button
Parameters
[in]param1Unused
[in]param2Step to be fired

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppSpecificLedIndication ( bool  bleConnectionStatus)
static
  • If connected then Orange LED is turned ON
  • If disconnected then Rolling LED pattern is provided
Parameters
[in]bleConnectionStatusBoolean representing the control BLE connection status

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void Button1EventCallback ( ButtonEvent_T  buttonEvent)
static
static void Button2EventCallback ( ButtonEvent_T  buttonEvent)
static
static uint8_t* ConvertDecimalToSTring ( uint8_t  data,
uint8_t *  str 
)
static
Parameters
[in]data- Number which needs to be convert into string to display in Decimal instead of HEX values.
in/out]*str - pointer to Store/write the Version number in String Format.

+ Here is the caller graph for this function:

static void ConvertInteger32ToVersionString ( uint32_t  xdkVersion,
uint8_t *  str 
)
static
Parameters
[in]xdkVersion- 32 bit value containing the XDK SW version information
in/out]str - pointer to the parsed version string

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Retcode_T CurrentExternalHWConnected ( ExternalSensor_Target_T currentHw)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void GetFwVersionInfo ( void  )
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void HandleExternalHwHotPlug ( ExternalSensor_Target_T connectedHw)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void NoiseSensorTask ( void *  pvParameters)
static
Parameters
[in]pvParametersUnused

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Retcode_T SampleAndNotifyHighPriorityData ( void  )
static

+ 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

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 = true,
.CharacteristicValue =
{
.ModelNumber = &ModelNumberCharacteristicValue[0],
.Manufacturer = &ManufacturerCharacteristicValue[0],
.SoftwareRevision = &SoftwareRevisionCharacteristicValue[0]
},
.CustomServiceRegistryCB = NULL,
}
static uint8_t ModelNumberCharacteristicValue[]
Definition: AppController.c:114
#define APP_CONTROLLER_BLE_DEVICE_NAME
Definition: AppController.h:106
#define NULL
Definition: BCDS_Basics.h:80
static void AppControllerBleDataRxCB(uint8_t *rxBuffer, uint8_t rxDataLength, void *param)
Definition: AppController.c:333
Definition: XDK_BLE.h:67
static uint8_t ManufacturerCharacteristicValue[]
Definition: AppController.c:115
static uint8_t SoftwareRevisionCharacteristicValue[10U]
Definition: AppController.c:116

BLE setup parameters

uint8_t Button1Status = 0
static
uint8_t Button2Status = 0
static
Button_Setup_T ButtonSetup
static
Initial value:
=
{
.CmdProcessorHandle = NULL,
.InternalButton1isEnabled = true,
.InternalButton2isEnabled = true,
.InternalButton1Callback = Button1EventCallback,
.InternalButton2Callback = Button2EventCallback,
}
static void Button2EventCallback(ButtonEvent_T buttonEvent)
Definition: AppController.c:321
#define NULL
Definition: BCDS_Basics.h:80
static void Button1EventCallback(ButtonEvent_T buttonEvent)
Definition: AppController.c:309

Button setup parameters

uint32_t DataSampleRateInMs = 200
static

variable to store the sensor sample time

ExternalSensor_Setup_T ExternalSensorSetup
static
Initial value:
=
{
.CmdProcessorHandle = NULL,
.Enable =
{
.LemCurrent = false,
.MaxResistance = false,
},
.LemConfig =
{
.CurrentRatedTransformationRatio = APP_CURRENT_RATED_TRANSFORMATION_RATIO,
},
.Max31865Config =
{
},
}
#define APP_CURRENT_RATED_TRANSFORMATION_RATIO
Definition: AppController.h:76
#define NULL
Definition: BCDS_Basics.h:80
#define ENABLE_EXTERNAL_MAX_SENSOR
Definition: AppController.h:59
#define ENABLE_EXTERNAL_LEM_SENSOR
Definition: AppController.h:54
Definition: XDK_ExternalSensor.h:65

External Sensor setup parameters

bool extTempHwConnectStatus = false
static
uint8_t IsUseBuiltInSensorFusion = 1
static
bool lemHwConnectStatus = false
static
uint8_t ManufacturerCharacteristicValue[] = "Robert Bosch GmbH"
static
uint8_t ModelNumberCharacteristicValue[] = "XDK110"
static
volatile float NoiseRmsVoltage = 0.0f
static
xTaskHandle NoiseSensorHandle = NULL
static

OS thread handle for noise sensor to be used by run-time blocking threads

uint16_t SampleCounter = 0
static

counter used for toggling low priority data messages.

bool SensorDataStartSampling = false
static
Sensor_Setup_T SensorSetup
static

Sensor setup parameters

uint8_t SoftwareRevisionCharacteristicValue[10U] = { 0 }
static
Storage_Setup_T StorageSetup
static
Initial value:
=
{
.SDCard = true,
.WiFiFileSystem = false,
}

Storage setup parameters

const VirtualSensor_Enable_T VirtualSensors
Initial value:
=
{
.Rotation = true,
.Compass = false,
.AbsoluteHumidity = false,
.CalibratedAccel = false,
.CalibratedGyro = false,
.CalibratedMag = false,
.Gravity = false,
.StepCounter = false,
.FingerPrint = false,
.LinearAccel = false,
.Gesture = false
}

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:55 by doxygen 1.8.8