@@ -245,6 +245,7 @@
void azx_reboot_now
( |
+ void |
| ) |
|
@@ -257,8 +258,8 @@
-◆ azx_shutdown_now()
+
+◆ azx_shutdown_now()
@@ -266,6 +267,7 @@
void azx_shutdown_now
( |
+ void |
| ) |
|
diff --git a/Samples/AZX_Docs/html/azx__utils_8h.js b/Samples/AZX_Docs/html/azx__utils_8h.js
index 7c2ce53..a3f3fdf 100644
--- a/Samples/AZX_Docs/html/azx__utils_8h.js
+++ b/Samples/AZX_Docs/html/azx__utils_8h.js
@@ -3,7 +3,7 @@ var azx__utils_8h =
[ "AZX_LIMIT", "azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9", null ],
[ "AZX_UTILS_HEX_DUMP_BUFFER_SIZE", "azx__utils_8h.html#a8c7358115439ddd523797f3d027df1f2", null ],
[ "azx_hex_dump", "azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f", null ],
- [ "azx_reboot_now", "azx__utils_8h.html#a8fb8f6f485efbdbc31fc02942faf3a89", null ],
- [ "azx_shutdown_now", "azx__utils_8h.html#ae6a6a38c2fdd6b84d9ef00b88690c97d", null ],
+ [ "azx_reboot_now", "azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf", null ],
+ [ "azx_shutdown_now", "azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df", null ],
[ "azx_sleep_ms", "azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5", null ]
];
\ No newline at end of file
diff --git a/Samples/AZX_Docs/html/azx__utils_8h_source.html b/Samples/AZX_Docs/html/azx__utils_8h_source.html
index a0c173f..8df4494 100644
--- a/Samples/AZX_Docs/html/azx__utils_8h_source.html
+++ b/Samples/AZX_Docs/html/azx__utils_8h_source.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
@@ -95,39 +95,40 @@
azx_utils.h
-
Go to the documentation of this file.
-
-
3 #ifndef HDR_M2M_UTILS_H_
-
4 #define HDR_M2M_UTILS_H_
-
-
15 #include "m2mb_types.h"
-
-
+
Go to the documentation of this file.
+
+
+
4 #ifndef HDR_M2M_UTILS_H_
+
5 #define HDR_M2M_UTILS_H_
+
+
16 #include "m2mb_types.h"
+
-
31 #define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
-
-
-
-
-
43 #define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
-
-
-
-
-
-
-
-
+
+
32 #define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+
+
+
+
44 #define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+
+
+
+
+
+
+
-
+
+
void azx_sleep_ms(UINT32 ms)
Puts the task to sleep for a specified time.
-void azx_shutdown_now()
Shuts the modem down straight away.
+void azx_reboot_now(void)
Reboots the modem straight away.
+void azx_shutdown_now(void)
Shuts the modem down straight away.
Logging utilities to print on available output channels.
-void azx_reboot_now()
Reboots the modem straight away.
const CHAR * azx_hex_dump(const void *data, UINT32 len)
Dumps HEX data to string.
diff --git a/Samples/AZX_Docs/html/classes.html b/Samples/AZX_Docs/html/classes.html
index dd815f0..6740580 100644
--- a/Samples/AZX_Docs/html/classes.html
+++ b/Samples/AZX_Docs/html/classes.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html b/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
index 39f49a0..2a8e5aa 100644
--- a/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
+++ b/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/files.html b/Samples/AZX_Docs/html/files.html
index dced1ec..180e4ad 100644
--- a/Samples/AZX_Docs/html/files.html
+++ b/Samples/AZX_Docs/html/files.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/functions.html b/Samples/AZX_Docs/html/functions.html
index 4075523..4576a1d 100644
--- a/Samples/AZX_Docs/html/functions.html
+++ b/Samples/AZX_Docs/html/functions.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/functions_vars.html b/Samples/AZX_Docs/html/functions_vars.html
index 02a3bb0..4ec197f 100644
--- a/Samples/AZX_Docs/html/functions_vars.html
+++ b/Samples/AZX_Docs/html/functions_vars.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals.html b/Samples/AZX_Docs/html/globals.html
index b164b43..3c46bfc 100644
--- a/Samples/AZX_Docs/html/globals.html
+++ b/Samples/AZX_Docs/html/globals.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
@@ -118,6 +118,9 @@ - a -
- AZX_LOG_ERRORS_E
: azx_log.h
+- azx_log_flush_to_file()
+: azx_log.h
+
- azx_log_getLevel()
: azx_log.h
@@ -163,6 +166,9 @@ - a -
- AZX_LOG_NOT_INIT
: azx_log.h
+- azx_log_send_to_file()
+: azx_log.h
+
- azx_log_setLevel()
: azx_log.h
@@ -188,10 +194,10 @@ - a -
: app_cfg.h
- azx_reboot_now()
-: azx_utils.h
+: azx_utils.h
- azx_shutdown_now()
-: azx_utils.h
+: azx_utils.h
- azx_sleep_ms()
: azx_utils.h
diff --git a/Samples/AZX_Docs/html/globals_defs.html b/Samples/AZX_Docs/html/globals_defs.html
index 33af509..020dc89 100644
--- a/Samples/AZX_Docs/html/globals_defs.html
+++ b/Samples/AZX_Docs/html/globals_defs.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_enum.html b/Samples/AZX_Docs/html/globals_enum.html
index 7a568a4..11f4b24 100644
--- a/Samples/AZX_Docs/html/globals_enum.html
+++ b/Samples/AZX_Docs/html/globals_enum.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_eval.html b/Samples/AZX_Docs/html/globals_eval.html
index 90d1a74..252ef15 100644
--- a/Samples/AZX_Docs/html/globals_eval.html
+++ b/Samples/AZX_Docs/html/globals_eval.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_func.html b/Samples/AZX_Docs/html/globals_func.html
index 0f1ac2a..9c711f0 100644
--- a/Samples/AZX_Docs/html/globals_func.html
+++ b/Samples/AZX_Docs/html/globals_func.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
@@ -98,20 +98,26 @@
- azx_log_deinit()
: azx_log.h
+- azx_log_flush_to_file()
+: azx_log.h
+
- azx_log_getLevel()
: azx_log.h
- azx_log_init()
: azx_log.h
+- azx_log_send_to_file()
+: azx_log.h
+
- azx_log_setLevel()
: azx_log.h
- azx_reboot_now()
-: azx_utils.h
+: azx_utils.h
- azx_shutdown_now()
-: azx_utils.h
+: azx_utils.h
- azx_sleep_ms()
: azx_utils.h
diff --git a/Samples/AZX_Docs/html/graph_legend.html b/Samples/AZX_Docs/html/graph_legend.html
index 64b48fc..29242d5 100644
--- a/Samples/AZX_Docs/html/graph_legend.html
+++ b/Samples/AZX_Docs/html/graph_legend.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/group__log_conf.html b/Samples/AZX_Docs/html/group__log_conf.html
index ca81284..1391b2a 100644
--- a/Samples/AZX_Docs/html/group__log_conf.html
+++ b/Samples/AZX_Docs/html/group__log_conf.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
@@ -105,14 +105,14 @@
|
enum | AZX_LOG_LEVEL_E {
- AZX_LOG_LEVEL_NONE = 0,
-AZX_LOG_LEVEL_TRACE = 1,
+ AZX_LOG_LEVEL_TRACE = 1,
AZX_LOG_LEVEL_DEBUG = 2,
AZX_LOG_LEVEL_INFO = 3,
+AZX_LOG_LEVEL_WARN = 4,
- AZX_LOG_LEVEL_WARN = 4,
-AZX_LOG_LEVEL_ERROR = 5,
-AZX_LOG_LEVEL_CRITICAL = 6
+ AZX_LOG_LEVEL_ERROR = 5,
+AZX_LOG_LEVEL_CRITICAL = 6,
+AZX_LOG_LEVEL_NONE = 0x7F
} |
| Logging levels. More...
|
@@ -178,9 +178,7 @@
diff --git a/Samples/AZX_Docs/html/group__log_conf.js b/Samples/AZX_Docs/html/group__log_conf.js
index be7bf93..07cb9ac 100644
--- a/Samples/AZX_Docs/html/group__log_conf.js
+++ b/Samples/AZX_Docs/html/group__log_conf.js
@@ -7,13 +7,13 @@ var group__log_conf =
[ "AZX_LOG_TO_USB1", "group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286", null ]
] ],
[ "AZX_LOG_LEVEL_E", "group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5", [
- [ "AZX_LOG_LEVEL_NONE", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4", null ],
[ "AZX_LOG_LEVEL_TRACE", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497", null ],
[ "AZX_LOG_LEVEL_DEBUG", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048", null ],
[ "AZX_LOG_LEVEL_INFO", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25", null ],
[ "AZX_LOG_LEVEL_WARN", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8", null ],
[ "AZX_LOG_LEVEL_ERROR", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2", null ],
- [ "AZX_LOG_LEVEL_CRITICAL", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c", null ]
+ [ "AZX_LOG_LEVEL_CRITICAL", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c", null ],
+ [ "AZX_LOG_LEVEL_NONE", "group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4", null ]
] ],
[ "azx_log_init", "group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af", null ]
];
\ No newline at end of file
diff --git a/Samples/AZX_Docs/html/group__log_usage.html b/Samples/AZX_Docs/html/group__log_usage.html
index ed6b6cd..b62db1b 100644
--- a/Samples/AZX_Docs/html/group__log_usage.html
+++ b/Samples/AZX_Docs/html/group__log_usage.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/index.html b/Samples/AZX_Docs/html/index.html
index ffab556..e80d599 100644
--- a/Samples/AZX_Docs/html/index.html
+++ b/Samples/AZX_Docs/html/index.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/modules.html b/Samples/AZX_Docs/html/modules.html
index 55a92ed..546f164 100644
--- a/Samples/AZX_Docs/html/modules.html
+++ b/Samples/AZX_Docs/html/modules.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/navtreeindex0.js b/Samples/AZX_Docs/html/navtreeindex0.js
index a774aec..85ea36b 100644
--- a/Samples/AZX_Docs/html/navtreeindex0.js
+++ b/Samples/AZX_Docs/html/navtreeindex0.js
@@ -9,19 +9,21 @@ var NAVTREEINDEX0 =
"app__cfg_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc":[3,0,0,0,4],
"app__cfg_8h_source.html":[3,0,0,0],
"azx__log_8h.html":[3,0,0,1],
-"azx__log_8h.html#a024e23064b2dc69cbeeab7b728d4d010":[3,0,0,1,6],
+"azx__log_8h.html#a024e23064b2dc69cbeeab7b728d4d010":[3,0,0,1,7],
"azx__log_8h.html#a0b1d083f518b1fac0659671b6b744bff":[3,0,0,1,1],
"azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231":[3,0,0,1,5],
-"azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b":[3,0,0,1,9],
-"azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8":[3,0,0,1,7],
+"azx__log_8h.html#a3e999a06dd697da3196e357039081124":[3,0,0,1,6],
+"azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b":[3,0,0,1,11],
+"azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8":[3,0,0,1,8],
+"azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3":[3,0,0,1,10],
"azx__log_8h_source.html":[3,0,0,1],
"azx__utils_8h.html":[3,0,0,2],
"azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f":[3,0,0,2,2],
+"azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf":[3,0,0,2,3],
"azx__utils_8h.html#a8c7358115439ddd523797f3d027df1f2":[3,0,0,2,1],
-"azx__utils_8h.html#a8fb8f6f485efbdbc31fc02942faf3a89":[3,0,0,2,3],
"azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5":[3,0,0,2,5],
"azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9":[3,0,0,2,0],
-"azx__utils_8h.html#ae6a6a38c2fdd6b84d9ef00b88690c97d":[3,0,0,2,4],
+"azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df":[3,0,0,2,4],
"azx__utils_8h_source.html":[3,0,0,2],
"classes.html":[2,1],
"dir_0045f852bf8045b6d5abd9c9eb54a446.html":[3,0,0],
@@ -36,8 +38,8 @@ var NAVTREEINDEX0 =
"group__log_conf.html":[1,0],
"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[3,0,0,1,3],
"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[1,0,0],
-"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[3,0,0,1,8],
"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[1,0,2],
+"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[3,0,0,1,9],
"group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5":[1,0,1],
"group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5":[3,0,0,1,4],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4":[3,0,0,1,3,1],
@@ -49,29 +51,29 @@ var NAVTREEINDEX0 =
"group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286":[3,0,0,1,3,3],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286":[1,0,0,3],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760acd8c06c121bab2a0f3aede4b76afde39":[3,0,0,1,3,4],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[3,0,0,1,4,4],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[1,0,1,4],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[3,0,0,1,4,3],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[1,0,1,3],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[1,0,1,6],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[3,0,0,1,4,6],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[3,0,0,1,4,0],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[1,0,1,0],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[3,0,0,1,4,2],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[1,0,1,2],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[3,0,0,1,4,5],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[1,0,1,5],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[3,0,0,1,4,1],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[1,0,1,1],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[3,0,0,1,4,3],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[1,0,1,3],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[3,0,0,1,4,2],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[1,0,1,2],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[3,0,0,1,4,5],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[1,0,1,5],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[3,0,0,1,4,6],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[1,0,1,6],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[3,0,0,1,4,1],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[1,0,1,1],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[3,0,0,1,4,4],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[1,0,1,4],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[3,0,0,1,4,0],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[1,0,1,0],
"group__log_usage.html":[1,1],
"group__log_usage.html#ga47bb701aa779a05aa34ed01fcfbbdd54":[3,0,0,0,6],
"group__log_usage.html#ga47bb701aa779a05aa34ed01fcfbbdd54":[1,1,5],
"group__log_usage.html#ga4cbebf6589190814b5ee9adb22bb1d44":[1,1,0],
"group__log_usage.html#ga4cbebf6589190814b5ee9adb22bb1d44":[3,0,0,0,0],
-"group__log_usage.html#ga81e4f03b2a752e5e9cfae1e037ce7256":[1,1,2],
"group__log_usage.html#ga81e4f03b2a752e5e9cfae1e037ce7256":[3,0,0,0,2],
-"group__log_usage.html#ga847d9b9f62e31bf14b31882be7418675":[3,0,0,0,3],
+"group__log_usage.html#ga81e4f03b2a752e5e9cfae1e037ce7256":[1,1,2],
"group__log_usage.html#ga847d9b9f62e31bf14b31882be7418675":[1,1,3],
+"group__log_usage.html#ga847d9b9f62e31bf14b31882be7418675":[3,0,0,0,3],
"group__log_usage.html#gaa85ac7254570a307564019c5dfb98d83":[3,0,0,0,5],
"group__log_usage.html#gaa85ac7254570a307564019c5dfb98d83":[1,1,4],
"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[1,1,6],
diff --git a/Samples/AZX_Docs/html/search/all_0.js b/Samples/AZX_Docs/html/search/all_0.js
index bc57110..a0247ad 100644
--- a/Samples/AZX_Docs/html/search/all_0.js
+++ b/Samples/AZX_Docs/html/search/all_0.js
@@ -11,31 +11,33 @@ var searchData=
['azx_5flog_5fdeinit_8',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
['azx_5flog_5ferror_9',['AZX_LOG_ERROR',['../group__log_usage.html#ga81e4f03b2a752e5e9cfae1e037ce7256',1,'app_cfg.h']]],
['azx_5flog_5ferrors_5fe_10',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
- ['azx_5flog_5fgetlevel_11',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
- ['azx_5flog_5fhandle_5fe_12',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
- ['azx_5flog_5finfo_13',['AZX_LOG_INFO',['../group__log_usage.html#ga847d9b9f62e31bf14b31882be7418675',1,'app_cfg.h']]],
- ['azx_5flog_5finit_14',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log_init(AZX_LOG_CFG_T *cfg): azx_log.h'],['../app__cfg_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'AZX_LOG_INIT(): app_cfg.h']]],
- ['azx_5flog_5flevel_5fcritical_15',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fdebug_16',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fe_17',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ferror_18',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5finfo_19',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fnone_20',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ftrace_21',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fwarn_22',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
- ['azx_5flog_5fno_5fusb_5finstance_5favailable_23',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
- ['azx_5flog_5fnot_5finit_24',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
- ['azx_5flog_5fsetlevel_25',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
- ['azx_5flog_5fto_5faux_5fuart_26',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fmain_5fuart_27',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb0_28',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb1_29',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
- ['azx_5flog_5ftrace_30',['AZX_LOG_TRACE',['../group__log_usage.html#gaa85ac7254570a307564019c5dfb98d83',1,'app_cfg.h']]],
- ['azx_5flog_5fusb_5fcable_5funplugged_31',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
- ['azx_5flog_5fwarn_32',['AZX_LOG_WARN',['../group__log_usage.html#ga47bb701aa779a05aa34ed01fcfbbdd54',1,'app_cfg.h']]],
- ['azx_5freboot_5fnow_33',['azx_reboot_now',['../azx__utils_8h.html#a8fb8f6f485efbdbc31fc02942faf3a89',1,'azx_utils.h']]],
- ['azx_5fshutdown_5fnow_34',['azx_shutdown_now',['../azx__utils_8h.html#ae6a6a38c2fdd6b84d9ef00b88690c97d',1,'azx_utils.h']]],
- ['azx_5fsleep_5fms_35',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
- ['azx_5futils_2eh_36',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
- ['azx_20sample_20modules_20documentation_37',['AZX sample modules documentation',['../index.html',1,'']]]
+ ['azx_5flog_5fflush_5fto_5ffile_11',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
+ ['azx_5flog_5fgetlevel_12',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
+ ['azx_5flog_5fhandle_5fe_13',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
+ ['azx_5flog_5finfo_14',['AZX_LOG_INFO',['../group__log_usage.html#ga847d9b9f62e31bf14b31882be7418675',1,'app_cfg.h']]],
+ ['azx_5flog_5finit_15',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log_init(AZX_LOG_CFG_T *cfg): azx_log.h'],['../app__cfg_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'AZX_LOG_INIT(): app_cfg.h']]],
+ ['azx_5flog_5flevel_5fcritical_16',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fdebug_17',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fe_18',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ferror_19',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5finfo_20',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fnone_21',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ftrace_22',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fwarn_23',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
+ ['azx_5flog_5fno_5fusb_5finstance_5favailable_24',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
+ ['azx_5flog_5fnot_5finit_25',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
+ ['azx_5flog_5fsend_5fto_5ffile_26',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
+ ['azx_5flog_5fsetlevel_27',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5faux_5fuart_28',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fmain_5fuart_29',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb0_30',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb1_31',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
+ ['azx_5flog_5ftrace_32',['AZX_LOG_TRACE',['../group__log_usage.html#gaa85ac7254570a307564019c5dfb98d83',1,'app_cfg.h']]],
+ ['azx_5flog_5fusb_5fcable_5funplugged_33',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
+ ['azx_5flog_5fwarn_34',['AZX_LOG_WARN',['../group__log_usage.html#ga47bb701aa779a05aa34ed01fcfbbdd54',1,'app_cfg.h']]],
+ ['azx_5freboot_5fnow_35',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
+ ['azx_5fshutdown_5fnow_36',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
+ ['azx_5fsleep_5fms_37',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
+ ['azx_5futils_2eh_38',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
+ ['azx_20sample_20modules_20documentation_39',['AZX sample modules documentation',['../index.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_1.js b/Samples/AZX_Docs/html/search/all_1.js
index e255eeb..6b18790 100644
--- a/Samples/AZX_Docs/html/search/all_1.js
+++ b/Samples/AZX_Docs/html/search/all_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['configuration_20of_20logging_20functionalities_38',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
+ ['configuration_20of_20logging_20functionalities_40',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_2.js b/Samples/AZX_Docs/html/search/all_2.js
index 20f3995..d12e2da 100644
--- a/Samples/AZX_Docs/html/search/all_2.js
+++ b/Samples/AZX_Docs/html/search/all_2.js
@@ -1,7 +1,7 @@
var searchData=
[
- ['log_5fchannel_39',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_40',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_41',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T::log_level()'],['../app__cfg_8h.html#a0b87e0d3bf5853bcbb0b66a7c48fdc05',1,'LOG_LEVEL(): app_cfg.h']]],
- ['log_5fwith_5fcolour_42',['LOG_WITH_COLOUR',['../app__cfg_8h.html#a490faa4d74e7d551583e681f9b8c2dfe',1,'app_cfg.h']]]
+ ['log_5fchannel_41',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_42',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_43',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T::log_level()'],['../app__cfg_8h.html#a0b87e0d3bf5853bcbb0b66a7c48fdc05',1,'LOG_LEVEL(): app_cfg.h']]],
+ ['log_5fwith_5fcolour_44',['LOG_WITH_COLOUR',['../app__cfg_8h.html#a490faa4d74e7d551583e681f9b8c2dfe',1,'app_cfg.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_3.js b/Samples/AZX_Docs/html/search/all_3.js
index ab1e377..93bcc3c 100644
--- a/Samples/AZX_Docs/html/search/all_3.js
+++ b/Samples/AZX_Docs/html/search/all_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_43',['Usage of logging functionalities',['../group__log_usage.html',1,'']]]
+ ['usage_20of_20logging_20functionalities_45',['Usage of logging functionalities',['../group__log_usage.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_4.js b/Samples/AZX_Docs/html/search/all_4.js
index 0e109fe..2bc1709 100644
--- a/Samples/AZX_Docs/html/search/all_4.js
+++ b/Samples/AZX_Docs/html/search/all_4.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['version_44',['VERSION',['../app__cfg_8h.html#a1c6d5de492ac61ad29aec7aa9a436bbf',1,'app_cfg.h']]]
+ ['version_46',['VERSION',['../app__cfg_8h.html#a1c6d5de492ac61ad29aec7aa9a436bbf',1,'app_cfg.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/classes_0.js b/Samples/AZX_Docs/html/search/classes_0.js
index 7ebb134..8c9619a 100644
--- a/Samples/AZX_Docs/html/search/classes_0.js
+++ b/Samples/AZX_Docs/html/search/classes_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['azx_5flog_5fcfg_5ft_45',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]]
+ ['azx_5flog_5fcfg_5ft_47',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/defines_0.js b/Samples/AZX_Docs/html/search/defines_0.js
index e83cd00..cd8ba65 100644
--- a/Samples/AZX_Docs/html/search/defines_0.js
+++ b/Samples/AZX_Docs/html/search/defines_0.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['azx_5flimit_78',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
- ['azx_5flog_5finit_79',['AZX_LOG_INIT',['../app__cfg_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'app_cfg.h']]]
+ ['azx_5flimit_82',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
+ ['azx_5flog_5finit_83',['AZX_LOG_INIT',['../app__cfg_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'app_cfg.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/defines_1.js b/Samples/AZX_Docs/html/search/defines_1.js
index 8d00242..4d8dc3a 100644
--- a/Samples/AZX_Docs/html/search/defines_1.js
+++ b/Samples/AZX_Docs/html/search/defines_1.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['log_5flevel_80',['LOG_LEVEL',['../app__cfg_8h.html#a0b87e0d3bf5853bcbb0b66a7c48fdc05',1,'app_cfg.h']]],
- ['log_5fwith_5fcolour_81',['LOG_WITH_COLOUR',['../app__cfg_8h.html#a490faa4d74e7d551583e681f9b8c2dfe',1,'app_cfg.h']]]
+ ['log_5flevel_84',['LOG_LEVEL',['../app__cfg_8h.html#a0b87e0d3bf5853bcbb0b66a7c48fdc05',1,'app_cfg.h']]],
+ ['log_5fwith_5fcolour_85',['LOG_WITH_COLOUR',['../app__cfg_8h.html#a490faa4d74e7d551583e681f9b8c2dfe',1,'app_cfg.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/defines_2.js b/Samples/AZX_Docs/html/search/defines_2.js
index 0f018bf..e35b0d7 100644
--- a/Samples/AZX_Docs/html/search/defines_2.js
+++ b/Samples/AZX_Docs/html/search/defines_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['version_82',['VERSION',['../app__cfg_8h.html#a1c6d5de492ac61ad29aec7aa9a436bbf',1,'app_cfg.h']]]
+ ['version_86',['VERSION',['../app__cfg_8h.html#a1c6d5de492ac61ad29aec7aa9a436bbf',1,'app_cfg.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/enums_0.js b/Samples/AZX_Docs/html/search/enums_0.js
index 972b59f..4b2957b 100644
--- a/Samples/AZX_Docs/html/search/enums_0.js
+++ b/Samples/AZX_Docs/html/search/enums_0.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['azx_5flog_5ferrors_5fe_60',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
- ['azx_5flog_5fhandle_5fe_61',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fe_62',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]]
+ ['azx_5flog_5ferrors_5fe_64',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
+ ['azx_5flog_5fhandle_5fe_65',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fe_66',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/enumvalues_0.js b/Samples/AZX_Docs/html/search/enumvalues_0.js
index 2187cf2..12b5664 100644
--- a/Samples/AZX_Docs/html/search/enumvalues_0.js
+++ b/Samples/AZX_Docs/html/search/enumvalues_0.js
@@ -1,18 +1,18 @@
var searchData=
[
- ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_63',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fcritical_64',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fdebug_65',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ferror_66',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5finfo_67',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fnone_68',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ftrace_69',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fwarn_70',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
- ['azx_5flog_5fno_5fusb_5finstance_5favailable_71',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
- ['azx_5flog_5fnot_5finit_72',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
- ['azx_5flog_5fto_5faux_5fuart_73',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fmain_5fuart_74',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb0_75',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb1_76',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
- ['azx_5flog_5fusb_5fcable_5funplugged_77',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]]
+ ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_67',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fcritical_68',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fdebug_69',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ferror_70',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5finfo_71',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fnone_72',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ftrace_73',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fwarn_74',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
+ ['azx_5flog_5fno_5fusb_5finstance_5favailable_75',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
+ ['azx_5flog_5fnot_5finit_76',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5faux_5fuart_77',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fmain_5fuart_78',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb0_79',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb1_80',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
+ ['azx_5flog_5fusb_5fcable_5funplugged_81',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/files_0.js b/Samples/AZX_Docs/html/search/files_0.js
index ac55d4f..d7f50b1 100644
--- a/Samples/AZX_Docs/html/search/files_0.js
+++ b/Samples/AZX_Docs/html/search/files_0.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['app_5fcfg_2eh_46',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
- ['azx_5flog_2eh_47',['azx_log.h',['../azx__log_8h.html',1,'']]],
- ['azx_5futils_2eh_48',['azx_utils.h',['../azx__utils_8h.html',1,'']]]
+ ['app_5fcfg_2eh_48',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
+ ['azx_5flog_2eh_49',['azx_log.h',['../azx__log_8h.html',1,'']]],
+ ['azx_5futils_2eh_50',['azx_utils.h',['../azx__utils_8h.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/functions_0.js b/Samples/AZX_Docs/html/search/functions_0.js
index 18af8dd..59d48af 100644
--- a/Samples/AZX_Docs/html/search/functions_0.js
+++ b/Samples/AZX_Docs/html/search/functions_0.js
@@ -1,11 +1,13 @@
var searchData=
[
- ['azx_5fhex_5fdump_49',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
- ['azx_5flog_5fdeinit_50',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
- ['azx_5flog_5fgetlevel_51',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
- ['azx_5flog_5finit_52',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
- ['azx_5flog_5fsetlevel_53',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
- ['azx_5freboot_5fnow_54',['azx_reboot_now',['../azx__utils_8h.html#a8fb8f6f485efbdbc31fc02942faf3a89',1,'azx_utils.h']]],
- ['azx_5fshutdown_5fnow_55',['azx_shutdown_now',['../azx__utils_8h.html#ae6a6a38c2fdd6b84d9ef00b88690c97d',1,'azx_utils.h']]],
- ['azx_5fsleep_5fms_56',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]]
+ ['azx_5fhex_5fdump_51',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
+ ['azx_5flog_5fdeinit_52',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
+ ['azx_5flog_5fflush_5fto_5ffile_53',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
+ ['azx_5flog_5fgetlevel_54',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
+ ['azx_5flog_5finit_55',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
+ ['azx_5flog_5fsend_5fto_5ffile_56',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
+ ['azx_5flog_5fsetlevel_57',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
+ ['azx_5freboot_5fnow_58',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
+ ['azx_5fshutdown_5fnow_59',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
+ ['azx_5fsleep_5fms_60',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/groups_0.js b/Samples/AZX_Docs/html/search/groups_0.js
index 1be15f2..5af8f69 100644
--- a/Samples/AZX_Docs/html/search/groups_0.js
+++ b/Samples/AZX_Docs/html/search/groups_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['configuration_20of_20logging_20functionalities_83',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
+ ['configuration_20of_20logging_20functionalities_87',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/groups_1.js b/Samples/AZX_Docs/html/search/groups_1.js
index 4397a21..93509ba 100644
--- a/Samples/AZX_Docs/html/search/groups_1.js
+++ b/Samples/AZX_Docs/html/search/groups_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_84',['Usage of logging functionalities',['../group__log_usage.html',1,'']]]
+ ['usage_20of_20logging_20functionalities_88',['Usage of logging functionalities',['../group__log_usage.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/pages_0.js b/Samples/AZX_Docs/html/search/pages_0.js
index 8c98d94..5e5b5ce 100644
--- a/Samples/AZX_Docs/html/search/pages_0.js
+++ b/Samples/AZX_Docs/html/search/pages_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['azx_20sample_20modules_20documentation_85',['AZX sample modules documentation',['../index.html',1,'']]]
+ ['azx_20sample_20modules_20documentation_89',['AZX sample modules documentation',['../index.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/variables_0.js b/Samples/AZX_Docs/html/search/variables_0.js
index bfc4614..2a42215 100644
--- a/Samples/AZX_Docs/html/search/variables_0.js
+++ b/Samples/AZX_Docs/html/search/variables_0.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['log_5fchannel_57',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_58',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_59',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
+ ['log_5fchannel_61',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_62',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_63',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
];
diff --git a/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html b/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
index 0a592f3..5fc489e 100644
--- a/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
+++ b/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.4
+ 1.0.5
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
index 04f29be..38912d3 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_AZX_LOG_H_
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.2
+ * @version 1.0.5
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -39,13 +40,13 @@
*/
typedef enum
{
- AZX_LOG_LEVEL_NONE = 0, /**< Do not print anything */
- AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
- AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
- AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
- AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
- AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
- AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
+ AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
+ AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
+ AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
+ AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
+ AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_NONE = 0x7F, /**< Do not print anything */
} AZX_LOG_LEVEL_E;
@@ -208,4 +209,37 @@ void azx_log_setLevel(AZX_LOG_LEVEL_E level);
*/
AZX_LOG_LEVEL_E azx_log_getLevel(void);
+/**
+ * @brief Gets the logging component to output to a file.
+ *
+ * Once this is called all the logs will be sent to a named file. The file will be appended to, so
+ * existing logs there will not be removed.
+ *
+ * Logs will continue to be sent to USB/UART if that is so configured.
+ *
+ * Only one file can be used at the same time, so calling this again with a new filename means that
+ * all logs will go to the new file instead of the old one.
+ *
+ * The logging can be configured to be done in a circular way by setting circular_chunks to a value
+ * greater than 0. Each chunk will have at most max_size_kb KB.
+ *
+ * @param filename The name of the file to log to. If NULL, this function does nothing.
+ * @param circular_chunks The number of chunks to store circularly (apart from the original one).
+ * @param min_level The minimum level of the logs to be stored.
+ * @param max_size_kb The maximum size in KB of each size of the log file. Once the file reaches
+ * that limit, no further logging will be made to it.
+ *
+ * @return TRUE if the file can be created and opened, FALSE otherwise
+ */
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb);
+
+/**
+ * @brief Flushes any outstanding logs to the file.
+ *
+ * Without calling this, there is no guarantee of when the logs will be written to the filesystem.
+ * It may take longer due to caching.
+ */
+void azx_log_flush_to_file(void);
+
#endif /* HDR_AZX_LOG_H_ */
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_utils.h b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_utils.h
index b4905da..d0ffd84 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_utils.h
+++ b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_utils.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_M2M_UTILS_H_
#define HDR_M2M_UTILS_H_
/**
* @file azx_utils.h
- * @version 1.0.0
+ * @version 1.0.1
* @dependencies azx_log
* @author Ioannis Demetriou
* @author Sorin Basca
@@ -67,7 +68,7 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len);
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_reboot_now();
+void azx_reboot_now(void);
/**
@brief Shuts the modem down straight away.
@@ -80,7 +81,7 @@ void azx_reboot_now();
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_shutdown_now();
+void azx_shutdown_now(void);
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_log.c b/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_log.c
index eb6be31..abade1f 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_log.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_log.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
/* Include files =============================================================*/
@@ -12,13 +12,17 @@
#include "m2mb_usb.h"
#include "m2mb_uart.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_rtc.h"
+
#include "app_cfg.h"
#include "azx_log.h"
/* Local defines =============================================================*/
#define USB_CH_MAX 3
#define LOG_BUFFER_SIZE 2048
-
+#define MAX_FILE_LOG_CACHE 10000
#define NO_COLOUR "\033[0m"
#define BOLD "\033[1m"
@@ -66,6 +70,15 @@
); \
break
+#define LOG_FILE_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ prefix_fmt_file, get_date_time(), \
+ ((now / 10) % 100), #tag, \
+ get_file_title(file), line \
+ ); \
+ break
+
/* Local typedefs ============================================================*/
/* Local statics =============================================================*/
static struct
@@ -76,19 +89,49 @@ static struct
INT32 ch_fd;
BOOLEAN colouredLogs;
M2MB_OS_SEM_HANDLE CSSemHandle;
-} log_cfg = {.isInit=FALSE, .level=AZX_LOG_LEVEL_NONE, .channel=AZX_LOG_TO_MAX, .ch_fd = -1, .colouredLogs=FALSE, .CSSemHandle = NULL};
+} log_cfg = {/*.isInit*/ FALSE, /*.level*/ AZX_LOG_LEVEL_NONE, /*.channel*/ AZX_LOG_TO_MAX, /*.ch_fd */ -1, /*.colouredLogs*/ FALSE, /*.CSSemHandle */ NULL};
static CHAR log_buffer[LOG_BUFFER_SIZE] = { 0 };
static CHAR task_name[64];
+static CHAR dateTime[32] = { 0 };
+static struct
+{
+ M2MB_FILE_T* fd;
+ CHAR name[32];
+ CHAR current_name[40];
+ UINT32 circular_chunks;
+ UINT32 max_size_kb;
+ AZX_LOG_LEVEL_E min_level;
+ UINT32 cache_idx;
+ CHAR cache[MAX_FILE_LOG_CACHE];
+} logFile = {
+ /*.fd */
+ 0,
+ /*.name */
+ { 0 },
+ /*.current_name */
+ { 0 },
+ /*.circular_chunks */
+ 0,
+ /*.max_size_kb */
+ 0,
+ /*.min_level */
+ AZX_LOG_LEVEL_CRITICAL,
+ /*.cache_idx */
+ 0,
+ /*.cache */
+ { 0 }
+};
static const CHAR* prefix_fmt_colour = "[%s%-5s%s] %3.2f " CYAN "%s" NO_COLOUR
":" BOLD CYAN "%d" NO_COLOUR
" - %s{" BOLD WHITE "%s" NO_COLOUR "}$ ";
static const CHAR* prefix_fmt_no_colour = "[%s%-5s%s] %3.2f %s:%d - %s{%s}$ ";
+static const CHAR* prefix_fmt_file = "%s.%.2u [%-5s] %s:%d ";
/* Local function prototypes =================================================*/
@@ -131,6 +174,13 @@ static INT32 log_print_to_USB (const CHAR *path, const CHAR *message );
static UINT32 get_uptime(void);
static const char* get_file_title(const CHAR* path);
static char* get_current_task_name(CHAR *name);
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb);
+static void flush_log_to_file();
+static void file_log_or_cache(const CHAR* buffer);
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb);
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks);
+static const char* get_date_time();
/* Static functions ==========================================================*/
@@ -251,6 +301,8 @@ static UINT32 get_uptime(void)
}
+static CHAR fileTitle[12] = "";
+
/*-----------------------------------------------------------------------------------------------*/
/*!
\brief Removes the file path from the provided path, leaving only filename
@@ -263,15 +315,27 @@ static UINT32 get_uptime(void)
static const char* get_file_title(const CHAR* path)
{
const CHAR* p = path;
+ const CHAR* start = path;
+ const CHAR* end = path;
while (*p) {
if (*p == '/' || *p == '\\') {
- return p + 1;
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
}
p++;
}
- return path;
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
}
@@ -301,6 +365,29 @@ static char* get_current_task_name(CHAR *name)
}
}
+static const char* get_date_time(void)
+{
+ INT32 fd = m2mb_rtc_open( "/dev/rtc0", 0 );
+ M2MB_RTC_TIME_T ts = { 0 };
+ if(fd == -1)
+ {
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+
+ if(-1 == m2mb_rtc_ioctl( fd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &ts ))
+ {
+ m2mb_rtc_close( fd );
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+ m2mb_rtc_close( fd );
+ snprintf(dateTime, sizeof(dateTime), "%02u-%02u %02u:%02u:%02u",
+ ts.mon, ts.day,
+ ts.hour, ts.min, ts.sec);
+ return dateTime;
+}
+
/* Global functions ==========================================================*/
@@ -486,8 +573,210 @@ INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
/* Print the message on the selected output stream */
sent = log_base_function(log_buffer);
+ if(logFile.fd && level >= logFile.min_level)
+ {
+ if(!check_file_size(logFile.current_name, logFile.max_size_kb))
+ {
+ /* Log limit reached, so we'll need to open the next file in the rotation. Log in the file
+ * that this limit is reached and then get the next filename */
+ m2mb_fs_fputs("=== Log file size limit reached\r\n", logFile.fd);
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(logFile.name, logFile.circular_chunks,
+ logFile.max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ goto end;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ goto end;
+ }
+ }
+
+ switch(level)
+ {
+ LOG_FILE_PREFIX(TRACE);
+ LOG_FILE_PREFIX(DEBUG);
+ LOG_FILE_PREFIX(INFO);
+ LOG_FILE_PREFIX(WARN);
+ LOG_FILE_PREFIX(ERROR);
+ LOG_FILE_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE - offset, fmt, arg);
+ va_end(arg);
+ file_log_or_cache(log_buffer);
+ }
+
+end:
m2mb_os_sem_put(log_cfg.CSSemHandle);
}
return sent;
}
+
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb)
+{
+ struct M2MB_STAT stat;
+ if(-1 == m2mb_fs_stat(filename, &stat))
+ {
+ /* Most likely the file doesn't exist, so return true */
+ return TRUE;
+ }
+ return ((stat.st_size >> 10) < max_size_kb);
+}
+
+static void flush_log_to_file(void)
+{
+ logFile.cache[logFile.cache_idx] = '\0';
+ m2mb_fs_fwrite(logFile.cache, logFile.cache_idx, 1, logFile.fd);
+ logFile.cache_idx = 0;
+}
+
+static void file_log_or_cache(const CHAR* buffer)
+{
+ const UINT32 size = strlen(buffer);
+
+ if(MAX_FILE_LOG_CACHE - 1 - size < logFile.cache_idx)
+ {
+ flush_log_to_file();
+ }
+
+ memcpy(&logFile.cache[logFile.cache_idx], buffer, size);
+ logFile.cache_idx += size;
+}
+
+static CHAR filenameInUse[40] = "";
+
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks)
+{
+ CHAR from[40] = "";
+ CHAR to[40] = "";
+ UINT32 i = 0;
+
+ /* This will move log.1 to log.2, log.2 to log.3 and so on until the last one */
+ snprintf(from, sizeof(from), "%s.%u", filename, circular_chunks);
+
+ m2mb_fs_remove(from);
+
+ for(i = circular_chunks - 1; i > 0; --i)
+ {
+ snprintf(from, sizeof(from), "%s.%u", filename, i);
+ snprintf(to, sizeof(to), "%s.%u", filename, i+1);
+ if(-1 == m2mb_fs_rename(from, to))
+ {
+ /* Only return FALSE when the final file cannot be renamed - the other renames could be
+ * failing if there are no files there */
+ if(i == 1)
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb)
+{
+ filenameInUse[0] = '\0';
+
+ if(!filename)
+ {
+ goto end;
+ }
+
+ /* First try the original file */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ /* If there is no circular logging and the original file is full, just return empty string */
+ if(circular_chunks == 0)
+ {
+ filenameInUse[0] = '\0';
+ goto end;
+ }
+
+ /* We should log to filename.1, but if that's full we need to rotate logs and then still use
+ * filename.1 (since the old one got moved to filename.2) */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s.1", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ if(!rotate_log_files(filename, circular_chunks))
+ {
+ /* Since we failed to rotate, just wipe filename.1 so it can be reused */
+ m2mb_fs_remove(filenameInUse);
+ goto end;
+ }
+
+end:
+ return filenameInUse;
+}
+
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb)
+
+{
+ if(!filename)
+ {
+ return FALSE;
+ }
+
+ if(circular_chunks == 0 && !check_file_size(filename, max_size_kb))
+ {
+ return FALSE;
+ }
+
+ if(logFile.fd)
+ {
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+ }
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(filename, circular_chunks, max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ return FALSE;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ return FALSE;
+ }
+
+ snprintf(logFile.name, sizeof(logFile.name), "%s", filename);
+ logFile.circular_chunks = circular_chunks;
+ logFile.min_level = min_level;
+ logFile.max_size_kb = max_size_kb;
+ logFile.cache_idx = 0;
+ return TRUE;
+}
+
+void azx_log_flush_to_file(void)
+{
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+ flush_log_to_file();
+ m2mb_os_sem_put(log_cfg.CSSemHandle);
+}
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_utils.c b/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_utils.c
index af11062..a15c5cf 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_utils.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/azx/src/azx_utils.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
#include
#include
@@ -43,24 +43,26 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len)
return buff;
}
-void azx_reboot_now()
+void azx_reboot_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Rebooting device\r\n");
m2mb_power_reboot(h);
}
}
-void azx_shutdown_now()
+void azx_shutdown_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
m2mb_power_shutdown(h);
}
}
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/hdr/app_cfg.h b/Samples/BRAVO_Environment_BSEC_Demo/hdr/app_cfg.h
index 711dd51..5c90daa 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/hdr/app_cfg.h
+++ b/Samples/BRAVO_Environment_BSEC_Demo/hdr/app_cfg.h
@@ -23,7 +23,7 @@
/**
* @brief The current version of the Samples
*/
-#define VERSION "1.0.4"
+#define VERSION "1.0.5"
/**
* @name Log Settings
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
index 364da7f..2362fe8 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
@@ -309,6 +309,21 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit( lwm2m_evHandle );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
azx_sleep_ms(1000);
/*new object instance information*/
@@ -328,19 +343,6 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit( lwm2m_evHandle );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
return 0;
}
diff --git a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
index 04f29be..38912d3 100644
--- a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_AZX_LOG_H_
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.2
+ * @version 1.0.5
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -39,13 +40,13 @@
*/
typedef enum
{
- AZX_LOG_LEVEL_NONE = 0, /**< Do not print anything */
- AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
- AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
- AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
- AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
- AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
- AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
+ AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
+ AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
+ AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
+ AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
+ AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_NONE = 0x7F, /**< Do not print anything */
} AZX_LOG_LEVEL_E;
@@ -208,4 +209,37 @@ void azx_log_setLevel(AZX_LOG_LEVEL_E level);
*/
AZX_LOG_LEVEL_E azx_log_getLevel(void);
+/**
+ * @brief Gets the logging component to output to a file.
+ *
+ * Once this is called all the logs will be sent to a named file. The file will be appended to, so
+ * existing logs there will not be removed.
+ *
+ * Logs will continue to be sent to USB/UART if that is so configured.
+ *
+ * Only one file can be used at the same time, so calling this again with a new filename means that
+ * all logs will go to the new file instead of the old one.
+ *
+ * The logging can be configured to be done in a circular way by setting circular_chunks to a value
+ * greater than 0. Each chunk will have at most max_size_kb KB.
+ *
+ * @param filename The name of the file to log to. If NULL, this function does nothing.
+ * @param circular_chunks The number of chunks to store circularly (apart from the original one).
+ * @param min_level The minimum level of the logs to be stored.
+ * @param max_size_kb The maximum size in KB of each size of the log file. Once the file reaches
+ * that limit, no further logging will be made to it.
+ *
+ * @return TRUE if the file can be created and opened, FALSE otherwise
+ */
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb);
+
+/**
+ * @brief Flushes any outstanding logs to the file.
+ *
+ * Without calling this, there is no guarantee of when the logs will be written to the filesystem.
+ * It may take longer due to caching.
+ */
+void azx_log_flush_to_file(void);
+
#endif /* HDR_AZX_LOG_H_ */
diff --git a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_utils.h b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_utils.h
index b4905da..d0ffd84 100644
--- a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_utils.h
+++ b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_utils.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_M2M_UTILS_H_
#define HDR_M2M_UTILS_H_
/**
* @file azx_utils.h
- * @version 1.0.0
+ * @version 1.0.1
* @dependencies azx_log
* @author Ioannis Demetriou
* @author Sorin Basca
@@ -67,7 +68,7 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len);
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_reboot_now();
+void azx_reboot_now(void);
/**
@brief Shuts the modem down straight away.
@@ -80,7 +81,7 @@ void azx_reboot_now();
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_shutdown_now();
+void azx_shutdown_now(void);
diff --git a/Samples/BRAVO_Rotation_Demo/azx/src/azx_log.c b/Samples/BRAVO_Rotation_Demo/azx/src/azx_log.c
index eb6be31..abade1f 100644
--- a/Samples/BRAVO_Rotation_Demo/azx/src/azx_log.c
+++ b/Samples/BRAVO_Rotation_Demo/azx/src/azx_log.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
/* Include files =============================================================*/
@@ -12,13 +12,17 @@
#include "m2mb_usb.h"
#include "m2mb_uart.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_rtc.h"
+
#include "app_cfg.h"
#include "azx_log.h"
/* Local defines =============================================================*/
#define USB_CH_MAX 3
#define LOG_BUFFER_SIZE 2048
-
+#define MAX_FILE_LOG_CACHE 10000
#define NO_COLOUR "\033[0m"
#define BOLD "\033[1m"
@@ -66,6 +70,15 @@
); \
break
+#define LOG_FILE_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ prefix_fmt_file, get_date_time(), \
+ ((now / 10) % 100), #tag, \
+ get_file_title(file), line \
+ ); \
+ break
+
/* Local typedefs ============================================================*/
/* Local statics =============================================================*/
static struct
@@ -76,19 +89,49 @@ static struct
INT32 ch_fd;
BOOLEAN colouredLogs;
M2MB_OS_SEM_HANDLE CSSemHandle;
-} log_cfg = {.isInit=FALSE, .level=AZX_LOG_LEVEL_NONE, .channel=AZX_LOG_TO_MAX, .ch_fd = -1, .colouredLogs=FALSE, .CSSemHandle = NULL};
+} log_cfg = {/*.isInit*/ FALSE, /*.level*/ AZX_LOG_LEVEL_NONE, /*.channel*/ AZX_LOG_TO_MAX, /*.ch_fd */ -1, /*.colouredLogs*/ FALSE, /*.CSSemHandle */ NULL};
static CHAR log_buffer[LOG_BUFFER_SIZE] = { 0 };
static CHAR task_name[64];
+static CHAR dateTime[32] = { 0 };
+static struct
+{
+ M2MB_FILE_T* fd;
+ CHAR name[32];
+ CHAR current_name[40];
+ UINT32 circular_chunks;
+ UINT32 max_size_kb;
+ AZX_LOG_LEVEL_E min_level;
+ UINT32 cache_idx;
+ CHAR cache[MAX_FILE_LOG_CACHE];
+} logFile = {
+ /*.fd */
+ 0,
+ /*.name */
+ { 0 },
+ /*.current_name */
+ { 0 },
+ /*.circular_chunks */
+ 0,
+ /*.max_size_kb */
+ 0,
+ /*.min_level */
+ AZX_LOG_LEVEL_CRITICAL,
+ /*.cache_idx */
+ 0,
+ /*.cache */
+ { 0 }
+};
static const CHAR* prefix_fmt_colour = "[%s%-5s%s] %3.2f " CYAN "%s" NO_COLOUR
":" BOLD CYAN "%d" NO_COLOUR
" - %s{" BOLD WHITE "%s" NO_COLOUR "}$ ";
static const CHAR* prefix_fmt_no_colour = "[%s%-5s%s] %3.2f %s:%d - %s{%s}$ ";
+static const CHAR* prefix_fmt_file = "%s.%.2u [%-5s] %s:%d ";
/* Local function prototypes =================================================*/
@@ -131,6 +174,13 @@ static INT32 log_print_to_USB (const CHAR *path, const CHAR *message );
static UINT32 get_uptime(void);
static const char* get_file_title(const CHAR* path);
static char* get_current_task_name(CHAR *name);
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb);
+static void flush_log_to_file();
+static void file_log_or_cache(const CHAR* buffer);
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb);
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks);
+static const char* get_date_time();
/* Static functions ==========================================================*/
@@ -251,6 +301,8 @@ static UINT32 get_uptime(void)
}
+static CHAR fileTitle[12] = "";
+
/*-----------------------------------------------------------------------------------------------*/
/*!
\brief Removes the file path from the provided path, leaving only filename
@@ -263,15 +315,27 @@ static UINT32 get_uptime(void)
static const char* get_file_title(const CHAR* path)
{
const CHAR* p = path;
+ const CHAR* start = path;
+ const CHAR* end = path;
while (*p) {
if (*p == '/' || *p == '\\') {
- return p + 1;
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
}
p++;
}
- return path;
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
}
@@ -301,6 +365,29 @@ static char* get_current_task_name(CHAR *name)
}
}
+static const char* get_date_time(void)
+{
+ INT32 fd = m2mb_rtc_open( "/dev/rtc0", 0 );
+ M2MB_RTC_TIME_T ts = { 0 };
+ if(fd == -1)
+ {
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+
+ if(-1 == m2mb_rtc_ioctl( fd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &ts ))
+ {
+ m2mb_rtc_close( fd );
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+ m2mb_rtc_close( fd );
+ snprintf(dateTime, sizeof(dateTime), "%02u-%02u %02u:%02u:%02u",
+ ts.mon, ts.day,
+ ts.hour, ts.min, ts.sec);
+ return dateTime;
+}
+
/* Global functions ==========================================================*/
@@ -486,8 +573,210 @@ INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
/* Print the message on the selected output stream */
sent = log_base_function(log_buffer);
+ if(logFile.fd && level >= logFile.min_level)
+ {
+ if(!check_file_size(logFile.current_name, logFile.max_size_kb))
+ {
+ /* Log limit reached, so we'll need to open the next file in the rotation. Log in the file
+ * that this limit is reached and then get the next filename */
+ m2mb_fs_fputs("=== Log file size limit reached\r\n", logFile.fd);
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(logFile.name, logFile.circular_chunks,
+ logFile.max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ goto end;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ goto end;
+ }
+ }
+
+ switch(level)
+ {
+ LOG_FILE_PREFIX(TRACE);
+ LOG_FILE_PREFIX(DEBUG);
+ LOG_FILE_PREFIX(INFO);
+ LOG_FILE_PREFIX(WARN);
+ LOG_FILE_PREFIX(ERROR);
+ LOG_FILE_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE - offset, fmt, arg);
+ va_end(arg);
+ file_log_or_cache(log_buffer);
+ }
+
+end:
m2mb_os_sem_put(log_cfg.CSSemHandle);
}
return sent;
}
+
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb)
+{
+ struct M2MB_STAT stat;
+ if(-1 == m2mb_fs_stat(filename, &stat))
+ {
+ /* Most likely the file doesn't exist, so return true */
+ return TRUE;
+ }
+ return ((stat.st_size >> 10) < max_size_kb);
+}
+
+static void flush_log_to_file(void)
+{
+ logFile.cache[logFile.cache_idx] = '\0';
+ m2mb_fs_fwrite(logFile.cache, logFile.cache_idx, 1, logFile.fd);
+ logFile.cache_idx = 0;
+}
+
+static void file_log_or_cache(const CHAR* buffer)
+{
+ const UINT32 size = strlen(buffer);
+
+ if(MAX_FILE_LOG_CACHE - 1 - size < logFile.cache_idx)
+ {
+ flush_log_to_file();
+ }
+
+ memcpy(&logFile.cache[logFile.cache_idx], buffer, size);
+ logFile.cache_idx += size;
+}
+
+static CHAR filenameInUse[40] = "";
+
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks)
+{
+ CHAR from[40] = "";
+ CHAR to[40] = "";
+ UINT32 i = 0;
+
+ /* This will move log.1 to log.2, log.2 to log.3 and so on until the last one */
+ snprintf(from, sizeof(from), "%s.%u", filename, circular_chunks);
+
+ m2mb_fs_remove(from);
+
+ for(i = circular_chunks - 1; i > 0; --i)
+ {
+ snprintf(from, sizeof(from), "%s.%u", filename, i);
+ snprintf(to, sizeof(to), "%s.%u", filename, i+1);
+ if(-1 == m2mb_fs_rename(from, to))
+ {
+ /* Only return FALSE when the final file cannot be renamed - the other renames could be
+ * failing if there are no files there */
+ if(i == 1)
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb)
+{
+ filenameInUse[0] = '\0';
+
+ if(!filename)
+ {
+ goto end;
+ }
+
+ /* First try the original file */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ /* If there is no circular logging and the original file is full, just return empty string */
+ if(circular_chunks == 0)
+ {
+ filenameInUse[0] = '\0';
+ goto end;
+ }
+
+ /* We should log to filename.1, but if that's full we need to rotate logs and then still use
+ * filename.1 (since the old one got moved to filename.2) */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s.1", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ if(!rotate_log_files(filename, circular_chunks))
+ {
+ /* Since we failed to rotate, just wipe filename.1 so it can be reused */
+ m2mb_fs_remove(filenameInUse);
+ goto end;
+ }
+
+end:
+ return filenameInUse;
+}
+
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb)
+
+{
+ if(!filename)
+ {
+ return FALSE;
+ }
+
+ if(circular_chunks == 0 && !check_file_size(filename, max_size_kb))
+ {
+ return FALSE;
+ }
+
+ if(logFile.fd)
+ {
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+ }
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(filename, circular_chunks, max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ return FALSE;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ return FALSE;
+ }
+
+ snprintf(logFile.name, sizeof(logFile.name), "%s", filename);
+ logFile.circular_chunks = circular_chunks;
+ logFile.min_level = min_level;
+ logFile.max_size_kb = max_size_kb;
+ logFile.cache_idx = 0;
+ return TRUE;
+}
+
+void azx_log_flush_to_file(void)
+{
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+ flush_log_to_file();
+ m2mb_os_sem_put(log_cfg.CSSemHandle);
+}
diff --git a/Samples/BRAVO_Rotation_Demo/azx/src/azx_utils.c b/Samples/BRAVO_Rotation_Demo/azx/src/azx_utils.c
index af11062..a15c5cf 100644
--- a/Samples/BRAVO_Rotation_Demo/azx/src/azx_utils.c
+++ b/Samples/BRAVO_Rotation_Demo/azx/src/azx_utils.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
#include
#include
@@ -43,24 +43,26 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len)
return buff;
}
-void azx_reboot_now()
+void azx_reboot_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Rebooting device\r\n");
m2mb_power_reboot(h);
}
}
-void azx_shutdown_now()
+void azx_shutdown_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
m2mb_power_shutdown(h);
}
}
diff --git a/Samples/BRAVO_Rotation_Demo/hdr/app_cfg.h b/Samples/BRAVO_Rotation_Demo/hdr/app_cfg.h
index 711dd51..5c90daa 100644
--- a/Samples/BRAVO_Rotation_Demo/hdr/app_cfg.h
+++ b/Samples/BRAVO_Rotation_Demo/hdr/app_cfg.h
@@ -23,7 +23,7 @@
/**
* @brief The current version of the Samples
*/
-#define VERSION "1.0.4"
+#define VERSION "1.0.5"
/**
* @name Log Settings
diff --git a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
index 364da7f..2362fe8 100644
--- a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
@@ -309,6 +309,21 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit( lwm2m_evHandle );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
azx_sleep_ms(1000);
/*new object instance information*/
@@ -328,19 +343,6 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit( lwm2m_evHandle );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
return 0;
}
diff --git a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
index 04f29be..38912d3 100644
--- a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_AZX_LOG_H_
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.2
+ * @version 1.0.5
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -39,13 +40,13 @@
*/
typedef enum
{
- AZX_LOG_LEVEL_NONE = 0, /**< Do not print anything */
- AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
- AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
- AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
- AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
- AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
- AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_TRACE = 1, /**< Prints every message, adds a "TRACE" at the beginning of the message*/
+ AZX_LOG_LEVEL_DEBUG = 2, /**< Prints most of the messages, adds a "DEBUG" at the beginning of the message*/
+ AZX_LOG_LEVEL_INFO = 3, /**< print the message only, without any additional info */
+ AZX_LOG_LEVEL_WARN = 4, /**< like DEBUG, but adds a "WARNING" at the beginning of the message. */
+ AZX_LOG_LEVEL_ERROR = 5, /**< like DEBUG, but adds an "ERROR" at the beginning of the message */
+ AZX_LOG_LEVEL_CRITICAL = 6, /**< like DEBUG, but adds an "CRITICAL" at the beginning of the message */
+ AZX_LOG_LEVEL_NONE = 0x7F, /**< Do not print anything */
} AZX_LOG_LEVEL_E;
@@ -208,4 +209,37 @@ void azx_log_setLevel(AZX_LOG_LEVEL_E level);
*/
AZX_LOG_LEVEL_E azx_log_getLevel(void);
+/**
+ * @brief Gets the logging component to output to a file.
+ *
+ * Once this is called all the logs will be sent to a named file. The file will be appended to, so
+ * existing logs there will not be removed.
+ *
+ * Logs will continue to be sent to USB/UART if that is so configured.
+ *
+ * Only one file can be used at the same time, so calling this again with a new filename means that
+ * all logs will go to the new file instead of the old one.
+ *
+ * The logging can be configured to be done in a circular way by setting circular_chunks to a value
+ * greater than 0. Each chunk will have at most max_size_kb KB.
+ *
+ * @param filename The name of the file to log to. If NULL, this function does nothing.
+ * @param circular_chunks The number of chunks to store circularly (apart from the original one).
+ * @param min_level The minimum level of the logs to be stored.
+ * @param max_size_kb The maximum size in KB of each size of the log file. Once the file reaches
+ * that limit, no further logging will be made to it.
+ *
+ * @return TRUE if the file can be created and opened, FALSE otherwise
+ */
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb);
+
+/**
+ * @brief Flushes any outstanding logs to the file.
+ *
+ * Without calling this, there is no guarantee of when the logs will be written to the filesystem.
+ * It may take longer due to caching.
+ */
+void azx_log_flush_to_file(void);
+
#endif /* HDR_AZX_LOG_H_ */
diff --git a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_utils.h b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_utils.h
index b4905da..d0ffd84 100644
--- a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_utils.h
+++ b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_utils.h
@@ -1,10 +1,11 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
#ifndef HDR_M2M_UTILS_H_
#define HDR_M2M_UTILS_H_
/**
* @file azx_utils.h
- * @version 1.0.0
+ * @version 1.0.1
* @dependencies azx_log
* @author Ioannis Demetriou
* @author Sorin Basca
@@ -67,7 +68,7 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len);
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_reboot_now();
+void azx_reboot_now(void);
/**
@brief Shuts the modem down straight away.
@@ -80,7 +81,7 @@ void azx_reboot_now();
*/
/*-----------------------------------------------------------------------------------------------*/
-void azx_shutdown_now();
+void azx_shutdown_now(void);
diff --git a/Samples/BRAVO_Tampering_Demo/azx/src/azx_log.c b/Samples/BRAVO_Tampering_Demo/azx/src/azx_log.c
index eb6be31..abade1f 100644
--- a/Samples/BRAVO_Tampering_Demo/azx/src/azx_log.c
+++ b/Samples/BRAVO_Tampering_Demo/azx/src/azx_log.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
/* Include files =============================================================*/
@@ -12,13 +12,17 @@
#include "m2mb_usb.h"
#include "m2mb_uart.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_rtc.h"
+
#include "app_cfg.h"
#include "azx_log.h"
/* Local defines =============================================================*/
#define USB_CH_MAX 3
#define LOG_BUFFER_SIZE 2048
-
+#define MAX_FILE_LOG_CACHE 10000
#define NO_COLOUR "\033[0m"
#define BOLD "\033[1m"
@@ -66,6 +70,15 @@
); \
break
+#define LOG_FILE_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ prefix_fmt_file, get_date_time(), \
+ ((now / 10) % 100), #tag, \
+ get_file_title(file), line \
+ ); \
+ break
+
/* Local typedefs ============================================================*/
/* Local statics =============================================================*/
static struct
@@ -76,19 +89,49 @@ static struct
INT32 ch_fd;
BOOLEAN colouredLogs;
M2MB_OS_SEM_HANDLE CSSemHandle;
-} log_cfg = {.isInit=FALSE, .level=AZX_LOG_LEVEL_NONE, .channel=AZX_LOG_TO_MAX, .ch_fd = -1, .colouredLogs=FALSE, .CSSemHandle = NULL};
+} log_cfg = {/*.isInit*/ FALSE, /*.level*/ AZX_LOG_LEVEL_NONE, /*.channel*/ AZX_LOG_TO_MAX, /*.ch_fd */ -1, /*.colouredLogs*/ FALSE, /*.CSSemHandle */ NULL};
static CHAR log_buffer[LOG_BUFFER_SIZE] = { 0 };
static CHAR task_name[64];
+static CHAR dateTime[32] = { 0 };
+static struct
+{
+ M2MB_FILE_T* fd;
+ CHAR name[32];
+ CHAR current_name[40];
+ UINT32 circular_chunks;
+ UINT32 max_size_kb;
+ AZX_LOG_LEVEL_E min_level;
+ UINT32 cache_idx;
+ CHAR cache[MAX_FILE_LOG_CACHE];
+} logFile = {
+ /*.fd */
+ 0,
+ /*.name */
+ { 0 },
+ /*.current_name */
+ { 0 },
+ /*.circular_chunks */
+ 0,
+ /*.max_size_kb */
+ 0,
+ /*.min_level */
+ AZX_LOG_LEVEL_CRITICAL,
+ /*.cache_idx */
+ 0,
+ /*.cache */
+ { 0 }
+};
static const CHAR* prefix_fmt_colour = "[%s%-5s%s] %3.2f " CYAN "%s" NO_COLOUR
":" BOLD CYAN "%d" NO_COLOUR
" - %s{" BOLD WHITE "%s" NO_COLOUR "}$ ";
static const CHAR* prefix_fmt_no_colour = "[%s%-5s%s] %3.2f %s:%d - %s{%s}$ ";
+static const CHAR* prefix_fmt_file = "%s.%.2u [%-5s] %s:%d ";
/* Local function prototypes =================================================*/
@@ -131,6 +174,13 @@ static INT32 log_print_to_USB (const CHAR *path, const CHAR *message );
static UINT32 get_uptime(void);
static const char* get_file_title(const CHAR* path);
static char* get_current_task_name(CHAR *name);
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb);
+static void flush_log_to_file();
+static void file_log_or_cache(const CHAR* buffer);
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb);
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks);
+static const char* get_date_time();
/* Static functions ==========================================================*/
@@ -251,6 +301,8 @@ static UINT32 get_uptime(void)
}
+static CHAR fileTitle[12] = "";
+
/*-----------------------------------------------------------------------------------------------*/
/*!
\brief Removes the file path from the provided path, leaving only filename
@@ -263,15 +315,27 @@ static UINT32 get_uptime(void)
static const char* get_file_title(const CHAR* path)
{
const CHAR* p = path;
+ const CHAR* start = path;
+ const CHAR* end = path;
while (*p) {
if (*p == '/' || *p == '\\') {
- return p + 1;
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
}
p++;
}
- return path;
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
}
@@ -301,6 +365,29 @@ static char* get_current_task_name(CHAR *name)
}
}
+static const char* get_date_time(void)
+{
+ INT32 fd = m2mb_rtc_open( "/dev/rtc0", 0 );
+ M2MB_RTC_TIME_T ts = { 0 };
+ if(fd == -1)
+ {
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+
+ if(-1 == m2mb_rtc_ioctl( fd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &ts ))
+ {
+ m2mb_rtc_close( fd );
+ dateTime[0] = '\0';
+ return dateTime;
+ }
+ m2mb_rtc_close( fd );
+ snprintf(dateTime, sizeof(dateTime), "%02u-%02u %02u:%02u:%02u",
+ ts.mon, ts.day,
+ ts.hour, ts.min, ts.sec);
+ return dateTime;
+}
+
/* Global functions ==========================================================*/
@@ -486,8 +573,210 @@ INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
/* Print the message on the selected output stream */
sent = log_base_function(log_buffer);
+ if(logFile.fd && level >= logFile.min_level)
+ {
+ if(!check_file_size(logFile.current_name, logFile.max_size_kb))
+ {
+ /* Log limit reached, so we'll need to open the next file in the rotation. Log in the file
+ * that this limit is reached and then get the next filename */
+ m2mb_fs_fputs("=== Log file size limit reached\r\n", logFile.fd);
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(logFile.name, logFile.circular_chunks,
+ logFile.max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ goto end;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ goto end;
+ }
+ }
+
+ switch(level)
+ {
+ LOG_FILE_PREFIX(TRACE);
+ LOG_FILE_PREFIX(DEBUG);
+ LOG_FILE_PREFIX(INFO);
+ LOG_FILE_PREFIX(WARN);
+ LOG_FILE_PREFIX(ERROR);
+ LOG_FILE_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE - offset, fmt, arg);
+ va_end(arg);
+ file_log_or_cache(log_buffer);
+ }
+
+end:
m2mb_os_sem_put(log_cfg.CSSemHandle);
}
return sent;
}
+
+static BOOLEAN check_file_size(const CHAR* filename, UINT32 max_size_kb)
+{
+ struct M2MB_STAT stat;
+ if(-1 == m2mb_fs_stat(filename, &stat))
+ {
+ /* Most likely the file doesn't exist, so return true */
+ return TRUE;
+ }
+ return ((stat.st_size >> 10) < max_size_kb);
+}
+
+static void flush_log_to_file(void)
+{
+ logFile.cache[logFile.cache_idx] = '\0';
+ m2mb_fs_fwrite(logFile.cache, logFile.cache_idx, 1, logFile.fd);
+ logFile.cache_idx = 0;
+}
+
+static void file_log_or_cache(const CHAR* buffer)
+{
+ const UINT32 size = strlen(buffer);
+
+ if(MAX_FILE_LOG_CACHE - 1 - size < logFile.cache_idx)
+ {
+ flush_log_to_file();
+ }
+
+ memcpy(&logFile.cache[logFile.cache_idx], buffer, size);
+ logFile.cache_idx += size;
+}
+
+static CHAR filenameInUse[40] = "";
+
+static BOOLEAN rotate_log_files(const CHAR* filename, UINT32 circular_chunks)
+{
+ CHAR from[40] = "";
+ CHAR to[40] = "";
+ UINT32 i = 0;
+
+ /* This will move log.1 to log.2, log.2 to log.3 and so on until the last one */
+ snprintf(from, sizeof(from), "%s.%u", filename, circular_chunks);
+
+ m2mb_fs_remove(from);
+
+ for(i = circular_chunks - 1; i > 0; --i)
+ {
+ snprintf(from, sizeof(from), "%s.%u", filename, i);
+ snprintf(to, sizeof(to), "%s.%u", filename, i+1);
+ if(-1 == m2mb_fs_rename(from, to))
+ {
+ /* Only return FALSE when the final file cannot be renamed - the other renames could be
+ * failing if there are no files there */
+ if(i == 1)
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+static const CHAR* get_next_log_filename(const CHAR* filename,
+ UINT32 circular_chunks, UINT32 max_size_kb)
+{
+ filenameInUse[0] = '\0';
+
+ if(!filename)
+ {
+ goto end;
+ }
+
+ /* First try the original file */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ /* If there is no circular logging and the original file is full, just return empty string */
+ if(circular_chunks == 0)
+ {
+ filenameInUse[0] = '\0';
+ goto end;
+ }
+
+ /* We should log to filename.1, but if that's full we need to rotate logs and then still use
+ * filename.1 (since the old one got moved to filename.2) */
+ snprintf(filenameInUse, sizeof(filenameInUse), "%s.1", filename);
+
+ if(check_file_size(filenameInUse, max_size_kb))
+ {
+ goto end;
+ }
+
+ if(!rotate_log_files(filename, circular_chunks))
+ {
+ /* Since we failed to rotate, just wipe filename.1 so it can be reused */
+ m2mb_fs_remove(filenameInUse);
+ goto end;
+ }
+
+end:
+ return filenameInUse;
+}
+
+BOOLEAN azx_log_send_to_file(const CHAR* filename, UINT32 circular_chunks,
+ AZX_LOG_LEVEL_E min_level, UINT32 max_size_kb)
+
+{
+ if(!filename)
+ {
+ return FALSE;
+ }
+
+ if(circular_chunks == 0 && !check_file_size(filename, max_size_kb))
+ {
+ return FALSE;
+ }
+
+ if(logFile.fd)
+ {
+ m2mb_fs_fclose(logFile.fd);
+ logFile.fd = 0;
+ }
+
+ snprintf(logFile.current_name, sizeof(logFile.current_name), "%s",
+ get_next_log_filename(filename, circular_chunks, max_size_kb));
+
+ if(logFile.current_name[0] == '\0')
+ {
+ return FALSE;
+ }
+
+ logFile.fd = m2mb_fs_fopen(logFile.current_name, "a");
+
+ if(!logFile.fd)
+ {
+ return FALSE;
+ }
+
+ snprintf(logFile.name, sizeof(logFile.name), "%s", filename);
+ logFile.circular_chunks = circular_chunks;
+ logFile.min_level = min_level;
+ logFile.max_size_kb = max_size_kb;
+ logFile.cache_idx = 0;
+ return TRUE;
+}
+
+void azx_log_flush_to_file(void)
+{
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+ flush_log_to_file();
+ m2mb_os_sem_put(log_cfg.CSSemHandle);
+}
diff --git a/Samples/BRAVO_Tampering_Demo/azx/src/azx_utils.c b/Samples/BRAVO_Tampering_Demo/azx/src/azx_utils.c
index af11062..a15c5cf 100644
--- a/Samples/BRAVO_Tampering_Demo/azx/src/azx_utils.c
+++ b/Samples/BRAVO_Tampering_Demo/azx/src/azx_utils.c
@@ -1,5 +1,5 @@
-/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
-/* See LICENSE file in the project root for full license information. */
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
#include
#include
@@ -43,24 +43,26 @@ const CHAR* azx_hex_dump(const void* data, UINT32 len)
return buff;
}
-void azx_reboot_now()
+void azx_reboot_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Rebooting device\r\n");
m2mb_power_reboot(h);
}
}
-void azx_shutdown_now()
+void azx_shutdown_now(void)
{
M2MB_POWER_HANDLE h = NULL;
if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
{
- AZX_LOG_ERROR("It's dead, Jim!\r\n");
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
m2mb_power_shutdown(h);
}
}
diff --git a/Samples/BRAVO_Tampering_Demo/hdr/app_cfg.h b/Samples/BRAVO_Tampering_Demo/hdr/app_cfg.h
index 711dd51..5c90daa 100644
--- a/Samples/BRAVO_Tampering_Demo/hdr/app_cfg.h
+++ b/Samples/BRAVO_Tampering_Demo/hdr/app_cfg.h
@@ -23,7 +23,7 @@
/**
* @brief The current version of the Samples
*/
-#define VERSION "1.0.4"
+#define VERSION "1.0.5"
/**
* @name Log Settings
diff --git a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
index 364da7f..2362fe8 100644
--- a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
@@ -309,6 +309,21 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit( lwm2m_evHandle );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
azx_sleep_ms(1000);
/*new object instance information*/
@@ -328,19 +343,6 @@ uint8_t oneedge_init( INT32 obj_id )
return -1;
}
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(lwm2m_evHandle, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit( lwm2m_evHandle );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
return 0;
}
diff --git a/Samples/README.md b/Samples/README.md
index 3cef994..f5c831c 100644
--- a/Samples/README.md
+++ b/Samples/README.md
@@ -4,7 +4,7 @@
-Package Version: **1.0.4**
+Package Version: **1.0.5**
Firmware Version: **30.00.XX8**