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

This module is responsible for controlling the complete PPMP Unide application control flow. More...

+ Collaboration diagram for PpmpUnide:

Files

file  AppController.c
 

Macros

#define APP_HTTP_COMM_ISSUE_COUNT_FOR_RESET   10U
 
#define APP_POST_REQUEST_CUSTOM_HEADER_0   "X-AuthToken: InsertCrypticAuthenticationToken\r\n"
 
#define APP_POST_REQUEST_CUSTOM_HEADER_1   "X-Foobar: AnotherCustomHeader\r\n"
 
#define APP_REQUEST_MAX_DOWNLOAD_SIZE   UINT32_C(512)
 
#define APP_RESPONSE_FROM_HTTP_SERVER_POST_TIMEOUT   UINT32_C(10000)
 
#define APP_RESPONSE_FROM_SNTP_SERVER_TIMEOUT   UINT32_C(10000)
 
#define APP_SENSORS_PAYLOAD_TO_BE_SERIALIZED   3U
 
#define APP_SENSORS_TO_BE_SERIALIZED_PER_PAYLOAD   7U
 
#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 AppControllerEnable (void *param1, uint32_t param2)
 To enable the necessary modules for the application. More...
 
static void AppControllerFire (void *pvParameters)
 Responsible for controlling the PPMP Example application control flow. More...
 
static void AppControllerSetup (void *param1, uint32_t param2)
 To setup the necessary modules for the application. More...
 
static void AppControllerValidateWLANConnectivity (void)
 This will validate the WLAN network connectivity. More...
 

Variables

static CmdProcessor_TAppCmdProcessor
 
static xTaskHandle AppControllerHandle = NULL
 
static HTTPRestClient_Config_T HTTPRestClientConfigInfo
 
static HTTPRestClient_Post_T HTTPRestClientPostMeasurementInfo
 
static HTTPRestClient_Setup_T HTTPRestClientSetupInfo
 
static PPMPSerializer_Setup_T PPMPSerializerSetup
 
static Sensor_Setup_T SensorSetup
 
static SNTP_Setup_T SNTPSetupInfo
 
static WLAN_Setup_T WLANSetupInfo
 

Detailed Description

We have a thread that currently runs on polling basis. For every iteration that we call the POST cycle, by default we perform the below for positive scenario.

In addition,

Macro Definition Documentation

#define APP_HTTP_COMM_ISSUE_COUNT_FOR_RESET   10U

APP_HTTP_COMM_ISSUE_COUNT_FOR_RESET is an application logic count where-in upon encountering those many consecutive server communication failures the node will reset.

#define APP_POST_REQUEST_CUSTOM_HEADER_0   "X-AuthToken: InsertCrypticAuthenticationToken\r\n"

APP_POST_REQUEST_CUSTOM_HEADER_0 is a custom header which is sent along with the POST request.

#define APP_POST_REQUEST_CUSTOM_HEADER_1   "X-Foobar: AnotherCustomHeader\r\n"

APP_POST_REQUEST_CUSTOM_HEADER_1 is a custom header which is sent along with the POST request.

#define APP_REQUEST_MAX_DOWNLOAD_SIZE   UINT32_C(512)

The maximum amount of data we download in a single request (in bytes). This number is limited by the platform abstraction layer implementation that ships with the XDK. The maximum value that will work here is 512 bytes.

#define APP_RESPONSE_FROM_HTTP_SERVER_POST_TIMEOUT   UINT32_C(10000)

Timeout for completion of HTTP rest client POST

#define APP_RESPONSE_FROM_SNTP_SERVER_TIMEOUT   UINT32_C(10000)

Timeout for SNTP server time sync

#define APP_SENSORS_PAYLOAD_TO_BE_SERIALIZED   3U

APP_SENSORS_PAYLOAD_TO_BE_SERIALIZED is an application logic count which will define the number of sensor payloads to be serialized.

#define APP_SENSORS_TO_BE_SERIALIZED_PER_PAYLOAD   7U

APP_SENSORS_TO_BE_SERIALIZED_PER_PAYLOAD is an application logic count which will define the number of sensors to be serialized per send.

#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 AppControllerEnable ( void *  param1,
uint32_t  param2 
)
static
  • WLAN
  • ServalPAL
  • SNTP
  • HTTP rest client
  • PPMP Serializer
  • 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 network connection is available
  • Synchronize the SNTP server for timestamp
  • Sample the node data
  • Construct the PPMP payload
  • POST it to the server
  • Wait for APP_POST_INTERVAL_MS 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
  • WLAN
  • ServalPAL
  • SNTP
  • HTTP rest client
  • PPMP Serializer
  • Sensor
Parameters
[in]param1Unused
[in]param2Unused

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void AppControllerValidateWLANConnectivity ( void  )
static

Currently, upon abrupt disconnection the event from the WiFi chip is not propagated / notified to the application. Until then, we manually validate prior to ever HTTP Rest Client POST/GET cycle to make sure that the possibility of software break is reduced. We check if the IP is valid to validate the same.

If there is no connectivity we will restart the node after 10 seconds.

+ 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 reused by ServalPAL thread

xTaskHandle AppControllerHandle = NULL
static

OS thread handle for Application controller

HTTPRestClient_Config_T HTTPRestClientConfigInfo
static
Initial value:
=
{
.IsSecure = false,
.DestinationServerUrl = PPMP_SERVER_URL,
.DestinationServerPort = PPMP_SERVER_PORT,
.RequestMaxDownloadSize = APP_REQUEST_MAX_DOWNLOAD_SIZE,
}
#define PPMP_SERVER_URL
Definition: AppController.h:122
#define PPMP_SERVER_PORT
Definition: AppController.h:127
#define APP_REQUEST_MAX_DOWNLOAD_SIZE
Definition: AppController.c:126

HTTP rest client configuration parameters

HTTPRestClient_Post_T HTTPRestClientPostMeasurementInfo
static
Initial value:
=
{
.Payload = NULL,
.PayloadLength = 0UL,
.RequestCustomHeader0 = APP_POST_REQUEST_CUSTOM_HEADER_0,
.RequestCustomHeader1 = APP_POST_REQUEST_CUSTOM_HEADER_1,
}
#define PPMP_POST_URL_MEASUREMENT
Definition: AppController.h:132
#define NULL
Definition: BCDS_Basics.h:80
#define APP_POST_REQUEST_CUSTOM_HEADER_0
Definition: AppController.c:132
#define APP_POST_REQUEST_CUSTOM_HEADER_1
Definition: AppController.c:138

HTTP rest client POST parameters

HTTPRestClient_Setup_T HTTPRestClientSetupInfo
static
Initial value:
=
{
.IsSecure = false,
}

HTTP rest client setup parameters

PPMPSerializer_Setup_T PPMPSerializerSetup
static
Initial value:
=
{
.DeviceName = APP_PPMP_DEVICE_ID,
}
#define APP_PPMP_DEVICE_ID
Definition: AppController.h:164

PPMP serializer setup parameters

Sensor_Setup_T SensorSetup
static

Sensor setup parameters

SNTP_Setup_T SNTPSetupInfo
static
Initial value:
=
{
.ServerUrl = SNTP_SERVER_URL,
.ServerPort = SNTP_SERVER_PORT,
}
#define SNTP_SERVER_PORT
Definition: AppController.h:120
#define SNTP_SERVER_URL
Definition: AppController.h:115

SNTP setup parameters

WLAN_Setup_T WLANSetupInfo
static
Initial value:
=
{
.IsEnterprise = false,
.IsHostPgmEnabled = false,
.SSID = WLAN_SSID,
.Username = WLAN_PSK,
.Password = WLAN_PSK,
.IsStatic = WLAN_STATIC_IP,
.IpAddr = WLAN_IP_ADDR,
.GwAddr = WLAN_GW_ADDR,
.DnsAddr = WLAN_DNS_ADDR,
.Mask = WLAN_MASK,
}
#define WLAN_DNS_ADDR
Definition: AppController.h:101
#define WLAN_PSK
Definition: AppController.h:75
#define WLAN_GW_ADDR
Definition: AppController.h:94
#define WLAN_IP_ADDR
Definition: AppController.h:87
#define WLAN_SSID
Definition: AppController.h:69
#define WLAN_STATIC_IP
Definition: AppController.h:80
#define WLAN_MASK
Definition: AppController.h:108

WLAN setup parameters


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:54 by doxygen 1.8.8