![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.
source/main.cpp@0:2c57ed6943f7, 2017-07-13 (annotated)
- Committer:
- sgnezdov
- Date:
- Thu Jul 13 17:22:32 2017 +0000
- Revision:
- 0:2c57ed6943f7
- Child:
- 1:eebe442fc126
tracing is configured
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sgnezdov | 0:2c57ed6943f7 | 1 | #include "mbed.h" |
sgnezdov | 0:2c57ed6943f7 | 2 | |
sgnezdov | 0:2c57ed6943f7 | 3 | #include "mbed-trace/mbed_trace.h" |
sgnezdov | 0:2c57ed6943f7 | 4 | #define TRACE_GROUP "main" |
sgnezdov | 0:2c57ed6943f7 | 5 | |
sgnezdov | 0:2c57ed6943f7 | 6 | // These are necessary only if thread safety is needed |
sgnezdov | 0:2c57ed6943f7 | 7 | static Mutex TracingLock; |
sgnezdov | 0:2c57ed6943f7 | 8 | static void tracingWait() |
sgnezdov | 0:2c57ed6943f7 | 9 | { |
sgnezdov | 0:2c57ed6943f7 | 10 | TracingLock.lock(); |
sgnezdov | 0:2c57ed6943f7 | 11 | } |
sgnezdov | 0:2c57ed6943f7 | 12 | static void tracingRelease() |
sgnezdov | 0:2c57ed6943f7 | 13 | { |
sgnezdov | 0:2c57ed6943f7 | 14 | TracingLock.unlock(); |
sgnezdov | 0:2c57ed6943f7 | 15 | } |
sgnezdov | 0:2c57ed6943f7 | 16 | |
sgnezdov | 0:2c57ed6943f7 | 17 | int main() |
sgnezdov | 0:2c57ed6943f7 | 18 | { |
sgnezdov | 0:2c57ed6943f7 | 19 | printf("\n==Borsch==\n"); |
sgnezdov | 0:2c57ed6943f7 | 20 | |
sgnezdov | 0:2c57ed6943f7 | 21 | /* Setup tracing */ |
sgnezdov | 0:2c57ed6943f7 | 22 | mbed_trace_mutex_wait_function_set( tracingWait ); // only if thread safety is needed |
sgnezdov | 0:2c57ed6943f7 | 23 | mbed_trace_mutex_release_function_set( tracingRelease ); // only if thread safety is needed |
sgnezdov | 0:2c57ed6943f7 | 24 | mbed_trace_init(); // initialize the trace library |
sgnezdov | 0:2c57ed6943f7 | 25 | |
sgnezdov | 0:2c57ed6943f7 | 26 | tr_info("**Started**"); //-> "[INFO][main]: this is an info msg" |
sgnezdov | 0:2c57ed6943f7 | 27 | |
sgnezdov | 0:2c57ed6943f7 | 28 | |
sgnezdov | 0:2c57ed6943f7 | 29 | |
sgnezdov | 0:2c57ed6943f7 | 30 | tr_debug("this is debug msg"); //-> "[DBG ][main]: this is a debug msg" |
sgnezdov | 0:2c57ed6943f7 | 31 | tr_info("**Finished**"); //-> "[INFO][main]: this is an info msg" |
sgnezdov | 0:2c57ed6943f7 | 32 | exit(0); |
sgnezdov | 0:2c57ed6943f7 | 33 | } |