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.
Revision 27:60c12f3f3430, committed 2017-08-04
- Comitter:
- sgnezdov
- Date:
- Fri Aug 04 22:03:54 2017 +0000
- Parent:
- 26:1798e352679a
- Child:
- 28:7214f7806526
- Commit message:
- added documentation to all services and jobs
Changed in this revision
--- a/source/config.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/config.h Fri Aug 04 22:03:54 2017 +0000 @@ -1,10 +1,21 @@ #pragma once +/** +@brief Config is an application service collecting device specific configuration +parameters. + +Configuration allows for parameters change, but it is not epxected to happen +frequently. +*/ class Config { public: Config(char* sn): _sn(sn) {} + /** @brief SerialNumber returns serial number of the device. + + SN is used to uniquely identify the device when it sends data to HE. + */ const char* SerialNumber() { return _sn; }
--- a/source/jobFakeADC.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/jobFakeADC.h Fri Aug 04 22:03:54 2017 +0000 @@ -3,14 +3,19 @@ #include "mbed.h" #include "lceProxy.h" +/** JobFakeADC is a job that simulates ADC data uploads to HE. */ class JobFakeADC { public: + /** RunAdapter is scheduler callback function. + @param thisPointer provides job context, which is this class's instance. + */ static void RunAdapter(void *thisPointer) { JobFakeADC *self = static_cast<JobFakeADC*>(thisPointer); self->Run(); } - + + /** JobFakeADC constructor takes services as dependencies. */ JobFakeADC(LceProxy& lce): _lce(lce), _next(1) {} void Run();
--- a/source/jobSchedulesUpload.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/jobSchedulesUpload.h Fri Aug 04 22:03:54 2017 +0000 @@ -7,14 +7,19 @@ // JobSchedulesUpload reads current jobs schedule and uploads it to LCE // using Job protocol buffers structures. +/** JobSchedulesUpload uploads shceduler state to LCE HE. */ class JobSchedulesUpload { public: + /** RunAdapter is scheduler callback function. + @param thisPointer provides job context, which is this class's instance. + */ static void RunAdapter(void *thisPointer) { JobSchedulesUpload *self = static_cast<JobSchedulesUpload*>(thisPointer); self->Run(); } - + + /** JobSchedulesUpload constructor arguments are its service dependencies. */ JobSchedulesUpload(Config& conf, LceProxy& lce, JobScheduler::Scheduler& scheduler): _conf(conf), _lce(lce), _scheduler(scheduler) {}
--- a/source/jobTestPrint.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/jobTestPrint.h Fri Aug 04 22:03:54 2017 +0000 @@ -1,8 +1,17 @@ #pragma once +/** JobTestPrint is a job that simply prints a message to STDOUT. + +The class has no constructor, because it has no service dependenices. +This job is a great candidate for a simple C-function job example. + +*/ class JobTestPrint { public: + /** RunAdapter is scheduler callback function. + @param thisPointer provides job context, which is this class's instance. + */ static void RunAdapter(void *thisPointer) { JobTestPrint *self = static_cast<JobTestPrint*>(thisPointer); self->Run();
--- a/source/jobTestUpload.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/jobTestUpload.h Fri Aug 04 22:03:54 2017 +0000 @@ -3,14 +3,19 @@ #include "mbed.h" #include "lceProxy.h" +/** JobTestUpload uploads a hardcoded message to a hardcoded LCE endpoint. */ class JobTestUpload { public: + /** RunAdapter is scheduler callback function. + @param thisPointer provides job context, which is this class's instance. + */ static void RunAdapter(void *thisPointer) { JobTestUpload *self = static_cast<JobTestUpload*>(thisPointer); self->Run(); } + /** JobTestUpload constructor arguments take services it depends on. */ JobTestUpload(LceProxy& lce): _lce(lce) {} void Run();
--- a/source/lceProxy.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/lceProxy.h Fri Aug 04 22:03:54 2017 +0000 @@ -3,6 +3,12 @@ #include "mbed.h" #include "config.h" +/** +LceProxy is an application service allowing to send data to LCE headend using +LCE specific protocols. + +LCE is developed by Itron "Advanced Research and Development" team. +*/ class LceProxy { public:
--- a/source/netstack.cpp Fri Aug 04 21:40:24 2017 +0000 +++ b/source/netstack.cpp Fri Aug 04 22:03:54 2017 +0000 @@ -40,7 +40,7 @@ NetworkInterface* initNetworkStack(uint8_t mac_addr[6]) { NetworkInterface* network_interface = 0; int connect_success = -1; - /// This should be removed once mbedOS supports proper dual-stack + // This should be removed once mbedOS supports proper dual-stack #if (MBED_CONF_LWIP_IPV6_ENABLED==true) tr_error("IPv6 mode"); #else
--- a/source/netstack.h Fri Aug 04 21:40:24 2017 +0000 +++ b/source/netstack.h Fri Aug 04 22:03:54 2017 +0000 @@ -2,4 +2,13 @@ #include "mbed.h" +/** +@file netstack.cpp +*/ + +/** initNetworkStack function is responsible for initialization of +mbed OS network stack according to hardware configuration. + +@return NetworkInterface pointer on success or NULL on failure. +*/ NetworkInterface* initNetworkStack(uint8_t mac_addr[6]);