research application on sending data to headend

Dependencies:   DataStore JobScheduler NetworkServices W5500Interface nanopb protocol

See "main.cpp" documentation on "API Documentation" tab for details about application.

Committer:
sgnezdov
Date:
Fri Aug 04 21:10:31 2017 +0000
Revision:
23:1976f83da84e
Parent:
22:3af582d8e227
Child:
24:62ca1f410862
minor section name update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgnezdov 22:3af582d8e227 1 #pragma once
sgnezdov 22:3af582d8e227 2
sgnezdov 22:3af582d8e227 3 // Include main application documentation.
sgnezdov 22:3af582d8e227 4 /**
sgnezdov 22:3af582d8e227 5
sgnezdov 22:3af582d8e227 6 @file main.cpp
sgnezdov 22:3af582d8e227 7
sgnezdov 22:3af582d8e227 8 @brief Contains application entry point and oulines core application design.
sgnezdov 22:3af582d8e227 9
sgnezdov 22:3af582d8e227 10 @section design_overview_sec Design Overview
sgnezdov 22:3af582d8e227 11
sgnezdov 22:3af582d8e227 12 The application is designed around a concept serial execution of high level tasks called jobs. The 'scheduler' library is responsible for maintaining job schedules and ensuring that only one job is executing at any given time. The Scheduler library for details on how it works.
sgnezdov 22:3af582d8e227 13
sgnezdov 22:3af582d8e227 14 Each job is defined as a function that needs to be executed. Currently the job function does not take any arguments. It is planned that job may take a single argument of Scheduler::Appointment type. Appointment provides all detailed data about job, its schedule and configurable per job instance parameters.
sgnezdov 22:3af582d8e227 15
sgnezdov 22:3af582d8e227 16 Each job has its own unique context that's defined by its dependency on application specific services. Examples of application services:
sgnezdov 22:3af582d8e227 17
sgnezdov 22:3af582d8e227 18 @li LCE is a lightweight collection engine proxy. LCE provides interface for sending CoAP data to headend (HE).
sgnezdov 22:3af582d8e227 19
sgnezdov 22:3af582d8e227 20 @li Configuration service collects device specific configuration such as Serial Number and other parameters that can be changed through commands while device is running.
sgnezdov 22:3af582d8e227 21
sgnezdov 22:3af582d8e227 22 @li Network stack service is defined by mbed OS itself through NetworkInterface class. NetworkInterface is a good example of changing application functionality through change of interface implementation. For example, it can use W5500 driver and it can be use a cell modem driver.
sgnezdov 22:3af582d8e227 23
sgnezdov 22:3af582d8e227 24 @li Scheduler is a service object from design level point of view. Scheduler can be passed as a context dependency to jobs that need to manipulate schedules.
sgnezdov 22:3af582d8e227 25
sgnezdov 22:3af582d8e227 26 If job is implemented as a C++ class, then its service references should be instance variables. C++ reference is recommended, because ass services are always expected to be not NULL.
sgnezdov 22:3af582d8e227 27
sgnezdov 22:3af582d8e227 28 If job is implemented as a C module, then a separate initialize function is expected to set module level variables.
sgnezdov 22:3af582d8e227 29
sgnezdov 22:3af582d8e227 30 In general failure to create a service object results in application termination as it results in cascading failure effect.
sgnezdov 22:3af582d8e227 31
sgnezdov 23:1976f83da84e 32 @subsection do_application_lifetime Application Lifetime
sgnezdov 22:3af582d8e227 33
sgnezdov 22:3af582d8e227 34 Once service objects are created, job scheduler is started on the main application thread. Main thread is then blocked by waiting for scheduler to quit. Unless there is a job that explicitly requests scheduler termination, the main thread will never unblock.
sgnezdov 22:3af582d8e227 35
sgnezdov 22:3af582d8e227 36 If scheduler stops, then main thread proceeds to the final stage of the application. At this stage it is guaranteed that no job will be started, because scheduler has been stopped. Thus, environment is fully under main function control and drastic changes can be applied such as firmware upgrades.
sgnezdov 22:3af582d8e227 37
sgnezdov 23:1976f83da84e 38 @subsection do_parallel_to_jobs Running of Other Parallel Threads
sgnezdov 22:3af582d8e227 39
sgnezdov 22:3af582d8e227 40 The job is just another C function and thus there is nothing to stop function from creating its own thread after execution ends. This is not denied, but a high level impact needs to be considered.
sgnezdov 22:3af582d8e227 41
sgnezdov 22:3af582d8e227 42 For example, a receiving thread can be started for the life time of the socket.
sgnezdov 22:3af582d8e227 43
sgnezdov 22:3af582d8e227 44 One consequence to consider is that creation of long running threads that go beyond job lifetime will make it more difficult to manage power consumption. The recommended solution is to schedule another job through application scheduler from the job function itself. This way a single task at a time concept is not impacted and there is no concurrency complication.
sgnezdov 22:3af582d8e227 45 */