Examples azx_pduDec_example.c .
+Examples azx_pduDec_example.c .
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__pdu_enc_usage.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__pdu_enc_usage.html
index 85ffc82c..db075348 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__pdu_enc_usage.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__pdu_enc_usage.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__string_usage.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__string_usage.html
index b324a5ed..2ca64615 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__string_usage.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__string_usage.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__task_usage.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__task_usage.html
index 1d117048..5a62f304 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__task_usage.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__task_usage.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__zlib_usage.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__zlib_usage.html
index cf1b0e2d..f3927cae 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__zlib_usage.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/group__zlib_usage.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/index.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/index.html
index 9aef4f7f..6721ab70 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/index.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/index.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/modules.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/modules.html
index 3f308f37..14d66f45 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/modules.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/modules.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreedata.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreedata.js
index ffe87c50..c31fb0df 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreedata.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreedata.js
@@ -53,10 +53,10 @@ var NAVTREEINDEX =
[
"annotated.html",
"azx__gnu__unistd_8h.html#a1865e3e4dbf6644059d3e46946f7763e",
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa6b5399de27c9237fbd27092f491e5ee3",
-"group__http_conf.html#gae45c5ce7ad62c080a02504578c721840",
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa32eb954fe288a3242719373705a47858",
+"group__http_conf.html#gae40751f148308705cd22ee69282afbe8",
"group__zlib_usage.html#ga480681b27918c801d6789f523d0d5f3c",
-"struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c"
+"struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a"
];
var SYNCONMSG = 'click to disable panel synchronisation';
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex1.js
index 530a86db..c637a420 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex1.js
@@ -58,196 +58,196 @@ var NAVTREEINDEX1 =
"azx__log_8h.html#acd61f6160b4cd02c2ec2259b5bc94670":[3,0,0,16,2],
"azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3":[3,0,0,16,17],
"azx__log_8h_source.html":[3,0,0,16],
-"azx__pdu_dec_8h.html":[3,0,0,17],
-"azx__pdu_dec_8h_source.html":[3,0,0,17],
-"azx__pdu_enc_8h.html":[3,0,0,18],
-"azx__pdu_enc_8h_source.html":[3,0,0,18],
-"azx__spi__flash__hw_8h.html":[3,0,0,19],
-"azx__spi__flash__hw_8h.html#a07a665355e55d6ae1828abe1d6819304":[3,0,0,19,12],
-"azx__spi__flash__hw_8h.html#a1659b80cf9a30ffc639119848a718f62":[3,0,0,19,6],
-"azx__spi__flash__hw_8h.html#a20ebe4cc8b2fb659d48d0b4d0c4fd34a":[3,0,0,19,2],
-"azx__spi__flash__hw_8h.html#a32acf28ca3346a2bccad41d4514499f7":[3,0,0,19,5],
-"azx__spi__flash__hw_8h.html#a44248d4c1bd6866e67455378a2bf1790":[3,0,0,19,9],
-"azx__spi__flash__hw_8h.html#a49c20261147c810dbceba2e36455b4e9":[3,0,0,19,8],
-"azx__spi__flash__hw_8h.html#a4b3317c6e4a1626293b240b514da8653":[3,0,0,19,11],
-"azx__spi__flash__hw_8h.html#a5245e4c2f253659ec6014246903b7f8f":[3,0,0,19,14],
-"azx__spi__flash__hw_8h.html#a53612c54b20ccc9e9f8b2d73b013e8f7":[3,0,0,19,1],
-"azx__spi__flash__hw_8h.html#a5527ef3473847be7dd6f33cd2c499480":[3,0,0,19,10],
-"azx__spi__flash__hw_8h.html#a6a0dff69b1407dc627df2b7fb614cf95":[3,0,0,19,0],
-"azx__spi__flash__hw_8h.html#a7bbe7ac978ff97cb9c6643147958ba51":[3,0,0,19,4],
-"azx__spi__flash__hw_8h.html#a89c906d45c42276b3a5d62b4ad7dec52":[3,0,0,19,7],
-"azx__spi__flash__hw_8h.html#aa1e09aaa8627cc9d02de43e8ef150b39":[3,0,0,19,13],
-"azx__spi__flash__hw_8h.html#ab38f4394b18ed0f5ba93fc860495c551":[3,0,0,19,3],
-"azx__spi__flash__hw_8h.html#acaf6fd5aa646d1cb15cd87adf03076fc":[3,0,0,19,15],
-"azx__spi__flash__hw_8h_source.html":[3,0,0,19],
-"azx__spi__flash__hw__external_8h.html":[3,0,0,20],
-"azx__spi__flash__hw__external_8h.html#a2f01c4e0ddfb139e7d2370ed22246086":[3,0,0,20,2],
-"azx__spi__flash__hw__external_8h.html#a30ebabd8032d7ed8178d4f4fc675801f":[3,0,0,20,5],
-"azx__spi__flash__hw__external_8h.html#a31e89ab2d83c013ebccd0acdeab761bc":[3,0,0,20,6],
-"azx__spi__flash__hw__external_8h.html#a36d39e4288b3fc5239e8810adde0e24d":[3,0,0,20,20],
-"azx__spi__flash__hw__external_8h.html#a537e2ae35a55fa47e6c2c4aebf3f6f02":[3,0,0,20,8],
-"azx__spi__flash__hw__external_8h.html#a754dcc8ec65ea7fb615ebbc0f990243e":[3,0,0,20,12],
-"azx__spi__flash__hw__external_8h.html#a7e4e3c62a3f048003df93efd7c5f269a":[3,0,0,20,10],
-"azx__spi__flash__hw__external_8h.html#a8443fcf9d673c50e9135db31781c708e":[3,0,0,20,14],
-"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08b":[3,0,0,20,18],
-"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08ba003937c107a83de367f4deb73d9c57e9":[3,0,0,20,18,2],
-"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08ba5dabb6cbc1f2cf77adf09b1d03275d8f":[3,0,0,20,18,1],
-"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08bad70101357ea6060c859c686f69f19ff4":[3,0,0,20,18,0],
-"azx__spi__flash__hw__external_8h.html#a8b37f6597f46f59b8a4e1412a64da631":[3,0,0,20,13],
-"azx__spi__flash__hw__external_8h.html#a924fd752855ddeae4dbda7c41814b06c":[3,0,0,20,7],
-"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638":[3,0,0,20,17],
-"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a25a723b5a93417bce7b79733debb36cc":[3,0,0,20,17,3],
-"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a5a1af7a33326bf86acc4aeb0c4f629a0":[3,0,0,20,17,1],
-"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638af8ddf1501237dfb358f6f258f03f5ab8":[3,0,0,20,17,2],
-"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638afafed77006d842f30bdf6fc64b136267":[3,0,0,20,17,0],
-"azx__spi__flash__hw__external_8h.html#aa344d49e0031dafdc610dc211a8db8eb":[3,0,0,20,11],
-"azx__spi__flash__hw__external_8h.html#aaf0e0ddbda5e076eb92c1bcf2a955a83":[3,0,0,20,4],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0":[3,0,0,20,15],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a03c84d5dcb4ac88c5be9f5bcab87fed1":[3,0,0,20,15,33],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a0e311d48f5cbe947bea808c208e4d410":[3,0,0,20,15,10],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a10b8be8e4fec11ae45e9995a47b50aca":[3,0,0,20,15,21],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a1c32f465e43eb8412fd26851fe6e51ec":[3,0,0,20,15,26],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a1ea1323553ace521e7db564a00855267":[3,0,0,20,15,2],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a225189ac11629e89cd4363548176c6b8":[3,0,0,20,15,9],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a2985a0cccbc076b75c04764814c5d2aa":[3,0,0,20,15,12],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a341b627c40e1866e3af07bc92d69878f":[3,0,0,20,15,23],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a3885cd092bbd12a3856b567e480ad30f":[3,0,0,20,15,34],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a5103b437ae9be7c764ba3af5b9fd404c":[3,0,0,20,15,15],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a55503797a75232b6ea0fda0a5c0add0b":[3,0,0,20,15,0],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a5718ca92bf02e8a0ee7cccfa478460f8":[3,0,0,20,15,3],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a6231b38182f30f4af643ba5c9aacebb5":[3,0,0,20,15,7],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a701c914a58fb1c21a91375ba3d19fef4":[3,0,0,20,15,35],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a72c288c9477ff3cf377e6424f92c111b":[3,0,0,20,15,31],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a7cbe15d94cda9af0fe9387a99283e683":[3,0,0,20,15,20],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a7f47815a4f99bae7080402a946a63cda":[3,0,0,20,15,6],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8b5c85e550298eb0e1e6c593481c444d":[3,0,0,20,15,28],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8ba3bbb0597ac8afc4a24c963a82584c":[3,0,0,20,15,29],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8c3c01b5d50cd90681c7b69b2aa7744e":[3,0,0,20,15,18],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8e8e8deabf2bde1ff9ab8b8e5241c2d4":[3,0,0,20,15,17],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a943f1a23f6ddd95f146baa0301b783ad":[3,0,0,20,15,19],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a97b56e7d579ccbb9ae1c1f0405ae53da":[3,0,0,20,15,4],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aac2bc849926a9e9cc6f289b8ed18acc4":[3,0,0,20,15,22],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ab06860a3b4f0088cd1a2e6f494433682":[3,0,0,20,15,13],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aba5b1f0b516ac8d24cea603d09d83910":[3,0,0,20,15,1],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ac3394591e65c66665027c55a8be85ba7":[3,0,0,20,15,27],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad3a7a832da77ab4ee282bd89830055c0":[3,0,0,20,15,14],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad3e95ae151b1ef07b99b86e81703d852":[3,0,0,20,15,16],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad41d160b0f3857a236109a74af6b4a2b":[3,0,0,20,15,32],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ade635da0cd9e14bfb705472c704d9bed":[3,0,0,20,15,5],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aef416d06618ae6037aa6a18536d6a190":[3,0,0,20,15,25],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aef95ad68ce707b0b57300c1684d20696":[3,0,0,20,15,8],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0af3400daf9a766ee75b210177d8b861f2":[3,0,0,20,15,24],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0af3879835d576e8deaa3e16b2fd3bdad5":[3,0,0,20,15,11],
-"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0afebc34a027d1fdcbef98c103122d2431":[3,0,0,20,15,30],
-"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c":[3,0,0,20,19],
-"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a":[3,0,0,20,19,3],
-"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1":[3,0,0,20,19,0],
-"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5":[3,0,0,20,19,1],
-"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67":[3,0,0,20,19,2],
-"azx__spi__flash__hw__external_8h.html#ae0ed8056d1818f56f370214da2204d8e":[3,0,0,20,3],
-"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0c":[3,0,0,20,16],
-"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8":[3,0,0,20,16,0],
-"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619":[3,0,0,20,16,1],
-"azx__spi__flash__hw__external_8h.html#aef07b3b113087d735c9229f6c381c60a":[3,0,0,20,9],
-"azx__spi__flash__hw__external_8h_source.html":[3,0,0,20],
-"azx__spi__flash__jsc_8h.html":[3,0,0,21],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73d":[3,0,0,21,44],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da1ae9e11a497ca51ef655eda907f36543":[3,0,0,21,44,2],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da6597e9636c57c365067f9d1bdf1df9d4":[3,0,0,21,44,3],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da8ab89f36072b323837230fb4ea0b261e":[3,0,0,21,44,1],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73daa6391a9fb711de60b63e0b35f7945192":[3,0,0,21,44,0],
-"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73dad030f569adf79ef16c07155db6a2ffee":[3,0,0,21,44,4],
-"azx__spi__flash__jsc_8h.html#a0a658f007e96b84ac78c2e837b97a551":[3,0,0,21,51],
-"azx__spi__flash__jsc_8h.html#a0b45a7b782a5950b356d5dc5464fc287":[3,0,0,21,23],
-"azx__spi__flash__jsc_8h.html#a0de92912fb9daefb4b38b77d2a6489b3":[3,0,0,21,61],
-"azx__spi__flash__jsc_8h.html#a1f6b395606a7308060596b1b13398e4c":[3,0,0,21,33],
-"azx__spi__flash__jsc_8h.html#a235cd76a9a8c1b91aed9dd252261ea55":[3,0,0,21,8],
-"azx__spi__flash__jsc_8h.html#a2c90be8f38abbab48e1902cff4c3e023":[3,0,0,21,37],
-"azx__spi__flash__jsc_8h.html#a3474db546a452490bfdcc98be620e189":[3,0,0,21,32],
-"azx__spi__flash__jsc_8h.html#a34b72a188122eab58eacccc9bced4bf0":[3,0,0,21,34],
-"azx__spi__flash__jsc_8h.html#a353fa68e8b51bdede6ee211d8cd31803":[3,0,0,21,56],
-"azx__spi__flash__jsc_8h.html#a393c7e7ade4f722d204d31fd3025bda9":[3,0,0,21,11],
-"azx__spi__flash__jsc_8h.html#a56386e80f801a39d557cf9977ee9f757":[3,0,0,21,38],
-"azx__spi__flash__jsc_8h.html#a58ad5c71f224ba7b8e78f0c7f87db7cc":[3,0,0,21,52],
-"azx__spi__flash__jsc_8h.html#a594e071851239da3eb2f1fd7345e3574":[3,0,0,21,16],
-"azx__spi__flash__jsc_8h.html#a5c0c083c9a986e82ce993dcfb7492630":[3,0,0,21,27],
-"azx__spi__flash__jsc_8h.html#a6097029ad73f4786cac5179724bfedae":[3,0,0,21,40],
-"azx__spi__flash__jsc_8h.html#a6891137858e6a444c5d9242882f59f00":[3,0,0,21,22],
-"azx__spi__flash__jsc_8h.html#a783362908d603d4587037f70c8aa57db":[3,0,0,21,29],
-"azx__spi__flash__jsc_8h.html#a7931b157023d73bb2f25298acb3355c9":[3,0,0,21,13],
-"azx__spi__flash__jsc_8h.html#a7ce55fd3b71387760d27abbcfc4b9b9b":[3,0,0,21,50],
-"azx__spi__flash__jsc_8h.html#a7f2842ed4e9accbce39a290612b0099c":[3,0,0,21,24],
-"azx__spi__flash__jsc_8h.html#a8e3095bb2fbf30b6bbe8c53ed72f5f99":[3,0,0,21,59],
-"azx__spi__flash__jsc_8h.html#a8fa51bf0f0afd1fb3923852d74a1f71a":[3,0,0,21,39],
-"azx__spi__flash__jsc_8h.html#a9680974585e3c8aedfc59ee0fc3664bd":[3,0,0,21,20],
-"azx__spi__flash__jsc_8h.html#a96d389276fc7ab72fb67e41eb4d2539d":[3,0,0,21,46],
-"azx__spi__flash__jsc_8h.html#a9ba7fe76aeba6eb0f6ceef7ad3a9496f":[3,0,0,21,7],
-"azx__spi__flash__jsc_8h.html#a9c3d14e93f07b99e0313f20cbd7844bc":[3,0,0,21,36],
-"azx__spi__flash__jsc_8h.html#aa023633b3ae3f8e4438681bf6dd99450":[3,0,0,21,58],
-"azx__spi__flash__jsc_8h.html#aa4303b6947d5d48883703f9f3f28d4cc":[3,0,0,21,14],
-"azx__spi__flash__jsc_8h.html#ab34385c4aa10e19963db1134e432026c":[3,0,0,21,21],
-"azx__spi__flash__jsc_8h.html#ab792a628007418f5dba661ecbdfdbde1":[3,0,0,21,60],
-"azx__spi__flash__jsc_8h.html#ab898071398b359603a35c202e9c65f3b":[3,0,0,21,45],
-"azx__spi__flash__jsc_8h.html#abf0c4c0871dbec223a5d37ae3c957e52":[3,0,0,21,48],
-"azx__spi__flash__jsc_8h.html#ac53e225a054ecab4918c56de96ee5173":[3,0,0,21,19],
-"azx__spi__flash__jsc_8h.html#ac85ef83ccfa97d130a4c1dbc591e033a":[3,0,0,21,17],
-"azx__spi__flash__jsc_8h.html#aca7737afad03f34a4f5f7898befb1707":[3,0,0,21,26],
-"azx__spi__flash__jsc_8h.html#acc7a6a02109ddd98f64dfc74c141eedc":[3,0,0,21,10],
-"azx__spi__flash__jsc_8h.html#ad3a79469bde8898d93ea2c2322381530":[3,0,0,21,30],
-"azx__spi__flash__jsc_8h.html#adc6a789d54d5db215fb5d98cb8aeb424":[3,0,0,21,15],
-"azx__spi__flash__jsc_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a56927300333604a220d08bde6252c7b4":[3,0,0,21,41],
-"azx__spi__flash__jsc_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a911e854f3baea378f4556a02ae63a1e7":[3,0,0,21,43],
-"azx__spi__flash__jsc_8h.html#adf764cbdea00d65edcd07bb9953ad2b7aa73712d2a90bddf732f129471e41740c":[3,0,0,21,42],
-"azx__spi__flash__jsc_8h.html#ae0ce5dec84f2a12c41842f877eeeec7e":[3,0,0,21,53],
-"azx__spi__flash__jsc_8h.html#ae2913f43be17555a6ce23965c4684515":[3,0,0,21,55],
-"azx__spi__flash__jsc_8h.html#ae35dbbeb7d8c4eed134edd326f93e67b":[3,0,0,21,28],
-"azx__spi__flash__jsc_8h.html#ae681287eda124bd215d2af4d90519154":[3,0,0,21,62],
-"azx__spi__flash__jsc_8h.html#ae7f329eb0286d0bd07d3615f21f821a8":[3,0,0,21,31],
-"azx__spi__flash__jsc_8h.html#aea80bb870d1991f2611a34c9754d100f":[3,0,0,21,25],
-"azx__spi__flash__jsc_8h.html#aec87a2d0aff7725daea171453179169a":[3,0,0,21,35],
-"azx__spi__flash__jsc_8h.html#af0458ec80a9a24368fd4a61908a8ac5e":[3,0,0,21,57],
-"azx__spi__flash__jsc_8h.html#af1a3e763fb7eb2a355b0a4db301ec2b4":[3,0,0,21,18],
-"azx__spi__flash__jsc_8h.html#af55c5ca20b66bf5cd4c6a069f9bef4f0":[3,0,0,21,47],
-"azx__spi__flash__jsc_8h.html#af5a8d740f57623c44668aef78727c6fa":[3,0,0,21,9],
-"azx__spi__flash__jsc_8h.html#af69895286659c9f84c75199d6b44f8a5":[3,0,0,21,12],
-"azx__spi__flash__jsc_8h.html#af7cd45aae52097d59fe4ae942e37336c":[3,0,0,21,49],
-"azx__spi__flash__jsc_8h.html#afa9aa4e0c25876ccc0ea6e805c38b640":[3,0,0,21,54],
-"azx__spi__flash__jsc_8h_source.html":[3,0,0,21],
-"azx__spi__flash__strings_8h.html":[3,0,0,22],
-"azx__spi__flash__strings_8h_source.html":[3,0,0,22],
-"azx__spi__flash__types_8h.html":[3,0,0,23],
-"azx__spi__flash__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4":[3,0,0,23,1],
-"azx__spi__flash__types_8h.html#a0bd8ff01497435727af1f16f3eae6bd9":[3,0,0,23,7],
-"azx__spi__flash__types_8h.html#a19883b325c6281a72358a5cd0d36f8ac":[3,0,0,23,5],
-"azx__spi__flash__types_8h.html#a41f9c5fb8b08eb5dc3edce4dcb37fee7":[3,0,0,23,2],
-"azx__spi__flash__types_8h.html#a4b0af0cd13da33916c109188f461fa50":[3,0,0,23,4],
-"azx__spi__flash__types_8h.html#a53d77af47fa2ef26adb09cd0713da03a":[3,0,0,23,9],
-"azx__spi__flash__types_8h.html#a5808a93eb3b3af13861b30543cdd4ed7":[3,0,0,23,8],
-"azx__spi__flash__types_8h.html#a59df8859d55ed427c38e55abda8b8e99":[3,0,0,23,12],
-"azx__spi__flash__types_8h.html#a65e9886d74aaee76545e83dd09011727":[3,0,0,23,0],
-"azx__spi__flash__types_8h.html#a694f9dcb7a5209d1228405cf0b0a6152":[3,0,0,23,10],
-"azx__spi__flash__types_8h.html#abcff9f88368c7ee72c8220a24c8cc376":[3,0,0,23,11],
-"azx__spi__flash__types_8h.html#accc7068cb46778108251b13010f49303":[3,0,0,23,3],
-"azx__spi__flash__types_8h.html#adb312138f7df553ff99083e080b26a5a":[3,0,0,23,6],
-"azx__spi__flash__types_8h_source.html":[3,0,0,23],
-"azx__string__utils_8h.html":[3,0,0,24],
-"azx__string__utils_8h.html#a1486bd91d85c805d7f7593c751e5cbcb":[3,0,0,24,6],
-"azx__string__utils_8h_source.html":[3,0,0,24],
-"azx__tasks_8h.html":[3,0,0,25],
-"azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a":[3,0,0,25,17],
-"azx__tasks_8h_source.html":[3,0,0,25],
-"azx__utils_8h.html":[3,0,0,26],
-"azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f":[3,0,0,26,2],
-"azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf":[3,0,0,26,3],
-"azx__utils_8h.html#a8c7358115439ddd523797f3d027df1f2":[3,0,0,26,1],
-"azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5":[3,0,0,26,5],
-"azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9":[3,0,0,26,0],
-"azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df":[3,0,0,26,4],
-"azx__utils_8h_source.html":[3,0,0,26],
-"azx__zlib_8h.html":[3,0,0,27],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854af":[3,0,0,27,90],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa002a1feb14ec07376e073b7c2f839ebc":[3,0,0,27,90,0],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa21f940bf73872ebb94413fe32c85cdf3":[3,0,0,27,90,1],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa2d7ca7fcd77b985f6d80fdbd39876637":[3,0,0,27,90,8],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa32eb954fe288a3242719373705a47858":[3,0,0,27,90,9]
+"azx__pdu_common_8h_source.html":[3,0,0,17],
+"azx__pdu_dec_8h.html":[3,0,0,18],
+"azx__pdu_dec_8h_source.html":[3,0,0,18],
+"azx__pdu_enc_8h.html":[3,0,0,19],
+"azx__pdu_enc_8h_source.html":[3,0,0,19],
+"azx__spi__flash__hw_8h.html":[3,0,0,20],
+"azx__spi__flash__hw_8h.html#a07a665355e55d6ae1828abe1d6819304":[3,0,0,20,12],
+"azx__spi__flash__hw_8h.html#a1659b80cf9a30ffc639119848a718f62":[3,0,0,20,6],
+"azx__spi__flash__hw_8h.html#a20ebe4cc8b2fb659d48d0b4d0c4fd34a":[3,0,0,20,2],
+"azx__spi__flash__hw_8h.html#a32acf28ca3346a2bccad41d4514499f7":[3,0,0,20,5],
+"azx__spi__flash__hw_8h.html#a44248d4c1bd6866e67455378a2bf1790":[3,0,0,20,9],
+"azx__spi__flash__hw_8h.html#a49c20261147c810dbceba2e36455b4e9":[3,0,0,20,8],
+"azx__spi__flash__hw_8h.html#a4b3317c6e4a1626293b240b514da8653":[3,0,0,20,11],
+"azx__spi__flash__hw_8h.html#a5245e4c2f253659ec6014246903b7f8f":[3,0,0,20,14],
+"azx__spi__flash__hw_8h.html#a53612c54b20ccc9e9f8b2d73b013e8f7":[3,0,0,20,1],
+"azx__spi__flash__hw_8h.html#a5527ef3473847be7dd6f33cd2c499480":[3,0,0,20,10],
+"azx__spi__flash__hw_8h.html#a6a0dff69b1407dc627df2b7fb614cf95":[3,0,0,20,0],
+"azx__spi__flash__hw_8h.html#a7bbe7ac978ff97cb9c6643147958ba51":[3,0,0,20,4],
+"azx__spi__flash__hw_8h.html#a89c906d45c42276b3a5d62b4ad7dec52":[3,0,0,20,7],
+"azx__spi__flash__hw_8h.html#aa1e09aaa8627cc9d02de43e8ef150b39":[3,0,0,20,13],
+"azx__spi__flash__hw_8h.html#ab38f4394b18ed0f5ba93fc860495c551":[3,0,0,20,3],
+"azx__spi__flash__hw_8h.html#acaf6fd5aa646d1cb15cd87adf03076fc":[3,0,0,20,15],
+"azx__spi__flash__hw_8h_source.html":[3,0,0,20],
+"azx__spi__flash__hw__external_8h.html":[3,0,0,21],
+"azx__spi__flash__hw__external_8h.html#a2f01c4e0ddfb139e7d2370ed22246086":[3,0,0,21,2],
+"azx__spi__flash__hw__external_8h.html#a30ebabd8032d7ed8178d4f4fc675801f":[3,0,0,21,5],
+"azx__spi__flash__hw__external_8h.html#a31e89ab2d83c013ebccd0acdeab761bc":[3,0,0,21,6],
+"azx__spi__flash__hw__external_8h.html#a36d39e4288b3fc5239e8810adde0e24d":[3,0,0,21,20],
+"azx__spi__flash__hw__external_8h.html#a537e2ae35a55fa47e6c2c4aebf3f6f02":[3,0,0,21,8],
+"azx__spi__flash__hw__external_8h.html#a754dcc8ec65ea7fb615ebbc0f990243e":[3,0,0,21,12],
+"azx__spi__flash__hw__external_8h.html#a7e4e3c62a3f048003df93efd7c5f269a":[3,0,0,21,10],
+"azx__spi__flash__hw__external_8h.html#a8443fcf9d673c50e9135db31781c708e":[3,0,0,21,14],
+"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08b":[3,0,0,21,18],
+"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08ba003937c107a83de367f4deb73d9c57e9":[3,0,0,21,18,2],
+"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08ba5dabb6cbc1f2cf77adf09b1d03275d8f":[3,0,0,21,18,1],
+"azx__spi__flash__hw__external_8h.html#a86bd3d46e237918358c2167c21aff08bad70101357ea6060c859c686f69f19ff4":[3,0,0,21,18,0],
+"azx__spi__flash__hw__external_8h.html#a8b37f6597f46f59b8a4e1412a64da631":[3,0,0,21,13],
+"azx__spi__flash__hw__external_8h.html#a924fd752855ddeae4dbda7c41814b06c":[3,0,0,21,7],
+"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638":[3,0,0,21,17],
+"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a25a723b5a93417bce7b79733debb36cc":[3,0,0,21,17,3],
+"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a5a1af7a33326bf86acc4aeb0c4f629a0":[3,0,0,21,17,1],
+"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638af8ddf1501237dfb358f6f258f03f5ab8":[3,0,0,21,17,2],
+"azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638afafed77006d842f30bdf6fc64b136267":[3,0,0,21,17,0],
+"azx__spi__flash__hw__external_8h.html#aa344d49e0031dafdc610dc211a8db8eb":[3,0,0,21,11],
+"azx__spi__flash__hw__external_8h.html#aaf0e0ddbda5e076eb92c1bcf2a955a83":[3,0,0,21,4],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0":[3,0,0,21,15],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a03c84d5dcb4ac88c5be9f5bcab87fed1":[3,0,0,21,15,33],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a0e311d48f5cbe947bea808c208e4d410":[3,0,0,21,15,10],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a10b8be8e4fec11ae45e9995a47b50aca":[3,0,0,21,15,21],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a1c32f465e43eb8412fd26851fe6e51ec":[3,0,0,21,15,26],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a1ea1323553ace521e7db564a00855267":[3,0,0,21,15,2],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a225189ac11629e89cd4363548176c6b8":[3,0,0,21,15,9],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a2985a0cccbc076b75c04764814c5d2aa":[3,0,0,21,15,12],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a341b627c40e1866e3af07bc92d69878f":[3,0,0,21,15,23],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a3885cd092bbd12a3856b567e480ad30f":[3,0,0,21,15,34],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a5103b437ae9be7c764ba3af5b9fd404c":[3,0,0,21,15,15],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a55503797a75232b6ea0fda0a5c0add0b":[3,0,0,21,15,0],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a5718ca92bf02e8a0ee7cccfa478460f8":[3,0,0,21,15,3],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a6231b38182f30f4af643ba5c9aacebb5":[3,0,0,21,15,7],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a701c914a58fb1c21a91375ba3d19fef4":[3,0,0,21,15,35],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a72c288c9477ff3cf377e6424f92c111b":[3,0,0,21,15,31],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a7cbe15d94cda9af0fe9387a99283e683":[3,0,0,21,15,20],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a7f47815a4f99bae7080402a946a63cda":[3,0,0,21,15,6],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8b5c85e550298eb0e1e6c593481c444d":[3,0,0,21,15,28],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8ba3bbb0597ac8afc4a24c963a82584c":[3,0,0,21,15,29],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8c3c01b5d50cd90681c7b69b2aa7744e":[3,0,0,21,15,18],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a8e8e8deabf2bde1ff9ab8b8e5241c2d4":[3,0,0,21,15,17],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a943f1a23f6ddd95f146baa0301b783ad":[3,0,0,21,15,19],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0a97b56e7d579ccbb9ae1c1f0405ae53da":[3,0,0,21,15,4],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aac2bc849926a9e9cc6f289b8ed18acc4":[3,0,0,21,15,22],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ab06860a3b4f0088cd1a2e6f494433682":[3,0,0,21,15,13],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aba5b1f0b516ac8d24cea603d09d83910":[3,0,0,21,15,1],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ac3394591e65c66665027c55a8be85ba7":[3,0,0,21,15,27],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad3a7a832da77ab4ee282bd89830055c0":[3,0,0,21,15,14],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad3e95ae151b1ef07b99b86e81703d852":[3,0,0,21,15,16],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ad41d160b0f3857a236109a74af6b4a2b":[3,0,0,21,15,32],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0ade635da0cd9e14bfb705472c704d9bed":[3,0,0,21,15,5],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aef416d06618ae6037aa6a18536d6a190":[3,0,0,21,15,25],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0aef95ad68ce707b0b57300c1684d20696":[3,0,0,21,15,8],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0af3400daf9a766ee75b210177d8b861f2":[3,0,0,21,15,24],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0af3879835d576e8deaa3e16b2fd3bdad5":[3,0,0,21,15,11],
+"azx__spi__flash__hw__external_8h.html#ac90d9642eb8941dc8bf5900c889168d0afebc34a027d1fdcbef98c103122d2431":[3,0,0,21,15,30],
+"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c":[3,0,0,21,19],
+"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a":[3,0,0,21,19,3],
+"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1":[3,0,0,21,19,0],
+"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5":[3,0,0,21,19,1],
+"azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67":[3,0,0,21,19,2],
+"azx__spi__flash__hw__external_8h.html#ae0ed8056d1818f56f370214da2204d8e":[3,0,0,21,3],
+"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0c":[3,0,0,21,16],
+"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8":[3,0,0,21,16,0],
+"azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619":[3,0,0,21,16,1],
+"azx__spi__flash__hw__external_8h.html#aef07b3b113087d735c9229f6c381c60a":[3,0,0,21,9],
+"azx__spi__flash__hw__external_8h_source.html":[3,0,0,21],
+"azx__spi__flash__jsc_8h.html":[3,0,0,22],
+"azx__spi__flash__jsc_8h.html#a0411cd49bb5b71852cecd93bcbf0ca2da56927300333604a220d08bde6252c7b4":[3,0,0,22,41],
+"azx__spi__flash__jsc_8h.html#a0411cd49bb5b71852cecd93bcbf0ca2da911e854f3baea378f4556a02ae63a1e7":[3,0,0,22,43],
+"azx__spi__flash__jsc_8h.html#a0411cd49bb5b71852cecd93bcbf0ca2daa73712d2a90bddf732f129471e41740c":[3,0,0,22,42],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73d":[3,0,0,22,44],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da1ae9e11a497ca51ef655eda907f36543":[3,0,0,22,44,2],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da6597e9636c57c365067f9d1bdf1df9d4":[3,0,0,22,44,3],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73da8ab89f36072b323837230fb4ea0b261e":[3,0,0,22,44,1],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73daa6391a9fb711de60b63e0b35f7945192":[3,0,0,22,44,0],
+"azx__spi__flash__jsc_8h.html#a04f24c0d905e06c83c3ab2a6f509d73dad030f569adf79ef16c07155db6a2ffee":[3,0,0,22,44,4],
+"azx__spi__flash__jsc_8h.html#a0a658f007e96b84ac78c2e837b97a551":[3,0,0,22,51],
+"azx__spi__flash__jsc_8h.html#a0b45a7b782a5950b356d5dc5464fc287":[3,0,0,22,23],
+"azx__spi__flash__jsc_8h.html#a0de92912fb9daefb4b38b77d2a6489b3":[3,0,0,22,61],
+"azx__spi__flash__jsc_8h.html#a1f6b395606a7308060596b1b13398e4c":[3,0,0,22,33],
+"azx__spi__flash__jsc_8h.html#a235cd76a9a8c1b91aed9dd252261ea55":[3,0,0,22,8],
+"azx__spi__flash__jsc_8h.html#a2c90be8f38abbab48e1902cff4c3e023":[3,0,0,22,37],
+"azx__spi__flash__jsc_8h.html#a3474db546a452490bfdcc98be620e189":[3,0,0,22,32],
+"azx__spi__flash__jsc_8h.html#a34b72a188122eab58eacccc9bced4bf0":[3,0,0,22,34],
+"azx__spi__flash__jsc_8h.html#a353fa68e8b51bdede6ee211d8cd31803":[3,0,0,22,56],
+"azx__spi__flash__jsc_8h.html#a393c7e7ade4f722d204d31fd3025bda9":[3,0,0,22,11],
+"azx__spi__flash__jsc_8h.html#a56386e80f801a39d557cf9977ee9f757":[3,0,0,22,38],
+"azx__spi__flash__jsc_8h.html#a58ad5c71f224ba7b8e78f0c7f87db7cc":[3,0,0,22,52],
+"azx__spi__flash__jsc_8h.html#a594e071851239da3eb2f1fd7345e3574":[3,0,0,22,16],
+"azx__spi__flash__jsc_8h.html#a5c0c083c9a986e82ce993dcfb7492630":[3,0,0,22,27],
+"azx__spi__flash__jsc_8h.html#a6097029ad73f4786cac5179724bfedae":[3,0,0,22,40],
+"azx__spi__flash__jsc_8h.html#a6891137858e6a444c5d9242882f59f00":[3,0,0,22,22],
+"azx__spi__flash__jsc_8h.html#a783362908d603d4587037f70c8aa57db":[3,0,0,22,29],
+"azx__spi__flash__jsc_8h.html#a7931b157023d73bb2f25298acb3355c9":[3,0,0,22,13],
+"azx__spi__flash__jsc_8h.html#a7ce55fd3b71387760d27abbcfc4b9b9b":[3,0,0,22,50],
+"azx__spi__flash__jsc_8h.html#a7f2842ed4e9accbce39a290612b0099c":[3,0,0,22,24],
+"azx__spi__flash__jsc_8h.html#a8e3095bb2fbf30b6bbe8c53ed72f5f99":[3,0,0,22,59],
+"azx__spi__flash__jsc_8h.html#a8fa51bf0f0afd1fb3923852d74a1f71a":[3,0,0,22,39],
+"azx__spi__flash__jsc_8h.html#a9680974585e3c8aedfc59ee0fc3664bd":[3,0,0,22,20],
+"azx__spi__flash__jsc_8h.html#a96d389276fc7ab72fb67e41eb4d2539d":[3,0,0,22,46],
+"azx__spi__flash__jsc_8h.html#a9ba7fe76aeba6eb0f6ceef7ad3a9496f":[3,0,0,22,7],
+"azx__spi__flash__jsc_8h.html#a9c3d14e93f07b99e0313f20cbd7844bc":[3,0,0,22,36],
+"azx__spi__flash__jsc_8h.html#aa023633b3ae3f8e4438681bf6dd99450":[3,0,0,22,58],
+"azx__spi__flash__jsc_8h.html#aa4303b6947d5d48883703f9f3f28d4cc":[3,0,0,22,14],
+"azx__spi__flash__jsc_8h.html#ab34385c4aa10e19963db1134e432026c":[3,0,0,22,21],
+"azx__spi__flash__jsc_8h.html#ab792a628007418f5dba661ecbdfdbde1":[3,0,0,22,60],
+"azx__spi__flash__jsc_8h.html#ab898071398b359603a35c202e9c65f3b":[3,0,0,22,45],
+"azx__spi__flash__jsc_8h.html#abf0c4c0871dbec223a5d37ae3c957e52":[3,0,0,22,48],
+"azx__spi__flash__jsc_8h.html#ac53e225a054ecab4918c56de96ee5173":[3,0,0,22,19],
+"azx__spi__flash__jsc_8h.html#ac85ef83ccfa97d130a4c1dbc591e033a":[3,0,0,22,17],
+"azx__spi__flash__jsc_8h.html#aca7737afad03f34a4f5f7898befb1707":[3,0,0,22,26],
+"azx__spi__flash__jsc_8h.html#acc7a6a02109ddd98f64dfc74c141eedc":[3,0,0,22,10],
+"azx__spi__flash__jsc_8h.html#ad3a79469bde8898d93ea2c2322381530":[3,0,0,22,30],
+"azx__spi__flash__jsc_8h.html#adc6a789d54d5db215fb5d98cb8aeb424":[3,0,0,22,15],
+"azx__spi__flash__jsc_8h.html#ae0ce5dec84f2a12c41842f877eeeec7e":[3,0,0,22,53],
+"azx__spi__flash__jsc_8h.html#ae2913f43be17555a6ce23965c4684515":[3,0,0,22,55],
+"azx__spi__flash__jsc_8h.html#ae35dbbeb7d8c4eed134edd326f93e67b":[3,0,0,22,28],
+"azx__spi__flash__jsc_8h.html#ae681287eda124bd215d2af4d90519154":[3,0,0,22,62],
+"azx__spi__flash__jsc_8h.html#ae7f329eb0286d0bd07d3615f21f821a8":[3,0,0,22,31],
+"azx__spi__flash__jsc_8h.html#aea80bb870d1991f2611a34c9754d100f":[3,0,0,22,25],
+"azx__spi__flash__jsc_8h.html#aec87a2d0aff7725daea171453179169a":[3,0,0,22,35],
+"azx__spi__flash__jsc_8h.html#af0458ec80a9a24368fd4a61908a8ac5e":[3,0,0,22,57],
+"azx__spi__flash__jsc_8h.html#af1a3e763fb7eb2a355b0a4db301ec2b4":[3,0,0,22,18],
+"azx__spi__flash__jsc_8h.html#af55c5ca20b66bf5cd4c6a069f9bef4f0":[3,0,0,22,47],
+"azx__spi__flash__jsc_8h.html#af5a8d740f57623c44668aef78727c6fa":[3,0,0,22,9],
+"azx__spi__flash__jsc_8h.html#af69895286659c9f84c75199d6b44f8a5":[3,0,0,22,12],
+"azx__spi__flash__jsc_8h.html#af7cd45aae52097d59fe4ae942e37336c":[3,0,0,22,49],
+"azx__spi__flash__jsc_8h.html#afa9aa4e0c25876ccc0ea6e805c38b640":[3,0,0,22,54],
+"azx__spi__flash__jsc_8h_source.html":[3,0,0,22],
+"azx__spi__flash__strings_8h.html":[3,0,0,23],
+"azx__spi__flash__strings_8h_source.html":[3,0,0,23],
+"azx__spi__flash__types_8h.html":[3,0,0,24],
+"azx__spi__flash__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4":[3,0,0,24,1],
+"azx__spi__flash__types_8h.html#a0bd8ff01497435727af1f16f3eae6bd9":[3,0,0,24,7],
+"azx__spi__flash__types_8h.html#a19883b325c6281a72358a5cd0d36f8ac":[3,0,0,24,5],
+"azx__spi__flash__types_8h.html#a41f9c5fb8b08eb5dc3edce4dcb37fee7":[3,0,0,24,2],
+"azx__spi__flash__types_8h.html#a4b0af0cd13da33916c109188f461fa50":[3,0,0,24,4],
+"azx__spi__flash__types_8h.html#a53d77af47fa2ef26adb09cd0713da03a":[3,0,0,24,9],
+"azx__spi__flash__types_8h.html#a5808a93eb3b3af13861b30543cdd4ed7":[3,0,0,24,8],
+"azx__spi__flash__types_8h.html#a59df8859d55ed427c38e55abda8b8e99":[3,0,0,24,12],
+"azx__spi__flash__types_8h.html#a65e9886d74aaee76545e83dd09011727":[3,0,0,24,0],
+"azx__spi__flash__types_8h.html#a694f9dcb7a5209d1228405cf0b0a6152":[3,0,0,24,10],
+"azx__spi__flash__types_8h.html#abcff9f88368c7ee72c8220a24c8cc376":[3,0,0,24,11],
+"azx__spi__flash__types_8h.html#accc7068cb46778108251b13010f49303":[3,0,0,24,3],
+"azx__spi__flash__types_8h.html#adb312138f7df553ff99083e080b26a5a":[3,0,0,24,6],
+"azx__spi__flash__types_8h_source.html":[3,0,0,24],
+"azx__string__utils_8h.html":[3,0,0,25],
+"azx__string__utils_8h.html#a1486bd91d85c805d7f7593c751e5cbcb":[3,0,0,25,6],
+"azx__string__utils_8h_source.html":[3,0,0,25],
+"azx__tasks_8h.html":[3,0,0,26],
+"azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a":[3,0,0,26,17],
+"azx__tasks_8h_source.html":[3,0,0,26],
+"azx__utils_8h.html":[3,0,0,27],
+"azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f":[3,0,0,27,2],
+"azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf":[3,0,0,27,3],
+"azx__utils_8h.html#a8c7358115439ddd523797f3d027df1f2":[3,0,0,27,1],
+"azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5":[3,0,0,27,5],
+"azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9":[3,0,0,27,0],
+"azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df":[3,0,0,27,4],
+"azx__utils_8h_source.html":[3,0,0,27],
+"azx__zlib_8h.html":[3,0,0,28],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854af":[3,0,0,28,90],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa002a1feb14ec07376e073b7c2f839ebc":[3,0,0,28,90,0],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa21f940bf73872ebb94413fe32c85cdf3":[3,0,0,28,90,1],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa2d7ca7fcd77b985f6d80fdbd39876637":[3,0,0,28,90,8]
};
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex2.js
index 14f69f7e..d07932d8 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex2.js
@@ -1,14 +1,15 @@
var NAVTREEINDEX2 =
{
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa6b5399de27c9237fbd27092f491e5ee3":[3,0,0,27,90,2],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa8014f2fbf8748e22bebc888326e903c3":[3,0,0,27,90,10],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afab07d41efab2d2f6afb72c154d3a98f1a":[3,0,0,27,90,3],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afab8d4d275617b1fdba3759e43525484b6":[3,0,0,27,90,4],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afabbc12c8efd45fd19a7cd862d54f96f49":[3,0,0,27,90,7],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afac3efc58bc96e5e5ea948d7acee55d202":[3,0,0,27,90,11],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afad820ebee5d8bf24157346d891927e4bf":[3,0,0,27,90,5],
-"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afafbb42efd3adfe609e67041e28a4a2443":[3,0,0,27,90,6],
-"azx__zlib_8h_source.html":[3,0,0,27],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa32eb954fe288a3242719373705a47858":[3,0,0,28,90,9],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa6b5399de27c9237fbd27092f491e5ee3":[3,0,0,28,90,2],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afa8014f2fbf8748e22bebc888326e903c3":[3,0,0,28,90,10],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afab07d41efab2d2f6afb72c154d3a98f1a":[3,0,0,28,90,3],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afab8d4d275617b1fdba3759e43525484b6":[3,0,0,28,90,4],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afabbc12c8efd45fd19a7cd862d54f96f49":[3,0,0,28,90,7],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afac3efc58bc96e5e5ea948d7acee55d202":[3,0,0,28,90,11],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afad820ebee5d8bf24157346d891927e4bf":[3,0,0,28,90,5],
+"azx__zlib_8h.html#a9ac96bbe8a1cc594e1e38f082c2854afafbb42efd3adfe609e67041e28a4a2443":[3,0,0,28,90,6],
+"azx__zlib_8h_source.html":[3,0,0,28],
"azx_base64_example_8c-example.html":[4,0],
"azx_ftp_example_8c-example.html":[4,1],
"azx_https_example_8c-example.html":[4,2],
@@ -43,8 +44,8 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___c_o_n_f.html#ga391d2352ba1f858b96e2e2c3f76c095d":[3,0,0,5,24],
"group___a_z_x___f_t_p___c_o_n_f.html#ga581b457d90027912cfa8b0c781fb8a7c":[3,0,0,5,7],
"group___a_z_x___f_t_p___c_o_n_f.html#ga581b457d90027912cfa8b0c781fb8a7c":[1,3,2],
-"group___a_z_x___f_t_p___c_o_n_f.html#ga5b2d4554c8d26b5ad29aa165b17adf19":[3,0,0,5,30],
"group___a_z_x___f_t_p___c_o_n_f.html#ga5b2d4554c8d26b5ad29aa165b17adf19":[1,3,8],
+"group___a_z_x___f_t_p___c_o_n_f.html#ga5b2d4554c8d26b5ad29aa165b17adf19":[3,0,0,5,30],
"group___a_z_x___f_t_p___c_o_n_f.html#ga66188a5de36ea1d3cc9cf3708474f35b":[1,3,9],
"group___a_z_x___f_t_p___c_o_n_f.html#ga66188a5de36ea1d3cc9cf3708474f35b":[3,0,0,5,40],
"group___a_z_x___f_t_p___c_o_n_f.html#ga726ab9c51a026d57a13e66fb8e88fc79":[3,0,0,5,8],
@@ -53,16 +54,16 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___c_o_n_f.html#gab630cfe2640089295bd32cedd5370303":[1,3,4],
"group___a_z_x___f_t_p___c_o_n_f.html#gabea09560fe008da81ae794c3dd0fc5c7":[3,0,0,5,6],
"group___a_z_x___f_t_p___c_o_n_f.html#gabea09560fe008da81ae794c3dd0fc5c7":[1,3,1],
-"group___a_z_x___f_t_p___c_o_n_f.html#gadd26991f6b171b823da3ec9f919985c8":[1,3,5],
"group___a_z_x___f_t_p___c_o_n_f.html#gadd26991f6b171b823da3ec9f919985c8":[3,0,0,5,14],
+"group___a_z_x___f_t_p___c_o_n_f.html#gadd26991f6b171b823da3ec9f919985c8":[1,3,5],
"group___a_z_x___f_t_p___c_o_n_f.html#gafe78f44e49db1f4dd17c32d3dc3b4cee":[3,0,0,5,21],
"group___a_z_x___f_t_p___c_o_n_f.html#gafe78f44e49db1f4dd17c32d3dc3b4cee":[1,3,6],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19a080dc84c20af83589e186c1102724665":[3,0,0,5,30,0],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19a080dc84c20af83589e186c1102724665":[1,3,8,0],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19aab54d566ab01ca7156bcc914f0aa0dad":[3,0,0,5,30,2],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19aab54d566ab01ca7156bcc914f0aa0dad":[1,3,8,2],
-"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19ac934a97e8fbfce66292815ca909f0318":[3,0,0,5,30,3],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19ac934a97e8fbfce66292815ca909f0318":[1,3,8,3],
+"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19ac934a97e8fbfce66292815ca909f0318":[3,0,0,5,30,3],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19adf82f3622ed1c2f86322033e98fa82d1":[3,0,0,5,30,1],
"group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19adf82f3622ed1c2f86322033e98fa82d1":[1,3,8,1],
"group___a_z_x___f_t_p___u_s_a_g_e.html":[1,4],
@@ -72,22 +73,22 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga25bce2f4df2b29b5e3a5f45c54c8d284":[1,4,10],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga2725d29c5b79492215523d7de3c39a6f":[3,0,0,5,42],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga2725d29c5b79492215523d7de3c39a6f":[1,4,26],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#ga2a3abdbfd150910c90dcce00d1f07071":[1,4,12],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga2a3abdbfd150910c90dcce00d1f07071":[3,0,0,5,18],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#ga2a3abdbfd150910c90dcce00d1f07071":[1,4,12],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga3711029cd940a1cd4345b50b7d3f5247":[3,0,0,5,48],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga3711029cd940a1cd4345b50b7d3f5247":[1,4,32],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga3e3fd4e25dd3c998314bba50dd4d0fa4":[3,0,0,5,50],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga3e3fd4e25dd3c998314bba50dd4d0fa4":[1,4,34],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga4145baef7fe7bd2f4e2b457ee3f1b012":[3,0,0,5,49],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga4145baef7fe7bd2f4e2b457ee3f1b012":[1,4,33],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5047343f2f45cad0bc52640e05ab250d":[3,0,0,5,10],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5047343f2f45cad0bc52640e05ab250d":[1,4,5],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5047343f2f45cad0bc52640e05ab250d":[3,0,0,5,10],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5257cafc61aa846446cdb6ed49f8ae6b":[3,0,0,5,44],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5257cafc61aa846446cdb6ed49f8ae6b":[1,4,28],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga52d11bf0c0ea2066975162c1a51dd2f1":[3,0,0,5,46],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga52d11bf0c0ea2066975162c1a51dd2f1":[1,4,30],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#ga589a9c6cc78985dfbd0dd5fa787f6a1c":[1,4,14],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga589a9c6cc78985dfbd0dd5fa787f6a1c":[3,0,0,5,23],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#ga589a9c6cc78985dfbd0dd5fa787f6a1c":[1,4,14],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5bdeda3a38f9208ee690f9bc5e96e5d5":[3,0,0,5,55],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5bdeda3a38f9208ee690f9bc5e96e5d5":[1,4,39],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga5d7a2d96a890b26f7388414b67b0cb48":[3,0,0,5,38],
@@ -104,8 +105,8 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga792c2053f5aeb6ea683ace3b90579aac":[1,4,27],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga83324a297a9eb71c4c3003b81b8f7f61":[3,0,0,5,52],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga83324a297a9eb71c4c3003b81b8f7f61":[1,4,36],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#ga874ac4f9724a26331c055c039f59d631":[3,0,0,5,11],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga874ac4f9724a26331c055c039f59d631":[1,4,6],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#ga874ac4f9724a26331c055c039f59d631":[3,0,0,5,11],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga880d217d28fef0cb9953fcc51101e58a":[3,0,0,5,45],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga880d217d28fef0cb9953fcc51101e58a":[1,4,29],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ga921c508f5078e8fee11de7f902af4e19":[3,0,0,5,37],
@@ -118,20 +119,20 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___u_s_a_g_e.html#gab0392507e7a32bed1915c2bac2f343ec":[1,4,37],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gab31a7329f4257d631b2dd19a60f87ea3":[3,0,0,5,47],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gab31a7329f4257d631b2dd19a60f87ea3":[1,4,31],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#gab5dc26863b2b72d8024fec2214c48ac5":[1,4,8],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gab5dc26863b2b72d8024fec2214c48ac5":[3,0,0,5,13],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#gab76da8e3c66105cf4503f2a8c07b30f3":[3,0,0,5,12],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#gab5dc26863b2b72d8024fec2214c48ac5":[1,4,8],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gab76da8e3c66105cf4503f2a8c07b30f3":[1,4,7],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#gab76da8e3c66105cf4503f2a8c07b30f3":[3,0,0,5,12],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gac18063638eedd97fbd53d35ef81e1811":[3,0,0,5,51],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gac18063638eedd97fbd53d35ef81e1811":[1,4,35],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#gad00a4ba26fa22811b61904e411bd1af2":[1,4,15],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad00a4ba26fa22811b61904e411bd1af2":[3,0,0,5,29],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#gad00a4ba26fa22811b61904e411bd1af2":[1,4,15],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad075d72a44e0ede76fcb83fc3beaa7a3":[3,0,0,5,4],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad075d72a44e0ede76fcb83fc3beaa7a3":[1,4,3],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad1d276d72c19ca275f62b391863e917c":[3,0,0,5,41],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad1d276d72c19ca275f62b391863e917c":[1,4,25],
-"group___a_z_x___f_t_p___u_s_a_g_e.html#gad9c77d2d392c378a6d013c0cc9864d12":[3,0,0,5,5],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gad9c77d2d392c378a6d013c0cc9864d12":[1,4,4],
+"group___a_z_x___f_t_p___u_s_a_g_e.html#gad9c77d2d392c378a6d013c0cc9864d12":[3,0,0,5,5],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gadbdffe015f1f2c5125641399bf181029":[3,0,0,5,31],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gadbdffe015f1f2c5125641399bf181029":[1,4,16],
"group___a_z_x___f_t_p___u_s_a_g_e.html#gaf1d7d4071e395d57344d1961068ab56c":[3,0,0,5,36],
@@ -151,7 +152,7 @@ var NAVTREEINDEX2 =
"group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a8bd786bf28fbd4a4c5924da9673bc33c":[3,0,0,5,31,2],
"group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a8bd786bf28fbd4a4c5924da9673bc33c":[1,4,16,2],
"group__array_usage.html":[1,12],
-"group__array_usage.html#gafd983da7349623ac1be8d9926aaee1cd":[3,0,0,24,0],
+"group__array_usage.html#gafd983da7349623ac1be8d9926aaee1cd":[3,0,0,25,0],
"group__array_usage.html#gafd983da7349623ac1be8d9926aaee1cd":[1,12,0],
"group__azx__easy__at.html":[1,1],
"group__azx__easy__at.html#ga016dc78945b2312ee4cad3bd9de2f623":[3,0,0,3,26],
@@ -162,8 +163,8 @@ var NAVTREEINDEX2 =
"group__azx__easy__at.html#ga16f3951dc1a7159cfde27d577fbd81a9":[1,1,15],
"group__azx__easy__at.html#ga1f2ef572c4f0f59ea698339a62c8e039":[3,0,0,3,35],
"group__azx__easy__at.html#ga1f2ef572c4f0f59ea698339a62c8e039":[1,1,13],
-"group__azx__easy__at.html#ga2837186123b024092f3df448abc7ea1d":[1,1,9],
"group__azx__easy__at.html#ga2837186123b024092f3df448abc7ea1d":[3,0,0,3,31],
+"group__azx__easy__at.html#ga2837186123b024092f3df448abc7ea1d":[1,1,9],
"group__azx__easy__at.html#ga2acece85b798eff12b4fd1b6a4c7ea04":[3,0,0,3,32],
"group__azx__easy__at.html#ga2acece85b798eff12b4fd1b6a4c7ea04":[1,1,10],
"group__azx__easy__at.html#ga48f6ebd416cd9be39c9a356421a4591b":[3,0,0,3,30],
@@ -172,14 +173,14 @@ var NAVTREEINDEX2 =
"group__azx__easy__at.html#ga51d1176c88e43cfabc735bbbbf5bd170":[1,1,14],
"group__azx__easy__at.html#ga5455b055750449c4feeccf635cb2a878":[3,0,0,3,39],
"group__azx__easy__at.html#ga5455b055750449c4feeccf635cb2a878":[1,1,17],
-"group__azx__easy__at.html#ga57cb7cf0548ffdd80c15e30d33302eec":[1,1,6],
"group__azx__easy__at.html#ga57cb7cf0548ffdd80c15e30d33302eec":[3,0,0,3,28],
+"group__azx__easy__at.html#ga57cb7cf0548ffdd80c15e30d33302eec":[1,1,6],
"group__azx__easy__at.html#ga5c954a7ed95aaa6147f8d3ce904e76b4":[3,0,0,3,34],
"group__azx__easy__at.html#ga5c954a7ed95aaa6147f8d3ce904e76b4":[1,1,12],
-"group__azx__easy__at.html#ga8ed786c0af1cc17027447d90012878cc":[3,0,0,3,25],
"group__azx__easy__at.html#ga8ed786c0af1cc17027447d90012878cc":[1,1,3],
-"group__azx__easy__at.html#gaa20fed7933848b243f2a2a0bcbdef99b":[1,1,5],
+"group__azx__easy__at.html#ga8ed786c0af1cc17027447d90012878cc":[3,0,0,3,25],
"group__azx__easy__at.html#gaa20fed7933848b243f2a2a0bcbdef99b":[3,0,0,3,27],
+"group__azx__easy__at.html#gaa20fed7933848b243f2a2a0bcbdef99b":[1,1,5],
"group__azx__easy__at.html#gaf3db6baca901839f1501ffb056273057":[3,0,0,3,38],
"group__azx__easy__at.html#gaf3db6baca901839f1501ffb056273057":[1,1,16],
"group__azx__easy__at.html#gaf7bf8df993507aeac61d304d6ad80b62":[3,0,0,3,29],
@@ -206,10 +207,10 @@ var NAVTREEINDEX2 =
"group__azx__eeprom.html#gac8db2ab9e36ce597bbafccb5483f4b67":[1,2,8],
"group__azx__eeprom.html#gad5ffe47e59efa57771f91dfc50689e66":[1,2,3],
"group__azx__eeprom.html#gad5ffe47e59efa57771f91dfc50689e66":[3,0,0,4,3],
-"group__azx__eeprom.html#gad6b44dd78f22ad65614a5e98c1ca373b":[3,0,0,4,1],
"group__azx__eeprom.html#gad6b44dd78f22ad65614a5e98c1ca373b":[1,2,2],
-"group__azx__eeprom.html#gae15185a63c805a8bcaa0969d7b5a57d5":[3,0,0,4,4],
+"group__azx__eeprom.html#gad6b44dd78f22ad65614a5e98c1ca373b":[3,0,0,4,1],
"group__azx__eeprom.html#gae15185a63c805a8bcaa0969d7b5a57d5":[1,2,4],
+"group__azx__eeprom.html#gae15185a63c805a8bcaa0969d7b5a57d5":[3,0,0,4,4],
"group__azx__eeprom.html#gafc08ba3e768fc5b3ef4b383cb5869e23":[1,2,1],
"group__azx__eeprom.html#gafc08ba3e768fc5b3ef4b383cb5869e23":[3,0,0,4,0],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a07df5299ef4b1ff8a2e170abd6fcd096":[3,0,0,4,4,0],
@@ -224,8 +225,8 @@ var NAVTREEINDEX2 =
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a55902786b78fd01c45d411c7a1244635":[1,2,4,4],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5af0a3bbbc511c1e748e2718abdc094453":[3,0,0,4,4,7],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5af0a3bbbc511c1e748e2718abdc094453":[1,2,4,7],
-"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afbe5da7ae1822ffb3e7968cb98545a15":[3,0,0,4,4,1],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afbe5da7ae1822ffb3e7968cb98545a15":[1,2,4,1],
+"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afbe5da7ae1822ffb3e7968cb98545a15":[3,0,0,4,4,1],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afd12b69a2dd7e0315de970ae1358d19c":[3,0,0,4,4,2],
"group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afd12b69a2dd7e0315de970ae1358d19c":[1,2,4,2],
"group__b64_usage.html":[1,0],
@@ -236,18 +237,17 @@ var NAVTREEINDEX2 =
"group__http_conf.html":[1,5],
"group__http_conf.html#ga0e2abd820dff5b4f020b1b70d797b249":[1,5,11],
"group__http_conf.html#ga0e2abd820dff5b4f020b1b70d797b249":[3,0,0,14,17],
-"group__http_conf.html#ga30623080daf9875d7ef4a53282de1ac0":[1,5,7],
"group__http_conf.html#ga30623080daf9875d7ef4a53282de1ac0":[3,0,0,14,9],
+"group__http_conf.html#ga30623080daf9875d7ef4a53282de1ac0":[1,5,7],
"group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890":[3,0,0,14,8],
"group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890":[1,5,6],
-"group__http_conf.html#ga91dcf453b00607b13fb25aa4fb9996d8":[1,5,8],
"group__http_conf.html#ga91dcf453b00607b13fb25aa4fb9996d8":[3,0,0,14,10],
-"group__http_conf.html#gaaad9f441f95bdedecbd30f8145df2585":[1,5,5],
+"group__http_conf.html#ga91dcf453b00607b13fb25aa4fb9996d8":[1,5,8],
"group__http_conf.html#gaaad9f441f95bdedecbd30f8145df2585":[3,0,0,14,7],
+"group__http_conf.html#gaaad9f441f95bdedecbd30f8145df2585":[1,5,5],
"group__http_conf.html#gab1e72fc6db9cd975e6ec9e222b131f67":[1,5,9],
"group__http_conf.html#gab1e72fc6db9cd975e6ec9e222b131f67":[3,0,0,14,11],
"group__http_conf.html#gac324733f55c37381f15963897b55dd68":[3,0,0,14,5],
"group__http_conf.html#gac324733f55c37381f15963897b55dd68":[1,5,3],
-"group__http_conf.html#gae40751f148308705cd22ee69282afbe8":[1,5,12],
"group__http_conf.html#gae40751f148308705cd22ee69282afbe8":[3,0,0,14,18]
};
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex3.js
index 821f3871..c00b27e3 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex3.js
@@ -1,17 +1,18 @@
var NAVTREEINDEX3 =
{
-"group__http_conf.html#gae45c5ce7ad62c080a02504578c721840":[3,0,0,14,6],
+"group__http_conf.html#gae40751f148308705cd22ee69282afbe8":[1,5,12],
"group__http_conf.html#gae45c5ce7ad62c080a02504578c721840":[1,5,4],
+"group__http_conf.html#gae45c5ce7ad62c080a02504578c721840":[3,0,0,14,6],
"group__http_conf.html#gae9912e7808e5d0674afa85487ec85387":[1,5,10],
"group__http_conf.html#gae9912e7808e5d0674afa85487ec85387":[3,0,0,14,15],
-"group__http_conf.html#gafb5cf49a7418b6b306a91aca97342df3":[3,0,0,14,4],
"group__http_conf.html#gafb5cf49a7418b6b306a91aca97342df3":[1,5,2],
-"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0adad15d80cb1335235d262de42ecf6fa6":[1,5,7,1],
+"group__http_conf.html#gafb5cf49a7418b6b306a91aca97342df3":[3,0,0,14,4],
"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0adad15d80cb1335235d262de42ecf6fa6":[3,0,0,14,9,1],
-"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0ae405fbb86fb9b0c85f7413e63ba650e6":[3,0,0,14,9,0],
+"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0adad15d80cb1335235d262de42ecf6fa6":[1,5,7,1],
"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0ae405fbb86fb9b0c85f7413e63ba650e6":[1,5,7,0],
-"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0aefe5566487896abaadb1fccd36cf7dc2":[1,5,7,2],
+"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0ae405fbb86fb9b0c85f7413e63ba650e6":[3,0,0,14,9,0],
"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0aefe5566487896abaadb1fccd36cf7dc2":[3,0,0,14,9,2],
+"group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0aefe5566487896abaadb1fccd36cf7dc2":[1,5,7,2],
"group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a25797e59ff6e516bfc9dd37571ec1342":[1,5,8,2],
"group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a25797e59ff6e516bfc9dd37571ec1342":[3,0,0,14,10,2],
"group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a52caae2f3497597c5284e38ea9c89f65":[3,0,0,14,10,0],
@@ -24,28 +25,28 @@ var NAVTREEINDEX3 =
"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a02f29bd2c3216bcf68db3795666a4bf6":[3,0,0,14,11,1],
"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a1263ebd012612156ea9b291a2b64f793":[1,5,9,2],
"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a1263ebd012612156ea9b291a2b64f793":[3,0,0,14,11,2],
-"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a97401ceafc13b3c7a046946fcabf1d42":[1,5,9,3],
"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a97401ceafc13b3c7a046946fcabf1d42":[3,0,0,14,11,3],
+"group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a97401ceafc13b3c7a046946fcabf1d42":[1,5,9,3],
"group__http_usage.html":[1,6],
"group__http_usage.html#ga1eb3cd56e8853af0fa05eac66e5c170f":[1,6,4],
"group__http_usage.html#ga1eb3cd56e8853af0fa05eac66e5c170f":[3,0,0,14,1],
"group__http_usage.html#ga272faa61175fcf4e7a00529957106d35":[1,6,8],
"group__http_usage.html#ga272faa61175fcf4e7a00529957106d35":[3,0,0,14,13],
-"group__http_usage.html#ga468c6015a239492a88c0c530fe73d973":[3,0,0,14,16],
"group__http_usage.html#ga468c6015a239492a88c0c530fe73d973":[1,6,10],
+"group__http_usage.html#ga468c6015a239492a88c0c530fe73d973":[3,0,0,14,16],
"group__http_usage.html#ga5717de1767a336a315469ea5c2c8e0a8":[1,6,9],
"group__http_usage.html#ga5717de1767a336a315469ea5c2c8e0a8":[3,0,0,14,14],
-"group__http_usage.html#ga5af72b34cc3de7e623f3c9240f6ec0d0":[3,0,0,14,12],
"group__http_usage.html#ga5af72b34cc3de7e623f3c9240f6ec0d0":[1,6,7],
-"group__http_usage.html#ga9567e818e1e8bcdf8df7efbf5c99c2d4":[3,0,0,14,2],
+"group__http_usage.html#ga5af72b34cc3de7e623f3c9240f6ec0d0":[3,0,0,14,12],
"group__http_usage.html#ga9567e818e1e8bcdf8df7efbf5c99c2d4":[1,6,5],
-"group__http_usage.html#gaa86e4372eae59c09495c49a8117b4738":[1,6,6],
+"group__http_usage.html#ga9567e818e1e8bcdf8df7efbf5c99c2d4":[3,0,0,14,2],
"group__http_usage.html#gaa86e4372eae59c09495c49a8117b4738":[3,0,0,14,3],
+"group__http_usage.html#gaa86e4372eae59c09495c49a8117b4738":[1,6,6],
"group__log_conf.html":[1,7],
"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[1,7,0],
"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[3,0,0,16,10],
-"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[3,0,0,16,16],
"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[1,7,2],
+"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[3,0,0,16,16],
"group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5":[1,7,1],
"group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5":[3,0,0,16,11],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4":[1,7,0,1],
@@ -65,8 +66,8 @@ var NAVTREEINDEX3 =
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[3,0,0,16,11,5],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[1,7,1,6],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[3,0,0,16,11,6],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[1,7,1,1],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[3,0,0,16,11,1],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048":[1,7,1,1],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[1,7,1,4],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2":[3,0,0,16,11,4],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[1,7,1,0],
@@ -74,180 +75,179 @@ var NAVTREEINDEX3 =
"group__log_usage.html":[1,8],
"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[1,8,0],
"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[3,0,0,16,9],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[3,0,0,16,9,0],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[1,8,0,0],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[3,0,0,16,9,0],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a19881bc82e9c47a02c88b541c58a04c8":[3,0,0,16,9,5],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7":[1,8,0,4],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7":[3,0,0,16,9,4],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c":[1,8,0,3],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c":[3,0,0,16,9,3],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b":[3,0,0,16,9,1],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b":[1,8,0,1],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[1,8,0,2],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b":[3,0,0,16,9,1],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[3,0,0,16,9,2],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[1,8,0,2],
"group__pdu_dec_usage.html":[1,9],
"group__pdu_dec_usage.html#ga0c48f5ebe23043bb044abce2f8e571a5":[1,9,1],
-"group__pdu_dec_usage.html#ga0c48f5ebe23043bb044abce2f8e571a5":[3,0,0,17,1],
+"group__pdu_dec_usage.html#ga0c48f5ebe23043bb044abce2f8e571a5":[3,0,0,18,1],
"group__pdu_dec_usage.html#ga71756909d9789b37acdf20e3997a9b27":[1,9,0],
-"group__pdu_dec_usage.html#ga71756909d9789b37acdf20e3997a9b27":[3,0,0,17,0],
-"group__pdu_dec_usage.html#ga883238aa220185561f08b9112ec96bfd":[3,0,0,17,2],
+"group__pdu_dec_usage.html#ga71756909d9789b37acdf20e3997a9b27":[3,0,0,18,0],
"group__pdu_dec_usage.html#ga883238aa220185561f08b9112ec96bfd":[1,9,2],
+"group__pdu_dec_usage.html#ga883238aa220185561f08b9112ec96bfd":[3,0,0,18,2],
"group__pdu_enc_usage.html":[1,10],
"group__pdu_enc_usage.html#ga43f49411b4f11d9b77abed8036346cca":[1,10,0],
-"group__pdu_enc_usage.html#ga43f49411b4f11d9b77abed8036346cca":[3,0,0,18,0],
+"group__pdu_enc_usage.html#ga43f49411b4f11d9b77abed8036346cca":[3,0,0,19,0],
"group__pdu_enc_usage.html#gacb79107f730c3a648b4033429d3cc8d8":[1,10,1],
-"group__pdu_enc_usage.html#gacb79107f730c3a648b4033429d3cc8d8":[3,0,0,18,1],
+"group__pdu_enc_usage.html#gacb79107f730c3a648b4033429d3cc8d8":[3,0,0,19,1],
"group__string_usage.html":[1,11],
-"group__string_usage.html#ga07193317da404839040b65b5d0b93477":[3,0,0,24,13],
+"group__string_usage.html#ga07193317da404839040b65b5d0b93477":[3,0,0,25,13],
"group__string_usage.html#ga07193317da404839040b65b5d0b93477":[1,11,11],
-"group__string_usage.html#ga126567b2fbbb1fbe65ab22337a8cc34c":[3,0,0,24,10],
"group__string_usage.html#ga126567b2fbbb1fbe65ab22337a8cc34c":[1,11,8],
+"group__string_usage.html#ga126567b2fbbb1fbe65ab22337a8cc34c":[3,0,0,25,10],
+"group__string_usage.html#ga247722bf178ce803288144489374145d":[3,0,0,25,1],
"group__string_usage.html#ga247722bf178ce803288144489374145d":[1,11,0],
-"group__string_usage.html#ga247722bf178ce803288144489374145d":[3,0,0,24,1],
-"group__string_usage.html#ga34d51366309ee1c55a88af2b1247f207":[3,0,0,24,11],
"group__string_usage.html#ga34d51366309ee1c55a88af2b1247f207":[1,11,9],
+"group__string_usage.html#ga34d51366309ee1c55a88af2b1247f207":[3,0,0,25,11],
+"group__string_usage.html#ga4a7dd0426703bbab33a5206d1ecbadba":[3,0,0,25,2],
"group__string_usage.html#ga4a7dd0426703bbab33a5206d1ecbadba":[1,11,1],
-"group__string_usage.html#ga4a7dd0426703bbab33a5206d1ecbadba":[3,0,0,24,2],
-"group__string_usage.html#ga4d8f5e69f7077804f9eacefda37e6047":[3,0,0,24,4],
+"group__string_usage.html#ga4d8f5e69f7077804f9eacefda37e6047":[3,0,0,25,4],
"group__string_usage.html#ga4d8f5e69f7077804f9eacefda37e6047":[1,11,3],
-"group__string_usage.html#ga4e49e0bbe1dad195b0655fef86d06762":[3,0,0,24,12],
+"group__string_usage.html#ga4e49e0bbe1dad195b0655fef86d06762":[3,0,0,25,12],
"group__string_usage.html#ga4e49e0bbe1dad195b0655fef86d06762":[1,11,10],
-"group__string_usage.html#ga563cd603c4ba7d98ccaa45bdf8d02fca":[3,0,0,24,9],
"group__string_usage.html#ga563cd603c4ba7d98ccaa45bdf8d02fca":[1,11,7],
-"group__string_usage.html#ga565fe741a788c9a294da6e3bd8a3b20a":[3,0,0,24,5],
+"group__string_usage.html#ga563cd603c4ba7d98ccaa45bdf8d02fca":[3,0,0,25,9],
+"group__string_usage.html#ga565fe741a788c9a294da6e3bd8a3b20a":[3,0,0,25,5],
"group__string_usage.html#ga565fe741a788c9a294da6e3bd8a3b20a":[1,11,4],
"group__string_usage.html#ga591daac0fe51a8dc56728499297ff7f4":[1,11,5],
-"group__string_usage.html#ga591daac0fe51a8dc56728499297ff7f4":[3,0,0,24,7],
-"group__string_usage.html#ga67f4337ecaca70a7295a701dbebe1032":[3,0,0,24,14],
+"group__string_usage.html#ga591daac0fe51a8dc56728499297ff7f4":[3,0,0,25,7],
+"group__string_usage.html#ga67f4337ecaca70a7295a701dbebe1032":[3,0,0,25,14],
"group__string_usage.html#ga67f4337ecaca70a7295a701dbebe1032":[1,11,12],
-"group__string_usage.html#ga8f29fd37628a802201f37eeeab1632d6":[3,0,0,24,3],
"group__string_usage.html#ga8f29fd37628a802201f37eeeab1632d6":[1,11,2],
-"group__string_usage.html#gaf108513aba06635348dc6bcd64ffc5ce":[3,0,0,24,8],
+"group__string_usage.html#ga8f29fd37628a802201f37eeeab1632d6":[3,0,0,25,3],
"group__string_usage.html#gaf108513aba06635348dc6bcd64ffc5ce":[1,11,6],
+"group__string_usage.html#gaf108513aba06635348dc6bcd64ffc5ce":[3,0,0,25,8],
"group__task_usage.html":[1,13],
-"group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac":[3,0,0,25,11],
"group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac":[1,13,12],
-"group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3":[3,0,0,25,12],
+"group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac":[3,0,0,26,11],
+"group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3":[3,0,0,26,12],
"group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3":[1,13,13],
"group__task_usage.html#ga146f8901751b1510a2d8add0cfafb8d6":[1,13,8],
-"group__task_usage.html#ga146f8901751b1510a2d8add0cfafb8d6":[3,0,0,25,7],
+"group__task_usage.html#ga146f8901751b1510a2d8add0cfafb8d6":[3,0,0,26,7],
+"group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2":[3,0,0,26,18],
"group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2":[1,13,18],
-"group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2":[3,0,0,25,18],
+"group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708":[3,0,0,26,14],
"group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708":[1,13,15],
-"group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708":[3,0,0,25,14],
-"group__task_usage.html#ga3fe3fea325c9badf3a7cf5e2aea7012e":[3,0,0,25,5],
+"group__task_usage.html#ga3fe3fea325c9badf3a7cf5e2aea7012e":[3,0,0,26,5],
"group__task_usage.html#ga3fe3fea325c9badf3a7cf5e2aea7012e":[1,13,6],
"group__task_usage.html#ga56dfe0df57f53da981c1b7ec7ff782fe":[1,13,1],
-"group__task_usage.html#ga56dfe0df57f53da981c1b7ec7ff782fe":[3,0,0,25,0],
-"group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b":[3,0,0,25,10],
+"group__task_usage.html#ga56dfe0df57f53da981c1b7ec7ff782fe":[3,0,0,26,0],
"group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b":[1,13,11],
+"group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b":[3,0,0,26,10],
+"group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2":[3,0,0,26,19],
"group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2":[1,13,19],
-"group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2":[3,0,0,25,19],
-"group__task_usage.html#ga8c8cb01a85069a084d2e1dd17e299722":[3,0,0,25,6],
+"group__task_usage.html#ga8c8cb01a85069a084d2e1dd17e299722":[3,0,0,26,6],
"group__task_usage.html#ga8c8cb01a85069a084d2e1dd17e299722":[1,13,7],
"group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196":[1,13,4],
-"group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196":[3,0,0,25,3],
+"group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196":[3,0,0,26,3],
+"group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6":[3,0,0,26,16],
"group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6":[1,13,17],
-"group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6":[3,0,0,25,16],
-"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[3,0,0,25,2],
"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[1,13,3],
+"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[3,0,0,26,2],
"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[1,13,2],
-"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[3,0,0,25,1],
+"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[3,0,0,26,1],
"group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623":[1,13,16],
-"group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623":[3,0,0,25,15],
+"group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623":[3,0,0,26,15],
+"group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd":[3,0,0,26,8],
"group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd":[1,13,9],
-"group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd":[3,0,0,25,8],
-"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[3,0,0,25,13],
"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[1,13,14],
-"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[3,0,0,25,4],
+"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[3,0,0,26,13],
"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[1,13,5],
-"group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416":[3,0,0,25,9],
+"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[3,0,0,26,4],
+"group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416":[3,0,0,26,9],
"group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416":[1,13,10],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[3,0,0,25,11,0],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[3,0,0,26,11,0],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[1,13,12,0],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf":[3,0,0,26,11,3],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf":[1,13,12,3],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf":[3,0,0,25,11,3],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[3,0,0,25,11,2],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[1,13,12,2],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[3,0,0,26,11,2],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9":[1,13,12,1],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9":[3,0,0,25,11,1],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998":[3,0,0,25,12,3],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9":[3,0,0,26,11,1],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998":[3,0,0,26,12,3],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998":[1,13,13,3],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[1,13,13,1],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[3,0,0,25,12,1],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[3,0,0,26,12,1],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[3,0,0,26,12,0],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[1,13,13,0],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[3,0,0,25,12,0],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837":[1,13,13,2],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837":[3,0,0,25,12,2],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa":[3,0,0,25,12,4],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837":[3,0,0,26,12,2],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa":[3,0,0,26,12,4],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa":[1,13,13,4],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234":[3,0,0,25,10,1],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234":[3,0,0,26,10,1],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234":[1,13,11,1],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994":[1,13,11,6],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994":[3,0,0,25,10,6],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994":[3,0,0,26,10,6],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d":[1,13,11,3],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d":[3,0,0,25,10,3],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b":[3,0,0,25,10,11],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d":[3,0,0,26,10,3],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b":[3,0,0,26,10,11],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b":[1,13,11,11],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[3,0,0,26,10,9],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[1,13,11,9],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[3,0,0,25,10,9],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457":[3,0,0,25,10,10],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457":[3,0,0,26,10,10],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457":[1,13,11,10],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[3,0,0,26,10,2],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[1,13,11,2],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[3,0,0,25,10,2],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[1,13,11,4],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[3,0,0,25,10,4],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[3,0,0,25,10,5],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[3,0,0,26,10,4],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[1,13,11,5],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[3,0,0,26,10,5],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[3,0,0,26,10,7],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[1,13,11,7],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[3,0,0,25,10,7],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e":[3,0,0,25,10,8],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e":[3,0,0,26,10,8],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e":[1,13,11,8],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[3,0,0,26,10,13],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[1,13,11,13],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[3,0,0,25,10,13],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c":[3,0,0,25,10,0],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c":[3,0,0,26,10,0],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c":[1,13,11,0],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[3,0,0,26,10,12],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[1,13,11,12],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[3,0,0,25,10,12],
"group__zlib_usage.html":[1,14],
-"group__zlib_usage.html#ga0037a89a78f6ecfb49e182f3607bd6f1":[3,0,0,27,57],
+"group__zlib_usage.html#ga0037a89a78f6ecfb49e182f3607bd6f1":[3,0,0,28,57],
"group__zlib_usage.html#ga0037a89a78f6ecfb49e182f3607bd6f1":[1,14,51],
-"group__zlib_usage.html#ga027a46f4a550f216c32f546bd098b91b":[3,0,0,27,0],
+"group__zlib_usage.html#ga027a46f4a550f216c32f546bd098b91b":[3,0,0,28,0],
"group__zlib_usage.html#ga027a46f4a550f216c32f546bd098b91b":[1,14,0],
+"group__zlib_usage.html#ga0349605df9951777d2730304d0ea8b28":[3,0,0,28,6],
"group__zlib_usage.html#ga0349605df9951777d2730304d0ea8b28":[1,14,6],
-"group__zlib_usage.html#ga0349605df9951777d2730304d0ea8b28":[3,0,0,27,6],
-"group__zlib_usage.html#ga0c790d119458d2e1200e8aaebe790a1c":[3,0,0,27,86],
+"group__zlib_usage.html#ga0c790d119458d2e1200e8aaebe790a1c":[3,0,0,28,86],
"group__zlib_usage.html#ga0c790d119458d2e1200e8aaebe790a1c":[1,14,75],
-"group__zlib_usage.html#ga0db66276cc7d432b53976ff3d0567c87":[3,0,0,27,20],
"group__zlib_usage.html#ga0db66276cc7d432b53976ff3d0567c87":[1,14,18],
+"group__zlib_usage.html#ga0db66276cc7d432b53976ff3d0567c87":[3,0,0,28,20],
"group__zlib_usage.html#ga0e3bf01a513133fd058555a8521ee293":[1,14,8],
-"group__zlib_usage.html#ga0e3bf01a513133fd058555a8521ee293":[3,0,0,27,8],
-"group__zlib_usage.html#ga0f0456f7d830540779cfb088c4d5dc9b":[3,0,0,27,61],
-"group__zlib_usage.html#ga14ecc5c8be95f7f21ab409523dfc5cf8":[3,0,0,27,67],
+"group__zlib_usage.html#ga0e3bf01a513133fd058555a8521ee293":[3,0,0,28,8],
+"group__zlib_usage.html#ga0f0456f7d830540779cfb088c4d5dc9b":[3,0,0,28,61],
+"group__zlib_usage.html#ga14ecc5c8be95f7f21ab409523dfc5cf8":[3,0,0,28,67],
"group__zlib_usage.html#ga14ecc5c8be95f7f21ab409523dfc5cf8":[1,14,60],
-"group__zlib_usage.html#ga157f0c16970912d610093aecd1913ef1":[3,0,0,27,12],
"group__zlib_usage.html#ga157f0c16970912d610093aecd1913ef1":[1,14,12],
-"group__zlib_usage.html#ga23f18cb05ee5583729cb9f59caafd2c7":[3,0,0,27,35],
+"group__zlib_usage.html#ga157f0c16970912d610093aecd1913ef1":[3,0,0,28,12],
+"group__zlib_usage.html#ga23f18cb05ee5583729cb9f59caafd2c7":[3,0,0,28,35],
"group__zlib_usage.html#ga23f18cb05ee5583729cb9f59caafd2c7":[1,14,31],
-"group__zlib_usage.html#ga24918fd427e23c20d8ade3cacc5c9670":[3,0,0,27,44],
"group__zlib_usage.html#ga24918fd427e23c20d8ade3cacc5c9670":[1,14,38],
-"group__zlib_usage.html#ga2543ae5ed7a23ef2c8d97fb4890958d0":[3,0,0,27,39],
-"group__zlib_usage.html#ga27da769d23de01d0960e7dd01e65a1f4":[3,0,0,27,76],
+"group__zlib_usage.html#ga24918fd427e23c20d8ade3cacc5c9670":[3,0,0,28,44],
+"group__zlib_usage.html#ga2543ae5ed7a23ef2c8d97fb4890958d0":[3,0,0,28,39],
+"group__zlib_usage.html#ga27da769d23de01d0960e7dd01e65a1f4":[3,0,0,28,76],
"group__zlib_usage.html#ga27da769d23de01d0960e7dd01e65a1f4":[1,14,67],
-"group__zlib_usage.html#ga287d8e547e36b0409a764495548bf81a":[3,0,0,27,53],
+"group__zlib_usage.html#ga287d8e547e36b0409a764495548bf81a":[3,0,0,28,53],
"group__zlib_usage.html#ga287d8e547e36b0409a764495548bf81a":[1,14,47],
-"group__zlib_usage.html#ga2c4a5deea41168010da0cdd22bd29912":[3,0,0,27,43],
"group__zlib_usage.html#ga2c4a5deea41168010da0cdd22bd29912":[1,14,37],
+"group__zlib_usage.html#ga2c4a5deea41168010da0cdd22bd29912":[3,0,0,28,43],
+"group__zlib_usage.html#ga2cb7573b19aa583192a175612b8a0969":[3,0,0,28,5],
"group__zlib_usage.html#ga2cb7573b19aa583192a175612b8a0969":[1,14,5],
-"group__zlib_usage.html#ga2cb7573b19aa583192a175612b8a0969":[3,0,0,27,5],
-"group__zlib_usage.html#ga2ccb8f65a070116a9aed2d30f22b3a52":[3,0,0,27,37],
+"group__zlib_usage.html#ga2ccb8f65a070116a9aed2d30f22b3a52":[3,0,0,28,37],
"group__zlib_usage.html#ga2ccb8f65a070116a9aed2d30f22b3a52":[1,14,33],
-"group__zlib_usage.html#ga36db2f67e0da06af716d72ca18eb629e":[3,0,0,27,22],
+"group__zlib_usage.html#ga36db2f67e0da06af716d72ca18eb629e":[3,0,0,28,22],
"group__zlib_usage.html#ga36db2f67e0da06af716d72ca18eb629e":[1,14,20],
-"group__zlib_usage.html#ga372d2f996f98e1ffc47862ad4370ca1c":[3,0,0,27,13],
+"group__zlib_usage.html#ga372d2f996f98e1ffc47862ad4370ca1c":[3,0,0,28,13],
"group__zlib_usage.html#ga372d2f996f98e1ffc47862ad4370ca1c":[1,14,13],
-"group__zlib_usage.html#ga3e9b60bc167cd5ed409922dafaba5efc":[3,0,0,27,34],
+"group__zlib_usage.html#ga3e9b60bc167cd5ed409922dafaba5efc":[3,0,0,28,34],
"group__zlib_usage.html#ga3e9b60bc167cd5ed409922dafaba5efc":[1,14,30],
-"group__zlib_usage.html#ga42e13c4acd5750bfaee241abf60e5431":[3,0,0,27,28],
-"group__zlib_usage.html#ga480681b27918c801d6789f523d0d5f3c":[3,0,0,27,1]
+"group__zlib_usage.html#ga42e13c4acd5750bfaee241abf60e5431":[3,0,0,28,28]
};
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex4.js
index 3915b98f..97a03a0b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex4.js
@@ -1,133 +1,134 @@
var NAVTREEINDEX4 =
{
+"group__zlib_usage.html#ga480681b27918c801d6789f523d0d5f3c":[3,0,0,28,1],
"group__zlib_usage.html#ga480681b27918c801d6789f523d0d5f3c":[1,14,1],
-"group__zlib_usage.html#ga4be944225d7e5a074762d482278cc31a":[3,0,0,27,77],
+"group__zlib_usage.html#ga4be944225d7e5a074762d482278cc31a":[3,0,0,28,77],
"group__zlib_usage.html#ga4be944225d7e5a074762d482278cc31a":[1,14,68],
-"group__zlib_usage.html#ga4fa4b23550ae014dbcb37b5fc9674866":[3,0,0,27,14],
+"group__zlib_usage.html#ga4fa4b23550ae014dbcb37b5fc9674866":[3,0,0,28,14],
"group__zlib_usage.html#ga56174f3889279ec630b6e06bee63b464":[1,14,11],
-"group__zlib_usage.html#ga56174f3889279ec630b6e06bee63b464":[3,0,0,27,11],
+"group__zlib_usage.html#ga56174f3889279ec630b6e06bee63b464":[3,0,0,28,11],
+"group__zlib_usage.html#ga5c33d90b7db39e962978759ec18b1527":[3,0,0,28,63],
"group__zlib_usage.html#ga5c33d90b7db39e962978759ec18b1527":[1,14,56],
-"group__zlib_usage.html#ga5c33d90b7db39e962978759ec18b1527":[3,0,0,27,63],
-"group__zlib_usage.html#ga60580fe569a46fd32756b563a23d9ec9":[3,0,0,27,70],
"group__zlib_usage.html#ga60580fe569a46fd32756b563a23d9ec9":[1,14,61],
+"group__zlib_usage.html#ga60580fe569a46fd32756b563a23d9ec9":[3,0,0,28,70],
"group__zlib_usage.html#ga62aa45dab7752c80a6222ddfe902d0d7":[1,14,57],
-"group__zlib_usage.html#ga62aa45dab7752c80a6222ddfe902d0d7":[3,0,0,27,64],
+"group__zlib_usage.html#ga62aa45dab7752c80a6222ddfe902d0d7":[3,0,0,28,64],
+"group__zlib_usage.html#ga64032ae1f54a0988849ea0c6b53c440c":[3,0,0,28,83],
"group__zlib_usage.html#ga64032ae1f54a0988849ea0c6b53c440c":[1,14,74],
-"group__zlib_usage.html#ga64032ae1f54a0988849ea0c6b53c440c":[3,0,0,27,83],
"group__zlib_usage.html#ga664dc60b2a0a1a417188553d2987c400":[1,14,72],
-"group__zlib_usage.html#ga664dc60b2a0a1a417188553d2987c400":[3,0,0,27,81],
-"group__zlib_usage.html#ga672aa260a69b07860d839d9ec10ddd48":[3,0,0,27,88],
+"group__zlib_usage.html#ga664dc60b2a0a1a417188553d2987c400":[3,0,0,28,81],
+"group__zlib_usage.html#ga672aa260a69b07860d839d9ec10ddd48":[3,0,0,28,88],
"group__zlib_usage.html#ga672aa260a69b07860d839d9ec10ddd48":[1,14,77],
-"group__zlib_usage.html#ga6b467f2d3d9368d6a2b759afe2d6cfbd":[3,0,0,27,49],
+"group__zlib_usage.html#ga6b467f2d3d9368d6a2b759afe2d6cfbd":[3,0,0,28,49],
"group__zlib_usage.html#ga6b467f2d3d9368d6a2b759afe2d6cfbd":[1,14,43],
-"group__zlib_usage.html#ga6ed38511b143c980ce9d85cdb9cb3c82":[3,0,0,27,3],
"group__zlib_usage.html#ga6ed38511b143c980ce9d85cdb9cb3c82":[1,14,3],
+"group__zlib_usage.html#ga6ed38511b143c980ce9d85cdb9cb3c82":[3,0,0,28,3],
+"group__zlib_usage.html#ga7036597aa2a37242eb0dbfa45a6de63a":[3,0,0,28,71],
"group__zlib_usage.html#ga7036597aa2a37242eb0dbfa45a6de63a":[1,14,62],
-"group__zlib_usage.html#ga7036597aa2a37242eb0dbfa45a6de63a":[3,0,0,27,71],
+"group__zlib_usage.html#ga71cf4a702313e558a11cb7c725556e62":[3,0,0,28,56],
"group__zlib_usage.html#ga71cf4a702313e558a11cb7c725556e62":[1,14,50],
-"group__zlib_usage.html#ga71cf4a702313e558a11cb7c725556e62":[3,0,0,27,56],
-"group__zlib_usage.html#ga76a3c8972c088c1fd855736bd29c217d":[3,0,0,27,17],
+"group__zlib_usage.html#ga76a3c8972c088c1fd855736bd29c217d":[3,0,0,28,17],
"group__zlib_usage.html#ga76a3c8972c088c1fd855736bd29c217d":[1,14,15],
-"group__zlib_usage.html#ga76bd08954c634a28d09c34298f0c5f2c":[3,0,0,27,36],
+"group__zlib_usage.html#ga76bd08954c634a28d09c34298f0c5f2c":[3,0,0,28,36],
"group__zlib_usage.html#ga76bd08954c634a28d09c34298f0c5f2c":[1,14,32],
"group__zlib_usage.html#ga76eb970981de97c0e148dfc64b76707d":[1,14,52],
-"group__zlib_usage.html#ga76eb970981de97c0e148dfc64b76707d":[3,0,0,27,58],
+"group__zlib_usage.html#ga76eb970981de97c0e148dfc64b76707d":[3,0,0,28,58],
"group__zlib_usage.html#ga79c1f29ebbb4dc50e9f2a1038301f0dd":[1,14,17],
-"group__zlib_usage.html#ga79c1f29ebbb4dc50e9f2a1038301f0dd":[3,0,0,27,19],
-"group__zlib_usage.html#ga79e8c3cb1ba308872109e55e9a6692f0":[3,0,0,27,85],
-"group__zlib_usage.html#ga82278c02ed2f297f37a8acff1b64b4ed":[3,0,0,27,72],
+"group__zlib_usage.html#ga79c1f29ebbb4dc50e9f2a1038301f0dd":[3,0,0,28,19],
+"group__zlib_usage.html#ga79e8c3cb1ba308872109e55e9a6692f0":[3,0,0,28,85],
"group__zlib_usage.html#ga82278c02ed2f297f37a8acff1b64b4ed":[1,14,63],
+"group__zlib_usage.html#ga82278c02ed2f297f37a8acff1b64b4ed":[3,0,0,28,72],
+"group__zlib_usage.html#ga8252643611b3bbdbd2bb6f99e0ec1c6f":[3,0,0,28,60],
"group__zlib_usage.html#ga8252643611b3bbdbd2bb6f99e0ec1c6f":[1,14,54],
-"group__zlib_usage.html#ga8252643611b3bbdbd2bb6f99e0ec1c6f":[3,0,0,27,60],
+"group__zlib_usage.html#ga8a5601abd6f2ba0a96046fa68f558805":[3,0,0,28,2],
"group__zlib_usage.html#ga8a5601abd6f2ba0a96046fa68f558805":[1,14,2],
-"group__zlib_usage.html#ga8a5601abd6f2ba0a96046fa68f558805":[3,0,0,27,2],
-"group__zlib_usage.html#ga94ffcce2091138c86f16906ad5259bbe":[3,0,0,27,79],
+"group__zlib_usage.html#ga94ffcce2091138c86f16906ad5259bbe":[3,0,0,28,79],
"group__zlib_usage.html#ga94ffcce2091138c86f16906ad5259bbe":[1,14,70],
-"group__zlib_usage.html#ga97bf58de068d0636ab6deb65b253e04d":[3,0,0,27,69],
-"group__zlib_usage.html#ga9a12bd3bb2adfdbd764db73249377596":[3,0,0,27,38],
-"group__zlib_usage.html#ga9a4e335780dfd3e02f16d9ecb0c3bab6":[3,0,0,27,23],
+"group__zlib_usage.html#ga97bf58de068d0636ab6deb65b253e04d":[3,0,0,28,69],
+"group__zlib_usage.html#ga9a12bd3bb2adfdbd764db73249377596":[3,0,0,28,38],
+"group__zlib_usage.html#ga9a4e335780dfd3e02f16d9ecb0c3bab6":[3,0,0,28,23],
"group__zlib_usage.html#ga9a4e335780dfd3e02f16d9ecb0c3bab6":[1,14,21],
-"group__zlib_usage.html#ga9de80b10fbde167a8840b03c17aaac05":[3,0,0,27,68],
+"group__zlib_usage.html#ga9de80b10fbde167a8840b03c17aaac05":[3,0,0,28,68],
"group__zlib_usage.html#gaa063a53e7b02167146361eb1319bdf7f":[1,14,49],
-"group__zlib_usage.html#gaa063a53e7b02167146361eb1319bdf7f":[3,0,0,27,55],
-"group__zlib_usage.html#gaa254c6d8c2e50a73b89403b1d924c5f8":[3,0,0,27,52],
+"group__zlib_usage.html#gaa063a53e7b02167146361eb1319bdf7f":[3,0,0,28,55],
"group__zlib_usage.html#gaa254c6d8c2e50a73b89403b1d924c5f8":[1,14,46],
-"group__zlib_usage.html#gaa3858540035464c356a950b34f21f5b9":[3,0,0,27,84],
+"group__zlib_usage.html#gaa254c6d8c2e50a73b89403b1d924c5f8":[3,0,0,28,52],
+"group__zlib_usage.html#gaa3858540035464c356a950b34f21f5b9":[3,0,0,28,84],
+"group__zlib_usage.html#gaa3df0dbd418a2c98c7260ffccbeebf3b":[3,0,0,28,48],
"group__zlib_usage.html#gaa3df0dbd418a2c98c7260ffccbeebf3b":[1,14,42],
-"group__zlib_usage.html#gaa3df0dbd418a2c98c7260ffccbeebf3b":[3,0,0,27,48],
-"group__zlib_usage.html#gaa5b6b3ffd313880af1dfa174fc33f97b":[3,0,0,27,87],
+"group__zlib_usage.html#gaa5b6b3ffd313880af1dfa174fc33f97b":[3,0,0,28,87],
"group__zlib_usage.html#gaa5b6b3ffd313880af1dfa174fc33f97b":[1,14,76],
-"group__zlib_usage.html#gaac5f0331da68c5e034b0d1d57b03148f":[3,0,0,27,45],
+"group__zlib_usage.html#gaac5f0331da68c5e034b0d1d57b03148f":[3,0,0,28,45],
"group__zlib_usage.html#gaac5f0331da68c5e034b0d1d57b03148f":[1,14,39],
-"group__zlib_usage.html#gaaed734e345aa66170a0849db8737dccb":[3,0,0,27,24],
"group__zlib_usage.html#gaaed734e345aa66170a0849db8737dccb":[1,14,22],
-"group__zlib_usage.html#gab371b4ab9f4dbe256d237dc6c90ec121":[3,0,0,27,80],
+"group__zlib_usage.html#gaaed734e345aa66170a0849db8737dccb":[3,0,0,28,24],
"group__zlib_usage.html#gab371b4ab9f4dbe256d237dc6c90ec121":[1,14,71],
+"group__zlib_usage.html#gab371b4ab9f4dbe256d237dc6c90ec121":[3,0,0,28,80],
"group__zlib_usage.html#gab4e9ac9981f3abd498f0b41b6cb8c415":[1,14,55],
-"group__zlib_usage.html#gab4e9ac9981f3abd498f0b41b6cb8c415":[3,0,0,27,62],
-"group__zlib_usage.html#gab52f2641300cf89bdd1e5c33ffaba094":[3,0,0,27,31],
+"group__zlib_usage.html#gab4e9ac9981f3abd498f0b41b6cb8c415":[3,0,0,28,62],
+"group__zlib_usage.html#gab52f2641300cf89bdd1e5c33ffaba094":[3,0,0,28,31],
"group__zlib_usage.html#gab52f2641300cf89bdd1e5c33ffaba094":[1,14,27],
+"group__zlib_usage.html#gab9acc4c1d9593278c14a83ca79d85c26":[3,0,0,28,26],
"group__zlib_usage.html#gab9acc4c1d9593278c14a83ca79d85c26":[1,14,24],
-"group__zlib_usage.html#gab9acc4c1d9593278c14a83ca79d85c26":[3,0,0,27,26],
-"group__zlib_usage.html#gabc4bac45b28da6358355f41130528ad7":[3,0,0,27,33],
"group__zlib_usage.html#gabc4bac45b28da6358355f41130528ad7":[1,14,29],
+"group__zlib_usage.html#gabc4bac45b28da6358355f41130528ad7":[3,0,0,28,33],
"group__zlib_usage.html#gabfe9471f5cee8561b1dc0de10d08e2a2":[1,14,40],
-"group__zlib_usage.html#gabfe9471f5cee8561b1dc0de10d08e2a2":[3,0,0,27,46],
-"group__zlib_usage.html#gac0701712fe9dde65b11aa0b69a766281":[3,0,0,27,10],
+"group__zlib_usage.html#gabfe9471f5cee8561b1dc0de10d08e2a2":[3,0,0,28,46],
+"group__zlib_usage.html#gac0701712fe9dde65b11aa0b69a766281":[3,0,0,28,10],
"group__zlib_usage.html#gac0701712fe9dde65b11aa0b69a766281":[1,14,10],
-"group__zlib_usage.html#gac2437bc6bf46ab087b92d7b185ef8243":[3,0,0,27,74],
+"group__zlib_usage.html#gac2437bc6bf46ab087b92d7b185ef8243":[3,0,0,28,74],
"group__zlib_usage.html#gac2437bc6bf46ab087b92d7b185ef8243":[1,14,65],
"group__zlib_usage.html#gac7d371569755cdf73a23359cae1ef379":[1,14,44],
-"group__zlib_usage.html#gac7d371569755cdf73a23359cae1ef379":[3,0,0,27,50],
-"group__zlib_usage.html#gac942c2984f389f7b2b650d8b9fffa8e5":[3,0,0,27,82],
+"group__zlib_usage.html#gac7d371569755cdf73a23359cae1ef379":[3,0,0,28,50],
"group__zlib_usage.html#gac942c2984f389f7b2b650d8b9fffa8e5":[1,14,73],
+"group__zlib_usage.html#gac942c2984f389f7b2b650d8b9fffa8e5":[3,0,0,28,82],
+"group__zlib_usage.html#gacc7e2be8d181a75ae3fbd5665f26b11d":[3,0,0,28,32],
"group__zlib_usage.html#gacc7e2be8d181a75ae3fbd5665f26b11d":[1,14,28],
-"group__zlib_usage.html#gacc7e2be8d181a75ae3fbd5665f26b11d":[3,0,0,27,32],
-"group__zlib_usage.html#gacd6cc60a004eaa48a8f6bcacd295b9f3":[3,0,0,27,51],
"group__zlib_usage.html#gacd6cc60a004eaa48a8f6bcacd295b9f3":[1,14,45],
+"group__zlib_usage.html#gacd6cc60a004eaa48a8f6bcacd295b9f3":[3,0,0,28,51],
"group__zlib_usage.html#gad26617c8439d4f0681312f46cf62e20a":[1,14,25],
-"group__zlib_usage.html#gad26617c8439d4f0681312f46cf62e20a":[3,0,0,27,29],
+"group__zlib_usage.html#gad26617c8439d4f0681312f46cf62e20a":[3,0,0,28,29],
"group__zlib_usage.html#gad79f3e8714a9c444ec1bff0975566f8c":[1,14,69],
-"group__zlib_usage.html#gad79f3e8714a9c444ec1bff0975566f8c":[3,0,0,27,78],
-"group__zlib_usage.html#gada028cafd29ac0861c0f23a2a59f9295":[3,0,0,27,15],
+"group__zlib_usage.html#gad79f3e8714a9c444ec1bff0975566f8c":[3,0,0,28,78],
+"group__zlib_usage.html#gada028cafd29ac0861c0f23a2a59f9295":[3,0,0,28,15],
"group__zlib_usage.html#gadc8644fe15e6c41e1043b821443068f7":[1,14,58],
-"group__zlib_usage.html#gadc8644fe15e6c41e1043b821443068f7":[3,0,0,27,65],
-"group__zlib_usage.html#gadd5055b434eb1bf8e73e6404c8616414":[3,0,0,27,21],
+"group__zlib_usage.html#gadc8644fe15e6c41e1043b821443068f7":[3,0,0,28,65],
"group__zlib_usage.html#gadd5055b434eb1bf8e73e6404c8616414":[1,14,19],
+"group__zlib_usage.html#gadd5055b434eb1bf8e73e6404c8616414":[3,0,0,28,21],
+"group__zlib_usage.html#gae0a4919477676f3761bdb1cdc227ef84":[3,0,0,28,89],
"group__zlib_usage.html#gae0a4919477676f3761bdb1cdc227ef84":[1,14,78],
-"group__zlib_usage.html#gae0a4919477676f3761bdb1cdc227ef84":[3,0,0,27,89],
-"group__zlib_usage.html#gae0c912715a5af4434c75907d2786c600":[3,0,0,27,41],
"group__zlib_usage.html#gae0c912715a5af4434c75907d2786c600":[1,14,35],
+"group__zlib_usage.html#gae0c912715a5af4434c75907d2786c600":[3,0,0,28,41],
+"group__zlib_usage.html#gae116476e8bb34da50587d0fa6d8bb700":[3,0,0,28,54],
"group__zlib_usage.html#gae116476e8bb34da50587d0fa6d8bb700":[1,14,48],
-"group__zlib_usage.html#gae116476e8bb34da50587d0fa6d8bb700":[3,0,0,27,54],
-"group__zlib_usage.html#gae19cdf50ddb4a287c7155bb6aa8c9108":[3,0,0,27,9],
+"group__zlib_usage.html#gae19cdf50ddb4a287c7155bb6aa8c9108":[3,0,0,28,9],
"group__zlib_usage.html#gae19cdf50ddb4a287c7155bb6aa8c9108":[1,14,9],
+"group__zlib_usage.html#gae7d96996f6a8ac847686393e588cc57e":[3,0,0,28,30],
"group__zlib_usage.html#gae7d96996f6a8ac847686393e588cc57e":[1,14,26],
-"group__zlib_usage.html#gae7d96996f6a8ac847686393e588cc57e":[3,0,0,27,30],
-"group__zlib_usage.html#gae8275c77366353d9bd20ab5075c72826":[3,0,0,27,4],
"group__zlib_usage.html#gae8275c77366353d9bd20ab5075c72826":[1,14,4],
+"group__zlib_usage.html#gae8275c77366353d9bd20ab5075c72826":[3,0,0,28,4],
+"group__zlib_usage.html#gae96d9e2381acfa6fa1363fa0400251df":[3,0,0,28,75],
"group__zlib_usage.html#gae96d9e2381acfa6fa1363fa0400251df":[1,14,66],
-"group__zlib_usage.html#gae96d9e2381acfa6fa1363fa0400251df":[3,0,0,27,75],
"group__zlib_usage.html#gaebad8589ebefeff4772c697823d186ed":[1,14,53],
-"group__zlib_usage.html#gaebad8589ebefeff4772c697823d186ed":[3,0,0,27,59],
-"group__zlib_usage.html#gaec88908699c3055b231c1ac4ced6832f":[3,0,0,27,47],
+"group__zlib_usage.html#gaebad8589ebefeff4772c697823d186ed":[3,0,0,28,59],
+"group__zlib_usage.html#gaec88908699c3055b231c1ac4ced6832f":[3,0,0,28,47],
"group__zlib_usage.html#gaec88908699c3055b231c1ac4ced6832f":[1,14,41],
"group__zlib_usage.html#gaecbd0a9bbc12b57efe07850415a952f4":[1,14,64],
-"group__zlib_usage.html#gaecbd0a9bbc12b57efe07850415a952f4":[3,0,0,27,73],
-"group__zlib_usage.html#gaefccb1c0a4d8db07ec5a5acdeb96b7b4":[3,0,0,27,27],
+"group__zlib_usage.html#gaecbd0a9bbc12b57efe07850415a952f4":[3,0,0,28,73],
+"group__zlib_usage.html#gaefccb1c0a4d8db07ec5a5acdeb96b7b4":[3,0,0,28,27],
"group__zlib_usage.html#gaf1efb3cb8a63650ab4ddb30d07157195":[1,14,34],
-"group__zlib_usage.html#gaf1efb3cb8a63650ab4ddb30d07157195":[3,0,0,27,40],
+"group__zlib_usage.html#gaf1efb3cb8a63650ab4ddb30d07157195":[3,0,0,28,40],
"group__zlib_usage.html#gaf26db2720c1579317f0137d719a76914":[1,14,14],
-"group__zlib_usage.html#gaf26db2720c1579317f0137d719a76914":[3,0,0,27,16],
-"group__zlib_usage.html#gaf3ee859356303d4ab912afc9ee1914db":[3,0,0,27,25],
+"group__zlib_usage.html#gaf26db2720c1579317f0137d719a76914":[3,0,0,28,16],
+"group__zlib_usage.html#gaf3ee859356303d4ab912afc9ee1914db":[3,0,0,28,25],
"group__zlib_usage.html#gaf3ee859356303d4ab912afc9ee1914db":[1,14,23],
+"group__zlib_usage.html#gaf6244e24b73f4d1a4486db2584d1e605":[3,0,0,28,66],
"group__zlib_usage.html#gaf6244e24b73f4d1a4486db2584d1e605":[1,14,59],
-"group__zlib_usage.html#gaf6244e24b73f4d1a4486db2584d1e605":[3,0,0,27,66],
-"group__zlib_usage.html#gafbd1175d41d11305a07929dafc0b7cbd":[3,0,0,27,7],
"group__zlib_usage.html#gafbd1175d41d11305a07929dafc0b7cbd":[1,14,7],
-"group__zlib_usage.html#gafd6c900e1b997b3ffdb84dfe0fa254cf":[3,0,0,27,18],
+"group__zlib_usage.html#gafbd1175d41d11305a07929dafc0b7cbd":[3,0,0,28,7],
"group__zlib_usage.html#gafd6c900e1b997b3ffdb84dfe0fa254cf":[1,14,16],
-"group__zlib_usage.html#gaff30f5f8f783bb8dce572eb600181899":[3,0,0,27,42],
+"group__zlib_usage.html#gafd6c900e1b997b3ffdb84dfe0fa254cf":[3,0,0,28,18],
+"group__zlib_usage.html#gaff30f5f8f783bb8dce572eb600181899":[3,0,0,28,42],
"group__zlib_usage.html#gaff30f5f8f783bb8dce572eb600181899":[1,14,36],
"index.html":[0],
"index.html":[],
@@ -248,6 +249,5 @@ var NAVTREEINDEX4 =
"struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html":[2,0,22],
"struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#a399e8267dda10781705c4a03c542339b":[2,0,22,0],
"struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#abaad5bb722a71d1270c07d3ba3bc1398":[2,0,22,1],
-"struct_a_z_x___l_o_g___c_f_g___t.html":[2,0,23],
-"struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a":[2,0,23,0]
+"struct_a_z_x___l_o_g___c_f_g___t.html":[2,0,23]
};
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex5.js
index d20c0201..cdb54a34 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex5.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/navtreeindex5.js
@@ -1,5 +1,6 @@
var NAVTREEINDEX5 =
{
+"struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a":[2,0,23,0],
"struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c":[2,0,23,1],
"struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2":[2,0,23,2],
"struct_a_z_x___r_a_m___d_i_s_k___s.html":[2,0,24],
@@ -83,12 +84,41 @@ var NAVTREEINDEX5 =
"structazx__http_callback_options.html#ad1867ec1a9d182c41114cd4cab164b65":[1,5,0,2],
"structazx__http_callback_options.html#ad467e1a167c72ecb0b3fb027d191583b":[1,5,0,0],
"structazx__http_callback_options.html#ae999de10c7ec41abc95949d9e3b90102":[1,5,0,3],
-"structsockaddr__storage.html":[2,0,38],
-"structsockaddr__storage.html#a222b6f4e6a65207b788b7bba229ecb46":[2,0,38,1],
-"structsockaddr__storage.html#a5213f7597a36290fe84e60b12088d816":[2,0,38,3],
-"structsockaddr__storage.html#a7483aaf6fe5cd14c8a0ba75d4060f2d7":[2,0,38,0],
-"structsockaddr__storage.html#a78b33db5fc23bbb019aef701cf813b8c":[2,0,38,2],
-"structtimezone.html":[2,0,39],
-"structtimezone.html#a3042f7eff6e1b980728def76b1fa0eb7":[2,0,39,1],
-"structtimezone.html#a85259977aeb63b17e6ce94f19afdfd99":[2,0,39,0]
+"structdcs__struct.html":[2,0,35],
+"structdcs__struct.html#a052a22bcda7ae485c109a15514ee0cb7":[2,0,35,2],
+"structdcs__struct.html#a1a6cfd436585d06593eb345fa3227d48":[2,0,35,0],
+"structdcs__struct.html#aaf53ef38707b62cdfb57f88770cc2d13":[2,0,35,1],
+"structpdu__struct.html":[2,0,39],
+"structpdu__struct.html#a01b110321ffd6853d2fa2151a1c30aa9":[2,0,39,8],
+"structpdu__struct.html#a04c58e4bf19591e3ff2d31f22597f834":[2,0,39,11],
+"structpdu__struct.html#a0af33b15b3f41ba86e4e6de671baa602":[2,0,39,7],
+"structpdu__struct.html#a18e9ea34a77f4ea47e99dee521dc9c2f":[2,0,39,21],
+"structpdu__struct.html#a238650e82cb1cb7b3a590a03b4ecd18f":[2,0,39,16],
+"structpdu__struct.html#a2e7befe7ddaf3376d8637e8ab8d59626":[2,0,39,15],
+"structpdu__struct.html#a2fe19b4e6f822ac6afd885b9c11aae31":[2,0,39,6],
+"structpdu__struct.html#a44edb8aa7e003746b1d848e93ab949bb":[2,0,39,22],
+"structpdu__struct.html#a4586398d6563740c5937b2bd3dbfa57b":[2,0,39,9],
+"structpdu__struct.html#a5295d0953f4cb515f6e6425aa3fdf61a":[2,0,39,2],
+"structpdu__struct.html#a658fa87e51574c246b9a756baf78736d":[2,0,39,4],
+"structpdu__struct.html#a7f419d19168835c2f32a16095ce05b2a":[2,0,39,3],
+"structpdu__struct.html#a95ba6560c0b59b7ff091def4646f18a4":[2,0,39,23],
+"structpdu__struct.html#a974cedf335bea5005cf127dc450da970":[2,0,39,13],
+"structpdu__struct.html#a985de544a0adaeb79210a9da77f35015":[2,0,39,18],
+"structpdu__struct.html#aae22974e9d60ae59728e3d028ed52f67":[2,0,39,19],
+"structpdu__struct.html#abfe24f5e16c400d6ef5f63eaddeb2925":[2,0,39,0],
+"structpdu__struct.html#aca89e87d64c77e8494d0b1191761149f":[2,0,39,20],
+"structpdu__struct.html#ad0784134e062540c8d6f907d666f17f9":[2,0,39,10],
+"structpdu__struct.html#ae24c15c28018ba6c9c1d7bbea6443407":[2,0,39,17],
+"structpdu__struct.html#ae678b74654c8a4e251376f55e278172c":[2,0,39,1],
+"structpdu__struct.html#af399df2f9a3b51cddb264310fb5089a3":[2,0,39,5],
+"structpdu__struct.html#af81c005d2970814c8eb0b696d0534d30":[2,0,39,14],
+"structpdu__struct.html#afb4ac41fdf97fae28b7f31556735cad2":[2,0,39,12],
+"structsockaddr__storage.html":[2,0,40],
+"structsockaddr__storage.html#a222b6f4e6a65207b788b7bba229ecb46":[2,0,40,1],
+"structsockaddr__storage.html#a5213f7597a36290fe84e60b12088d816":[2,0,40,3],
+"structsockaddr__storage.html#a7483aaf6fe5cd14c8a0ba75d4060f2d7":[2,0,40,0],
+"structsockaddr__storage.html#a78b33db5fc23bbb019aef701cf813b8c":[2,0,40,2],
+"structtimezone.html":[2,0,41],
+"structtimezone.html#a3042f7eff6e1b980728def76b1fa0eb7":[2,0,41,1],
+"structtimezone.html#a85259977aeb63b17e6ce94f19afdfd99":[2,0,41,0]
};
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_1.js
index a5ba587b..b355196e 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_1.js
@@ -139,7 +139,7 @@ var searchData=
['azx_5fftp_5fdebug_5fhook_5fnone_139',['AZX_FTP_DEBUG_HOOK_NONE',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19a080dc84c20af83589e186c1102724665',1,'azx_ftp.h']]],
['azx_5fftp_5fdebughook_140',['azx_ftp_debugHook',['../group___a_z_x___f_t_p___c_o_n_f.html#ga391d2352ba1f858b96e2e2c3f76c095d',1,'azx_ftp.h']]],
['azx_5fftp_5fdelete_141',['azx_ftp_delete',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga921c508f5078e8fee11de7f902af4e19',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdir_142',['azx_ftp_dir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5d7a2d96a890b26f7388414b67b0cb48',1,'azx_ftp_dir(AZX_FTP_XFER_T *output, const CHAR *path, AZX_FTP_NET_BUF_T *nControl): azx_ftp.h'],['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5047343f2f45cad0bc52640e05ab250d',1,'AZX_FTP_DIR(): azx_ftp.h']]],
+ ['azx_5fftp_5fdir_142',['AZX_FTP_DIR',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5047343f2f45cad0bc52640e05ab250d',1,'AZX_FTP_DIR(): azx_ftp.h'],['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5d7a2d96a890b26f7388414b67b0cb48',1,'azx_ftp_dir(AZX_FTP_XFER_T *output, const CHAR *path, AZX_FTP_NET_BUF_T *nControl): azx_ftp.h']]],
['azx_5fftp_5fdir_5fverbose_143',['AZX_FTP_DIR_VERBOSE',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga874ac4f9724a26331c055c039f59d631',1,'azx_ftp.h']]],
['azx_5fftp_5ffile_5finfo_144',['AZX_FTP_FILE_INFO',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html',1,'']]],
['azx_5fftp_5ffile_5finfo_5ftag_145',['AZX_FTP_FILE_INFO_TAG',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html',1,'']]],
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_10.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_10.js
index 9e39b470..1032704e 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_10.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_10.js
@@ -1,11 +1,11 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_579',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
- ['usage_20of_20pdu_20decoding_20functionalities_580',['Usage of pdu decoding functionalities',['../group__pdu_dec_usage.html',1,'']]],
- ['usage_20of_20pdu_20encoding_20functionalities_581',['Usage of pdu encoding functionalities',['../group__pdu_enc_usage.html',1,'']]],
- ['usage_20of_20tasks_20example_20functionalities_582',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]],
- ['user_5fagent_583',['user_agent',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a59825a2326d7fc12991da432fbe20098',1,'AZX_HTTP_HEADER']]],
- ['user_5fbase64_5fencode_584',['user_base64_encode',['../group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890',1,'azx_https.h']]],
- ['user_5fcb_5fbytes_5fsize_585',['user_cb_bytes_size',['../structazx__http_callback_options.html#ae999de10c7ec41abc95949d9e3b90102',1,'azx_httpCallbackOptions']]],
- ['user_5ftask_5fcb_586',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
+ ['usage_20of_20logging_20functionalities_581',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
+ ['usage_20of_20pdu_20decoding_20functionalities_582',['Usage of pdu decoding functionalities',['../group__pdu_dec_usage.html',1,'']]],
+ ['usage_20of_20pdu_20encoding_20functionalities_583',['Usage of pdu encoding functionalities',['../group__pdu_enc_usage.html',1,'']]],
+ ['usage_20of_20tasks_20example_20functionalities_584',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]],
+ ['user_5fagent_585',['user_agent',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a59825a2326d7fc12991da432fbe20098',1,'AZX_HTTP_HEADER']]],
+ ['user_5fbase64_5fencode_586',['user_base64_encode',['../group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890',1,'azx_https.h']]],
+ ['user_5fcb_5fbytes_5fsize_587',['user_cb_bytes_size',['../structazx__http_callback_options.html#ae999de10c7ec41abc95949d9e3b90102',1,'azx_httpCallbackOptions']]],
+ ['user_5ftask_5fcb_588',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_11.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_11.js
index bddb1d5a..7fb75b56 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_11.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_11.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['valuedouble_587',['valuedouble',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a5bb5e5d9b929a207d8e3638ff69e0bbd',1,'AZX_CJSON_TAG']]],
- ['valueint_588',['valueint',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ad01e0574595b9bd3372e4a0cb6513946',1,'AZX_CJSON_TAG']]],
- ['valuestring_589',['valuestring',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a6eb2a686fb4d6eee30abc3054b2012ec',1,'AZX_CJSON_TAG']]]
+ ['valuedouble_589',['valuedouble',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a5bb5e5d9b929a207d8e3638ff69e0bbd',1,'AZX_CJSON_TAG']]],
+ ['valueint_590',['valueint',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ad01e0574595b9bd3372e4a0cb6513946',1,'AZX_CJSON_TAG']]],
+ ['valuestring_591',['valuestring',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a6eb2a686fb4d6eee30abc3054b2012ec',1,'AZX_CJSON_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_12.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_12.js
index 5b7f36c8..63373445 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_12.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_12.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['zlibusage_590',['ZlibUsage',['../group__zlib_usage.html',1,'']]]
+ ['zlibusage_592',['ZlibUsage',['../group__zlib_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_4.js
index 612995c0..a668f3e9 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_4.js
@@ -4,5 +4,6 @@ var searchData=
['data_5fcb_5fdata_508',['DATA_CB_DATA',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a576d5504422b3b4ca16d012d5140420e',1,'azx_ftp.h']]],
['data_5fcb_5fend_509',['DATA_CB_END',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a8bd786bf28fbd4a4c5924da9673bc33c',1,'azx_ftp.h']]],
['data_5fcb_5fstart_510',['DATA_CB_START',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a310f681a436283e67f5752dc6fb81e65',1,'azx_ftp.h']]],
- ['delegation_511',['Delegation',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#adb543eb2a52c2679e78567a9f005eb25',1,'AZX_EASY_AT_ATCOMMAND_TAG']]]
+ ['dcs_5fstruct_511',['dcs_struct',['../structdcs__struct.html',1,'']]],
+ ['delegation_512',['Delegation',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#adb543eb2a52c2679e78567a9f005eb25',1,'AZX_EASY_AT_ATCOMMAND_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_5.js
index e39ad07a..20c488e6 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_5.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_5.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['eeprom_20utilities_20allowing_20communication_20with_20eeprom_20chips_20of_2024xx256_20family_2e_512',['EEPROM utilities allowing communication with EEPROM chips of 24xx256 family.',['../group__azx__eeprom.html',1,'']]],
- ['easy_5fat_5fhandles_5ftag_513',['EASY_AT_HANDLES_TAG',['../struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
- ['easy_5fat_5fmodule_5ftag_514',['EASY_AT_MODULE_TAG',['../struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]]
+ ['eeprom_20utilities_20allowing_20communication_20with_20eeprom_20chips_20of_2024xx256_20family_2e_513',['EEPROM utilities allowing communication with EEPROM chips of 24xx256 family.',['../group__azx__eeprom.html',1,'']]],
+ ['easy_5fat_5fhandles_5ftag_514',['EASY_AT_HANDLES_TAG',['../struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
+ ['easy_5fat_5fmodule_5ftag_515',['EASY_AT_MODULE_TAG',['../struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_6.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_6.js
index df2736e3..9c3b26a7 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_6.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_6.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['ftp_20client_20configuration_515',['FTP Client configuration',['../group___a_z_x___f_t_p___c_o_n_f.html',1,'']]],
- ['ftp_20client_20usage_516',['FTP Client usage',['../group___a_z_x___f_t_p___u_s_a_g_e.html',1,'']]],
- ['fd_5fset_517',['FD_SET',['../azx__gnu__sys__socket_8h.html#ad97013c4b9982b36a8308917d5c22c52',1,'azx_gnu_sys_socket.h']]],
- ['fileinfo_518',['fileInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#a56a3937348cbbaa14b988ff3d50d39da',1,'AZX_FTP_XFER_TAG']]],
- ['filesize_519',['fileSize',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a4be4fd757122b5abebcfbd59ed9ca1df',1,'AZX_FTP_FILE_INFO_TAG']]],
- ['ftpcallbackoptions_520',['FtpCallbackOptions',['../struct_ftp_callback_options.html',1,'']]]
+ ['ftp_20client_20configuration_516',['FTP Client configuration',['../group___a_z_x___f_t_p___c_o_n_f.html',1,'']]],
+ ['ftp_20client_20usage_517',['FTP Client usage',['../group___a_z_x___f_t_p___u_s_a_g_e.html',1,'']]],
+ ['fd_5fset_518',['FD_SET',['../azx__gnu__sys__socket_8h.html#ad97013c4b9982b36a8308917d5c22c52',1,'azx_gnu_sys_socket.h']]],
+ ['fileinfo_519',['fileInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#a56a3937348cbbaa14b988ff3d50d39da',1,'AZX_FTP_XFER_TAG']]],
+ ['filesize_520',['fileSize',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a4be4fd757122b5abebcfbd59ed9ca1df',1,'AZX_FTP_FILE_INFO_TAG']]],
+ ['ftpcallbackoptions_521',['FtpCallbackOptions',['../struct_ftp_callback_options.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_7.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_7.js
index 19fc29b8..2b3178f2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_7.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_7.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['handle_521',['handle',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a05528a90a9a74940a2e76d8c587148eb',1,'AZX_EASY_AT_HANDLES_TAG']]],
- ['high_5fvalue_522',['HIGH_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619',1,'azx_spi_flash_hw_external.h']]],
- ['host_523',['host',['../struct_a_z_x___h_t_t_p___u_r_l.html#a6bf08b18309f7f22242da6ef980e4cc2',1,'AZX_HTTP_URL']]],
- ['http_20client_20configuration_524',['HTTP client configuration',['../group__http_conf.html',1,'']]],
- ['https_525',['https',['../struct_a_z_x___h_t_t_p___u_r_l.html#ae3c4b1e005db64167b8230216a94985f',1,'AZX_HTTP_URL']]],
- ['http_20client_20usage_526',['HTTP client usage',['../group__http_usage.html',1,'']]]
+ ['handle_522',['handle',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a05528a90a9a74940a2e76d8c587148eb',1,'AZX_EASY_AT_HANDLES_TAG']]],
+ ['high_5fvalue_523',['HIGH_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619',1,'azx_spi_flash_hw_external.h']]],
+ ['host_524',['host',['../struct_a_z_x___h_t_t_p___u_r_l.html#a6bf08b18309f7f22242da6ef980e4cc2',1,'AZX_HTTP_URL']]],
+ ['http_20client_20configuration_525',['HTTP client configuration',['../group__http_conf.html',1,'']]],
+ ['https_526',['https',['../struct_a_z_x___h_t_t_p___u_r_l.html#ae3c4b1e005db64167b8230216a94985f',1,'AZX_HTTP_URL']]],
+ ['http_20client_20usage_527',['HTTP client usage',['../group__http_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_8.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_8.js
index 7cffe724..f0697de7 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_8.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_8.js
@@ -1,12 +1,12 @@
var searchData=
[
- ['i2c_5fhandle_527',['i2c_handle',['../struct_a_z_x___e_e_p_r_o_m___t.html#ace28601755fa5bedd7f57d149df2a975',1,'AZX_EEPROM_T']]],
- ['idletime_528',['idleTime',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#a31e887128d37ea5729e25523c552ddec',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]],
- ['if_5fnamesize_529',['IF_NAMESIZE',['../azx__gnu__sys__socket_8h.html#aedb93bcce9682d7644080b859849f59d',1,'azx_gnu_sys_socket.h']]],
- ['in_5faddr_5ft_530',['in_addr_t',['../azx__gnu__sys__socket_8h.html#a861113898f7e0855e1a08858b19b5a3d',1,'azx_gnu_sys_socket.h']]],
- ['inet_5faddrstrlen_531',['INET_ADDRSTRLEN',['../azx__gnu__sys__socket_8h.html#a93b37007689284fd9c4bde1a8f4b9199',1,'azx_gnu_sys_socket.h']]],
- ['info_532',['info',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a413ff5942d1eaa515fc507c3562e0a49',1,'AZX_LFS_INFO_FILE']]],
- ['ishidden_533',['isHidden',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a2f8bbf4d3fd67988b6665f2737047939',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
- ['isinit_534',['isInit',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#a399e8267dda10781705c4a03c542339b',1,'AZX_LFS_STATUS_UTILS']]],
- ['ismount_535',['isMount',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#abaad5bb722a71d1270c07d3ba3bc1398',1,'AZX_LFS_STATUS_UTILS']]]
+ ['i2c_5fhandle_528',['i2c_handle',['../struct_a_z_x___e_e_p_r_o_m___t.html#ace28601755fa5bedd7f57d149df2a975',1,'AZX_EEPROM_T']]],
+ ['idletime_529',['idleTime',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#a31e887128d37ea5729e25523c552ddec',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]],
+ ['if_5fnamesize_530',['IF_NAMESIZE',['../azx__gnu__sys__socket_8h.html#aedb93bcce9682d7644080b859849f59d',1,'azx_gnu_sys_socket.h']]],
+ ['in_5faddr_5ft_531',['in_addr_t',['../azx__gnu__sys__socket_8h.html#a861113898f7e0855e1a08858b19b5a3d',1,'azx_gnu_sys_socket.h']]],
+ ['inet_5faddrstrlen_532',['INET_ADDRSTRLEN',['../azx__gnu__sys__socket_8h.html#a93b37007689284fd9c4bde1a8f4b9199',1,'azx_gnu_sys_socket.h']]],
+ ['info_533',['info',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a413ff5942d1eaa515fc507c3562e0a49',1,'AZX_LFS_INFO_FILE']]],
+ ['ishidden_534',['isHidden',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a2f8bbf4d3fd67988b6665f2737047939',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
+ ['isinit_535',['isInit',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#a399e8267dda10781705c4a03c542339b',1,'AZX_LFS_STATUS_UTILS']]],
+ ['ismount_536',['isMount',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#abaad5bb722a71d1270c07d3ba3bc1398',1,'AZX_LFS_STATUS_UTILS']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_9.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_9.js
index 5a74b837..07c6c839 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_9.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_9.js
@@ -1,14 +1,14 @@
var searchData=
[
- ['last_5fat_5finstance_536',['last_AT_Instance',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a7a25b7d50914a64818790092f886b3a2',1,'AZX_EASY_AT_MODULE_TAG']]],
- ['last_5fatp_5fhandle_537',['last_ATP_Handle',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a12ab5e3a209f52f7f02e99917359ba20',1,'AZX_EASY_AT_MODULE_TAG']]],
- ['level_538',['level',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ab8f878a853262f834a7bdf51e04b53ed',1,'AZX_FTP_OPTIONS_TAG']]],
- ['location_539',['location',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a96d238225d01cc207e77d4140e3e2b5e',1,'AZX_HTTP_HEADER']]],
- ['log_5fchannel_540',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_541',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_542',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]],
- ['logarg_543',['logArg',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a6306ca88fc8eff2aa06ac2e6d613a948',1,'AZX_HTTP_OPTIONS']]],
- ['logfunc_544',['logFunc',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a1a061e1b6445742cfdbfbc69b129eeec',1,'AZX_HTTP_OPTIONS']]],
- ['loglevel_545',['loglevel',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a781168041c2fd139fefa9c31de6d9c86',1,'AZX_HTTP_OPTIONS']]],
- ['low_5fvalue_546',['LOW_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8',1,'azx_spi_flash_hw_external.h']]]
+ ['last_5fat_5finstance_537',['last_AT_Instance',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a7a25b7d50914a64818790092f886b3a2',1,'AZX_EASY_AT_MODULE_TAG']]],
+ ['last_5fatp_5fhandle_538',['last_ATP_Handle',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a12ab5e3a209f52f7f02e99917359ba20',1,'AZX_EASY_AT_MODULE_TAG']]],
+ ['level_539',['level',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ab8f878a853262f834a7bdf51e04b53ed',1,'AZX_FTP_OPTIONS_TAG']]],
+ ['location_540',['location',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a96d238225d01cc207e77d4140e3e2b5e',1,'AZX_HTTP_HEADER']]],
+ ['log_5fchannel_541',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_542',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_543',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]],
+ ['logarg_544',['logArg',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a6306ca88fc8eff2aa06ac2e6d613a948',1,'AZX_HTTP_OPTIONS']]],
+ ['logfunc_545',['logFunc',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a1a061e1b6445742cfdbfbc69b129eeec',1,'AZX_HTTP_OPTIONS']]],
+ ['loglevel_546',['loglevel',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a781168041c2fd139fefa9c31de6d9c86',1,'AZX_HTTP_OPTIONS']]],
+ ['low_5fvalue_547',['LOW_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8',1,'azx_spi_flash_hw_external.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_a.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_a.js
index a65f3dc6..a5849ba3 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_a.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_a.js
@@ -1,7 +1,7 @@
var searchData=
[
- ['m2m_5fos_5ftask_5fstack_5flimit_547',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]],
- ['mem_5fsize_548',['mem_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a52579f677c61a9132d71d86430ab5e7b',1,'AZX_EEPROM_T']]],
- ['method_549',['method',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aa3b55132919b0eb9649b04e03423e82e',1,'AZX_HTTP_HEADER']]],
- ['module_5fname_550',['module_name',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a19f9fdd573dc3062152819565de5ac01',1,'AZX_EASY_AT_MODULE_TAG']]]
+ ['m2m_5fos_5ftask_5fstack_5flimit_548',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]],
+ ['mem_5fsize_549',['mem_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a52579f677c61a9132d71d86430ab5e7b',1,'AZX_EEPROM_T']]],
+ ['method_550',['method',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aa3b55132919b0eb9649b04e03423e82e',1,'AZX_HTTP_HEADER']]],
+ ['module_5fname_551',['module_name',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a19f9fdd573dc3062152819565de5ac01',1,'AZX_EASY_AT_MODULE_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_b.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_b.js
index 81fb583c..9585be3c 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_b.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_b.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['next_551',['next',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ada4b3bb3a8d840cc4c8dbddd559fe796',1,'AZX_CJSON_TAG::next()'],['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a1467c82be849a9e4db0566b7cad0870c',1,'AZX_LFS_INFO_FILE::next()']]]
+ ['next_552',['next',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ada4b3bb3a8d840cc4c8dbddd559fe796',1,'AZX_CJSON_TAG::next()'],['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a1467c82be849a9e4db0566b7cad0870c',1,'AZX_LFS_INFO_FILE::next()']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_c.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_c.js
index bad86e67..c3a1cfb7 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_c.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_c.js
@@ -1,12 +1,13 @@
var searchData=
[
- ['padding_552',['padding',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a009dfc4ae5a6b15f6ce9abe5f60ab813',1,'AZX_HTTP_OPTIONS']]],
- ['page_5fsize_553',['page_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a838dde91b1b4467af3495d3edad8c3ad',1,'AZX_EEPROM_T']]],
- ['param1_554',['param1',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a0a5c89e190600f643c60380bb32d3579',1,'AZX_TASKS_MESSAGE_T']]],
- ['param2_555',['param2',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a21c34f7468ecae71cbe5edf2da4f1c09',1,'AZX_TASKS_MESSAGE_T']]],
- ['path_556',['path',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a07d7fc9fc39327e4a14f70792889934b',1,'AZX_FTP_FILE_INFO_TAG::path()'],['../struct_a_z_x___h_t_t_p___u_r_l.html#aaf259b6e879aeabb86c582d65e25dd68',1,'AZX_HTTP_URL::path()']]],
- ['payload_557',['payload',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#abdafe0fe61a0c3a2de0b3de8bb795a92',1,'AZX_FTP_XFER_TAG']]],
- ['port_558',['port',['../struct_a_z_x___h_t_t_p___u_r_l.html#a8c4b4d7776d5fc2d3762ae9d7a34411a',1,'AZX_HTTP_URL']]],
- ['post_5fdata_559',['post_data',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a4b8018e0fa63244f5d16181874ef996b',1,'AZX_HTTP_HEADER']]],
- ['prev_560',['prev',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a73c6b79049b7349f09378271ff721966',1,'AZX_CJSON_TAG']]]
+ ['padding_553',['padding',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a009dfc4ae5a6b15f6ce9abe5f60ab813',1,'AZX_HTTP_OPTIONS']]],
+ ['page_5fsize_554',['page_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a838dde91b1b4467af3495d3edad8c3ad',1,'AZX_EEPROM_T']]],
+ ['param1_555',['param1',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a0a5c89e190600f643c60380bb32d3579',1,'AZX_TASKS_MESSAGE_T']]],
+ ['param2_556',['param2',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a21c34f7468ecae71cbe5edf2da4f1c09',1,'AZX_TASKS_MESSAGE_T']]],
+ ['path_557',['path',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a07d7fc9fc39327e4a14f70792889934b',1,'AZX_FTP_FILE_INFO_TAG::path()'],['../struct_a_z_x___h_t_t_p___u_r_l.html#aaf259b6e879aeabb86c582d65e25dd68',1,'AZX_HTTP_URL::path()']]],
+ ['payload_558',['payload',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#abdafe0fe61a0c3a2de0b3de8bb795a92',1,'AZX_FTP_XFER_TAG']]],
+ ['pdu_5fstruct_559',['pdu_struct',['../structpdu__struct.html',1,'']]],
+ ['port_560',['port',['../struct_a_z_x___h_t_t_p___u_r_l.html#a8c4b4d7776d5fc2d3762ae9d7a34411a',1,'AZX_HTTP_URL']]],
+ ['post_5fdata_561',['post_data',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a4b8018e0fa63244f5d16181874ef996b',1,'AZX_HTTP_HEADER']]],
+ ['prev_562',['prev',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a73c6b79049b7349f09378271ff721966',1,'AZX_CJSON_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_d.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_d.js
index b5adc30a..07d9c309 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_d.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_d.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['referrer_561',['referrer',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad72c30d64c80b4ffbd49d0d81a880cff',1,'AZX_HTTP_HEADER']]]
+ ['referrer_563',['referrer',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad72c30d64c80b4ffbd49d0d81a880cff',1,'AZX_HTTP_HEADER']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_e.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_e.js
index 50f6ca75..09294fb1 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_e.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_e.js
@@ -1,18 +1,18 @@
var searchData=
[
- ['sockaddr_562',['sockaddr',['../azx__gnu__sys__socket_8h.html#af5850e749a61de4774245a6d599920b4',1,'azx_gnu_sys_socket.h']]],
- ['sockaddr_5fstorage_563',['sockaddr_storage',['../structsockaddr__storage.html',1,'']]],
- ['socket_564',['socket',['../azx__gnu__sys__socket_8h.html#aa8318fbee111c5bde5952c63e894c962',1,'azx_gnu_sys_socket.h']]],
- ['socklen_5ft_565',['socklen_t',['../azx__gnu__sys__socket_8h.html#aae83a93236e01902b58ec3f197a17f7c',1,'azx_gnu_sys_socket.h']]],
- ['spi_5fflash_5flog_5fhook_5flevels_5fe_566',['SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5fdebug_567',['SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5ferror_568',['SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5finfo_569',['SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5fnone_570',['SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1',1,'azx_spi_flash_hw_external.h']]],
- ['sslauthtype_571',['sslAuthType',['../struct_a_z_x___h_t_t_p___s_s_l.html#a74687f5a92426fe2c83c3b0bf038296c',1,'AZX_HTTP_SSL']]],
- ['sslconf_572',['sslConf',['../struct_a_z_x___h_t_t_p___s_s_l.html#a3546333f61310abba5a3b8389b450f71',1,'AZX_HTTP_SSL']]],
- ['sslh_573',['sslH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a87aa1e5006bc730ba8bdd3d8a5e8d102',1,'AZX_HTTP_SSL']]],
- ['status_574',['status',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a8f2c6f2c1d19eaa45d95ccbd75cd0d95',1,'AZX_HTTP_HEADER']]],
- ['string_575',['string',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a7e7993d4465c690d53f8dc49600540d2',1,'AZX_CJSON_TAG']]],
- ['string_20utilities_20usage_576',['String utilities usage',['../group__string_usage.html',1,'']]]
+ ['sockaddr_564',['sockaddr',['../azx__gnu__sys__socket_8h.html#af5850e749a61de4774245a6d599920b4',1,'azx_gnu_sys_socket.h']]],
+ ['sockaddr_5fstorage_565',['sockaddr_storage',['../structsockaddr__storage.html',1,'']]],
+ ['socket_566',['socket',['../azx__gnu__sys__socket_8h.html#aa8318fbee111c5bde5952c63e894c962',1,'azx_gnu_sys_socket.h']]],
+ ['socklen_5ft_567',['socklen_t',['../azx__gnu__sys__socket_8h.html#aae83a93236e01902b58ec3f197a17f7c',1,'azx_gnu_sys_socket.h']]],
+ ['spi_5fflash_5flog_5fhook_5flevels_5fe_568',['SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5fdebug_569',['SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5ferror_570',['SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5finfo_571',['SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5fnone_572',['SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1',1,'azx_spi_flash_hw_external.h']]],
+ ['sslauthtype_573',['sslAuthType',['../struct_a_z_x___h_t_t_p___s_s_l.html#a74687f5a92426fe2c83c3b0bf038296c',1,'AZX_HTTP_SSL']]],
+ ['sslconf_574',['sslConf',['../struct_a_z_x___h_t_t_p___s_s_l.html#a3546333f61310abba5a3b8389b450f71',1,'AZX_HTTP_SSL']]],
+ ['sslh_575',['sslH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a87aa1e5006bc730ba8bdd3d8a5e8d102',1,'AZX_HTTP_SSL']]],
+ ['status_576',['status',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a8f2c6f2c1d19eaa45d95ccbd75cd0d95',1,'AZX_HTTP_HEADER']]],
+ ['string_577',['string',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a7e7993d4465c690d53f8dc49600540d2',1,'AZX_CJSON_TAG']]],
+ ['string_20utilities_20usage_578',['String utilities usage',['../group__string_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_f.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_f.js
index 24f47f9d..99b6af44 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_f.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/all_f.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['timezone_577',['timezone',['../structtimezone.html',1,'']]],
- ['type_578',['type',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ae125d3fd935e29ae9a71f99134f9f43e',1,'AZX_CJSON_TAG::type()'],['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#af641d98bcb03ff5ecad1d40e870bd7b5',1,'AZX_FTP_XFER_TAG::type()'],['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a8809225d58c6b2c59835114fb625c045',1,'AZX_LFS_CONTEXT::type()'],['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a9110a674136a92f2eea7927877398f0e',1,'AZX_TASKS_MESSAGE_T::type()']]]
+ ['timezone_579',['timezone',['../structtimezone.html',1,'']]],
+ ['type_580',['type',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ae125d3fd935e29ae9a71f99134f9f43e',1,'AZX_CJSON_TAG::type()'],['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#af641d98bcb03ff5ecad1d40e870bd7b5',1,'AZX_FTP_XFER_TAG::type()'],['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a8809225d58c6b2c59835114fb625c045',1,'AZX_LFS_CONTEXT::type()'],['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a9110a674136a92f2eea7927877398f0e',1,'AZX_TASKS_MESSAGE_T::type()']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_0.js
index bac6d60f..9e6d93b0 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_0.js
@@ -1,38 +1,38 @@
var searchData=
[
- ['azx_5fcjson_5ftag_591',['AZX_CJSON_TAG',['../struct_a_z_x___c_j_s_o_n___t_a_g.html',1,'']]],
- ['azx_5feasy_5fat_5fatcommand_5ftag_592',['AZX_EASY_AT_ATCOMMAND_TAG',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html',1,'']]],
- ['azx_5feasy_5fat_5fhandles_5ftag_593',['AZX_EASY_AT_HANDLES_TAG',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
- ['azx_5feasy_5fat_5fmodule_5ftag_594',['AZX_EASY_AT_MODULE_TAG',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]],
- ['azx_5feeprom_5ft_595',['AZX_EEPROM_T',['../struct_a_z_x___e_e_p_r_o_m___t.html',1,'']]],
- ['azx_5fftp_5fbuffer_596',['AZX_FTP_BUFFER',['../struct_a_z_x___f_t_p___b_u_f_f_e_r.html',1,'']]],
- ['azx_5fftp_5fbuffer_5ftag_597',['AZX_FTP_BUFFER_TAG',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html',1,'']]],
- ['azx_5fftp_5fcallback_5foptions_5ftag_598',['AZX_FTP_CALLBACK_OPTIONS_TAG',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html',1,'']]],
- ['azx_5fftp_5ffile_5finfo_599',['AZX_FTP_FILE_INFO',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html',1,'']]],
- ['azx_5fftp_5ffile_5finfo_5ftag_600',['AZX_FTP_FILE_INFO_TAG',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html',1,'']]],
- ['azx_5fftp_5fnet_5fbuf_5ftag_601',['AZX_FTP_NET_BUF_TAG',['../struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html',1,'']]],
- ['azx_5fftp_5foptions_5ftag_602',['AZX_FTP_OPTIONS_TAG',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html',1,'']]],
- ['azx_5fftp_5fxfer_5ftag_603',['AZX_FTP_XFER_TAG',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html',1,'']]],
- ['azx_5fhttp_5fheader_604',['AZX_HTTP_HEADER',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html',1,'']]],
- ['azx_5fhttp_5finfo_605',['AZX_HTTP_INFO',['../struct_a_z_x___h_t_t_p___i_n_f_o.html',1,'']]],
- ['azx_5fhttp_5foptions_606',['AZX_HTTP_OPTIONS',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html',1,'']]],
- ['azx_5fhttp_5fssl_607',['AZX_HTTP_SSL',['../struct_a_z_x___h_t_t_p___s_s_l.html',1,'']]],
- ['azx_5fhttp_5furl_608',['AZX_HTTP_URL',['../struct_a_z_x___h_t_t_p___u_r_l.html',1,'']]],
- ['azx_5fhttpcallbackoptions_609',['azx_httpCallbackOptions',['../structazx__http_callback_options.html',1,'']]],
- ['azx_5fhttps_5foptions_610',['AZX_HTTPS_OPTIONS',['../struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html',1,'']]],
- ['azx_5flfs_5fcontext_611',['AZX_LFS_CONTEXT',['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html',1,'']]],
- ['azx_5flfs_5finfo_5ffile_612',['AZX_LFS_INFO_FILE',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html',1,'']]],
- ['azx_5flfs_5fstatus_5futils_613',['AZX_LFS_STATUS_UTILS',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html',1,'']]],
- ['azx_5flog_5fcfg_5ft_614',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]],
- ['azx_5fram_5fdisk_5fs_615',['AZX_RAM_DISK_S',['../struct_a_z_x___r_a_m___d_i_s_k___s.html',1,'']]],
- ['azx_5fspi_5fflash_5fdescriptor_616',['AZX_SPI_FLASH_DESCRIPTOR',['../struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html',1,'']]],
- ['azx_5fspi_5fflash_5fecclayout_617',['AZX_SPI_FLASH_ECCLAYOUT',['../struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html',1,'']]],
- ['azx_5fspi_5fflash_5fevent_5fcallback_618',['AZX_SPI_FLASH_EVENT_CALLBACK',['../struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html',1,'']]],
- ['azx_5fspi_5fflash_5fjsc_5fevent_5fres_5ft_619',['AZX_SPI_FLASH_JSC_EVENT_RES_T',['../struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html',1,'']]],
- ['azx_5fspi_5fflash_5fmicro_5fspi_5fparams_620',['AZX_SPI_FLASH_MICRO_SPI_PARAMS',['../struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html',1,'']]],
- ['azx_5fspi_5fflash_5fmtd_5foob_5fops_621',['AZX_SPI_FLASH_MTD_OOB_OPS',['../struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html',1,'']]],
- ['azx_5fspi_5fflash_5foobfree_622',['AZX_SPI_FLASH_OOBFREE',['../struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html',1,'']]],
- ['azx_5fspi_5fflash_5fspi_5fchip_623',['AZX_SPI_FLASH_SPI_CHIP',['../struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html',1,'']]],
- ['azx_5fspi_5fflash_5fspi_5fslave_624',['AZX_SPI_FLASH_SPI_SLAVE',['../struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html',1,'']]],
- ['azx_5ftasks_5fmessage_5ft_625',['AZX_TASKS_MESSAGE_T',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html',1,'']]]
+ ['azx_5fcjson_5ftag_593',['AZX_CJSON_TAG',['../struct_a_z_x___c_j_s_o_n___t_a_g.html',1,'']]],
+ ['azx_5feasy_5fat_5fatcommand_5ftag_594',['AZX_EASY_AT_ATCOMMAND_TAG',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html',1,'']]],
+ ['azx_5feasy_5fat_5fhandles_5ftag_595',['AZX_EASY_AT_HANDLES_TAG',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
+ ['azx_5feasy_5fat_5fmodule_5ftag_596',['AZX_EASY_AT_MODULE_TAG',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]],
+ ['azx_5feeprom_5ft_597',['AZX_EEPROM_T',['../struct_a_z_x___e_e_p_r_o_m___t.html',1,'']]],
+ ['azx_5fftp_5fbuffer_598',['AZX_FTP_BUFFER',['../struct_a_z_x___f_t_p___b_u_f_f_e_r.html',1,'']]],
+ ['azx_5fftp_5fbuffer_5ftag_599',['AZX_FTP_BUFFER_TAG',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html',1,'']]],
+ ['azx_5fftp_5fcallback_5foptions_5ftag_600',['AZX_FTP_CALLBACK_OPTIONS_TAG',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html',1,'']]],
+ ['azx_5fftp_5ffile_5finfo_601',['AZX_FTP_FILE_INFO',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html',1,'']]],
+ ['azx_5fftp_5ffile_5finfo_5ftag_602',['AZX_FTP_FILE_INFO_TAG',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html',1,'']]],
+ ['azx_5fftp_5fnet_5fbuf_5ftag_603',['AZX_FTP_NET_BUF_TAG',['../struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html',1,'']]],
+ ['azx_5fftp_5foptions_5ftag_604',['AZX_FTP_OPTIONS_TAG',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html',1,'']]],
+ ['azx_5fftp_5fxfer_5ftag_605',['AZX_FTP_XFER_TAG',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html',1,'']]],
+ ['azx_5fhttp_5fheader_606',['AZX_HTTP_HEADER',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html',1,'']]],
+ ['azx_5fhttp_5finfo_607',['AZX_HTTP_INFO',['../struct_a_z_x___h_t_t_p___i_n_f_o.html',1,'']]],
+ ['azx_5fhttp_5foptions_608',['AZX_HTTP_OPTIONS',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html',1,'']]],
+ ['azx_5fhttp_5fssl_609',['AZX_HTTP_SSL',['../struct_a_z_x___h_t_t_p___s_s_l.html',1,'']]],
+ ['azx_5fhttp_5furl_610',['AZX_HTTP_URL',['../struct_a_z_x___h_t_t_p___u_r_l.html',1,'']]],
+ ['azx_5fhttpcallbackoptions_611',['azx_httpCallbackOptions',['../structazx__http_callback_options.html',1,'']]],
+ ['azx_5fhttps_5foptions_612',['AZX_HTTPS_OPTIONS',['../struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html',1,'']]],
+ ['azx_5flfs_5fcontext_613',['AZX_LFS_CONTEXT',['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html',1,'']]],
+ ['azx_5flfs_5finfo_5ffile_614',['AZX_LFS_INFO_FILE',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html',1,'']]],
+ ['azx_5flfs_5fstatus_5futils_615',['AZX_LFS_STATUS_UTILS',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html',1,'']]],
+ ['azx_5flog_5fcfg_5ft_616',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]],
+ ['azx_5fram_5fdisk_5fs_617',['AZX_RAM_DISK_S',['../struct_a_z_x___r_a_m___d_i_s_k___s.html',1,'']]],
+ ['azx_5fspi_5fflash_5fdescriptor_618',['AZX_SPI_FLASH_DESCRIPTOR',['../struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html',1,'']]],
+ ['azx_5fspi_5fflash_5fecclayout_619',['AZX_SPI_FLASH_ECCLAYOUT',['../struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html',1,'']]],
+ ['azx_5fspi_5fflash_5fevent_5fcallback_620',['AZX_SPI_FLASH_EVENT_CALLBACK',['../struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html',1,'']]],
+ ['azx_5fspi_5fflash_5fjsc_5fevent_5fres_5ft_621',['AZX_SPI_FLASH_JSC_EVENT_RES_T',['../struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html',1,'']]],
+ ['azx_5fspi_5fflash_5fmicro_5fspi_5fparams_622',['AZX_SPI_FLASH_MICRO_SPI_PARAMS',['../struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html',1,'']]],
+ ['azx_5fspi_5fflash_5fmtd_5foob_5fops_623',['AZX_SPI_FLASH_MTD_OOB_OPS',['../struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html',1,'']]],
+ ['azx_5fspi_5fflash_5foobfree_624',['AZX_SPI_FLASH_OOBFREE',['../struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html',1,'']]],
+ ['azx_5fspi_5fflash_5fspi_5fchip_625',['AZX_SPI_FLASH_SPI_CHIP',['../struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html',1,'']]],
+ ['azx_5fspi_5fflash_5fspi_5fslave_626',['AZX_SPI_FLASH_SPI_SLAVE',['../struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html',1,'']]],
+ ['azx_5ftasks_5fmessage_5ft_627',['AZX_TASKS_MESSAGE_T',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_1.js
index fe76282f..78ab3007 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_1.js
@@ -1,5 +1,4 @@
var searchData=
[
- ['easy_5fat_5fhandles_5ftag_626',['EASY_AT_HANDLES_TAG',['../struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
- ['easy_5fat_5fmodule_5ftag_627',['EASY_AT_MODULE_TAG',['../struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]]
+ ['dcs_5fstruct_628',['dcs_struct',['../structdcs__struct.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_2.js
index decf0922..b50fa7b6 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_2.js
@@ -1,4 +1,5 @@
var searchData=
[
- ['ftpcallbackoptions_628',['FtpCallbackOptions',['../struct_ftp_callback_options.html',1,'']]]
+ ['easy_5fat_5fhandles_5ftag_629',['EASY_AT_HANDLES_TAG',['../struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html',1,'']]],
+ ['easy_5fat_5fmodule_5ftag_630',['EASY_AT_MODULE_TAG',['../struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_3.js
index 63bec873..e21688c2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['sockaddr_5fstorage_629',['sockaddr_storage',['../structsockaddr__storage.html',1,'']]]
+ ['ftpcallbackoptions_631',['FtpCallbackOptions',['../struct_ftp_callback_options.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_4.js
index 98ffb0d0..db6cdb51 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_4.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['timezone_630',['timezone',['../structtimezone.html',1,'']]]
+ ['pdu_5fstruct_632',['pdu_struct',['../structpdu__struct.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.html
new file mode 100644
index 00000000..e7afb2c3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
+
+
Searching...
+
No Matches
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.js
new file mode 100644
index 00000000..3a3656f0
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_5.js
@@ -0,0 +1,4 @@
+var searchData=
+[
+ ['sockaddr_5fstorage_633',['sockaddr_storage',['../structsockaddr__storage.html',1,'']]]
+];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.html
new file mode 100644
index 00000000..f397fd5a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
+
+
Searching...
+
No Matches
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.js
new file mode 100644
index 00000000..eaaaf909
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/classes_6.js
@@ -0,0 +1,4 @@
+var searchData=
+[
+ ['timezone_634',['timezone',['../structtimezone.html',1,'']]]
+];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_0.js
index 1bcf205b..b12009a0 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['_5fss_5fmaxsize_1033',['_SS_MAXSIZE',['../azx__gnu__sys__socket_8h.html#a313001ab5b0b2b81f4e90198d40f6c4a',1,'azx_gnu_sys_socket.h']]]
+ ['_5fss_5fmaxsize_1037',['_SS_MAXSIZE',['../azx__gnu__sys__socket_8h.html#a313001ab5b0b2b81f4e90198d40f6c4a',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_1.js
index 091ebfba..5fd5c51c 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_1.js
@@ -1,22 +1,22 @@
var searchData=
[
- ['af_5finet_1034',['AF_INET',['../azx__gnu__sys__socket_8h.html#a9930604d0e32588eae76f43ca38e7826',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fcjson_5faddbooltoobject_1035',['azx_cjson_addBoolToObject',['../azx__cjson_8h.html#a4d5538f7a9fadb17ee409b362bc7ced9',1,'azx_cjson.h']]],
- ['azx_5fcjson_5faddfalsetoobject_1036',['azx_cjson_addFalseToObject',['../azx__cjson_8h.html#a89540572bdba85a7a90ce62c60b15a17',1,'azx_cjson.h']]],
- ['azx_5fcjson_5faddnulltoobject_1037',['azx_cjson_addNullToObject',['../azx__cjson_8h.html#a9d4b7568e82117bdd74eee4992ee678c',1,'azx_cjson.h']]],
- ['azx_5fcjson_5faddnumbertoobject_1038',['azx_cjson_addNumberToObject',['../azx__cjson_8h.html#aa3260ed08cf17452af26a718d5f75edb',1,'azx_cjson.h']]],
- ['azx_5fcjson_5faddstringtoobject_1039',['azx_cjson_addStringToObject',['../azx__cjson_8h.html#a84e5f71eb499bd55fa4fdc73cccaf96e',1,'azx_cjson.h']]],
- ['azx_5fcjson_5faddtruetoobject_1040',['azx_cjson_addTrueToObject',['../azx__cjson_8h.html#a33c44ba1c181f3e9042312676baf1991',1,'azx_cjson.h']]],
- ['azx_5fcjson_5farray_1041',['AZX_CJSON_ARRAY',['../azx__cjson_8h.html#ab12333727df92037da86dc7774cf741f',1,'azx_cjson.h']]],
- ['azx_5fcjson_5farrayforeach_1042',['azx_cjson_arrayForEach',['../azx__cjson_8h.html#ac5bc1565ecbf4457f41903f8f532fc82',1,'azx_cjson.h']]],
- ['azx_5fcjson_5ffalse_1043',['AZX_CJSON_FALSE',['../azx__cjson_8h.html#a832675b87aa841437c8d494bcdd0e73c',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fnull_1044',['AZX_CJSON_NULL',['../azx__cjson_8h.html#a98b0d0f0c7c002c32d7cfee560f0a0a1',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fnumber_1045',['AZX_CJSON_NUMBER',['../azx__cjson_8h.html#a6a5f43b6b5523f79cecd3ca2b4e6ec40',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fobject_1046',['AZX_CJSON_OBJECT',['../azx__cjson_8h.html#adefe387b2795364011c8e552a24f8e8c',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fstring_1047',['AZX_CJSON_STRING',['../azx__cjson_8h.html#a76c79eba76adc5d6d4b77155a5cff610',1,'azx_cjson.h']]],
- ['azx_5fcjson_5ftrue_1048',['AZX_CJSON_TRUE',['../azx__cjson_8h.html#a0c6149ce8f0742e4808f825dd80a0b3d',1,'azx_cjson.h']]],
- ['azx_5feasy_5fat_5fcmd_5finfo_1049',['AZX_EASY_AT_CMD_INFO',['../azx__easy__at_8h.html#afc7de7e047faad3cae7fce22239cf19a',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5frelease_5fwith_5fcmee_1050',['AZX_EASY_AT_RELEASE_WITH_CMEE',['../azx__easy__at_8h.html#a8fadfac423878b7530e7dc0baf56a1a6',1,'azx_easy_at.h']]],
- ['azx_5flimit_1051',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
- ['azx_5flog_5finit_1052',['AZX_LOG_INIT',['../azx__log_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'azx_log.h']]]
+ ['af_5finet_1038',['AF_INET',['../azx__gnu__sys__socket_8h.html#a9930604d0e32588eae76f43ca38e7826',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fcjson_5faddbooltoobject_1039',['azx_cjson_addBoolToObject',['../azx__cjson_8h.html#a4d5538f7a9fadb17ee409b362bc7ced9',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5faddfalsetoobject_1040',['azx_cjson_addFalseToObject',['../azx__cjson_8h.html#a89540572bdba85a7a90ce62c60b15a17',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5faddnulltoobject_1041',['azx_cjson_addNullToObject',['../azx__cjson_8h.html#a9d4b7568e82117bdd74eee4992ee678c',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5faddnumbertoobject_1042',['azx_cjson_addNumberToObject',['../azx__cjson_8h.html#aa3260ed08cf17452af26a718d5f75edb',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5faddstringtoobject_1043',['azx_cjson_addStringToObject',['../azx__cjson_8h.html#a84e5f71eb499bd55fa4fdc73cccaf96e',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5faddtruetoobject_1044',['azx_cjson_addTrueToObject',['../azx__cjson_8h.html#a33c44ba1c181f3e9042312676baf1991',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5farray_1045',['AZX_CJSON_ARRAY',['../azx__cjson_8h.html#ab12333727df92037da86dc7774cf741f',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5farrayforeach_1046',['azx_cjson_arrayForEach',['../azx__cjson_8h.html#ac5bc1565ecbf4457f41903f8f532fc82',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5ffalse_1047',['AZX_CJSON_FALSE',['../azx__cjson_8h.html#a832675b87aa841437c8d494bcdd0e73c',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fnull_1048',['AZX_CJSON_NULL',['../azx__cjson_8h.html#a98b0d0f0c7c002c32d7cfee560f0a0a1',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fnumber_1049',['AZX_CJSON_NUMBER',['../azx__cjson_8h.html#a6a5f43b6b5523f79cecd3ca2b4e6ec40',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fobject_1050',['AZX_CJSON_OBJECT',['../azx__cjson_8h.html#adefe387b2795364011c8e552a24f8e8c',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fstring_1051',['AZX_CJSON_STRING',['../azx__cjson_8h.html#a76c79eba76adc5d6d4b77155a5cff610',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5ftrue_1052',['AZX_CJSON_TRUE',['../azx__cjson_8h.html#a0c6149ce8f0742e4808f825dd80a0b3d',1,'azx_cjson.h']]],
+ ['azx_5feasy_5fat_5fcmd_5finfo_1053',['AZX_EASY_AT_CMD_INFO',['../azx__easy__at_8h.html#afc7de7e047faad3cae7fce22239cf19a',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5frelease_5fwith_5fcmee_1054',['AZX_EASY_AT_RELEASE_WITH_CMEE',['../azx__easy__at_8h.html#a8fadfac423878b7530e7dc0baf56a1a6',1,'azx_easy_at.h']]],
+ ['azx_5flimit_1055',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
+ ['azx_5flog_5finit_1056',['AZX_LOG_INIT',['../azx__log_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'azx_log.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_2.js
index 031b4041..93b976fd 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['fd_5fset_1053',['FD_SET',['../azx__gnu__sys__socket_8h.html#ad97013c4b9982b36a8308917d5c22c52',1,'azx_gnu_sys_socket.h']]]
+ ['fd_5fset_1057',['FD_SET',['../azx__gnu__sys__socket_8h.html#ad97013c4b9982b36a8308917d5c22c52',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_3.js
index c9e0293c..11064fab 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_3.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['if_5fnamesize_1054',['IF_NAMESIZE',['../azx__gnu__sys__socket_8h.html#aedb93bcce9682d7644080b859849f59d',1,'azx_gnu_sys_socket.h']]],
- ['inet_5faddrstrlen_1055',['INET_ADDRSTRLEN',['../azx__gnu__sys__socket_8h.html#a93b37007689284fd9c4bde1a8f4b9199',1,'azx_gnu_sys_socket.h']]]
+ ['if_5fnamesize_1058',['IF_NAMESIZE',['../azx__gnu__sys__socket_8h.html#aedb93bcce9682d7644080b859849f59d',1,'azx_gnu_sys_socket.h']]],
+ ['inet_5faddrstrlen_1059',['INET_ADDRSTRLEN',['../azx__gnu__sys__socket_8h.html#a93b37007689284fd9c4bde1a8f4b9199',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_4.js
index d4ad2c4f..2faa4ea6 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/defines_4.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['sockaddr_1056',['sockaddr',['../azx__gnu__sys__socket_8h.html#af5850e749a61de4774245a6d599920b4',1,'azx_gnu_sys_socket.h']]],
- ['socket_1057',['socket',['../azx__gnu__sys__socket_8h.html#aa8318fbee111c5bde5952c63e894c962',1,'azx_gnu_sys_socket.h']]]
+ ['sockaddr_1060',['sockaddr',['../azx__gnu__sys__socket_8h.html#af5850e749a61de4774245a6d599920b4',1,'azx_gnu_sys_socket.h']]],
+ ['socket_1061',['socket',['../azx__gnu__sys__socket_8h.html#aa8318fbee111c5bde5952c63e894c962',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_0.js
index 368742a4..ff003726 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_0.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['_5fazx_5fhttp_5fmethod_922',['_AZX_HTTP_METHOD',['../group__http_conf.html#ga30623080daf9875d7ef4a53282de1ac0',1,'azx_https.h']]],
- ['_5fhttp_5fauth_5fschema_923',['_HTTP_AUTH_SCHEMA',['../group__http_conf.html#ga91dcf453b00607b13fb25aa4fb9996d8',1,'azx_https.h']]]
+ ['_5fazx_5fhttp_5fmethod_926',['_AZX_HTTP_METHOD',['../group__http_conf.html#ga30623080daf9875d7ef4a53282de1ac0',1,'azx_https.h']]],
+ ['_5fhttp_5fauth_5fschema_927',['_HTTP_AUTH_SCHEMA',['../group__http_conf.html#ga91dcf453b00607b13fb25aa4fb9996d8',1,'azx_https.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_1.js
index 03d7365a..56649c7b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_1.js
@@ -1,21 +1,21 @@
var searchData=
[
- ['azx_5feeprom_5fres_5fe_924',['AZX_EEPROM_RES_E',['../group__azx__eeprom.html#gae15185a63c805a8bcaa0969d7b5a57d5',1,'azx_eeprom_24XX.h']]],
- ['azx_5fftp_5fdebug_5fhook_5flevels_5fe_925',['AZX_FTP_DEBUG_HOOK_LEVELS_E',['../group___a_z_x___f_t_p___c_o_n_f.html#ga5b2d4554c8d26b5ad29aa165b17adf19',1,'azx_ftp.h']]],
- ['azx_5fftp_5fuser_5fcb_5fev_5fe_926',['AZX_FTP_USER_CB_EV_E',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gadbdffe015f1f2c5125641399bf181029',1,'azx_ftp.h']]],
- ['azx_5fftp_5fxfer_5fe_927',['AZX_FTP_XFER_E',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga93677062f9160355dea103b8049695f2',1,'azx_ftp.h']]],
- ['azx_5fhttp_5flog_5fhook_5flevels_5fe_928',['AZX_HTTP_LOG_HOOK_LEVELS_E',['../group__http_conf.html#gab1e72fc6db9cd975e6ec9e222b131f67',1,'azx_https.h']]],
- ['azx_5flfs_5fcontext_5ftype_5fe_929',['AZX_LFS_CONTEXT_TYPE_E',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27',1,'azx_lfs_utils.h']]],
- ['azx_5flfsdir_5fmode_5fe_930',['AZX_LFSDIR_MODE_E',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6d',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmount_5fmode_5fe_931',['AZX_LFSMOUNT_MODE_E',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00',1,'azx_lfs_utils.h']]],
- ['azx_5flfsrmdir_5fmode_5fe_932',['AZX_LFSRMDIR_MODE_E',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83e',1,'azx_lfs_utils.h']]],
- ['azx_5flfswrite_5fmode_5fe_933',['AZX_LFSWRITE_MODE_E',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3ac',1,'azx_lfs_utils.h']]],
- ['azx_5flog_5ferrors_5fe_934',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
- ['azx_5flog_5fhandle_5fe_935',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fe_936',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
- ['azx_5fspi_5fflash_5fgpio_5fvalue_5fe_937',['AZX_SPI_FLASH_GPIO_VALUE_E',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0c',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5fspi_5fflash_5flog_5fhook_5flevels_5fe_938',['AZX_SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5ftasks_5ferr_5fe_939',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fsize_940',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_941',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]]
+ ['azx_5feeprom_5fres_5fe_928',['AZX_EEPROM_RES_E',['../group__azx__eeprom.html#gae15185a63c805a8bcaa0969d7b5a57d5',1,'azx_eeprom_24XX.h']]],
+ ['azx_5fftp_5fdebug_5fhook_5flevels_5fe_929',['AZX_FTP_DEBUG_HOOK_LEVELS_E',['../group___a_z_x___f_t_p___c_o_n_f.html#ga5b2d4554c8d26b5ad29aa165b17adf19',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fuser_5fcb_5fev_5fe_930',['AZX_FTP_USER_CB_EV_E',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gadbdffe015f1f2c5125641399bf181029',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fxfer_5fe_931',['AZX_FTP_XFER_E',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga93677062f9160355dea103b8049695f2',1,'azx_ftp.h']]],
+ ['azx_5fhttp_5flog_5fhook_5flevels_5fe_932',['AZX_HTTP_LOG_HOOK_LEVELS_E',['../group__http_conf.html#gab1e72fc6db9cd975e6ec9e222b131f67',1,'azx_https.h']]],
+ ['azx_5flfs_5fcontext_5ftype_5fe_933',['AZX_LFS_CONTEXT_TYPE_E',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsdir_5fmode_5fe_934',['AZX_LFSDIR_MODE_E',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6d',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmount_5fmode_5fe_935',['AZX_LFSMOUNT_MODE_E',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsrmdir_5fmode_5fe_936',['AZX_LFSRMDIR_MODE_E',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83e',1,'azx_lfs_utils.h']]],
+ ['azx_5flfswrite_5fmode_5fe_937',['AZX_LFSWRITE_MODE_E',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3ac',1,'azx_lfs_utils.h']]],
+ ['azx_5flog_5ferrors_5fe_938',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
+ ['azx_5flog_5fhandle_5fe_939',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fe_940',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
+ ['azx_5fspi_5fflash_5fgpio_5fvalue_5fe_941',['AZX_SPI_FLASH_GPIO_VALUE_E',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0c',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5fspi_5fflash_5flog_5fhook_5flevels_5fe_942',['AZX_SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5ftasks_5ferr_5fe_943',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fsize_944',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_945',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_2.js
index 064350a8..ea634d07 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enums_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['spi_5fflash_5flog_5fhook_5flevels_5fe_942',['SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c',1,'azx_spi_flash_hw_external.h']]]
+ ['spi_5fflash_5flog_5fhook_5flevels_5fe_946',['SPI_FLASH_LOG_HOOK_LEVELS_E',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95c',1,'azx_spi_flash_hw_external.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_0.js
index f1b3d0c0..d6f2ebd2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_0.js
@@ -1,83 +1,83 @@
var searchData=
[
- ['azx_5fauthnotsupported_943',['azx_AuthNotSupported',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a25797e59ff6e516bfc9dd37571ec1342',1,'azx_https.h']]],
- ['azx_5fauthschemabasic_944',['azx_AuthSchemaBasic',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a857a96483abfbe69be35631f72146a0e',1,'azx_https.h']]],
- ['azx_5fauthschemanone_945',['azx_AuthSchemaNone',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a52caae2f3497597c5284e38ea9c89f65',1,'azx_https.h']]],
- ['azx_5feeprom_5fres_5fcannot_5fallocate_946',['AZX_EEPROM_RES_CANNOT_ALLOCATE',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a1ca954ba5b2e26ece3bd777e2acc8162',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5fcannot_5finit_947',['AZX_EEPROM_RES_CANNOT_INIT',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afbe5da7ae1822ffb3e7968cb98545a15',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5finvalid_5fhandle_948',['AZX_EEPROM_RES_INVALID_HANDLE',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afd12b69a2dd7e0315de970ae1358d19c',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5fmax_949',['AZX_EEPROM_RES_MAX',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5af0a3bbbc511c1e748e2718abdc094453',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5fok_950',['AZX_EEPROM_RES_OK',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a07df5299ef4b1ff8a2e170abd6fcd096',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5foverflow_951',['AZX_EEPROM_RES_OVERFLOW',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a16b446e14545fdf58ff6b63c2625f466',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5fread_5ferr_952',['AZX_EEPROM_RES_READ_ERR',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a1be95abb65e1f95ea57ede467a191ac9',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fres_5fwrite_5ferr_953',['AZX_EEPROM_RES_WRITE_ERR',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a55902786b78fd01c45d411c7a1244635',1,'azx_eeprom_24XX.h']]],
- ['azx_5fftp_5fdebug_5fhook_5fdebug_954',['AZX_FTP_DEBUG_HOOK_DEBUG',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19ac934a97e8fbfce66292815ca909f0318',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdebug_5fhook_5ferror_955',['AZX_FTP_DEBUG_HOOK_ERROR',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19adf82f3622ed1c2f86322033e98fa82d1',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdebug_5fhook_5finfo_956',['AZX_FTP_DEBUG_HOOK_INFO',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19aab54d566ab01ca7156bcc914f0aa0dad',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdebug_5fhook_5fnone_957',['AZX_FTP_DEBUG_HOOK_NONE',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19a080dc84c20af83589e186c1102724665',1,'azx_ftp.h']]],
- ['azx_5fftp_5fxfer_5fbuff_958',['AZX_FTP_XFER_BUFF',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gga93677062f9160355dea103b8049695f2a5902786cfaa7660a0a2f89d084ce22ff',1,'azx_ftp.h']]],
- ['azx_5fftp_5fxfer_5ffile_959',['AZX_FTP_XFER_FILE',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gga93677062f9160355dea103b8049695f2ac9f6fc2bf068a4a3f96e6eff260c3d27',1,'azx_ftp.h']]],
- ['azx_5fhttp_5fget_960',['AZX_HTTP_GET',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0ae405fbb86fb9b0c85f7413e63ba650e6',1,'azx_https.h']]],
- ['azx_5fhttp_5fhead_961',['AZX_HTTP_HEAD',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0aefe5566487896abaadb1fccd36cf7dc2',1,'azx_https.h']]],
- ['azx_5fhttp_5flog_5fdebug_962',['AZX_HTTP_LOG_DEBUG',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a97401ceafc13b3c7a046946fcabf1d42',1,'azx_https.h']]],
- ['azx_5fhttp_5flog_5ferror_963',['AZX_HTTP_LOG_ERROR',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a02f29bd2c3216bcf68db3795666a4bf6',1,'azx_https.h']]],
- ['azx_5fhttp_5flog_5finfo_964',['AZX_HTTP_LOG_INFO',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a1263ebd012612156ea9b291a2b64f793',1,'azx_https.h']]],
- ['azx_5fhttp_5flog_5fnone_965',['AZX_HTTP_LOG_NONE',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a013e96ebf5114c3d291baaa3ed4d0e18',1,'azx_https.h']]],
- ['azx_5fhttp_5fpost_966',['AZX_HTTP_POST',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0adad15d80cb1335235d262de42ecf6fa6',1,'azx_https.h']]],
- ['azx_5flfscontext_5fflash_967',['AZX_LFSCONTEXT_FLASH',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27a6441c86db4ad938ad458d2be00f7da91',1,'azx_lfs_utils.h']]],
- ['azx_5flfscontext_5fram_968',['AZX_LFSCONTEXT_RAM',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27a962c98462a8432e866a78d7cf31a2953',1,'azx_lfs_utils.h']]],
- ['azx_5flfsdir_5fmode_5fappend_969',['AZX_LFSDIR_MODE_APPEND',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6dad645ea77579b43e414e0deda9966145c',1,'azx_lfs_utils.h']]],
- ['azx_5flfsdir_5fmode_5fcreat_970',['AZX_LFSDIR_MODE_CREAT',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6da83827030ce39e2bf83a734f04363c797',1,'azx_lfs_utils.h']]],
- ['azx_5flfsdir_5fmode_5fexcl_971',['AZX_LFSDIR_MODE_EXCL',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6da345f237cf258e19d15f5f5c39289d1f3',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmount_5fmode_5fformat_5fand_5fmount_972',['AZX_LFSMOUNT_MODE_FORMAT_AND_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00a18dfb71dd4456399fdc4a2ed4f4e7c6d',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmount_5fmode_5flow_5fformat_5fand_5fmount_973',['AZX_LFSMOUNT_MODE_LOW_FORMAT_AND_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00af8cc06320b8106b7b100f1be84fe3670',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmount_5fmode_5fmount_974',['AZX_LFSMOUNT_MODE_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00afdf3047ffb55468e5dba7bdd3efa15a6',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmount_5fmode_5fmount_5for_5fformat_975',['AZX_LFSMOUNT_MODE_MOUNT_OR_FORMAT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00a2dde15cc3b219f74d52fe99eab880e51',1,'azx_lfs_utils.h']]],
- ['azx_5flfsrmdir_5fmode_5fempty_976',['AZX_LFSRMDIR_MODE_EMPTY',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83ea866c8ded94bbf4d889f9186ee016f4e2',1,'azx_lfs_utils.h']]],
- ['azx_5flfsrmdir_5fmode_5frm_977',['AZX_LFSRMDIR_MODE_RM',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83ea01be162e2cb94636c6ec3db6e22d4947',1,'azx_lfs_utils.h']]],
- ['azx_5flfswrite_5fmode_5fappend_978',['AZX_LFSWRITE_MODE_APPEND',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3aca13c83c38ea0eb851d3e53b0e80b6999d',1,'azx_lfs_utils.h']]],
- ['azx_5flfswrite_5fmode_5fcreat_979',['AZX_LFSWRITE_MODE_CREAT',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3aca9bcec5e653f50a5d8a91b46d79a87cf0',1,'azx_lfs_utils.h']]],
- ['azx_5flfswrite_5fmode_5fexcl_980',['AZX_LFSWRITE_MODE_EXCL',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3acac4790774f0052c338f5333a242929d34',1,'azx_lfs_utils.h']]],
- ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_981',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fcritical_982',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fdebug_983',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ferror_984',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5finfo_985',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fnone_986',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ftrace_987',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fwarn_988',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
- ['azx_5flog_5fno_5fusb_5finstance_5favailable_989',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
- ['azx_5flog_5fnot_5finit_990',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
- ['azx_5flog_5fto_5faux_5fuart_991',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fmain_5fuart_992',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb0_993',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb1_994',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
- ['azx_5flog_5funexpected_5fchannel_995',['AZX_LOG_UNEXPECTED_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7',1,'azx_log.h']]],
- ['azx_5flog_5fusb_5fcable_5funplugged_996',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
- ['azx_5fspi_5fflash_5flog_5flevel_5fdebug_997',['AZX_SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a25a723b5a93417bce7b79733debb36cc',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5fspi_5fflash_5flog_5flevel_5ferror_998',['AZX_SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a5a1af7a33326bf86acc4aeb0c4f629a0',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5fspi_5fflash_5flog_5flevel_5finfo_999',['AZX_SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638af8ddf1501237dfb358f6f258f03f5ab8',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5fspi_5fflash_5flog_5flevel_5fnone_1000',['AZX_SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638afafed77006d842f30bdf6fc64b136267',1,'azx_spi_flash_hw_external.h']]],
- ['azx_5ftasks_5falloc_5ferr_1001',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fattrib_5fset_5ferr_1002',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fcreate_5ferr_1003',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_1004',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finvalid_5fid_5ferr_1005',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fl_1006',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5flimit_1007',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fm_1008',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fs_1009',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_1010',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fsend_5ferr_1011',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_1012',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fnotinit_5ferr_1013',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fok_1014',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_1015',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5finit_5ferr_1016',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fl_1017',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fm_1018',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fs_1019',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_5ferr_1020',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fxl_1021',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fwrong_5fprio_5ferr_1022',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]]
+ ['azx_5fauthnotsupported_947',['azx_AuthNotSupported',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a25797e59ff6e516bfc9dd37571ec1342',1,'azx_https.h']]],
+ ['azx_5fauthschemabasic_948',['azx_AuthSchemaBasic',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a857a96483abfbe69be35631f72146a0e',1,'azx_https.h']]],
+ ['azx_5fauthschemanone_949',['azx_AuthSchemaNone',['../group__http_conf.html#gga91dcf453b00607b13fb25aa4fb9996d8a52caae2f3497597c5284e38ea9c89f65',1,'azx_https.h']]],
+ ['azx_5feeprom_5fres_5fcannot_5fallocate_950',['AZX_EEPROM_RES_CANNOT_ALLOCATE',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a1ca954ba5b2e26ece3bd777e2acc8162',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5fcannot_5finit_951',['AZX_EEPROM_RES_CANNOT_INIT',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afbe5da7ae1822ffb3e7968cb98545a15',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5finvalid_5fhandle_952',['AZX_EEPROM_RES_INVALID_HANDLE',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5afd12b69a2dd7e0315de970ae1358d19c',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5fmax_953',['AZX_EEPROM_RES_MAX',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5af0a3bbbc511c1e748e2718abdc094453',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5fok_954',['AZX_EEPROM_RES_OK',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a07df5299ef4b1ff8a2e170abd6fcd096',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5foverflow_955',['AZX_EEPROM_RES_OVERFLOW',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a16b446e14545fdf58ff6b63c2625f466',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5fread_5ferr_956',['AZX_EEPROM_RES_READ_ERR',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a1be95abb65e1f95ea57ede467a191ac9',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fres_5fwrite_5ferr_957',['AZX_EEPROM_RES_WRITE_ERR',['../group__azx__eeprom.html#ggae15185a63c805a8bcaa0969d7b5a57d5a55902786b78fd01c45d411c7a1244635',1,'azx_eeprom_24XX.h']]],
+ ['azx_5fftp_5fdebug_5fhook_5fdebug_958',['AZX_FTP_DEBUG_HOOK_DEBUG',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19ac934a97e8fbfce66292815ca909f0318',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdebug_5fhook_5ferror_959',['AZX_FTP_DEBUG_HOOK_ERROR',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19adf82f3622ed1c2f86322033e98fa82d1',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdebug_5fhook_5finfo_960',['AZX_FTP_DEBUG_HOOK_INFO',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19aab54d566ab01ca7156bcc914f0aa0dad',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdebug_5fhook_5fnone_961',['AZX_FTP_DEBUG_HOOK_NONE',['../group___a_z_x___f_t_p___c_o_n_f.html#gga5b2d4554c8d26b5ad29aa165b17adf19a080dc84c20af83589e186c1102724665',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fxfer_5fbuff_962',['AZX_FTP_XFER_BUFF',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gga93677062f9160355dea103b8049695f2a5902786cfaa7660a0a2f89d084ce22ff',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fxfer_5ffile_963',['AZX_FTP_XFER_FILE',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gga93677062f9160355dea103b8049695f2ac9f6fc2bf068a4a3f96e6eff260c3d27',1,'azx_ftp.h']]],
+ ['azx_5fhttp_5fget_964',['AZX_HTTP_GET',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0ae405fbb86fb9b0c85f7413e63ba650e6',1,'azx_https.h']]],
+ ['azx_5fhttp_5fhead_965',['AZX_HTTP_HEAD',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0aefe5566487896abaadb1fccd36cf7dc2',1,'azx_https.h']]],
+ ['azx_5fhttp_5flog_5fdebug_966',['AZX_HTTP_LOG_DEBUG',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a97401ceafc13b3c7a046946fcabf1d42',1,'azx_https.h']]],
+ ['azx_5fhttp_5flog_5ferror_967',['AZX_HTTP_LOG_ERROR',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a02f29bd2c3216bcf68db3795666a4bf6',1,'azx_https.h']]],
+ ['azx_5fhttp_5flog_5finfo_968',['AZX_HTTP_LOG_INFO',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a1263ebd012612156ea9b291a2b64f793',1,'azx_https.h']]],
+ ['azx_5fhttp_5flog_5fnone_969',['AZX_HTTP_LOG_NONE',['../group__http_conf.html#ggab1e72fc6db9cd975e6ec9e222b131f67a013e96ebf5114c3d291baaa3ed4d0e18',1,'azx_https.h']]],
+ ['azx_5fhttp_5fpost_970',['AZX_HTTP_POST',['../group__http_conf.html#gga30623080daf9875d7ef4a53282de1ac0adad15d80cb1335235d262de42ecf6fa6',1,'azx_https.h']]],
+ ['azx_5flfscontext_5fflash_971',['AZX_LFSCONTEXT_FLASH',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27a6441c86db4ad938ad458d2be00f7da91',1,'azx_lfs_utils.h']]],
+ ['azx_5flfscontext_5fram_972',['AZX_LFSCONTEXT_RAM',['../azx__lfs__utils_8h.html#a110109540a1594564983f0d0d5e1ea27a962c98462a8432e866a78d7cf31a2953',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsdir_5fmode_5fappend_973',['AZX_LFSDIR_MODE_APPEND',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6dad645ea77579b43e414e0deda9966145c',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsdir_5fmode_5fcreat_974',['AZX_LFSDIR_MODE_CREAT',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6da83827030ce39e2bf83a734f04363c797',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsdir_5fmode_5fexcl_975',['AZX_LFSDIR_MODE_EXCL',['../azx__lfs__utils_8h.html#a5b92e54ce582ccb70b6fe647e23e3f6da345f237cf258e19d15f5f5c39289d1f3',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmount_5fmode_5fformat_5fand_5fmount_976',['AZX_LFSMOUNT_MODE_FORMAT_AND_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00a18dfb71dd4456399fdc4a2ed4f4e7c6d',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmount_5fmode_5flow_5fformat_5fand_5fmount_977',['AZX_LFSMOUNT_MODE_LOW_FORMAT_AND_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00af8cc06320b8106b7b100f1be84fe3670',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmount_5fmode_5fmount_978',['AZX_LFSMOUNT_MODE_MOUNT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00afdf3047ffb55468e5dba7bdd3efa15a6',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmount_5fmode_5fmount_5for_5fformat_979',['AZX_LFSMOUNT_MODE_MOUNT_OR_FORMAT',['../azx__lfs__utils_8h.html#aa945595fc4377c538cf01a670fb8cc00a2dde15cc3b219f74d52fe99eab880e51',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsrmdir_5fmode_5fempty_980',['AZX_LFSRMDIR_MODE_EMPTY',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83ea866c8ded94bbf4d889f9186ee016f4e2',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsrmdir_5fmode_5frm_981',['AZX_LFSRMDIR_MODE_RM',['../azx__lfs__utils_8h.html#afe10d49448d2cb2a3ccb5cbddc28e83ea01be162e2cb94636c6ec3db6e22d4947',1,'azx_lfs_utils.h']]],
+ ['azx_5flfswrite_5fmode_5fappend_982',['AZX_LFSWRITE_MODE_APPEND',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3aca13c83c38ea0eb851d3e53b0e80b6999d',1,'azx_lfs_utils.h']]],
+ ['azx_5flfswrite_5fmode_5fcreat_983',['AZX_LFSWRITE_MODE_CREAT',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3aca9bcec5e653f50a5d8a91b46d79a87cf0',1,'azx_lfs_utils.h']]],
+ ['azx_5flfswrite_5fmode_5fexcl_984',['AZX_LFSWRITE_MODE_EXCL',['../azx__lfs__utils_8h.html#acea82eb3ff5afebe16ecd9d0124fa3acac4790774f0052c338f5333a242929d34',1,'azx_lfs_utils.h']]],
+ ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_985',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fcritical_986',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fdebug_987',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ferror_988',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5finfo_989',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fnone_990',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ftrace_991',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fwarn_992',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
+ ['azx_5flog_5fno_5fusb_5finstance_5favailable_993',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
+ ['azx_5flog_5fnot_5finit_994',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5faux_5fuart_995',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fmain_5fuart_996',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb0_997',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb1_998',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
+ ['azx_5flog_5funexpected_5fchannel_999',['AZX_LOG_UNEXPECTED_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7',1,'azx_log.h']]],
+ ['azx_5flog_5fusb_5fcable_5funplugged_1000',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
+ ['azx_5fspi_5fflash_5flog_5flevel_5fdebug_1001',['AZX_SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a25a723b5a93417bce7b79733debb36cc',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5fspi_5fflash_5flog_5flevel_5ferror_1002',['AZX_SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638a5a1af7a33326bf86acc4aeb0c4f629a0',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5fspi_5fflash_5flog_5flevel_5finfo_1003',['AZX_SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638af8ddf1501237dfb358f6f258f03f5ab8',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5fspi_5fflash_5flog_5flevel_5fnone_1004',['AZX_SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#a970c1d509d2d3328b7f92d094eb31638afafed77006d842f30bdf6fc64b136267',1,'azx_spi_flash_hw_external.h']]],
+ ['azx_5ftasks_5falloc_5ferr_1005',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fattrib_5fset_5ferr_1006',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fcreate_5ferr_1007',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_1008',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finvalid_5fid_5ferr_1009',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fl_1010',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5flimit_1011',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fm_1012',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fs_1013',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_1014',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fsend_5ferr_1015',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_1016',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fnotinit_5ferr_1017',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fok_1018',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_1019',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5finit_5ferr_1020',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fl_1021',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fm_1022',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fs_1023',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_5ferr_1024',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fxl_1025',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fwrong_5fprio_5ferr_1026',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_1.js
index 0febdb6f..90817fca 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_1.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['data_5fcb_5fdata_1023',['DATA_CB_DATA',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a576d5504422b3b4ca16d012d5140420e',1,'azx_ftp.h']]],
- ['data_5fcb_5fend_1024',['DATA_CB_END',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a8bd786bf28fbd4a4c5924da9673bc33c',1,'azx_ftp.h']]],
- ['data_5fcb_5fstart_1025',['DATA_CB_START',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a310f681a436283e67f5752dc6fb81e65',1,'azx_ftp.h']]]
+ ['data_5fcb_5fdata_1027',['DATA_CB_DATA',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a576d5504422b3b4ca16d012d5140420e',1,'azx_ftp.h']]],
+ ['data_5fcb_5fend_1028',['DATA_CB_END',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a8bd786bf28fbd4a4c5924da9673bc33c',1,'azx_ftp.h']]],
+ ['data_5fcb_5fstart_1029',['DATA_CB_START',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ggadbdffe015f1f2c5125641399bf181029a310f681a436283e67f5752dc6fb81e65',1,'azx_ftp.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_2.js
index 1863a1bd..852f9466 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['high_5fvalue_1026',['HIGH_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619',1,'azx_spi_flash_hw_external.h']]]
+ ['high_5fvalue_1030',['HIGH_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca231d7fdbca0a646b9206e4c8cb5f9619',1,'azx_spi_flash_hw_external.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_3.js
index 81961552..5c7c9e1f 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['low_5fvalue_1027',['LOW_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8',1,'azx_spi_flash_hw_external.h']]]
+ ['low_5fvalue_1031',['LOW_VALUE',['../azx__spi__flash__hw__external_8h.html#aed69b1b2bb3cdc4a03d3416545b2be0ca17aa21e3d314621b5040b6732f7a02e8',1,'azx_spi_flash_hw_external.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_4.js
index c1263d3c..4a0e6be8 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_4.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['m2m_5fos_5ftask_5fstack_5flimit_1028',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
+ ['m2m_5fos_5ftask_5fstack_5flimit_1032',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_5.js
index f333c045..5556e168 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_5.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/enumvalues_5.js
@@ -1,7 +1,7 @@
var searchData=
[
- ['spi_5fflash_5flog_5flevel_5fdebug_1029',['SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5ferror_1030',['SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5finfo_1031',['SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67',1,'azx_spi_flash_hw_external.h']]],
- ['spi_5fflash_5flog_5flevel_5fnone_1032',['SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1',1,'azx_spi_flash_hw_external.h']]]
+ ['spi_5fflash_5flog_5flevel_5fdebug_1033',['SPI_FLASH_LOG_LEVEL_DEBUG',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca6d5d2421d04142dcc435bb95e5f95a5a',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5ferror_1034',['SPI_FLASH_LOG_LEVEL_ERROR',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca8c155cf062b070fd6eda798bf5427ed5',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5finfo_1035',['SPI_FLASH_LOG_LEVEL_INFO',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95caa01f15376a15963e900258cd4f2efb67',1,'azx_spi_flash_hw_external.h']]],
+ ['spi_5fflash_5flog_5flevel_5fnone_1036',['SPI_FLASH_LOG_LEVEL_NONE',['../azx__spi__flash__hw__external_8h.html#acf571d297920367214835922a78fb95ca79cc6b877eb49f5c4d6beb9d8fa168f1',1,'azx_spi_flash_hw_external.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/files_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/files_0.js
index ddd5f6db..35348530 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/files_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/files_0.js
@@ -1,31 +1,31 @@
var searchData=
[
- ['app_5fcfg_2eh_631',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
- ['azx_5fbase64_2eh_632',['azx_base64.h',['../azx__base64_8h.html',1,'']]],
- ['azx_5fcjson_2eh_633',['azx_cjson.h',['../azx__cjson_8h.html',1,'']]],
- ['azx_5feasy_5fat_2eh_634',['azx_easy_at.h',['../azx__easy__at_8h.html',1,'']]],
- ['azx_5feeprom_5f24xx_2eh_635',['azx_eeprom_24XX.h',['../azx__eeprom__24_x_x_8h.html',1,'']]],
- ['azx_5fftp_2eh_636',['azx_ftp.h',['../azx__ftp_8h.html',1,'']]],
- ['azx_5fgnu_5ffcntl_2eh_637',['azx_gnu_fcntl.h',['../azx__gnu__fcntl_8h.html',1,'']]],
- ['azx_5fgnu_5fstdio_2eh_638',['azx_gnu_stdio.h',['../azx__gnu__stdio_8h.html',1,'']]],
- ['azx_5fgnu_5fstdlib_2eh_639',['azx_gnu_stdlib.h',['../azx__gnu__stdlib_8h.html',1,'']]],
- ['azx_5fgnu_5fstring_2eh_640',['azx_gnu_string.h',['../azx__gnu__string_8h.html',1,'']]],
- ['azx_5fgnu_5fsys_5fsocket_2eh_641',['azx_gnu_sys_socket.h',['../azx__gnu__sys__socket_8h.html',1,'']]],
- ['azx_5fgnu_5fsys_5ftime_2eh_642',['azx_gnu_sys_time.h',['../azx__gnu__sys__time_8h.html',1,'']]],
- ['azx_5fgnu_5fsys_5ftypes_2eh_643',['azx_gnu_sys_types.h',['../azx__gnu__sys__types_8h.html',1,'']]],
- ['azx_5fgnu_5funistd_2eh_644',['azx_gnu_unistd.h',['../azx__gnu__unistd_8h.html',1,'']]],
- ['azx_5fhttps_2eh_645',['azx_https.h',['../azx__https_8h.html',1,'']]],
- ['azx_5flfs_5futils_2eh_646',['azx_lfs_utils.h',['../azx__lfs__utils_8h.html',1,'']]],
- ['azx_5flog_2eh_647',['azx_log.h',['../azx__log_8h.html',1,'']]],
- ['azx_5fpdudec_2eh_648',['azx_pduDec.h',['../azx__pdu_dec_8h.html',1,'']]],
- ['azx_5fpduenc_2eh_649',['azx_pduEnc.h',['../azx__pdu_enc_8h.html',1,'']]],
- ['azx_5fspi_5fflash_5fhw_2eh_650',['azx_spi_flash_hw.h',['../azx__spi__flash__hw_8h.html',1,'']]],
- ['azx_5fspi_5fflash_5fhw_5fexternal_2eh_651',['azx_spi_flash_hw_external.h',['../azx__spi__flash__hw__external_8h.html',1,'']]],
- ['azx_5fspi_5fflash_5fjsc_2eh_652',['azx_spi_flash_jsc.h',['../azx__spi__flash__jsc_8h.html',1,'']]],
- ['azx_5fspi_5fflash_5fstrings_2eh_653',['azx_spi_flash_strings.h',['../azx__spi__flash__strings_8h.html',1,'']]],
- ['azx_5fspi_5fflash_5ftypes_2eh_654',['azx_spi_flash_types.h',['../azx__spi__flash__types_8h.html',1,'']]],
- ['azx_5fstring_5futils_2eh_655',['azx_string_utils.h',['../azx__string__utils_8h.html',1,'']]],
- ['azx_5ftasks_2eh_656',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
- ['azx_5futils_2eh_657',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
- ['azx_5fzlib_2eh_658',['azx_zlib.h',['../azx__zlib_8h.html',1,'']]]
+ ['app_5fcfg_2eh_635',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
+ ['azx_5fbase64_2eh_636',['azx_base64.h',['../azx__base64_8h.html',1,'']]],
+ ['azx_5fcjson_2eh_637',['azx_cjson.h',['../azx__cjson_8h.html',1,'']]],
+ ['azx_5feasy_5fat_2eh_638',['azx_easy_at.h',['../azx__easy__at_8h.html',1,'']]],
+ ['azx_5feeprom_5f24xx_2eh_639',['azx_eeprom_24XX.h',['../azx__eeprom__24_x_x_8h.html',1,'']]],
+ ['azx_5fftp_2eh_640',['azx_ftp.h',['../azx__ftp_8h.html',1,'']]],
+ ['azx_5fgnu_5ffcntl_2eh_641',['azx_gnu_fcntl.h',['../azx__gnu__fcntl_8h.html',1,'']]],
+ ['azx_5fgnu_5fstdio_2eh_642',['azx_gnu_stdio.h',['../azx__gnu__stdio_8h.html',1,'']]],
+ ['azx_5fgnu_5fstdlib_2eh_643',['azx_gnu_stdlib.h',['../azx__gnu__stdlib_8h.html',1,'']]],
+ ['azx_5fgnu_5fstring_2eh_644',['azx_gnu_string.h',['../azx__gnu__string_8h.html',1,'']]],
+ ['azx_5fgnu_5fsys_5fsocket_2eh_645',['azx_gnu_sys_socket.h',['../azx__gnu__sys__socket_8h.html',1,'']]],
+ ['azx_5fgnu_5fsys_5ftime_2eh_646',['azx_gnu_sys_time.h',['../azx__gnu__sys__time_8h.html',1,'']]],
+ ['azx_5fgnu_5fsys_5ftypes_2eh_647',['azx_gnu_sys_types.h',['../azx__gnu__sys__types_8h.html',1,'']]],
+ ['azx_5fgnu_5funistd_2eh_648',['azx_gnu_unistd.h',['../azx__gnu__unistd_8h.html',1,'']]],
+ ['azx_5fhttps_2eh_649',['azx_https.h',['../azx__https_8h.html',1,'']]],
+ ['azx_5flfs_5futils_2eh_650',['azx_lfs_utils.h',['../azx__lfs__utils_8h.html',1,'']]],
+ ['azx_5flog_2eh_651',['azx_log.h',['../azx__log_8h.html',1,'']]],
+ ['azx_5fpdudec_2eh_652',['azx_pduDec.h',['../azx__pdu_dec_8h.html',1,'']]],
+ ['azx_5fpduenc_2eh_653',['azx_pduEnc.h',['../azx__pdu_enc_8h.html',1,'']]],
+ ['azx_5fspi_5fflash_5fhw_2eh_654',['azx_spi_flash_hw.h',['../azx__spi__flash__hw_8h.html',1,'']]],
+ ['azx_5fspi_5fflash_5fhw_5fexternal_2eh_655',['azx_spi_flash_hw_external.h',['../azx__spi__flash__hw__external_8h.html',1,'']]],
+ ['azx_5fspi_5fflash_5fjsc_2eh_656',['azx_spi_flash_jsc.h',['../azx__spi__flash__jsc_8h.html',1,'']]],
+ ['azx_5fspi_5fflash_5fstrings_2eh_657',['azx_spi_flash_strings.h',['../azx__spi__flash__strings_8h.html',1,'']]],
+ ['azx_5fspi_5fflash_5ftypes_2eh_658',['azx_spi_flash_types.h',['../azx__spi__flash__types_8h.html',1,'']]],
+ ['azx_5fstring_5futils_2eh_659',['azx_string_utils.h',['../azx__string__utils_8h.html',1,'']]],
+ ['azx_5ftasks_2eh_660',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
+ ['azx_5futils_2eh_661',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
+ ['azx_5fzlib_2eh_662',['azx_zlib.h',['../azx__zlib_8h.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/functions_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/functions_0.js
index 3720c22e..dea4e309 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/functions_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/functions_0.js
@@ -1,167 +1,167 @@
var searchData=
[
- ['azx_5fasc_5fto_5fdec_659',['azx_asc_to_dec',['../group__string_usage.html#ga4d8f5e69f7077804f9eacefda37e6047',1,'azx_string_utils.h']]],
- ['azx_5fbase64decoder_660',['azx_base64Decoder',['../group__b64_usage.html#ga93eb3741d34b1ceac2535cc5e4800dd0',1,'azx_base64.h']]],
- ['azx_5fbase64encoder_661',['azx_base64Encoder',['../group__b64_usage.html#gad8b065533b2936e830f8dae10bdbd725',1,'azx_base64.h']]],
- ['azx_5fcjson_5fadditemreferencetoarray_662',['azx_cjson_addItemReferenceToArray',['../azx__cjson_8h.html#a18c02dc305c0e2961c06e57995c50d13',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fadditemreferencetoobject_663',['azx_cjson_addItemReferenceToObject',['../azx__cjson_8h.html#ae148412b0242e2e9d7e8761d0b3bdb2b',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fadditemtoarray_664',['azx_cjson_addItemToArray',['../azx__cjson_8h.html#a7bfc069c31ce4092aa1fe7f84f9a60de',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fadditemtoobject_665',['azx_cjson_addItemToObject',['../azx__cjson_8h.html#a59f3c9e57c3a171990610e56c9e7ef7e',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fadditemtoobjectcs_666',['azx_cjson_addItemToObjectCS',['../azx__cjson_8h.html#a5486d3a5f1b4743023091c6f0a0968c8',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatearray_667',['azx_cjson_createArray',['../azx__cjson_8h.html#affec05168d41a69b3a39e220237b025d',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatebool_668',['azx_cjson_createBool',['../azx__cjson_8h.html#aa939250881a85d73a4a4aefc4cbfc6e1',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatedoublearray_669',['azx_cjson_createDoubleArray',['../azx__cjson_8h.html#a4a8418c860017e70d935fcbd9da31d69',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatefalse_670',['azx_cjson_createFalse',['../azx__cjson_8h.html#a8006d014b64241b8007dc8103b24e194',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatefloatarray_671',['azx_cjson_createFloatArray',['../azx__cjson_8h.html#a787f692e40f37a50c528e90ea6590b21',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreateintarray_672',['azx_cjson_createIntArray',['../azx__cjson_8h.html#a460b41ea27fa1ddb5f5ea86f4f8839a0',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatenull_673',['azx_cjson_createNull',['../azx__cjson_8h.html#a0b4f7111114204178c2b74f7fa2d08f6',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatenumber_674',['azx_cjson_createNumber',['../azx__cjson_8h.html#a52db1824e9fe6aa7322bb193bd910817',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreateobject_675',['azx_cjson_createObject',['../azx__cjson_8h.html#ac263fb569695df60bb73073b8d168fe5',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatestring_676',['azx_cjson_createString',['../azx__cjson_8h.html#a296d6171f3e5ecefbe7e37cfa6167d59',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatestringarray_677',['azx_cjson_createStringArray',['../azx__cjson_8h.html#a310b1fd2a809fc4774a930399fe4e7e2',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fcreatetrue_678',['azx_cjson_createTrue',['../azx__cjson_8h.html#a52309cc4300cda8a813363d89ac3dc5c',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fdelete_679',['azx_cjson_delete',['../azx__cjson_8h.html#ab837eb1cd2f55b0471ebef08ea4fc9d0',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fdeleteitemfromarray_680',['azx_cjson_deleteItemFromArray',['../azx__cjson_8h.html#a61dd5967235447bdb28459f31a37d316',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fdeleteitemfromobject_681',['azx_cjson_deleteItemFromObject',['../azx__cjson_8h.html#a206f3c825c1bd1be068fff4beb4f037b',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fdetachitemfromarray_682',['azx_cjson_detachItemFromArray',['../azx__cjson_8h.html#a63d8f79be39b7026b5139c72d31560b0',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fdetachitemfromobject_683',['azx_cjson_detachItemFromObject',['../azx__cjson_8h.html#ad9319458602ef9ecc8088f28571dcdaf',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fduplicate_684',['azx_cjson_duplicate',['../azx__cjson_8h.html#a9ae6cfcc13afff8124ccf358bcf30547',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fgetarrayitem_685',['azx_cjson_getArrayItem',['../azx__cjson_8h.html#af9ecf906b8b8bffcb8c675b2275654f0',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fgetarraysize_686',['azx_cjson_getArraySize',['../azx__cjson_8h.html#a94ff58cda007eead7e1dde9432d8dd0f',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fgeterrorptr_687',['azx_cjson_getErrorPtr',['../azx__cjson_8h.html#a29fec223c2392efe2915423f1d98aa77',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fgetobjectitem_688',['azx_cjson_getObjectItem',['../azx__cjson_8h.html#a941ac39d1debc7fd39517dd47c75ad00',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fhasobjectitem_689',['azx_cjson_hasObjectItem',['../azx__cjson_8h.html#aa6b2216e477358d4602711377f12eb38',1,'azx_cjson.h']]],
- ['azx_5fcjson_5finsertiteminarray_690',['azx_cjson_insertItemInArray',['../azx__cjson_8h.html#a53a2979366f17ceb39e363d2ec0eb2bb',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fminify_691',['azx_cjson_minify',['../azx__cjson_8h.html#a4cb383ba2f0f8fcd1b4c0181fe649d49',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fparse_692',['azx_cjson_parse',['../azx__cjson_8h.html#aa4220bac1af07f3fb47700bf48a67dfd',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fparsewithopts_693',['azx_cjson_parseWithOpts',['../azx__cjson_8h.html#a1861b75134755b991ffe438a2a4ee31a',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fprint_694',['azx_cjson_print',['../azx__cjson_8h.html#a38652f1d212fbdc1f7b2f7ae8314873a',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fprintbuffered_695',['azx_cjson_printBuffered',['../azx__cjson_8h.html#a19cacec6e220feceb3ee87d3992820e6',1,'azx_cjson.h']]],
- ['azx_5fcjson_5fprintunformatted_696',['azx_cjson_printUnformatted',['../azx__cjson_8h.html#ace93d2a0c360ae7ff9d3780dc1648767',1,'azx_cjson.h']]],
- ['azx_5fcjson_5freplaceiteminarray_697',['azx_cjson_replaceItemInArray',['../azx__cjson_8h.html#a0d2188f3b1733a31791817a262d76d87',1,'azx_cjson.h']]],
- ['azx_5fcjson_5freplaceiteminobject_698',['azx_cjson_replaceItemInObject',['../azx__cjson_8h.html#a4b654304feb28d014a75cc6c516ff54c',1,'azx_cjson.h']]],
- ['azx_5feasy_5fat_5fasctodec_699',['azx_easy_at_ASCtoDEC',['../group__azx__easy__at.html#gaa20fed7933848b243f2a2a0bcbdef99b',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fcmdtypeasstring_700',['azx_easy_at_cmdTypeAsString',['../group__azx__easy__at.html#ga57cb7cf0548ffdd80c15e30d33302eec',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fcmee_701',['azx_easy_at_CMEE',['../group__azx__easy__at.html#gaf7bf8df993507aeac61d304d6ad80b62',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fgetate_702',['azx_easy_at_getAte',['../group__azx__easy__at.html#ga48f6ebd416cd9be39c9a356421a4591b',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fgetcmee_703',['azx_easy_at_getCmee',['../group__azx__easy__at.html#ga2837186123b024092f3df448abc7ea1d',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5finit_704',['azx_easy_at_init',['../group__azx__easy__at.html#ga2acece85b798eff12b4fd1b6a4c7ea04',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fsendunsolicited_705',['azx_easy_at_sendUnsolicited',['../group__azx__easy__at.html#ga07a90a6fa19625f00de2fd08b50c460f',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fstrtol_706',['azx_easy_at_strToL',['../group__azx__easy__at.html#ga5c954a7ed95aaa6147f8d3ce904e76b4',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fstrtoul_707',['azx_easy_at_strToUL',['../group__azx__easy__at.html#ga1f2ef572c4f0f59ea698339a62c8e039',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fstrtoulhex_708',['azx_easy_at_strToULHex',['../group__azx__easy__at.html#ga51d1176c88e43cfabc735bbbbf5bd170',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fstrtoull_709',['azx_easy_at_strToULL',['../group__azx__easy__at.html#ga16f3951dc1a7159cfde27d577fbd81a9',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fstrtous_710',['azx_easy_at_strToUS',['../group__azx__easy__at.html#gaf3db6baca901839f1501ffb056273057',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5ftrimandremovequotes_711',['azx_easy_at_TrimAndRemoveQuotes',['../group__azx__easy__at.html#ga5455b055750449c4feeccf635cb2a878',1,'azx_easy_at.h']]],
- ['azx_5feeprom_5fdeinit_712',['azx_eeprom_deinit',['../group__azx__eeprom.html#gaba53c6b828ccef4388ac9978ca7510fc',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5feraseall_713',['azx_eeprom_eraseAll',['../group__azx__eeprom.html#ga924b6a9d7468d744515fd266618acb6d',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5finit_714',['azx_eeprom_init',['../group__azx__eeprom.html#ga5eedf6970a776b71a9d46dc064d19dfe',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5freadbyte_715',['azx_eeprom_readByte',['../group__azx__eeprom.html#gac8db2ab9e36ce597bbafccb5483f4b67',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5freadbytefromcurrentaddress_716',['azx_eeprom_readByteFromCurrentAddress',['../group__azx__eeprom.html#gac5006d130c15ada37d84a98103202a7b',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5freadpages_717',['azx_eeprom_readPages',['../group__azx__eeprom.html#ga5ce8e7227dc5523d3d36745ebb09a8f6',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5freadsequentially_718',['azx_eeprom_readSequentially',['../group__azx__eeprom.html#ga7f20166c535bbbdf45e3fee1dfdc1588',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fwritebyte_719',['azx_eeprom_writeByte',['../group__azx__eeprom.html#ga89d6ab17b288d7c0e404c0d07f65b30e',1,'azx_eeprom_24XX.h']]],
- ['azx_5feeprom_5fwritepages_720',['azx_eeprom_writePages',['../group__azx__eeprom.html#ga02a69d94770ca3968c3847ba7754c77e',1,'azx_eeprom_24XX.h']]],
- ['azx_5fftp_5fcdup_721',['azx_ftp_cdUp',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga14bdbe2e63b0c3a7eaf7d2ede2befa11',1,'azx_ftp.h']]],
- ['azx_5fftp_5fchdir_722',['azx_ftp_chdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gaf9617c8c28b79495063d2259ee56e10f',1,'azx_ftp.h']]],
- ['azx_5fftp_5fclearcallback_723',['azx_ftp_clearCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga697c4239a8a778e3ca876c1e06f69549',1,'azx_ftp.h']]],
- ['azx_5fftp_5fconnect_724',['azx_ftp_connect',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gaf1d7d4071e395d57344d1961068ab56c',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdelete_725',['azx_ftp_delete',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga921c508f5078e8fee11de7f902af4e19',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdir_726',['azx_ftp_dir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5d7a2d96a890b26f7388414b67b0cb48',1,'azx_ftp.h']]],
- ['azx_5fftp_5fget_727',['azx_ftp_get',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga9bbf4cf039c3c252c2b340b5edc83f47',1,'azx_ftp.h']]],
- ['azx_5fftp_5finit_728',['azx_ftp_init',['../group___a_z_x___f_t_p___c_o_n_f.html#ga66188a5de36ea1d3cc9cf3708474f35b',1,'azx_ftp.h']]],
- ['azx_5fftp_5flastresponse_729',['azx_ftp_lastResponse',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gad1d276d72c19ca275f62b391863e917c',1,'azx_ftp.h']]],
- ['azx_5fftp_5flogin_730',['azx_ftp_login',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga2725d29c5b79492215523d7de3c39a6f',1,'azx_ftp.h']]],
- ['azx_5fftp_5fmkdir_731',['azx_ftp_mkdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga792c2053f5aeb6ea683ace3b90579aac',1,'azx_ftp.h']]],
- ['azx_5fftp_5fmoddate_732',['azx_ftp_modDate',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5257cafc61aa846446cdb6ed49f8ae6b',1,'azx_ftp.h']]],
- ['azx_5fftp_5fnlst_733',['azx_ftp_nlst',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga880d217d28fef0cb9953fcc51101e58a',1,'azx_ftp.h']]],
- ['azx_5fftp_5foptions_734',['azx_ftp_options',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga52d11bf0c0ea2066975162c1a51dd2f1',1,'azx_ftp.h']]],
- ['azx_5fftp_5fput_735',['azx_ftp_put',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gab31a7329f4257d631b2dd19a60f87ea3',1,'azx_ftp.h']]],
- ['azx_5fftp_5fpwd_736',['azx_ftp_pwd',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga3711029cd940a1cd4345b50b7d3f5247',1,'azx_ftp.h']]],
- ['azx_5fftp_5fquit_737',['azx_ftp_quit',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga4145baef7fe7bd2f4e2b457ee3f1b012',1,'azx_ftp.h']]],
- ['azx_5fftp_5frename_738',['azx_ftp_rename',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga3e3fd4e25dd3c998314bba50dd4d0fa4',1,'azx_ftp.h']]],
- ['azx_5fftp_5frmdir_739',['azx_ftp_rmdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gac18063638eedd97fbd53d35ef81e1811',1,'azx_ftp.h']]],
- ['azx_5fftp_5fsetcallback_740',['azx_ftp_setCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga83324a297a9eb71c4c3003b81b8f7f61',1,'azx_ftp.h']]],
- ['azx_5fftp_5fsite_741',['azx_ftp_site',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gab0392507e7a32bed1915c2bac2f343ec',1,'azx_ftp.h']]],
- ['azx_5fftp_5fsize_742',['azx_ftp_size',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga71aa36b0717a844334e0cc3beea3046f',1,'azx_ftp.h']]],
- ['azx_5fftp_5fsystype_743',['azx_ftp_sysType',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5bdeda3a38f9208ee690f9bc5e96e5d5',1,'azx_ftp.h']]],
- ['azx_5fgnu_5fcalloc_744',['azx_gnu_calloc',['../azx__gnu__stdlib_8h.html#a7997c34fb06cfa0e66c00469c2d4e5f6',1,'azx_gnu_stdlib.h']]],
- ['azx_5fgnu_5fchown_745',['azx_gnu_chown',['../azx__gnu__unistd_8h.html#a0df411b3596f1d5f25031fce69c5f696',1,'azx_gnu_unistd.h']]],
- ['azx_5fgnu_5ffprintf_746',['azx_gnu_fprintf',['../azx__gnu__stdio_8h.html#aacad0e51d9ef10e0f6ef01b27ef13597',1,'azx_gnu_stdio.h']]],
- ['azx_5fgnu_5ffree_747',['azx_gnu_free',['../azx__gnu__stdlib_8h.html#adf00383f106b20e878a20d62fbe11101',1,'azx_gnu_stdlib.h']]],
- ['azx_5fgnu_5fgetgcid_748',['azx_gnu_getgCID',['../azx__gnu__sys__socket_8h.html#abd732c8acd3db56ad887706f27ca5425',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fgethostbyname_749',['azx_gnu_gethostbyname',['../azx__gnu__sys__socket_8h.html#a99d8ac30b262f970760ab1b012d9eabe',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fgethostbyname_5fr_750',['azx_gnu_gethostbyname_r',['../azx__gnu__sys__socket_8h.html#a3466eaed96749995e030404f31f7c5f8',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fhstrerror_751',['azx_gnu_hstrerror',['../azx__gnu__sys__socket_8h.html#a703b07485e9fba31deda448ada8ec91b',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fmalloc_752',['azx_gnu_malloc',['../azx__gnu__stdlib_8h.html#a9a3cae7e50aff0b388a6a8ab8366bb91',1,'azx_gnu_stdlib.h']]],
- ['azx_5fgnu_5frealloc_753',['azx_gnu_realloc',['../azx__gnu__stdlib_8h.html#adde8371f617ee5ec1ac98f0e8f47d62a',1,'azx_gnu_stdlib.h']]],
- ['azx_5fgnu_5fselect_754',['azx_gnu_select',['../azx__gnu__sys__socket_8h.html#a8e77af6cdbb141c528c8a462a89297d6',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fsetgcid_755',['azx_gnu_setgCID',['../azx__gnu__sys__socket_8h.html#ab749c7b21efdc2adf4b2abc6c2291598',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fsocket_5fbsd_5fsocket_5fglobal_5fcid_756',['azx_gnu_socket_bsd_socket_global_cid',['../azx__gnu__sys__socket_8h.html#ace5573e8929fe9c2531732b4fc836f6b',1,'azx_gnu_sys_socket.h']]],
- ['azx_5fgnu_5fstrdup_757',['azx_gnu_strdup',['../azx__gnu__string_8h.html#ad13cfbfaf8e75075e184f12268cade20',1,'azx_gnu_string.h']]],
- ['azx_5fgnu_5fstrndup_758',['azx_gnu_strndup',['../azx__gnu__string_8h.html#a26dca330619f975f18b71e62b7e3ac8c',1,'azx_gnu_string.h']]],
- ['azx_5fgnu_5ftruncate_759',['azx_gnu_truncate',['../azx__gnu__stdio_8h.html#adb8fdfcb8c8ca87a63653dcbc794a18a',1,'azx_gnu_stdio.h']]],
- ['azx_5fhex_5fdump_760',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
- ['azx_5fhttp_5fget_761',['azx_http_get',['../group__http_usage.html#ga5af72b34cc3de7e623f3c9240f6ec0d0',1,'azx_https.h']]],
- ['azx_5fhttp_5fgetcid_762',['azx_http_getCID',['../group__http_usage.html#ga272faa61175fcf4e7a00529957106d35',1,'azx_https.h']]],
- ['azx_5fhttp_5fhead_763',['azx_http_head',['../group__http_usage.html#ga5717de1767a336a315469ea5c2c8e0a8',1,'azx_https.h']]],
- ['azx_5fhttp_5finitialize_764',['azx_http_initialize',['../group__http_conf.html#gae9912e7808e5d0674afa85487ec85387',1,'azx_https.h']]],
- ['azx_5fhttp_5fpost_765',['azx_http_post',['../group__http_usage.html#ga468c6015a239492a88c0c530fe73d973',1,'azx_https.h']]],
- ['azx_5fhttp_5fsetcb_766',['azx_http_setCB',['../group__http_conf.html#ga0e2abd820dff5b4f020b1b70d797b249',1,'azx_https.h']]],
- ['azx_5fhttp_5fsslinit_767',['azx_http_SSLInit',['../group__http_conf.html#gae40751f148308705cd22ee69282afbe8',1,'azx_https.h']]],
- ['azx_5flfsdircreationbycontext_768',['azx_lfsDirCreationByContext',['../azx__lfs__utils_8h.html#a8a8b6840cbe44f1ac7733fa6612d1132',1,'azx_lfs_utils.h']]],
- ['azx_5flfslistscontentbycontext_769',['azx_lfsListsContentByContext',['../azx__lfs__utils_8h.html#a40039264ee26cab494d8bf349791c1ea',1,'azx_lfs_utils.h']]],
- ['azx_5flfsmountbycontext_770',['azx_lfsMountByContext',['../azx__lfs__utils_8h.html#a566bca4bb52f4663885a039731e50618',1,'azx_lfs_utils.h']]],
- ['azx_5flfsreadbycontext_771',['azx_lfsReadByContext',['../azx__lfs__utils_8h.html#a5523520d7e3789b9f765e76902e39f03',1,'azx_lfs_utils.h']]],
- ['azx_5flfsrmfilebycontext_772',['azx_lfsRmFileByContext',['../azx__lfs__utils_8h.html#ac6c8f7222c79f4d0b7b55fb7c03685fd',1,'azx_lfs_utils.h']]],
- ['azx_5flfswritebycontext_773',['azx_lfsWriteByContext',['../azx__lfs__utils_8h.html#acfc3e279bbd82a1f3724d98e9227d5c7',1,'azx_lfs_utils.h']]],
- ['azx_5flog_5fdeinit_774',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
- ['azx_5flog_5fflush_5fto_5ffile_775',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
- ['azx_5flog_5fgetlevel_776',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
- ['azx_5flog_5finit_777',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
- ['azx_5flog_5fsend_5fto_5ffile_778',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
- ['azx_5flog_5fsetlevel_779',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
- ['azx_5fpdu_5fconvertzeropaddedhexintobyte_780',['azx_pdu_convertZeroPaddedHexIntoByte',['../group__pdu_enc_usage.html#ga43f49411b4f11d9b77abed8036346cca',1,'azx_pduEnc.h']]],
- ['azx_5fpdu_5fdecode_781',['azx_pdu_decode',['../group__pdu_dec_usage.html#ga71756909d9789b37acdf20e3997a9b27',1,'azx_pduDec.h']]],
- ['azx_5fpdu_5fdecodestring_782',['azx_pdu_decodeString',['../group__pdu_dec_usage.html#ga0c48f5ebe23043bb044abce2f8e571a5',1,'azx_pduDec.h']]],
- ['azx_5fpdu_5fencode_783',['azx_pdu_encode',['../group__pdu_enc_usage.html#gacb79107f730c3a648b4033429d3cc8d8',1,'azx_pduEnc.h']]],
- ['azx_5fpdu_5fs_5futf8_5fto_5fascii_784',['azx_pdu_s_utf8_to_ascii',['../group__pdu_dec_usage.html#ga883238aa220185561f08b9112ec96bfd',1,'azx_pduDec.h']]],
- ['azx_5fram_5finitialize_785',['azx_ram_initialize',['../azx__lfs__utils_8h.html#a4341542c574a3196c0129f2d5d6f7a4b',1,'azx_lfs_utils.h']]],
- ['azx_5fram_5freleaseresources_786',['azx_ram_releaseResources',['../azx__lfs__utils_8h.html#afaf404673739284db00841cc8a4ef123',1,'azx_lfs_utils.h']]],
- ['azx_5freboot_5fnow_787',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
- ['azx_5fshutdown_5fnow_788',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
- ['azx_5fsleep_5fms_789',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
- ['azx_5fspi_5fflash_5fblockisbad_790',['azx_spi_flash_blockIsBad',['../azx__spi__flash__jsc_8h.html#a96d389276fc7ab72fb67e41eb4d2539d',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fcallbak_791',['azx_spi_flash_callbak',['../azx__spi__flash__jsc_8h.html#af55c5ca20b66bf5cd4c6a069f9bef4f0',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fcheckparameter_792',['azx_spi_flash_checkParameter',['../azx__spi__flash__jsc_8h.html#abf0c4c0871dbec223a5d37ae3c957e52',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fconfigure_793',['azx_spi_flash_configure',['../azx__spi__flash__jsc_8h.html#af7cd45aae52097d59fe4ae942e37336c',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fdisableecc_794',['azx_spi_flash_disableEcc',['../azx__spi__flash__jsc_8h.html#a7ce55fd3b71387760d27abbcfc4b9b9b',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fenableecc_795',['azx_spi_flash_enableEcc',['../azx__spi__flash__jsc_8h.html#a0a658f007e96b84ac78c2e837b97a551',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5ferase_796',['azx_spi_flash_erase',['../azx__spi__flash__jsc_8h.html#a58ad5c71f224ba7b8e78f0c7f87db7cc',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5finitialize_797',['azx_spi_flash_initialize',['../azx__spi__flash__jsc_8h.html#ae0ce5dec84f2a12c41842f877eeeec7e',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5flockblock_798',['azx_spi_flash_lockBlock',['../azx__spi__flash__jsc_8h.html#afa9aa4e0c25876ccc0ea6e805c38b640',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5freadid_799',['azx_spi_flash_readID',['../azx__spi__flash__jsc_8h.html#ae2913f43be17555a6ce23965c4684515',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5freadoob_800',['azx_spi_flash_readOob',['../azx__spi__flash__jsc_8h.html#a353fa68e8b51bdede6ee211d8cd31803',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5freadparameterpage_801',['azx_spi_flash_readParameterPage',['../azx__spi__flash__jsc_8h.html#af0458ec80a9a24368fd4a61908a8ac5e',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5freaduidpage_802',['azx_spi_flash_readUIDpage',['../azx__spi__flash__jsc_8h.html#aa023633b3ae3f8e4438681bf6dd99450',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5freleaseresources_803',['azx_spi_flash_releaseResources',['../azx__spi__flash__jsc_8h.html#a8e3095bb2fbf30b6bbe8c53ed72f5f99',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fwaitforready_804',['azx_spi_flash_waitForReady',['../azx__spi__flash__jsc_8h.html#ab792a628007418f5dba661ecbdfdbde1',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fspi_5fflash_5fwriteoob_805',['azx_spi_flash_writeOob',['../azx__spi__flash__jsc_8h.html#a0de92912fb9daefb4b38b77d2a6489b3',1,'azx_spi_flash_jsc.h']]],
- ['azx_5fstr_5fl_5ftrim_806',['azx_str_l_trim',['../group__string_usage.html#ga565fe741a788c9a294da6e3bd8a3b20a',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fr_5ftrim_807',['azx_str_r_trim',['../azx__string__utils_8h.html#a1486bd91d85c805d7f7593c751e5cbcb',1,'azx_string_utils.h']]],
- ['azx_5fstr_5frem_5fch_808',['azx_str_rem_ch',['../group__string_usage.html#ga591daac0fe51a8dc56728499297ff7f4',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5fd_809',['azx_str_to_d',['../group__string_usage.html#gaf108513aba06635348dc6bcd64ffc5ce',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5ff_810',['azx_str_to_f',['../group__string_usage.html#ga563cd603c4ba7d98ccaa45bdf8d02fca',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5fl_811',['azx_str_to_l',['../group__string_usage.html#ga126567b2fbbb1fbe65ab22337a8cc34c',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5fuc_812',['azx_str_to_uc',['../group__string_usage.html#ga34d51366309ee1c55a88af2b1247f207',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5ful_813',['azx_str_to_ul',['../group__string_usage.html#ga4e49e0bbe1dad195b0655fef86d06762',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5ful_5fhex_814',['azx_str_to_ul_hex',['../group__string_usage.html#ga07193317da404839040b65b5d0b93477',1,'azx_string_utils.h']]],
- ['azx_5fstr_5fto_5full_815',['azx_str_to_ull',['../group__string_usage.html#ga67f4337ecaca70a7295a701dbebe1032',1,'azx_string_utils.h']]],
- ['azx_5ftasks_5fcreatetask_816',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fdestroytask_817',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskid_818',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskname_819',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetenqueuedcount_820',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finit_821',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fsendmessagetotask_822',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]]
+ ['azx_5fasc_5fto_5fdec_663',['azx_asc_to_dec',['../group__string_usage.html#ga4d8f5e69f7077804f9eacefda37e6047',1,'azx_string_utils.h']]],
+ ['azx_5fbase64decoder_664',['azx_base64Decoder',['../group__b64_usage.html#ga93eb3741d34b1ceac2535cc5e4800dd0',1,'azx_base64.h']]],
+ ['azx_5fbase64encoder_665',['azx_base64Encoder',['../group__b64_usage.html#gad8b065533b2936e830f8dae10bdbd725',1,'azx_base64.h']]],
+ ['azx_5fcjson_5fadditemreferencetoarray_666',['azx_cjson_addItemReferenceToArray',['../azx__cjson_8h.html#a18c02dc305c0e2961c06e57995c50d13',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fadditemreferencetoobject_667',['azx_cjson_addItemReferenceToObject',['../azx__cjson_8h.html#ae148412b0242e2e9d7e8761d0b3bdb2b',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fadditemtoarray_668',['azx_cjson_addItemToArray',['../azx__cjson_8h.html#a7bfc069c31ce4092aa1fe7f84f9a60de',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fadditemtoobject_669',['azx_cjson_addItemToObject',['../azx__cjson_8h.html#a59f3c9e57c3a171990610e56c9e7ef7e',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fadditemtoobjectcs_670',['azx_cjson_addItemToObjectCS',['../azx__cjson_8h.html#a5486d3a5f1b4743023091c6f0a0968c8',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatearray_671',['azx_cjson_createArray',['../azx__cjson_8h.html#affec05168d41a69b3a39e220237b025d',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatebool_672',['azx_cjson_createBool',['../azx__cjson_8h.html#aa939250881a85d73a4a4aefc4cbfc6e1',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatedoublearray_673',['azx_cjson_createDoubleArray',['../azx__cjson_8h.html#a4a8418c860017e70d935fcbd9da31d69',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatefalse_674',['azx_cjson_createFalse',['../azx__cjson_8h.html#a8006d014b64241b8007dc8103b24e194',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatefloatarray_675',['azx_cjson_createFloatArray',['../azx__cjson_8h.html#a787f692e40f37a50c528e90ea6590b21',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreateintarray_676',['azx_cjson_createIntArray',['../azx__cjson_8h.html#a460b41ea27fa1ddb5f5ea86f4f8839a0',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatenull_677',['azx_cjson_createNull',['../azx__cjson_8h.html#a0b4f7111114204178c2b74f7fa2d08f6',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatenumber_678',['azx_cjson_createNumber',['../azx__cjson_8h.html#a52db1824e9fe6aa7322bb193bd910817',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreateobject_679',['azx_cjson_createObject',['../azx__cjson_8h.html#ac263fb569695df60bb73073b8d168fe5',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatestring_680',['azx_cjson_createString',['../azx__cjson_8h.html#a296d6171f3e5ecefbe7e37cfa6167d59',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatestringarray_681',['azx_cjson_createStringArray',['../azx__cjson_8h.html#a310b1fd2a809fc4774a930399fe4e7e2',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fcreatetrue_682',['azx_cjson_createTrue',['../azx__cjson_8h.html#a52309cc4300cda8a813363d89ac3dc5c',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fdelete_683',['azx_cjson_delete',['../azx__cjson_8h.html#ab837eb1cd2f55b0471ebef08ea4fc9d0',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fdeleteitemfromarray_684',['azx_cjson_deleteItemFromArray',['../azx__cjson_8h.html#a61dd5967235447bdb28459f31a37d316',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fdeleteitemfromobject_685',['azx_cjson_deleteItemFromObject',['../azx__cjson_8h.html#a206f3c825c1bd1be068fff4beb4f037b',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fdetachitemfromarray_686',['azx_cjson_detachItemFromArray',['../azx__cjson_8h.html#a63d8f79be39b7026b5139c72d31560b0',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fdetachitemfromobject_687',['azx_cjson_detachItemFromObject',['../azx__cjson_8h.html#ad9319458602ef9ecc8088f28571dcdaf',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fduplicate_688',['azx_cjson_duplicate',['../azx__cjson_8h.html#a9ae6cfcc13afff8124ccf358bcf30547',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fgetarrayitem_689',['azx_cjson_getArrayItem',['../azx__cjson_8h.html#af9ecf906b8b8bffcb8c675b2275654f0',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fgetarraysize_690',['azx_cjson_getArraySize',['../azx__cjson_8h.html#a94ff58cda007eead7e1dde9432d8dd0f',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fgeterrorptr_691',['azx_cjson_getErrorPtr',['../azx__cjson_8h.html#a29fec223c2392efe2915423f1d98aa77',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fgetobjectitem_692',['azx_cjson_getObjectItem',['../azx__cjson_8h.html#a941ac39d1debc7fd39517dd47c75ad00',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fhasobjectitem_693',['azx_cjson_hasObjectItem',['../azx__cjson_8h.html#aa6b2216e477358d4602711377f12eb38',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5finsertiteminarray_694',['azx_cjson_insertItemInArray',['../azx__cjson_8h.html#a53a2979366f17ceb39e363d2ec0eb2bb',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fminify_695',['azx_cjson_minify',['../azx__cjson_8h.html#a4cb383ba2f0f8fcd1b4c0181fe649d49',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fparse_696',['azx_cjson_parse',['../azx__cjson_8h.html#aa4220bac1af07f3fb47700bf48a67dfd',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fparsewithopts_697',['azx_cjson_parseWithOpts',['../azx__cjson_8h.html#a1861b75134755b991ffe438a2a4ee31a',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fprint_698',['azx_cjson_print',['../azx__cjson_8h.html#a38652f1d212fbdc1f7b2f7ae8314873a',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fprintbuffered_699',['azx_cjson_printBuffered',['../azx__cjson_8h.html#a19cacec6e220feceb3ee87d3992820e6',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5fprintunformatted_700',['azx_cjson_printUnformatted',['../azx__cjson_8h.html#ace93d2a0c360ae7ff9d3780dc1648767',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5freplaceiteminarray_701',['azx_cjson_replaceItemInArray',['../azx__cjson_8h.html#a0d2188f3b1733a31791817a262d76d87',1,'azx_cjson.h']]],
+ ['azx_5fcjson_5freplaceiteminobject_702',['azx_cjson_replaceItemInObject',['../azx__cjson_8h.html#a4b654304feb28d014a75cc6c516ff54c',1,'azx_cjson.h']]],
+ ['azx_5feasy_5fat_5fasctodec_703',['azx_easy_at_ASCtoDEC',['../group__azx__easy__at.html#gaa20fed7933848b243f2a2a0bcbdef99b',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fcmdtypeasstring_704',['azx_easy_at_cmdTypeAsString',['../group__azx__easy__at.html#ga57cb7cf0548ffdd80c15e30d33302eec',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fcmee_705',['azx_easy_at_CMEE',['../group__azx__easy__at.html#gaf7bf8df993507aeac61d304d6ad80b62',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fgetate_706',['azx_easy_at_getAte',['../group__azx__easy__at.html#ga48f6ebd416cd9be39c9a356421a4591b',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fgetcmee_707',['azx_easy_at_getCmee',['../group__azx__easy__at.html#ga2837186123b024092f3df448abc7ea1d',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5finit_708',['azx_easy_at_init',['../group__azx__easy__at.html#ga2acece85b798eff12b4fd1b6a4c7ea04',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fsendunsolicited_709',['azx_easy_at_sendUnsolicited',['../group__azx__easy__at.html#ga07a90a6fa19625f00de2fd08b50c460f',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fstrtol_710',['azx_easy_at_strToL',['../group__azx__easy__at.html#ga5c954a7ed95aaa6147f8d3ce904e76b4',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fstrtoul_711',['azx_easy_at_strToUL',['../group__azx__easy__at.html#ga1f2ef572c4f0f59ea698339a62c8e039',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fstrtoulhex_712',['azx_easy_at_strToULHex',['../group__azx__easy__at.html#ga51d1176c88e43cfabc735bbbbf5bd170',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fstrtoull_713',['azx_easy_at_strToULL',['../group__azx__easy__at.html#ga16f3951dc1a7159cfde27d577fbd81a9',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fstrtous_714',['azx_easy_at_strToUS',['../group__azx__easy__at.html#gaf3db6baca901839f1501ffb056273057',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5ftrimandremovequotes_715',['azx_easy_at_TrimAndRemoveQuotes',['../group__azx__easy__at.html#ga5455b055750449c4feeccf635cb2a878',1,'azx_easy_at.h']]],
+ ['azx_5feeprom_5fdeinit_716',['azx_eeprom_deinit',['../group__azx__eeprom.html#gaba53c6b828ccef4388ac9978ca7510fc',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5feraseall_717',['azx_eeprom_eraseAll',['../group__azx__eeprom.html#ga924b6a9d7468d744515fd266618acb6d',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5finit_718',['azx_eeprom_init',['../group__azx__eeprom.html#ga5eedf6970a776b71a9d46dc064d19dfe',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5freadbyte_719',['azx_eeprom_readByte',['../group__azx__eeprom.html#gac8db2ab9e36ce597bbafccb5483f4b67',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5freadbytefromcurrentaddress_720',['azx_eeprom_readByteFromCurrentAddress',['../group__azx__eeprom.html#gac5006d130c15ada37d84a98103202a7b',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5freadpages_721',['azx_eeprom_readPages',['../group__azx__eeprom.html#ga5ce8e7227dc5523d3d36745ebb09a8f6',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5freadsequentially_722',['azx_eeprom_readSequentially',['../group__azx__eeprom.html#ga7f20166c535bbbdf45e3fee1dfdc1588',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fwritebyte_723',['azx_eeprom_writeByte',['../group__azx__eeprom.html#ga89d6ab17b288d7c0e404c0d07f65b30e',1,'azx_eeprom_24XX.h']]],
+ ['azx_5feeprom_5fwritepages_724',['azx_eeprom_writePages',['../group__azx__eeprom.html#ga02a69d94770ca3968c3847ba7754c77e',1,'azx_eeprom_24XX.h']]],
+ ['azx_5fftp_5fcdup_725',['azx_ftp_cdUp',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga14bdbe2e63b0c3a7eaf7d2ede2befa11',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fchdir_726',['azx_ftp_chdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gaf9617c8c28b79495063d2259ee56e10f',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fclearcallback_727',['azx_ftp_clearCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga697c4239a8a778e3ca876c1e06f69549',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fconnect_728',['azx_ftp_connect',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gaf1d7d4071e395d57344d1961068ab56c',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdelete_729',['azx_ftp_delete',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga921c508f5078e8fee11de7f902af4e19',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdir_730',['azx_ftp_dir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5d7a2d96a890b26f7388414b67b0cb48',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fget_731',['azx_ftp_get',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga9bbf4cf039c3c252c2b340b5edc83f47',1,'azx_ftp.h']]],
+ ['azx_5fftp_5finit_732',['azx_ftp_init',['../group___a_z_x___f_t_p___c_o_n_f.html#ga66188a5de36ea1d3cc9cf3708474f35b',1,'azx_ftp.h']]],
+ ['azx_5fftp_5flastresponse_733',['azx_ftp_lastResponse',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gad1d276d72c19ca275f62b391863e917c',1,'azx_ftp.h']]],
+ ['azx_5fftp_5flogin_734',['azx_ftp_login',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga2725d29c5b79492215523d7de3c39a6f',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fmkdir_735',['azx_ftp_mkdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga792c2053f5aeb6ea683ace3b90579aac',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fmoddate_736',['azx_ftp_modDate',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5257cafc61aa846446cdb6ed49f8ae6b',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fnlst_737',['azx_ftp_nlst',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga880d217d28fef0cb9953fcc51101e58a',1,'azx_ftp.h']]],
+ ['azx_5fftp_5foptions_738',['azx_ftp_options',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga52d11bf0c0ea2066975162c1a51dd2f1',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fput_739',['azx_ftp_put',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gab31a7329f4257d631b2dd19a60f87ea3',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fpwd_740',['azx_ftp_pwd',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga3711029cd940a1cd4345b50b7d3f5247',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fquit_741',['azx_ftp_quit',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga4145baef7fe7bd2f4e2b457ee3f1b012',1,'azx_ftp.h']]],
+ ['azx_5fftp_5frename_742',['azx_ftp_rename',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga3e3fd4e25dd3c998314bba50dd4d0fa4',1,'azx_ftp.h']]],
+ ['azx_5fftp_5frmdir_743',['azx_ftp_rmdir',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gac18063638eedd97fbd53d35ef81e1811',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fsetcallback_744',['azx_ftp_setCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga83324a297a9eb71c4c3003b81b8f7f61',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fsite_745',['azx_ftp_site',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gab0392507e7a32bed1915c2bac2f343ec',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fsize_746',['azx_ftp_size',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga71aa36b0717a844334e0cc3beea3046f',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fsystype_747',['azx_ftp_sysType',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga5bdeda3a38f9208ee690f9bc5e96e5d5',1,'azx_ftp.h']]],
+ ['azx_5fgnu_5fcalloc_748',['azx_gnu_calloc',['../azx__gnu__stdlib_8h.html#a7997c34fb06cfa0e66c00469c2d4e5f6',1,'azx_gnu_stdlib.h']]],
+ ['azx_5fgnu_5fchown_749',['azx_gnu_chown',['../azx__gnu__unistd_8h.html#a0df411b3596f1d5f25031fce69c5f696',1,'azx_gnu_unistd.h']]],
+ ['azx_5fgnu_5ffprintf_750',['azx_gnu_fprintf',['../azx__gnu__stdio_8h.html#aacad0e51d9ef10e0f6ef01b27ef13597',1,'azx_gnu_stdio.h']]],
+ ['azx_5fgnu_5ffree_751',['azx_gnu_free',['../azx__gnu__stdlib_8h.html#adf00383f106b20e878a20d62fbe11101',1,'azx_gnu_stdlib.h']]],
+ ['azx_5fgnu_5fgetgcid_752',['azx_gnu_getgCID',['../azx__gnu__sys__socket_8h.html#abd732c8acd3db56ad887706f27ca5425',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fgethostbyname_753',['azx_gnu_gethostbyname',['../azx__gnu__sys__socket_8h.html#a99d8ac30b262f970760ab1b012d9eabe',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fgethostbyname_5fr_754',['azx_gnu_gethostbyname_r',['../azx__gnu__sys__socket_8h.html#a3466eaed96749995e030404f31f7c5f8',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fhstrerror_755',['azx_gnu_hstrerror',['../azx__gnu__sys__socket_8h.html#a703b07485e9fba31deda448ada8ec91b',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fmalloc_756',['azx_gnu_malloc',['../azx__gnu__stdlib_8h.html#a9a3cae7e50aff0b388a6a8ab8366bb91',1,'azx_gnu_stdlib.h']]],
+ ['azx_5fgnu_5frealloc_757',['azx_gnu_realloc',['../azx__gnu__stdlib_8h.html#adde8371f617ee5ec1ac98f0e8f47d62a',1,'azx_gnu_stdlib.h']]],
+ ['azx_5fgnu_5fselect_758',['azx_gnu_select',['../azx__gnu__sys__socket_8h.html#a8e77af6cdbb141c528c8a462a89297d6',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fsetgcid_759',['azx_gnu_setgCID',['../azx__gnu__sys__socket_8h.html#ab749c7b21efdc2adf4b2abc6c2291598',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fsocket_5fbsd_5fsocket_5fglobal_5fcid_760',['azx_gnu_socket_bsd_socket_global_cid',['../azx__gnu__sys__socket_8h.html#ace5573e8929fe9c2531732b4fc836f6b',1,'azx_gnu_sys_socket.h']]],
+ ['azx_5fgnu_5fstrdup_761',['azx_gnu_strdup',['../azx__gnu__string_8h.html#ad13cfbfaf8e75075e184f12268cade20',1,'azx_gnu_string.h']]],
+ ['azx_5fgnu_5fstrndup_762',['azx_gnu_strndup',['../azx__gnu__string_8h.html#a26dca330619f975f18b71e62b7e3ac8c',1,'azx_gnu_string.h']]],
+ ['azx_5fgnu_5ftruncate_763',['azx_gnu_truncate',['../azx__gnu__stdio_8h.html#adb8fdfcb8c8ca87a63653dcbc794a18a',1,'azx_gnu_stdio.h']]],
+ ['azx_5fhex_5fdump_764',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
+ ['azx_5fhttp_5fget_765',['azx_http_get',['../group__http_usage.html#ga5af72b34cc3de7e623f3c9240f6ec0d0',1,'azx_https.h']]],
+ ['azx_5fhttp_5fgetcid_766',['azx_http_getCID',['../group__http_usage.html#ga272faa61175fcf4e7a00529957106d35',1,'azx_https.h']]],
+ ['azx_5fhttp_5fhead_767',['azx_http_head',['../group__http_usage.html#ga5717de1767a336a315469ea5c2c8e0a8',1,'azx_https.h']]],
+ ['azx_5fhttp_5finitialize_768',['azx_http_initialize',['../group__http_conf.html#gae9912e7808e5d0674afa85487ec85387',1,'azx_https.h']]],
+ ['azx_5fhttp_5fpost_769',['azx_http_post',['../group__http_usage.html#ga468c6015a239492a88c0c530fe73d973',1,'azx_https.h']]],
+ ['azx_5fhttp_5fsetcb_770',['azx_http_setCB',['../group__http_conf.html#ga0e2abd820dff5b4f020b1b70d797b249',1,'azx_https.h']]],
+ ['azx_5fhttp_5fsslinit_771',['azx_http_SSLInit',['../group__http_conf.html#gae40751f148308705cd22ee69282afbe8',1,'azx_https.h']]],
+ ['azx_5flfsdircreationbycontext_772',['azx_lfsDirCreationByContext',['../azx__lfs__utils_8h.html#a8a8b6840cbe44f1ac7733fa6612d1132',1,'azx_lfs_utils.h']]],
+ ['azx_5flfslistscontentbycontext_773',['azx_lfsListsContentByContext',['../azx__lfs__utils_8h.html#a40039264ee26cab494d8bf349791c1ea',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsmountbycontext_774',['azx_lfsMountByContext',['../azx__lfs__utils_8h.html#a566bca4bb52f4663885a039731e50618',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsreadbycontext_775',['azx_lfsReadByContext',['../azx__lfs__utils_8h.html#a5523520d7e3789b9f765e76902e39f03',1,'azx_lfs_utils.h']]],
+ ['azx_5flfsrmfilebycontext_776',['azx_lfsRmFileByContext',['../azx__lfs__utils_8h.html#ac6c8f7222c79f4d0b7b55fb7c03685fd',1,'azx_lfs_utils.h']]],
+ ['azx_5flfswritebycontext_777',['azx_lfsWriteByContext',['../azx__lfs__utils_8h.html#acfc3e279bbd82a1f3724d98e9227d5c7',1,'azx_lfs_utils.h']]],
+ ['azx_5flog_5fdeinit_778',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
+ ['azx_5flog_5fflush_5fto_5ffile_779',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
+ ['azx_5flog_5fgetlevel_780',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
+ ['azx_5flog_5finit_781',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
+ ['azx_5flog_5fsend_5fto_5ffile_782',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
+ ['azx_5flog_5fsetlevel_783',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
+ ['azx_5fpdu_5fconvertzeropaddedhexintobyte_784',['azx_pdu_convertZeroPaddedHexIntoByte',['../group__pdu_enc_usage.html#ga43f49411b4f11d9b77abed8036346cca',1,'azx_pduEnc.h']]],
+ ['azx_5fpdu_5fdecode_785',['azx_pdu_decode',['../group__pdu_dec_usage.html#ga71756909d9789b37acdf20e3997a9b27',1,'azx_pduDec.h']]],
+ ['azx_5fpdu_5fdecodestring_786',['azx_pdu_decodeString',['../group__pdu_dec_usage.html#ga0c48f5ebe23043bb044abce2f8e571a5',1,'azx_pduDec.h']]],
+ ['azx_5fpdu_5fencode_787',['azx_pdu_encode',['../group__pdu_enc_usage.html#gacb79107f730c3a648b4033429d3cc8d8',1,'azx_pduEnc.h']]],
+ ['azx_5fpdu_5fs_5futf8_5fto_5fascii_788',['azx_pdu_s_utf8_to_ascii',['../group__pdu_dec_usage.html#ga883238aa220185561f08b9112ec96bfd',1,'azx_pduDec.h']]],
+ ['azx_5fram_5finitialize_789',['azx_ram_initialize',['../azx__lfs__utils_8h.html#a4341542c574a3196c0129f2d5d6f7a4b',1,'azx_lfs_utils.h']]],
+ ['azx_5fram_5freleaseresources_790',['azx_ram_releaseResources',['../azx__lfs__utils_8h.html#afaf404673739284db00841cc8a4ef123',1,'azx_lfs_utils.h']]],
+ ['azx_5freboot_5fnow_791',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
+ ['azx_5fshutdown_5fnow_792',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
+ ['azx_5fsleep_5fms_793',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
+ ['azx_5fspi_5fflash_5fblockisbad_794',['azx_spi_flash_blockIsBad',['../azx__spi__flash__jsc_8h.html#a96d389276fc7ab72fb67e41eb4d2539d',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fcallbak_795',['azx_spi_flash_callbak',['../azx__spi__flash__jsc_8h.html#af55c5ca20b66bf5cd4c6a069f9bef4f0',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fcheckparameter_796',['azx_spi_flash_checkParameter',['../azx__spi__flash__jsc_8h.html#abf0c4c0871dbec223a5d37ae3c957e52',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fconfigure_797',['azx_spi_flash_configure',['../azx__spi__flash__jsc_8h.html#af7cd45aae52097d59fe4ae942e37336c',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fdisableecc_798',['azx_spi_flash_disableEcc',['../azx__spi__flash__jsc_8h.html#a7ce55fd3b71387760d27abbcfc4b9b9b',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fenableecc_799',['azx_spi_flash_enableEcc',['../azx__spi__flash__jsc_8h.html#a0a658f007e96b84ac78c2e837b97a551',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5ferase_800',['azx_spi_flash_erase',['../azx__spi__flash__jsc_8h.html#a58ad5c71f224ba7b8e78f0c7f87db7cc',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5finitialize_801',['azx_spi_flash_initialize',['../azx__spi__flash__jsc_8h.html#ae0ce5dec84f2a12c41842f877eeeec7e',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5flockblock_802',['azx_spi_flash_lockBlock',['../azx__spi__flash__jsc_8h.html#afa9aa4e0c25876ccc0ea6e805c38b640',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5freadid_803',['azx_spi_flash_readID',['../azx__spi__flash__jsc_8h.html#ae2913f43be17555a6ce23965c4684515',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5freadoob_804',['azx_spi_flash_readOob',['../azx__spi__flash__jsc_8h.html#a353fa68e8b51bdede6ee211d8cd31803',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5freadparameterpage_805',['azx_spi_flash_readParameterPage',['../azx__spi__flash__jsc_8h.html#af0458ec80a9a24368fd4a61908a8ac5e',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5freaduidpage_806',['azx_spi_flash_readUIDpage',['../azx__spi__flash__jsc_8h.html#aa023633b3ae3f8e4438681bf6dd99450',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5freleaseresources_807',['azx_spi_flash_releaseResources',['../azx__spi__flash__jsc_8h.html#a8e3095bb2fbf30b6bbe8c53ed72f5f99',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fwaitforready_808',['azx_spi_flash_waitForReady',['../azx__spi__flash__jsc_8h.html#ab792a628007418f5dba661ecbdfdbde1',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fspi_5fflash_5fwriteoob_809',['azx_spi_flash_writeOob',['../azx__spi__flash__jsc_8h.html#a0de92912fb9daefb4b38b77d2a6489b3',1,'azx_spi_flash_jsc.h']]],
+ ['azx_5fstr_5fl_5ftrim_810',['azx_str_l_trim',['../group__string_usage.html#ga565fe741a788c9a294da6e3bd8a3b20a',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fr_5ftrim_811',['azx_str_r_trim',['../azx__string__utils_8h.html#a1486bd91d85c805d7f7593c751e5cbcb',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5frem_5fch_812',['azx_str_rem_ch',['../group__string_usage.html#ga591daac0fe51a8dc56728499297ff7f4',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5fd_813',['azx_str_to_d',['../group__string_usage.html#gaf108513aba06635348dc6bcd64ffc5ce',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5ff_814',['azx_str_to_f',['../group__string_usage.html#ga563cd603c4ba7d98ccaa45bdf8d02fca',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5fl_815',['azx_str_to_l',['../group__string_usage.html#ga126567b2fbbb1fbe65ab22337a8cc34c',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5fuc_816',['azx_str_to_uc',['../group__string_usage.html#ga34d51366309ee1c55a88af2b1247f207',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5ful_817',['azx_str_to_ul',['../group__string_usage.html#ga4e49e0bbe1dad195b0655fef86d06762',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5ful_5fhex_818',['azx_str_to_ul_hex',['../group__string_usage.html#ga07193317da404839040b65b5d0b93477',1,'azx_string_utils.h']]],
+ ['azx_5fstr_5fto_5full_819',['azx_str_to_ull',['../group__string_usage.html#ga67f4337ecaca70a7295a701dbebe1032',1,'azx_string_utils.h']]],
+ ['azx_5ftasks_5fcreatetask_820',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fdestroytask_821',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskid_822',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskname_823',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetenqueuedcount_824',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finit_825',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fsendmessagetotask_826',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_0.js
index 0d6cf663..0811875b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['array_20utilities_20usage_1058',['Array utilities usage',['../group__array_usage.html',1,'']]]
+ ['array_20utilities_20usage_1062',['Array utilities usage',['../group__array_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_1.js
index 1c47feca..0b6fa2e4 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['base64_20functions_20usage_1059',['Base64 functions usage',['../group__b64_usage.html',1,'']]]
+ ['base64_20functions_20usage_1063',['Base64 functions usage',['../group__b64_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_2.js
index 93b5bb61..4dd68ec2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['configuration_20of_20logging_20functionalities_1060',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
+ ['configuration_20of_20logging_20functionalities_1064',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_3.js
index 88012153..874c0b60 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['documentation_20for_20azx_5feasy_5fat_20functionalities_1061',['Documentation for azx_easy_at functionalities',['../group__azx__easy__at.html',1,'']]]
+ ['documentation_20for_20azx_5feasy_5fat_20functionalities_1065',['Documentation for azx_easy_at functionalities',['../group__azx__easy__at.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_4.js
index 070dc8d5..b24d08f9 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_4.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['eeprom_20utilities_20allowing_20communication_20with_20eeprom_20chips_20of_2024xx256_20family_2e_1062',['EEPROM utilities allowing communication with EEPROM chips of 24xx256 family.',['../group__azx__eeprom.html',1,'']]]
+ ['eeprom_20utilities_20allowing_20communication_20with_20eeprom_20chips_20of_2024xx256_20family_2e_1066',['EEPROM utilities allowing communication with EEPROM chips of 24xx256 family.',['../group__azx__eeprom.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_5.js
index cc50aa9a..5418ed0a 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_5.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_5.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['ftp_20client_20configuration_1063',['FTP Client configuration',['../group___a_z_x___f_t_p___c_o_n_f.html',1,'']]],
- ['ftp_20client_20usage_1064',['FTP Client usage',['../group___a_z_x___f_t_p___u_s_a_g_e.html',1,'']]]
+ ['ftp_20client_20configuration_1067',['FTP Client configuration',['../group___a_z_x___f_t_p___c_o_n_f.html',1,'']]],
+ ['ftp_20client_20usage_1068',['FTP Client usage',['../group___a_z_x___f_t_p___u_s_a_g_e.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_6.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_6.js
index d7188e0a..7d0cc05d 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_6.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_6.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['http_20client_20configuration_1065',['HTTP client configuration',['../group__http_conf.html',1,'']]],
- ['http_20client_20usage_1066',['HTTP client usage',['../group__http_usage.html',1,'']]]
+ ['http_20client_20configuration_1069',['HTTP client configuration',['../group__http_conf.html',1,'']]],
+ ['http_20client_20usage_1070',['HTTP client usage',['../group__http_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_7.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_7.js
index d65fe4da..cee9222b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_7.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_7.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['string_20utilities_20usage_1067',['String utilities usage',['../group__string_usage.html',1,'']]]
+ ['string_20utilities_20usage_1071',['String utilities usage',['../group__string_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_8.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_8.js
index e016fe6a..1540e5af 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_8.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_8.js
@@ -1,7 +1,7 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_1068',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
- ['usage_20of_20pdu_20decoding_20functionalities_1069',['Usage of pdu decoding functionalities',['../group__pdu_dec_usage.html',1,'']]],
- ['usage_20of_20pdu_20encoding_20functionalities_1070',['Usage of pdu encoding functionalities',['../group__pdu_enc_usage.html',1,'']]],
- ['usage_20of_20tasks_20example_20functionalities_1071',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]]
+ ['usage_20of_20logging_20functionalities_1072',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
+ ['usage_20of_20pdu_20decoding_20functionalities_1073',['Usage of pdu decoding functionalities',['../group__pdu_dec_usage.html',1,'']]],
+ ['usage_20of_20pdu_20encoding_20functionalities_1074',['Usage of pdu encoding functionalities',['../group__pdu_enc_usage.html',1,'']]],
+ ['usage_20of_20tasks_20example_20functionalities_1075',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_9.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_9.js
index 7ef75aba..454ceff8 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_9.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/groups_9.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['zlibusage_1072',['ZlibUsage',['../group__zlib_usage.html',1,'']]]
+ ['zlibusage_1076',['ZlibUsage',['../group__zlib_usage.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/pages_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/pages_0.js
index eabc9b3b..d7ea37bf 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/pages_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/pages_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['azx_20sample_20modules_20documentation_1073',['AZX sample modules documentation',['../index.html',1,'']]]
+ ['azx_20sample_20modules_20documentation_1077',['AZX sample modules documentation',['../index.html',1,'']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/searchdata.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/searchdata.js
index cbcf5e47..9031452b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/searchdata.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/searchdata.js
@@ -1,7 +1,7 @@
var indexSectionsWithContent =
{
0: "_abcdefhilmnprstuvz",
- 1: "aefst",
+ 1: "adefpst",
2: "a",
3: "a",
4: "abcdfhilmnprstuv",
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_0.js
index b199d1af..78d818d0 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_0.js
@@ -1,21 +1,21 @@
var searchData=
[
- ['azx_5fcjson_5ft_900',['AZX_CJSON_T',['../azx__cjson_8h.html#aff729ee2acd66d5c36f24d65d951478b',1,'azx_cjson.h']]],
- ['azx_5feasy_5fat_5fatcommand_5ft_901',['AZX_EASY_AT_ATCOMMAND_T',['../azx__easy__at_8h.html#aebdd0ba24ce48f20c02e57a5d4a01184',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fhandles_5ft_902',['AZX_EASY_AT_HANDLES_T',['../azx__easy__at_8h.html#abd84e2d7c47e054f016c85110d4c88ce',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5fmodule_5ft_903',['AZX_EASY_AT_MODULE_T',['../azx__easy__at_8h.html#a2f17b3c171a38f17de29a90123d946b5',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5ftaskcallback_904',['azx_easy_at_taskCallback',['../group__azx__easy__at.html#ga8ed786c0af1cc17027447d90012878cc',1,'azx_easy_at.h']]],
- ['azx_5feasy_5fat_5ftaskdelegation_905',['azx_easy_at_taskDelegation',['../group__azx__easy__at.html#ga016dc78945b2312ee4cad3bd9de2f623',1,'azx_easy_at.h']]],
- ['azx_5fftp_5fcallback_906',['azx_ftp_callback',['../group___a_z_x___f_t_p___c_o_n_f.html#gafe78f44e49db1f4dd17c32d3dc3b4cee',1,'azx_ftp.h']]],
- ['azx_5fftp_5fcallback_5foptions_5ft_907',['AZX_FTP_CALLBACK_OPTIONS_T',['../azx__ftp_8h.html#a5211fd732f7053fedfe00b9332a3dad8',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdatacallback_908',['azx_ftp_dataCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga589a9c6cc78985dfbd0dd5fa787f6a1c',1,'azx_ftp.h']]],
- ['azx_5fftp_5fdebughook_909',['azx_ftp_debugHook',['../group___a_z_x___f_t_p___c_o_n_f.html#ga391d2352ba1f858b96e2e2c3f76c095d',1,'azx_ftp.h']]],
- ['azx_5fftp_5ffsz_5ft_910',['azx_ftp_fsz_t',['../azx__ftp_8h.html#a883a8abfcc8f9e553ae3843253dda83a',1,'azx_ftp.h']]],
- ['azx_5fftp_5fnet_5fbuf_5ft_911',['AZX_FTP_NET_BUF_T',['../azx__ftp_8h.html#a60ff811724b199da009e4ec755ed3d21',1,'azx_ftp.h']]],
- ['azx_5fftp_5foptions_5ft_912',['AZX_FTP_OPTIONS_T',['../azx__ftp_8h.html#a7fbf57a86231e6b24bc47aefbd819ac6',1,'azx_ftp.h']]],
- ['azx_5fftp_5fxfer_5ft_913',['AZX_FTP_XFER_T',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gad00a4ba26fa22811b61904e411bd1af2',1,'azx_ftp.h']]],
- ['azx_5fhttp_5fauth_5fschema_914',['AZX_HTTP_AUTH_SCHEMA',['../group__http_conf.html#gafb5cf49a7418b6b306a91aca97342df3',1,'azx_https.h']]],
- ['azx_5fhttp_5fmethod_915',['AZX_HTTP_METHOD',['../group__http_conf.html#gac324733f55c37381f15963897b55dd68',1,'azx_https.h']]],
- ['azx_5fhttpdebughook_916',['azx_httpDebugHook',['../group__http_conf.html#gae45c5ce7ad62c080a02504578c721840',1,'azx_https.h']]],
- ['azx_5fhttps_5fuser_5fcb_917',['AZX_HTTPS_USER_CB',['../group__http_conf.html#gaaad9f441f95bdedecbd30f8145df2585',1,'azx_https.h']]]
+ ['azx_5fcjson_5ft_904',['AZX_CJSON_T',['../azx__cjson_8h.html#aff729ee2acd66d5c36f24d65d951478b',1,'azx_cjson.h']]],
+ ['azx_5feasy_5fat_5fatcommand_5ft_905',['AZX_EASY_AT_ATCOMMAND_T',['../azx__easy__at_8h.html#aebdd0ba24ce48f20c02e57a5d4a01184',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fhandles_5ft_906',['AZX_EASY_AT_HANDLES_T',['../azx__easy__at_8h.html#abd84e2d7c47e054f016c85110d4c88ce',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5fmodule_5ft_907',['AZX_EASY_AT_MODULE_T',['../azx__easy__at_8h.html#a2f17b3c171a38f17de29a90123d946b5',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5ftaskcallback_908',['azx_easy_at_taskCallback',['../group__azx__easy__at.html#ga8ed786c0af1cc17027447d90012878cc',1,'azx_easy_at.h']]],
+ ['azx_5feasy_5fat_5ftaskdelegation_909',['azx_easy_at_taskDelegation',['../group__azx__easy__at.html#ga016dc78945b2312ee4cad3bd9de2f623',1,'azx_easy_at.h']]],
+ ['azx_5fftp_5fcallback_910',['azx_ftp_callback',['../group___a_z_x___f_t_p___c_o_n_f.html#gafe78f44e49db1f4dd17c32d3dc3b4cee',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fcallback_5foptions_5ft_911',['AZX_FTP_CALLBACK_OPTIONS_T',['../azx__ftp_8h.html#a5211fd732f7053fedfe00b9332a3dad8',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdatacallback_912',['azx_ftp_dataCallback',['../group___a_z_x___f_t_p___u_s_a_g_e.html#ga589a9c6cc78985dfbd0dd5fa787f6a1c',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fdebughook_913',['azx_ftp_debugHook',['../group___a_z_x___f_t_p___c_o_n_f.html#ga391d2352ba1f858b96e2e2c3f76c095d',1,'azx_ftp.h']]],
+ ['azx_5fftp_5ffsz_5ft_914',['azx_ftp_fsz_t',['../azx__ftp_8h.html#a883a8abfcc8f9e553ae3843253dda83a',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fnet_5fbuf_5ft_915',['AZX_FTP_NET_BUF_T',['../azx__ftp_8h.html#a60ff811724b199da009e4ec755ed3d21',1,'azx_ftp.h']]],
+ ['azx_5fftp_5foptions_5ft_916',['AZX_FTP_OPTIONS_T',['../azx__ftp_8h.html#a7fbf57a86231e6b24bc47aefbd819ac6',1,'azx_ftp.h']]],
+ ['azx_5fftp_5fxfer_5ft_917',['AZX_FTP_XFER_T',['../group___a_z_x___f_t_p___u_s_a_g_e.html#gad00a4ba26fa22811b61904e411bd1af2',1,'azx_ftp.h']]],
+ ['azx_5fhttp_5fauth_5fschema_918',['AZX_HTTP_AUTH_SCHEMA',['../group__http_conf.html#gafb5cf49a7418b6b306a91aca97342df3',1,'azx_https.h']]],
+ ['azx_5fhttp_5fmethod_919',['AZX_HTTP_METHOD',['../group__http_conf.html#gac324733f55c37381f15963897b55dd68',1,'azx_https.h']]],
+ ['azx_5fhttpdebughook_920',['azx_httpDebugHook',['../group__http_conf.html#gae45c5ce7ad62c080a02504578c721840',1,'azx_https.h']]],
+ ['azx_5fhttps_5fuser_5fcb_921',['AZX_HTTPS_USER_CB',['../group__http_conf.html#gaaad9f441f95bdedecbd30f8145df2585',1,'azx_https.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_1.js
index 7abcce69..aba5acce 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['in_5faddr_5ft_918',['in_addr_t',['../azx__gnu__sys__socket_8h.html#a861113898f7e0855e1a08858b19b5a3d',1,'azx_gnu_sys_socket.h']]]
+ ['in_5faddr_5ft_922',['in_addr_t',['../azx__gnu__sys__socket_8h.html#a861113898f7e0855e1a08858b19b5a3d',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_2.js
index e178ff28..9f44c168 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['socklen_5ft_919',['socklen_t',['../azx__gnu__sys__socket_8h.html#aae83a93236e01902b58ec3f197a17f7c',1,'azx_gnu_sys_socket.h']]]
+ ['socklen_5ft_923',['socklen_t',['../azx__gnu__sys__socket_8h.html#aae83a93236e01902b58ec3f197a17f7c',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_3.js
index 48452bac..5494167f 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/typedefs_3.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['user_5fbase64_5fencode_920',['user_base64_encode',['../group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890',1,'azx_https.h']]],
- ['user_5ftask_5fcb_921',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
+ ['user_5fbase64_5fencode_924',['user_base64_encode',['../group__http_conf.html#ga3cb8375a9c231c36d41bcc6390f26890',1,'azx_https.h']]],
+ ['user_5ftask_5fcb_925',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_0.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_0.js
index b193ab3d..c55449ce 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_0.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_0.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['accept_5ftype_823',['accept_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ac194fd4b0f404aae7584e9e0055a953e',1,'AZX_HTTP_HEADER']]],
- ['atpflags_824',['atpFlags',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a48c56278a486f7c81b68225366f9c887',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
- ['atpi_825',['atpI',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a56c989b6affc734e1c8524300bf53d2a',1,'AZX_EASY_AT_HANDLES_TAG']]],
- ['auth_5fcredentials_826',['auth_credentials',['../struct_a_z_x___h_t_t_p___u_r_l.html#a7039a296e1b4923c73af0ba1057ea653',1,'AZX_HTTP_URL']]],
- ['auth_5ftype_827',['auth_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ac565c09c8ffb02b02a1b044edd2ca85d',1,'AZX_HTTP_HEADER']]],
- ['azx_5fgnu_5fh_5ferrno_828',['azx_gnu_h_errno',['../azx__gnu__sys__socket_8h.html#ac668a8297fe60a7d6d0c4056b76a5d1b',1,'azx_gnu_sys_socket.h']]]
+ ['accept_5ftype_827',['accept_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ac194fd4b0f404aae7584e9e0055a953e',1,'AZX_HTTP_HEADER']]],
+ ['atpflags_828',['atpFlags',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a48c56278a486f7c81b68225366f9c887',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
+ ['atpi_829',['atpI',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a56c989b6affc734e1c8524300bf53d2a',1,'AZX_EASY_AT_HANDLES_TAG']]],
+ ['auth_5fcredentials_830',['auth_credentials',['../struct_a_z_x___h_t_t_p___u_r_l.html#a7039a296e1b4923c73af0ba1057ea653',1,'AZX_HTTP_URL']]],
+ ['auth_5ftype_831',['auth_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ac565c09c8ffb02b02a1b044edd2ca85d',1,'AZX_HTTP_HEADER']]],
+ ['azx_5fgnu_5fh_5ferrno_832',['azx_gnu_h_errno',['../azx__gnu__sys__socket_8h.html#ac668a8297fe60a7d6d0c4056b76a5d1b',1,'azx_gnu_sys_socket.h']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_1.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_1.js
index 78c56b37..250da587 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_1.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_1.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['boundary_829',['boundary',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad930e846064b3e7383764980fa9a792d',1,'AZX_HTTP_HEADER']]],
- ['buf_5fcb_830',['buf_cb',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#a0c6529dc3a1ce4a043ed36546f1368e6',1,'AZX_FTP_BUFFER_TAG']]],
- ['buffer_831',['buffer',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#a91a363801ba834482bc0c06b3c9bee03',1,'AZX_FTP_BUFFER_TAG']]],
- ['buffersize_832',['bufferSize',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#acd91017fde668bbf8ef18c1e04a6eedd',1,'AZX_FTP_BUFFER_TAG']]],
- ['buffinfo_833',['buffInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#aaed620e5108866012b9ac12a857b6227',1,'AZX_FTP_XFER_TAG']]],
- ['bytesxferred_834',['bytesXferred',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#ae10ab56c3513d3eb14bbab3ae2f24da6',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]]
+ ['boundary_833',['boundary',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad930e846064b3e7383764980fa9a792d',1,'AZX_HTTP_HEADER']]],
+ ['buf_5fcb_834',['buf_cb',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#a0c6529dc3a1ce4a043ed36546f1368e6',1,'AZX_FTP_BUFFER_TAG']]],
+ ['buffer_835',['buffer',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#a91a363801ba834482bc0c06b3c9bee03',1,'AZX_FTP_BUFFER_TAG']]],
+ ['buffersize_836',['bufferSize',['../struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html#acd91017fde668bbf8ef18c1e04a6eedd',1,'AZX_FTP_BUFFER_TAG']]],
+ ['buffinfo_837',['buffInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#aaed620e5108866012b9ac12a857b6227',1,'AZX_FTP_XFER_TAG']]],
+ ['bytesxferred_838',['bytesXferred',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#ae10ab56c3513d3eb14bbab3ae2f24da6',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_2.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_2.js
index 589119e6..6f991aea 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_2.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_2.js
@@ -1,21 +1,21 @@
var searchData=
[
- ['ca_5fcert_5ffilepath_835',['CA_CERT_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a6fa1a9ef7ffaf8084a1121203286b381',1,'AZX_HTTP_SSL']]],
- ['callback_836',['Callback',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a76d25f6105c7bc3c6cffff300fd8a0eb',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
- ['cbarg_837',['cbArg',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ac060b40c8c9b433ecbf20a2c06735649',1,'AZX_FTP_OPTIONS_TAG::cbArg()'],['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#aa3d4809192b6215b324b8b644678018b',1,'AZX_FTP_CALLBACK_OPTIONS_TAG::cbArg()']]],
- ['cbdata_838',['cbData',['../structazx__http_callback_options.html#ad467e1a167c72ecb0b3fb027d191583b',1,'azx_httpCallbackOptions']]],
- ['cbevtflag_839',['cbEvtFlag',['../structazx__http_callback_options.html#a194817cf069ae7e296a2cacf6c908db1',1,'azx_httpCallbackOptions']]],
- ['cbfunc_840',['cbFunc',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ad5abfabcfdc377016bf6d500d7a61cae',1,'AZX_FTP_OPTIONS_TAG::cbFunc()'],['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#af2abca18c447e35b02e54afc1655148c',1,'AZX_FTP_CALLBACK_OPTIONS_TAG::cbFunc()'],['../structazx__http_callback_options.html#ad1867ec1a9d182c41114cd4cab164b65',1,'azx_httpCallbackOptions::cbFunc()']]],
- ['child_841',['child',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#acc0812450b11fd961c1ffbd27802602f',1,'AZX_CJSON_TAG']]],
- ['chunked_842',['chunked',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a74c6b4d4a88c248ced6d6e2d905d0d38',1,'AZX_HTTP_HEADER']]],
- ['cid_843',['cid',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#a612b9126403b6090be53329d834cd676',1,'AZX_FTP_OPTIONS_TAG::cid()'],['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#af5d583d83b87d5336dca07024feedd50',1,'AZX_HTTP_OPTIONS::cid()']]],
- ['client_5fcert_5ffilepath_844',['CLIENT_CERT_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#abaf4e5e1c9eaf345ee66bc66bf8bf714',1,'AZX_HTTP_SSL']]],
- ['client_5fkey_5ffilepath_845',['CLIENT_KEY_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#af874ede478279b85d0d616992fa5919d',1,'AZX_HTTP_SSL']]],
- ['close_846',['close',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#add388494f00515ad4ae46b94d0856b1f',1,'AZX_HTTP_HEADER']]],
- ['cmd_847',['cmd',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a050c96bf850ad6f307803f98507d9482',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
- ['content_5flength_848',['content_length',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aeeb62bb853b0d76ce1c8c3bb8bdc4cea',1,'AZX_HTTP_HEADER']]],
- ['content_5ftype_849',['content_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#abdd2a59f7fbec36c210f292979a15ba5',1,'AZX_HTTP_HEADER']]],
- ['context_850',['context',['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a19875eebf027d5380a4ebc6376ea9a5f',1,'AZX_LFS_CONTEXT']]],
- ['cookie_851',['cookie',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aea075e8551f0d14674cd1a57d78c4c5b',1,'AZX_HTTP_HEADER']]],
- ['custom_5ffields_852',['custom_fields',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a332a7525e2394bebb227969c2d3f15b2',1,'AZX_HTTP_HEADER']]]
+ ['ca_5fcert_5ffilepath_839',['CA_CERT_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a6fa1a9ef7ffaf8084a1121203286b381',1,'AZX_HTTP_SSL']]],
+ ['callback_840',['Callback',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a76d25f6105c7bc3c6cffff300fd8a0eb',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
+ ['cbarg_841',['cbArg',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ac060b40c8c9b433ecbf20a2c06735649',1,'AZX_FTP_OPTIONS_TAG::cbArg()'],['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#aa3d4809192b6215b324b8b644678018b',1,'AZX_FTP_CALLBACK_OPTIONS_TAG::cbArg()']]],
+ ['cbdata_842',['cbData',['../structazx__http_callback_options.html#ad467e1a167c72ecb0b3fb027d191583b',1,'azx_httpCallbackOptions']]],
+ ['cbevtflag_843',['cbEvtFlag',['../structazx__http_callback_options.html#a194817cf069ae7e296a2cacf6c908db1',1,'azx_httpCallbackOptions']]],
+ ['cbfunc_844',['cbFunc',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ad5abfabcfdc377016bf6d500d7a61cae',1,'AZX_FTP_OPTIONS_TAG::cbFunc()'],['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#af2abca18c447e35b02e54afc1655148c',1,'AZX_FTP_CALLBACK_OPTIONS_TAG::cbFunc()'],['../structazx__http_callback_options.html#ad1867ec1a9d182c41114cd4cab164b65',1,'azx_httpCallbackOptions::cbFunc()']]],
+ ['child_845',['child',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#acc0812450b11fd961c1ffbd27802602f',1,'AZX_CJSON_TAG']]],
+ ['chunked_846',['chunked',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a74c6b4d4a88c248ced6d6e2d905d0d38',1,'AZX_HTTP_HEADER']]],
+ ['cid_847',['cid',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#a612b9126403b6090be53329d834cd676',1,'AZX_FTP_OPTIONS_TAG::cid()'],['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#af5d583d83b87d5336dca07024feedd50',1,'AZX_HTTP_OPTIONS::cid()']]],
+ ['client_5fcert_5ffilepath_848',['CLIENT_CERT_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#abaf4e5e1c9eaf345ee66bc66bf8bf714',1,'AZX_HTTP_SSL']]],
+ ['client_5fkey_5ffilepath_849',['CLIENT_KEY_FILEPATH',['../struct_a_z_x___h_t_t_p___s_s_l.html#af874ede478279b85d0d616992fa5919d',1,'AZX_HTTP_SSL']]],
+ ['close_850',['close',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#add388494f00515ad4ae46b94d0856b1f',1,'AZX_HTTP_HEADER']]],
+ ['cmd_851',['cmd',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a050c96bf850ad6f307803f98507d9482',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
+ ['content_5flength_852',['content_length',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aeeb62bb853b0d76ce1c8c3bb8bdc4cea',1,'AZX_HTTP_HEADER']]],
+ ['content_5ftype_853',['content_type',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#abdd2a59f7fbec36c210f292979a15ba5',1,'AZX_HTTP_HEADER']]],
+ ['context_854',['context',['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a19875eebf027d5380a4ebc6376ea9a5f',1,'AZX_LFS_CONTEXT']]],
+ ['cookie_855',['cookie',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aea075e8551f0d14674cd1a57d78c4c5b',1,'AZX_HTTP_HEADER']]],
+ ['custom_5ffields_856',['custom_fields',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a332a7525e2394bebb227969c2d3f15b2',1,'AZX_HTTP_HEADER']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_3.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_3.js
index e495f66c..56ae06bd 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_3.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['delegation_853',['Delegation',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#adb543eb2a52c2679e78567a9f005eb25',1,'AZX_EASY_AT_ATCOMMAND_TAG']]]
+ ['delegation_857',['Delegation',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#adb543eb2a52c2679e78567a9f005eb25',1,'AZX_EASY_AT_ATCOMMAND_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_4.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_4.js
index 0fe09961..531645d7 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_4.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_4.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['fileinfo_854',['fileInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#a56a3937348cbbaa14b988ff3d50d39da',1,'AZX_FTP_XFER_TAG']]],
- ['filesize_855',['fileSize',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a4be4fd757122b5abebcfbd59ed9ca1df',1,'AZX_FTP_FILE_INFO_TAG']]]
+ ['fileinfo_858',['fileInfo',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#a56a3937348cbbaa14b988ff3d50d39da',1,'AZX_FTP_XFER_TAG']]],
+ ['filesize_859',['fileSize',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a4be4fd757122b5abebcfbd59ed9ca1df',1,'AZX_FTP_FILE_INFO_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_5.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_5.js
index 263bf1c1..c26dc61c 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_5.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_5.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['handle_856',['handle',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a05528a90a9a74940a2e76d8c587148eb',1,'AZX_EASY_AT_HANDLES_TAG']]],
- ['host_857',['host',['../struct_a_z_x___h_t_t_p___u_r_l.html#a6bf08b18309f7f22242da6ef980e4cc2',1,'AZX_HTTP_URL']]],
- ['https_858',['https',['../struct_a_z_x___h_t_t_p___u_r_l.html#ae3c4b1e005db64167b8230216a94985f',1,'AZX_HTTP_URL']]]
+ ['handle_860',['handle',['../struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html#a05528a90a9a74940a2e76d8c587148eb',1,'AZX_EASY_AT_HANDLES_TAG']]],
+ ['host_861',['host',['../struct_a_z_x___h_t_t_p___u_r_l.html#a6bf08b18309f7f22242da6ef980e4cc2',1,'AZX_HTTP_URL']]],
+ ['https_862',['https',['../struct_a_z_x___h_t_t_p___u_r_l.html#ae3c4b1e005db64167b8230216a94985f',1,'AZX_HTTP_URL']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_6.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_6.js
index 5ab2c764..2e12362a 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_6.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_6.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['i2c_5fhandle_859',['i2c_handle',['../struct_a_z_x___e_e_p_r_o_m___t.html#ace28601755fa5bedd7f57d149df2a975',1,'AZX_EEPROM_T']]],
- ['idletime_860',['idleTime',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#a31e887128d37ea5729e25523c552ddec',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]],
- ['info_861',['info',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a413ff5942d1eaa515fc507c3562e0a49',1,'AZX_LFS_INFO_FILE']]],
- ['ishidden_862',['isHidden',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a2f8bbf4d3fd67988b6665f2737047939',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
- ['isinit_863',['isInit',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#a399e8267dda10781705c4a03c542339b',1,'AZX_LFS_STATUS_UTILS']]],
- ['ismount_864',['isMount',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#abaad5bb722a71d1270c07d3ba3bc1398',1,'AZX_LFS_STATUS_UTILS']]]
+ ['i2c_5fhandle_863',['i2c_handle',['../struct_a_z_x___e_e_p_r_o_m___t.html#ace28601755fa5bedd7f57d149df2a975',1,'AZX_EEPROM_T']]],
+ ['idletime_864',['idleTime',['../struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html#a31e887128d37ea5729e25523c552ddec',1,'AZX_FTP_CALLBACK_OPTIONS_TAG']]],
+ ['info_865',['info',['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a413ff5942d1eaa515fc507c3562e0a49',1,'AZX_LFS_INFO_FILE']]],
+ ['ishidden_866',['isHidden',['../struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html#a2f8bbf4d3fd67988b6665f2737047939',1,'AZX_EASY_AT_ATCOMMAND_TAG']]],
+ ['isinit_867',['isInit',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#a399e8267dda10781705c4a03c542339b',1,'AZX_LFS_STATUS_UTILS']]],
+ ['ismount_868',['isMount',['../struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html#abaad5bb722a71d1270c07d3ba3bc1398',1,'AZX_LFS_STATUS_UTILS']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_7.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_7.js
index e0be149a..c7f73900 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_7.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_7.js
@@ -1,13 +1,13 @@
var searchData=
[
- ['last_5fat_5finstance_865',['last_AT_Instance',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a7a25b7d50914a64818790092f886b3a2',1,'AZX_EASY_AT_MODULE_TAG']]],
- ['last_5fatp_5fhandle_866',['last_ATP_Handle',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a12ab5e3a209f52f7f02e99917359ba20',1,'AZX_EASY_AT_MODULE_TAG']]],
- ['level_867',['level',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ab8f878a853262f834a7bdf51e04b53ed',1,'AZX_FTP_OPTIONS_TAG']]],
- ['location_868',['location',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a96d238225d01cc207e77d4140e3e2b5e',1,'AZX_HTTP_HEADER']]],
- ['log_5fchannel_869',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_870',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_871',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]],
- ['logarg_872',['logArg',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a6306ca88fc8eff2aa06ac2e6d613a948',1,'AZX_HTTP_OPTIONS']]],
- ['logfunc_873',['logFunc',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a1a061e1b6445742cfdbfbc69b129eeec',1,'AZX_HTTP_OPTIONS']]],
- ['loglevel_874',['loglevel',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a781168041c2fd139fefa9c31de6d9c86',1,'AZX_HTTP_OPTIONS']]]
+ ['last_5fat_5finstance_869',['last_AT_Instance',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a7a25b7d50914a64818790092f886b3a2',1,'AZX_EASY_AT_MODULE_TAG']]],
+ ['last_5fatp_5fhandle_870',['last_ATP_Handle',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a12ab5e3a209f52f7f02e99917359ba20',1,'AZX_EASY_AT_MODULE_TAG']]],
+ ['level_871',['level',['../struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html#ab8f878a853262f834a7bdf51e04b53ed',1,'AZX_FTP_OPTIONS_TAG']]],
+ ['location_872',['location',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a96d238225d01cc207e77d4140e3e2b5e',1,'AZX_HTTP_HEADER']]],
+ ['log_5fchannel_873',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_874',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_875',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]],
+ ['logarg_876',['logArg',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a6306ca88fc8eff2aa06ac2e6d613a948',1,'AZX_HTTP_OPTIONS']]],
+ ['logfunc_877',['logFunc',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a1a061e1b6445742cfdbfbc69b129eeec',1,'AZX_HTTP_OPTIONS']]],
+ ['loglevel_878',['loglevel',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a781168041c2fd139fefa9c31de6d9c86',1,'AZX_HTTP_OPTIONS']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_8.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_8.js
index 97a6c95c..bb25c505 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_8.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_8.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['mem_5fsize_875',['mem_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a52579f677c61a9132d71d86430ab5e7b',1,'AZX_EEPROM_T']]],
- ['method_876',['method',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aa3b55132919b0eb9649b04e03423e82e',1,'AZX_HTTP_HEADER']]],
- ['module_5fname_877',['module_name',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a19f9fdd573dc3062152819565de5ac01',1,'AZX_EASY_AT_MODULE_TAG']]]
+ ['mem_5fsize_879',['mem_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a52579f677c61a9132d71d86430ab5e7b',1,'AZX_EEPROM_T']]],
+ ['method_880',['method',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#aa3b55132919b0eb9649b04e03423e82e',1,'AZX_HTTP_HEADER']]],
+ ['module_5fname_881',['module_name',['../struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html#a19f9fdd573dc3062152819565de5ac01',1,'AZX_EASY_AT_MODULE_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_9.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_9.js
index 9d839392..20ebb459 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_9.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_9.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['next_878',['next',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ada4b3bb3a8d840cc4c8dbddd559fe796',1,'AZX_CJSON_TAG::next()'],['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a1467c82be849a9e4db0566b7cad0870c',1,'AZX_LFS_INFO_FILE::next()']]]
+ ['next_882',['next',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ada4b3bb3a8d840cc4c8dbddd559fe796',1,'AZX_CJSON_TAG::next()'],['../struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html#a1467c82be849a9e4db0566b7cad0870c',1,'AZX_LFS_INFO_FILE::next()']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_a.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_a.js
index c8a62950..3c92c211 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_a.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_a.js
@@ -1,12 +1,12 @@
var searchData=
[
- ['padding_879',['padding',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a009dfc4ae5a6b15f6ce9abe5f60ab813',1,'AZX_HTTP_OPTIONS']]],
- ['page_5fsize_880',['page_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a838dde91b1b4467af3495d3edad8c3ad',1,'AZX_EEPROM_T']]],
- ['param1_881',['param1',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a0a5c89e190600f643c60380bb32d3579',1,'AZX_TASKS_MESSAGE_T']]],
- ['param2_882',['param2',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a21c34f7468ecae71cbe5edf2da4f1c09',1,'AZX_TASKS_MESSAGE_T']]],
- ['path_883',['path',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a07d7fc9fc39327e4a14f70792889934b',1,'AZX_FTP_FILE_INFO_TAG::path()'],['../struct_a_z_x___h_t_t_p___u_r_l.html#aaf259b6e879aeabb86c582d65e25dd68',1,'AZX_HTTP_URL::path()']]],
- ['payload_884',['payload',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#abdafe0fe61a0c3a2de0b3de8bb795a92',1,'AZX_FTP_XFER_TAG']]],
- ['port_885',['port',['../struct_a_z_x___h_t_t_p___u_r_l.html#a8c4b4d7776d5fc2d3762ae9d7a34411a',1,'AZX_HTTP_URL']]],
- ['post_5fdata_886',['post_data',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a4b8018e0fa63244f5d16181874ef996b',1,'AZX_HTTP_HEADER']]],
- ['prev_887',['prev',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a73c6b79049b7349f09378271ff721966',1,'AZX_CJSON_TAG']]]
+ ['padding_883',['padding',['../struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html#a009dfc4ae5a6b15f6ce9abe5f60ab813',1,'AZX_HTTP_OPTIONS']]],
+ ['page_5fsize_884',['page_size',['../struct_a_z_x___e_e_p_r_o_m___t.html#a838dde91b1b4467af3495d3edad8c3ad',1,'AZX_EEPROM_T']]],
+ ['param1_885',['param1',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a0a5c89e190600f643c60380bb32d3579',1,'AZX_TASKS_MESSAGE_T']]],
+ ['param2_886',['param2',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a21c34f7468ecae71cbe5edf2da4f1c09',1,'AZX_TASKS_MESSAGE_T']]],
+ ['path_887',['path',['../struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html#a07d7fc9fc39327e4a14f70792889934b',1,'AZX_FTP_FILE_INFO_TAG::path()'],['../struct_a_z_x___h_t_t_p___u_r_l.html#aaf259b6e879aeabb86c582d65e25dd68',1,'AZX_HTTP_URL::path()']]],
+ ['payload_888',['payload',['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#abdafe0fe61a0c3a2de0b3de8bb795a92',1,'AZX_FTP_XFER_TAG']]],
+ ['port_889',['port',['../struct_a_z_x___h_t_t_p___u_r_l.html#a8c4b4d7776d5fc2d3762ae9d7a34411a',1,'AZX_HTTP_URL']]],
+ ['post_5fdata_890',['post_data',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a4b8018e0fa63244f5d16181874ef996b',1,'AZX_HTTP_HEADER']]],
+ ['prev_891',['prev',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a73c6b79049b7349f09378271ff721966',1,'AZX_CJSON_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_b.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_b.js
index 93c007f4..45d380d6 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_b.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_b.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['referrer_888',['referrer',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad72c30d64c80b4ffbd49d0d81a880cff',1,'AZX_HTTP_HEADER']]]
+ ['referrer_892',['referrer',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#ad72c30d64c80b4ffbd49d0d81a880cff',1,'AZX_HTTP_HEADER']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_c.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_c.js
index e69586a7..7cc96b43 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_c.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_c.js
@@ -1,8 +1,8 @@
var searchData=
[
- ['sslauthtype_889',['sslAuthType',['../struct_a_z_x___h_t_t_p___s_s_l.html#a74687f5a92426fe2c83c3b0bf038296c',1,'AZX_HTTP_SSL']]],
- ['sslconf_890',['sslConf',['../struct_a_z_x___h_t_t_p___s_s_l.html#a3546333f61310abba5a3b8389b450f71',1,'AZX_HTTP_SSL']]],
- ['sslh_891',['sslH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a87aa1e5006bc730ba8bdd3d8a5e8d102',1,'AZX_HTTP_SSL']]],
- ['status_892',['status',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a8f2c6f2c1d19eaa45d95ccbd75cd0d95',1,'AZX_HTTP_HEADER']]],
- ['string_893',['string',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a7e7993d4465c690d53f8dc49600540d2',1,'AZX_CJSON_TAG']]]
+ ['sslauthtype_893',['sslAuthType',['../struct_a_z_x___h_t_t_p___s_s_l.html#a74687f5a92426fe2c83c3b0bf038296c',1,'AZX_HTTP_SSL']]],
+ ['sslconf_894',['sslConf',['../struct_a_z_x___h_t_t_p___s_s_l.html#a3546333f61310abba5a3b8389b450f71',1,'AZX_HTTP_SSL']]],
+ ['sslh_895',['sslH',['../struct_a_z_x___h_t_t_p___s_s_l.html#a87aa1e5006bc730ba8bdd3d8a5e8d102',1,'AZX_HTTP_SSL']]],
+ ['status_896',['status',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a8f2c6f2c1d19eaa45d95ccbd75cd0d95',1,'AZX_HTTP_HEADER']]],
+ ['string_897',['string',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a7e7993d4465c690d53f8dc49600540d2',1,'AZX_CJSON_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_d.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_d.js
index e6ff4233..0dec7c35 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_d.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_d.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['type_894',['type',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ae125d3fd935e29ae9a71f99134f9f43e',1,'AZX_CJSON_TAG::type()'],['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#af641d98bcb03ff5ecad1d40e870bd7b5',1,'AZX_FTP_XFER_TAG::type()'],['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a8809225d58c6b2c59835114fb625c045',1,'AZX_LFS_CONTEXT::type()'],['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a9110a674136a92f2eea7927877398f0e',1,'AZX_TASKS_MESSAGE_T::type()']]]
+ ['type_898',['type',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ae125d3fd935e29ae9a71f99134f9f43e',1,'AZX_CJSON_TAG::type()'],['../struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html#af641d98bcb03ff5ecad1d40e870bd7b5',1,'AZX_FTP_XFER_TAG::type()'],['../struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html#a8809225d58c6b2c59835114fb625c045',1,'AZX_LFS_CONTEXT::type()'],['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html#a9110a674136a92f2eea7927877398f0e',1,'AZX_TASKS_MESSAGE_T::type()']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_e.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_e.js
index 5c160385..372615a3 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_e.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_e.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['user_5fagent_895',['user_agent',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a59825a2326d7fc12991da432fbe20098',1,'AZX_HTTP_HEADER']]],
- ['user_5fcb_5fbytes_5fsize_896',['user_cb_bytes_size',['../structazx__http_callback_options.html#ae999de10c7ec41abc95949d9e3b90102',1,'azx_httpCallbackOptions']]]
+ ['user_5fagent_899',['user_agent',['../struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html#a59825a2326d7fc12991da432fbe20098',1,'AZX_HTTP_HEADER']]],
+ ['user_5fcb_5fbytes_5fsize_900',['user_cb_bytes_size',['../structazx__http_callback_options.html#ae999de10c7ec41abc95949d9e3b90102',1,'azx_httpCallbackOptions']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_f.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_f.js
index 5c421c4b..c7aed1ba 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_f.js
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/search/variables_f.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['valuedouble_897',['valuedouble',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a5bb5e5d9b929a207d8e3638ff69e0bbd',1,'AZX_CJSON_TAG']]],
- ['valueint_898',['valueint',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ad01e0574595b9bd3372e4a0cb6513946',1,'AZX_CJSON_TAG']]],
- ['valuestring_899',['valuestring',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a6eb2a686fb4d6eee30abc3054b2012ec',1,'AZX_CJSON_TAG']]]
+ ['valuedouble_901',['valuedouble',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a5bb5e5d9b929a207d8e3638ff69e0bbd',1,'AZX_CJSON_TAG']]],
+ ['valueint_902',['valueint',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#ad01e0574595b9bd3372e4a0cb6513946',1,'AZX_CJSON_TAG']]],
+ ['valuestring_903',['valuestring',['../struct_a_z_x___c_j_s_o_n___t_a_g.html#a6eb2a686fb4d6eee30abc3054b2012ec',1,'AZX_CJSON_TAG']]]
];
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___c_j_s_o_n___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___c_j_s_o_n___t_a_g.html
index 1d8dfadf..b468b500 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___c_j_s_o_n___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___c_j_s_o_n___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html
index 97983ad8..eacebf15 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___a_t_c_o_m_m_a_n_d___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
index af8845cf..ceeecaa8 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
index 80884e70..a2da5684 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_e_p_r_o_m___t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_e_p_r_o_m___t.html
index 483eab83..649ccccd 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_e_p_r_o_m___t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___e_e_p_r_o_m___t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r.html
index d691deef..5893b390 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html
index e3bcab85..1e3b6b7b 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___b_u_f_f_e_r___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html
index 3ffd58a2..7353bb1a 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___c_a_l_l_b_a_c_k___o_p_t_i_o_n_s___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html
index 10795b18..0dd1484e 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html
index 005734ce..a7e8b1ed 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___f_i_l_e___i_n_f_o___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html
index 576a2c68..e18a3bda 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___n_e_t___b_u_f___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html
index 53d56032..284d3ae4 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___o_p_t_i_o_n_s___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html
index 93e591ec..b0bc88a2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___f_t_p___x_f_e_r___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html
index 1a1f327a..42326c55 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___h_e_a_d_e_r.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___i_n_f_o.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___i_n_f_o.html
index 509d1142..22f1c4c9 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___i_n_f_o.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___i_n_f_o.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html
index 77101680..1004be6d 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___o_p_t_i_o_n_s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___s_s_l.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___s_s_l.html
index 496b02ef..4994f25a 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___s_s_l.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___s_s_l.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___u_r_l.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___u_r_l.html
index 837e10df..df78e2c8 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___u_r_l.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p___u_r_l.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html
index cb697977..04e77a27 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___h_t_t_p_s___o_p_t_i_o_n_s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html
index 786223d9..3173d57c 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___c_o_n_t_e_x_t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html
index d87eaeee..7ffe7e09 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___i_n_f_o___f_i_l_e.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html
index 1d57ac8a..adcc42b5 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_f_s___s_t_a_t_u_s___u_t_i_l_s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
index 331ae38c..a50ac665 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___r_a_m___d_i_s_k___s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___r_a_m___d_i_s_k___s.html
index f6b1d4ac..d89de481 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___r_a_m___d_i_s_k___s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___r_a_m___d_i_s_k___s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html
index 8bdc5994..e9dfaa22 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___d_e_s_c_r_i_p_t_o_r.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html
index 702bc74a..5deeb689 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_c_c_l_a_y_o_u_t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html
index d7561d88..0f8842a4 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___e_v_e_n_t___c_a_l_l_b_a_c_k.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html
index 026b5c60..0fdaa727 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___j_s_c___e_v_e_n_t___r_e_s___t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html
index 6c80e5f3..d5210e58 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_i_c_r_o___s_p_i___p_a_r_a_m_s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html
index 6a5ec643..035e7d3d 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___m_t_d___o_o_b___o_p_s.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html
index bca94a62..16335649 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___o_o_b_f_r_e_e.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html
index f0ed118d..316ab265 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___c_h_i_p.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html
index 668ec4d5..cfd288a4 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___s_p_i___f_l_a_s_h___s_p_i___s_l_a_v_e.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html
index d08163f1..54e9b4bd 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
index 96123622..fd491cc2 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___h_a_n_d_l_e_s___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
index b754f4b8..6e815e76 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_e_a_s_y___a_t___m_o_d_u_l_e___t_a_g.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_ftp_callback_options.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_ftp_callback_options.html
index 4ff9173d..f83bb038 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_ftp_callback_options.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/struct_ftp_callback_options.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structazx__http_callback_options.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structazx__http_callback_options.html
index 23ff583e..ef37c9a1 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structazx__http_callback_options.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structazx__http_callback_options.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.html
new file mode 100644
index 00000000..99d5a59f
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.html
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+AZX (AppZone eXtensions) documentation: dcs_struct Struct Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AZX (AppZone eXtensions) documentation
+ 1.1.13-CxL
+
+ A set of companion utilities that make AZ development easier
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+uint8_t smCompressed
+
+
+uint8_t smAlphabet
+
+
+uint8_t smClass
+
+
+
The documentation for this struct was generated from the following file:
+
+
+
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.js
new file mode 100644
index 00000000..d458a27e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structdcs__struct.js
@@ -0,0 +1,6 @@
+var structdcs__struct =
+[
+ [ "smAlphabet", "structdcs__struct.html#a1a6cfd436585d06593eb345fa3227d48", null ],
+ [ "smClass", "structdcs__struct.html#aaf53ef38707b62cdfb57f88770cc2d13", null ],
+ [ "smCompressed", "structdcs__struct.html#a052a22bcda7ae485c109a15514ee0cb7", null ]
+];
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.html
new file mode 100644
index 00000000..0cdd1ce5
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.html
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+AZX (AppZone eXtensions) documentation: pdu_struct Struct Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AZX (AppZone eXtensions) documentation
+ 1.1.13-CxL
+
+ A set of companion utilities that make AZ development easier
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+struct {
+
+ uint8_t len
+
+
+ uint8_t bytes
+
+
+ uint8_t type
+
+
+ uint8_t data [14]
+
+} smsc
+
+
+struct {
+
+ uint8_t len
+
+
+ uint8_t bytes
+
+
+ uint8_t type
+
+
+ uint8_t data [14]
+
+} sender
+
+
+struct {
+
+ uint16_t len
+
+
+ uint16_t bytes
+
+
+ uint8_t * data
+
+} msg
+
+
+uint8_t first
+
+
+uint8_t tp_msg_ref
+
+
+uint8_t tp_pid
+
+
+uint8_t tp_dcs
+
+
+uint8_t tp_vp
+
+
+uint8_t year
+
+
+uint8_t month
+
+
+uint8_t date
+
+
+uint8_t hour
+
+
+uint8_t min
+
+
+uint8_t sec
+
+
+int8_t tz
+
+
+uint16_t len_bytes
+
+
+uint16_t len_cmgs
+
+
+
+
The documentation for this struct was generated from the following file:
+
+
+
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.js b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.js
new file mode 100644
index 00000000..78f253c3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structpdu__struct.js
@@ -0,0 +1,27 @@
+var structpdu__struct =
+[
+ [ "bytes", "structpdu__struct.html#abfe24f5e16c400d6ef5f63eaddeb2925", null ],
+ [ "bytes", "structpdu__struct.html#ae678b74654c8a4e251376f55e278172c", null ],
+ [ "data", "structpdu__struct.html#a5295d0953f4cb515f6e6425aa3fdf61a", null ],
+ [ "data", "structpdu__struct.html#a7f419d19168835c2f32a16095ce05b2a", null ],
+ [ "date", "structpdu__struct.html#a658fa87e51574c246b9a756baf78736d", null ],
+ [ "first", "structpdu__struct.html#af399df2f9a3b51cddb264310fb5089a3", null ],
+ [ "hour", "structpdu__struct.html#a2fe19b4e6f822ac6afd885b9c11aae31", null ],
+ [ "len", "structpdu__struct.html#a0af33b15b3f41ba86e4e6de671baa602", null ],
+ [ "len", "structpdu__struct.html#a01b110321ffd6853d2fa2151a1c30aa9", null ],
+ [ "len_bytes", "structpdu__struct.html#a4586398d6563740c5937b2bd3dbfa57b", null ],
+ [ "len_cmgs", "structpdu__struct.html#ad0784134e062540c8d6f907d666f17f9", null ],
+ [ "min", "structpdu__struct.html#a04c58e4bf19591e3ff2d31f22597f834", null ],
+ [ "month", "structpdu__struct.html#afb4ac41fdf97fae28b7f31556735cad2", null ],
+ [ "msg", "structpdu__struct.html#a974cedf335bea5005cf127dc450da970", null ],
+ [ "sec", "structpdu__struct.html#af81c005d2970814c8eb0b696d0534d30", null ],
+ [ "sender", "structpdu__struct.html#a2e7befe7ddaf3376d8637e8ab8d59626", null ],
+ [ "smsc", "structpdu__struct.html#a238650e82cb1cb7b3a590a03b4ecd18f", null ],
+ [ "tp_dcs", "structpdu__struct.html#ae24c15c28018ba6c9c1d7bbea6443407", null ],
+ [ "tp_msg_ref", "structpdu__struct.html#a985de544a0adaeb79210a9da77f35015", null ],
+ [ "tp_pid", "structpdu__struct.html#aae22974e9d60ae59728e3d028ed52f67", null ],
+ [ "tp_vp", "structpdu__struct.html#aca89e87d64c77e8494d0b1191761149f", null ],
+ [ "type", "structpdu__struct.html#a18e9ea34a77f4ea47e99dee521dc9c2f", null ],
+ [ "tz", "structpdu__struct.html#a44edb8aa7e003746b1d848e93ab949bb", null ],
+ [ "year", "structpdu__struct.html#a95ba6560c0b59b7ff091def4646f18a4", null ]
+];
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structsockaddr__storage.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structsockaddr__storage.html
index 275019a7..8d5a49d4 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structsockaddr__storage.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structsockaddr__storage.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structtimezone.html b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structtimezone.html
index e2d2ec3b..6447445a 100644
--- a/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structtimezone.html
+++ b/ME310G1-ME910G1-ML865G1/AZX_Docs/html/structtimezone.html
@@ -34,7 +34,7 @@
AZX (AppZone eXtensions) documentation
- 1.1.10-CxL
+ 1.1.13-CxL
A set of companion utilities that make AZ development easier
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/metadata.json
old mode 100755
new mode 100644
index 17af47bd..f7bf7b8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ATI/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/metadata.json
old mode 100755
new mode 100644
index a7823d91..5add0c1e
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/src/aws_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/src/aws_demo.c
index 4dbc01ce..f4bf8843 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/src/aws_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AWS/src/aws_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.2
+ 1.0.3
@note
@@ -157,26 +157,31 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
}
/* clean everything */
- res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
- if(res==0)
- {
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
- }
- else
- {
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
- }
- res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
- if(res==0)
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
- else
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
{
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
-
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -253,28 +258,28 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
}
#if HOSTMISMATCH_ENABLE
- ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
- if(ret != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
- }
+ ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
+ if(ret != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
+ }
#endif
#if SNI_ENABLE
- res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
- if(res != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
- }
+ res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
+ if(res != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
+ }
#endif
{
@@ -357,18 +362,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx, M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
{
- AZX_LOG_DEBUG("Client certificate file %s \r\n",CLIENTCERTFILE);
+ AZX_LOG_DEBUG("Client certificate file %s \r\n", CLIENTCERTFILE);
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
@@ -379,7 +386,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -389,7 +397,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -416,7 +425,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -426,7 +436,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -443,13 +454,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -754,6 +767,11 @@ INT32 AWS_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/metadata.json
old mode 100755
new mode 100644
index 222b8ebb..55db5226
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/AppManager/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -33,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/Makefile.in
index b459f9e0..0223966b 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/metadata.json
old mode 100755
new mode 100644
index c4ce79b1..0150cc83
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/App_OTA_FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/Makefile.in
index f654f135..b512c6f8 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/metadata.json
old mode 100755
new mode 100644
index dcffa0b2..fae62b53
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/CJSON/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/metadata.json
old mode 100755
new mode 100644
index 8dd7984c..4c7906ea
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Crypto_ECC/metadata.json
@@ -13,18 +13,19 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/Makefile.in
index eb742709..e186ae48 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
index 64f0b1eb..08534830 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
@@ -122,7 +122,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c || !pData)
{
@@ -153,11 +153,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
msgs[0].buf = (UINT8*)buf;
msgs[0].flags = I2C_M_WR;
msgs[0].len = bufsize; // 2 address bytes + data
-
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
+
memcpy(buf + 2, pData, size );
rdrw_data.msgs = &msgs[0];
@@ -191,7 +187,7 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c)
{
@@ -219,10 +215,6 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
msgs[0].flags = I2C_M_WR;
msgs[0].len = sizeof(buf); // 2 address bytes + data
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
rdrw_data.msgs = &msgs[0];
rdrw_data.nmsgs = 1;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
index 80bd7f30..dda66918 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
@@ -1,3 +1,5 @@
+1.0.2
+-----------
1.0.1
-----------
1.0.0
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/metadata.json
old mode 100755
new mode 100644
index 0e7c35b6..2295fd77
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EEPROM_AA256/metadata.json
@@ -12,19 +12,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/Makefile.in
index 401c6ad2..e3d757b5 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/metadata.json
old mode 100755
new mode 100644
index 49c8691e..6aba0ce3
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/EasyAT/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/metadata.json
old mode 100755
new mode 100644
index 4433aaea..51964612
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/metadata.json
old mode 100755
new mode 100644
index 9ff2af61..ac9ab71d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Events_Barrier/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/metadata.json
old mode 100755
new mode 100644
index a602504c..bee71bbe
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FOTA/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/Makefile.in
index b459f9e0..0223966b 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/metadata.json
old mode 100755
new mode 100644
index 0e43fa56..5ef7d293
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/metadata.json
old mode 100755
new mode 100644
index a957497a..0f86126c
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/File_System/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/README.md
index fa41574f..11366e07 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/README.md
@@ -10,16 +10,22 @@ Sample application showing how to use GNSS functionality. Debug prints on **AUX
- How to enable GNSS receiver on module
- How to collect location information from receiver
+**Note:** on MEx10G1 product family both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
**Application workflow**
**`M2MB_main.c`**
- Open USB/UART/UART_AUX
-- Init gnss, enable position report and start it.
-- When a fix is available, a message will be printed by the GNSS callback function
+- Print a welcome message
+- Create GNSS task and send a message to it
-
+**`gps_task.c`**
+- Init Info feature and get module type
+- Init gnss, enable position/NMEA report and start it.
+- When a fix or a NMEA sentence is available, a message will be printed by the GNSS callback function
+
+
---------------------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/hdr/azx_tasks.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/hdr/azx_tasks.h
new file mode 100755
index 00000000..e392af6a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/hdr/azx_tasks.h
@@ -0,0 +1,292 @@
+/*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_TASKS_H_
+#define HDR_AZX_TASKS_H_
+/**
+ * @file azx_tasks.h
+ * @version 1.0.4
+ * @dependencies core/azx_log core/azx_utils
+ * @author Alessio Quieti
+ * @date 07/04/2018
+ *
+ * @brief Tasks related utilities
+ *
+ * Functions usable to simplify the tasks creation and usage
+ * (instead of directly using m2mb_os_q.h low level APIs, which in turn allow
+ * much greater control of the tasks)
+ *
+ * The library is modelled after the way tasks were handled in the old M2M API.
+ */
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "azx_log.h"
+
+/** @defgroup taskUsage Usage of tasks example functionalities
+ * Functions usable to simplify the tasks creation and usage
+*/
+
+/**
+ * @brief Task user callback signature
+ *
+ * This is the structure of the task user callback. Each time a message is
+ * received by an user task, a callback with this structure will be called.
+ *
+ * It is responsibility of the user to define the callback logic.
+ *
+ * @ingroup taskUsage
+ *
+ * @see azx_tasks_init()
+*/
+typedef INT32 (*USER_TASK_CB)(INT32, INT32, INT32);
+
+/** @addtogroup taskUsage
+@{ */
+
+/**
+ * @name Stack defines
+ * @brief Available ranges for tasks
+ * @{ */
+#define AZX_TASKS_MIN_STACK_SIZE 1024 /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/hdr/gnss_task.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/hdr/gnss_task.h
new file mode 100755
index 00000000..87d7919e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/hdr/gnss_task.h
@@ -0,0 +1,23 @@
+/*
+ * gps_task.h
+ *
+ * Created on: 23 apr 2021
+ * Author: robertaga
+ */
+
+#ifndef HDR_GPS_TASK_H_
+#define HDR_GPS_TASK_H_
+
+#include "m2mb_types.h"
+
+typedef enum {
+ START_GPS,
+ STOP_GPS
+
+} GPS_APP_STATUS;
+
+
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2);
+
+
+#endif /* HDR_GPS_TASK_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/metadata.json
index b57e11d4..36f2c370 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
@@ -58,6 +71,7 @@
],
"requires": {
"core/azx_log": "master",
- "core/azx_utils": "master"
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
}
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/M2MB_main.c
index 82e52bb4..3f666d76 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/M2MB_main.c
@@ -13,16 +13,16 @@
@description
Sample application showing how to use GNSS functionality. Debug prints on AUX UART
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@author
-
+ Roberta Galeazzo
@date
- 23/10/2019
+ 12/10/2021
*/
/* Include files ================================================================================*/
@@ -36,71 +36,22 @@
#include "m2mb_os_api.h"
#include "m2mb_os.h"
#include "m2mb_os_sem.h"
-#include "m2mb_gnss.h"
+
+#include "gnss_task.h"
#include "azx_log.h"
#include "azx_utils.h"
-
+#include "azx_tasks.h"
#include "app_cfg.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
+INT32 gpsTask;
-void sleep_ms(UINT32 ms)
-{
- m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
-}
-
-
-void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
-{
- locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
-
- AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
- AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
-
- AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
- AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
-
- AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
- AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
-
- AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
- AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
-
- AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
- AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
- AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
- AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
-
- AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
- AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
-
- AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
- AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
-
- return;
-}
-
-void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
-{
- (void)handle;
- (void)resp_size;
- (void)userdata;
-
- if(event == M2MB_GNSS_INDICATION_POSITION_REPORT)
- {
- printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
- }
- else
- {
- AZX_LOG_INFO("gnssCallback_test => event FAIL\r\n");
- }
-}
@@ -119,65 +70,31 @@ void M2MB_main( int argc, char **argv )
(void)argc;
(void)argv;
- void *userdata = NULL;
-
- M2MB_GNSS_HANDLE handle1;
-
- azx_sleep_ms(2000);
-
- AZX_LOG_INIT();
- AZX_LOG_INFO("Starting GNSS demo app. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
- {
- return;
- }
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
-
- AZX_LOG_INFO("m2mb_gnss_enable OK\r\n");
-
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
- {
- return;
- }
+ azx_sleep_ms(2000);
- AZX_LOG_INFO("m2mb_gnss_start OK\r\n");
+ AZX_LOG_INIT();
+ azx_tasks_init();
+ AZX_LOG_INFO("\r\nStarting GNSS demo app. This is v%s built on %s %s.\r\n\r\n",
+ VERSION, __DATE__, __TIME__);
- /*
- * System will start to execute the callback function.
- */
+ gpsTask = azx_tasks_createTask((char*) "myGPSTask", AZX_TASKS_STACK_L, 1, AZX_TASKS_MBOX_S, GPS_task);
- azx_sleep_ms(120000);
+ azx_sleep_ms(1000);
+ if (gpsTask > 0){
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+ azx_tasks_sendMessageToTask(gpsTask, START_GPS, 0, 0 );
+ AZX_LOG_TRACE("Tasks %d created!\r\n", gpsTask);
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+ } else{
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ AZX_LOG_ERROR("Cannot create tasks!\r\n");
+ return;
+ }
+ azx_sleep_ms(2000);
+
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/gnss_task.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/gnss_task.c
new file mode 100755
index 00000000..bd1d23a3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GNSS/src/gnss_task.c
@@ -0,0 +1,365 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application showing how to use GNSS functionality. Debug prints on $OUTPUT
+ @version
+ 1.0.2
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 12/10/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+#include "m2mb_os_sem.h"
+#include "m2mb_gnss.h"
+#include "m2mb_info.h"
+
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+#include "gnss_task.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define GPS_BIT (UINT32)0x1 /*0x0000000000000001*/
+
+#ifndef M2MB_GNSS_WWAN_GNSS_PRIORITY_E
+ #define GNSS_MEX10G1 0
+#else
+ #define GNSS_MEX10G1 1
+#endif
+/* Local typedefs ===============================================================================*/
+
+typedef enum{
+ MEX10C1,
+ MEX10G1,
+ LE910CX,
+ LE910CX_X,
+ NONE
+} MODULE_TYPE_E;
+
+/* Local statics ================================================================================*/
+
+void *userdata = NULL;
+
+M2MB_GNSS_HANDLE handle1;
+UINT8 priority;
+UINT32 TBF;
+UINT8 constellation;
+
+const CHAR *gnssServ[] = {"POSITION", "NMEA sentences"};
+
+M2MB_GNSS_SERVICE_E gnss_service;
+MODULE_TYPE_E moduleType;
+static M2MB_OS_EV_HANDLE gps_evHandle = NULL;
+//static UINT32 sentenceNum = 0;
+
+extern INT32 gpsTask;
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+MODULE_TYPE_E getModuleType(void)
+{
+M2MB_RESULT_E res;
+M2MB_INFO_HANDLE hInfo;
+CHAR *info;
+MODULE_TYPE_E moduleType = NONE;
+
+ res = m2mb_info_init(&hInfo);
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible init info\r\n");
+ }
+ else
+ {
+ res = m2mb_info_get(hInfo, M2MB_INFO_GET_MODEL, &info);
+
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible to get model\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("Model: %s\r\n", info);
+ if (strstr(info, "G1") != NULL)
+ {
+ AZX_LOG_TRACE("Type: %d\r\n", MEX10G1);
+ moduleType = MEX10G1;
+ }
+ else if (info[0] == 'M' && strstr(info, "C1"))
+ {
+ AZX_LOG_TRACE("type: %d\r\n", MEX10C1);
+ moduleType = MEX10C1;
+ }
+ else if ( strstr(info, "LE910C"))
+ {
+ if (info[strlen(info) -1 ] == 'X')
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX_X);
+ moduleType = LE910CX_X;
+ }
+ else
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX);
+ moduleType = LE910CX;
+ }
+ }
+ }
+ m2mb_info_deinit(hInfo);
+ }
+ return moduleType;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
+{
+ locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
+
+ AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
+ AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
+
+ AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
+ AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
+
+ AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
+ AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
+
+ AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
+ AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
+
+ AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
+ AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
+ AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
+ AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
+
+ AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
+ AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
+
+ AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
+ AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
+
+ return;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
+{
+ (void)handle;
+ (void)resp_size;
+ (void)userdata;
+ //INT32 retVal;
+
+ //AZX_LOG_DEBUG("gnssCallback[%d]\r\n", sentenceNum);
+ switch (event){
+
+ case M2MB_GNSS_INDICATION_POSITION_REPORT:
+ {
+ printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+#if GNSS_MEX10G1
+ case M2MB_GNSS_INDICATION_NMEA_REPORT:
+ {
+ AZX_LOG_INFO("NMEA: %s\r\n", (CHAR*)resp);
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+#endif
+ default:
+ AZX_LOG_WARN("unexpected event\r\n");
+ break;
+ }
+ //sentenceNum++;
+
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/***************************************************************************************************
+ GPS_task handles GPS init, configuration, start and stop
+ **************************************************************************************************/
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2){
+
+M2MB_OS_RESULT_E osRes;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+//INT32 retVal;
+#if GNSS_MEX10G1
+M2MB_RESULT_E res;
+#endif
+ (void)param1;
+ (void)param2;
+
+
+ switch(type){
+
+ case START_GPS:
+ {
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "gps_ev"));
+ osRes = m2mb_os_ev_init( &gps_evHandle, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS ){
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return -1;
+ } else {
+
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+
+ }
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable NMEA REPORT, failed!\r\n");
+ return -1;
+ }
+
+ moduleType = getModuleType();
+
+ /*this part is available ONLY for MEX10G1 products*/
+#if GNSS_MEX10G1
+ if(moduleType == MEX10G1){
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_PRIORITY, &priority);
+
+ AZX_LOG_INFO("Priority: %d\r\n", priority);
+
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_TBF, &TBF);
+ AZX_LOG_INFO("TBF: %d\r\n", TBF);
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_CONSTELLATION, &constellation);
+ AZX_LOG_INFO("constellation: %d\r\n", constellation);
+
+ /*To start getting GPS position priority MUST be set to GNSS */
+ res = m2mb_gnss_set_prio_runtime(handle1, GNSS_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to GNSS_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to GNSS_PRIORITY, start GPS\r\n");
+ }
+
+ }
+#endif
+ /*
+ * on MEX10G1 both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while
+ * on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
+ */
+
+ if(moduleType == MEX10G1){
+ //gnss_service = M2MB_GNSS_SERVICE_NMEA_REPORT; /*On MEx10G1 family NMEA report sentences can be enabled as well*/
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ } else {
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ }
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, gnss_service) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable %s REPORT, failed!\r\n", gnssServ[gnss_service]);
+ return -1;
+ }
+
+ AZX_LOG_INFO("\r\nm2mb_gnss_enable, %s OK\r\n",gnssServ[gnss_service]);
+
+
+ /*
+ * System will start to execute the callback function.
+ */
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
+ {
+ AZX_LOG_ERROR("Failed to start GPS\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("\r\nm2mb_gnss_start OK, waiting for position/nmea sentences...\r\n");
+ /*Wait for GPS fix/NMEA sentences event to occur (released in gnssCallbackFN function) */
+ m2mb_os_ev_get(gps_evHandle, GPS_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ AZX_LOG_INFO("\r\n***** Wait 120 seconds and then stop GPS *****\r\n\r\n");
+
+ azx_sleep_ms(120000);
+
+ azx_tasks_sendMessageToTask(gpsTask, STOP_GPS, 0, 0 );
+
+ }
+ break;
+
+ case STOP_GPS:
+ {
+ AZX_LOG_INFO("***** 120 seconds expired *****\r\n\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_stop fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, gnss_service ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_disable fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+
+#if GNSS_MEX10G1
+ /*Restore priority to WWAN */
+ if(moduleType == MEX10G1){
+ res = m2mb_gnss_set_prio_runtime(handle1, WWAN_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to WWAN_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to WWAN_PRIORITY, stop GPS\r\n");
+ }
+ }
+#endif
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_deinit fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ return 0;
+
+
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/metadata.json
old mode 100755
new mode 100644
index b1b1cf51..cfc78137
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/GPIO_Interrupt/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/metadata.json
old mode 100755
new mode 100644
index ab02a67b..8f676908
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/General_INFO/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/Makefile.in
index 527d0584..b7cb87ed 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/metadata.json
old mode 100755
new mode 100644
index 3747302d..060974df
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HTTP_Client/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/metadata.json
old mode 100755
new mode 100644
index 4f8edfd2..15b9cfd0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HW_Timer/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/metadata.json
old mode 100755
new mode 100644
index bf0d29f9..423336f2
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/HelloWorld/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/metadata.json
old mode 100755
new mode 100644
index 61742456..52fc9d8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/README.md
index 4391522f..88962d64 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/README.md
@@ -1,7 +1,7 @@
### I2C Combined
-Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on **AUX UART**
+Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
**Features**
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/description.txt
index da3de9d7..0121c0d4 100644
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/description.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/description.txt
@@ -1 +1 @@
-Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on AUX UART
+Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/metadata.json
old mode 100755
new mode 100644
index fbc342c8..e4331c15
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/metadata.json
@@ -11,19 +11,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -33,9 +34,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/src/M2MB_main.c
index f4fa7aeb..ed55f5cc 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/I2C_Combined/src/M2MB_main.c
@@ -11,9 +11,9 @@
@details
@description
- Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on AUX UART
+ Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -266,7 +266,7 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
M2MB_I2C_CFG_T i2c_data = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
/* Retrieve current channel config */
i2c_res = m2mb_i2c_ioctl(fd, M2MB_I2C_IOCTL_GET_CFG, (void *)&i2c_data);
@@ -291,9 +291,6 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
msgs[0].len = 2; /* How many bytes to be written: register + data*/
msgs[0].buf = i2cbuf_wr; /* Assign write buffer to message struct [0]*/
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
/* Set i2c data struct rw parameters messages pointer to msgs */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/README.md
index 89e65312..2c44024d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/README.md
@@ -21,6 +21,16 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage write, read and monitoring resources changed from the portal
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
**Application workflow**
**`M2MB_main.c`**
@@ -35,8 +45,6 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
**`msgLWM2MTask`**
- Check registration status
-- Configure APN to the correct one for CID 1
-
- Initialize LWM2M client,
- Check for XML file fo custom object
@@ -51,7 +59,9 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Wait for client to register to Portal
- - Send integer and string values
+ - Performs all operations (set, read, get, write) on the related resources
+
+ - Performs a set with notify ack enabled
- Wait for events from server
@@ -61,6 +71,15 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage events arriving from client \(operations completion status and unsolicited events\)
- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
#### Custom Object configuration
The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
@@ -86,10 +105,10 @@ Copy the xml file content and paste it in the new Object form
-Also, the application requires the XML file `/xml/object_35000.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+Also, the application requires the XML file `/xml/object_32010.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
It can be done with
-`AT#M2MWRITE=/XML/object_35000.xml,`
+`AT#M2MWRITE=/XML/object_32010.xml,`
To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
@@ -110,7 +129,14 @@ The file is successfully loaded on the module

-
+
+
+
+
+
+
+
+
After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
@@ -125,7 +151,7 @@ For example, executing the two Exec Resources at the bottom of the list, the app

-Writing a string resource (id /35000/0/11 ), the application will notify the change
+Writing a string resource (id /32010/0/11 ), the application will notify the change

diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_demo.h
index abb12868..0eb5f70e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_demo.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_demo.h
@@ -14,6 +14,7 @@
@note
Dependencies:
m2mb_types.h
+ m2mb_lwm2m.h
@author
@@ -28,9 +29,7 @@
/* Global declarations ==========================================================================*/
-/*cellular event bits*/
-#define EV_NET_BIT (UINT32)0x1
-#define EV_PDP_BIT (UINT32)0x2
+
/*LWM2M event bits*/
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
@@ -42,11 +41,90 @@
#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000100
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000200
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00001000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
#define EV_MON_URC_RECEIVED 2
#define EV_URC_TO_BE_ENABLED 3
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32010
+#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
+#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
+#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
+#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
+#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
+#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
+#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
+
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
+#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
+#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
+#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
+#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
+#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
+#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
+#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
+#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
+#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
+
+#define DEMO_STRING_W_RES_ID 41 /* single string resource, Write only*/
+#define DEMO_INT_W_RES_ID 42 /* single integer resource, Write only*/
+#define DEMO_FLOAT_W_RES_ID 43 /* single floating point resource, Write only*/
+#define DEMO_BOOL_W_RES_ID 44 /* single boolean resource, Write only*/
+#define DEMO_OPAQUE_W_RES_ID 45 /* single opaque (raw data) resource, Write only*/
+#define DEMO_TIME_W_RES_ID 46 /* single time resource, Write only*/
+#define DEMO_OBJLINK_W_RES_ID 47 /* single object link resource, Write only*/
+
+#define DEMO_MULTI_STRING_W_RES_ID 51 /* multiple string resource, Write only*/
+#define DEMO_MULTI_INT_W_RES_ID 52 /* multiple integer resource, Write only*/
+#define DEMO_MULTI_FLOAT_W_RES_ID 53 /* multiple floating point resource, Write only*/
+#define DEMO_MULTI_BOOL_W_RES_ID 54 /* multiple boolean resource, Write only*/
+#define DEMO_MULTI_OPAQUE_W_RES_ID 55 /* multiple opaque (raw data) resource, Write only*/
+#define DEMO_MULTI_TIME_W_RES_ID 56 /* multiple time resource, Write only*/
+#define DEMO_MULTI_OBJLINK_W_RES_ID 57 /* multiple object link resource, Write only*/
+
+#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
+
+
+#define OBJECT_XML_NAME "object_32010.xml"
+
/* Global typedefs ==============================================================================*/
typedef enum {
@@ -55,9 +133,9 @@ typedef enum {
APPLICATION_EXIT
} APP_STATES;
-/* Global functions =============================================================================*/
+/* Global functions =============================================================================*/
/**
@brief Initialize OneEdge connection
@@ -67,10 +145,5 @@ typedef enum {
*/
UINT8 oneedge_init( void );
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value);
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result);
-
-
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..1d975a09
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"617276d580cbbb0af346d50a","name":"LwM2M resources demo","observations":[{"objId":32010,"instId":0,"resId":2}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/metadata.json
index fc023cfa..3562cf60 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/metadata.json
@@ -6,37 +6,47 @@
"homepage": "https://www.telit.com/",
"keywords": [
"IoT AppZone",
- "LwM2M"
+ "LwM2M",
+ "OneEdge"
],
"availability": {
"MXXXXC1": {
"firmwares": [
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
- "firmwares": [
- "25.30.xx1",
- "25.30.xx2"
- ]
+ "firmwares": []
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c
index f511c74a..dac0a7c3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -75,11 +75,7 @@ void M2MB_main( int argc, char **argv )
AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_demo.c
index 764c7cb3..ff66f157 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_demo.c
@@ -10,8 +10,8 @@
@details
- @version
- 1.0.2
+ @version
+ 1.0.4
@note
@@ -46,70 +46,12 @@
#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
/* Local defines ================================================================================*/
-#define APN "web.omnitel.it"
#define CTX_ID 1 /*PDP context ID*/
-/*OBJECTs and RESOURCEs IDs*/
-#define DEVICE_OBJ_ID 3
-#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
-
-
-#define LOCATION_OBJ_ID 6
-#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
-#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
-
-#define CONN_STATS_OBJ_ID 7
-#define CONN_STATS_STOP_EXEC_RES_ID 7
-#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
-
-#define APN_CONN_PROFILE_OBJ_ID 11
-#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
-
-#define M2MB_LWM2M_DEMO_OBJ_ID 35000
-#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
-#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
-#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
-#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
-#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
-#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
-#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
-
-#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
-#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
-#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
-#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
-#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
-#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
-#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
-
-#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
-#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
-#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
-#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
-#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
-#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
-#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
-
-#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
-#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
-#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
-#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
-#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
-#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
-#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
-
-#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
-#define DEMO_EXEC2_RES_ID 102 /* execute resource 2*/
-
-
-#define OBJECT_XML_NAME "object_35000.xml"
-
-
-
-
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
@@ -135,24 +77,17 @@ const char *CL_STATUS_STRING[] =
"M2MB_LWM2M_CL_STATE_SUSPENDED"
};
-
-M2MB_OS_EV_HANDLE net_pdp_evHandle = NULL;
-
-static M2MB_PDP_HANDLE pdpHandle = NULL;
-
static INT8 lwm2m_taskID;
/*===== ONEEDGE =====*/
/*Handles*/
static M2MB_LWM2M_HANDLE lwm2mHandle;
-static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
/*URI objects*/
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
- 33211, 0,
- 0,1};
+ 33211, 0, 0, 1};
/* Local function prototypes ====================================================================*/
@@ -186,57 +121,46 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz)
/* Static functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
(void) param2;
- MEM_W data_buffer[256] = {0};
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
INT32 data_int = 0;
- UINT32 data_time = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
double data_float = 0;
- M2MB_RESULT_E retVal;
+
+ INT32 retVal;
M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
M2MB_LWM2M_OBJ_URI_T uri = *pUri;
- M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
m2mb_os_free(pUri);
uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
switch(event)
{
- case EV_MON_URC_RECEIVED:
+ case EV_MON_URC_RECEIVED:
AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
-
- memset(data_buffer,0,sizeof(data_buffer));
- retVal = m2mb_lwm2m_read( lwm2mHandle, &(uri), data_buffer, sizeof(data_buffer));
-
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "LWM2M read request succeeded\r\n" );
- }
- else
- {
- AZX_LOG_ERROR("Read request failed\r\n");
- return retVal;
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
{
switch(uri.resource)
@@ -253,16 +177,21 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_STRING_RW_RES_ID:
/*fallback*/
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_STRING;
AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- data_buffer );
-
+ string_buffer );
break;
-
-
/* ==================
*
* INTEGER TYPES
@@ -277,13 +206,14 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = (INT32) ( (INT32 *)data_buffer )[0];
-
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_int);
-
break;
/* ==================
@@ -300,13 +230,16 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
- /*Cast the data buffer as an integers array and take the first element*/
- data_float = (double) ( (double *)data_buffer )[0];
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_float );
-
break;
@@ -321,15 +254,15 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_BOOL_RW_RES_ID:
/*fallback*/
- /*Store data_type for further management*/
- data_type = M2MB_LWM2M_DATA_TYPE_BOOLEAN;
-
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = !!((INT32) ( (INT32 *)data_buffer )[0]);
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- (data_int>0)? "true":"false");
+ (data_bool)? "true":"false");
break;
@@ -348,13 +281,17 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_TIME;
- /*Cast the data buffer as an integers array and take the first element*/
- data_time = (INT32) ( (INT32 *)data_buffer )[0];
- convertUnixTimeToRTC_TIME((time_t) (data_time), &time_struct, 0);
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
- AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %d"
- "(%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_time,
time_struct.year, time_struct.mon, time_struct.day,
@@ -375,16 +312,151 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
/*fallback*/
int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+
+
+
+ /* *************************
+ *
+ * WRITE ONLY TYPES
+ *
+ * *************************/
+
+ case DEMO_STRING_W_RES_ID:
+ case DEMO_MULTI_STRING_W_RES_ID:
+ /*fallback*/
+
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = get_write_only_string_resource(lwm2mHandle, &(uri), string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ case DEMO_INT_W_RES_ID:
+ case DEMO_MULTI_INT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = get_write_only_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ case DEMO_FLOAT_W_RES_ID:
+ case DEMO_MULTI_FLOAT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = get_write_only_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+ case DEMO_BOOL_W_RES_ID:
+ case DEMO_MULTI_BOOL_W_RES_ID:
+ /*fallback*/
+
+ retVal = get_write_only_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+ break;
+
+ case DEMO_TIME_W_RES_ID:
+ case DEMO_MULTI_TIME_W_RES_ID:
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = get_write_only_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ break;
+
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,data_size);
+ retVal = get_write_only_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
- AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content:\r\n",
- uri.obj, uri.objInst, uri.resource, uri.resourceInst);
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
- for (i=0; i < (int)(sizeof(data_buffer) / sizeof(data_buffer[0])); i++)
+ for (i=0; i < data_size; i++)
{
- AZX_LOG_INFO("%02X ", data_buffer[i]);
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
}
AZX_LOG_INFO("\r\n");
}
@@ -413,13 +485,23 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
return 1;
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
( void ) h;
( void ) resp_size;
- ( void ) userdata;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
/* Client generated events */
switch( event )
@@ -432,11 +514,35 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_INFO( "LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -448,11 +554,12 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -461,20 +568,22 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
case M2MB_LWM2M_READ_RES:
{
M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
- AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
- AZX_LOG_DEBUG("Read type: %d; size: %u\r\n",
- resp->resType,
- resp->len
- );
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -486,14 +595,50 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
}
else
{
- AZX_LOG_WARN( "Enable write %d\r\n", resp->result );
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
}
break;
}
+
/* event in response to m2mb_lwm2m_new_inst() */
case M2MB_LWM2M_NEW_INST_RES:
{
@@ -541,7 +686,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
case M2MB_LWM2M_CL_STATE_REGISTERED:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
break;
case M2MB_LWM2M_CL_STATE_DEREGISTERING:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
@@ -587,6 +732,68 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
}
+ case M2MB_LWM2M_NFYACK_URI_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_uri */
+ M2MB_LWM2M_NFYACK_URI_RES_T *resp = ( M2MB_LWM2M_NFYACK_URI_RES_T * )resp_struct;
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_uri response OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_STATUS_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_status */
+ M2MB_LWM2M_NFYACK_STATUS_RES_T *resp = ( M2MB_LWM2M_NFYACK_STATUS_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "Current status for Notify Ack reporting is %s\r\n\r\n", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_LIST_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_list */
+ M2MB_LWM2M_NFYACK_LIST_RES_T *resp = ( M2MB_LWM2M_NFYACK_LIST_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_LIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_INFO_IND:
+ {
+ /* event that brings a Notify Ack information */
+ M2MB_LWM2M_NFYACK_INFO_IND_T *pInfo = ( M2MB_LWM2M_NFYACK_INFO_IND_T * )resp_struct;
+
+ if( pInfo )
+ {
+ AZX_LOG_TRACE( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s\r\n",
+ pInfo->agent,
+ pInfo->shServerId,
+ pInfo->uri.obj,
+ pInfo->uri.objInst,
+ pInfo->uri.resource,
+ ( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
+
+ if(pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
case M2MB_LWM2M_SESSION_INFO_IND:
{
AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
@@ -606,9 +813,6 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC1_RES_ID);
break;
- case DEMO_EXEC2_RES_ID:
- AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC2_RES_ID);
- break;
default:
AZX_LOG_WARN("\r\nUnexpected exec resource URI {%u/%u/%u/%u (%u)}!\r\n",
execUri.obj, execUri.objInst, execUri.resource, execUri.resourceInst, execUri.uriLen );
@@ -634,7 +838,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -650,18 +854,24 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
{
AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
-
default:
AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
break;
}
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
static int check_xml_file(const char* name)
{
char path[64] = {0};
@@ -692,7 +902,16 @@ static int check_xml_file(const char* name)
}
}
-//strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&now)
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
{
struct tm *_utctime = NULL;
@@ -717,279 +936,47 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT
}
-
/* Global functions =============================================================================*/
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value)
+
+UINT8 oneedge_init( void)
{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- value);
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
}
- else
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- value);
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
}
- M2MB_RESULT_E retVal = m2mb_lwm2m_set( h, pUri, &value, sizeof(int));
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M set timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-INT32 write_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
-{
- UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
- {
- AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to %s on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- data);
- }
- else
- {
- AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- data);
- }
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, data, strlen(data));
-
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M write timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result)
-{
- int data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for integer from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%d> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result)
-{
- double data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for double from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%f> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-
-
-void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
-{
- (void)resp_size;
- (void)myUserdata;
-
- M2MB_NET_REG_STATUS_T *stat_info;
-
- switch (net_event)
- {
-
-
-
- case M2MB_NET_GET_REG_STATUS_INFO_RESP:
- stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
- if (stat_info->stat == 1 || stat_info->stat == 5)
- {
- AZX_LOG_TRACE("Module is registered to cell 0x%X!\r\n", stat_info->cellID);
- m2mb_os_ev_set(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- m2mb_net_get_reg_status_info(h); //try again
- }
- break;
-
-
- default:
- AZX_LOG_DEBUG("unexpected net_event: %d\r\n", net_event);
- break;
-
- }
-}
-
-void PdpCallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
-{
- (void)userdata;
- struct M2MB_SOCKET_BSD_SOCKADDR_IN CBtmpAddress;
- CHAR CBtmpIPaddr[32];
-
- switch (pdp_event)
- {
- case M2MB_PDP_UP:
- AZX_LOG_DEBUG ("Context activated!\r\n");
- m2mb_pdp_get_my_ip(h, cid, M2MB_PDP_IPV4, &CBtmpAddress.sin_addr.s_addr);
- m2mb_socket_bsd_inet_ntop( M2MB_SOCKET_BSD_AF_INET, &CBtmpAddress.sin_addr.s_addr, ( CHAR * )&( CBtmpIPaddr ), sizeof( CBtmpIPaddr ) );
- AZX_LOG_TRACE( "IP address: %s\r\n", CBtmpIPaddr);
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_SET);
- break;
-
- case M2MB_PDP_DOWN:
- AZX_LOG_TRACE ("Context deactivated!\r\n");
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_CLEAR);
- break;
- default:
- AZX_LOG_DEBUG("unexpected pdp_event: %d\r\n", pdp_event);
- break;
-
- }
-}
-
-UINT8 oneedge_init( void)
-{
- M2MB_RESULT_E retVal;
- M2MB_LWM2M_ENABLE_REQ_T pars;
-
- INT32 service_enable = 1;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
- UINT32 curEvBits;
-
-
- if(0 != check_xml_file(OBJECT_XML_NAME))
- {
- AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
- return 1;
- }
-
-
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
- osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
-
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
-
- //get the handle of the lwm2m client on _h
- retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )NULL );
-
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- return 1;
- }
-
- retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
-
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
}
lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_S, lwm2m_taskCB);
@@ -998,7 +985,6 @@ UINT8 oneedge_init( void)
if(lwm2m_taskID <= 0)
{
AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
@@ -1014,12 +1000,11 @@ UINT8 oneedge_init( void)
if( retVal != M2MB_RESULT_SUCCESS )
{
AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_ENABLE_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1028,40 +1013,80 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
azx_sleep_ms(2000);
m2mb_lwm2m_deinit(lwm2mHandle);
return 1;
}
-
-
azx_sleep_ms(1000);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ /* query of the custom object URI for agent 0 (Telit)*/
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_R_RES_ID;
+ exist_uri.resourceInst = 0;
- /*Create an instance of the demo's custom object*/
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
- M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
- new_inst_params.agent = 0; /*Telit Agent*/
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
- /*If OK the instance was not present, and so it was created. If an error
- is received in the callback, it is likely because the instance already exists. */
- retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
- if( retVal != M2MB_RESULT_SUCCESS )
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
{
- AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
}
}
+
/*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
{
M2MB_LWM2M_MON_REQ_T mon;
@@ -1082,7 +1107,7 @@ UINT8 oneedge_init( void)
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_MON_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1091,7 +1116,7 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1101,11 +1126,11 @@ UINT8 oneedge_init( void)
}
AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1116,6 +1141,8 @@ UINT8 oneedge_init( void)
return 0;
}
+/*-----------------------------------------------------------------------------------------------*/
+
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
{
@@ -1123,104 +1150,22 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
(void)param1;
(void)param2;
- M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle = NULL;
UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_OBJ_URI_T resource_uri = {0};
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- M2MB_NET_HANDLE netHandle = NULL;
INT32 ret = 0;
+ M2MB_RTC_TIMEVAL_T currTime = {1234567890, 0}; /*dummy value as fallback*/
+ INT32 rtcfd = -1;
int task_status = type;
- void *myUserdata = NULL;
do
{
AZX_LOG_INFO("Initializing resources...\r\n");
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
- osRes = m2mb_os_ev_init( &net_pdp_evHandle, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
- task_status = APPLICATION_EXIT;
- break;
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- /* check network registration and configure PDP context */
- retVal = m2mb_net_init(&netHandle, NetCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- AZX_LOG_TRACE("Waiting for registration...\r\n");
-
- retVal = m2mb_net_get_reg_status_info(netHandle);
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- /*Wait for network registration event to occur (released in NetCallback function) */
- m2mb_os_ev_get(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
-
-
-
- AZX_LOG_TRACE("PDP context initialization\r\n");
- retVal = m2mb_pdp_init(&pdpHandle, PdpCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- /*
- * Just set the APN, as LwM2M agent will automatically manage the connection.
- * !! This could require a reboot if LTE networks are in use !!
- *
- * */
- retVal = m2mb_pdp_APN_set( pdpHandle, 1 /*LWM2M uses CID 1 by default*/, (char*)APN );
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_APN_set returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_APN_set did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- m2mb_pdp_deinit(pdpHandle);
-
-
+ init_sync();
azx_sleep_ms(8000);
@@ -1232,15 +1177,20 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
break;
}
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1){
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ } else {
- AZX_LOG_INFO("\r\nWaiting for events from portal. Write on monitored resource or call an exec\r\n\r\n");
+ AZX_LOG_ERROR("Cannot open RTC!");
+ }
/*Checking client status*/
m2mb_lwm2m_get_stat(lwm2mHandle);
if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_GET_STAT_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1251,12 +1201,17 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
return -2;
}
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
/* ==================================================
- * Sending a read only resource with a SET operation
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
resource_uri.resource = DEMO_INT_R_RES_ID;
@@ -1264,8 +1219,23 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 50);
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
* Filling resource URI with required parameters (multi instance read only integer, in this case)
@@ -1278,6 +1248,7 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 10);
+ azx_sleep_ms(5000);
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
@@ -1288,47 +1259,768 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 11);
+ azx_sleep_ms(5000);
-
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
- * Sending a string resource with a WRITE operation
+ * Sending a read only float resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only double, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
- resource_uri.resource = DEMO_STRING_RW_RES_ID;
- resource_uri.resourceInst = 0;
+ resource_uri.resource = DEMO_FLOAT_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- write_string_resource(lwm2mHandle, &resource_uri, (CHAR *)"demo_string");
+ set_read_only_double_resource(lwm2mHandle, &resource_uri, 20.5);
- while(1)
{
- /*Wait*/
- azx_sleep_ms(1000);
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
}
- task_status = APPLICATION_EXIT;
- } while(0);
- if (task_status == APPLICATION_EXIT)
- {
- if(pdpHandle)
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only boolean resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ set_read_only_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+
+ /* ==================================================
+ * Sending a read only timestamp resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only timestamp, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = (UINT64)currTime.sec;
+ //m2mb_lwm2m_set(lwm2mHandle, &resource_uri, &value, sizeof(value));
+ set_read_only_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+ /*Try and read again the set value*/
+ value = 0;
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a read only opaque resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ set_read_only_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only string resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ set_read_only_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /*------------------------ RW ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-WRITE RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a r/w integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a r/w boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+
+ /*------------------------ Write-only ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "WRITE-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a write-only integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(get_write_only_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(get_write_only_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a write-only boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(get_write_only_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(get_write_only_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(get_write_only_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(get_write_only_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nResources operations examples done.\r\n"
+ "-----------------------------------\r\n");
+
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nWill perform a SET with notify ACK enabled.\r\n"
+ "-----------------------------------\r\n");
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = 0;
+ resource_uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_INFO("Enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* setting the status to ENABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, TRUE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ azx_sleep_ms(2000);
+
+ /* ==================================================
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /* Setting a different value on this resource so the notification will be sent to the server */
+ set_read_only_integer_resource(lwm2mHandle, &resource_uri, 60);
+ {
+
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(30000) /*wait 30 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("lwm2m notify ack timeout!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nACK received from server!\r\n");
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+ }
+ }
+
+ AZX_LOG_INFO("\r\nDisable notify ack\r\n");
+ /* setting the status to DISABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, FALSE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
{
- m2mb_pdp_deinit(pdpHandle);
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
}
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ AZX_LOG_INFO("Done.\r\n");
- if(netHandle)
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+
+ while(1)
{
- m2mb_net_deinit(netHandle);
+ /*Wait*/
+ azx_sleep_ms(10000);
}
+ task_status = APPLICATION_EXIT;
+ } while(0);
- if(net_pdp_evHandle)
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
{
- m2mb_os_ev_deinit(net_pdp_evHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
}
+ deinit_sync();
+ if (rtcfd != -1)
+ {
+ m2mb_rtc_close(rtcfd);
+ }
AZX_LOG_DEBUG("Application complete.\r\n");
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_utils.c
new file mode 100755
index 00000000..cd2c7249
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/src/lwm2m_utils.c
@@ -0,0 +1,922 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Get - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_R_RES_ID:
+ case DEMO_OPAQUE_RW_RES_ID:
+ case DEMO_MULTI_OPAQUE_R_RES_ID:
+ case DEMO_MULTI_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_35000.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_32010.xml
similarity index 69%
rename from LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_35000.xml
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_32010.xml
index 1fc773af..f90edc57 100755
--- a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_35000.xml
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M/xml/object_32010.xml
@@ -3,8 +3,8 @@
m2mb lwm2m demo
object related to all OMA types resources usable in demos
- 35000
- urn:oma:lwm2m:x:35000
+ 32010
+ urn:oma:lwm2m:x:32010
1.0
1.0
Single
@@ -73,7 +73,7 @@
-
Read Only Objlnk
R
- Multiple
+ Single
Mandatory
Objlnk
@@ -82,7 +82,7 @@
- -
+
-
Read Write String
RW
Single
@@ -145,7 +145,7 @@
-
Read Write Objlnk
RW
- Multiple
+ Single
Mandatory
Objlnk
@@ -298,28 +298,159 @@
- -
-
Executable 1
- E
+ -
+
Write Only String
+ W
Single
Mandatory
-
+ String
-
- -
-
Executable 2
- E
+ -
+
Write Only Integer
+ W
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only Float
+ W
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only Boolean
+ W
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only Opaque
+ W
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only Time
+ W
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only Objlnk
+ W
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Write Only MultiInstance String
+ W
Multiple
Mandatory
+ String
+
+
+
+
+ -
+
Write Only MultiInstance Integer
+ W
+ Multiple
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only MultiInstance Float
+ W
+ Multiple
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only MultiInstance Boolean
+ W
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only MultiInstance Opaque
+ W
+ Multiple
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only MultiInstance Time
+ W
+ Multiple
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only MultiInstance Objlnk
+ W
+ Multiple
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Executable
+ E
+ Single
+ Mandatory
-
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/Makefile.in
new file mode 100755
index 00000000..89c90dd2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_AUX_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/README.md
similarity index 60%
rename from LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/README.md
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/README.md
index c83a277e..ab5c8f11 100755
--- a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/README.md
@@ -1,7 +1,7 @@
-### LWM2M
+### LWM2M OBJ_GET AND OBJ_SET
-Sample application showcasing LWM2M client usage with M2MB API. Debug prints on **MAIN UART**
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on **AUX UART**
**Features**
@@ -11,16 +11,24 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Create an instance of a custom object
-- Set an integer value on a read only resource
+- Create a Json string
-- Set two integer values on a multi-instance read only resource
+- Set string, integer, float, boolean, timestamp and opaque values with `m2mb_lwm2m_objset`
-- write a string on a read/write resource
-
-- Manage exec requests from the portal
+- Get all resources values with `m2mb_lwm2m_objget`
- Manage write, read and monitoring resources changed from the portal
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
**Application workflow**
**`M2MB_main.c`**
@@ -35,24 +43,22 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
**`msgLWM2MTask`**
- Check registration status
-- Configure APN to the correct one for CID 1
-
-- Initialize LWM2M client,
+- Initialize LWM2M client,
- Check for XML file fo custom object
-
+
- Enable unsolicited messages from client
-
+
- Create a task \(lwm2m_taskCB is its callback function \)to manage events from Portal
-
+
- Enable LwM2M client
-
+
- Create a new instance for the custom object
-
+
- Wait for client to register to Portal
-
- - Send integer and string values
-
+
+ - Performs obj_set and obj_get operations on the related resources
+
- Wait for events from server
@@ -61,6 +67,15 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage events arriving from client \(operations completion status and unsolicited events\)
- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
#### Custom Object configuration
The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
@@ -86,10 +101,10 @@ Copy the xml file content and paste it in the new Object form
-Also, the application requires the XML file `/xml/object_35000.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
-It can be done with
+Also, the application requires the XML file `/xml/object_32011.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+It can be done with
-`AT#M2MWRITE=/XML/object_35000.xml,`
+`AT#M2MWRITE=/XML/object_32011.xml,`
To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
@@ -110,24 +125,20 @@ The file is successfully loaded on the module

-
+
+
+
-After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
-
-
-An instance of the object will be present and the resources can be modified.
-
-
-For example, executing the two Exec Resources at the bottom of the list, the application will react accordingly:
+After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
-
+
-Writing a string resource (id /35000/0/11 ), the application will notify the change
+An instance of the object will be present and the resources can be modified.
-
+
---------------------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
new file mode 100755
index 00000000..cccb3c54
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
@@ -0,0 +1,89 @@
+/*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.3
+ * @dependencies core/azx_log
+ * @author Ioannis Demetriou
+ * @author Sorin Basca
+ * @date 10/02/2019
+ *
+ * @brief Various helpful utilities
+ */
+#include "m2mb_types.h"
+#include "azx_log.h"
+
+
+/**
+ * @brief Limits a value to a certain interval
+ *
+ * This is defined as a macro so it works with any types that support ordering.
+ *
+ * @param val The value to limit
+ * @param min The minimum allowed value
+ * @param max The maximum allowed value
+ *
+ * @return The original value if it was inside the limits, or min, or max, if it was less than, or
+ * greater than the limits.
+ */
+#define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/description.txt
new file mode 100644
index 00000000..9d8be75b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/description.txt
@@ -0,0 +1 @@
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on AUX UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
new file mode 100755
index 00000000..9bfb403a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
@@ -0,0 +1,103 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.h
+
+ @brief
+ demo related definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author
+
+
+ @date
+ 22/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_DEMO_H_
+#define HDR_LWM2M_DEMO_H_
+
+
+/* Global declarations ==========================================================================*/
+
+
+/*LWM2M event bits*/
+#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_OBJGET_RES_BIT (UINT32)0x00100000
+#define EV_LWM2M_OBJSET_RES_BIT (UINT32)0x00200000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
+#define EV_MON_URC_RECEIVED 2
+#define EV_URC_TO_BE_ENABLED 3
+
+
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32011
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+
+#define OBJECT_XML_NAME "object_32011.xml"
+
+
+/* Global typedefs ==============================================================================*/
+typedef enum {
+ INIT=0,
+
+ APPLICATION_EXIT
+} APP_STATES;
+
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Initialize OneEdge connection
+ @param[in] obj_id Object ID to be used for initialization
+ @return result of initialization
+
+*/
+UINT8 oneedge_init( void );
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
+#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..d69e680b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"619e27be14c97817d38a452c","name":"LwM2M resources objset - objget demo","observations":[{"objId":32011,"instId":0}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/metadata.json
new file mode 100755
index 00000000..e41eab0c
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/metadata.json
@@ -0,0 +1,65 @@
+{
+ "name": "Sample App for LwM2M with OBJSET and OBJGET calls",
+ "type": "sample-app",
+ "description": "A sample app that shows LwM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "LwM2M",
+ "OneEdge"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": []
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Alessio Quieti",
+ "email": "alessio.quieti@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
+ }
+}
diff --git a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
similarity index 74%
rename from LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
index e1c1442a..fb1589b9 100755
--- a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -9,11 +9,11 @@
The file contains the main user entry point of Appzone
@details
-
+
@description
- Sample application showcasing LWM2M client usage with M2MB API. Debug prints on USB0
- @version
- 1.0.1
+ Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on AUX UART
+ @version
+ 1.0.0
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -22,7 +22,7 @@
@date
- 27/05/2020
+ 22/11/2021
*/
/* Include files ================================================================================*/
@@ -62,7 +62,7 @@ void M2MB_main( int argc, char **argv )
{
(void)argc;
(void)argv;
-
+
INT32 taskID;
azx_tasks_init();
@@ -72,21 +72,16 @@ void M2MB_main( int argc, char **argv )
/*SET output channel */
AZX_LOG_INIT();
- AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
+ AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources objset - objget demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
AZX_LOG_TRACE("Task ID: %d.\r\n", taskID);
-
+
azx_sleep_ms(1000);
-
+
if (taskID > 0)
{
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
new file mode 100755
index 00000000..d453b7c5
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
@@ -0,0 +1,1111 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.c
+
+ @brief
+ The file contains the LWM2M utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+ Alessio Quieti
+
+ @date
+ 22/11/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_net.h"
+#include "m2mb_pdp.h"
+#include "m2mb_socket.h"
+
+#include "m2mb_fs_stdio.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+/* Local defines ================================================================================*/
+#define CTX_ID 1 /*PDP context ID*/
+
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+const char *IF_STATUS_STRING[] = { "M2MB_LWM2M_IF_STATE_NONE",
+ "M2MB_LWM2M_IF_STATE_DISABLED", "M2MB_LWM2M_IF_STATE_ACK_WAIT",
+ "M2MB_LWM2M_IF_STATE_ACTIVE", "M2MB_LWM2M_IF_STATE_IDLE",
+ "M2MB_LWM2M_IF_STATE_DEREG_WAIT", "M2MB_LWM2M_IF_STATE_DEREGISTERING" };
+
+const char *CL_STATUS_STRING[] = { "M2MB_LWM2M_CL_STATE_DISABLED",
+ "M2MB_LWM2M_CL_STATE_BOOTSTRAPPING", "M2MB_LWM2M_CL_STATE_BOOTSTRAPPED",
+ "M2MB_LWM2M_CL_STATE_REGISTERING", "M2MB_LWM2M_CL_STATE_REGISTERED",
+ "M2MB_LWM2M_CL_STATE_DEREGISTERING", "M2MB_LWM2M_CL_STATE_SUSPENDED" };
+
+static INT8 lwm2m_taskID;
+
+/*===== ONEEDGE =====*/
+
+/*Handles*/
+static M2MB_LWM2M_HANDLE lwm2mHandle;
+
+/*URI objects*/
+
+static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
+ 33211, 0, 0, 1};
+
+/* Local function prototypes ====================================================================*/
+
+static INT32 lwm2m_taskCB( INT32 event, INT32 info, INT32 param2);
+
+/**
+ @brief Callback function for Client generated LWM2M events
+
+ WARNING: do not place blocking action within callback, since it is issued by the agent's task!!
+
+ @param[in] h LWM2M handle
+ @param[in] event Event Identification
+ @param[in] resp_size Size of the response buffer
+ @param[in] resp_struct Address of response buffer
+ @param[in] userdata Address of user data
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event,
+ UINT16 resp_size, void *resp_struct, void *userdata );
+
+
+/*!
+ * @brief Check existence of XML object description file in XML directory
+ *
+ * @param[in] name Name of the file to be checked
+ * @retval 0 if OK, other values error
+ *
+ */
+static int check_xml_file(const char* name);
+
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz);
+
+/* Static functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
+static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
+{
+ (void) param2;
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
+ INT32 data_int = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
+ double data_float = 0;
+
+
+ INT32 retVal;
+ M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
+ M2MB_LWM2M_OBJ_URI_T uri = *pUri;
+
+
+
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
+
+ m2mb_os_free(pUri);
+
+ uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
+ switch(event)
+ {
+ case EV_MON_URC_RECEIVED:
+
+ AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+
+ if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
+ {
+ switch(uri.resource)
+ {
+
+ /* ==================
+ *
+ * STRING TYPES
+ *
+ * ==================*/
+ case DEMO_STRING_RW_RES_ID:
+ case DEMO_MULTI_STRING_RW_RES_ID:
+ /*fallback*/
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ /* ==================
+ *
+ * INTEGER TYPES
+ *
+ * ==================*/
+ case DEMO_INT_RW_RES_ID:
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ /* ==================
+ *
+ * FLOAT TYPES
+ *
+ * ==================*/
+ case DEMO_FLOAT_RW_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+
+ /* ==================
+ *
+ * BOOLEAN TYPES
+ *
+ * ==================*/
+ case DEMO_BOOL_RW_RES_ID:
+ case DEMO_MULTI_BOOL_RW_RES_ID:
+ /*fallback*/
+
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+
+ break;
+
+ /* ==================
+ *
+ * TIME TYPES
+ *
+ * ==================*/
+ case DEMO_TIME_RW_RES_ID:
+ {
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ }
+ break;
+
+
+ /* ==================
+ *
+ * OPAQUE TYPES
+ *
+ * ==================*/
+ case DEMO_OPAQUE_RW_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+ break;
+
+ default:
+ AZX_LOG_WARN("\r\nUnexpected resource URI {%u/%u/%u/%u (%u)}!\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+ break;
+ } /* switch(uri.resource) */
+
+ AZX_LOG_TRACE("Data type: %d\r\n", data_type);
+ }
+ else
+ {
+ AZX_LOG_WARN("Unexpected object ID %u\r\n", uri.obj);
+ }
+
+ break;
+
+ default:
+ AZX_LOG_WARN("Unmanaged task event %d\r\n", event);
+ break;
+ } /* switch(event) */
+
+ return 1;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
+ void *userdata )
+{
+ ( void ) h;
+ ( void ) resp_size;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
+
+ /* Client generated events */
+ switch( event )
+ {
+
+ /* event in response to m2mb_lwm2m_enable() */
+ case M2MB_LWM2M_ENABLE_RES:
+ {
+ M2MB_LWM2M_ENABLE_RES_T *resp = ( M2MB_LWM2M_ENABLE_RES_T * ) resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_INFO( "LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_set() */
+ case M2MB_LWM2M_SET_RES:
+ {
+ M2MB_LWM2M_SET_RES_T *resp = ( M2MB_LWM2M_SET_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_read() */
+ case M2MB_LWM2M_READ_RES:
+ {
+ M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_write() */
+ case M2MB_LWM2M_WRITE_RES:
+ {
+ M2MB_LWM2M_WRITE_RES_T *resp = ( M2MB_LWM2M_WRITE_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
+ }
+ else
+ {
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_new_inst() */
+ case M2MB_LWM2M_NEW_INST_RES:
+ {
+ // event in response to the m2mb_lwm2m_newinst
+ M2MB_LWM2M_NEW_INST_RES_T *resp = ( M2MB_LWM2M_NEW_INST_RES_T * )resp_struct;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+ AZX_LOG_TRACE( "New Instance created successfully\r\n" );
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_DEBUG( "New instance creation not allowed (already present?)\r\n" );
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance failed. Result: %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SRV_INFO_IND:
+ {
+
+ M2MB_LWM2M_SRV_INFO_IND_T *resp = ( M2MB_LWM2M_SRV_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND, resp->info = %d\r\n", resp->info);
+
+ switch(resp->info)
+ {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_SUSPENDED\r\n" );
+ break;
+ default:
+ AZX_LOG_WARN( "resp->info: unexpected value!! %d\r\n", resp->info);
+ break;
+ }
+ break;
+ }
+
+ /* event in case a resource changed (if monitoring is enabled) */
+ case M2MB_LWM2M_MON_INFO_IND:
+ {
+ /*
+ An URC was received, like
+ #LWM2MMON: UPD,"/3311/x/5850/0
+ */
+ /* event that brings a resource change information */
+ M2MB_LWM2M_OBJ_URI_T * p_uri = (M2MB_LWM2M_OBJ_URI_T *)m2mb_os_malloc(sizeof(M2MB_LWM2M_OBJ_URI_T));
+
+ M2MB_LWM2M_MON_INFO_IND_T *pInfo = ( M2MB_LWM2M_MON_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("\r\nM2MB_LWM2M_MON_INFO_IND\r\n");
+
+ if(p_uri)
+ {
+ memcpy(p_uri, &(pInfo->uri), sizeof(M2MB_LWM2M_OBJ_URI_T));
+ AZX_LOG_INFO( "\r\nResource /%u/%u/%u/%u changed!\r\n",
+ p_uri->obj, p_uri->objInst,
+ p_uri->resource, p_uri->resourceInst
+ );
+
+ azx_tasks_sendMessageToTask( lwm2m_taskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
+
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ M2MB_LWM2M_MON_RES_T *resp = ( M2MB_LWM2M_MON_RES_T * )resp_struct;
+ AZX_LOG_TRACE( "Resource change monitor setting result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ M2MB_LWM2M_GET_STAT_RES_T *resp = ( M2MB_LWM2M_GET_STAT_RES_T * )resp_struct;
+
+ AZX_LOG_TRACE( "Get Stat result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
+ IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_OBJSET_RES:
+ {
+ M2MB_LWM2M_OBJSET_RES_T *resp = (M2MB_LWM2M_OBJSET_RES_T *) resp_struct;
+
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+
+ case M2MB_LWM2M_OBJGET_RES:
+ {
+ M2MB_LWM2M_OBJGET_RES_T *resp = (M2MB_LWM2M_OBJGET_RES_T *) resp_struct;
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_TRACE("objGet string <%s>\r\n", resp->dataString);
+ AZX_LOG_TRACE("objGet string size <%d>\r\n", resp->dataStringSize);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ default:
+ AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
+static int check_xml_file(const char* name)
+{
+ char path[64] = {0};
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+
+ AZX_LOG_TRACE("Looking for <%s> file..\r\n", path);
+
+ if(0 == m2mb_fs_stat(path, &info))
+ {
+ AZX_LOG_TRACE("File is present.\r\n");
+ return 0;
+ }
+ else
+ {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if(last_errno == M2MB_FS_ENOENT)
+ {
+ AZX_LOG_WARN("File %s not found.\r\n", path);
+ return -1;
+ }
+ else
+ {
+ AZX_LOG_ERROR("error with m2mb_fs_stat, errno is: %d\r\n", last_errno);
+ return -2;
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
+{
+ struct tm *_utctime = NULL;
+
+ if(!p_rtc_time)
+ {
+ return;
+ }
+
+ memset(p_rtc_time,0,sizeof(M2MB_RTC_TIME_T));
+ _utctime = gmtime((const time_t *)&t);
+ if(_utctime)
+ {
+ p_rtc_time->year = _utctime->tm_year + 1900;
+ p_rtc_time->mon = _utctime->tm_mon + 1;
+ p_rtc_time->day = _utctime->tm_mday;
+ p_rtc_time->hour = _utctime->tm_hour;
+ p_rtc_time->min = _utctime->tm_min;
+ p_rtc_time->sec = _utctime->tm_sec;
+ p_rtc_time->tz = tz;
+ }
+}
+
+
+/* Global functions =============================================================================*/
+
+UINT8 oneedge_init( void)
+{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
+ {
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
+ }
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
+ }
+
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
+
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_M, lwm2m_taskCB);
+
+ AZX_LOG_TRACE("Task ID: %d.\r\n", lwm2m_taskID);
+ if(lwm2m_taskID <= 0)
+ {
+ AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ pars.apnclass = CTX_ID; /*CID*/
+ pars.guardRequestEventSecs = 5;
+ pars.guardReleaseEventSecs = 5;
+ pars.commandType = M2MB_LWM2MENA_CMD_TYPE_SET;
+ pars.mode = M2MB_LWM2M_MODE_NO_ACK;
+
+ retVal = m2mb_lwm2m_enable( lwm2mHandle, &pars );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
+
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ /* query of the custom object URI for agent 0 (Telit)*/
+
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_RW_RES_ID;
+ exist_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
+ {
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ }
+ }
+
+
+
+ /*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+
+ M2MB_LWM2M_OBJ_URI_T uri_mon = {
+ M2MB_LWM2M_URI_4_FIELDS,
+ M2MB_LWM2M_DEMO_OBJ_ID, 0,
+ 0, 0
+ };
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded\r\n" );
+ }
+
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_MON_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+ AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
+{
+ (void)type;
+ (void)param1;
+ (void)param2;
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJGET_PARAM_T objGetReq;
+
+ UINT16 objGetRespSize = 8000; //size of the buffer where to write the response
+ CHAR* objGetRespString = NULL;
+ M2MB_RESULT_E objres;
+
+ int json_size = 400;
+ char * json_string = NULL;
+
+ INT32 ret = 0;
+ int i;
+ int task_status = type;
+
+ do
+ {
+ AZX_LOG_INFO("Initializing resources...\r\n");
+
+ init_sync();
+
+ azx_sleep_ms(8000);
+
+ /*Initialize LWM2M*/
+ ret = oneedge_init();
+ if (ret != 0)
+ {
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /*Checking client status*/
+ m2mb_lwm2m_get_stat(lwm2mHandle);
+
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_GET_STAT_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M get status timeout!\r\n");
+ return -2;
+ }
+
+ /*Obj_set on the custom object*/
+ json_string = (char *) m2mb_os_malloc(json_size * sizeof(char));
+ M2MB_LWM2M_OBJSET_PARAM_T obj_struct;
+
+ /*New multiple set with JSON string*/
+ sprintf(json_string, "{\"bn\":\"/%d/0/\",\"e\":"
+ "["
+ "{\"n\":\"11\",\"sv\":\"hello world\"}," /*String*/
+ "{\"n\":\"12\",\"v\":70}," /*integer*/
+ "{\"n\":\"13\",\"v\":-12.5}," /*float*/
+ "{\"n\":\"15\",\"sv\":\"aGVsbG8gd29ybGQ=\"}," /*opaque: data must be in BASE64 format*/
+ "{\"n\":\"16\",\"v\":1620828702}," /*time*/
+ "{\"n\":\"31/0\",\"sv\":\"Greetings\"}," /*String multi-instance*/
+ "{\"n\":\"31/1\",\"sv\":\"from\"}," /*String multi-instance*/
+ "{\"n\":\"31/2\",\"sv\":\"AppZone!\"}," /*String multi-instance*/
+ "{\"n\":\"34/0\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/1\",\"bv\":false}," /*Boolean multi-instance*/
+ "{\"n\":\"34/2\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/3\",\"bv\":false}" /*Boolean multi-instance*/
+ "]}",
+ M2MB_LWM2M_DEMO_OBJ_ID
+ );
+
+ obj_struct.objectId = M2MB_LWM2M_DEMO_OBJ_ID;
+ obj_struct.objectInstanceId = 0;
+ obj_struct.dataString = json_string;
+ obj_struct.dataStringSize = json_size;
+
+ if (m2mb_lwm2m_objset(lwm2mHandle, &obj_struct) == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objset status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objset SUCCESS \r\n");
+ }
+ }
+ else
+ {
+ AZX_LOG_ERROR("\r\nm2mb_lwm2m_objset failed\r\n");
+ }
+
+ m2mb_os_free(json_string);
+ json_string = NULL;
+
+ azx_sleep_ms(10000);
+
+ i = 5;
+ AZX_LOG_INFO("\r\nWaiting %d seconds before the m2mb_lwm2m_objget\r\n", i);
+
+ while(i > 0)
+ {
+ AZX_LOG_INFO("\r\nWaiting: %d\r\n", i);
+ azx_sleep_ms(1000);
+ i--;
+ }
+
+ objGetRespString = (CHAR*)m2mb_os_calloc(objGetRespSize * sizeof(CHAR));
+
+ memset(&objGetReq, 0, sizeof(M2MB_LWM2M_OBJGET_PARAM_T));
+
+ objGetReq.agentId = 0;
+ objGetReq.uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ objGetReq.uri.objInst = 0;
+ objGetReq.uri.uriLen = M2MB_LWM2M_URI_2_FIELDS;
+
+ objres = m2mb_lwm2m_objget(lwm2mHandle, &objGetReq, objGetRespString,
+ objGetRespSize);
+
+ if (objres == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M OBJget status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objget SUCCESS \r\n");
+ AZX_LOG_INFO("\r\nContent: \r\n<%s>\r\n\r\n", objGetRespString);
+ }
+ } else
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objget failed\r\n");
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+ while(1)
+ {
+ /*Wait*/
+ azx_sleep_ms(10000);
+ }
+ task_status = APPLICATION_EXIT;
+ } while(0);
+
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
+ {
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ }
+
+ if(json_string)
+ {
+ m2mb_os_free(json_string);
+ }
+
+ deinit_sync();
+ AZX_LOG_DEBUG("Application complete.\r\n");
+ }
+
+ return 0;
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
new file mode 100755
index 00000000..fa70f5ea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
@@ -0,0 +1,909 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml
new file mode 100755
index 00000000..b275635e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml
@@ -0,0 +1,106 @@
+
+
+
+ m2mb lwm2m objset-get demo
+ object providing OMA resources required for the m2mb_lwm2m_objget and m2mb_lwm2m_objset DEMO
+ 32011
+ urn:oma:lwm2m:x:32011
+ 1.0
+ 1.0
+ Single
+ Optional
+
+ -
+
Read Write String
+ RW
+ Single
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write Integer
+ RW
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Read Write Float
+ RW
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Read Write Boolean
+ RW
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Read Write Opaque
+ RW
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Read Write Time
+ RW
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Read Write Objlnk
+ RW
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+ -
+
Read Write MultiInstance String
+ RW
+ Multiple
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write MultiInstance Boolean
+ RW
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/metadata.json
old mode 100755
new mode 100644
index b6d942ec..8e467776
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Logging/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/metadata.json
old mode 100755
new mode 100644
index 522467fd..63477194
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MD5/metadata.json
@@ -14,13 +14,15 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,9 +40,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/metadata.json
old mode 100755
new mode 100644
index 158ad703..40e55098
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -34,9 +36,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/src/mqtt_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/src/mqtt_demo.c
index fc7554f7..00741d9e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/src/mqtt_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MQTT/src/mqtt_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.5
+ 1.0.6
@note
@@ -141,9 +141,8 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
return;
}
- if ((ssl_auth_mode == M2MB_SSL_SERVER_AUTH) || (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH))
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
-
/* clean everything */
res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
if(res==0)
@@ -155,6 +154,20 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
}
}
+
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
+ {
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
+ }
+
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -265,18 +278,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
- if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
+ if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
{
AZX_LOG_DEBUG("server + client authentication is chosen \r\n");
AZX_LOG_DEBUG("ca cert file %s \r\n",CLIENTCERTFILE);
@@ -284,14 +299,14 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
AZX_LOG_DEBUG("file size: %u\r\n", st.st_size);
-
}
fd = m2mb_fs_open(CLIENTCERTFILE, M2MB_O_RDONLY); /*open in read only mode*/
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -301,7 +316,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -329,7 +345,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -339,7 +356,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -356,13 +374,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -543,7 +563,11 @@ INT32 MQTT_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
-
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
/* Init events handler */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/metadata.json
old mode 100755
new mode 100644
index 58b49b5e..85d4fef0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/MultiTask/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/metadata.json
old mode 100755
new mode 100644
index c100619c..e06bc734
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Mutex/metadata.json
@@ -15,19 +15,20 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -37,9 +38,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/metadata.json
old mode 100755
new mode 100644
index 9137e03f..4af20f01
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/NTP/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/Makefile.in
new file mode 100755
index 00000000..89c90dd2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_AUX_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/README.md
new file mode 100755
index 00000000..20407974
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/README.md
@@ -0,0 +1,28 @@
+
+### RTC example
+
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on **AUX UART**
+
+
+**Features**
+
+
+- How to read module timestamp
+- How to read module system time
+- How to set new system time
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Init log azx and print a welcome message
+- Init net functionality and wait for module registration
+- Init RTC functionality and get module time in timestamp format (seconds from the epoch)
+- Get moudle system time in date/time format
+- Add 1 hour to timestamp, convert it to system time and set it to module
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /** (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/description.txt
new file mode 100644
index 00000000..48951fa3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/description.txt
@@ -0,0 +1 @@
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on AUX UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/metadata.json
new file mode 100755
index 00000000..62dc4bec
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/metadata.json
@@ -0,0 +1,77 @@
+{
+ "name": "Sample App to set/get module RTC",
+ "type": "sample-app",
+ "description": "A sample app that shows how to set and get module system time and timestamp.",
+ "copyright": "Telit Communications, 2020",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "RTC",
+ "Time"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.00.xx6",
+ "30.00.xx7",
+ "30.00.xx8",
+ "30.00.xx9",
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx1",
+ "37.00.xx2",
+ "37.00.xx3",
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": [
+ "25.20.xx8",
+ "25.20.xx9",
+ "25.21.xx0"
+ ]
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ "25.30.xx1",
+ "25.30.xx2"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/src/M2MB_main.c
new file mode 100755
index 00000000..a34b46f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/RTC/src/M2MB_main.c
@@ -0,0 +1,280 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on AUX UART
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 11/10/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "m2mb_os_api.h"
+#include "m2mb_net.h"
+#include "m2mb_rtc.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define EV_NET_BIT (UINT32)0x1 /*0x0000000000000001*/
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+static M2MB_OS_EV_HANDLE net_evHandle = NULL;
+M2MB_NET_HANDLE hNet;
+
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
+{
+ (void)resp_size;
+ (void)myUserdata;
+
+ M2MB_NET_REG_STATUS_T *stat_info;
+
+ switch (net_event)
+ {
+
+ case M2MB_NET_GET_REG_STATUS_INFO_RESP:
+ stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
+ if (stat_info->stat == 1 || stat_info->stat == 5)
+ {
+ AZX_LOG_INFO("Module is registered!\r\n");
+ m2mb_os_ev_set(net_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_net_get_reg_status_info(h); //call it again
+ }
+ break;
+
+
+ default:
+ AZX_LOG_TRACE("unexpected net_event: %d\r\n", net_event);
+ break;
+
+ }
+}
+
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+(void)argc;
+(void)argv;
+M2MB_OS_RESULT_E osRes;
+M2MB_RESULT_E res;
+INT32 retVal;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+void *myUserdata = NULL;
+
+
+struct tm dateTime;
+time_t currTime;
+INT32 rtcfd;
+M2MB_RTC_TIME_T newTime;
+INT16 timeZone;
+
+
+
+ AZX_LOG_INIT();
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO( "\r\n Start RTC demo application. This is v%s built on %s %s.\r\n",
+ VERSION, __DATE__, __TIME__);
+
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
+ osRes = m2mb_os_ev_init( &net_evHandle, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ res = m2mb_net_init(&hNet, NetCallback, myUserdata);
+ if ( res == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for registration...\r\n");
+
+ res = m2mb_net_get_reg_status_info(hNet);
+ if ( res != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ /*Wait for network registration event to occur (released in NetCallback function) */
+ m2mb_os_ev_get(net_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1)
+ {
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot open RTC!");
+ return;
+ }
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("Module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ if (newTime.tz != 255)
+ {
+ timeZone = newTime.tz;
+ }
+ else
+ {
+ timeZone = 0;
+ }
+
+ /*
+ * Get time and date in timestamp format, add one hour, convert it into date/time format, setthis new value
+ */
+ AZX_LOG_INFO("\r\nGet current time and add an hour\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ //Add 1 hour -> 3600 sec
+
+ currTime += 3600;
+ {
+ struct tm *tmp = localtime(&currTime);
+ if (tmp != NULL)
+ {
+ dateTime = *tmp;
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get local time!");
+ return;
+ }
+ }
+
+ AZX_LOG_TRACE("Current time converted: %d-%02d-%02d, %02d:%02d:%02d\r\n", dateTime.tm_year + 1900, dateTime.tm_mon + 1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min, dateTime.tm_sec);
+
+ newTime.hour = dateTime.tm_hour;
+ newTime.min = dateTime.tm_min;
+ newTime.sec = dateTime.tm_sec;
+ newTime.day = dateTime.tm_mday;
+ newTime.mon = dateTime.tm_mon + 1; //January is 0
+ newTime.year = dateTime.tm_year + 1900;
+ newTime.dlst = (UINT8)dateTime.tm_isdst;
+ newTime.tz = timeZone;
+
+ AZX_LOG_INFO("New time to be set: %d-%02d-%02d, %02d:%02d:%02d, tz:%d, dlst:%d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec, newTime.tz, newTime.dlst);
+
+
+ //set module system time
+ AZX_LOG_INFO("\r\nSet new time and check the setting\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_SET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_TRACE("\r\nSet new system time done\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot set new system time!");
+ return;
+ }
+
+ //check if value has changed
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("NEW module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ azx_sleep_ms(2000);
+
+ m2mb_rtc_close(rtcfd);
+}
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/Makefile.in
index fdb8fc1c..f986248e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
new file mode 100755
index 00000000..786e2684
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
@@ -0,0 +1,1418 @@
+/*
+ * azx_common.c
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#include "azx_pduCommon.h"
+
+#include
+#include
+#include
+
+
+/*
+ Setting out_fmt variable, output can be represented in hex raw (if coding is 8-bit or UCS2) or utf8. Default is utf8.
+ Variable can be set/read runtime using function pdu_set_output_format/get_set_output_format
+ */
+
+static SMS_TXT_OUT_FMT_E out_fmt = UTF8_default;
+//SMS_TXT_OUT_FMT_E out_fmt = HEX_raw;
+
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
+ u8 n = 0; u16 o;
+ if (in[0] < 0x80){ n = 1; o = in[0]; }
+ else if ((in[0] & 0xE0) == 0xE0){
+ if ((in[1] != 0) && (in[2] != 0)){
+ n = 3;
+ o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
+ }
+ } else if ((in[0] & 0xC0) == 0xC0){
+ if (in[1] != 0){
+ n = 2;
+ o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
+ }
+ }
+ if (n){
+ if (be){
+ *((u8 *)out) = o >> 8;
+ *((u8 *)out + 1) = o;
+ } else {
+ *((u8 *)out) = o;
+ *((u8 *)out + 1) = o >> 8;
+ }
+ }
+ return n;
+}
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
+ if (in_len == 0) in_len = s_len(in,0);
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = utf8_to_ucs2(in, out, be);
+ if (n == 0) in_len = 0;
+ else {
+ in += n;
+ out++; out_len++;
+ in_len = (in_len >= n) ? (in_len - n) : 0;
+ }
+ }
+ return out_len;
+}
+
+
+u8 ucs2_to_utf8(u32 in, u8 *out){
+ u8 n = 0;
+ if (in < 0x80){
+ out[0] = in;
+ out[1] = 0;
+ n = 1;
+ }
+ else if ((in >= 0x80) && (in < 0x800)){
+ out[0] = (in >> 6) | 0xC0;
+ out[1] = (in & 0x3F) | 0x80;
+ out[2] = 0;
+ n = 2;
+ }
+ else if ((in >= 0x800) && (in < 0xFFFF)){
+ if (!((in >= 0xD800) && (in <= 0xDFFF))){
+ out[0] = (in >> 12) | 0xE0;
+ out[1] = ((in >> 6 ) & 0x3F) | 0x80;
+ out[2] = (in & 0x3F) | 0x80;
+ out[3] = 0;
+ n = 3;
+ }
+ }
+ else if ((in >= 0x10000) && (in < 0x10FFFF)){
+ out[0] = 0xF0 | (in >> 18);
+ out[1] = 0x80 | ((in >> 12) & 0x3F);
+ out[2] = 0x80 | ((in >> 6) & 0x3F);
+ out[3] = 0x80 | ((in & 0x3F));
+ out[4] = 0;
+ return 4;
+ }
+ return n;
+}
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = ucs2_to_utf8(
+ (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
+ if (n == 0) in_len = 0;
+ else {
+ in++; in_len--;
+ out += n; out_len += n;
+ }
+ }
+ return out_len;
+}
+
+u16 s_len(u8 *s, u8 eol){
+ if (s == NULL) return 0;
+ u16 l = 0;
+ while (*s++ != eol) l++;
+ return l;
+}
+u8 s_lines(u8 *s, u16 len, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 n = 0;
+ while (len--) if (*s++ == eol) n++;
+ return n;
+}
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 l = 0;
+ while (len-- && (l < line))
+ if (*s++ == eol) l++;
+ return (len == 0) ? NULL : s;
+}
+u8 *s_skip_crlf(u8 *s){
+ while ((*s == '\r')||(*s == '\n')) s++;
+ return s;
+}
+
+u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
+void s_upcase(u8 *s, u16 len){
+ if (len == 0) len = s_len(s, 0);
+ while (len--){
+ *s = c_upcase(*s);
+ s++;
+ }
+}
+
+u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
+u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
+
+u8 s_cmp(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (*s1++ != *s2++) return 0;
+ return 1;
+}
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
+ return 1;
+}
+
+u8 s_starts(u8 *s, char *start){
+ while (*start != 0) if (*s++ != *start++) return 0;
+ return 1;
+}
+u8 s_ends(u8 *s, char *end){
+ u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
+ if ((el > 0)&&(sl >= el)){
+ s += sl - 1; end += el - 1;
+ while (el--) if (*s-- != *end--) return 0;
+ return 1;
+ }
+ return 0;
+}
+
+u8 *s_cpos(u8 *s, u8 c, u8 eol){
+ while(*s != eol){
+ if (*s == c) return s;
+ s++;
+ }
+ return NULL;
+}
+
+u32 s_parse_dec(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
+ return n;
+}
+u32 s_parse_hex(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
+ n = (n << 4) + s_h2b4( *s++ );
+ return n;
+}
+
+u8 s_is_7bit(u8 *s, u8 eol){
+ while (*s != eol) if (*s++ > 0x7F) return 0;
+ return 1;
+}
+
+u8 *s_copy(u8 *in, u8 eol, u8 *out){
+ if (in == out) return out;
+ while (*in != eol) *out++ = *in++;
+ *out = eol;
+ return out;
+}
+
+u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
+u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
+u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
+u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
+u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
+u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
+u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
+
+#if 0
+u8 *s_append_u32(u8 *out, u32 n) {
+ if (n){
+ n = bin2bcd_u32(n, 4); u8 digs = 8;
+ while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
+ while(digs--){
+ *out++ = s_b2h4(n >> 28);
+ n <<= 4;
+ }
+ } else *out++ = '0';
+ *out = 0;
+ return out;
+}
+
+
+u8 *s_append_s32(u8 *out, s32 n) {
+ if (n < 0){
+ out = s_append_c(out, '-');
+ n = -n;
+ }
+ return s_append_u32(out, n);
+}
+#endif
+
+void *memset2(void *dest, int val, size_t len) {
+ u8 *dest1 = (u8*) dest;
+ while (len--) *dest1++ = (u8)val;
+ return dest;
+}
+
+void *memcpy2(void *dest, const void *src, size_t len) {
+ u8 *dest1 = (u8 *) dest;
+ u8 *src1 = (u8 *)src;
+ while (len--) *dest1++ = *src1++;
+ return dest;
+}
+
+u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n) {
+ u32 quot = n >> 1;
+ quot += quot >> 1;
+ quot += quot >> 4;
+ quot += quot >> 8;
+ quot += quot >> 16;
+ u32 qq = quot & ~7ul;
+ quot >>= 3;
+ divmod10_u32_rem = n - ((quot << 1) + qq);
+ if (divmod10_u32_rem > 9) {
+ divmod10_u32_rem -= 10;
+ quot++;
+ }
+ return quot;
+}
+
+u8 asc_point = '.';
+u8 asc_space = ' ';
+u8 asc_minus = '-';
+
+u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
+
+u8 bin2bcd_u8( u8 bin ) {
+ u8 tens = 0;
+ while (bin > 9) { bin -= 10; tens++; }
+ return ( (tens << 4) + bin );
+}
+
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
+
+ "bin2bcd_u32_00: \n" // correct input number by left shifts
+ "mov r31, %A[data] \n"
+ "mov %A[data], %B[data] \n"
+ "mov %B[data], %C[data] \n"
+ "mov %C[data], %D[data] \n"
+ "mov %D[data], r31 \n"
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_00 \n"
+
+ "eor r26, r26 \n" // result=0
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %[result_bytes] \n"
+ "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bin2bcd_u32_01: \n" // bits shift and correction loop
+ "subi r26,-0x33 \n" // add 0x33
+ "sbrs r26, 3 \n" // if carry to bit 3,
+ "subi r26, 3 \n" // subtract 3
+ "sbrs r26, 7 \n" // if carry to bit 7,
+ "subi r26, 0x30 \n" // subtract 0x30
+ "subi r27,-0x33 \n" // add 0x33
+ "sbrs r27, 3 \n" // if carry to bit 3,
+ "subi r27, 3 \n" // subtract 3
+ "sbrs r27, 7 \n" // if carry to bit 7,
+ "subi r27, 0x30 \n" // subtract 0x30
+ "subi r30,-0x33 \n" // add 0x33
+ "sbrs r30, 3 \n" // if carry to bit 3,
+ "subi r30, 3 \n" // subtract 3
+ "sbrs r30, 7 \n" // if carry to bit 7,
+ "subi r30, 0x30 \n" // subtract 0x30
+ "subi r31,-0x33 \n" // add 0x33
+ "sbrs r31, 3 \n" // if carry to bit 3,
+ "subi r31, 3 \n" // subtract 3
+ "sbrs r31, 7 \n" // if carry to bit 7,
+ "subi r31, 0x30 \n" // subtract 0x30
+ "lsl r26 \n" // shift result number
+ "rol r27 \n"
+ "rol r30 \n"
+ "rol r31 \n"
+
+ "sbrc %D[data], 7 \n" // skip if msbit of input == 0
+ "ori r26, 1 \n" // set lsb of output
+ "lsl %A[data] \n" // shift input number
+ "rol %B[data] \n"
+ "rol %C[data] \n"
+ "rol %D[data] \n"
+
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_01 \n" // repeat for all bits
+
+ //"mov %A[result], r26 \n" // move to result
+ //"mov %B[result], r27 \n"
+ //"mov %C[result], r30 \n"
+ //"mov %D[result], r31 \n"
+
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result) // output
+ :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
+ :"r26","r27","r30","r31" // clobbers
+ );
+ return result;
+}
+#endif
+
+u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
+ data <<= 8;
+ for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
+ /*result BCD nibbles correction*/
+ result += 0x33333333;
+ /*result correction loop*/
+ for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
+ u8 corr_byte = result >> 24;
+ if (!(corr_byte & 0x08)) corr_byte -= 0x03;
+ if (!(corr_byte & 0x80)) corr_byte -= 0x30;
+ result <<= 8; /*shift result*/
+ result += corr_byte; /*set 8 bits of result*/
+ }
+ /*shift next bit of input to result*/
+ result <<= 1;
+ if (((u8)(data >> 24)) & 0x80)
+ result |= 1;
+ data <<= 1;
+ }
+ return(result);
+}
+
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
+ u32 result = 0;
+ result_bytes = 0;
+ while (data > 0) {
+ result += (data % 10) << result_bytes;
+ data /= 10;
+ result_bytes += 4;
+ }
+ return result;
+}
+
+u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
+ static ldiv_t bin2bcd_ldiv_result;
+ bin2bcd_ldiv_result.quot = value;
+ u32 result = 0;
+ nbytes = 0;
+ while (bin2bcd_ldiv_result.quot > 0) {
+ bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
+ result += bin2bcd_ldiv_result.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+struct divmod10_t {
+ uint32_t quot;
+ uint8_t rem;
+} divmodu10_res;
+inline static void divmodu10(u32 n) {
+ divmodu10_res.quot = n >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 4;
+ divmodu10_res.quot += divmodu10_res.quot >> 8;
+ divmodu10_res.quot += divmodu10_res.quot >> 16;
+ u32 qq = divmodu10_res.quot & ~7ul;
+ divmodu10_res.quot >>= 3;
+ divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
+ if (divmodu10_res.rem > 9) {
+ divmodu10_res.rem -= 10;
+ divmodu10_res.quot++;
+ }
+}
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
+ u32 result = 0; nbytes = 0;
+ divmodu10_res.quot = value;
+ while (divmodu10_res.quot != 0) {
+ divmodu10(divmodu10_res.quot);
+ result += divmodu10_res.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+#ifdef __AVR__
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "eor r26, r26 \n" /* result = 0 */
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bcd2bin_u32_00: \n" /* bits shift and correction loop */
+ "lsr r31 \n" /* shift out buffer */
+ "ror r30 \n"
+ "ror r27 \n"
+ "ror r26 \n"
+
+ "sbrc %A[data], 0 \n" /* move lowest bit to result */
+ "ori r31, 0x80 \n"
+
+ "lsr %D[data] \n"
+ "ror %C[data] \n"
+ "ror %B[data] \n"
+ "ror %A[data] \n"
+
+ "sbrc %D[data], 7 \n" /* if carry to bit 7, */
+ "subi %D[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %D[data], 3 \n" /* if carry to bit 3, */
+ "subi %D[data], 3 \n" /* subtract 3 */
+ "sbrc %C[data], 7 \n" /* if carry to bit 7, */
+
+ "subi %C[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %C[data], 3 \n" /* if carry to bit 3, */
+ "subi %C[data], 3 \n" /* subtract 0x30 */
+ "sbrc %B[data], 7 \n" /* if carry to bit 7, */
+ "subi %B[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %B[data], 3 \n" /* if carry to bit 3, */
+ "subi %B[data], 3 \n" /* subtract 3 */
+ "sbrc %A[data], 7 \n" /* if carry to bit 7, */
+ "subi %A[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %A[data], 3 \n" /* if carry to bit 3, */
+ "subi %A[data], 3 \n" /* subtract 3 */
+
+ "dec __tmp_reg__ \n" /* repeat for all bits */
+ "brne bcd2bin_u32_00 \n"
+
+ // "movw %A[result], r26 \n" /* adjust result */
+ // "movw %C[result], r30 \n"
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "bcd2bin_u32_01: \n"
+ "mov __tmp_reg__,r25 \n"
+ "mov r25,r24 \n"
+ "mov r24,r23 \n"
+ "mov r23,r22 \n"
+ "mov r22,__tmp_reg__ \n"
+ "dec %[result_bytes] \n"
+ "brne bcd2bin_u32_01 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
+ );
+ return result;
+}
+#endif
+
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
+ /*shift next bit*/
+ result >>= 1;
+ if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
+ data >>= 1;
+ /* result BCD correction */
+ for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
+ u8 tmp_byte = (data >> 24);
+ if (tmp_byte & 0x80) tmp_byte -= 0x30;
+ if (tmp_byte & 0x08) tmp_byte -= 0x03;
+ data <<= 8;
+ data |= tmp_byte;
+ }
+ }
+ /*adjust result bytes*/
+ for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
+ result >>= 8;
+ return(result);
+}
+
+u8 asc2bin_u8(u8 data) {
+ if ((data >= '0') && (data <= '9')) data -= '0';
+ else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
+ else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
+ else data = 0xf0;
+ return(data);
+}
+
+u8 bin2asc_u8(u8 data) {
+ data &= 0xf;
+ return (data > 9) ? (data + 'A' - 10) : (data + '0');
+}
+
+u32 asc2bin_u32(u8 *buf, s8 size) {
+ u32 result;
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ result = 0;
+ while(size) {
+ u8 tmp_u8 = asc2bin_u8(*buf);
+ if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
+ result <<= 4;
+ result |= tmp_u8;
+ }
+ size--;
+ if (flag_negative) buf--;
+ else buf++; /*go to next symbol*/
+ }
+ return(result);
+}
+
+void bin2asc_u32(u32 data, u8 *buf, s8 size) {
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ while (size) {
+ *buf = bin2asc_u8(data);
+ data >>= 4;
+ if (flag_negative) buf--;
+ else buf++;
+ size--;
+ if (data == 0) size = 0; /*stop conversion on zero*/
+ }
+}
+
+void num2asc_s32(s32 data, u8 *buf, u8 flags) {
+ u8 cnt_chars = (flags & 7); //number of digits
+ //convert negative to positive, set '-' flag
+ if (data < 0) {data = -data; flags |= 1;}
+ else flags &= ~1;
+ //if necessary, convert to BCD
+ //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
+ cnt_chars++;
+ //calculate point position
+ u8 point_pos = cnt_chars - ((flags >> 4) & 7);
+ if (point_pos) point_pos++;
+ flags |= 2;
+ while (cnt_chars) { //digits conversion loop
+ if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
+ if (flags & 1) *buf = asc_minus;
+ else if (flags & 2) *buf = '0';
+ else *buf = asc_space;
+ flags &= ~1;
+ } else {
+ //show point
+ if ((cnt_chars == point_pos) && (flags & 0x70)) {
+ *buf-- = asc_point;
+ cnt_chars--;
+ }
+ *buf = bin2asc_u8(data); //show ASCII digit
+ }
+ cnt_chars--;
+ buf--;
+ data >>= 4;
+ flags &= ~2;
+ }
+ if (flags & 1) *buf = asc_minus;
+}
+
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
+{
+ uint8_t len_msg = 0;
+ uint8_t i = 0;
+ uint8_t check = 160;
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x00)
+ Str[j] = '@';
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x11)
+ Str[j] = '_';
+
+ while((i < len) && (check--))
+ {
+ if(*Str == 0x1B)
+ {
+ // |
+ if(*(uint16_t*)Str == 0x401B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '|';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // "\"
+ if(*(uint16_t*)Str == 0x2F1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '\\';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ^
+ if(*(uint16_t*)Str == 0x141B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '^';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // [
+ if(*(uint16_t*)Str == 0x3C1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '[';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ]
+ if(*(uint16_t*)Str == 0x3E1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = ']';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // {
+ if(*(uint16_t*)Str == 0x281B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '{';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // }
+ if(*(uint16_t*)Str == 0x291B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '}';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ~
+ if(*(uint16_t*)Str == 0x3D1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '~';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // euro
+ if(*(uint16_t*)Str == 0x651B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '?';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+ }
+ else
+ {
+ i++;
+ len_msg++;
+ Str++;
+ }
+ }
+
+ return len_msg;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_7to8(uint8_t *a, uint8_t len)
+{
+ //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
+ //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
+ //'Hello!' -> C8 32 9B FD 0E 01
+ if (len == 0)
+ len = s_len(a,0);
+
+ a[len] = 0;
+ len++;
+
+ // Correct symbol @
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '@')
+ a[j] = 0x00;
+
+ // Correct symbol _
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '_')
+ a[j] = 0x11;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len-2); i1++)
+ {
+ for (uint8_t i2=(len-1); i2>i1; i2--)
+ {
+ a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
+ a[i2] >>= 1;
+ }
+ }
+ }
+
+ len--;
+
+ return len - (len >> 3);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_8to7(uint8_t *a, uint8_t len)
+{
+ uint8_t len1 = len + (len >> 3);
+
+ while (len < len1)
+ a[len++] = 0;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len1-1); i1++)
+ for (uint8_t i2=(len1-1); i2>i1; i2--)
+ a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
+ }
+
+ for (uint8_t i=0; i= n) ? (in_len - n) : 0;
+// }
+// }
+// return out_len;
+//}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t swap8 (uint8_t b)
+{
+ return (b << 4)|(b >> 4);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t swap16(uint16_t w)
+{
+ return (w << 8)|(w >> 8);
+}
+#include
+#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
+{
+ if (len == 0)
+ return;
+
+ len >>= 1;
+
+ while (len--)
+ {
+ *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
+ h += 2;
+ }
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
+{
+ if (len == 0)
+ return;
+
+ b += len-1; h += ((uint16_t)len << 1) - 1;
+ while (len--)
+ {
+ *h-- = s_b2h4(*b & 0xF);
+ *h-- = s_b2h4(*b-- >> 4);
+ }
+}
+
+
+uint8_t convert_binary_coded_to_decimal(uint8_t hex)
+{
+ uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
+ return dec;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+/*DCS decoding function*/
+dcs_struct pdu_decode_dcs(uint8_t tp_dcs)
+{
+ dcs_struct sm_dcs;
+ uint8_t alpha_byte, class_byte;
+
+ if ( ( (tp_dcs & 0xc0) == 0)) /* coding group: 00xx */
+ {
+ if ( tp_dcs & 0x20 )
+ sm_dcs.smCompressed = 1; /* compressed */
+ else
+ sm_dcs.smCompressed = 0;
+
+
+ alpha_byte = ( tp_dcs & 0x0c ) >> 2; /* alphabet */
+ if ( alpha_byte == 0 )
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ else if ( alpha_byte == 1 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else if ( alpha_byte == 2 )
+ sm_dcs.smAlphabet = PDU_DCS_UCS2;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_AUTO;
+
+ if ( tp_dcs & 0x10 ) /* bit 1 and 0 have class meaning */
+ {
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ }
+ else
+ sm_dcs.smClass = noClass;
+
+ } else if ( (tp_dcs >> 4) == 0x0f ){ /* coding group: 1111 */
+ sm_dcs.smCompressed = 0;
+
+ if ( tp_dcs & 0x04 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_7;
+
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ } else {/* reserved codings groups: assume 7 bit, uncompressed, class 2 */
+
+ sm_dcs.smCompressed = 0;
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ sm_dcs.smClass = class2;
+ }
+ return sm_dcs;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ int8_t tz_sign = 1;
+ dcs_struct sm_dcs; /*Added dcs decoding in alphabet, class and compressed*/
+
+ if (len == 0)
+ len = s_len(in, 0);
+
+ len >>= 1;
+
+ out->smsc.len = in[0];
+ out->smsc.bytes = out->smsc.len - 1;
+
+ if (in[0] == 7)
+ {
+ out->smsc.type = in[1];
+ for (uint8_t i=0; i<(out->smsc.bytes); i++)
+ out->smsc.data[i] = in[i+2];
+ }
+
+ in += out->smsc.len + 1;
+
+ out->first = *in++;
+ out->sender.len = *in++;
+ out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
+ out->sender.type = *in++;
+ for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
+ out->sender.data[i] = *in++;
+
+ out->tp_pid = *in++;
+ out->tp_dcs = *in++;
+
+ out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
+ //*in = 0x4a;
+ out->tz = swap8( *in++ );
+
+ if ((out->tz & 0x80) == 0x80)
+ {
+ tz_sign = -1;
+ }
+
+ out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
+
+ out->msg.len = out->msg.bytes = *in++;
+
+ // correction for 7-bit encoding
+
+ /*Now dcs has been correctly decoded*/
+ sm_dcs = pdu_decode_dcs(out->tp_dcs);
+ out->tp_dcs = sm_dcs.smAlphabet;
+ /**/
+ if (out->tp_dcs == PDU_DCS_7)
+ out->msg.bytes -= (out->msg.bytes >> 3);
+ // decode message text (if output buffer is given)
+ out->msg.data = in;
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ pdu_hex2bytes(in, len, in);
+ pdu_in_decode_binary(in, len, out);
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+#if 1
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+ if (pdu_get_output_format() == UTF8_default) {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ } else if(pdu_get_output_format() == HEX_raw) {
+ uint16_t i, j;
+ uint8_t tmpByte;
+
+ j = 0;
+
+ for ( i = 0; i < in_bytes; i++ )
+ {
+
+ tmpByte = ( in[i] & 0x00FF );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0xF0 ) >> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+
+ }
+
+ in_bytes = j;
+ out += in_bytes;
+ }
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ for (uint8_t i=0; i> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+ }
+ //out[j] = '\0';
+ in_bytes = j;
+ out += in_bytes;
+ } else {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ }
+ }
+ }
+
+ *out = 0;
+
+ return in_bytes;
+}
+
+
+#else //original
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ }
+
+ for (uint8_t i=0; ismsc.len;
+ // fill SMSC data
+ if (in->smsc.len)
+ {
+ *out++ = in->smsc.type;
+ for (uint8_t i=0; i<(in->smsc.len-1); i++)
+ *out++ = in->smsc.data[i];
+ len = in->smsc.len;
+ }
+
+ *out++ = in->first; // 1st octet (0x11)
+ *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+
+ in->sender.bytes = pdu_phone_bytes(in->sender.data);
+ in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
+ *out++ = in->sender.len; // address length, digits
+ *out++ = in->sender.type; // type-of-address
+ for (uint8_t i=0; isender.bytes; i++)
+ *out++ = in->sender.data[i];
+
+ *out++ = in->tp_pid; // TP-PID. Protocol identifier
+
+ if (in->tp_dcs == PDU_DCS_AUTO)
+ in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
+
+ *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
+
+ *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
+ len += in->sender.bytes + 8;
+
+ // add message
+ in->msg.len = s_len(in->msg.data,0);
+
+ if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
+ {
+ in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
+ *out++ = in->msg.len;
+ }
+ else
+ {
+ *out++ = in->msg.len;
+ s_copy(in->msg.data, 0, out);
+ if (in->tp_dcs == PDU_DCS_7)
+ in->msg.bytes = pdu_7to8(out, in->msg.len);
+ else
+ in->msg.bytes = in->msg.len;
+ }
+
+ out -= len;
+ len += in->msg.bytes;
+ pdu_bytes2hex(out, len, out);
+ in->len_bytes = len << 1;
+ in->len_cmgs = len - in->smsc.len - 1;
+ out[in->len_bytes] = 0;
+
+ return in->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
+{
+ pdu->first = 0x11;
+ pdu->tp_msg_ref = 0;
+ pdu->tp_pid = 0;
+ pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
+
+ pdu->smsc.len = 0;
+
+ pdu->sender.type = PDU_TYPE_INTERNATIONAL;
+
+
+ if (pdu_phone_is_packed((uint8_t *)sender)) {
+ pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
+ }
+ else{
+ pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
+ }
+
+
+ //pdu->tp_dcs = PDU_DCS_AUTO;
+ //pdu->tp_dcs = PDU_DCS_8;
+ pdu->tp_dcs = dcs;
+ pdu->msg.data = (uint8_t *)msg;
+
+ pdu_out_encode(pdu, out);
+
+ return pdu->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
+{
+ uint8_t n = 0;
+
+ if (*in == '+')
+ in++;
+
+ while ((*in >= '0')&&(*in <= '9'))
+ {
+ *out = s_h2b4(*in++);
+ if (*in)
+ {
+ *out |= s_h2b4(*in) << 4;
+ in++;
+ n++;
+ }
+ else
+ *out |= 0xF0;
+
+ n++;
+ out++;
+ }
+
+ *out = 0xFF;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
+{
+ uint8_t n = 0;
+
+ if (type == PDU_TYPE_INTERNATIONAL)
+ *out++ = '+';
+
+ while (len--)
+ {
+ *out++ = s_b2h4(*in & 0xF);
+ n++;
+
+ if ((*in & 0xF0) != 0xF0)
+ {
+ *out++ = s_b2h4(*in >> 4);
+ n++;
+ }
+
+ in++;
+ }
+
+ *out = 0;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_is_packed(uint8_t *phone)
+{
+ return *phone != '+';
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits_bytes(uint8_t digits)
+{
+ return (digits + (digits & 1)) >> 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_bytes(uint8_t *in)
+{
+ uint8_t len = 0;
+
+ while (*in++ != 0xFF)
+ len++;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
+{
+ uint8_t len = bytes << 1;
+
+ if ((in[bytes-1] & 0xF0) == 0xF0)
+ len--;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
+{
+ if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
+ return 0;
+
+ while (in1_bytes--) if (*in1++ != *in2++)
+ return 0;
+
+ return 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_phone_copy(uint8_t *in, uint8_t *out)
+{
+ if (in == out)
+ return;
+
+ uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
+
+ while (*in != eop)
+ *out++ = *in++;
+
+ *out = eop;
+}
+
+//Functions to convert SMS text in raw hex output (as specified by 3GPP TS 27.005)
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format)
+{
+ out_fmt = output_format;
+}
+
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void)
+{
+ return out_fmt;
+}
+
+static const uint8_t ha_form[] =
+{
+ '0',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F'
+};
+
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb)
+{
+ /* convert it into ASCII code */
+ return (ha_form[(LV_nmb & 0x0F)]);
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h
new file mode 100755
index 00000000..33438ac2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h
@@ -0,0 +1,369 @@
+/*
+ * azx_common.h
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#ifndef AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+#define AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+
+#include
+#include
+
+#ifndef offsetof
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+#endif
+#ifndef countof
+#define countof(arg) (sizeof(arg) / sizeof(arg[0]))
+#endif
+
+//attributes
+#define WEAK __attribute__ ((weak))
+#define NAKED __attribute__ ((naked))
+#define INTERRUPT __attribute__ ((__interrupt__))
+#define USED __attribute__ ((used))
+#define NORETURN __attribute__ ((noreturn))
+#define SECTION(s) __attribute__ ((section(s)))
+#define NOINIT SECTION(".noinit")
+#define ALIAS(a) __attribute__ ((weak, alias (a)))
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define OPTIMIZE(level) __attribute__ ((optimize(level)))
+
+//architecture-specific inlines
+#ifdef __AVR
+#define wdr() asm volatile("wdr")
+#define nop() asm volatile("nop")
+#define sleep() asm volatile("sleep")
+#else
+#define PROGMEM
+#endif
+
+#ifdef __i8051
+#define cli() EI = 0
+#define sei() EI = 1
+#endif
+
+#ifdef __STM8
+#define cli() _asm("sim")
+#define sei() _asm("rim")
+#define nop() _asm("nop")
+#define wdr() { IWDG_KR = 0xAA; }
+#endif
+
+#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
+#define cli() asm volatile ( "CPSID i \n" )
+#define sei() asm volatile ( "CPSIE i \n" )
+#endif
+
+//short named types
+typedef uint8_t u8;
+typedef int8_t s8;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+typedef int64_t s64;
+typedef float f32;
+typedef double f64;
+#ifdef __float128
+typedef __float128 f128;
+#endif
+
+//bit mask
+#define B(_b) (1 << (_b))
+#define BIT(_b) (1 << (_b))
+
+//Increment/decrement, Add/Subtract with range rollover/limit
+#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
+#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
+#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
+#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
+#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
+#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
+#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
+#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
+#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
+#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
+#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
+#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+#ifdef __ARM_ARCH_7M__
+//ARM Cortex BitBand access macros
+#define BITBAND_SRAM_REF 0x20000000
+#define BITBAND_SRAM_BASE 0x22000000
+// Convert SRAM address
+#define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
+#define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
+
+#define BITBAND_PERI_REF 0x40000000
+#define BITBAND_PERI_BASE 0x42000000
+// Convert PERIPHERAL address
+#define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
+#define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
+#endif
+
+//memset - simple verion
+void *memset2(void *dest, int val, size_t len);
+//memcpy - simple verion
+void *memcpy2(void *dest, const void *src, size_t len);
+
+extern u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n);
+
+
+// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
+// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
+
+// convert UCS2 codepoint to UTF8, returns number of bytes processed
+u8 ucs2_to_utf8(u32 in, u8 *out);
+// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
+
+
+// find length of line, terminated by eol char
+u16 s_len(u8 *s, u8 eol);
+
+// number of lines, separated by eol char
+u8 s_lines(u8 *s, u16 len, u8 eol);
+
+u8 c_upcase(u8 c);
+// uppercase string, in-place
+void s_upcase(u8 *s, u16 len);
+
+u8 s_h2b4(u8 hex);
+u8 s_b2h4(u8 b);
+
+// find start of line, delimited by eol char
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
+
+// skip CR/LF chars
+u8 *s_skip_crlf(u8 *s);
+
+// compare 2 strings, returns 1 if equal
+u8 s_cmp(u8 *s1, u8 *s2, u16 len);
+// compare 2 strings, upper-casing each char, returns 1 if equal
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
+
+// check if s starts with start
+u8 s_starts(u8 *s, char *start);
+// check if s ends with end
+u8 s_ends(u8 *s, char *end);
+
+// finds 1st occurence of char c, returns NULL if not found
+u8 *s_cpos(u8 *s, u8 c, u8 eol);
+
+// check if string is 7-bit
+u8 s_is_7bit(u8 *s, u8 eol);
+
+// copy in string (terminated by eol char) to out
+u8 *s_copy(u8 *in, u8 eol, u8 *out);
+
+
+// append string out to in, returns pointer after last char
+u8 *s_append_s (u8 *out, char *in);
+// append char to string buffer
+u8 *s_append_c (u8 *out, u8 c);
+// append Hex char to string buffer
+u8 *s_append_h4 (u8 *out, u8 n);
+// append Hex byte to string buffer
+u8 *s_append_h8 (u8 *out, u8 n);
+// append 16-bit Hex to string buffer
+u8 *s_append_h16(u8 *out, u16 n);
+// append 24-bit Hex to string buffer
+u8 *s_append_h24(u8 *out, u32 n);
+// append 32-bit Hex to string buffer
+u8 *s_append_h32(u8 *out, u32 n);
+
+
+// parse decimal number
+u32 s_parse_dec(u8 *s, u8 len);
+// parse hex number
+u32 s_parse_hex(u8 *s, u8 len);
+
+extern u8 asc_point;
+extern u8 asc_space;
+extern u8 asc_minus;
+
+/** convert lower nibble to HEX symbol */
+#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
+
+/** 8-bit BCD->BIN conversion */
+u8 bcd2bin_u8( u8 bcd );
+/** 8-bit BIN->BCD conversion */
+u8 bin2bcd_u8( u8 bin );
+
+// 32-bit BIN->BCD conversion using shifts and correction
+//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
+
+// 32-bit BIN->BCD conversion using hardware divider
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using ldiv
+u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using fast soft div
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
+
+// 32-bit BCD->BIN conversion
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
+
+u8 asc2bin_u8(u8 data);
+u8 bin2asc_u8(u8 data);
+u32 asc2bin_u32(u8 *buf, s8 size);
+void bin2asc_u32(u32 data, u8 *buf, s8 size);
+
+// AVR-optimized conversions
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
+u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
+#endif
+
+/** convert 32-bit signed data to ASCII number to buffer (right to left)
+ * options & 7 - width-1,
+ * (options >> 4) & 7 - point position,
+ * options & 0x08 - supress leading zeros,
+ * options & 0x80 - convert to BCD.
+ */
+#define NUM2ASC_BCD (u8)0x80
+#define NUM2ASC_NOZEROS (u8)0x08
+#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
+#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
+#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
+void num2asc_s32(s32 data, u8 *buf, u8 flags);
+inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
+
+// calculate number width
+
+inline u8 width_i32(s32 n){
+ u8 s = 0;
+ if (n < 0){ s = 1; n = -n; }
+ return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
+ ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
+}
+
+#define SMS_PDU_MAX_SIZE 400
+
+// data coding scheme
+enum
+{
+ PDU_DCS_7 = 0,
+ PDU_DCS_8 = 0x4,
+ PDU_DCS_UCS2 = 0x08,
+ PDU_DCS_AUTO = 0xFF
+};
+
+//SMS classes
+enum
+{
+ class0 = 0,
+ class1,
+ class2,
+ class3,
+ noClass = 0xFF
+};
+
+//Output format
+typedef enum
+{
+
+ HEX_raw = 0,
+ UTF8_default
+}SMS_TXT_OUT_FMT_E;
+
+// number format
+enum
+{
+ PDU_TYPE_NATIONAL = 0xA1,
+ PDU_TYPE_INTERNATIONAL = 0x91,
+ PDU_TYPE_ALPHADET = 0xD0,
+ PDU_TYPE_NETWORK = 0xB1
+};
+
+typedef struct
+{
+ // SMSC number
+ struct{ uint8_t len, bytes, type, data[14]; }smsc;
+ // caller/sender number
+ struct{ uint8_t len, bytes, type, data[14]; }sender;
+ // input/output zero-terminated message (7bit/8bit/UTF8)
+ struct{ uint16_t len, bytes; uint8_t *data; }msg;
+
+ uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
+ uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+ uint8_t tp_pid; // Protocol identifier (0)
+ uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
+ uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
+
+ // incoming SMS timestamp
+ uint8_t year, month, date; // date
+ uint8_t hour, min, sec; // time
+ int8_t tz; // zone
+
+ // PDU length in bytes and for CMGS command
+ uint16_t len_bytes, len_cmgs;
+}pdu_struct;
+
+typedef struct
+{
+
+ uint8_t smCompressed;
+ uint8_t smAlphabet;
+ uint8_t smClass;
+
+}dcs_struct;
+
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format);
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void);
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb);
+
+// Change GSM 7-bit table to ANSI
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
+// pack 7-bit array to 8-bit
+uint8_t pdu_7to8(uint8_t *a, uint8_t len);
+// unpack 8-bit array to 7-bit
+uint8_t pdu_8to7(uint8_t *a, uint8_t len);
+
+// convert HEX line to bytes, len - length of input buffer
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
+// convert bytes to HEX line, len - length of input buffer
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
+
+// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
+
+// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
+// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
+
+// encode outcoming PDU
+uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
+// encode outcoming PDU, simple interface
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
+
+// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
+// unpack phone number to string, returns number of unpacked digits
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
+// check if phone is packed
+uint8_t pdu_phone_is_packed(uint8_t *phone);
+
+// get number of bytes from number of digits
+uint8_t pdu_phone_digits_bytes(uint8_t digits);
+// get number of bytes of packed phone
+uint8_t pdu_phone_bytes(uint8_t *in);
+// count number of digits
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
+
+// compare 2 packed phones
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
+// copy packed phone
+void pdu_phone_copy(uint8_t *in, uint8_t *out);
+
+#endif /* AZX_PDU_CODEC_AZX_PDUCOMMON_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
index fcc37bb3..42ad15d1 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
@@ -28,7 +28,7 @@
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduDec.h"
/* Local defines ================================================================================*/
@@ -87,9 +87,10 @@ INT32 azx_pdu_decode(UINT8 *pdu, UINT32 pdu_len, pdu_struct *packet, CHAR *numbe
//fill result buffer
+ /*Now dcs has been correctly decoded, including 8 bit case*/
pdu_in_decode_text(packet->msg.data,
packet->msg.len,
- (packet->tp_dcs == 0x00 ? PDU_DCS_7:PDU_DCS_UCS2),
+ (packet->tp_dcs),
(UINT8*)msg);
len_msg = packet->msg.len;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
index d0042998..3e6fb59d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
@@ -29,7 +29,7 @@
/** \defgroup pduDecUsage Usage of pdu decoding functionalities
* Functions usable to retrieve ASCII message and other info from a PDU message in binary format
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
index 525a6654..68617866 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
@@ -26,7 +26,8 @@
#include
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
index efe858ff..42a85ef4 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
@@ -30,7 +30,7 @@
/** \defgroup pduEncUsage Usage of pdu encoding functionalities
* Functions usable to create a PDU message from a string text
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
/**
@brief
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/readme b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/readme
old mode 100644
new mode 100755
index be00a200..98184a07
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/readme
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/readme
@@ -1,3 +1,3 @@
@brief Utility code to simplify parse/encode binary PDU to be used with `m2mb_sms_*` APIs
-@version 1.0.0
+@version 1.0.3
@dependencies
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c
deleted file mode 100755
index 7f4c0530..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * gsm_pdu.c
- *
- * Created on: Sep 15, 2014
- * Author: qwer
- */
-#include
-#include
-#include "ul_gsm_pdu.h"
-#include "ul_s.h"
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
-{
- uint8_t len_msg = 0;
- uint8_t i = 0;
- uint8_t check = 160;
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x00)
- Str[j] = '@';
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x11)
- Str[j] = '_';
-
- while((i < len) && (check--))
- {
- if(*Str == 0x1B)
- {
- // |
- if(*(uint16_t*)Str == 0x401B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '|';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // "\"
- if(*(uint16_t*)Str == 0x2F1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '\\';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ^
- if(*(uint16_t*)Str == 0x141B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '^';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // [
- if(*(uint16_t*)Str == 0x3C1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '[';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ]
- if(*(uint16_t*)Str == 0x3E1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = ']';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // {
- if(*(uint16_t*)Str == 0x281B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '{';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // }
- if(*(uint16_t*)Str == 0x291B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '}';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ~
- if(*(uint16_t*)Str == 0x3D1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '~';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // euro
- if(*(uint16_t*)Str == 0x651B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '?';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
- }
- else
- {
- i++;
- len_msg++;
- Str++;
- }
- }
-
- return len_msg;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_7to8(uint8_t *a, uint8_t len)
-{
- //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
- //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
- //'Hello!' -> C8 32 9B FD 0E 01
- if (len == 0)
- len = s_len(a,0);
-
- a[len] = 0;
- len++;
-
- // Correct symbol @
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '@')
- a[j] = 0x00;
-
- // Correct symbol _
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '_')
- a[j] = 0x11;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len-2); i1++)
- {
- for (uint8_t i2=(len-1); i2>i1; i2--)
- {
- a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
- a[i2] >>= 1;
- }
- }
- }
-
- len--;
-
- return len - (len >> 3);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_8to7(uint8_t *a, uint8_t len)
-{
- uint8_t len1 = len + (len >> 3);
-
- while (len < len1)
- a[len++] = 0;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len1-1); i1++)
- for (uint8_t i2=(len1-1); i2>i1; i2--)
- a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
- }
-
- for (uint8_t i=0; i= n) ? (in_len - n) : 0;
-// }
-// }
-// return out_len;
-//}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t swap8 (uint8_t b)
-{
- return (b << 4)|(b >> 4);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t swap16(uint16_t w)
-{
- return (w << 8)|(w >> 8);
-}
-#include
-#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
-{
- if (len == 0)
- return;
-
- len >>= 1;
-
- while (len--)
- {
- *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
- h += 2;
- }
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
-{
- if (len == 0)
- return;
-
- b += len-1; h += ((uint16_t)len << 1) - 1;
- while (len--)
- {
- *h-- = s_b2h4(*b & 0xF);
- *h-- = s_b2h4(*b-- >> 4);
- }
-}
-
-
-uint8_t convert_binary_coded_to_decimal(uint8_t hex)
-{
- uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
- return dec;
-}
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- int8_t tz_sign = 1;
- if (len == 0)
- len = s_len(in, 0);
-
- len >>= 1;
-
- out->smsc.len = in[0];
- out->smsc.bytes = out->smsc.len - 1;
-
- if (in[0] == 7)
- {
- out->smsc.type = in[1];
- for (uint8_t i=0; i<(out->smsc.bytes); i++)
- out->smsc.data[i] = in[i+2];
- }
-
- in += out->smsc.len + 1;
-
- out->first = *in++;
- out->sender.len = *in++;
- out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
- out->sender.type = *in++;
- for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
- out->sender.data[i] = *in++;
-
- out->tp_pid = *in++;
- out->tp_dcs = *in++;
-
- out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
- //*in = 0x4a;
- out->tz = swap8( *in++ );
-
- if ((out->tz & 0x80) == 0x80)
- {
- tz_sign = -1;
- }
-
- out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
-
- out->msg.len = out->msg.bytes = *in++;
-
- // correction for 7-bit encoding
- if (out->tp_dcs == PDU_DCS_7)
- out->msg.bytes -= (out->msg.bytes >> 3);
-
- // decode message text (if output buffer is given)
- out->msg.data = in;
-}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- pdu_hex2bytes(in, len, in);
- pdu_in_decode_binary(in, len, out);
-}
-
-
-
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
-{
- if (in_dcs == PDU_DCS_UCS2)
- {
- in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
- out += in_bytes;
- }
- else
- {
- if (in_dcs == PDU_DCS_7)
- {
- in_bytes += in_bytes >> 3;
- pdu_8to7(in, in_bytes);
- }
-
- for (uint8_t i=0; ismsc.len;
- // fill SMSC data
- if (in->smsc.len)
- {
- *out++ = in->smsc.type;
- for (uint8_t i=0; i<(in->smsc.len-1); i++)
- *out++ = in->smsc.data[i];
- len = in->smsc.len;
- }
-
- *out++ = in->first; // 1st octet (0x11)
- *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
-
- in->sender.bytes = pdu_phone_bytes(in->sender.data);
- in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
- *out++ = in->sender.len; // address length, digits
- *out++ = in->sender.type; // type-of-address
- for (uint8_t i=0; isender.bytes; i++)
- *out++ = in->sender.data[i];
-
- *out++ = in->tp_pid; // TP-PID. Protocol identifier
-
- if (in->tp_dcs == PDU_DCS_AUTO)
- in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
-
- *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
-
- *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
- len += in->sender.bytes + 8;
-
- // add message
- in->msg.len = s_len(in->msg.data,0);
-
- if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
- {
- in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
- *out++ = in->msg.len;
- }
- else
- {
- *out++ = in->msg.len;
- s_copy(in->msg.data, 0, out);
- if (in->tp_dcs == PDU_DCS_7)
- in->msg.bytes = pdu_7to8(out, in->msg.len);
- else
- in->msg.bytes = in->msg.len;
- }
-
- out -= len;
- len += in->msg.bytes;
- pdu_bytes2hex(out, len, out);
- in->len_bytes = len << 1;
- in->len_cmgs = len - in->smsc.len - 1;
- out[in->len_bytes] = 0;
-
- return in->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
-{
- pdu->first = 0x11;
- pdu->tp_msg_ref = 0;
- pdu->tp_pid = 0;
- pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
-
- pdu->smsc.len = 0;
-
- pdu->sender.type = PDU_TYPE_INTERNATIONAL;
-
-
- if (pdu_phone_is_packed((uint8_t *)sender)) {
- pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
- }
- else{
- pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
- }
-
-
- //pdu->tp_dcs = PDU_DCS_AUTO;
- //pdu->tp_dcs = PDU_DCS_8;
- pdu->tp_dcs = dcs;
- pdu->msg.data = (uint8_t *)msg;
-
- pdu_out_encode(pdu, out);
-
- return pdu->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
-{
- uint8_t n = 0;
-
- if (*in == '+')
- in++;
-
- while ((*in >= '0')&&(*in <= '9'))
- {
- *out = s_h2b4(*in++);
- if (*in)
- {
- *out |= s_h2b4(*in) << 4;
- in++;
- n++;
- }
- else
- *out |= 0xF0;
-
- n++;
- out++;
- }
-
- *out = 0xFF;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
-{
- uint8_t n = 0;
-
- if (type == PDU_TYPE_INTERNATIONAL)
- *out++ = '+';
-
- while (len--)
- {
- *out++ = s_b2h4(*in & 0xF);
- n++;
-
- if ((*in & 0xF0) != 0xF0)
- {
- *out++ = s_b2h4(*in >> 4);
- n++;
- }
-
- in++;
- }
-
- *out = 0;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_is_packed(uint8_t *phone)
-{
- return *phone != '+';
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits_bytes(uint8_t digits)
-{
- return (digits + (digits & 1)) >> 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_bytes(uint8_t *in)
-{
- uint8_t len = 0;
-
- while (*in++ != 0xFF)
- len++;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
-{
- uint8_t len = bytes << 1;
-
- if ((in[bytes-1] & 0xF0) == 0xF0)
- len--;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
-{
- if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
- return 0;
-
- while (in1_bytes--) if (*in1++ != *in2++)
- return 0;
-
- return 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_phone_copy(uint8_t *in, uint8_t *out)
-{
- if (in == out)
- return;
-
- uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
-
- while (*in != eop)
- *out++ = *in++;
-
- *out = eop;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h
deleted file mode 100755
index 7fc1fa34..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===================================================================================*/
-/*>>> Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved. <<<*/
-/* See LICENSE file in the project root for full license information. */
-/**
- @file
- ul_gsm_pdu.h
-
- @brief
- PDU defines
- @details
- porting of original code at https://github.com/tardigrade888/c-pdu
-
- @note
- Dependencies:
- m2mb_types.h
-
- @author
-
- @date
- 24/10/2018
-*/
-#ifndef HDR_UL_GSM_PDU_H_
-#define HDR_UL_GSM_PDU_H_
-
-// data coding scheme
-enum
-{
- PDU_DCS_7 = 0,
- PDU_DCS_8 = 0x4,
- PDU_DCS_UCS2 = 0x08,
- PDU_DCS_AUTO = 0xFF
-};
-
-// number format
-enum
-{
- PDU_TYPE_NATIONAL = 0xA1,
- PDU_TYPE_INTERNATIONAL = 0x91,
- PDU_TYPE_ALPHADET = 0xD0,
- PDU_TYPE_NETWORK = 0xB1
-};
-
-typedef struct
-{
- // SMSC number
- struct{ uint8_t len, bytes, type, data[14]; }smsc;
- // caller/sender number
- struct{ uint8_t len, bytes, type, data[14]; }sender;
- // input/output zero-terminated message (7bit/8bit/UTF8)
- struct{ uint16_t len, bytes; uint8_t *data; }msg;
-
- uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
- uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
- uint8_t tp_pid; // Protocol identifier (0)
- uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
- uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
-
- // incoming SMS timestamp
- uint8_t year, month, date; // date
- uint8_t hour, min, sec; // time
- int8_t tz; // zone
-
- // PDU length in bytes and for CMGS command
- uint16_t len_bytes, len_cmgs;
-}pdu_struct;
-
-// Change GSM 7-bit table to ANSI
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
-// pack 7-bit array to 8-bit
-uint8_t pdu_7to8(uint8_t *a, uint8_t len);
-// unpack 8-bit array to 7-bit
-uint8_t pdu_8to7(uint8_t *a, uint8_t len);
-
-// convert HEX line to bytes, len - length of input buffer
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
-// convert bytes to HEX line, len - length of input buffer
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
-
-// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
-
-// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
-// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
-
-// encode outcoming PDU
-uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
-// encode outcoming PDU, simple interface
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
-
-// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
-// unpack phone number to string, returns number of unpacked digits
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
-// check if phone is packed
-uint8_t pdu_phone_is_packed(uint8_t *phone);
-
-// get number of bytes from number of digits
-uint8_t pdu_phone_digits_bytes(uint8_t digits);
-// get number of bytes of packed phone
-uint8_t pdu_phone_bytes(uint8_t *in);
-// count number of digits
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
-
-// compare 2 packed phones
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
-// copy packed phone
-void pdu_phone_copy(uint8_t *in, uint8_t *out);
-
-#endif /* HDR_UL_GSM_PDU_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c
deleted file mode 100644
index 338ee2d1..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c
+++ /dev/null
@@ -1,356 +0,0 @@
-#include "ul_math_bcd.h"
-#include
-
-u8 asc_point = '.';
-u8 asc_space = ' ';
-u8 asc_minus = '-';
-
-u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
-
-u8 bin2bcd_u8( u8 bin ) {
- u8 tens = 0;
- while (bin > 9) { bin -= 10; tens++; }
- return ( (tens << 4) + bin );
-}
-
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
-
- "bin2bcd_u32_00: \n" // correct input number by left shifts
- "mov r31, %A[data] \n"
- "mov %A[data], %B[data] \n"
- "mov %B[data], %C[data] \n"
- "mov %C[data], %D[data] \n"
- "mov %D[data], r31 \n"
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_00 \n"
-
- "eor r26, r26 \n" // result=0
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %[result_bytes] \n"
- "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bin2bcd_u32_01: \n" // bits shift and correction loop
- "subi r26,-0x33 \n" // add 0x33
- "sbrs r26, 3 \n" // if carry to bit 3,
- "subi r26, 3 \n" // subtract 3
- "sbrs r26, 7 \n" // if carry to bit 7,
- "subi r26, 0x30 \n" // subtract 0x30
- "subi r27,-0x33 \n" // add 0x33
- "sbrs r27, 3 \n" // if carry to bit 3,
- "subi r27, 3 \n" // subtract 3
- "sbrs r27, 7 \n" // if carry to bit 7,
- "subi r27, 0x30 \n" // subtract 0x30
- "subi r30,-0x33 \n" // add 0x33
- "sbrs r30, 3 \n" // if carry to bit 3,
- "subi r30, 3 \n" // subtract 3
- "sbrs r30, 7 \n" // if carry to bit 7,
- "subi r30, 0x30 \n" // subtract 0x30
- "subi r31,-0x33 \n" // add 0x33
- "sbrs r31, 3 \n" // if carry to bit 3,
- "subi r31, 3 \n" // subtract 3
- "sbrs r31, 7 \n" // if carry to bit 7,
- "subi r31, 0x30 \n" // subtract 0x30
- "lsl r26 \n" // shift result number
- "rol r27 \n"
- "rol r30 \n"
- "rol r31 \n"
-
- "sbrc %D[data], 7 \n" // skip if msbit of input == 0
- "ori r26, 1 \n" // set lsb of output
- "lsl %A[data] \n" // shift input number
- "rol %B[data] \n"
- "rol %C[data] \n"
- "rol %D[data] \n"
-
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_01 \n" // repeat for all bits
-
- //"mov %A[result], r26 \n" // move to result
- //"mov %B[result], r27 \n"
- //"mov %C[result], r30 \n"
- //"mov %D[result], r31 \n"
-
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result) // output
- :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
- :"r26","r27","r30","r31" // clobbers
- );
- return result;
- }
-#endif
-
-u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
- data <<= 8;
- for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
- /*result BCD nibbles correction*/
- result += 0x33333333;
- /*result correction loop*/
- for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
- u8 corr_byte = result >> 24;
- if (!(corr_byte & 0x08)) corr_byte -= 0x03;
- if (!(corr_byte & 0x80)) corr_byte -= 0x30;
- result <<= 8; /*shift result*/
- result += corr_byte; /*set 8 bits of result*/
- }
- /*shift next bit of input to result*/
- result <<= 1;
- if (((u8)(data >> 24)) & 0x80)
- result |= 1;
- data <<= 1;
- }
- return(result);
-}
-
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
- u32 result = 0;
- result_bytes = 0;
- while (data > 0) {
- result += (data % 10) << result_bytes;
- data /= 10;
- result_bytes += 4;
- }
- return result;
-}
-
-u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
- static ldiv_t bin2bcd_ldiv_result;
- bin2bcd_ldiv_result.quot = value;
- u32 result = 0;
- nbytes = 0;
- while (bin2bcd_ldiv_result.quot > 0) {
- bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
- result += bin2bcd_ldiv_result.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-struct divmod10_t {
- uint32_t quot;
- uint8_t rem;
-} divmodu10_res;
-inline static void divmodu10(u32 n) {
- divmodu10_res.quot = n >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 4;
- divmodu10_res.quot += divmodu10_res.quot >> 8;
- divmodu10_res.quot += divmodu10_res.quot >> 16;
- u32 qq = divmodu10_res.quot & ~7ul;
- divmodu10_res.quot >>= 3;
- divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
- if (divmodu10_res.rem > 9) {
- divmodu10_res.rem -= 10;
- divmodu10_res.quot++;
- }
-}
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
- u32 result = 0; nbytes = 0;
- divmodu10_res.quot = value;
- while (divmodu10_res.quot != 0) {
- divmodu10(divmodu10_res.quot);
- result += divmodu10_res.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-#ifdef __AVR__
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "eor r26, r26 \n" /* result = 0 */
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bcd2bin_u32_00: \n" /* bits shift and correction loop */
- "lsr r31 \n" /* shift out buffer */
- "ror r30 \n"
- "ror r27 \n"
- "ror r26 \n"
-
- "sbrc %A[data], 0 \n" /* move lowest bit to result */
- "ori r31, 0x80 \n"
-
- "lsr %D[data] \n"
- "ror %C[data] \n"
- "ror %B[data] \n"
- "ror %A[data] \n"
-
- "sbrc %D[data], 7 \n" /* if carry to bit 7, */
- "subi %D[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %D[data], 3 \n" /* if carry to bit 3, */
- "subi %D[data], 3 \n" /* subtract 3 */
- "sbrc %C[data], 7 \n" /* if carry to bit 7, */
-
- "subi %C[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %C[data], 3 \n" /* if carry to bit 3, */
- "subi %C[data], 3 \n" /* subtract 0x30 */
- "sbrc %B[data], 7 \n" /* if carry to bit 7, */
- "subi %B[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %B[data], 3 \n" /* if carry to bit 3, */
- "subi %B[data], 3 \n" /* subtract 3 */
- "sbrc %A[data], 7 \n" /* if carry to bit 7, */
- "subi %A[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %A[data], 3 \n" /* if carry to bit 3, */
- "subi %A[data], 3 \n" /* subtract 3 */
-
- "dec __tmp_reg__ \n" /* repeat for all bits */
- "brne bcd2bin_u32_00 \n"
-
-// "movw %A[result], r26 \n" /* adjust result */
-// "movw %C[result], r30 \n"
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "bcd2bin_u32_01: \n"
- "mov __tmp_reg__,r25 \n"
- "mov r25,r24 \n"
- "mov r24,r23 \n"
- "mov r23,r22 \n"
- "mov r22,__tmp_reg__ \n"
- "dec %[result_bytes] \n"
- "brne bcd2bin_u32_01 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
- );
- return result;
- }
-#endif
-
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
- /*shift next bit*/
- result >>= 1;
- if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
- data >>= 1;
- /* result BCD correction */
- for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
- u8 tmp_byte = (data >> 24);
- if (tmp_byte & 0x80) tmp_byte -= 0x30;
- if (tmp_byte & 0x08) tmp_byte -= 0x03;
- data <<= 8;
- data |= tmp_byte;
- }
- }
- /*adjust result bytes*/
- for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
- result >>= 8;
- return(result);
-}
-
-u8 asc2bin_u8(u8 data) {
- if ((data >= '0') && (data <= '9')) data -= '0';
- else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
- else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
- else data = 0xf0;
- return(data);
-}
-
-u8 bin2asc_u8(u8 data) {
- data &= 0xf;
- return (data > 9) ? (data + 'A' - 10) : (data + '0');
-}
-
-u32 asc2bin_u32(u8 *buf, s8 size) {
- u32 result;
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- result = 0;
- while(size) {
- u8 tmp_u8 = asc2bin_u8(*buf);
- if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
- result <<= 4;
- result |= tmp_u8;
- }
- size--;
- if (flag_negative) buf--;
- else buf++; /*go to next symbol*/
- }
- return(result);
-}
-
-void bin2asc_u32(u32 data, u8 *buf, s8 size) {
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- while (size) {
- *buf = bin2asc_u8(data);
- data >>= 4;
- if (flag_negative) buf--;
- else buf++;
- size--;
- if (data == 0) size = 0; /*stop conversion on zero*/
- }
-}
-
-void num2asc_s32(s32 data, u8 *buf, u8 flags) {
- u8 cnt_chars = (flags & 7); //number of digits
- //convert negative to positive, set '-' flag
- if (data < 0) {data = -data; flags |= 1;}
- else flags &= ~1;
- //if necessary, convert to BCD
- //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
- cnt_chars++;
- //calculate point position
- u8 point_pos = cnt_chars - ((flags >> 4) & 7);
- if (point_pos) point_pos++;
- flags |= 2;
- while (cnt_chars) { //digits conversion loop
- if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
- if (flags & 1) *buf = asc_minus;
- else if (flags & 2) *buf = '0';
- else *buf = asc_space;
- flags &= ~1;
- } else {
- //show point
- if ((cnt_chars == point_pos) && (flags & 0x70)) {
- *buf-- = asc_point;
- cnt_chars--;
- }
- *buf = bin2asc_u8(data); //show ASCII digit
- }
- cnt_chars--;
- buf--;
- data >>= 4;
- flags &= ~2;
- }
- if (flags & 1) *buf = asc_minus;
-}
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h
deleted file mode 100644
index cbb417f9..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ul_bcd.h
- *
- * Created on: Sep 11, 2011
- * Author: qwer1
- */
-
-#ifndef UL_BCD_H_
-#define UL_BCD_H_
-
-#include "ul_other.h"
-
-extern u8 asc_point;
-extern u8 asc_space;
-extern u8 asc_minus;
-
-/** convert lower nibble to HEX symbol */
-#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
-
-/** 8-bit BCD->BIN conversion */
-u8 bcd2bin_u8( u8 bcd );
-/** 8-bit BIN->BCD conversion */
-u8 bin2bcd_u8( u8 bin );
-
-// 32-bit BIN->BCD conversion using shifts and correction
-//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
-
-// 32-bit BIN->BCD conversion using hardware divider
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using ldiv
-u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using fast soft div
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
-
-// 32-bit BCD->BIN conversion
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
-
-u8 asc2bin_u8(u8 data);
-u8 bin2asc_u8(u8 data);
-u32 asc2bin_u32(u8 *buf, s8 size);
-void bin2asc_u32(u32 data, u8 *buf, s8 size);
-
-// AVR-optimized conversions
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
- u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
-#endif
-
-/** convert 32-bit signed data to ASCII number to buffer (right to left)
- * options & 7 - width-1,
- * (options >> 4) & 7 - point position,
- * options & 0x08 - supress leading zeros,
- * options & 0x80 - convert to BCD.
- */
-#define NUM2ASC_BCD (u8)0x80
-#define NUM2ASC_NOZEROS (u8)0x08
-#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
-#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
-#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
-void num2asc_s32(s32 data, u8 *buf, u8 flags);
-inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
-
-// calculate number width
-
- inline u8 width_i32(s32 n){
- u8 s = 0;
- if (n < 0){ s = 1; n = -n; }
- return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
- ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
-}
-
-
-#endif /* UL_BCD_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.c
deleted file mode 100644
index 052a3565..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ul_other.c
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#include "ul_other.h"
-
-void *memset2(void *dest, int val, size_t len) {
- u8 *dest1 = (u8*) dest;
- while (len--) *dest1++ = (u8)val;
- return dest;
-}
-
-void *memcpy2(void *dest, const void *src, size_t len) {
- u8 *dest1 = (u8 *) dest;
- u8 *src1 = (u8 *)src;
- while (len--) *dest1++ = *src1++;
- return dest;
-}
-
-u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n) {
- u32 quot = n >> 1;
- quot += quot >> 1;
- quot += quot >> 4;
- quot += quot >> 8;
- quot += quot >> 16;
- u32 qq = quot & ~7ul;
- quot >>= 3;
- divmod10_u32_rem = n - ((quot << 1) + qq);
- if (divmod10_u32_rem > 9) {
- divmod10_u32_rem -= 10;
- quot++;
- }
- return quot;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.h
deleted file mode 100644
index 6248c057..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_other.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ul_other.h
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#ifndef UL_OTHER_H_
-#define UL_OTHER_H_
-
-#include
-#include
-
-#ifndef offsetof
- #define offsetof(s,m) (size_t)&(((s *)0)->m)
-#endif
-#ifndef countof
- #define countof(arg) (sizeof(arg) / sizeof(arg[0]))
-#endif
-
-//attributes
-#define WEAK __attribute__ ((weak))
-#define NAKED __attribute__ ((naked))
-#define INTERRUPT __attribute__ ((__interrupt__))
-#define USED __attribute__ ((used))
-#define NORETURN __attribute__ ((noreturn))
-#define SECTION(s) __attribute__ ((section(s)))
-#define NOINIT SECTION(".noinit")
-#define ALIAS(a) __attribute__ ((weak, alias (a)))
-#define ALWAYS_INLINE __attribute__ ((always_inline))
-#define OPTIMIZE(level) __attribute__ ((optimize(level)))
-
-//architecture-specific inlines
-#ifdef __AVR
- #define wdr() asm volatile("wdr")
- #define nop() asm volatile("nop")
- #define sleep() asm volatile("sleep")
-#else
- #define PROGMEM
-#endif
-
-#ifdef __i8051
- #define cli() EI = 0
- #define sei() EI = 1
-#endif
-
-#ifdef __STM8
- #define cli() _asm("sim")
- #define sei() _asm("rim")
- #define nop() _asm("nop")
- #define wdr() { IWDG_KR = 0xAA; }
-#endif
-
-#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
- #define cli() asm volatile ( "CPSID i \n" )
- #define sei() asm volatile ( "CPSIE i \n" )
-#endif
-
-//short named types
-typedef uint8_t u8;
-typedef int8_t s8;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef float f32;
-typedef double f64;
-#ifdef __float128
- typedef __float128 f128;
-#endif
-
-//bit mask
-#define B(_b) (1 << (_b))
-#define BIT(_b) (1 << (_b))
-
-//Increment/decrement, Add/Subtract with range rollover/limit
-#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
-#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
-#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
-#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
-#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
-#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
-#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
-#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
-#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
-#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
-#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
-#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-#ifdef __ARM_ARCH_7M__
- //ARM Cortex BitBand access macros
- #define BITBAND_SRAM_REF 0x20000000
- #define BITBAND_SRAM_BASE 0x22000000
- // Convert SRAM address
- #define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
- #define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
-
- #define BITBAND_PERI_REF 0x40000000
- #define BITBAND_PERI_BASE 0x42000000
- // Convert PERIPHERAL address
- #define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
- #define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
-#endif
-
-//memset - simple verion
-void *memset2(void *dest, int val, size_t len);
-//memcpy - simple verion
-void *memcpy2(void *dest, const void *src, size_t len);
-
-extern u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n);
-
-#endif /* OTHER_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.c
deleted file mode 100755
index 909e46b5..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ul_s.c
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#include "ul_s.h"
-#include "ul_math_bcd.h"
-
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
- u8 n = 0; u16 o;
- if (in[0] < 0x80){ n = 1; o = in[0]; }
- else if ((in[0] & 0xE0) == 0xE0){
- if ((in[1] != 0) && (in[2] != 0)){
- n = 3;
- o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
- }
- } else if ((in[0] & 0xC0) == 0xC0){
- if (in[1] != 0){
- n = 2;
- o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
- }
- }
- if (n){
- if (be){
- *((u8 *)out) = o >> 8;
- *((u8 *)out + 1) = o;
- } else {
- *((u8 *)out) = o;
- *((u8 *)out + 1) = o >> 8;
- }
- }
- return n;
-}
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
- if (in_len == 0) in_len = s_len(in,0);
- u16 out_len = 0;
- while (in_len){
- u8 n = utf8_to_ucs2(in, out, be);
- if (n == 0) in_len = 0;
- else {
- in += n;
- out++; out_len++;
- in_len = (in_len >= n) ? (in_len - n) : 0;
- }
- }
- return out_len;
-}
-
-
-u8 ucs2_to_utf8(u32 in, u8 *out){
- u8 n = 0;
- if (in < 0x80){
- out[0] = in;
- out[1] = 0;
- n = 1;
- }
- else if ((in >= 0x80) && (in < 0x800)){
- out[0] = (in >> 6) | 0xC0;
- out[1] = (in & 0x3F) | 0x80;
- out[2] = 0;
- n = 2;
- }
- else if ((in >= 0x800) && (in < 0xFFFF)){
- if (!((in >= 0xD800) && (in <= 0xDFFF))){
- out[0] = (in >> 12) | 0xE0;
- out[1] = ((in >> 6 ) & 0x3F) | 0x80;
- out[2] = (in & 0x3F) | 0x80;
- out[3] = 0;
- n = 3;
- }
- }
- else if ((in >= 0x10000) && (in < 0x10FFFF)){
- out[0] = 0xF0 | (in >> 18);
- out[1] = 0x80 | ((in >> 12) & 0x3F);
- out[2] = 0x80 | ((in >> 6) & 0x3F);
- out[3] = 0x80 | ((in & 0x3F));
- out[4] = 0;
- return 4;
- }
- return n;
-}
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
- u16 out_len = 0;
- while (in_len){
- u8 n = ucs2_to_utf8(
- (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
- if (n == 0) in_len = 0;
- else {
- in++; in_len--;
- out += n; out_len += n;
- }
- }
- return out_len;
-}
-
-u16 s_len(u8 *s, u8 eol){
- if (s == NULL) return 0;
- u16 l = 0;
- while (*s++ != eol) l++;
- return l;
-}
-u8 s_lines(u8 *s, u16 len, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 n = 0;
- while (len--) if (*s++ == eol) n++;
- return n;
-}
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 l = 0;
- while (len-- && (l < line))
- if (*s++ == eol) l++;
- return (len == 0) ? NULL : s;
-}
-u8 *s_skip_crlf(u8 *s){
- while ((*s == '\r')||(*s == '\n')) s++;
- return s;
-}
-
-u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
-void s_upcase(u8 *s, u16 len){
- if (len == 0) len = s_len(s, 0);
- while (len--){
- *s = c_upcase(*s);
- s++;
- }
-}
-
-u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
-u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
-
-u8 s_cmp(u8 *s1, u8 *s2, u16 len){
- while (len--) if (*s1++ != *s2++) return 0;
- return 1;
-}
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
- while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
- return 1;
-}
-
-u8 s_starts(u8 *s, char *start){
- while (*start != 0) if (*s++ != *start++) return 0;
- return 1;
-}
-u8 s_ends(u8 *s, char *end){
- u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
- if ((el > 0)&&(sl >= el)){
- s += sl - 1; end += el - 1;
- while (el--) if (*s-- != *end--) return 0;
- return 1;
- }
- return 0;
-}
-
-u8 *s_cpos(u8 *s, u8 c, u8 eol){
- while(*s != eol){
- if (*s == c) return s;
- s++;
- }
- return NULL;
-}
-
-u32 s_parse_dec(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
- return n;
-}
-u32 s_parse_hex(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
- n = (n << 4) + s_h2b4( *s++ );
- return n;
-}
-
-u8 s_is_7bit(u8 *s, u8 eol){
- while (*s != eol) if (*s++ > 0x7F) return 0;
- return 1;
-}
-
-u8 *s_copy(u8 *in, u8 eol, u8 *out){
- if (in == out) return out;
- while (*in != eol) *out++ = *in++;
- *out = eol;
- return out;
-}
-
-u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
-u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
-u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
-u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
-u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
-u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
-u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
-
-#if 0
-u8 *s_append_u32(u8 *out, u32 n) {
- if (n){
- n = bin2bcd_u32(n, 4); u8 digs = 8;
- while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
- while(digs--){
- *out++ = s_b2h4(n >> 28);
- n <<= 4;
- }
- } else *out++ = '0';
- *out = 0;
- return out;
-}
-
-
-u8 *s_append_s32(u8 *out, s32 n) {
- if (n < 0){
- out = s_append_c(out, '-');
- n = -n;
- }
- return s_append_u32(out, n);
-}
-#endif
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.h
deleted file mode 100644
index 8d46bd02..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/ul_s.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ul_s.h
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#ifndef UL_S_H_
-#define UL_S_H_
-
-#include "ul_other.h"
-
-
-// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
-// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
-
-// convert UCS2 codepoint to UTF8, returns number of bytes processed
-u8 ucs2_to_utf8(u32 in, u8 *out);
-// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
-
-
-// find length of line, terminated by eol char
-u16 s_len(u8 *s, u8 eol);
-
-// number of lines, separated by eol char
-u8 s_lines(u8 *s, u16 len, u8 eol);
-
-u8 c_upcase(u8 c);
-// uppercase string, in-place
-void s_upcase(u8 *s, u16 len);
-
-u8 s_h2b4(u8 hex);
-u8 s_b2h4(u8 b);
-
-// find start of line, delimited by eol char
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
-
-// skip CR/LF chars
-u8 *s_skip_crlf(u8 *s);
-
-// compare 2 strings, returns 1 if equal
-u8 s_cmp(u8 *s1, u8 *s2, u16 len);
-// compare 2 strings, upper-casing each char, returns 1 if equal
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
-
-// check if s starts with start
-u8 s_starts(u8 *s, char *start);
-// check if s ends with end
-u8 s_ends(u8 *s, char *end);
-
-// finds 1st occurence of char c, returns NULL if not found
-u8 *s_cpos(u8 *s, u8 c, u8 eol);
-
-// check if string is 7-bit
-u8 s_is_7bit(u8 *s, u8 eol);
-
-// copy in string (terminated by eol char) to out
-u8 *s_copy(u8 *in, u8 eol, u8 *out);
-
-
-// append string out to in, returns pointer after last char
-u8 *s_append_s (u8 *out, char *in);
-// append char to string buffer
-u8 *s_append_c (u8 *out, u8 c);
-// append Hex char to string buffer
-u8 *s_append_h4 (u8 *out, u8 n);
-// append Hex byte to string buffer
-u8 *s_append_h8 (u8 *out, u8 n);
-// append 16-bit Hex to string buffer
-u8 *s_append_h16(u8 *out, u16 n);
-// append 24-bit Hex to string buffer
-u8 *s_append_h24(u8 *out, u32 n);
-// append 32-bit Hex to string buffer
-u8 *s_append_h32(u8 *out, u32 n);
-
-
-// parse decimal number
-u32 s_parse_dec(u8 *s, u8 len);
-// parse hex number
-u32 s_parse_hex(u8 *s, u8 len);
-
-#endif /* UL_S_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/version.txt
index b0b37441..5f14daa7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/azx/pdu_codec/version.txt
@@ -1,3 +1,7 @@
+1.0.3
+New dcs decoding functionality
+Output encoding selection
+-----------
1.0.2
azx_pdu_convertZeroPaddedHexIntoByte arrays initialization and casting
-----------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/metadata.json
old mode 100755
new mode 100644
index 1264290a..39e79151
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/M2MB_main.c
index 0a23e152..f08cec96 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/M2MB_main.c
@@ -14,7 +14,7 @@
Sample application showcasing how to create and decode PDUs to be used with m2mb_sms_* API set. A SIM card and antenna must be present. Debug prints on AUX UART
@version
- 1.0.4
+ 1.0.5
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -42,7 +42,7 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
@@ -52,7 +52,7 @@
/* Local defines ================================================================================*/
-#define SMS_PDU_MAX_SIZE 400
+
#define SENDER_NUMBER "+391234567890" //remember to store the phone number in international format
@@ -241,6 +241,10 @@ void M2MB_main( int argc, char **argv )
AZX_LOG_ERROR("SMS not sent! - unexpected value %d returned\r\n", osRes);
}
+ //App waiting for incoming SMSs
+ AZX_LOG_INFO( "Waiting for an incoming SMS...\r\n" );
+
+
#ifdef LE910CXL
/* On Linux based LE910CX Linux, the end fo M2MB_main causes the return of the application.
Add a loop to allow reception of messages*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/callbacks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/callbacks.c
index e3cec8f2..1e30aee2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/callbacks.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_PDU/src/callbacks.c
@@ -34,11 +34,12 @@
#include "azx_log.h"
#include "azx_utils.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
#include "callbacks.h"
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
@@ -118,7 +119,7 @@ void Sms_Callback(M2MB_SMS_HANDLE h, M2MB_SMS_IND_E sms_event, UINT16 resp_size,
{
pdu_struct packet;
static char number[32];
- static char message[161];
+ static char message[SMS_PDU_MAX_SIZE]; //more bytes needed due to HEX_raw outtput format
INT32 len;
AZX_LOG_INFO("M2MB_SMS_READ_RESP Callback\r\n\n");
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/Makefile.in
index fdb8fc1c..f986248e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c
new file mode 100755
index 00000000..786e2684
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c
@@ -0,0 +1,1418 @@
+/*
+ * azx_common.c
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#include "azx_pduCommon.h"
+
+#include
+#include
+#include
+
+
+/*
+ Setting out_fmt variable, output can be represented in hex raw (if coding is 8-bit or UCS2) or utf8. Default is utf8.
+ Variable can be set/read runtime using function pdu_set_output_format/get_set_output_format
+ */
+
+static SMS_TXT_OUT_FMT_E out_fmt = UTF8_default;
+//SMS_TXT_OUT_FMT_E out_fmt = HEX_raw;
+
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
+ u8 n = 0; u16 o;
+ if (in[0] < 0x80){ n = 1; o = in[0]; }
+ else if ((in[0] & 0xE0) == 0xE0){
+ if ((in[1] != 0) && (in[2] != 0)){
+ n = 3;
+ o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
+ }
+ } else if ((in[0] & 0xC0) == 0xC0){
+ if (in[1] != 0){
+ n = 2;
+ o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
+ }
+ }
+ if (n){
+ if (be){
+ *((u8 *)out) = o >> 8;
+ *((u8 *)out + 1) = o;
+ } else {
+ *((u8 *)out) = o;
+ *((u8 *)out + 1) = o >> 8;
+ }
+ }
+ return n;
+}
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
+ if (in_len == 0) in_len = s_len(in,0);
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = utf8_to_ucs2(in, out, be);
+ if (n == 0) in_len = 0;
+ else {
+ in += n;
+ out++; out_len++;
+ in_len = (in_len >= n) ? (in_len - n) : 0;
+ }
+ }
+ return out_len;
+}
+
+
+u8 ucs2_to_utf8(u32 in, u8 *out){
+ u8 n = 0;
+ if (in < 0x80){
+ out[0] = in;
+ out[1] = 0;
+ n = 1;
+ }
+ else if ((in >= 0x80) && (in < 0x800)){
+ out[0] = (in >> 6) | 0xC0;
+ out[1] = (in & 0x3F) | 0x80;
+ out[2] = 0;
+ n = 2;
+ }
+ else if ((in >= 0x800) && (in < 0xFFFF)){
+ if (!((in >= 0xD800) && (in <= 0xDFFF))){
+ out[0] = (in >> 12) | 0xE0;
+ out[1] = ((in >> 6 ) & 0x3F) | 0x80;
+ out[2] = (in & 0x3F) | 0x80;
+ out[3] = 0;
+ n = 3;
+ }
+ }
+ else if ((in >= 0x10000) && (in < 0x10FFFF)){
+ out[0] = 0xF0 | (in >> 18);
+ out[1] = 0x80 | ((in >> 12) & 0x3F);
+ out[2] = 0x80 | ((in >> 6) & 0x3F);
+ out[3] = 0x80 | ((in & 0x3F));
+ out[4] = 0;
+ return 4;
+ }
+ return n;
+}
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = ucs2_to_utf8(
+ (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
+ if (n == 0) in_len = 0;
+ else {
+ in++; in_len--;
+ out += n; out_len += n;
+ }
+ }
+ return out_len;
+}
+
+u16 s_len(u8 *s, u8 eol){
+ if (s == NULL) return 0;
+ u16 l = 0;
+ while (*s++ != eol) l++;
+ return l;
+}
+u8 s_lines(u8 *s, u16 len, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 n = 0;
+ while (len--) if (*s++ == eol) n++;
+ return n;
+}
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 l = 0;
+ while (len-- && (l < line))
+ if (*s++ == eol) l++;
+ return (len == 0) ? NULL : s;
+}
+u8 *s_skip_crlf(u8 *s){
+ while ((*s == '\r')||(*s == '\n')) s++;
+ return s;
+}
+
+u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
+void s_upcase(u8 *s, u16 len){
+ if (len == 0) len = s_len(s, 0);
+ while (len--){
+ *s = c_upcase(*s);
+ s++;
+ }
+}
+
+u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
+u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
+
+u8 s_cmp(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (*s1++ != *s2++) return 0;
+ return 1;
+}
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
+ return 1;
+}
+
+u8 s_starts(u8 *s, char *start){
+ while (*start != 0) if (*s++ != *start++) return 0;
+ return 1;
+}
+u8 s_ends(u8 *s, char *end){
+ u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
+ if ((el > 0)&&(sl >= el)){
+ s += sl - 1; end += el - 1;
+ while (el--) if (*s-- != *end--) return 0;
+ return 1;
+ }
+ return 0;
+}
+
+u8 *s_cpos(u8 *s, u8 c, u8 eol){
+ while(*s != eol){
+ if (*s == c) return s;
+ s++;
+ }
+ return NULL;
+}
+
+u32 s_parse_dec(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
+ return n;
+}
+u32 s_parse_hex(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
+ n = (n << 4) + s_h2b4( *s++ );
+ return n;
+}
+
+u8 s_is_7bit(u8 *s, u8 eol){
+ while (*s != eol) if (*s++ > 0x7F) return 0;
+ return 1;
+}
+
+u8 *s_copy(u8 *in, u8 eol, u8 *out){
+ if (in == out) return out;
+ while (*in != eol) *out++ = *in++;
+ *out = eol;
+ return out;
+}
+
+u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
+u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
+u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
+u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
+u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
+u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
+u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
+
+#if 0
+u8 *s_append_u32(u8 *out, u32 n) {
+ if (n){
+ n = bin2bcd_u32(n, 4); u8 digs = 8;
+ while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
+ while(digs--){
+ *out++ = s_b2h4(n >> 28);
+ n <<= 4;
+ }
+ } else *out++ = '0';
+ *out = 0;
+ return out;
+}
+
+
+u8 *s_append_s32(u8 *out, s32 n) {
+ if (n < 0){
+ out = s_append_c(out, '-');
+ n = -n;
+ }
+ return s_append_u32(out, n);
+}
+#endif
+
+void *memset2(void *dest, int val, size_t len) {
+ u8 *dest1 = (u8*) dest;
+ while (len--) *dest1++ = (u8)val;
+ return dest;
+}
+
+void *memcpy2(void *dest, const void *src, size_t len) {
+ u8 *dest1 = (u8 *) dest;
+ u8 *src1 = (u8 *)src;
+ while (len--) *dest1++ = *src1++;
+ return dest;
+}
+
+u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n) {
+ u32 quot = n >> 1;
+ quot += quot >> 1;
+ quot += quot >> 4;
+ quot += quot >> 8;
+ quot += quot >> 16;
+ u32 qq = quot & ~7ul;
+ quot >>= 3;
+ divmod10_u32_rem = n - ((quot << 1) + qq);
+ if (divmod10_u32_rem > 9) {
+ divmod10_u32_rem -= 10;
+ quot++;
+ }
+ return quot;
+}
+
+u8 asc_point = '.';
+u8 asc_space = ' ';
+u8 asc_minus = '-';
+
+u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
+
+u8 bin2bcd_u8( u8 bin ) {
+ u8 tens = 0;
+ while (bin > 9) { bin -= 10; tens++; }
+ return ( (tens << 4) + bin );
+}
+
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
+
+ "bin2bcd_u32_00: \n" // correct input number by left shifts
+ "mov r31, %A[data] \n"
+ "mov %A[data], %B[data] \n"
+ "mov %B[data], %C[data] \n"
+ "mov %C[data], %D[data] \n"
+ "mov %D[data], r31 \n"
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_00 \n"
+
+ "eor r26, r26 \n" // result=0
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %[result_bytes] \n"
+ "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bin2bcd_u32_01: \n" // bits shift and correction loop
+ "subi r26,-0x33 \n" // add 0x33
+ "sbrs r26, 3 \n" // if carry to bit 3,
+ "subi r26, 3 \n" // subtract 3
+ "sbrs r26, 7 \n" // if carry to bit 7,
+ "subi r26, 0x30 \n" // subtract 0x30
+ "subi r27,-0x33 \n" // add 0x33
+ "sbrs r27, 3 \n" // if carry to bit 3,
+ "subi r27, 3 \n" // subtract 3
+ "sbrs r27, 7 \n" // if carry to bit 7,
+ "subi r27, 0x30 \n" // subtract 0x30
+ "subi r30,-0x33 \n" // add 0x33
+ "sbrs r30, 3 \n" // if carry to bit 3,
+ "subi r30, 3 \n" // subtract 3
+ "sbrs r30, 7 \n" // if carry to bit 7,
+ "subi r30, 0x30 \n" // subtract 0x30
+ "subi r31,-0x33 \n" // add 0x33
+ "sbrs r31, 3 \n" // if carry to bit 3,
+ "subi r31, 3 \n" // subtract 3
+ "sbrs r31, 7 \n" // if carry to bit 7,
+ "subi r31, 0x30 \n" // subtract 0x30
+ "lsl r26 \n" // shift result number
+ "rol r27 \n"
+ "rol r30 \n"
+ "rol r31 \n"
+
+ "sbrc %D[data], 7 \n" // skip if msbit of input == 0
+ "ori r26, 1 \n" // set lsb of output
+ "lsl %A[data] \n" // shift input number
+ "rol %B[data] \n"
+ "rol %C[data] \n"
+ "rol %D[data] \n"
+
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_01 \n" // repeat for all bits
+
+ //"mov %A[result], r26 \n" // move to result
+ //"mov %B[result], r27 \n"
+ //"mov %C[result], r30 \n"
+ //"mov %D[result], r31 \n"
+
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result) // output
+ :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
+ :"r26","r27","r30","r31" // clobbers
+ );
+ return result;
+}
+#endif
+
+u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
+ data <<= 8;
+ for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
+ /*result BCD nibbles correction*/
+ result += 0x33333333;
+ /*result correction loop*/
+ for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
+ u8 corr_byte = result >> 24;
+ if (!(corr_byte & 0x08)) corr_byte -= 0x03;
+ if (!(corr_byte & 0x80)) corr_byte -= 0x30;
+ result <<= 8; /*shift result*/
+ result += corr_byte; /*set 8 bits of result*/
+ }
+ /*shift next bit of input to result*/
+ result <<= 1;
+ if (((u8)(data >> 24)) & 0x80)
+ result |= 1;
+ data <<= 1;
+ }
+ return(result);
+}
+
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
+ u32 result = 0;
+ result_bytes = 0;
+ while (data > 0) {
+ result += (data % 10) << result_bytes;
+ data /= 10;
+ result_bytes += 4;
+ }
+ return result;
+}
+
+u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
+ static ldiv_t bin2bcd_ldiv_result;
+ bin2bcd_ldiv_result.quot = value;
+ u32 result = 0;
+ nbytes = 0;
+ while (bin2bcd_ldiv_result.quot > 0) {
+ bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
+ result += bin2bcd_ldiv_result.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+struct divmod10_t {
+ uint32_t quot;
+ uint8_t rem;
+} divmodu10_res;
+inline static void divmodu10(u32 n) {
+ divmodu10_res.quot = n >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 4;
+ divmodu10_res.quot += divmodu10_res.quot >> 8;
+ divmodu10_res.quot += divmodu10_res.quot >> 16;
+ u32 qq = divmodu10_res.quot & ~7ul;
+ divmodu10_res.quot >>= 3;
+ divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
+ if (divmodu10_res.rem > 9) {
+ divmodu10_res.rem -= 10;
+ divmodu10_res.quot++;
+ }
+}
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
+ u32 result = 0; nbytes = 0;
+ divmodu10_res.quot = value;
+ while (divmodu10_res.quot != 0) {
+ divmodu10(divmodu10_res.quot);
+ result += divmodu10_res.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+#ifdef __AVR__
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "eor r26, r26 \n" /* result = 0 */
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bcd2bin_u32_00: \n" /* bits shift and correction loop */
+ "lsr r31 \n" /* shift out buffer */
+ "ror r30 \n"
+ "ror r27 \n"
+ "ror r26 \n"
+
+ "sbrc %A[data], 0 \n" /* move lowest bit to result */
+ "ori r31, 0x80 \n"
+
+ "lsr %D[data] \n"
+ "ror %C[data] \n"
+ "ror %B[data] \n"
+ "ror %A[data] \n"
+
+ "sbrc %D[data], 7 \n" /* if carry to bit 7, */
+ "subi %D[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %D[data], 3 \n" /* if carry to bit 3, */
+ "subi %D[data], 3 \n" /* subtract 3 */
+ "sbrc %C[data], 7 \n" /* if carry to bit 7, */
+
+ "subi %C[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %C[data], 3 \n" /* if carry to bit 3, */
+ "subi %C[data], 3 \n" /* subtract 0x30 */
+ "sbrc %B[data], 7 \n" /* if carry to bit 7, */
+ "subi %B[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %B[data], 3 \n" /* if carry to bit 3, */
+ "subi %B[data], 3 \n" /* subtract 3 */
+ "sbrc %A[data], 7 \n" /* if carry to bit 7, */
+ "subi %A[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %A[data], 3 \n" /* if carry to bit 3, */
+ "subi %A[data], 3 \n" /* subtract 3 */
+
+ "dec __tmp_reg__ \n" /* repeat for all bits */
+ "brne bcd2bin_u32_00 \n"
+
+ // "movw %A[result], r26 \n" /* adjust result */
+ // "movw %C[result], r30 \n"
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "bcd2bin_u32_01: \n"
+ "mov __tmp_reg__,r25 \n"
+ "mov r25,r24 \n"
+ "mov r24,r23 \n"
+ "mov r23,r22 \n"
+ "mov r22,__tmp_reg__ \n"
+ "dec %[result_bytes] \n"
+ "brne bcd2bin_u32_01 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
+ );
+ return result;
+}
+#endif
+
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
+ /*shift next bit*/
+ result >>= 1;
+ if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
+ data >>= 1;
+ /* result BCD correction */
+ for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
+ u8 tmp_byte = (data >> 24);
+ if (tmp_byte & 0x80) tmp_byte -= 0x30;
+ if (tmp_byte & 0x08) tmp_byte -= 0x03;
+ data <<= 8;
+ data |= tmp_byte;
+ }
+ }
+ /*adjust result bytes*/
+ for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
+ result >>= 8;
+ return(result);
+}
+
+u8 asc2bin_u8(u8 data) {
+ if ((data >= '0') && (data <= '9')) data -= '0';
+ else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
+ else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
+ else data = 0xf0;
+ return(data);
+}
+
+u8 bin2asc_u8(u8 data) {
+ data &= 0xf;
+ return (data > 9) ? (data + 'A' - 10) : (data + '0');
+}
+
+u32 asc2bin_u32(u8 *buf, s8 size) {
+ u32 result;
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ result = 0;
+ while(size) {
+ u8 tmp_u8 = asc2bin_u8(*buf);
+ if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
+ result <<= 4;
+ result |= tmp_u8;
+ }
+ size--;
+ if (flag_negative) buf--;
+ else buf++; /*go to next symbol*/
+ }
+ return(result);
+}
+
+void bin2asc_u32(u32 data, u8 *buf, s8 size) {
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ while (size) {
+ *buf = bin2asc_u8(data);
+ data >>= 4;
+ if (flag_negative) buf--;
+ else buf++;
+ size--;
+ if (data == 0) size = 0; /*stop conversion on zero*/
+ }
+}
+
+void num2asc_s32(s32 data, u8 *buf, u8 flags) {
+ u8 cnt_chars = (flags & 7); //number of digits
+ //convert negative to positive, set '-' flag
+ if (data < 0) {data = -data; flags |= 1;}
+ else flags &= ~1;
+ //if necessary, convert to BCD
+ //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
+ cnt_chars++;
+ //calculate point position
+ u8 point_pos = cnt_chars - ((flags >> 4) & 7);
+ if (point_pos) point_pos++;
+ flags |= 2;
+ while (cnt_chars) { //digits conversion loop
+ if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
+ if (flags & 1) *buf = asc_minus;
+ else if (flags & 2) *buf = '0';
+ else *buf = asc_space;
+ flags &= ~1;
+ } else {
+ //show point
+ if ((cnt_chars == point_pos) && (flags & 0x70)) {
+ *buf-- = asc_point;
+ cnt_chars--;
+ }
+ *buf = bin2asc_u8(data); //show ASCII digit
+ }
+ cnt_chars--;
+ buf--;
+ data >>= 4;
+ flags &= ~2;
+ }
+ if (flags & 1) *buf = asc_minus;
+}
+
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
+{
+ uint8_t len_msg = 0;
+ uint8_t i = 0;
+ uint8_t check = 160;
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x00)
+ Str[j] = '@';
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x11)
+ Str[j] = '_';
+
+ while((i < len) && (check--))
+ {
+ if(*Str == 0x1B)
+ {
+ // |
+ if(*(uint16_t*)Str == 0x401B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '|';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // "\"
+ if(*(uint16_t*)Str == 0x2F1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '\\';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ^
+ if(*(uint16_t*)Str == 0x141B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '^';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // [
+ if(*(uint16_t*)Str == 0x3C1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '[';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ]
+ if(*(uint16_t*)Str == 0x3E1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = ']';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // {
+ if(*(uint16_t*)Str == 0x281B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '{';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // }
+ if(*(uint16_t*)Str == 0x291B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '}';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ~
+ if(*(uint16_t*)Str == 0x3D1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '~';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // euro
+ if(*(uint16_t*)Str == 0x651B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '?';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+ }
+ else
+ {
+ i++;
+ len_msg++;
+ Str++;
+ }
+ }
+
+ return len_msg;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_7to8(uint8_t *a, uint8_t len)
+{
+ //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
+ //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
+ //'Hello!' -> C8 32 9B FD 0E 01
+ if (len == 0)
+ len = s_len(a,0);
+
+ a[len] = 0;
+ len++;
+
+ // Correct symbol @
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '@')
+ a[j] = 0x00;
+
+ // Correct symbol _
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '_')
+ a[j] = 0x11;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len-2); i1++)
+ {
+ for (uint8_t i2=(len-1); i2>i1; i2--)
+ {
+ a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
+ a[i2] >>= 1;
+ }
+ }
+ }
+
+ len--;
+
+ return len - (len >> 3);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_8to7(uint8_t *a, uint8_t len)
+{
+ uint8_t len1 = len + (len >> 3);
+
+ while (len < len1)
+ a[len++] = 0;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len1-1); i1++)
+ for (uint8_t i2=(len1-1); i2>i1; i2--)
+ a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
+ }
+
+ for (uint8_t i=0; i= n) ? (in_len - n) : 0;
+// }
+// }
+// return out_len;
+//}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t swap8 (uint8_t b)
+{
+ return (b << 4)|(b >> 4);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t swap16(uint16_t w)
+{
+ return (w << 8)|(w >> 8);
+}
+#include
+#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
+{
+ if (len == 0)
+ return;
+
+ len >>= 1;
+
+ while (len--)
+ {
+ *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
+ h += 2;
+ }
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
+{
+ if (len == 0)
+ return;
+
+ b += len-1; h += ((uint16_t)len << 1) - 1;
+ while (len--)
+ {
+ *h-- = s_b2h4(*b & 0xF);
+ *h-- = s_b2h4(*b-- >> 4);
+ }
+}
+
+
+uint8_t convert_binary_coded_to_decimal(uint8_t hex)
+{
+ uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
+ return dec;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+/*DCS decoding function*/
+dcs_struct pdu_decode_dcs(uint8_t tp_dcs)
+{
+ dcs_struct sm_dcs;
+ uint8_t alpha_byte, class_byte;
+
+ if ( ( (tp_dcs & 0xc0) == 0)) /* coding group: 00xx */
+ {
+ if ( tp_dcs & 0x20 )
+ sm_dcs.smCompressed = 1; /* compressed */
+ else
+ sm_dcs.smCompressed = 0;
+
+
+ alpha_byte = ( tp_dcs & 0x0c ) >> 2; /* alphabet */
+ if ( alpha_byte == 0 )
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ else if ( alpha_byte == 1 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else if ( alpha_byte == 2 )
+ sm_dcs.smAlphabet = PDU_DCS_UCS2;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_AUTO;
+
+ if ( tp_dcs & 0x10 ) /* bit 1 and 0 have class meaning */
+ {
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ }
+ else
+ sm_dcs.smClass = noClass;
+
+ } else if ( (tp_dcs >> 4) == 0x0f ){ /* coding group: 1111 */
+ sm_dcs.smCompressed = 0;
+
+ if ( tp_dcs & 0x04 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_7;
+
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ } else {/* reserved codings groups: assume 7 bit, uncompressed, class 2 */
+
+ sm_dcs.smCompressed = 0;
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ sm_dcs.smClass = class2;
+ }
+ return sm_dcs;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ int8_t tz_sign = 1;
+ dcs_struct sm_dcs; /*Added dcs decoding in alphabet, class and compressed*/
+
+ if (len == 0)
+ len = s_len(in, 0);
+
+ len >>= 1;
+
+ out->smsc.len = in[0];
+ out->smsc.bytes = out->smsc.len - 1;
+
+ if (in[0] == 7)
+ {
+ out->smsc.type = in[1];
+ for (uint8_t i=0; i<(out->smsc.bytes); i++)
+ out->smsc.data[i] = in[i+2];
+ }
+
+ in += out->smsc.len + 1;
+
+ out->first = *in++;
+ out->sender.len = *in++;
+ out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
+ out->sender.type = *in++;
+ for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
+ out->sender.data[i] = *in++;
+
+ out->tp_pid = *in++;
+ out->tp_dcs = *in++;
+
+ out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
+ //*in = 0x4a;
+ out->tz = swap8( *in++ );
+
+ if ((out->tz & 0x80) == 0x80)
+ {
+ tz_sign = -1;
+ }
+
+ out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
+
+ out->msg.len = out->msg.bytes = *in++;
+
+ // correction for 7-bit encoding
+
+ /*Now dcs has been correctly decoded*/
+ sm_dcs = pdu_decode_dcs(out->tp_dcs);
+ out->tp_dcs = sm_dcs.smAlphabet;
+ /**/
+ if (out->tp_dcs == PDU_DCS_7)
+ out->msg.bytes -= (out->msg.bytes >> 3);
+ // decode message text (if output buffer is given)
+ out->msg.data = in;
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ pdu_hex2bytes(in, len, in);
+ pdu_in_decode_binary(in, len, out);
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+#if 1
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+ if (pdu_get_output_format() == UTF8_default) {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ } else if(pdu_get_output_format() == HEX_raw) {
+ uint16_t i, j;
+ uint8_t tmpByte;
+
+ j = 0;
+
+ for ( i = 0; i < in_bytes; i++ )
+ {
+
+ tmpByte = ( in[i] & 0x00FF );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0xF0 ) >> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+
+ }
+
+ in_bytes = j;
+ out += in_bytes;
+ }
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ for (uint8_t i=0; i> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+ }
+ //out[j] = '\0';
+ in_bytes = j;
+ out += in_bytes;
+ } else {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ }
+ }
+ }
+
+ *out = 0;
+
+ return in_bytes;
+}
+
+
+#else //original
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ }
+
+ for (uint8_t i=0; ismsc.len;
+ // fill SMSC data
+ if (in->smsc.len)
+ {
+ *out++ = in->smsc.type;
+ for (uint8_t i=0; i<(in->smsc.len-1); i++)
+ *out++ = in->smsc.data[i];
+ len = in->smsc.len;
+ }
+
+ *out++ = in->first; // 1st octet (0x11)
+ *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+
+ in->sender.bytes = pdu_phone_bytes(in->sender.data);
+ in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
+ *out++ = in->sender.len; // address length, digits
+ *out++ = in->sender.type; // type-of-address
+ for (uint8_t i=0; isender.bytes; i++)
+ *out++ = in->sender.data[i];
+
+ *out++ = in->tp_pid; // TP-PID. Protocol identifier
+
+ if (in->tp_dcs == PDU_DCS_AUTO)
+ in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
+
+ *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
+
+ *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
+ len += in->sender.bytes + 8;
+
+ // add message
+ in->msg.len = s_len(in->msg.data,0);
+
+ if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
+ {
+ in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
+ *out++ = in->msg.len;
+ }
+ else
+ {
+ *out++ = in->msg.len;
+ s_copy(in->msg.data, 0, out);
+ if (in->tp_dcs == PDU_DCS_7)
+ in->msg.bytes = pdu_7to8(out, in->msg.len);
+ else
+ in->msg.bytes = in->msg.len;
+ }
+
+ out -= len;
+ len += in->msg.bytes;
+ pdu_bytes2hex(out, len, out);
+ in->len_bytes = len << 1;
+ in->len_cmgs = len - in->smsc.len - 1;
+ out[in->len_bytes] = 0;
+
+ return in->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
+{
+ pdu->first = 0x11;
+ pdu->tp_msg_ref = 0;
+ pdu->tp_pid = 0;
+ pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
+
+ pdu->smsc.len = 0;
+
+ pdu->sender.type = PDU_TYPE_INTERNATIONAL;
+
+
+ if (pdu_phone_is_packed((uint8_t *)sender)) {
+ pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
+ }
+ else{
+ pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
+ }
+
+
+ //pdu->tp_dcs = PDU_DCS_AUTO;
+ //pdu->tp_dcs = PDU_DCS_8;
+ pdu->tp_dcs = dcs;
+ pdu->msg.data = (uint8_t *)msg;
+
+ pdu_out_encode(pdu, out);
+
+ return pdu->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
+{
+ uint8_t n = 0;
+
+ if (*in == '+')
+ in++;
+
+ while ((*in >= '0')&&(*in <= '9'))
+ {
+ *out = s_h2b4(*in++);
+ if (*in)
+ {
+ *out |= s_h2b4(*in) << 4;
+ in++;
+ n++;
+ }
+ else
+ *out |= 0xF0;
+
+ n++;
+ out++;
+ }
+
+ *out = 0xFF;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
+{
+ uint8_t n = 0;
+
+ if (type == PDU_TYPE_INTERNATIONAL)
+ *out++ = '+';
+
+ while (len--)
+ {
+ *out++ = s_b2h4(*in & 0xF);
+ n++;
+
+ if ((*in & 0xF0) != 0xF0)
+ {
+ *out++ = s_b2h4(*in >> 4);
+ n++;
+ }
+
+ in++;
+ }
+
+ *out = 0;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_is_packed(uint8_t *phone)
+{
+ return *phone != '+';
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits_bytes(uint8_t digits)
+{
+ return (digits + (digits & 1)) >> 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_bytes(uint8_t *in)
+{
+ uint8_t len = 0;
+
+ while (*in++ != 0xFF)
+ len++;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
+{
+ uint8_t len = bytes << 1;
+
+ if ((in[bytes-1] & 0xF0) == 0xF0)
+ len--;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
+{
+ if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
+ return 0;
+
+ while (in1_bytes--) if (*in1++ != *in2++)
+ return 0;
+
+ return 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_phone_copy(uint8_t *in, uint8_t *out)
+{
+ if (in == out)
+ return;
+
+ uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
+
+ while (*in != eop)
+ *out++ = *in++;
+
+ *out = eop;
+}
+
+//Functions to convert SMS text in raw hex output (as specified by 3GPP TS 27.005)
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format)
+{
+ out_fmt = output_format;
+}
+
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void)
+{
+ return out_fmt;
+}
+
+static const uint8_t ha_form[] =
+{
+ '0',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F'
+};
+
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb)
+{
+ /* convert it into ASCII code */
+ return (ha_form[(LV_nmb & 0x0F)]);
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h
new file mode 100755
index 00000000..33438ac2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h
@@ -0,0 +1,369 @@
+/*
+ * azx_common.h
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#ifndef AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+#define AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+
+#include
+#include
+
+#ifndef offsetof
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+#endif
+#ifndef countof
+#define countof(arg) (sizeof(arg) / sizeof(arg[0]))
+#endif
+
+//attributes
+#define WEAK __attribute__ ((weak))
+#define NAKED __attribute__ ((naked))
+#define INTERRUPT __attribute__ ((__interrupt__))
+#define USED __attribute__ ((used))
+#define NORETURN __attribute__ ((noreturn))
+#define SECTION(s) __attribute__ ((section(s)))
+#define NOINIT SECTION(".noinit")
+#define ALIAS(a) __attribute__ ((weak, alias (a)))
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define OPTIMIZE(level) __attribute__ ((optimize(level)))
+
+//architecture-specific inlines
+#ifdef __AVR
+#define wdr() asm volatile("wdr")
+#define nop() asm volatile("nop")
+#define sleep() asm volatile("sleep")
+#else
+#define PROGMEM
+#endif
+
+#ifdef __i8051
+#define cli() EI = 0
+#define sei() EI = 1
+#endif
+
+#ifdef __STM8
+#define cli() _asm("sim")
+#define sei() _asm("rim")
+#define nop() _asm("nop")
+#define wdr() { IWDG_KR = 0xAA; }
+#endif
+
+#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
+#define cli() asm volatile ( "CPSID i \n" )
+#define sei() asm volatile ( "CPSIE i \n" )
+#endif
+
+//short named types
+typedef uint8_t u8;
+typedef int8_t s8;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+typedef int64_t s64;
+typedef float f32;
+typedef double f64;
+#ifdef __float128
+typedef __float128 f128;
+#endif
+
+//bit mask
+#define B(_b) (1 << (_b))
+#define BIT(_b) (1 << (_b))
+
+//Increment/decrement, Add/Subtract with range rollover/limit
+#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
+#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
+#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
+#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
+#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
+#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
+#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
+#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
+#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
+#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
+#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
+#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+#ifdef __ARM_ARCH_7M__
+//ARM Cortex BitBand access macros
+#define BITBAND_SRAM_REF 0x20000000
+#define BITBAND_SRAM_BASE 0x22000000
+// Convert SRAM address
+#define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
+#define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
+
+#define BITBAND_PERI_REF 0x40000000
+#define BITBAND_PERI_BASE 0x42000000
+// Convert PERIPHERAL address
+#define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
+#define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
+#endif
+
+//memset - simple verion
+void *memset2(void *dest, int val, size_t len);
+//memcpy - simple verion
+void *memcpy2(void *dest, const void *src, size_t len);
+
+extern u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n);
+
+
+// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
+// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
+
+// convert UCS2 codepoint to UTF8, returns number of bytes processed
+u8 ucs2_to_utf8(u32 in, u8 *out);
+// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
+
+
+// find length of line, terminated by eol char
+u16 s_len(u8 *s, u8 eol);
+
+// number of lines, separated by eol char
+u8 s_lines(u8 *s, u16 len, u8 eol);
+
+u8 c_upcase(u8 c);
+// uppercase string, in-place
+void s_upcase(u8 *s, u16 len);
+
+u8 s_h2b4(u8 hex);
+u8 s_b2h4(u8 b);
+
+// find start of line, delimited by eol char
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
+
+// skip CR/LF chars
+u8 *s_skip_crlf(u8 *s);
+
+// compare 2 strings, returns 1 if equal
+u8 s_cmp(u8 *s1, u8 *s2, u16 len);
+// compare 2 strings, upper-casing each char, returns 1 if equal
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
+
+// check if s starts with start
+u8 s_starts(u8 *s, char *start);
+// check if s ends with end
+u8 s_ends(u8 *s, char *end);
+
+// finds 1st occurence of char c, returns NULL if not found
+u8 *s_cpos(u8 *s, u8 c, u8 eol);
+
+// check if string is 7-bit
+u8 s_is_7bit(u8 *s, u8 eol);
+
+// copy in string (terminated by eol char) to out
+u8 *s_copy(u8 *in, u8 eol, u8 *out);
+
+
+// append string out to in, returns pointer after last char
+u8 *s_append_s (u8 *out, char *in);
+// append char to string buffer
+u8 *s_append_c (u8 *out, u8 c);
+// append Hex char to string buffer
+u8 *s_append_h4 (u8 *out, u8 n);
+// append Hex byte to string buffer
+u8 *s_append_h8 (u8 *out, u8 n);
+// append 16-bit Hex to string buffer
+u8 *s_append_h16(u8 *out, u16 n);
+// append 24-bit Hex to string buffer
+u8 *s_append_h24(u8 *out, u32 n);
+// append 32-bit Hex to string buffer
+u8 *s_append_h32(u8 *out, u32 n);
+
+
+// parse decimal number
+u32 s_parse_dec(u8 *s, u8 len);
+// parse hex number
+u32 s_parse_hex(u8 *s, u8 len);
+
+extern u8 asc_point;
+extern u8 asc_space;
+extern u8 asc_minus;
+
+/** convert lower nibble to HEX symbol */
+#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
+
+/** 8-bit BCD->BIN conversion */
+u8 bcd2bin_u8( u8 bcd );
+/** 8-bit BIN->BCD conversion */
+u8 bin2bcd_u8( u8 bin );
+
+// 32-bit BIN->BCD conversion using shifts and correction
+//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
+
+// 32-bit BIN->BCD conversion using hardware divider
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using ldiv
+u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using fast soft div
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
+
+// 32-bit BCD->BIN conversion
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
+
+u8 asc2bin_u8(u8 data);
+u8 bin2asc_u8(u8 data);
+u32 asc2bin_u32(u8 *buf, s8 size);
+void bin2asc_u32(u32 data, u8 *buf, s8 size);
+
+// AVR-optimized conversions
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
+u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
+#endif
+
+/** convert 32-bit signed data to ASCII number to buffer (right to left)
+ * options & 7 - width-1,
+ * (options >> 4) & 7 - point position,
+ * options & 0x08 - supress leading zeros,
+ * options & 0x80 - convert to BCD.
+ */
+#define NUM2ASC_BCD (u8)0x80
+#define NUM2ASC_NOZEROS (u8)0x08
+#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
+#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
+#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
+void num2asc_s32(s32 data, u8 *buf, u8 flags);
+inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
+
+// calculate number width
+
+inline u8 width_i32(s32 n){
+ u8 s = 0;
+ if (n < 0){ s = 1; n = -n; }
+ return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
+ ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
+}
+
+#define SMS_PDU_MAX_SIZE 400
+
+// data coding scheme
+enum
+{
+ PDU_DCS_7 = 0,
+ PDU_DCS_8 = 0x4,
+ PDU_DCS_UCS2 = 0x08,
+ PDU_DCS_AUTO = 0xFF
+};
+
+//SMS classes
+enum
+{
+ class0 = 0,
+ class1,
+ class2,
+ class3,
+ noClass = 0xFF
+};
+
+//Output format
+typedef enum
+{
+
+ HEX_raw = 0,
+ UTF8_default
+}SMS_TXT_OUT_FMT_E;
+
+// number format
+enum
+{
+ PDU_TYPE_NATIONAL = 0xA1,
+ PDU_TYPE_INTERNATIONAL = 0x91,
+ PDU_TYPE_ALPHADET = 0xD0,
+ PDU_TYPE_NETWORK = 0xB1
+};
+
+typedef struct
+{
+ // SMSC number
+ struct{ uint8_t len, bytes, type, data[14]; }smsc;
+ // caller/sender number
+ struct{ uint8_t len, bytes, type, data[14]; }sender;
+ // input/output zero-terminated message (7bit/8bit/UTF8)
+ struct{ uint16_t len, bytes; uint8_t *data; }msg;
+
+ uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
+ uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+ uint8_t tp_pid; // Protocol identifier (0)
+ uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
+ uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
+
+ // incoming SMS timestamp
+ uint8_t year, month, date; // date
+ uint8_t hour, min, sec; // time
+ int8_t tz; // zone
+
+ // PDU length in bytes and for CMGS command
+ uint16_t len_bytes, len_cmgs;
+}pdu_struct;
+
+typedef struct
+{
+
+ uint8_t smCompressed;
+ uint8_t smAlphabet;
+ uint8_t smClass;
+
+}dcs_struct;
+
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format);
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void);
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb);
+
+// Change GSM 7-bit table to ANSI
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
+// pack 7-bit array to 8-bit
+uint8_t pdu_7to8(uint8_t *a, uint8_t len);
+// unpack 8-bit array to 7-bit
+uint8_t pdu_8to7(uint8_t *a, uint8_t len);
+
+// convert HEX line to bytes, len - length of input buffer
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
+// convert bytes to HEX line, len - length of input buffer
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
+
+// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
+
+// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
+// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
+
+// encode outcoming PDU
+uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
+// encode outcoming PDU, simple interface
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
+
+// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
+// unpack phone number to string, returns number of unpacked digits
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
+// check if phone is packed
+uint8_t pdu_phone_is_packed(uint8_t *phone);
+
+// get number of bytes from number of digits
+uint8_t pdu_phone_digits_bytes(uint8_t digits);
+// get number of bytes of packed phone
+uint8_t pdu_phone_bytes(uint8_t *in);
+// count number of digits
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
+
+// compare 2 packed phones
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
+// copy packed phone
+void pdu_phone_copy(uint8_t *in, uint8_t *out);
+
+#endif /* AZX_PDU_CODEC_AZX_PDUCOMMON_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
index fcc37bb3..42ad15d1 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
@@ -28,7 +28,7 @@
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduDec.h"
/* Local defines ================================================================================*/
@@ -87,9 +87,10 @@ INT32 azx_pdu_decode(UINT8 *pdu, UINT32 pdu_len, pdu_struct *packet, CHAR *numbe
//fill result buffer
+ /*Now dcs has been correctly decoded, including 8 bit case*/
pdu_in_decode_text(packet->msg.data,
packet->msg.len,
- (packet->tp_dcs == 0x00 ? PDU_DCS_7:PDU_DCS_UCS2),
+ (packet->tp_dcs),
(UINT8*)msg);
len_msg = packet->msg.len;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
index d0042998..3e6fb59d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
@@ -29,7 +29,7 @@
/** \defgroup pduDecUsage Usage of pdu decoding functionalities
* Functions usable to retrieve ASCII message and other info from a PDU message in binary format
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
index 525a6654..68617866 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
@@ -26,7 +26,8 @@
#include
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
index efe858ff..42a85ef4 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
@@ -30,7 +30,7 @@
/** \defgroup pduEncUsage Usage of pdu encoding functionalities
* Functions usable to create a PDU message from a string text
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
/**
@brief
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/readme b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/readme
old mode 100644
new mode 100755
index be00a200..98184a07
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/readme
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/readme
@@ -1,3 +1,3 @@
@brief Utility code to simplify parse/encode binary PDU to be used with `m2mb_sms_*` APIs
-@version 1.0.0
+@version 1.0.3
@dependencies
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c
deleted file mode 100755
index 7f4c0530..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * gsm_pdu.c
- *
- * Created on: Sep 15, 2014
- * Author: qwer
- */
-#include
-#include
-#include "ul_gsm_pdu.h"
-#include "ul_s.h"
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
-{
- uint8_t len_msg = 0;
- uint8_t i = 0;
- uint8_t check = 160;
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x00)
- Str[j] = '@';
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x11)
- Str[j] = '_';
-
- while((i < len) && (check--))
- {
- if(*Str == 0x1B)
- {
- // |
- if(*(uint16_t*)Str == 0x401B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '|';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // "\"
- if(*(uint16_t*)Str == 0x2F1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '\\';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ^
- if(*(uint16_t*)Str == 0x141B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '^';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // [
- if(*(uint16_t*)Str == 0x3C1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '[';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ]
- if(*(uint16_t*)Str == 0x3E1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = ']';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // {
- if(*(uint16_t*)Str == 0x281B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '{';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // }
- if(*(uint16_t*)Str == 0x291B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '}';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ~
- if(*(uint16_t*)Str == 0x3D1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '~';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // euro
- if(*(uint16_t*)Str == 0x651B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '?';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
- }
- else
- {
- i++;
- len_msg++;
- Str++;
- }
- }
-
- return len_msg;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_7to8(uint8_t *a, uint8_t len)
-{
- //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
- //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
- //'Hello!' -> C8 32 9B FD 0E 01
- if (len == 0)
- len = s_len(a,0);
-
- a[len] = 0;
- len++;
-
- // Correct symbol @
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '@')
- a[j] = 0x00;
-
- // Correct symbol _
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '_')
- a[j] = 0x11;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len-2); i1++)
- {
- for (uint8_t i2=(len-1); i2>i1; i2--)
- {
- a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
- a[i2] >>= 1;
- }
- }
- }
-
- len--;
-
- return len - (len >> 3);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_8to7(uint8_t *a, uint8_t len)
-{
- uint8_t len1 = len + (len >> 3);
-
- while (len < len1)
- a[len++] = 0;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len1-1); i1++)
- for (uint8_t i2=(len1-1); i2>i1; i2--)
- a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
- }
-
- for (uint8_t i=0; i= n) ? (in_len - n) : 0;
-// }
-// }
-// return out_len;
-//}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t swap8 (uint8_t b)
-{
- return (b << 4)|(b >> 4);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t swap16(uint16_t w)
-{
- return (w << 8)|(w >> 8);
-}
-#include
-#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
-{
- if (len == 0)
- return;
-
- len >>= 1;
-
- while (len--)
- {
- *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
- h += 2;
- }
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
-{
- if (len == 0)
- return;
-
- b += len-1; h += ((uint16_t)len << 1) - 1;
- while (len--)
- {
- *h-- = s_b2h4(*b & 0xF);
- *h-- = s_b2h4(*b-- >> 4);
- }
-}
-
-
-uint8_t convert_binary_coded_to_decimal(uint8_t hex)
-{
- uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
- return dec;
-}
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- int8_t tz_sign = 1;
- if (len == 0)
- len = s_len(in, 0);
-
- len >>= 1;
-
- out->smsc.len = in[0];
- out->smsc.bytes = out->smsc.len - 1;
-
- if (in[0] == 7)
- {
- out->smsc.type = in[1];
- for (uint8_t i=0; i<(out->smsc.bytes); i++)
- out->smsc.data[i] = in[i+2];
- }
-
- in += out->smsc.len + 1;
-
- out->first = *in++;
- out->sender.len = *in++;
- out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
- out->sender.type = *in++;
- for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
- out->sender.data[i] = *in++;
-
- out->tp_pid = *in++;
- out->tp_dcs = *in++;
-
- out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
- //*in = 0x4a;
- out->tz = swap8( *in++ );
-
- if ((out->tz & 0x80) == 0x80)
- {
- tz_sign = -1;
- }
-
- out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
-
- out->msg.len = out->msg.bytes = *in++;
-
- // correction for 7-bit encoding
- if (out->tp_dcs == PDU_DCS_7)
- out->msg.bytes -= (out->msg.bytes >> 3);
-
- // decode message text (if output buffer is given)
- out->msg.data = in;
-}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- pdu_hex2bytes(in, len, in);
- pdu_in_decode_binary(in, len, out);
-}
-
-
-
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
-{
- if (in_dcs == PDU_DCS_UCS2)
- {
- in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
- out += in_bytes;
- }
- else
- {
- if (in_dcs == PDU_DCS_7)
- {
- in_bytes += in_bytes >> 3;
- pdu_8to7(in, in_bytes);
- }
-
- for (uint8_t i=0; ismsc.len;
- // fill SMSC data
- if (in->smsc.len)
- {
- *out++ = in->smsc.type;
- for (uint8_t i=0; i<(in->smsc.len-1); i++)
- *out++ = in->smsc.data[i];
- len = in->smsc.len;
- }
-
- *out++ = in->first; // 1st octet (0x11)
- *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
-
- in->sender.bytes = pdu_phone_bytes(in->sender.data);
- in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
- *out++ = in->sender.len; // address length, digits
- *out++ = in->sender.type; // type-of-address
- for (uint8_t i=0; isender.bytes; i++)
- *out++ = in->sender.data[i];
-
- *out++ = in->tp_pid; // TP-PID. Protocol identifier
-
- if (in->tp_dcs == PDU_DCS_AUTO)
- in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
-
- *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
-
- *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
- len += in->sender.bytes + 8;
-
- // add message
- in->msg.len = s_len(in->msg.data,0);
-
- if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
- {
- in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
- *out++ = in->msg.len;
- }
- else
- {
- *out++ = in->msg.len;
- s_copy(in->msg.data, 0, out);
- if (in->tp_dcs == PDU_DCS_7)
- in->msg.bytes = pdu_7to8(out, in->msg.len);
- else
- in->msg.bytes = in->msg.len;
- }
-
- out -= len;
- len += in->msg.bytes;
- pdu_bytes2hex(out, len, out);
- in->len_bytes = len << 1;
- in->len_cmgs = len - in->smsc.len - 1;
- out[in->len_bytes] = 0;
-
- return in->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
-{
- pdu->first = 0x11;
- pdu->tp_msg_ref = 0;
- pdu->tp_pid = 0;
- pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
-
- pdu->smsc.len = 0;
-
- pdu->sender.type = PDU_TYPE_INTERNATIONAL;
-
-
- if (pdu_phone_is_packed((uint8_t *)sender)) {
- pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
- }
- else{
- pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
- }
-
-
- //pdu->tp_dcs = PDU_DCS_AUTO;
- //pdu->tp_dcs = PDU_DCS_8;
- pdu->tp_dcs = dcs;
- pdu->msg.data = (uint8_t *)msg;
-
- pdu_out_encode(pdu, out);
-
- return pdu->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
-{
- uint8_t n = 0;
-
- if (*in == '+')
- in++;
-
- while ((*in >= '0')&&(*in <= '9'))
- {
- *out = s_h2b4(*in++);
- if (*in)
- {
- *out |= s_h2b4(*in) << 4;
- in++;
- n++;
- }
- else
- *out |= 0xF0;
-
- n++;
- out++;
- }
-
- *out = 0xFF;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
-{
- uint8_t n = 0;
-
- if (type == PDU_TYPE_INTERNATIONAL)
- *out++ = '+';
-
- while (len--)
- {
- *out++ = s_b2h4(*in & 0xF);
- n++;
-
- if ((*in & 0xF0) != 0xF0)
- {
- *out++ = s_b2h4(*in >> 4);
- n++;
- }
-
- in++;
- }
-
- *out = 0;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_is_packed(uint8_t *phone)
-{
- return *phone != '+';
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits_bytes(uint8_t digits)
-{
- return (digits + (digits & 1)) >> 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_bytes(uint8_t *in)
-{
- uint8_t len = 0;
-
- while (*in++ != 0xFF)
- len++;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
-{
- uint8_t len = bytes << 1;
-
- if ((in[bytes-1] & 0xF0) == 0xF0)
- len--;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
-{
- if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
- return 0;
-
- while (in1_bytes--) if (*in1++ != *in2++)
- return 0;
-
- return 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_phone_copy(uint8_t *in, uint8_t *out)
-{
- if (in == out)
- return;
-
- uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
-
- while (*in != eop)
- *out++ = *in++;
-
- *out = eop;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h
deleted file mode 100755
index 7fc1fa34..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===================================================================================*/
-/*>>> Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved. <<<*/
-/* See LICENSE file in the project root for full license information. */
-/**
- @file
- ul_gsm_pdu.h
-
- @brief
- PDU defines
- @details
- porting of original code at https://github.com/tardigrade888/c-pdu
-
- @note
- Dependencies:
- m2mb_types.h
-
- @author
-
- @date
- 24/10/2018
-*/
-#ifndef HDR_UL_GSM_PDU_H_
-#define HDR_UL_GSM_PDU_H_
-
-// data coding scheme
-enum
-{
- PDU_DCS_7 = 0,
- PDU_DCS_8 = 0x4,
- PDU_DCS_UCS2 = 0x08,
- PDU_DCS_AUTO = 0xFF
-};
-
-// number format
-enum
-{
- PDU_TYPE_NATIONAL = 0xA1,
- PDU_TYPE_INTERNATIONAL = 0x91,
- PDU_TYPE_ALPHADET = 0xD0,
- PDU_TYPE_NETWORK = 0xB1
-};
-
-typedef struct
-{
- // SMSC number
- struct{ uint8_t len, bytes, type, data[14]; }smsc;
- // caller/sender number
- struct{ uint8_t len, bytes, type, data[14]; }sender;
- // input/output zero-terminated message (7bit/8bit/UTF8)
- struct{ uint16_t len, bytes; uint8_t *data; }msg;
-
- uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
- uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
- uint8_t tp_pid; // Protocol identifier (0)
- uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
- uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
-
- // incoming SMS timestamp
- uint8_t year, month, date; // date
- uint8_t hour, min, sec; // time
- int8_t tz; // zone
-
- // PDU length in bytes and for CMGS command
- uint16_t len_bytes, len_cmgs;
-}pdu_struct;
-
-// Change GSM 7-bit table to ANSI
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
-// pack 7-bit array to 8-bit
-uint8_t pdu_7to8(uint8_t *a, uint8_t len);
-// unpack 8-bit array to 7-bit
-uint8_t pdu_8to7(uint8_t *a, uint8_t len);
-
-// convert HEX line to bytes, len - length of input buffer
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
-// convert bytes to HEX line, len - length of input buffer
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
-
-// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
-
-// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
-// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
-
-// encode outcoming PDU
-uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
-// encode outcoming PDU, simple interface
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
-
-// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
-// unpack phone number to string, returns number of unpacked digits
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
-// check if phone is packed
-uint8_t pdu_phone_is_packed(uint8_t *phone);
-
-// get number of bytes from number of digits
-uint8_t pdu_phone_digits_bytes(uint8_t digits);
-// get number of bytes of packed phone
-uint8_t pdu_phone_bytes(uint8_t *in);
-// count number of digits
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
-
-// compare 2 packed phones
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
-// copy packed phone
-void pdu_phone_copy(uint8_t *in, uint8_t *out);
-
-#endif /* HDR_UL_GSM_PDU_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c
deleted file mode 100644
index 338ee2d1..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c
+++ /dev/null
@@ -1,356 +0,0 @@
-#include "ul_math_bcd.h"
-#include
-
-u8 asc_point = '.';
-u8 asc_space = ' ';
-u8 asc_minus = '-';
-
-u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
-
-u8 bin2bcd_u8( u8 bin ) {
- u8 tens = 0;
- while (bin > 9) { bin -= 10; tens++; }
- return ( (tens << 4) + bin );
-}
-
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
-
- "bin2bcd_u32_00: \n" // correct input number by left shifts
- "mov r31, %A[data] \n"
- "mov %A[data], %B[data] \n"
- "mov %B[data], %C[data] \n"
- "mov %C[data], %D[data] \n"
- "mov %D[data], r31 \n"
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_00 \n"
-
- "eor r26, r26 \n" // result=0
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %[result_bytes] \n"
- "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bin2bcd_u32_01: \n" // bits shift and correction loop
- "subi r26,-0x33 \n" // add 0x33
- "sbrs r26, 3 \n" // if carry to bit 3,
- "subi r26, 3 \n" // subtract 3
- "sbrs r26, 7 \n" // if carry to bit 7,
- "subi r26, 0x30 \n" // subtract 0x30
- "subi r27,-0x33 \n" // add 0x33
- "sbrs r27, 3 \n" // if carry to bit 3,
- "subi r27, 3 \n" // subtract 3
- "sbrs r27, 7 \n" // if carry to bit 7,
- "subi r27, 0x30 \n" // subtract 0x30
- "subi r30,-0x33 \n" // add 0x33
- "sbrs r30, 3 \n" // if carry to bit 3,
- "subi r30, 3 \n" // subtract 3
- "sbrs r30, 7 \n" // if carry to bit 7,
- "subi r30, 0x30 \n" // subtract 0x30
- "subi r31,-0x33 \n" // add 0x33
- "sbrs r31, 3 \n" // if carry to bit 3,
- "subi r31, 3 \n" // subtract 3
- "sbrs r31, 7 \n" // if carry to bit 7,
- "subi r31, 0x30 \n" // subtract 0x30
- "lsl r26 \n" // shift result number
- "rol r27 \n"
- "rol r30 \n"
- "rol r31 \n"
-
- "sbrc %D[data], 7 \n" // skip if msbit of input == 0
- "ori r26, 1 \n" // set lsb of output
- "lsl %A[data] \n" // shift input number
- "rol %B[data] \n"
- "rol %C[data] \n"
- "rol %D[data] \n"
-
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_01 \n" // repeat for all bits
-
- //"mov %A[result], r26 \n" // move to result
- //"mov %B[result], r27 \n"
- //"mov %C[result], r30 \n"
- //"mov %D[result], r31 \n"
-
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result) // output
- :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
- :"r26","r27","r30","r31" // clobbers
- );
- return result;
- }
-#endif
-
-u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
- data <<= 8;
- for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
- /*result BCD nibbles correction*/
- result += 0x33333333;
- /*result correction loop*/
- for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
- u8 corr_byte = result >> 24;
- if (!(corr_byte & 0x08)) corr_byte -= 0x03;
- if (!(corr_byte & 0x80)) corr_byte -= 0x30;
- result <<= 8; /*shift result*/
- result += corr_byte; /*set 8 bits of result*/
- }
- /*shift next bit of input to result*/
- result <<= 1;
- if (((u8)(data >> 24)) & 0x80)
- result |= 1;
- data <<= 1;
- }
- return(result);
-}
-
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
- u32 result = 0;
- result_bytes = 0;
- while (data > 0) {
- result += (data % 10) << result_bytes;
- data /= 10;
- result_bytes += 4;
- }
- return result;
-}
-
-u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
- static ldiv_t bin2bcd_ldiv_result;
- bin2bcd_ldiv_result.quot = value;
- u32 result = 0;
- nbytes = 0;
- while (bin2bcd_ldiv_result.quot > 0) {
- bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
- result += bin2bcd_ldiv_result.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-struct divmod10_t {
- uint32_t quot;
- uint8_t rem;
-} divmodu10_res;
-inline static void divmodu10(u32 n) {
- divmodu10_res.quot = n >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 4;
- divmodu10_res.quot += divmodu10_res.quot >> 8;
- divmodu10_res.quot += divmodu10_res.quot >> 16;
- u32 qq = divmodu10_res.quot & ~7ul;
- divmodu10_res.quot >>= 3;
- divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
- if (divmodu10_res.rem > 9) {
- divmodu10_res.rem -= 10;
- divmodu10_res.quot++;
- }
-}
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
- u32 result = 0; nbytes = 0;
- divmodu10_res.quot = value;
- while (divmodu10_res.quot != 0) {
- divmodu10(divmodu10_res.quot);
- result += divmodu10_res.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-#ifdef __AVR__
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "eor r26, r26 \n" /* result = 0 */
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bcd2bin_u32_00: \n" /* bits shift and correction loop */
- "lsr r31 \n" /* shift out buffer */
- "ror r30 \n"
- "ror r27 \n"
- "ror r26 \n"
-
- "sbrc %A[data], 0 \n" /* move lowest bit to result */
- "ori r31, 0x80 \n"
-
- "lsr %D[data] \n"
- "ror %C[data] \n"
- "ror %B[data] \n"
- "ror %A[data] \n"
-
- "sbrc %D[data], 7 \n" /* if carry to bit 7, */
- "subi %D[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %D[data], 3 \n" /* if carry to bit 3, */
- "subi %D[data], 3 \n" /* subtract 3 */
- "sbrc %C[data], 7 \n" /* if carry to bit 7, */
-
- "subi %C[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %C[data], 3 \n" /* if carry to bit 3, */
- "subi %C[data], 3 \n" /* subtract 0x30 */
- "sbrc %B[data], 7 \n" /* if carry to bit 7, */
- "subi %B[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %B[data], 3 \n" /* if carry to bit 3, */
- "subi %B[data], 3 \n" /* subtract 3 */
- "sbrc %A[data], 7 \n" /* if carry to bit 7, */
- "subi %A[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %A[data], 3 \n" /* if carry to bit 3, */
- "subi %A[data], 3 \n" /* subtract 3 */
-
- "dec __tmp_reg__ \n" /* repeat for all bits */
- "brne bcd2bin_u32_00 \n"
-
-// "movw %A[result], r26 \n" /* adjust result */
-// "movw %C[result], r30 \n"
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "bcd2bin_u32_01: \n"
- "mov __tmp_reg__,r25 \n"
- "mov r25,r24 \n"
- "mov r24,r23 \n"
- "mov r23,r22 \n"
- "mov r22,__tmp_reg__ \n"
- "dec %[result_bytes] \n"
- "brne bcd2bin_u32_01 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
- );
- return result;
- }
-#endif
-
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
- /*shift next bit*/
- result >>= 1;
- if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
- data >>= 1;
- /* result BCD correction */
- for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
- u8 tmp_byte = (data >> 24);
- if (tmp_byte & 0x80) tmp_byte -= 0x30;
- if (tmp_byte & 0x08) tmp_byte -= 0x03;
- data <<= 8;
- data |= tmp_byte;
- }
- }
- /*adjust result bytes*/
- for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
- result >>= 8;
- return(result);
-}
-
-u8 asc2bin_u8(u8 data) {
- if ((data >= '0') && (data <= '9')) data -= '0';
- else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
- else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
- else data = 0xf0;
- return(data);
-}
-
-u8 bin2asc_u8(u8 data) {
- data &= 0xf;
- return (data > 9) ? (data + 'A' - 10) : (data + '0');
-}
-
-u32 asc2bin_u32(u8 *buf, s8 size) {
- u32 result;
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- result = 0;
- while(size) {
- u8 tmp_u8 = asc2bin_u8(*buf);
- if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
- result <<= 4;
- result |= tmp_u8;
- }
- size--;
- if (flag_negative) buf--;
- else buf++; /*go to next symbol*/
- }
- return(result);
-}
-
-void bin2asc_u32(u32 data, u8 *buf, s8 size) {
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- while (size) {
- *buf = bin2asc_u8(data);
- data >>= 4;
- if (flag_negative) buf--;
- else buf++;
- size--;
- if (data == 0) size = 0; /*stop conversion on zero*/
- }
-}
-
-void num2asc_s32(s32 data, u8 *buf, u8 flags) {
- u8 cnt_chars = (flags & 7); //number of digits
- //convert negative to positive, set '-' flag
- if (data < 0) {data = -data; flags |= 1;}
- else flags &= ~1;
- //if necessary, convert to BCD
- //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
- cnt_chars++;
- //calculate point position
- u8 point_pos = cnt_chars - ((flags >> 4) & 7);
- if (point_pos) point_pos++;
- flags |= 2;
- while (cnt_chars) { //digits conversion loop
- if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
- if (flags & 1) *buf = asc_minus;
- else if (flags & 2) *buf = '0';
- else *buf = asc_space;
- flags &= ~1;
- } else {
- //show point
- if ((cnt_chars == point_pos) && (flags & 0x70)) {
- *buf-- = asc_point;
- cnt_chars--;
- }
- *buf = bin2asc_u8(data); //show ASCII digit
- }
- cnt_chars--;
- buf--;
- data >>= 4;
- flags &= ~2;
- }
- if (flags & 1) *buf = asc_minus;
-}
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h
deleted file mode 100644
index cbb417f9..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ul_bcd.h
- *
- * Created on: Sep 11, 2011
- * Author: qwer1
- */
-
-#ifndef UL_BCD_H_
-#define UL_BCD_H_
-
-#include "ul_other.h"
-
-extern u8 asc_point;
-extern u8 asc_space;
-extern u8 asc_minus;
-
-/** convert lower nibble to HEX symbol */
-#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
-
-/** 8-bit BCD->BIN conversion */
-u8 bcd2bin_u8( u8 bcd );
-/** 8-bit BIN->BCD conversion */
-u8 bin2bcd_u8( u8 bin );
-
-// 32-bit BIN->BCD conversion using shifts and correction
-//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
-
-// 32-bit BIN->BCD conversion using hardware divider
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using ldiv
-u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using fast soft div
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
-
-// 32-bit BCD->BIN conversion
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
-
-u8 asc2bin_u8(u8 data);
-u8 bin2asc_u8(u8 data);
-u32 asc2bin_u32(u8 *buf, s8 size);
-void bin2asc_u32(u32 data, u8 *buf, s8 size);
-
-// AVR-optimized conversions
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
- u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
-#endif
-
-/** convert 32-bit signed data to ASCII number to buffer (right to left)
- * options & 7 - width-1,
- * (options >> 4) & 7 - point position,
- * options & 0x08 - supress leading zeros,
- * options & 0x80 - convert to BCD.
- */
-#define NUM2ASC_BCD (u8)0x80
-#define NUM2ASC_NOZEROS (u8)0x08
-#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
-#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
-#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
-void num2asc_s32(s32 data, u8 *buf, u8 flags);
-inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
-
-// calculate number width
-
- inline u8 width_i32(s32 n){
- u8 s = 0;
- if (n < 0){ s = 1; n = -n; }
- return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
- ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
-}
-
-
-#endif /* UL_BCD_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.c
deleted file mode 100644
index 052a3565..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ul_other.c
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#include "ul_other.h"
-
-void *memset2(void *dest, int val, size_t len) {
- u8 *dest1 = (u8*) dest;
- while (len--) *dest1++ = (u8)val;
- return dest;
-}
-
-void *memcpy2(void *dest, const void *src, size_t len) {
- u8 *dest1 = (u8 *) dest;
- u8 *src1 = (u8 *)src;
- while (len--) *dest1++ = *src1++;
- return dest;
-}
-
-u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n) {
- u32 quot = n >> 1;
- quot += quot >> 1;
- quot += quot >> 4;
- quot += quot >> 8;
- quot += quot >> 16;
- u32 qq = quot & ~7ul;
- quot >>= 3;
- divmod10_u32_rem = n - ((quot << 1) + qq);
- if (divmod10_u32_rem > 9) {
- divmod10_u32_rem -= 10;
- quot++;
- }
- return quot;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.h
deleted file mode 100644
index 6248c057..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_other.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ul_other.h
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#ifndef UL_OTHER_H_
-#define UL_OTHER_H_
-
-#include
-#include
-
-#ifndef offsetof
- #define offsetof(s,m) (size_t)&(((s *)0)->m)
-#endif
-#ifndef countof
- #define countof(arg) (sizeof(arg) / sizeof(arg[0]))
-#endif
-
-//attributes
-#define WEAK __attribute__ ((weak))
-#define NAKED __attribute__ ((naked))
-#define INTERRUPT __attribute__ ((__interrupt__))
-#define USED __attribute__ ((used))
-#define NORETURN __attribute__ ((noreturn))
-#define SECTION(s) __attribute__ ((section(s)))
-#define NOINIT SECTION(".noinit")
-#define ALIAS(a) __attribute__ ((weak, alias (a)))
-#define ALWAYS_INLINE __attribute__ ((always_inline))
-#define OPTIMIZE(level) __attribute__ ((optimize(level)))
-
-//architecture-specific inlines
-#ifdef __AVR
- #define wdr() asm volatile("wdr")
- #define nop() asm volatile("nop")
- #define sleep() asm volatile("sleep")
-#else
- #define PROGMEM
-#endif
-
-#ifdef __i8051
- #define cli() EI = 0
- #define sei() EI = 1
-#endif
-
-#ifdef __STM8
- #define cli() _asm("sim")
- #define sei() _asm("rim")
- #define nop() _asm("nop")
- #define wdr() { IWDG_KR = 0xAA; }
-#endif
-
-#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
- #define cli() asm volatile ( "CPSID i \n" )
- #define sei() asm volatile ( "CPSIE i \n" )
-#endif
-
-//short named types
-typedef uint8_t u8;
-typedef int8_t s8;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef float f32;
-typedef double f64;
-#ifdef __float128
- typedef __float128 f128;
-#endif
-
-//bit mask
-#define B(_b) (1 << (_b))
-#define BIT(_b) (1 << (_b))
-
-//Increment/decrement, Add/Subtract with range rollover/limit
-#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
-#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
-#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
-#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
-#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
-#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
-#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
-#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
-#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
-#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
-#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
-#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-#ifdef __ARM_ARCH_7M__
- //ARM Cortex BitBand access macros
- #define BITBAND_SRAM_REF 0x20000000
- #define BITBAND_SRAM_BASE 0x22000000
- // Convert SRAM address
- #define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
- #define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
-
- #define BITBAND_PERI_REF 0x40000000
- #define BITBAND_PERI_BASE 0x42000000
- // Convert PERIPHERAL address
- #define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
- #define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
-#endif
-
-//memset - simple verion
-void *memset2(void *dest, int val, size_t len);
-//memcpy - simple verion
-void *memcpy2(void *dest, const void *src, size_t len);
-
-extern u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n);
-
-#endif /* OTHER_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.c
deleted file mode 100755
index 909e46b5..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ul_s.c
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#include "ul_s.h"
-#include "ul_math_bcd.h"
-
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
- u8 n = 0; u16 o;
- if (in[0] < 0x80){ n = 1; o = in[0]; }
- else if ((in[0] & 0xE0) == 0xE0){
- if ((in[1] != 0) && (in[2] != 0)){
- n = 3;
- o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
- }
- } else if ((in[0] & 0xC0) == 0xC0){
- if (in[1] != 0){
- n = 2;
- o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
- }
- }
- if (n){
- if (be){
- *((u8 *)out) = o >> 8;
- *((u8 *)out + 1) = o;
- } else {
- *((u8 *)out) = o;
- *((u8 *)out + 1) = o >> 8;
- }
- }
- return n;
-}
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
- if (in_len == 0) in_len = s_len(in,0);
- u16 out_len = 0;
- while (in_len){
- u8 n = utf8_to_ucs2(in, out, be);
- if (n == 0) in_len = 0;
- else {
- in += n;
- out++; out_len++;
- in_len = (in_len >= n) ? (in_len - n) : 0;
- }
- }
- return out_len;
-}
-
-
-u8 ucs2_to_utf8(u32 in, u8 *out){
- u8 n = 0;
- if (in < 0x80){
- out[0] = in;
- out[1] = 0;
- n = 1;
- }
- else if ((in >= 0x80) && (in < 0x800)){
- out[0] = (in >> 6) | 0xC0;
- out[1] = (in & 0x3F) | 0x80;
- out[2] = 0;
- n = 2;
- }
- else if ((in >= 0x800) && (in < 0xFFFF)){
- if (!((in >= 0xD800) && (in <= 0xDFFF))){
- out[0] = (in >> 12) | 0xE0;
- out[1] = ((in >> 6 ) & 0x3F) | 0x80;
- out[2] = (in & 0x3F) | 0x80;
- out[3] = 0;
- n = 3;
- }
- }
- else if ((in >= 0x10000) && (in < 0x10FFFF)){
- out[0] = 0xF0 | (in >> 18);
- out[1] = 0x80 | ((in >> 12) & 0x3F);
- out[2] = 0x80 | ((in >> 6) & 0x3F);
- out[3] = 0x80 | ((in & 0x3F));
- out[4] = 0;
- return 4;
- }
- return n;
-}
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
- u16 out_len = 0;
- while (in_len){
- u8 n = ucs2_to_utf8(
- (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
- if (n == 0) in_len = 0;
- else {
- in++; in_len--;
- out += n; out_len += n;
- }
- }
- return out_len;
-}
-
-u16 s_len(u8 *s, u8 eol){
- if (s == NULL) return 0;
- u16 l = 0;
- while (*s++ != eol) l++;
- return l;
-}
-u8 s_lines(u8 *s, u16 len, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 n = 0;
- while (len--) if (*s++ == eol) n++;
- return n;
-}
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 l = 0;
- while (len-- && (l < line))
- if (*s++ == eol) l++;
- return (len == 0) ? NULL : s;
-}
-u8 *s_skip_crlf(u8 *s){
- while ((*s == '\r')||(*s == '\n')) s++;
- return s;
-}
-
-u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
-void s_upcase(u8 *s, u16 len){
- if (len == 0) len = s_len(s, 0);
- while (len--){
- *s = c_upcase(*s);
- s++;
- }
-}
-
-u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
-u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
-
-u8 s_cmp(u8 *s1, u8 *s2, u16 len){
- while (len--) if (*s1++ != *s2++) return 0;
- return 1;
-}
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
- while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
- return 1;
-}
-
-u8 s_starts(u8 *s, char *start){
- while (*start != 0) if (*s++ != *start++) return 0;
- return 1;
-}
-u8 s_ends(u8 *s, char *end){
- u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
- if ((el > 0)&&(sl >= el)){
- s += sl - 1; end += el - 1;
- while (el--) if (*s-- != *end--) return 0;
- return 1;
- }
- return 0;
-}
-
-u8 *s_cpos(u8 *s, u8 c, u8 eol){
- while(*s != eol){
- if (*s == c) return s;
- s++;
- }
- return NULL;
-}
-
-u32 s_parse_dec(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
- return n;
-}
-u32 s_parse_hex(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
- n = (n << 4) + s_h2b4( *s++ );
- return n;
-}
-
-u8 s_is_7bit(u8 *s, u8 eol){
- while (*s != eol) if (*s++ > 0x7F) return 0;
- return 1;
-}
-
-u8 *s_copy(u8 *in, u8 eol, u8 *out){
- if (in == out) return out;
- while (*in != eol) *out++ = *in++;
- *out = eol;
- return out;
-}
-
-u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
-u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
-u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
-u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
-u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
-u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
-u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
-
-#if 0
-u8 *s_append_u32(u8 *out, u32 n) {
- if (n){
- n = bin2bcd_u32(n, 4); u8 digs = 8;
- while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
- while(digs--){
- *out++ = s_b2h4(n >> 28);
- n <<= 4;
- }
- } else *out++ = '0';
- *out = 0;
- return out;
-}
-
-
-u8 *s_append_s32(u8 *out, s32 n) {
- if (n < 0){
- out = s_append_c(out, '-');
- n = -n;
- }
- return s_append_u32(out, n);
-}
-#endif
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.h
deleted file mode 100644
index 8d46bd02..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/ul_s.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ul_s.h
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#ifndef UL_S_H_
-#define UL_S_H_
-
-#include "ul_other.h"
-
-
-// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
-// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
-
-// convert UCS2 codepoint to UTF8, returns number of bytes processed
-u8 ucs2_to_utf8(u32 in, u8 *out);
-// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
-
-
-// find length of line, terminated by eol char
-u16 s_len(u8 *s, u8 eol);
-
-// number of lines, separated by eol char
-u8 s_lines(u8 *s, u16 len, u8 eol);
-
-u8 c_upcase(u8 c);
-// uppercase string, in-place
-void s_upcase(u8 *s, u16 len);
-
-u8 s_h2b4(u8 hex);
-u8 s_b2h4(u8 b);
-
-// find start of line, delimited by eol char
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
-
-// skip CR/LF chars
-u8 *s_skip_crlf(u8 *s);
-
-// compare 2 strings, returns 1 if equal
-u8 s_cmp(u8 *s1, u8 *s2, u16 len);
-// compare 2 strings, upper-casing each char, returns 1 if equal
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
-
-// check if s starts with start
-u8 s_starts(u8 *s, char *start);
-// check if s ends with end
-u8 s_ends(u8 *s, char *end);
-
-// finds 1st occurence of char c, returns NULL if not found
-u8 *s_cpos(u8 *s, u8 c, u8 eol);
-
-// check if string is 7-bit
-u8 s_is_7bit(u8 *s, u8 eol);
-
-// copy in string (terminated by eol char) to out
-u8 *s_copy(u8 *in, u8 eol, u8 *out);
-
-
-// append string out to in, returns pointer after last char
-u8 *s_append_s (u8 *out, char *in);
-// append char to string buffer
-u8 *s_append_c (u8 *out, u8 c);
-// append Hex char to string buffer
-u8 *s_append_h4 (u8 *out, u8 n);
-// append Hex byte to string buffer
-u8 *s_append_h8 (u8 *out, u8 n);
-// append 16-bit Hex to string buffer
-u8 *s_append_h16(u8 *out, u16 n);
-// append 24-bit Hex to string buffer
-u8 *s_append_h24(u8 *out, u32 n);
-// append 32-bit Hex to string buffer
-u8 *s_append_h32(u8 *out, u32 n);
-
-
-// parse decimal number
-u32 s_parse_dec(u8 *s, u8 len);
-// parse hex number
-u32 s_parse_hex(u8 *s, u8 len);
-
-#endif /* UL_S_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/version.txt
index b0b37441..5f14daa7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/azx/pdu_codec/version.txt
@@ -1,3 +1,7 @@
+1.0.3
+New dcs decoding functionality
+Output encoding selection
+-----------
1.0.2
azx_pdu_convertZeroPaddedHexIntoByte arrays initialization and casting
-----------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/metadata.json
old mode 100755
new mode 100644
index b5b5e06f..43d0cd3f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/M2MB_main.c
index 45b00f22..67093465 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/M2MB_main.c
@@ -14,7 +14,7 @@
Sample application showcasing how to receive an SMS containing an AT command, process the AT command and send its answer to sender (configurable in sms_config.txt). A SIM card and antenna must be present. Debug prints on AUX UART
@version
- 1.0.4
+ 1.0.5
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -44,7 +44,6 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/callbacks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/callbacks.c
index 30f1592f..083d4060 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/callbacks.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SMS_atCmd/src/callbacks.c
@@ -41,9 +41,9 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
+#include "azx_pduCommon.h"
#include "at_utils.h"
@@ -51,7 +51,7 @@
/* Local defines ================================================================================*/
-#define SMS_PDU_MAX_SIZE 400
+
#define CONFIG_FILE LOCALPATH "/sms_config.txt"
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/metadata.json
old mode 100755
new mode 100644
index 19df2c34..7afcb63d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SW_Timer/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/metadata.json
old mode 100755
new mode 100644
index abb19d31..1ab47f19
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/SecureMS/metadata.json
@@ -13,18 +13,19 @@
"MXXXXC1": {
"firmwares": [
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/metadata.json
old mode 100755
new mode 100644
index b10989e2..061519f4
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-IP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/metadata.json
old mode 100755
new mode 100644
index 6aec30ac..2c0ffa5f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP-State/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/metadata.json
old mode 100755
new mode 100644
index e7e5a073..daa9519a
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TCP_Server/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/metadata.json
old mode 100755
new mode 100644
index 9dede96f..682d64e8
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/metadata.json
@@ -16,14 +16,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -41,9 +43,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/src/ssl_test.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/src/ssl_test.c
index 05dd0268..e689e69c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/src/ssl_test.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/TLS_SSL_CLIENT/src/ssl_test.c
@@ -9,11 +9,11 @@
The file contains the TLS/SSL utilities
@details
-
- @version
- 1.1.4
+
+ @version
+ 1.1.6
@note
-
+
@author
@@ -52,7 +52,7 @@
/* Local defines ================================================================================*/
/* 0: test using HTTPS server with client authentication (port 20443)
- 1: test using HTTPS server on port 443 with server authentication;
+ 1: test using HTTPS server on port 443 with server authentication;
*/
#define HTTP_443 1
@@ -65,17 +65,11 @@
CHAR queryBuf[] = "GET / HTTP/1.1\r\nHost: modules.telit.com\r\n\r\n";;
M2MB_SSL_AUTH_TYPE_E SSL_AUTH_MODE = M2MB_SSL_SERVER_AUTH;
#else //https with client cert
- #define WRONG_CLIENT_TEST 0 //test with wrong certificates to verify the secure socket on the server
#define SERVER "modules.telit.com"
#define CA_CERT_PATH LOCALPATH "/ssl_certs/modulesCA.crt"
-#if WRONG_CLIENT_TEST
- #define CLIENT_CERT_PATH LOCALPATH "/ssl_certs/wrong_Client.crt"
- #define CLIENT_KEY_PATH LOCALPATH "/ssl_certs/wrong_Client_pkcs1.key"
-#else
#define CLIENT_CERT_PATH LOCALPATH "/ssl_certs/modulesClient.crt"
#define CLIENT_KEY_PATH LOCALPATH "/ssl_certs/modulesClient_pkcs1.key" //Only RSA Private keys are supported
-#endif
#define SERVER_PORT 20443 //echo client+server
M2MB_SSL_AUTH_TYPE_E SSL_AUTH_MODE = M2MB_SSL_SERVER_CLIENT_AUTH;
@@ -156,7 +150,7 @@ void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size,
{
(void)resp_size;
(void)myUserdata;
-
+
M2MB_NET_REG_STATUS_T *stat_info;
switch (net_event)
@@ -198,7 +192,7 @@ void PdpCallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *u
m2mb_pdp_get_my_ip(h, cid, M2MB_PDP_IPV4, &CBtmpAddress.sin_addr.s_addr);
m2mb_socket_bsd_inet_ntop( M2MB_SOCKET_BSD_AF_INET, &CBtmpAddress.sin_addr.s_addr, ( CHAR * )&( CBtmpIPaddr ), sizeof( CBtmpIPaddr ) );
AZX_LOG_DEBUG( "IP address: %s\r\n", CBtmpIPaddr);
-
+
m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_SET);
break;
@@ -217,7 +211,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
(void)type;
(void)param1;
(void)param2;
-
+
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_OS_RESULT_E osRes;
@@ -294,6 +288,16 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
AZX_LOG_DEBUG("m2mb_ssl_create_config PASSED \r\n");
}
+ sslRes = m2mb_ssl_config( sslConfigHndl, M2MB_SSL_NAME_SNI, (void*)SERVER );
+ if(sslRes != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
+ }
+
sslCtxtHndl = m2mb_ssl_create_ctxt();
if( sslCtxtHndl == NULL )
@@ -469,7 +473,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
{
AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
}
-
+
/*Wait for network registration event to occur (released in NetCallback function) */
m2mb_os_ev_get(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
@@ -507,7 +511,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
return -1;
}
}
-
+
/*Wait for pdp activation event to occur (released in PDPCallback function) */
m2mb_os_ev_get(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
@@ -663,17 +667,17 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
m2mb_ssl_delete_config( sslConfigHndl );
-
+
if(SSL_AUTH_MODE == M2MB_SSL_SERVER_AUTH || SSL_AUTH_MODE == M2MB_SSL_SERVER_CLIENT_AUTH)
{
m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*) "CAListTest" );
}
-
+
if(SSL_AUTH_MODE == M2MB_SSL_SERVER_CLIENT_AUTH)
{
m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*) "ClientCertTest" );
}
-
+
m2mb_ssl_delete_ctxt( sslCtxtHndl );
ret = m2mb_pdp_deactivate(pdpHandle, PDP_CTX);
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/metadata.json
old mode 100755
new mode 100644
index 0f02a8ba..649ef17a
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/UDP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/Makefile.in
index 90e2a994..89c90dd2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/metadata.json
old mode 100755
new mode 100644
index 6fdb79d9..db354d98
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/USB-Cable_Check/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -33,8 +35,16 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/Makefile.in
new file mode 100755
index 00000000..89c90dd2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_AUX_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/README.md
new file mode 100755
index 00000000..970ba142
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/README.md
@@ -0,0 +1,26 @@
+
+### Watchdog example
+
+Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
+
+
+**Features**
+
+
+- Enable watchdog on Task_1
+- Handle watchdog kicks with a timer
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Create Task_1 that will be put under watchdog control
+- In Task_1 watchdog is ebnabled on it and a timer created to handle watchdog kicks. Then task enters in a loop where kicks are sent. After 5 kicks a task lock is simulated waiting for an event release (with a timeout longer that task watchdog inactivity timeout)
+- As soon as watchdog inactivity timeout expired M2MB_WDOG_TIMEOUT_IND is generated and handled in WDcallback (in this case the event is released, no further actions are done)
+- No further actions are performed by Task_1 (no kicks are sent) so after watchdog system timeout expiration app is rebooted.
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_utils.h
new file mode 100755
index 00000000..cccb3c54
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/hdr/azx_utils.h
@@ -0,0 +1,89 @@
+/*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.3
+ * @dependencies core/azx_log
+ * @author Ioannis Demetriou
+ * @author Sorin Basca
+ * @date 10/02/2019
+ *
+ * @brief Various helpful utilities
+ */
+#include "m2mb_types.h"
+#include "azx_log.h"
+
+
+/**
+ * @brief Limits a value to a certain interval
+ *
+ * This is defined as a macro so it works with any types that support ordering.
+ *
+ * @param val The value to limit
+ * @param min The minimum allowed value
+ * @param max The maximum allowed value
+ *
+ * @return The original value if it was inside the limits, or min, or max, if it was less than, or
+ * greater than the limits.
+ */
+#define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/description.txt
new file mode 100644
index 00000000..2b702b5a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/description.txt
@@ -0,0 +1 @@
+Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/WatchDog.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/WatchDog.h
new file mode 100755
index 00000000..dc1d96ea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/WatchDog.h
@@ -0,0 +1,37 @@
+/*
+ * M2M_WatchDog.h
+ *
+ * Created on: 10 May 2021
+ * Author: Alberto Lendini
+ */
+
+#ifndef HDR_M2MB_WDOG_H_
+#define HDR_M2MB_WDOG_H_
+
+INT32 M2MB_msgTask1(INT32 type, INT32 param1, INT32 param2);
+INT32 M2MB_msgTask2(INT32 type, INT32 param1, INT32 param2);
+
+typedef enum {
+ TASK_START=0,
+ LOOP,
+ WD_KICK
+} STATES;
+
+/* EVENTS */
+#define EV_WDOG_KICK (UINT32)0x00000001
+#define EV_WDOG_REMOVE (UINT32)0x00000002
+#define EV_WDOG_RESET (UINT32)0x00000004
+#define EV_WDOG_TEST (UINT32)0x00000008
+
+/* TIMEOUTS */
+#define WDOG_WAIT_TO 120000
+#define WDOG_REFERENCE_TIME 41500
+
+/* FLAG FILE */
+#define WDOG_FLAG "wdog_flag.txt"
+
+/* FUNCTIONS */
+void WDcallback( M2MB_WDOG_HANDLE hDog, M2MB_WDOG_IND_E wDog_event, UINT16 resp_size, void *resp_struct, void *userdata );
+void WDog_test(void);
+
+#endif /* HDR_M2MB_WDOG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/metadata.json
new file mode 100755
index 00000000..f23b9b66
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/metadata.json
@@ -0,0 +1,55 @@
+{
+ "name": "Sample App for watchdog functionality",
+ "type": "sample-app",
+ "description": "A sample app that shows how to set and implement a watchdog.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "Watchdog"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_tasks": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/src/M2MB_main.c
new file mode 100755
index 00000000..70d49ffa
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/Watchdog/src/M2MB_main.c
@@ -0,0 +1,363 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
+ are executed during system timeout a system reboot is performed. Debug prints on AUX UART
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 05/11/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+#include "m2mb_gpio.h"
+#include "m2mb_wDog.h"
+#include "m2mb_rtc.h"
+#include "m2mb_os_tmr.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "azx_tasks.h"
+
+#include "app_cfg.h"
+
+#include "WatchDog.h"
+
+
+
+
+/* Local defines ================================================================================*/
+#define WAKE_UP_TICKS 20 //to be used in m2mb_wDog_enable
+#define CTRL_TICKS_TO_REBOOT 6 //to be used in m2mb_wDog_enable
+#define WD_TOUT_COUNT 3 //to be used in m2mb_wDog_addTask
+
+#define TIMER_TOUT 5000
+
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+M2MB_OS_TASK_HANDLE Task1_H = NULL;
+INT8 taskID_1;
+M2MB_WDOG_HANDLE h_wDog;
+M2MB_OS_EV_HANDLE evHandle;
+
+/*Timer to perform wd kick*/
+M2MB_OS_TMR_ATTR_HANDLE tmrAttrHandle;
+M2MB_OS_TMR_HANDLE tmrHandle;
+UINT32 timeval1, timeval2, diff;
+UINT32 wd_tick_s;
+
+/* Local function prototypes ====================================================================*/
+void WDog_Init(void);
+
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+static void TimerCb(M2MB_OS_TMR_HANDLE tHandle, void *argCb )
+{
+static unsigned int Count = 0;
+
+ (void)tHandle;
+ (void)argCb;
+
+ AZX_LOG_TRACE("\r\nCallback Count: [%u]\r\n", Count++);
+ if (Count < 5)
+ {
+ AZX_LOG_INFO("WD kick\r\n");
+ azx_tasks_sendMessageToTask(taskID_1, WD_KICK, 0, 0);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n...stop WD kicks and simulate infinite loop\r\n");
+ azx_tasks_sendMessageToTask(taskID_1, LOOP, 0, 0);
+ m2mb_os_tmr_stop(tmrHandle);
+ }
+}
+
+void timer_Init(void)
+{
+M2MB_OS_RESULT_E res;
+
+ res = m2mb_os_tmr_setAttrItem( &tmrAttrHandle,
+ CMDS_ARGS
+ (
+ M2MB_OS_TMR_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TMR_SEL_CMD_NAME, "mytmr",
+ M2MB_OS_TMR_SEL_CMD_USRNAME, "myUsrtmr",
+ M2MB_OS_TMR_SEL_CMD_CB_FUNC, &TimerCb,
+ M2MB_OS_TMR_SEL_CMD_ARG_CB, &tmrHandle,
+ M2MB_OS_TMR_SEL_CMD_TICKS_PERIOD, M2MB_OS_MS2TICKS(TIMER_TOUT),
+ M2MB_OS_TMR_SEL_CMD_PERIODIC, M2MB_OS_TMR_PERIODIC_TMR
+ )
+ );
+
+ if( res != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR("Timer attribute creation fail, error: %d\r\n", res);
+ return;
+ }
+ else
+ {
+ AZX_LOG_TRACE("Timer attribute creation OK\r\n" );
+ }
+ //Define the timer and pass the parameters structure to it.
+ res = m2mb_os_tmr_init( &tmrHandle, &tmrAttrHandle );
+ if( res != M2MB_OS_SUCCESS )
+ {
+ //delete the parameters structure
+ m2mb_os_tmr_setAttrItem( &tmrAttrHandle, 1, M2MB_OS_TMR_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_ERROR("Timer creation fail, error: %d\r\n", res);
+ }
+ else
+ {
+ AZX_LOG_INFO("Timer creation OK\r\n" );
+ }
+
+}
+
+INT32 get_timeval(UINT32 *pOutTime)
+{
+INT32 fd;
+M2MB_RTC_TIMEVAL_T timeval;
+
+ fd = m2mb_rtc_open("/dev/rtc0", 0);
+ /* protection from invalid handle */
+ if (fd == -1)
+ return -3;
+
+ if (m2mb_rtc_ioctl(fd, M2MB_RTC_IOCTL_GET_TIMEVAL, &timeval) == -1)
+ {
+ m2mb_rtc_close(fd);
+ return -1;
+ }
+ (*pOutTime) = timeval.msec + (timeval.sec * 1000);
+
+ if (m2mb_rtc_close(fd) == -1)
+ return -2;
+ return 0;
+}
+
+void WDcallback(M2MB_WDOG_HANDLE hDog, M2MB_WDOG_IND_E wDog_event,UINT16 resp_size, void *resp_struct, void *userdata)
+{
+ (void)hDog;
+ (void)resp_size;
+ (void)resp_struct;
+ (void)userdata;
+
+ switch (wDog_event)
+ {
+ case M2MB_WDOG_TIMEOUT_IND:
+ {
+ AZX_LOG_INFO("Watchdog expired!\r\n");
+ /*release the event to unlock the task*/
+ get_timeval(&timeval2);
+ m2mb_os_ev_set(evHandle, EV_WDOG_TEST, M2MB_OS_EV_SET);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void WDog_Init(void)
+{
+M2MB_RESULT_E res;
+MEM_W time_ms;
+
+ AZX_LOG_INFO("\r\nInit WatchDog\r\n");
+ res = m2mb_wDog_init(&h_wDog, WDcallback, 0);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_init OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_init Fail, error: %d\r\n", res);
+ return;
+ }
+
+ /* Verifying tick duration */
+ res = m2mb_wDog_getItem(h_wDog, M2MB_WDOG_SELECT_CMD_TICK_DURATION_MS, 0, &time_ms);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ wd_tick_s = time_ms/1000;
+ AZX_LOG_INFO("Tick duration: %ds\r\n", wd_tick_s);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Get tick duration Fail, error: %d\r\n", res);
+ }
+
+
+ AZX_LOG_INFO("Adding Task under WD control with inactivity timeout of %ds\r\n", WD_TOUT_COUNT * WAKE_UP_TICKS * wd_tick_s);
+ /* wdTimeout (inactivity timeout of the task) is set to WD_TOUT_COUNT (3 in this case).
+ * This counter is decreased every time a control is done and no kick have been received. Control is done every WAKE_UP_TICKS.
+ * When the counter reaches 0 a further control is done and if it's still 0 then callback is called,
+ * so task inactivity timeout will be more or less WD_TOUT_COUNT * WAKE_UP_TICKS * 1s
+ */
+ res = m2mb_wDog_addTask(h_wDog, Task1_H, WD_TOUT_COUNT);
+
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_addTask OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_addTask Fail\r\n");
+ }
+
+ AZX_LOG_INFO("Enabling the WatchDog\r\n");
+ /* WAKE_UP_TICKS defines the number of ticks of every control, by default the tick is every 1s
+ * CTRL_TICKS_TO_REBOOT this defines the number of controls the wd does before rebooting the app if no kick are received (or no action is done in watchdog callback )
+ * so timeout to reboot is WAKE_UP_TICKS * CTRL_TICKS_TO_REBOOT * 1s
+ */
+ res = m2mb_wDog_enable(h_wDog, WAKE_UP_TICKS, CTRL_TICKS_TO_REBOOT);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_enable OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_enable Fail, error: %d\r\n", res);
+ }
+
+}
+
+
+INT32 M2MB_msgTask1(INT32 type, INT32 param1, INT32 param2)
+{
+M2MB_OS_RESULT_E osRes;
+UINT32 ev_bits;
+
+ (void)param1;
+ (void)param2;
+ //AZX_LOG_INFO(".\r\n");
+ switch (type)
+ {
+ case TASK_START:
+ AZX_LOG_INFO("\r\nTask started\r\n");
+ Task1_H = m2mb_os_taskGetId();
+
+ WDog_Init();
+ timer_Init();
+
+ AZX_LOG_INFO("\r\nStart WD kick every %ds...\r\n", TIMER_TOUT/1000);
+ m2mb_os_tmr_start(tmrHandle);
+
+ break;
+
+ case LOOP:
+ /*
+ * Simulate an infinite loop waiting an event for WDOG_WAIT_TO that should be bigger than WD_TOUT_COUNT * WAKE_UP_TICKS * 1s
+ */
+ AZX_LOG_INFO("Waiting for EV_WDOG_TEST event to simulate task lock\r\n");
+ get_timeval(&timeval1);
+ osRes = m2mb_os_ev_get(evHandle, EV_WDOG_TEST,
+ M2MB_OS_EV_GET_ALL_AND_CLEAR, &ev_bits,
+ WDOG_WAIT_TO);
+ if (M2MB_OS_SUCCESS == osRes)
+ {
+ AZX_LOG_INFO("Event EV_WDOG_TEST received - watchdog performed as expected after %d ms\r\n",(timeval2-timeval1));
+ }
+ else
+ {
+ AZX_LOG_ERROR("Event EV_WDOG_TEST not received in time %d, code %d\r\n",
+ WDOG_WAIT_TO, osRes);
+ }
+ AZX_LOG_INFO("Task doing nothing and no kicks, waiting for app restart in %ds", CTRL_TICKS_TO_REBOOT * WAKE_UP_TICKS * wd_tick_s);
+ break;
+
+ case WD_KICK:
+ m2mb_wDog_kick(h_wDog, Task1_H);
+ AZX_LOG_INFO("WD kick done\r\n");
+ break;
+
+ }
+
+ return 0;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+M2MB_OS_RESULT_E os_res;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+
+ (void)argc;
+ (void)argv;
+
+ azx_tasks_init();
+
+ azx_sleep_ms(5000);
+
+ /*SET output channel */
+ AZX_LOG_INIT();
+
+ AZX_LOG_INFO("\r\n\r\nStarting WATCHDOG demo app. This is v%s built on %s %s.\r\n\r\n",VERSION, __DATE__, __TIME__);
+
+ // *********** event initialization **************
+
+ m2mb_os_ev_setAttrItem(&evAttrHandle, 2, M2MB_OS_EV_SEL_CMD_CREATE_ATTR,
+ M2MB_OS_EV_SEL_CMD_NAME, NULL, "MyEv");
+
+ os_res = m2mb_os_ev_init(&evHandle, &evAttrHandle);
+ if (os_res != M2MB_OS_SUCCESS)
+ {
+ m2mb_os_ev_setAttrItem(&evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR,
+ NULL);
+ }
+ else
+ {
+ AZX_LOG_INFO("Event correctly initialized \r\n");
+ }
+
+ ////************** TASK INITIALIZATION *************
+ taskID_1 = azx_tasks_createTask((char*) "TASK_1", AZX_TASKS_STACK_L, 1, AZX_TASKS_MBOX_M, M2MB_msgTask1);
+
+ AZX_LOG_TRACE("Task ID: %d\r\n", taskID_1);
+
+ if (taskID_1 > 0)
+ {
+ azx_tasks_sendMessageToTask( taskID_1, TASK_START, 0, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("cannot create task!\r\n");
+ return;
+ }
+
+ azx_sleep_ms(2000);
+
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/Makefile.in
index d7b10052..de5048e3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/metadata.json
old mode 100755
new mode 100644
index 9bf4bf6d..d0171af7
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-AUX_UART/ZLIB/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/Makefile.in
index cf586748..3dc3f1f3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/metadata.json
old mode 100755
new mode 100644
index 1d68f8ff..b96ff209
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Aux_UART/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,7 +42,12 @@
}
},
"groups": [
- {"name": "BASIC", "limitations": ["LE910Cx-L"]}
+ {
+ "name": "BASIC",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/Makefile.in
index cf586748..3dc3f1f3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/metadata.json
old mode 100755
new mode 100644
index f81b7567..2835f6c0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_Main_UART/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,7 +42,10 @@
}
},
"groups": [
- {"name": "BASIC", "limitations": []}
+ {
+ "name": "BASIC",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/Makefile.in
index cf586748..3dc3f1f3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/metadata.json
old mode 100755
new mode 100644
index bc0d262c..3be7ece0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_HelloWorld_USB0/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,7 +42,10 @@
}
},
"groups": [
- {"name": "BASIC", "limitations": []}
+ {
+ "name": "BASIC",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/metadata.json
old mode 100755
new mode 100644
index 672a3255..43eac03e
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_Task/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,7 +40,10 @@
}
},
"groups": [
- {"name": "BASIC", "limitations": []}
+ {
+ "name": "BASIC",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/Makefile.in
new file mode 100755
index 00000000..3dc3f1f3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/Makefile.in
@@ -0,0 +1,48 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_USB0
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/README.md
new file mode 100755
index 00000000..6935e7a5
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/README.md
@@ -0,0 +1,47 @@
+
+### UART USB tunnel example
+
+Sample application that opens a tunnel between main UART and USB0 port.
+
+
+**Features**
+
+
+- Opens `Main UART` port with a callback function
+- Opens `USB0` port with a callback function
+- Creates a simple task to manage data exchange between ports
+
+
+**Application workflow**
+
+**`M2MB_main function`**
+
+- Create `Main UART` handle and configure its parameters
+- Create `USB0` handle and configure its parameters
+- Create the data management task
+- Write **`READY`** on both ports when the tunneling is ready
+
+**`USB_Cb`**
+
+- When data are received on the `USB0` port, retrieve the available amount and send the value to the data management task with the proper command
+
+**`UART_Cb`**
+
+- When data are received on the `Main UART` port, retrieve the available amount and send the value to the data management task with the proper command
+
+
+**`dataTask_Cb`**
+
+- if command is `TASK_UART_READ_AND_USB_WRITE`, read the requested amount from the `Main UART` port and write it on `USB0`
+- if command is `TASK_USB_READ_AND_UART_WRITE`, read the requested amount from the `USB0` port and write it on `Main UART`
+
+
+UART output received from USB0 (in RED, the user input data from UART )
+
+
+
+USB0 output received from UART (in RED, the user input data from USB0 )
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/description.txt
new file mode 100644
index 00000000..fea70cfd
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/description.txt
@@ -0,0 +1 @@
+Sample application that opens a tunnel between main UART and USB0 port.
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/metadata.json
similarity index 56%
rename from LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/metadata.json
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/metadata.json
index fc023cfa..3e345463 100755
--- a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/metadata.json
@@ -1,29 +1,38 @@
{
- "name": "Sample App for LwM2M",
+ "name": "Sample App for UART-USB tunneling",
"type": "sample-app",
- "description": "A sample app that shows LwM2M client usage with M2MB API.",
- "copyright": "Telit Communications, 2020",
+ "description": "A sample app that shows how to create a data tunneling betwen Main UART and USB0 ports.",
+ "copyright": "Telit Communications, 2021",
"homepage": "https://www.telit.com/",
"keywords": [
"IoT AppZone",
- "LwM2M"
+ "Basic",
+ "UART",
+ "USB",
+ "Tunnel",
+ "Communication"
],
"availability": {
"MXXXXC1": {
"firmwares": [
+ "30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
"firmwares": [
+ "25.20.xx9",
+ "25.21.xx0"
]
},
"LE910Cx-X": {
@@ -34,9 +43,10 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "BASIC",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
@@ -46,14 +56,10 @@
"authors": [
{
"name": "Fabio Pintus",
- "email": "fabio.pintus@telit.com",
+ "email": "Fabio.Pintus@telit.com",
"homepage": "http://www.telit.com/",
"role": "Developer"
}
],
- "requires": {
- "core/azx_log": "master",
- "core/azx_utils": "master",
- "core/azx_tasks": "master"
- }
+ "requires": {}
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/src/M2MB_main.c
new file mode 100755
index 00000000..d0b7507b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-BASIC/Basic_UART_USB_tunnel/src/M2MB_main.c
@@ -0,0 +1,388 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that opens a tunnel between main UART and USB0 port.
+ Any data sent on one port will be received on the other, and vice-versa.
+ The data read and write operations from both ports are managed with a simple dedicated task.
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+ @author
+
+ @date
+ 28/10/2021
+*/
+
+/* Include files ================================================================================*/
+#include "stdio.h"
+#include "string.h"
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+
+#include "m2mb_usb.h"
+#include "m2mb_uart.h"
+
+
+/* Local defines ================================================================================*/
+#define TASKSTACK_SIZE 8*1024 /*8 kB of task stack size*/
+#define TASKMSQ_Q_SIZE 5 /*up to 5 messages in task queue*/
+#define TASK_PRIORITY 5 /*from 1 to 32 as an example*/
+
+/* Local typedefs ===============================================================================*/
+
+/*
+ *
+ * prototype of the task user callback function
+ *
+ * */
+typedef INT32 (*USER_TASK_CB)(INT32, INT32);
+
+
+
+
+/*
+ *
+ * Structure holding the required parameters for the running task
+ *
+ * */
+typedef struct
+{
+ M2MB_OS_TASK_HANDLE Task_H; /*Task m2mb handler*/
+ M2MB_OS_Q_HANDLE Task_Queue_H; /*Task queue m2mb handler*/
+ USER_TASK_CB Task_UserCB; /*Task user provided callback function */
+} TASKS_ELEM_T;
+
+
+/*
+ *
+ * Structure holding the task message parameters
+ *
+ * */
+typedef struct
+{
+ INT32 cmd;
+ INT32 datalen;
+} AZX_TASKS_MESSAGE_T;
+
+
+/* Local statics ================================================================================*/
+
+/*
+ *
+ * Data task command options
+ *
+ * */
+enum
+{
+ TASK_UART_READ_AND_USB_WRITE,
+ TASK_USB_READ_AND_UART_WRITE
+};
+
+
+/*UART and USB global handles*/
+static INT32 USBfd = -1;
+static INT32 UARTfd = -1;
+
+
+/*Task structure entry, will be used for the UART read operations*/
+static TASKS_ELEM_T TaskElem;
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+
+
+
+/*
+ *
+ * The entry function for the data task. It will manage the messages dispatching to the user callback function
+ *
+ */
+static void Task_EntryFn( void *arg )
+{
+ (void) arg;
+ AZX_TASKS_MESSAGE_T inPars;
+
+
+ while( 1 )
+ {
+ /*Wait for messages and pass them to user callback*/
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( TaskElem.Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+ /*send data to callback*/
+ TaskElem.Task_UserCB( inPars.cmd, inPars.datalen );
+ }
+
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*
+ *
+ * Allows to create the Data task, given an user CB function
+ *
+ * */
+static int createTask( USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+ UINT32 queue_area_size;
+
+ INT32 stack_size = TASKSTACK_SIZE;
+ INT32 msg_q_size = TASKMSQ_Q_SIZE;
+ INT32 task_prio = 200 + TASK_PRIORITY; /*priority from 200 and above*/
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ return -1;
+ }
+ else
+ {
+ /*configure queue area to store msg_q_size messages*/
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ return -2;
+ }
+ else
+ {
+ /*init queue*/
+ os_res = m2mb_os_q_init( &TaskElem.Task_Queue_H, &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ return -3;
+ }
+ else
+ {
+
+ /*Init task parameters*/
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, "TTY_READ",
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ return -4;
+ }
+
+ /* Creating the task */
+ os_res = m2mb_os_taskCreate(
+ &(TaskElem.Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*) NULL
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ return -5;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == TaskElem.Task_H )
+ {
+
+ return -6;
+ }
+ TaskElem.Task_UserCB = cb;
+ return 0;
+ }
+ }
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*
+ *
+ * Sends a message to the Data task, passing command
+ * and how much data is available to read
+ *
+ * */
+static INT32 sendMessageToTask( INT32 cmd, INT32 datalen )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+
+
+ tmpMsg.cmd = cmd;
+ tmpMsg.datalen = datalen;
+
+ osRes = m2mb_os_q_tx( TaskElem.Task_Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ return -1; // failure
+ }
+ else
+ {
+ return 0; // success
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+/*
+ *
+ * USB events callback
+ *
+ * */
+static void USB_Cb( INT32 fd, M2MB_USB_IND_E usb_event, UINT16 resp_size, void *resp_struct, void *userdata )
+{
+ (void) fd;
+ (void) resp_size;
+ (void) userdata;
+
+ UINT32 usbRxLen;
+
+ if( M2MB_USB_RX_EVENT == usb_event )
+ {
+ /*The number of available bytes*/
+ usbRxLen = *((UINT32 *)resp_struct);
+ sendMessageToTask(TASK_USB_READ_AND_UART_WRITE, usbRxLen); /*this call will be executed by myTTYCB function */
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*
+ *
+ * UART events callback
+ *
+ * */
+static void UART_Cb( INT32 fd, M2MB_UART_IND_E uart_event, UINT16 resp_size, void *resp_struct, void *userdata )
+{
+ (void) fd;
+ (void) resp_size;
+ (void) userdata;
+ UINT32 uartRxLen;
+
+ if( M2MB_UART_RX_EV == uart_event )
+ {
+ uartRxLen = *((UINT32 *)resp_struct);
+ sendMessageToTask(TASK_UART_READ_AND_USB_WRITE, uartRxLen); /*this call will be executed by myTTYCB function */
+ }
+}
+
+/* Global functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*
+ *
+ * The data management task. Depending on cmd, it will read from UART and write on USB or vice-versa
+ *
+ * */
+INT32 dataTask_Cb(INT32 cmd, INT32 datalen)
+{
+ char * databuffer;
+ INT32 read_data;
+
+ databuffer = (char *) m2mb_os_malloc(datalen + 1);
+ if(!databuffer)
+ {
+ m2mb_usb_write(USBfd, "--FAILED ALLOCATION\r\n", strlen("--FAILED ALLOCATION\r\n"));
+ m2mb_usb_write(UARTfd, "--FAILED ALLOCATION\r\n", strlen("--FAILED ALLOCATION\r\n"));
+ return -1;
+ }
+
+ switch(cmd)
+ {
+ case TASK_UART_READ_AND_USB_WRITE:
+ read_data = m2mb_uart_read(UARTfd, databuffer, datalen);
+ if(read_data > 0)
+ {
+ m2mb_usb_write(USBfd, databuffer, read_data);
+ }
+ break;
+ case TASK_USB_READ_AND_UART_WRITE:
+ read_data = m2mb_usb_read(USBfd, databuffer, datalen);
+ if(read_data > 0)
+ {
+ m2mb_uart_write(UARTfd, databuffer, datalen);
+ }
+ break;
+
+ }
+ m2mb_os_free(databuffer);
+ return 0;
+}
+
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+ **************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+ (void) argc;
+ (void) argv;
+ UARTfd = m2mb_uart_open( "/dev/tty0", 0 );
+ USBfd = m2mb_usb_open("/dev/USB0", 0);
+
+ if(UARTfd == -1 || USBfd == -1)
+ {
+ return;
+ }
+
+ if (0 != createTask(dataTask_Cb))
+ {
+ m2mb_usb_write(USBfd, "FAILED CREATING TASK\r\n", strlen("FAILED CREATING TASK\r\n"));
+ return;
+ }
+
+ /*UART configuration*/
+ m2mb_uart_ioctl(UARTfd, M2MB_UART_IOCTL_SET_TX_TIMEOUT, 10);
+ m2mb_uart_ioctl(UARTfd, M2MB_UART_IOCTL_SET_RX_TIMEOUT, 10);
+ m2mb_uart_ioctl(UARTfd, M2MB_UART_IOCTL_SET_CB_FN, UART_Cb);
+
+ m2mb_uart_ioctl(UARTfd, M2MB_UART_IOCTL_SET_FCTL, M2MB_UART_FCTL_OFF);
+
+
+ /*USB configuration*/
+
+ m2mb_usb_ioctl(USBfd, M2MB_USB_IOCTL_SET_CB, USB_Cb);
+
+ /*notify user that the two channels are ready*/
+ m2mb_usb_write(USBfd, "READY", 5);
+ m2mb_uart_write(UARTfd, "READY", 5);
+
+}
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/Makefile.in
index 5286583b..95b245bb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/metadata.json
old mode 100755
new mode 100644
index 2771c60e..7469a4bf
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_Logging/metadata.json
@@ -14,19 +14,20 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -36,7 +37,10 @@
}
},
"groups": [
- {"name": "C++", "limitations": []}
+ {
+ "name": "C++",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/Makefile.in
index 73533d86..2628c98b 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/metadata.json
old mode 100755
new mode 100644
index 73ded0eb..17a3345b
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-C++/CPP_method_to_function/metadata.json
@@ -14,19 +14,20 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -36,7 +37,10 @@
}
},
"groups": [
- {"name": "C++", "limitations": []}
+ {
+ "name": "C++",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/metadata.json
old mode 100755
new mode 100644
index 17af47bd..f7bf7b8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ATI/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/metadata.json
old mode 100755
new mode 100644
index 92e1e692..597b127c
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AT_Tunnel/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,7 +41,10 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/metadata.json
old mode 100755
new mode 100644
index a7823d91..5add0c1e
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/src/aws_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/src/aws_demo.c
index 4dbc01ce..f4bf8843 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/src/aws_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AWS/src/aws_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.2
+ 1.0.3
@note
@@ -157,26 +157,31 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
}
/* clean everything */
- res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
- if(res==0)
- {
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
- }
- else
- {
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
- }
- res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
- if(res==0)
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
- else
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
{
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
-
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -253,28 +258,28 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
}
#if HOSTMISMATCH_ENABLE
- ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
- if(ret != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
- }
+ ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
+ if(ret != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
+ }
#endif
#if SNI_ENABLE
- res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
- if(res != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
- }
+ res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
+ if(res != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
+ }
#endif
{
@@ -357,18 +362,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx, M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
{
- AZX_LOG_DEBUG("Client certificate file %s \r\n",CLIENTCERTFILE);
+ AZX_LOG_DEBUG("Client certificate file %s \r\n", CLIENTCERTFILE);
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
@@ -379,7 +386,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -389,7 +397,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -416,7 +425,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -426,7 +436,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -443,13 +454,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -754,6 +767,11 @@ INT32 AWS_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/metadata.json
old mode 100755
new mode 100644
index 222b8ebb..55db5226
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/AppManager/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -33,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/Makefile.in
index a972c14b..1ff582f6 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/metadata.json
old mode 100755
new mode 100644
index c4ce79b1..0150cc83
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/App_OTA_FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/Makefile.in
index 889b9c84..ed7a72d1 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/metadata.json
old mode 100755
new mode 100644
index dcffa0b2..fae62b53
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/CJSON/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/metadata.json
old mode 100755
new mode 100644
index 8dd7984c..4c7906ea
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Crypto_ECC/metadata.json
@@ -13,18 +13,19 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/Makefile.in
index bbf9836d..bba88b71 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
index 64f0b1eb..08534830 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
@@ -122,7 +122,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c || !pData)
{
@@ -153,11 +153,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
msgs[0].buf = (UINT8*)buf;
msgs[0].flags = I2C_M_WR;
msgs[0].len = bufsize; // 2 address bytes + data
-
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
+
memcpy(buf + 2, pData, size );
rdrw_data.msgs = &msgs[0];
@@ -191,7 +187,7 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c)
{
@@ -219,10 +215,6 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
msgs[0].flags = I2C_M_WR;
msgs[0].len = sizeof(buf); // 2 address bytes + data
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
rdrw_data.msgs = &msgs[0];
rdrw_data.nmsgs = 1;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
index 80bd7f30..dda66918 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/azx/eeprom_24XX256/version.txt
@@ -1,3 +1,5 @@
+1.0.2
+-----------
1.0.1
-----------
1.0.0
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/metadata.json
old mode 100755
new mode 100644
index 0e7c35b6..2295fd77
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EEPROM_AA256/metadata.json
@@ -12,19 +12,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/Makefile.in
index 104f68ad..88d47f6d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/metadata.json
old mode 100755
new mode 100644
index 49c8691e..6aba0ce3
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/EasyAT/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/metadata.json
old mode 100755
new mode 100644
index 4433aaea..51964612
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/metadata.json
old mode 100755
new mode 100644
index 9ff2af61..ac9ab71d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Events_Barrier/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/metadata.json
old mode 100755
new mode 100644
index a602504c..bee71bbe
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FOTA/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/Makefile.in
index a972c14b..1ff582f6 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/metadata.json
old mode 100755
new mode 100644
index 0e43fa56..5ef7d293
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/metadata.json
old mode 100755
new mode 100644
index a957497a..0f86126c
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/File_System/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/README.md
index 6b4f8a06..ba2e00f9 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/README.md
@@ -10,16 +10,22 @@ Sample application showing how to use GNSS functionality. Debug prints on **MAIN
- How to enable GNSS receiver on module
- How to collect location information from receiver
+**Note:** on MEx10G1 product family both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
**Application workflow**
**`M2MB_main.c`**
- Open USB/UART/UART_AUX
-- Init gnss, enable position report and start it.
-- When a fix is available, a message will be printed by the GNSS callback function
+- Print a welcome message
+- Create GNSS task and send a message to it
-
+**`gps_task.c`**
+- Init Info feature and get module type
+- Init gnss, enable position/NMEA report and start it.
+- When a fix or a NMEA sentence is available, a message will be printed by the GNSS callback function
+
+
---------------------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/hdr/azx_tasks.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/hdr/azx_tasks.h
new file mode 100755
index 00000000..e392af6a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/hdr/azx_tasks.h
@@ -0,0 +1,292 @@
+/*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_TASKS_H_
+#define HDR_AZX_TASKS_H_
+/**
+ * @file azx_tasks.h
+ * @version 1.0.4
+ * @dependencies core/azx_log core/azx_utils
+ * @author Alessio Quieti
+ * @date 07/04/2018
+ *
+ * @brief Tasks related utilities
+ *
+ * Functions usable to simplify the tasks creation and usage
+ * (instead of directly using m2mb_os_q.h low level APIs, which in turn allow
+ * much greater control of the tasks)
+ *
+ * The library is modelled after the way tasks were handled in the old M2M API.
+ */
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "azx_log.h"
+
+/** @defgroup taskUsage Usage of tasks example functionalities
+ * Functions usable to simplify the tasks creation and usage
+*/
+
+/**
+ * @brief Task user callback signature
+ *
+ * This is the structure of the task user callback. Each time a message is
+ * received by an user task, a callback with this structure will be called.
+ *
+ * It is responsibility of the user to define the callback logic.
+ *
+ * @ingroup taskUsage
+ *
+ * @see azx_tasks_init()
+*/
+typedef INT32 (*USER_TASK_CB)(INT32, INT32, INT32);
+
+/** @addtogroup taskUsage
+@{ */
+
+/**
+ * @name Stack defines
+ * @brief Available ranges for tasks
+ * @{ */
+#define AZX_TASKS_MIN_STACK_SIZE 1024 /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/hdr/gnss_task.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/hdr/gnss_task.h
new file mode 100755
index 00000000..87d7919e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/hdr/gnss_task.h
@@ -0,0 +1,23 @@
+/*
+ * gps_task.h
+ *
+ * Created on: 23 apr 2021
+ * Author: robertaga
+ */
+
+#ifndef HDR_GPS_TASK_H_
+#define HDR_GPS_TASK_H_
+
+#include "m2mb_types.h"
+
+typedef enum {
+ START_GPS,
+ STOP_GPS
+
+} GPS_APP_STATUS;
+
+
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2);
+
+
+#endif /* HDR_GPS_TASK_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/metadata.json
index b57e11d4..36f2c370 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
@@ -58,6 +71,7 @@
],
"requires": {
"core/azx_log": "master",
- "core/azx_utils": "master"
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
}
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/M2MB_main.c
index 7fd55061..cac49cc6 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/M2MB_main.c
@@ -13,16 +13,16 @@
@description
Sample application showing how to use GNSS functionality. Debug prints on MAIN UART
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@author
-
+ Roberta Galeazzo
@date
- 23/10/2019
+ 12/10/2021
*/
/* Include files ================================================================================*/
@@ -36,71 +36,22 @@
#include "m2mb_os_api.h"
#include "m2mb_os.h"
#include "m2mb_os_sem.h"
-#include "m2mb_gnss.h"
+
+#include "gnss_task.h"
#include "azx_log.h"
#include "azx_utils.h"
-
+#include "azx_tasks.h"
#include "app_cfg.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
+INT32 gpsTask;
-void sleep_ms(UINT32 ms)
-{
- m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
-}
-
-
-void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
-{
- locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
-
- AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
- AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
-
- AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
- AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
-
- AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
- AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
-
- AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
- AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
-
- AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
- AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
- AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
- AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
-
- AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
- AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
-
- AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
- AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
-
- return;
-}
-
-void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
-{
- (void)handle;
- (void)resp_size;
- (void)userdata;
-
- if(event == M2MB_GNSS_INDICATION_POSITION_REPORT)
- {
- printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
- }
- else
- {
- AZX_LOG_INFO("gnssCallback_test => event FAIL\r\n");
- }
-}
@@ -119,65 +70,31 @@ void M2MB_main( int argc, char **argv )
(void)argc;
(void)argv;
- void *userdata = NULL;
-
- M2MB_GNSS_HANDLE handle1;
-
- azx_sleep_ms(2000);
-
- AZX_LOG_INIT();
- AZX_LOG_INFO("Starting GNSS demo app. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
- {
- return;
- }
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
-
- AZX_LOG_INFO("m2mb_gnss_enable OK\r\n");
-
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
- {
- return;
- }
+ azx_sleep_ms(2000);
- AZX_LOG_INFO("m2mb_gnss_start OK\r\n");
+ AZX_LOG_INIT();
+ azx_tasks_init();
+ AZX_LOG_INFO("\r\nStarting GNSS demo app. This is v%s built on %s %s.\r\n\r\n",
+ VERSION, __DATE__, __TIME__);
- /*
- * System will start to execute the callback function.
- */
+ gpsTask = azx_tasks_createTask((char*) "myGPSTask", AZX_TASKS_STACK_L, 1, AZX_TASKS_MBOX_S, GPS_task);
- azx_sleep_ms(120000);
+ azx_sleep_ms(1000);
+ if (gpsTask > 0){
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+ azx_tasks_sendMessageToTask(gpsTask, START_GPS, 0, 0 );
+ AZX_LOG_TRACE("Tasks %d created!\r\n", gpsTask);
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+ } else{
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ AZX_LOG_ERROR("Cannot create tasks!\r\n");
+ return;
+ }
+ azx_sleep_ms(2000);
+
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/gnss_task.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/gnss_task.c
new file mode 100755
index 00000000..bd1d23a3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GNSS/src/gnss_task.c
@@ -0,0 +1,365 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application showing how to use GNSS functionality. Debug prints on $OUTPUT
+ @version
+ 1.0.2
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 12/10/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+#include "m2mb_os_sem.h"
+#include "m2mb_gnss.h"
+#include "m2mb_info.h"
+
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+#include "gnss_task.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define GPS_BIT (UINT32)0x1 /*0x0000000000000001*/
+
+#ifndef M2MB_GNSS_WWAN_GNSS_PRIORITY_E
+ #define GNSS_MEX10G1 0
+#else
+ #define GNSS_MEX10G1 1
+#endif
+/* Local typedefs ===============================================================================*/
+
+typedef enum{
+ MEX10C1,
+ MEX10G1,
+ LE910CX,
+ LE910CX_X,
+ NONE
+} MODULE_TYPE_E;
+
+/* Local statics ================================================================================*/
+
+void *userdata = NULL;
+
+M2MB_GNSS_HANDLE handle1;
+UINT8 priority;
+UINT32 TBF;
+UINT8 constellation;
+
+const CHAR *gnssServ[] = {"POSITION", "NMEA sentences"};
+
+M2MB_GNSS_SERVICE_E gnss_service;
+MODULE_TYPE_E moduleType;
+static M2MB_OS_EV_HANDLE gps_evHandle = NULL;
+//static UINT32 sentenceNum = 0;
+
+extern INT32 gpsTask;
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+MODULE_TYPE_E getModuleType(void)
+{
+M2MB_RESULT_E res;
+M2MB_INFO_HANDLE hInfo;
+CHAR *info;
+MODULE_TYPE_E moduleType = NONE;
+
+ res = m2mb_info_init(&hInfo);
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible init info\r\n");
+ }
+ else
+ {
+ res = m2mb_info_get(hInfo, M2MB_INFO_GET_MODEL, &info);
+
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible to get model\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("Model: %s\r\n", info);
+ if (strstr(info, "G1") != NULL)
+ {
+ AZX_LOG_TRACE("Type: %d\r\n", MEX10G1);
+ moduleType = MEX10G1;
+ }
+ else if (info[0] == 'M' && strstr(info, "C1"))
+ {
+ AZX_LOG_TRACE("type: %d\r\n", MEX10C1);
+ moduleType = MEX10C1;
+ }
+ else if ( strstr(info, "LE910C"))
+ {
+ if (info[strlen(info) -1 ] == 'X')
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX_X);
+ moduleType = LE910CX_X;
+ }
+ else
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX);
+ moduleType = LE910CX;
+ }
+ }
+ }
+ m2mb_info_deinit(hInfo);
+ }
+ return moduleType;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
+{
+ locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
+
+ AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
+ AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
+
+ AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
+ AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
+
+ AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
+ AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
+
+ AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
+ AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
+
+ AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
+ AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
+ AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
+ AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
+
+ AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
+ AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
+
+ AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
+ AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
+
+ return;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
+{
+ (void)handle;
+ (void)resp_size;
+ (void)userdata;
+ //INT32 retVal;
+
+ //AZX_LOG_DEBUG("gnssCallback[%d]\r\n", sentenceNum);
+ switch (event){
+
+ case M2MB_GNSS_INDICATION_POSITION_REPORT:
+ {
+ printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+#if GNSS_MEX10G1
+ case M2MB_GNSS_INDICATION_NMEA_REPORT:
+ {
+ AZX_LOG_INFO("NMEA: %s\r\n", (CHAR*)resp);
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+#endif
+ default:
+ AZX_LOG_WARN("unexpected event\r\n");
+ break;
+ }
+ //sentenceNum++;
+
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/***************************************************************************************************
+ GPS_task handles GPS init, configuration, start and stop
+ **************************************************************************************************/
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2){
+
+M2MB_OS_RESULT_E osRes;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+//INT32 retVal;
+#if GNSS_MEX10G1
+M2MB_RESULT_E res;
+#endif
+ (void)param1;
+ (void)param2;
+
+
+ switch(type){
+
+ case START_GPS:
+ {
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "gps_ev"));
+ osRes = m2mb_os_ev_init( &gps_evHandle, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS ){
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return -1;
+ } else {
+
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+
+ }
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable NMEA REPORT, failed!\r\n");
+ return -1;
+ }
+
+ moduleType = getModuleType();
+
+ /*this part is available ONLY for MEX10G1 products*/
+#if GNSS_MEX10G1
+ if(moduleType == MEX10G1){
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_PRIORITY, &priority);
+
+ AZX_LOG_INFO("Priority: %d\r\n", priority);
+
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_TBF, &TBF);
+ AZX_LOG_INFO("TBF: %d\r\n", TBF);
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_CONSTELLATION, &constellation);
+ AZX_LOG_INFO("constellation: %d\r\n", constellation);
+
+ /*To start getting GPS position priority MUST be set to GNSS */
+ res = m2mb_gnss_set_prio_runtime(handle1, GNSS_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to GNSS_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to GNSS_PRIORITY, start GPS\r\n");
+ }
+
+ }
+#endif
+ /*
+ * on MEX10G1 both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while
+ * on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
+ */
+
+ if(moduleType == MEX10G1){
+ //gnss_service = M2MB_GNSS_SERVICE_NMEA_REPORT; /*On MEx10G1 family NMEA report sentences can be enabled as well*/
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ } else {
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ }
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, gnss_service) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable %s REPORT, failed!\r\n", gnssServ[gnss_service]);
+ return -1;
+ }
+
+ AZX_LOG_INFO("\r\nm2mb_gnss_enable, %s OK\r\n",gnssServ[gnss_service]);
+
+
+ /*
+ * System will start to execute the callback function.
+ */
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
+ {
+ AZX_LOG_ERROR("Failed to start GPS\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("\r\nm2mb_gnss_start OK, waiting for position/nmea sentences...\r\n");
+ /*Wait for GPS fix/NMEA sentences event to occur (released in gnssCallbackFN function) */
+ m2mb_os_ev_get(gps_evHandle, GPS_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ AZX_LOG_INFO("\r\n***** Wait 120 seconds and then stop GPS *****\r\n\r\n");
+
+ azx_sleep_ms(120000);
+
+ azx_tasks_sendMessageToTask(gpsTask, STOP_GPS, 0, 0 );
+
+ }
+ break;
+
+ case STOP_GPS:
+ {
+ AZX_LOG_INFO("***** 120 seconds expired *****\r\n\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_stop fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, gnss_service ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_disable fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+
+#if GNSS_MEX10G1
+ /*Restore priority to WWAN */
+ if(moduleType == MEX10G1){
+ res = m2mb_gnss_set_prio_runtime(handle1, WWAN_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to WWAN_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to WWAN_PRIORITY, stop GPS\r\n");
+ }
+ }
+#endif
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_deinit fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ return 0;
+
+
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/metadata.json
old mode 100755
new mode 100644
index b1b1cf51..cfc78137
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/GPIO_Interrupt/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/metadata.json
old mode 100755
new mode 100644
index ab02a67b..8f676908
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/General_INFO/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/Makefile.in
index 7aa99b18..f6553696 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/metadata.json
old mode 100755
new mode 100644
index 3747302d..060974df
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HTTP_Client/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/metadata.json
old mode 100755
new mode 100644
index 4f8edfd2..15b9cfd0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HW_Timer/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/metadata.json
old mode 100755
new mode 100644
index bf0d29f9..423336f2
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/HelloWorld/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/metadata.json
old mode 100755
new mode 100644
index 61742456..52fc9d8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/README.md
index c9cafa06..88962d64 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/README.md
@@ -1,7 +1,7 @@
### I2C Combined
-Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on **MAIN UART**
+Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
**Features**
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/metadata.json
old mode 100755
new mode 100644
index fbc342c8..e4331c15
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/metadata.json
@@ -11,19 +11,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -33,9 +34,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/src/M2MB_main.c
index c064b152..ed55f5cc 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/I2C_Combined/src/M2MB_main.c
@@ -13,7 +13,7 @@
@description
Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -266,7 +266,7 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
M2MB_I2C_CFG_T i2c_data = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
/* Retrieve current channel config */
i2c_res = m2mb_i2c_ioctl(fd, M2MB_I2C_IOCTL_GET_CFG, (void *)&i2c_data);
@@ -291,9 +291,6 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
msgs[0].len = 2; /* How many bytes to be written: register + data*/
msgs[0].buf = i2cbuf_wr; /* Assign write buffer to message struct [0]*/
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
/* Set i2c data struct rw parameters messages pointer to msgs */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/Makefile.in
index 54794658..fc990f33 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/metadata.json
old mode 100755
new mode 100644
index 4e7fc877..fc5d00f0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LFS2/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,8 +40,14 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/README.md
index c83a277e..6c924a30 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/README.md
@@ -21,6 +21,16 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage write, read and monitoring resources changed from the portal
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
**Application workflow**
**`M2MB_main.c`**
@@ -35,8 +45,6 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
**`msgLWM2MTask`**
- Check registration status
-- Configure APN to the correct one for CID 1
-
- Initialize LWM2M client,
- Check for XML file fo custom object
@@ -51,7 +59,9 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Wait for client to register to Portal
- - Send integer and string values
+ - Performs all operations (set, read, get, write) on the related resources
+
+ - Performs a set with notify ack enabled
- Wait for events from server
@@ -61,6 +71,15 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage events arriving from client \(operations completion status and unsolicited events\)
- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
#### Custom Object configuration
The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
@@ -86,10 +105,10 @@ Copy the xml file content and paste it in the new Object form
-Also, the application requires the XML file `/xml/object_35000.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+Also, the application requires the XML file `/xml/object_32010.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
It can be done with
-`AT#M2MWRITE=/XML/object_35000.xml,`
+`AT#M2MWRITE=/XML/object_32010.xml,`
To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
@@ -110,7 +129,14 @@ The file is successfully loaded on the module

-
+
+
+
+
+
+
+
+
After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
@@ -125,7 +151,7 @@ For example, executing the two Exec Resources at the bottom of the list, the app

-Writing a string resource (id /35000/0/11 ), the application will notify the change
+Writing a string resource (id /32010/0/11 ), the application will notify the change

diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_demo.h
index abb12868..0eb5f70e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_demo.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_demo.h
@@ -14,6 +14,7 @@
@note
Dependencies:
m2mb_types.h
+ m2mb_lwm2m.h
@author
@@ -28,9 +29,7 @@
/* Global declarations ==========================================================================*/
-/*cellular event bits*/
-#define EV_NET_BIT (UINT32)0x1
-#define EV_PDP_BIT (UINT32)0x2
+
/*LWM2M event bits*/
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
@@ -42,11 +41,90 @@
#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000100
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000200
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00001000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
#define EV_MON_URC_RECEIVED 2
#define EV_URC_TO_BE_ENABLED 3
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32010
+#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
+#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
+#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
+#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
+#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
+#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
+#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
+
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
+#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
+#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
+#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
+#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
+#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
+#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
+#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
+#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
+#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
+
+#define DEMO_STRING_W_RES_ID 41 /* single string resource, Write only*/
+#define DEMO_INT_W_RES_ID 42 /* single integer resource, Write only*/
+#define DEMO_FLOAT_W_RES_ID 43 /* single floating point resource, Write only*/
+#define DEMO_BOOL_W_RES_ID 44 /* single boolean resource, Write only*/
+#define DEMO_OPAQUE_W_RES_ID 45 /* single opaque (raw data) resource, Write only*/
+#define DEMO_TIME_W_RES_ID 46 /* single time resource, Write only*/
+#define DEMO_OBJLINK_W_RES_ID 47 /* single object link resource, Write only*/
+
+#define DEMO_MULTI_STRING_W_RES_ID 51 /* multiple string resource, Write only*/
+#define DEMO_MULTI_INT_W_RES_ID 52 /* multiple integer resource, Write only*/
+#define DEMO_MULTI_FLOAT_W_RES_ID 53 /* multiple floating point resource, Write only*/
+#define DEMO_MULTI_BOOL_W_RES_ID 54 /* multiple boolean resource, Write only*/
+#define DEMO_MULTI_OPAQUE_W_RES_ID 55 /* multiple opaque (raw data) resource, Write only*/
+#define DEMO_MULTI_TIME_W_RES_ID 56 /* multiple time resource, Write only*/
+#define DEMO_MULTI_OBJLINK_W_RES_ID 57 /* multiple object link resource, Write only*/
+
+#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
+
+
+#define OBJECT_XML_NAME "object_32010.xml"
+
/* Global typedefs ==============================================================================*/
typedef enum {
@@ -55,9 +133,9 @@ typedef enum {
APPLICATION_EXIT
} APP_STATES;
-/* Global functions =============================================================================*/
+/* Global functions =============================================================================*/
/**
@brief Initialize OneEdge connection
@@ -67,10 +145,5 @@ typedef enum {
*/
UINT8 oneedge_init( void );
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value);
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result);
-
-
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..1d975a09
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"617276d580cbbb0af346d50a","name":"LwM2M resources demo","observations":[{"objId":32010,"instId":0,"resId":2}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/metadata.json
index fc023cfa..3562cf60 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/metadata.json
@@ -6,37 +6,47 @@
"homepage": "https://www.telit.com/",
"keywords": [
"IoT AppZone",
- "LwM2M"
+ "LwM2M",
+ "OneEdge"
],
"availability": {
"MXXXXC1": {
"firmwares": [
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
- "firmwares": [
- "25.30.xx1",
- "25.30.xx2"
- ]
+ "firmwares": []
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c
index a1f760a4..83fcfa03 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -75,11 +75,7 @@ void M2MB_main( int argc, char **argv )
AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_demo.c
index 764c7cb3..ff66f157 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_demo.c
@@ -10,8 +10,8 @@
@details
- @version
- 1.0.2
+ @version
+ 1.0.4
@note
@@ -46,70 +46,12 @@
#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
/* Local defines ================================================================================*/
-#define APN "web.omnitel.it"
#define CTX_ID 1 /*PDP context ID*/
-/*OBJECTs and RESOURCEs IDs*/
-#define DEVICE_OBJ_ID 3
-#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
-
-
-#define LOCATION_OBJ_ID 6
-#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
-#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
-
-#define CONN_STATS_OBJ_ID 7
-#define CONN_STATS_STOP_EXEC_RES_ID 7
-#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
-
-#define APN_CONN_PROFILE_OBJ_ID 11
-#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
-
-#define M2MB_LWM2M_DEMO_OBJ_ID 35000
-#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
-#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
-#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
-#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
-#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
-#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
-#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
-
-#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
-#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
-#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
-#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
-#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
-#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
-#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
-
-#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
-#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
-#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
-#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
-#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
-#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
-#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
-
-#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
-#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
-#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
-#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
-#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
-#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
-#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
-
-#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
-#define DEMO_EXEC2_RES_ID 102 /* execute resource 2*/
-
-
-#define OBJECT_XML_NAME "object_35000.xml"
-
-
-
-
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
@@ -135,24 +77,17 @@ const char *CL_STATUS_STRING[] =
"M2MB_LWM2M_CL_STATE_SUSPENDED"
};
-
-M2MB_OS_EV_HANDLE net_pdp_evHandle = NULL;
-
-static M2MB_PDP_HANDLE pdpHandle = NULL;
-
static INT8 lwm2m_taskID;
/*===== ONEEDGE =====*/
/*Handles*/
static M2MB_LWM2M_HANDLE lwm2mHandle;
-static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
/*URI objects*/
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
- 33211, 0,
- 0,1};
+ 33211, 0, 0, 1};
/* Local function prototypes ====================================================================*/
@@ -186,57 +121,46 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz)
/* Static functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
(void) param2;
- MEM_W data_buffer[256] = {0};
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
INT32 data_int = 0;
- UINT32 data_time = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
double data_float = 0;
- M2MB_RESULT_E retVal;
+
+ INT32 retVal;
M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
M2MB_LWM2M_OBJ_URI_T uri = *pUri;
- M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
m2mb_os_free(pUri);
uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
switch(event)
{
- case EV_MON_URC_RECEIVED:
+ case EV_MON_URC_RECEIVED:
AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
-
- memset(data_buffer,0,sizeof(data_buffer));
- retVal = m2mb_lwm2m_read( lwm2mHandle, &(uri), data_buffer, sizeof(data_buffer));
-
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "LWM2M read request succeeded\r\n" );
- }
- else
- {
- AZX_LOG_ERROR("Read request failed\r\n");
- return retVal;
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
{
switch(uri.resource)
@@ -253,16 +177,21 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_STRING_RW_RES_ID:
/*fallback*/
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_STRING;
AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- data_buffer );
-
+ string_buffer );
break;
-
-
/* ==================
*
* INTEGER TYPES
@@ -277,13 +206,14 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = (INT32) ( (INT32 *)data_buffer )[0];
-
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_int);
-
break;
/* ==================
@@ -300,13 +230,16 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
- /*Cast the data buffer as an integers array and take the first element*/
- data_float = (double) ( (double *)data_buffer )[0];
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_float );
-
break;
@@ -321,15 +254,15 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_BOOL_RW_RES_ID:
/*fallback*/
- /*Store data_type for further management*/
- data_type = M2MB_LWM2M_DATA_TYPE_BOOLEAN;
-
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = !!((INT32) ( (INT32 *)data_buffer )[0]);
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- (data_int>0)? "true":"false");
+ (data_bool)? "true":"false");
break;
@@ -348,13 +281,17 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_TIME;
- /*Cast the data buffer as an integers array and take the first element*/
- data_time = (INT32) ( (INT32 *)data_buffer )[0];
- convertUnixTimeToRTC_TIME((time_t) (data_time), &time_struct, 0);
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
- AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %d"
- "(%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_time,
time_struct.year, time_struct.mon, time_struct.day,
@@ -375,16 +312,151 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
/*fallback*/
int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+
+
+
+ /* *************************
+ *
+ * WRITE ONLY TYPES
+ *
+ * *************************/
+
+ case DEMO_STRING_W_RES_ID:
+ case DEMO_MULTI_STRING_W_RES_ID:
+ /*fallback*/
+
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = get_write_only_string_resource(lwm2mHandle, &(uri), string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ case DEMO_INT_W_RES_ID:
+ case DEMO_MULTI_INT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = get_write_only_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ case DEMO_FLOAT_W_RES_ID:
+ case DEMO_MULTI_FLOAT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = get_write_only_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+ case DEMO_BOOL_W_RES_ID:
+ case DEMO_MULTI_BOOL_W_RES_ID:
+ /*fallback*/
+
+ retVal = get_write_only_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+ break;
+
+ case DEMO_TIME_W_RES_ID:
+ case DEMO_MULTI_TIME_W_RES_ID:
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = get_write_only_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ break;
+
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,data_size);
+ retVal = get_write_only_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
- AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content:\r\n",
- uri.obj, uri.objInst, uri.resource, uri.resourceInst);
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
- for (i=0; i < (int)(sizeof(data_buffer) / sizeof(data_buffer[0])); i++)
+ for (i=0; i < data_size; i++)
{
- AZX_LOG_INFO("%02X ", data_buffer[i]);
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
}
AZX_LOG_INFO("\r\n");
}
@@ -413,13 +485,23 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
return 1;
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
( void ) h;
( void ) resp_size;
- ( void ) userdata;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
/* Client generated events */
switch( event )
@@ -432,11 +514,35 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_INFO( "LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -448,11 +554,12 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -461,20 +568,22 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
case M2MB_LWM2M_READ_RES:
{
M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
- AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
- AZX_LOG_DEBUG("Read type: %d; size: %u\r\n",
- resp->resType,
- resp->len
- );
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -486,14 +595,50 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
}
else
{
- AZX_LOG_WARN( "Enable write %d\r\n", resp->result );
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
}
break;
}
+
/* event in response to m2mb_lwm2m_new_inst() */
case M2MB_LWM2M_NEW_INST_RES:
{
@@ -541,7 +686,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
case M2MB_LWM2M_CL_STATE_REGISTERED:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
break;
case M2MB_LWM2M_CL_STATE_DEREGISTERING:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
@@ -587,6 +732,68 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
}
+ case M2MB_LWM2M_NFYACK_URI_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_uri */
+ M2MB_LWM2M_NFYACK_URI_RES_T *resp = ( M2MB_LWM2M_NFYACK_URI_RES_T * )resp_struct;
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_uri response OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_STATUS_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_status */
+ M2MB_LWM2M_NFYACK_STATUS_RES_T *resp = ( M2MB_LWM2M_NFYACK_STATUS_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "Current status for Notify Ack reporting is %s\r\n\r\n", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_LIST_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_list */
+ M2MB_LWM2M_NFYACK_LIST_RES_T *resp = ( M2MB_LWM2M_NFYACK_LIST_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_LIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_INFO_IND:
+ {
+ /* event that brings a Notify Ack information */
+ M2MB_LWM2M_NFYACK_INFO_IND_T *pInfo = ( M2MB_LWM2M_NFYACK_INFO_IND_T * )resp_struct;
+
+ if( pInfo )
+ {
+ AZX_LOG_TRACE( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s\r\n",
+ pInfo->agent,
+ pInfo->shServerId,
+ pInfo->uri.obj,
+ pInfo->uri.objInst,
+ pInfo->uri.resource,
+ ( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
+
+ if(pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
case M2MB_LWM2M_SESSION_INFO_IND:
{
AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
@@ -606,9 +813,6 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC1_RES_ID);
break;
- case DEMO_EXEC2_RES_ID:
- AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC2_RES_ID);
- break;
default:
AZX_LOG_WARN("\r\nUnexpected exec resource URI {%u/%u/%u/%u (%u)}!\r\n",
execUri.obj, execUri.objInst, execUri.resource, execUri.resourceInst, execUri.uriLen );
@@ -634,7 +838,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -650,18 +854,24 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
{
AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
-
default:
AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
break;
}
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
static int check_xml_file(const char* name)
{
char path[64] = {0};
@@ -692,7 +902,16 @@ static int check_xml_file(const char* name)
}
}
-//strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&now)
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
{
struct tm *_utctime = NULL;
@@ -717,279 +936,47 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT
}
-
/* Global functions =============================================================================*/
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value)
+
+UINT8 oneedge_init( void)
{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- value);
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
}
- else
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- value);
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
}
- M2MB_RESULT_E retVal = m2mb_lwm2m_set( h, pUri, &value, sizeof(int));
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M set timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-INT32 write_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
-{
- UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
- {
- AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to %s on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- data);
- }
- else
- {
- AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- data);
- }
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, data, strlen(data));
-
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M write timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result)
-{
- int data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for integer from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%d> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result)
-{
- double data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for double from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%f> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-
-
-void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
-{
- (void)resp_size;
- (void)myUserdata;
-
- M2MB_NET_REG_STATUS_T *stat_info;
-
- switch (net_event)
- {
-
-
-
- case M2MB_NET_GET_REG_STATUS_INFO_RESP:
- stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
- if (stat_info->stat == 1 || stat_info->stat == 5)
- {
- AZX_LOG_TRACE("Module is registered to cell 0x%X!\r\n", stat_info->cellID);
- m2mb_os_ev_set(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- m2mb_net_get_reg_status_info(h); //try again
- }
- break;
-
-
- default:
- AZX_LOG_DEBUG("unexpected net_event: %d\r\n", net_event);
- break;
-
- }
-}
-
-void PdpCallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
-{
- (void)userdata;
- struct M2MB_SOCKET_BSD_SOCKADDR_IN CBtmpAddress;
- CHAR CBtmpIPaddr[32];
-
- switch (pdp_event)
- {
- case M2MB_PDP_UP:
- AZX_LOG_DEBUG ("Context activated!\r\n");
- m2mb_pdp_get_my_ip(h, cid, M2MB_PDP_IPV4, &CBtmpAddress.sin_addr.s_addr);
- m2mb_socket_bsd_inet_ntop( M2MB_SOCKET_BSD_AF_INET, &CBtmpAddress.sin_addr.s_addr, ( CHAR * )&( CBtmpIPaddr ), sizeof( CBtmpIPaddr ) );
- AZX_LOG_TRACE( "IP address: %s\r\n", CBtmpIPaddr);
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_SET);
- break;
-
- case M2MB_PDP_DOWN:
- AZX_LOG_TRACE ("Context deactivated!\r\n");
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_CLEAR);
- break;
- default:
- AZX_LOG_DEBUG("unexpected pdp_event: %d\r\n", pdp_event);
- break;
-
- }
-}
-
-UINT8 oneedge_init( void)
-{
- M2MB_RESULT_E retVal;
- M2MB_LWM2M_ENABLE_REQ_T pars;
-
- INT32 service_enable = 1;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
- UINT32 curEvBits;
-
-
- if(0 != check_xml_file(OBJECT_XML_NAME))
- {
- AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
- return 1;
- }
-
-
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
- osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
-
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
-
- //get the handle of the lwm2m client on _h
- retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )NULL );
-
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- return 1;
- }
-
- retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
-
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
}
lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_S, lwm2m_taskCB);
@@ -998,7 +985,6 @@ UINT8 oneedge_init( void)
if(lwm2m_taskID <= 0)
{
AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
@@ -1014,12 +1000,11 @@ UINT8 oneedge_init( void)
if( retVal != M2MB_RESULT_SUCCESS )
{
AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_ENABLE_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1028,40 +1013,80 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
azx_sleep_ms(2000);
m2mb_lwm2m_deinit(lwm2mHandle);
return 1;
}
-
-
azx_sleep_ms(1000);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ /* query of the custom object URI for agent 0 (Telit)*/
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_R_RES_ID;
+ exist_uri.resourceInst = 0;
- /*Create an instance of the demo's custom object*/
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
- M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
- new_inst_params.agent = 0; /*Telit Agent*/
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
- /*If OK the instance was not present, and so it was created. If an error
- is received in the callback, it is likely because the instance already exists. */
- retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
- if( retVal != M2MB_RESULT_SUCCESS )
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
{
- AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
}
}
+
/*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
{
M2MB_LWM2M_MON_REQ_T mon;
@@ -1082,7 +1107,7 @@ UINT8 oneedge_init( void)
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_MON_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1091,7 +1116,7 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1101,11 +1126,11 @@ UINT8 oneedge_init( void)
}
AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1116,6 +1141,8 @@ UINT8 oneedge_init( void)
return 0;
}
+/*-----------------------------------------------------------------------------------------------*/
+
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
{
@@ -1123,104 +1150,22 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
(void)param1;
(void)param2;
- M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle = NULL;
UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_OBJ_URI_T resource_uri = {0};
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- M2MB_NET_HANDLE netHandle = NULL;
INT32 ret = 0;
+ M2MB_RTC_TIMEVAL_T currTime = {1234567890, 0}; /*dummy value as fallback*/
+ INT32 rtcfd = -1;
int task_status = type;
- void *myUserdata = NULL;
do
{
AZX_LOG_INFO("Initializing resources...\r\n");
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
- osRes = m2mb_os_ev_init( &net_pdp_evHandle, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
- task_status = APPLICATION_EXIT;
- break;
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- /* check network registration and configure PDP context */
- retVal = m2mb_net_init(&netHandle, NetCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- AZX_LOG_TRACE("Waiting for registration...\r\n");
-
- retVal = m2mb_net_get_reg_status_info(netHandle);
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- /*Wait for network registration event to occur (released in NetCallback function) */
- m2mb_os_ev_get(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
-
-
-
- AZX_LOG_TRACE("PDP context initialization\r\n");
- retVal = m2mb_pdp_init(&pdpHandle, PdpCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- /*
- * Just set the APN, as LwM2M agent will automatically manage the connection.
- * !! This could require a reboot if LTE networks are in use !!
- *
- * */
- retVal = m2mb_pdp_APN_set( pdpHandle, 1 /*LWM2M uses CID 1 by default*/, (char*)APN );
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_APN_set returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_APN_set did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- m2mb_pdp_deinit(pdpHandle);
-
-
+ init_sync();
azx_sleep_ms(8000);
@@ -1232,15 +1177,20 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
break;
}
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1){
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ } else {
- AZX_LOG_INFO("\r\nWaiting for events from portal. Write on monitored resource or call an exec\r\n\r\n");
+ AZX_LOG_ERROR("Cannot open RTC!");
+ }
/*Checking client status*/
m2mb_lwm2m_get_stat(lwm2mHandle);
if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_GET_STAT_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1251,12 +1201,17 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
return -2;
}
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
/* ==================================================
- * Sending a read only resource with a SET operation
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
resource_uri.resource = DEMO_INT_R_RES_ID;
@@ -1264,8 +1219,23 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 50);
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
* Filling resource URI with required parameters (multi instance read only integer, in this case)
@@ -1278,6 +1248,7 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 10);
+ azx_sleep_ms(5000);
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
@@ -1288,47 +1259,768 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 11);
+ azx_sleep_ms(5000);
-
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
- * Sending a string resource with a WRITE operation
+ * Sending a read only float resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only double, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
- resource_uri.resource = DEMO_STRING_RW_RES_ID;
- resource_uri.resourceInst = 0;
+ resource_uri.resource = DEMO_FLOAT_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- write_string_resource(lwm2mHandle, &resource_uri, (CHAR *)"demo_string");
+ set_read_only_double_resource(lwm2mHandle, &resource_uri, 20.5);
- while(1)
{
- /*Wait*/
- azx_sleep_ms(1000);
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
}
- task_status = APPLICATION_EXIT;
- } while(0);
- if (task_status == APPLICATION_EXIT)
- {
- if(pdpHandle)
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only boolean resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ set_read_only_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+
+ /* ==================================================
+ * Sending a read only timestamp resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only timestamp, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = (UINT64)currTime.sec;
+ //m2mb_lwm2m_set(lwm2mHandle, &resource_uri, &value, sizeof(value));
+ set_read_only_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+ /*Try and read again the set value*/
+ value = 0;
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a read only opaque resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ set_read_only_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only string resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ set_read_only_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /*------------------------ RW ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-WRITE RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a r/w integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a r/w boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+
+ /*------------------------ Write-only ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "WRITE-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a write-only integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(get_write_only_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(get_write_only_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a write-only boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(get_write_only_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(get_write_only_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(get_write_only_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(get_write_only_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nResources operations examples done.\r\n"
+ "-----------------------------------\r\n");
+
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nWill perform a SET with notify ACK enabled.\r\n"
+ "-----------------------------------\r\n");
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = 0;
+ resource_uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_INFO("Enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* setting the status to ENABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, TRUE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ azx_sleep_ms(2000);
+
+ /* ==================================================
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /* Setting a different value on this resource so the notification will be sent to the server */
+ set_read_only_integer_resource(lwm2mHandle, &resource_uri, 60);
+ {
+
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(30000) /*wait 30 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("lwm2m notify ack timeout!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nACK received from server!\r\n");
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+ }
+ }
+
+ AZX_LOG_INFO("\r\nDisable notify ack\r\n");
+ /* setting the status to DISABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, FALSE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
{
- m2mb_pdp_deinit(pdpHandle);
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
}
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ AZX_LOG_INFO("Done.\r\n");
- if(netHandle)
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+
+ while(1)
{
- m2mb_net_deinit(netHandle);
+ /*Wait*/
+ azx_sleep_ms(10000);
}
+ task_status = APPLICATION_EXIT;
+ } while(0);
- if(net_pdp_evHandle)
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
{
- m2mb_os_ev_deinit(net_pdp_evHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
}
+ deinit_sync();
+ if (rtcfd != -1)
+ {
+ m2mb_rtc_close(rtcfd);
+ }
AZX_LOG_DEBUG("Application complete.\r\n");
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_utils.c
new file mode 100755
index 00000000..cd2c7249
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/src/lwm2m_utils.c
@@ -0,0 +1,922 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Get - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_R_RES_ID:
+ case DEMO_OPAQUE_RW_RES_ID:
+ case DEMO_MULTI_OPAQUE_R_RES_ID:
+ case DEMO_MULTI_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_32010.xml
similarity index 69%
rename from LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_32010.xml
index 1fc773af..f90edc57 100755
--- a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_32010.xml
@@ -3,8 +3,8 @@
m2mb lwm2m demo
object related to all OMA types resources usable in demos
- 35000
- urn:oma:lwm2m:x:35000
+ 32010
+ urn:oma:lwm2m:x:32010
1.0
1.0
Single
@@ -73,7 +73,7 @@
-
Read Only Objlnk
R
- Multiple
+ Single
Mandatory
Objlnk
@@ -82,7 +82,7 @@
- -
+
-
Read Write String
RW
Single
@@ -145,7 +145,7 @@
-
Read Write Objlnk
RW
- Multiple
+ Single
Mandatory
Objlnk
@@ -298,28 +298,159 @@
- -
-
Executable 1
- E
+ -
+
Write Only String
+ W
Single
Mandatory
-
+ String
-
- -
-
Executable 2
- E
+ -
+
Write Only Integer
+ W
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only Float
+ W
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only Boolean
+ W
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only Opaque
+ W
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only Time
+ W
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only Objlnk
+ W
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Write Only MultiInstance String
+ W
Multiple
Mandatory
+ String
+
+
+
+
+ -
+
Write Only MultiInstance Integer
+ W
+ Multiple
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only MultiInstance Float
+ W
+ Multiple
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only MultiInstance Boolean
+ W
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only MultiInstance Opaque
+ W
+ Multiple
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only MultiInstance Time
+ W
+ Multiple
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only MultiInstance Objlnk
+ W
+ Multiple
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Executable
+ E
+ Single
+ Mandatory
-
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml
deleted file mode 100755
index 1fc773af..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M/xml/object_35000.xml
+++ /dev/null
@@ -1,326 +0,0 @@
-
-
-
- m2mb lwm2m demo
- object related to all OMA types resources usable in demos
- 35000
- urn:oma:lwm2m:x:35000
- 1.0
- 1.0
- Single
- Optional
-
- -
-
Read Only String
- R
- Single
- Mandatory
- String
-
-
-
-
- -
-
Read Only Integer
- R
- Single
- Mandatory
- Integer
-
-
-
-
- -
-
Read Only Float
- R
- Single
- Mandatory
- Float
-
-
-
-
- -
-
Read Only Boolean
- R
- Single
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Only Opaque
- R
- Single
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Only Time
- R
- Single
- Mandatory
- Time
-
-
-
-
- -
-
Read Only Objlnk
- R
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
- -
-
Read Write String
- RW
- Single
- Mandatory
- String
-
-
-
-
- -
-
Read Write Integer
- RW
- Single
- Mandatory
- Integer
-
-
-
-
- -
-
Read Write Float
- RW
- Single
- Mandatory
- Float
-
-
-
-
- -
-
Read Write Boolean
- RW
- Single
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Write Opaque
- RW
- Single
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Write Time
- RW
- Single
- Mandatory
- Time
-
-
-
-
- -
-
Read Write Objlnk
- RW
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
-
- -
-
Read only MultiInstance String
- R
- Multiple
- Mandatory
- String
-
-
-
-
- -
-
Read only MultiInstance Integer
- R
- Multiple
- Mandatory
- Integer
-
-
-
-
- -
-
Read only MultiInstance Float
- R
- Multiple
- Mandatory
- Float
-
-
-
-
- -
-
Read only MultiInstance Boolean
- R
- Multiple
- Mandatory
- Boolean
-
-
-
-
- -
-
Read only MultiInstance Opaque
- R
- Multiple
- Mandatory
- Opaque
-
-
-
-
- -
-
Read only MultiInstance Time
- R
- Multiple
- Mandatory
- Time
-
-
-
-
- -
-
Read only MultiInstance Objlnk
- R
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
- -
-
Read Write MultiInstance String
- RW
- Multiple
- Mandatory
- String
-
-
-
-
- -
-
Read Write MultiInstance Integer
- RW
- Multiple
- Mandatory
- Integer
-
-
-
-
- -
-
Read Write MultiInstance Float
- RW
- Multiple
- Mandatory
- Float
-
-
-
-
- -
-
Read Write MultiInstance Boolean
- RW
- Multiple
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Write MultiInstance Opaque
- RW
- Multiple
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Write MultiInstance Time
- RW
- Multiple
- Mandatory
- Time
-
-
-
-
- -
-
Read Write MultiInstance Objlnk
- RW
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
- -
-
Executable 1
- E
- Single
- Mandatory
-
-
-
-
-
-
- -
-
Executable 2
- E
- Multiple
- Mandatory
-
-
-
-
-
-
-
-
-
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/Makefile.in
new file mode 100755
index 00000000..0126abeb
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_MAIN_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/README.md
new file mode 100755
index 00000000..3b5c73a2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/README.md
@@ -0,0 +1,144 @@
+
+### LWM2M OBJ_GET AND OBJ_SET
+
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on **MAIN UART**
+
+
+**Features**
+
+
+- Configure LWM2M client and enable it
+
+- Create an instance of a custom object
+
+- Create a Json string
+
+- Set string, integer, float, boolean, timestamp and opaque values with `m2mb_lwm2m_objset`
+
+- Get all resources values with `m2mb_lwm2m_objget`
+
+- Manage write, read and monitoring resources changed from the portal
+
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Open USB/UART/UART_AUX
+
+- Create a task to manage the LWM2M client and start it
+
+
+**`lwm2m_demo.c`**
+
+**`msgLWM2MTask`**
+- Check registration status
+
+- Initialize LWM2M client,
+
+ - Check for XML file fo custom object
+
+ - Enable unsolicited messages from client
+
+ - Create a task \(lwm2m_taskCB is its callback function \)to manage events from Portal
+
+ - Enable LwM2M client
+
+ - Create a new instance for the custom object
+
+ - Wait for client to register to Portal
+
+ - Performs obj_set and obj_get operations on the related resources
+
+ - Wait for events from server
+
+
+**`lwm2mIndicationCB`**
+
+- Manage events arriving from client \(operations completion status and unsolicited events\)
+- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
+#### Custom Object configuration
+
+The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
+
+First, enter Developer section from the top menu
+
+
+
+
+Choose Object Registry
+
+
+
+
+Create a New Object
+
+
+
+
+Copy the xml file content and paste it in the new Object form
+
+
+
+
+
+Also, the application requires the XML file `/xml/object_32011.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+It can be done with
+
+`AT#M2MWRITE=/XML/object_32011.xml,`
+
+To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
+
+
+
+
+Select the file from your computer
+
+
+
+
+The file is successfully loaded on the module
+
+
+
+
+#### Application execution example
+
+
+
+
+
+
+
+
+
+
+After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
+
+
+
+An instance of the object will be present and the resources can be modified.
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
new file mode 100755
index 00000000..cccb3c54
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
@@ -0,0 +1,89 @@
+/*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.3
+ * @dependencies core/azx_log
+ * @author Ioannis Demetriou
+ * @author Sorin Basca
+ * @date 10/02/2019
+ *
+ * @brief Various helpful utilities
+ */
+#include "m2mb_types.h"
+#include "azx_log.h"
+
+
+/**
+ * @brief Limits a value to a certain interval
+ *
+ * This is defined as a macro so it works with any types that support ordering.
+ *
+ * @param val The value to limit
+ * @param min The minimum allowed value
+ * @param max The maximum allowed value
+ *
+ * @return The original value if it was inside the limits, or min, or max, if it was less than, or
+ * greater than the limits.
+ */
+#define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/description.txt
new file mode 100644
index 00000000..143ae1fb
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/description.txt
@@ -0,0 +1 @@
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on MAIN UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
new file mode 100755
index 00000000..9bfb403a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
@@ -0,0 +1,103 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.h
+
+ @brief
+ demo related definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author
+
+
+ @date
+ 22/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_DEMO_H_
+#define HDR_LWM2M_DEMO_H_
+
+
+/* Global declarations ==========================================================================*/
+
+
+/*LWM2M event bits*/
+#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_OBJGET_RES_BIT (UINT32)0x00100000
+#define EV_LWM2M_OBJSET_RES_BIT (UINT32)0x00200000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
+#define EV_MON_URC_RECEIVED 2
+#define EV_URC_TO_BE_ENABLED 3
+
+
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32011
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+
+#define OBJECT_XML_NAME "object_32011.xml"
+
+
+/* Global typedefs ==============================================================================*/
+typedef enum {
+ INIT=0,
+
+ APPLICATION_EXIT
+} APP_STATES;
+
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Initialize OneEdge connection
+ @param[in] obj_id Object ID to be used for initialization
+ @return result of initialization
+
+*/
+UINT8 oneedge_init( void );
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
+#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..d69e680b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"619e27be14c97817d38a452c","name":"LwM2M resources objset - objget demo","observations":[{"objId":32011,"instId":0}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/metadata.json
new file mode 100755
index 00000000..e41eab0c
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/metadata.json
@@ -0,0 +1,65 @@
+{
+ "name": "Sample App for LwM2M with OBJSET and OBJGET calls",
+ "type": "sample-app",
+ "description": "A sample app that shows LwM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "LwM2M",
+ "OneEdge"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": []
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Alessio Quieti",
+ "email": "alessio.quieti@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
+ }
+}
diff --git a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
similarity index 74%
rename from LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
index f511c74a..3a7d8622 100755
--- a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -9,11 +9,11 @@
The file contains the main user entry point of Appzone
@details
-
+
@description
- Sample application showcasing LWM2M client usage with M2MB API. Debug prints on AUX UART
- @version
- 1.0.1
+ Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on MAIN UART
+ @version
+ 1.0.0
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -22,7 +22,7 @@
@date
- 27/05/2020
+ 22/11/2021
*/
/* Include files ================================================================================*/
@@ -62,7 +62,7 @@ void M2MB_main( int argc, char **argv )
{
(void)argc;
(void)argv;
-
+
INT32 taskID;
azx_tasks_init();
@@ -72,21 +72,16 @@ void M2MB_main( int argc, char **argv )
/*SET output channel */
AZX_LOG_INIT();
- AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
+ AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources objset - objget demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
AZX_LOG_TRACE("Task ID: %d.\r\n", taskID);
-
+
azx_sleep_ms(1000);
-
+
if (taskID > 0)
{
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
new file mode 100755
index 00000000..d453b7c5
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
@@ -0,0 +1,1111 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.c
+
+ @brief
+ The file contains the LWM2M utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+ Alessio Quieti
+
+ @date
+ 22/11/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_net.h"
+#include "m2mb_pdp.h"
+#include "m2mb_socket.h"
+
+#include "m2mb_fs_stdio.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+/* Local defines ================================================================================*/
+#define CTX_ID 1 /*PDP context ID*/
+
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+const char *IF_STATUS_STRING[] = { "M2MB_LWM2M_IF_STATE_NONE",
+ "M2MB_LWM2M_IF_STATE_DISABLED", "M2MB_LWM2M_IF_STATE_ACK_WAIT",
+ "M2MB_LWM2M_IF_STATE_ACTIVE", "M2MB_LWM2M_IF_STATE_IDLE",
+ "M2MB_LWM2M_IF_STATE_DEREG_WAIT", "M2MB_LWM2M_IF_STATE_DEREGISTERING" };
+
+const char *CL_STATUS_STRING[] = { "M2MB_LWM2M_CL_STATE_DISABLED",
+ "M2MB_LWM2M_CL_STATE_BOOTSTRAPPING", "M2MB_LWM2M_CL_STATE_BOOTSTRAPPED",
+ "M2MB_LWM2M_CL_STATE_REGISTERING", "M2MB_LWM2M_CL_STATE_REGISTERED",
+ "M2MB_LWM2M_CL_STATE_DEREGISTERING", "M2MB_LWM2M_CL_STATE_SUSPENDED" };
+
+static INT8 lwm2m_taskID;
+
+/*===== ONEEDGE =====*/
+
+/*Handles*/
+static M2MB_LWM2M_HANDLE lwm2mHandle;
+
+/*URI objects*/
+
+static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
+ 33211, 0, 0, 1};
+
+/* Local function prototypes ====================================================================*/
+
+static INT32 lwm2m_taskCB( INT32 event, INT32 info, INT32 param2);
+
+/**
+ @brief Callback function for Client generated LWM2M events
+
+ WARNING: do not place blocking action within callback, since it is issued by the agent's task!!
+
+ @param[in] h LWM2M handle
+ @param[in] event Event Identification
+ @param[in] resp_size Size of the response buffer
+ @param[in] resp_struct Address of response buffer
+ @param[in] userdata Address of user data
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event,
+ UINT16 resp_size, void *resp_struct, void *userdata );
+
+
+/*!
+ * @brief Check existence of XML object description file in XML directory
+ *
+ * @param[in] name Name of the file to be checked
+ * @retval 0 if OK, other values error
+ *
+ */
+static int check_xml_file(const char* name);
+
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz);
+
+/* Static functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
+static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
+{
+ (void) param2;
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
+ INT32 data_int = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
+ double data_float = 0;
+
+
+ INT32 retVal;
+ M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
+ M2MB_LWM2M_OBJ_URI_T uri = *pUri;
+
+
+
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
+
+ m2mb_os_free(pUri);
+
+ uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
+ switch(event)
+ {
+ case EV_MON_URC_RECEIVED:
+
+ AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+
+ if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
+ {
+ switch(uri.resource)
+ {
+
+ /* ==================
+ *
+ * STRING TYPES
+ *
+ * ==================*/
+ case DEMO_STRING_RW_RES_ID:
+ case DEMO_MULTI_STRING_RW_RES_ID:
+ /*fallback*/
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ /* ==================
+ *
+ * INTEGER TYPES
+ *
+ * ==================*/
+ case DEMO_INT_RW_RES_ID:
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ /* ==================
+ *
+ * FLOAT TYPES
+ *
+ * ==================*/
+ case DEMO_FLOAT_RW_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+
+ /* ==================
+ *
+ * BOOLEAN TYPES
+ *
+ * ==================*/
+ case DEMO_BOOL_RW_RES_ID:
+ case DEMO_MULTI_BOOL_RW_RES_ID:
+ /*fallback*/
+
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+
+ break;
+
+ /* ==================
+ *
+ * TIME TYPES
+ *
+ * ==================*/
+ case DEMO_TIME_RW_RES_ID:
+ {
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ }
+ break;
+
+
+ /* ==================
+ *
+ * OPAQUE TYPES
+ *
+ * ==================*/
+ case DEMO_OPAQUE_RW_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+ break;
+
+ default:
+ AZX_LOG_WARN("\r\nUnexpected resource URI {%u/%u/%u/%u (%u)}!\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+ break;
+ } /* switch(uri.resource) */
+
+ AZX_LOG_TRACE("Data type: %d\r\n", data_type);
+ }
+ else
+ {
+ AZX_LOG_WARN("Unexpected object ID %u\r\n", uri.obj);
+ }
+
+ break;
+
+ default:
+ AZX_LOG_WARN("Unmanaged task event %d\r\n", event);
+ break;
+ } /* switch(event) */
+
+ return 1;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
+ void *userdata )
+{
+ ( void ) h;
+ ( void ) resp_size;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
+
+ /* Client generated events */
+ switch( event )
+ {
+
+ /* event in response to m2mb_lwm2m_enable() */
+ case M2MB_LWM2M_ENABLE_RES:
+ {
+ M2MB_LWM2M_ENABLE_RES_T *resp = ( M2MB_LWM2M_ENABLE_RES_T * ) resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_INFO( "LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_set() */
+ case M2MB_LWM2M_SET_RES:
+ {
+ M2MB_LWM2M_SET_RES_T *resp = ( M2MB_LWM2M_SET_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_read() */
+ case M2MB_LWM2M_READ_RES:
+ {
+ M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_write() */
+ case M2MB_LWM2M_WRITE_RES:
+ {
+ M2MB_LWM2M_WRITE_RES_T *resp = ( M2MB_LWM2M_WRITE_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
+ }
+ else
+ {
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_new_inst() */
+ case M2MB_LWM2M_NEW_INST_RES:
+ {
+ // event in response to the m2mb_lwm2m_newinst
+ M2MB_LWM2M_NEW_INST_RES_T *resp = ( M2MB_LWM2M_NEW_INST_RES_T * )resp_struct;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+ AZX_LOG_TRACE( "New Instance created successfully\r\n" );
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_DEBUG( "New instance creation not allowed (already present?)\r\n" );
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance failed. Result: %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SRV_INFO_IND:
+ {
+
+ M2MB_LWM2M_SRV_INFO_IND_T *resp = ( M2MB_LWM2M_SRV_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND, resp->info = %d\r\n", resp->info);
+
+ switch(resp->info)
+ {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_SUSPENDED\r\n" );
+ break;
+ default:
+ AZX_LOG_WARN( "resp->info: unexpected value!! %d\r\n", resp->info);
+ break;
+ }
+ break;
+ }
+
+ /* event in case a resource changed (if monitoring is enabled) */
+ case M2MB_LWM2M_MON_INFO_IND:
+ {
+ /*
+ An URC was received, like
+ #LWM2MMON: UPD,"/3311/x/5850/0
+ */
+ /* event that brings a resource change information */
+ M2MB_LWM2M_OBJ_URI_T * p_uri = (M2MB_LWM2M_OBJ_URI_T *)m2mb_os_malloc(sizeof(M2MB_LWM2M_OBJ_URI_T));
+
+ M2MB_LWM2M_MON_INFO_IND_T *pInfo = ( M2MB_LWM2M_MON_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("\r\nM2MB_LWM2M_MON_INFO_IND\r\n");
+
+ if(p_uri)
+ {
+ memcpy(p_uri, &(pInfo->uri), sizeof(M2MB_LWM2M_OBJ_URI_T));
+ AZX_LOG_INFO( "\r\nResource /%u/%u/%u/%u changed!\r\n",
+ p_uri->obj, p_uri->objInst,
+ p_uri->resource, p_uri->resourceInst
+ );
+
+ azx_tasks_sendMessageToTask( lwm2m_taskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
+
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ M2MB_LWM2M_MON_RES_T *resp = ( M2MB_LWM2M_MON_RES_T * )resp_struct;
+ AZX_LOG_TRACE( "Resource change monitor setting result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ M2MB_LWM2M_GET_STAT_RES_T *resp = ( M2MB_LWM2M_GET_STAT_RES_T * )resp_struct;
+
+ AZX_LOG_TRACE( "Get Stat result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
+ IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_OBJSET_RES:
+ {
+ M2MB_LWM2M_OBJSET_RES_T *resp = (M2MB_LWM2M_OBJSET_RES_T *) resp_struct;
+
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+
+ case M2MB_LWM2M_OBJGET_RES:
+ {
+ M2MB_LWM2M_OBJGET_RES_T *resp = (M2MB_LWM2M_OBJGET_RES_T *) resp_struct;
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_TRACE("objGet string <%s>\r\n", resp->dataString);
+ AZX_LOG_TRACE("objGet string size <%d>\r\n", resp->dataStringSize);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ default:
+ AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
+static int check_xml_file(const char* name)
+{
+ char path[64] = {0};
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+
+ AZX_LOG_TRACE("Looking for <%s> file..\r\n", path);
+
+ if(0 == m2mb_fs_stat(path, &info))
+ {
+ AZX_LOG_TRACE("File is present.\r\n");
+ return 0;
+ }
+ else
+ {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if(last_errno == M2MB_FS_ENOENT)
+ {
+ AZX_LOG_WARN("File %s not found.\r\n", path);
+ return -1;
+ }
+ else
+ {
+ AZX_LOG_ERROR("error with m2mb_fs_stat, errno is: %d\r\n", last_errno);
+ return -2;
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
+{
+ struct tm *_utctime = NULL;
+
+ if(!p_rtc_time)
+ {
+ return;
+ }
+
+ memset(p_rtc_time,0,sizeof(M2MB_RTC_TIME_T));
+ _utctime = gmtime((const time_t *)&t);
+ if(_utctime)
+ {
+ p_rtc_time->year = _utctime->tm_year + 1900;
+ p_rtc_time->mon = _utctime->tm_mon + 1;
+ p_rtc_time->day = _utctime->tm_mday;
+ p_rtc_time->hour = _utctime->tm_hour;
+ p_rtc_time->min = _utctime->tm_min;
+ p_rtc_time->sec = _utctime->tm_sec;
+ p_rtc_time->tz = tz;
+ }
+}
+
+
+/* Global functions =============================================================================*/
+
+UINT8 oneedge_init( void)
+{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
+ {
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
+ }
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
+ }
+
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
+
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_M, lwm2m_taskCB);
+
+ AZX_LOG_TRACE("Task ID: %d.\r\n", lwm2m_taskID);
+ if(lwm2m_taskID <= 0)
+ {
+ AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ pars.apnclass = CTX_ID; /*CID*/
+ pars.guardRequestEventSecs = 5;
+ pars.guardReleaseEventSecs = 5;
+ pars.commandType = M2MB_LWM2MENA_CMD_TYPE_SET;
+ pars.mode = M2MB_LWM2M_MODE_NO_ACK;
+
+ retVal = m2mb_lwm2m_enable( lwm2mHandle, &pars );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
+
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ /* query of the custom object URI for agent 0 (Telit)*/
+
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_RW_RES_ID;
+ exist_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
+ {
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ }
+ }
+
+
+
+ /*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+
+ M2MB_LWM2M_OBJ_URI_T uri_mon = {
+ M2MB_LWM2M_URI_4_FIELDS,
+ M2MB_LWM2M_DEMO_OBJ_ID, 0,
+ 0, 0
+ };
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded\r\n" );
+ }
+
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_MON_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+ AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
+{
+ (void)type;
+ (void)param1;
+ (void)param2;
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJGET_PARAM_T objGetReq;
+
+ UINT16 objGetRespSize = 8000; //size of the buffer where to write the response
+ CHAR* objGetRespString = NULL;
+ M2MB_RESULT_E objres;
+
+ int json_size = 400;
+ char * json_string = NULL;
+
+ INT32 ret = 0;
+ int i;
+ int task_status = type;
+
+ do
+ {
+ AZX_LOG_INFO("Initializing resources...\r\n");
+
+ init_sync();
+
+ azx_sleep_ms(8000);
+
+ /*Initialize LWM2M*/
+ ret = oneedge_init();
+ if (ret != 0)
+ {
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /*Checking client status*/
+ m2mb_lwm2m_get_stat(lwm2mHandle);
+
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_GET_STAT_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M get status timeout!\r\n");
+ return -2;
+ }
+
+ /*Obj_set on the custom object*/
+ json_string = (char *) m2mb_os_malloc(json_size * sizeof(char));
+ M2MB_LWM2M_OBJSET_PARAM_T obj_struct;
+
+ /*New multiple set with JSON string*/
+ sprintf(json_string, "{\"bn\":\"/%d/0/\",\"e\":"
+ "["
+ "{\"n\":\"11\",\"sv\":\"hello world\"}," /*String*/
+ "{\"n\":\"12\",\"v\":70}," /*integer*/
+ "{\"n\":\"13\",\"v\":-12.5}," /*float*/
+ "{\"n\":\"15\",\"sv\":\"aGVsbG8gd29ybGQ=\"}," /*opaque: data must be in BASE64 format*/
+ "{\"n\":\"16\",\"v\":1620828702}," /*time*/
+ "{\"n\":\"31/0\",\"sv\":\"Greetings\"}," /*String multi-instance*/
+ "{\"n\":\"31/1\",\"sv\":\"from\"}," /*String multi-instance*/
+ "{\"n\":\"31/2\",\"sv\":\"AppZone!\"}," /*String multi-instance*/
+ "{\"n\":\"34/0\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/1\",\"bv\":false}," /*Boolean multi-instance*/
+ "{\"n\":\"34/2\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/3\",\"bv\":false}" /*Boolean multi-instance*/
+ "]}",
+ M2MB_LWM2M_DEMO_OBJ_ID
+ );
+
+ obj_struct.objectId = M2MB_LWM2M_DEMO_OBJ_ID;
+ obj_struct.objectInstanceId = 0;
+ obj_struct.dataString = json_string;
+ obj_struct.dataStringSize = json_size;
+
+ if (m2mb_lwm2m_objset(lwm2mHandle, &obj_struct) == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objset status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objset SUCCESS \r\n");
+ }
+ }
+ else
+ {
+ AZX_LOG_ERROR("\r\nm2mb_lwm2m_objset failed\r\n");
+ }
+
+ m2mb_os_free(json_string);
+ json_string = NULL;
+
+ azx_sleep_ms(10000);
+
+ i = 5;
+ AZX_LOG_INFO("\r\nWaiting %d seconds before the m2mb_lwm2m_objget\r\n", i);
+
+ while(i > 0)
+ {
+ AZX_LOG_INFO("\r\nWaiting: %d\r\n", i);
+ azx_sleep_ms(1000);
+ i--;
+ }
+
+ objGetRespString = (CHAR*)m2mb_os_calloc(objGetRespSize * sizeof(CHAR));
+
+ memset(&objGetReq, 0, sizeof(M2MB_LWM2M_OBJGET_PARAM_T));
+
+ objGetReq.agentId = 0;
+ objGetReq.uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ objGetReq.uri.objInst = 0;
+ objGetReq.uri.uriLen = M2MB_LWM2M_URI_2_FIELDS;
+
+ objres = m2mb_lwm2m_objget(lwm2mHandle, &objGetReq, objGetRespString,
+ objGetRespSize);
+
+ if (objres == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M OBJget status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objget SUCCESS \r\n");
+ AZX_LOG_INFO("\r\nContent: \r\n<%s>\r\n\r\n", objGetRespString);
+ }
+ } else
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objget failed\r\n");
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+ while(1)
+ {
+ /*Wait*/
+ azx_sleep_ms(10000);
+ }
+ task_status = APPLICATION_EXIT;
+ } while(0);
+
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
+ {
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ }
+
+ if(json_string)
+ {
+ m2mb_os_free(json_string);
+ }
+
+ deinit_sync();
+ AZX_LOG_DEBUG("Application complete.\r\n");
+ }
+
+ return 0;
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
new file mode 100755
index 00000000..fa70f5ea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
@@ -0,0 +1,909 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml
new file mode 100755
index 00000000..b275635e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/LWM2M_OBJ_SET_GET/xml/object_32011.xml
@@ -0,0 +1,106 @@
+
+
+
+ m2mb lwm2m objset-get demo
+ object providing OMA resources required for the m2mb_lwm2m_objget and m2mb_lwm2m_objset DEMO
+ 32011
+ urn:oma:lwm2m:x:32011
+ 1.0
+ 1.0
+ Single
+ Optional
+
+ -
+
Read Write String
+ RW
+ Single
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write Integer
+ RW
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Read Write Float
+ RW
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Read Write Boolean
+ RW
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Read Write Opaque
+ RW
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Read Write Time
+ RW
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Read Write Objlnk
+ RW
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+ -
+
Read Write MultiInstance String
+ RW
+ Multiple
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write MultiInstance Boolean
+ RW
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/metadata.json
old mode 100755
new mode 100644
index b6d942ec..8e467776
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Logging/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/metadata.json
old mode 100755
new mode 100644
index 522467fd..63477194
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MD5/metadata.json
@@ -14,13 +14,15 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,9 +40,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/metadata.json
old mode 100755
new mode 100644
index 158ad703..40e55098
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -34,9 +36,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/src/mqtt_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/src/mqtt_demo.c
index fc7554f7..00741d9e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/src/mqtt_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MQTT/src/mqtt_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.5
+ 1.0.6
@note
@@ -141,9 +141,8 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
return;
}
- if ((ssl_auth_mode == M2MB_SSL_SERVER_AUTH) || (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH))
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
-
/* clean everything */
res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
if(res==0)
@@ -155,6 +154,20 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
}
}
+
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
+ {
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
+ }
+
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -265,18 +278,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
- if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
+ if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
{
AZX_LOG_DEBUG("server + client authentication is chosen \r\n");
AZX_LOG_DEBUG("ca cert file %s \r\n",CLIENTCERTFILE);
@@ -284,14 +299,14 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
AZX_LOG_DEBUG("file size: %u\r\n", st.st_size);
-
}
fd = m2mb_fs_open(CLIENTCERTFILE, M2MB_O_RDONLY); /*open in read only mode*/
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -301,7 +316,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -329,7 +345,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -339,7 +356,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -356,13 +374,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -543,7 +563,11 @@ INT32 MQTT_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
-
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
/* Init events handler */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/metadata.json
old mode 100755
new mode 100644
index 58b49b5e..85d4fef0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/MultiTask/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/metadata.json
old mode 100755
new mode 100644
index c100619c..e06bc734
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Mutex/metadata.json
@@ -15,19 +15,20 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -37,9 +38,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/metadata.json
old mode 100755
new mode 100644
index 9137e03f..4af20f01
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/NTP/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/Makefile.in
new file mode 100755
index 00000000..0126abeb
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_MAIN_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/README.md
new file mode 100755
index 00000000..3a6ab3e6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/README.md
@@ -0,0 +1,28 @@
+
+### RTC example
+
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on **MAIN UART**
+
+
+**Features**
+
+
+- How to read module timestamp
+- How to read module system time
+- How to set new system time
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Init log azx and print a welcome message
+- Init net functionality and wait for module registration
+- Init RTC functionality and get module time in timestamp format (seconds from the epoch)
+- Get moudle system time in date/time format
+- Add 1 hour to timestamp, convert it to system time and set it to module
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /** (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/description.txt
new file mode 100644
index 00000000..a7f0d004
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/description.txt
@@ -0,0 +1 @@
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on MAIN UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/metadata.json
new file mode 100755
index 00000000..62dc4bec
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/metadata.json
@@ -0,0 +1,77 @@
+{
+ "name": "Sample App to set/get module RTC",
+ "type": "sample-app",
+ "description": "A sample app that shows how to set and get module system time and timestamp.",
+ "copyright": "Telit Communications, 2020",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "RTC",
+ "Time"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.00.xx6",
+ "30.00.xx7",
+ "30.00.xx8",
+ "30.00.xx9",
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx1",
+ "37.00.xx2",
+ "37.00.xx3",
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": [
+ "25.20.xx8",
+ "25.20.xx9",
+ "25.21.xx0"
+ ]
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ "25.30.xx1",
+ "25.30.xx2"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/src/M2MB_main.c
new file mode 100755
index 00000000..9e95984b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/RTC/src/M2MB_main.c
@@ -0,0 +1,280 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on MAIN UART
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 11/10/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "m2mb_os_api.h"
+#include "m2mb_net.h"
+#include "m2mb_rtc.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define EV_NET_BIT (UINT32)0x1 /*0x0000000000000001*/
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+static M2MB_OS_EV_HANDLE net_evHandle = NULL;
+M2MB_NET_HANDLE hNet;
+
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
+{
+ (void)resp_size;
+ (void)myUserdata;
+
+ M2MB_NET_REG_STATUS_T *stat_info;
+
+ switch (net_event)
+ {
+
+ case M2MB_NET_GET_REG_STATUS_INFO_RESP:
+ stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
+ if (stat_info->stat == 1 || stat_info->stat == 5)
+ {
+ AZX_LOG_INFO("Module is registered!\r\n");
+ m2mb_os_ev_set(net_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_net_get_reg_status_info(h); //call it again
+ }
+ break;
+
+
+ default:
+ AZX_LOG_TRACE("unexpected net_event: %d\r\n", net_event);
+ break;
+
+ }
+}
+
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+(void)argc;
+(void)argv;
+M2MB_OS_RESULT_E osRes;
+M2MB_RESULT_E res;
+INT32 retVal;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+void *myUserdata = NULL;
+
+
+struct tm dateTime;
+time_t currTime;
+INT32 rtcfd;
+M2MB_RTC_TIME_T newTime;
+INT16 timeZone;
+
+
+
+ AZX_LOG_INIT();
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO( "\r\n Start RTC demo application. This is v%s built on %s %s.\r\n",
+ VERSION, __DATE__, __TIME__);
+
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
+ osRes = m2mb_os_ev_init( &net_evHandle, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ res = m2mb_net_init(&hNet, NetCallback, myUserdata);
+ if ( res == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for registration...\r\n");
+
+ res = m2mb_net_get_reg_status_info(hNet);
+ if ( res != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ /*Wait for network registration event to occur (released in NetCallback function) */
+ m2mb_os_ev_get(net_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1)
+ {
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot open RTC!");
+ return;
+ }
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("Module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ if (newTime.tz != 255)
+ {
+ timeZone = newTime.tz;
+ }
+ else
+ {
+ timeZone = 0;
+ }
+
+ /*
+ * Get time and date in timestamp format, add one hour, convert it into date/time format, setthis new value
+ */
+ AZX_LOG_INFO("\r\nGet current time and add an hour\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ //Add 1 hour -> 3600 sec
+
+ currTime += 3600;
+ {
+ struct tm *tmp = localtime(&currTime);
+ if (tmp != NULL)
+ {
+ dateTime = *tmp;
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get local time!");
+ return;
+ }
+ }
+
+ AZX_LOG_TRACE("Current time converted: %d-%02d-%02d, %02d:%02d:%02d\r\n", dateTime.tm_year + 1900, dateTime.tm_mon + 1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min, dateTime.tm_sec);
+
+ newTime.hour = dateTime.tm_hour;
+ newTime.min = dateTime.tm_min;
+ newTime.sec = dateTime.tm_sec;
+ newTime.day = dateTime.tm_mday;
+ newTime.mon = dateTime.tm_mon + 1; //January is 0
+ newTime.year = dateTime.tm_year + 1900;
+ newTime.dlst = (UINT8)dateTime.tm_isdst;
+ newTime.tz = timeZone;
+
+ AZX_LOG_INFO("New time to be set: %d-%02d-%02d, %02d:%02d:%02d, tz:%d, dlst:%d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec, newTime.tz, newTime.dlst);
+
+
+ //set module system time
+ AZX_LOG_INFO("\r\nSet new time and check the setting\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_SET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_TRACE("\r\nSet new system time done\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot set new system time!");
+ return;
+ }
+
+ //check if value has changed
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("NEW module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ azx_sleep_ms(2000);
+
+ m2mb_rtc_close(rtcfd);
+}
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/Makefile.in
index 59b129cb..f0e01926 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
new file mode 100755
index 00000000..786e2684
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
@@ -0,0 +1,1418 @@
+/*
+ * azx_common.c
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#include "azx_pduCommon.h"
+
+#include
+#include
+#include
+
+
+/*
+ Setting out_fmt variable, output can be represented in hex raw (if coding is 8-bit or UCS2) or utf8. Default is utf8.
+ Variable can be set/read runtime using function pdu_set_output_format/get_set_output_format
+ */
+
+static SMS_TXT_OUT_FMT_E out_fmt = UTF8_default;
+//SMS_TXT_OUT_FMT_E out_fmt = HEX_raw;
+
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
+ u8 n = 0; u16 o;
+ if (in[0] < 0x80){ n = 1; o = in[0]; }
+ else if ((in[0] & 0xE0) == 0xE0){
+ if ((in[1] != 0) && (in[2] != 0)){
+ n = 3;
+ o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
+ }
+ } else if ((in[0] & 0xC0) == 0xC0){
+ if (in[1] != 0){
+ n = 2;
+ o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
+ }
+ }
+ if (n){
+ if (be){
+ *((u8 *)out) = o >> 8;
+ *((u8 *)out + 1) = o;
+ } else {
+ *((u8 *)out) = o;
+ *((u8 *)out + 1) = o >> 8;
+ }
+ }
+ return n;
+}
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
+ if (in_len == 0) in_len = s_len(in,0);
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = utf8_to_ucs2(in, out, be);
+ if (n == 0) in_len = 0;
+ else {
+ in += n;
+ out++; out_len++;
+ in_len = (in_len >= n) ? (in_len - n) : 0;
+ }
+ }
+ return out_len;
+}
+
+
+u8 ucs2_to_utf8(u32 in, u8 *out){
+ u8 n = 0;
+ if (in < 0x80){
+ out[0] = in;
+ out[1] = 0;
+ n = 1;
+ }
+ else if ((in >= 0x80) && (in < 0x800)){
+ out[0] = (in >> 6) | 0xC0;
+ out[1] = (in & 0x3F) | 0x80;
+ out[2] = 0;
+ n = 2;
+ }
+ else if ((in >= 0x800) && (in < 0xFFFF)){
+ if (!((in >= 0xD800) && (in <= 0xDFFF))){
+ out[0] = (in >> 12) | 0xE0;
+ out[1] = ((in >> 6 ) & 0x3F) | 0x80;
+ out[2] = (in & 0x3F) | 0x80;
+ out[3] = 0;
+ n = 3;
+ }
+ }
+ else if ((in >= 0x10000) && (in < 0x10FFFF)){
+ out[0] = 0xF0 | (in >> 18);
+ out[1] = 0x80 | ((in >> 12) & 0x3F);
+ out[2] = 0x80 | ((in >> 6) & 0x3F);
+ out[3] = 0x80 | ((in & 0x3F));
+ out[4] = 0;
+ return 4;
+ }
+ return n;
+}
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = ucs2_to_utf8(
+ (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
+ if (n == 0) in_len = 0;
+ else {
+ in++; in_len--;
+ out += n; out_len += n;
+ }
+ }
+ return out_len;
+}
+
+u16 s_len(u8 *s, u8 eol){
+ if (s == NULL) return 0;
+ u16 l = 0;
+ while (*s++ != eol) l++;
+ return l;
+}
+u8 s_lines(u8 *s, u16 len, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 n = 0;
+ while (len--) if (*s++ == eol) n++;
+ return n;
+}
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 l = 0;
+ while (len-- && (l < line))
+ if (*s++ == eol) l++;
+ return (len == 0) ? NULL : s;
+}
+u8 *s_skip_crlf(u8 *s){
+ while ((*s == '\r')||(*s == '\n')) s++;
+ return s;
+}
+
+u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
+void s_upcase(u8 *s, u16 len){
+ if (len == 0) len = s_len(s, 0);
+ while (len--){
+ *s = c_upcase(*s);
+ s++;
+ }
+}
+
+u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
+u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
+
+u8 s_cmp(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (*s1++ != *s2++) return 0;
+ return 1;
+}
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
+ return 1;
+}
+
+u8 s_starts(u8 *s, char *start){
+ while (*start != 0) if (*s++ != *start++) return 0;
+ return 1;
+}
+u8 s_ends(u8 *s, char *end){
+ u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
+ if ((el > 0)&&(sl >= el)){
+ s += sl - 1; end += el - 1;
+ while (el--) if (*s-- != *end--) return 0;
+ return 1;
+ }
+ return 0;
+}
+
+u8 *s_cpos(u8 *s, u8 c, u8 eol){
+ while(*s != eol){
+ if (*s == c) return s;
+ s++;
+ }
+ return NULL;
+}
+
+u32 s_parse_dec(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
+ return n;
+}
+u32 s_parse_hex(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
+ n = (n << 4) + s_h2b4( *s++ );
+ return n;
+}
+
+u8 s_is_7bit(u8 *s, u8 eol){
+ while (*s != eol) if (*s++ > 0x7F) return 0;
+ return 1;
+}
+
+u8 *s_copy(u8 *in, u8 eol, u8 *out){
+ if (in == out) return out;
+ while (*in != eol) *out++ = *in++;
+ *out = eol;
+ return out;
+}
+
+u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
+u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
+u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
+u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
+u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
+u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
+u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
+
+#if 0
+u8 *s_append_u32(u8 *out, u32 n) {
+ if (n){
+ n = bin2bcd_u32(n, 4); u8 digs = 8;
+ while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
+ while(digs--){
+ *out++ = s_b2h4(n >> 28);
+ n <<= 4;
+ }
+ } else *out++ = '0';
+ *out = 0;
+ return out;
+}
+
+
+u8 *s_append_s32(u8 *out, s32 n) {
+ if (n < 0){
+ out = s_append_c(out, '-');
+ n = -n;
+ }
+ return s_append_u32(out, n);
+}
+#endif
+
+void *memset2(void *dest, int val, size_t len) {
+ u8 *dest1 = (u8*) dest;
+ while (len--) *dest1++ = (u8)val;
+ return dest;
+}
+
+void *memcpy2(void *dest, const void *src, size_t len) {
+ u8 *dest1 = (u8 *) dest;
+ u8 *src1 = (u8 *)src;
+ while (len--) *dest1++ = *src1++;
+ return dest;
+}
+
+u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n) {
+ u32 quot = n >> 1;
+ quot += quot >> 1;
+ quot += quot >> 4;
+ quot += quot >> 8;
+ quot += quot >> 16;
+ u32 qq = quot & ~7ul;
+ quot >>= 3;
+ divmod10_u32_rem = n - ((quot << 1) + qq);
+ if (divmod10_u32_rem > 9) {
+ divmod10_u32_rem -= 10;
+ quot++;
+ }
+ return quot;
+}
+
+u8 asc_point = '.';
+u8 asc_space = ' ';
+u8 asc_minus = '-';
+
+u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
+
+u8 bin2bcd_u8( u8 bin ) {
+ u8 tens = 0;
+ while (bin > 9) { bin -= 10; tens++; }
+ return ( (tens << 4) + bin );
+}
+
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
+
+ "bin2bcd_u32_00: \n" // correct input number by left shifts
+ "mov r31, %A[data] \n"
+ "mov %A[data], %B[data] \n"
+ "mov %B[data], %C[data] \n"
+ "mov %C[data], %D[data] \n"
+ "mov %D[data], r31 \n"
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_00 \n"
+
+ "eor r26, r26 \n" // result=0
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %[result_bytes] \n"
+ "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bin2bcd_u32_01: \n" // bits shift and correction loop
+ "subi r26,-0x33 \n" // add 0x33
+ "sbrs r26, 3 \n" // if carry to bit 3,
+ "subi r26, 3 \n" // subtract 3
+ "sbrs r26, 7 \n" // if carry to bit 7,
+ "subi r26, 0x30 \n" // subtract 0x30
+ "subi r27,-0x33 \n" // add 0x33
+ "sbrs r27, 3 \n" // if carry to bit 3,
+ "subi r27, 3 \n" // subtract 3
+ "sbrs r27, 7 \n" // if carry to bit 7,
+ "subi r27, 0x30 \n" // subtract 0x30
+ "subi r30,-0x33 \n" // add 0x33
+ "sbrs r30, 3 \n" // if carry to bit 3,
+ "subi r30, 3 \n" // subtract 3
+ "sbrs r30, 7 \n" // if carry to bit 7,
+ "subi r30, 0x30 \n" // subtract 0x30
+ "subi r31,-0x33 \n" // add 0x33
+ "sbrs r31, 3 \n" // if carry to bit 3,
+ "subi r31, 3 \n" // subtract 3
+ "sbrs r31, 7 \n" // if carry to bit 7,
+ "subi r31, 0x30 \n" // subtract 0x30
+ "lsl r26 \n" // shift result number
+ "rol r27 \n"
+ "rol r30 \n"
+ "rol r31 \n"
+
+ "sbrc %D[data], 7 \n" // skip if msbit of input == 0
+ "ori r26, 1 \n" // set lsb of output
+ "lsl %A[data] \n" // shift input number
+ "rol %B[data] \n"
+ "rol %C[data] \n"
+ "rol %D[data] \n"
+
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_01 \n" // repeat for all bits
+
+ //"mov %A[result], r26 \n" // move to result
+ //"mov %B[result], r27 \n"
+ //"mov %C[result], r30 \n"
+ //"mov %D[result], r31 \n"
+
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result) // output
+ :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
+ :"r26","r27","r30","r31" // clobbers
+ );
+ return result;
+}
+#endif
+
+u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
+ data <<= 8;
+ for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
+ /*result BCD nibbles correction*/
+ result += 0x33333333;
+ /*result correction loop*/
+ for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
+ u8 corr_byte = result >> 24;
+ if (!(corr_byte & 0x08)) corr_byte -= 0x03;
+ if (!(corr_byte & 0x80)) corr_byte -= 0x30;
+ result <<= 8; /*shift result*/
+ result += corr_byte; /*set 8 bits of result*/
+ }
+ /*shift next bit of input to result*/
+ result <<= 1;
+ if (((u8)(data >> 24)) & 0x80)
+ result |= 1;
+ data <<= 1;
+ }
+ return(result);
+}
+
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
+ u32 result = 0;
+ result_bytes = 0;
+ while (data > 0) {
+ result += (data % 10) << result_bytes;
+ data /= 10;
+ result_bytes += 4;
+ }
+ return result;
+}
+
+u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
+ static ldiv_t bin2bcd_ldiv_result;
+ bin2bcd_ldiv_result.quot = value;
+ u32 result = 0;
+ nbytes = 0;
+ while (bin2bcd_ldiv_result.quot > 0) {
+ bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
+ result += bin2bcd_ldiv_result.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+struct divmod10_t {
+ uint32_t quot;
+ uint8_t rem;
+} divmodu10_res;
+inline static void divmodu10(u32 n) {
+ divmodu10_res.quot = n >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 4;
+ divmodu10_res.quot += divmodu10_res.quot >> 8;
+ divmodu10_res.quot += divmodu10_res.quot >> 16;
+ u32 qq = divmodu10_res.quot & ~7ul;
+ divmodu10_res.quot >>= 3;
+ divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
+ if (divmodu10_res.rem > 9) {
+ divmodu10_res.rem -= 10;
+ divmodu10_res.quot++;
+ }
+}
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
+ u32 result = 0; nbytes = 0;
+ divmodu10_res.quot = value;
+ while (divmodu10_res.quot != 0) {
+ divmodu10(divmodu10_res.quot);
+ result += divmodu10_res.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+#ifdef __AVR__
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "eor r26, r26 \n" /* result = 0 */
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bcd2bin_u32_00: \n" /* bits shift and correction loop */
+ "lsr r31 \n" /* shift out buffer */
+ "ror r30 \n"
+ "ror r27 \n"
+ "ror r26 \n"
+
+ "sbrc %A[data], 0 \n" /* move lowest bit to result */
+ "ori r31, 0x80 \n"
+
+ "lsr %D[data] \n"
+ "ror %C[data] \n"
+ "ror %B[data] \n"
+ "ror %A[data] \n"
+
+ "sbrc %D[data], 7 \n" /* if carry to bit 7, */
+ "subi %D[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %D[data], 3 \n" /* if carry to bit 3, */
+ "subi %D[data], 3 \n" /* subtract 3 */
+ "sbrc %C[data], 7 \n" /* if carry to bit 7, */
+
+ "subi %C[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %C[data], 3 \n" /* if carry to bit 3, */
+ "subi %C[data], 3 \n" /* subtract 0x30 */
+ "sbrc %B[data], 7 \n" /* if carry to bit 7, */
+ "subi %B[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %B[data], 3 \n" /* if carry to bit 3, */
+ "subi %B[data], 3 \n" /* subtract 3 */
+ "sbrc %A[data], 7 \n" /* if carry to bit 7, */
+ "subi %A[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %A[data], 3 \n" /* if carry to bit 3, */
+ "subi %A[data], 3 \n" /* subtract 3 */
+
+ "dec __tmp_reg__ \n" /* repeat for all bits */
+ "brne bcd2bin_u32_00 \n"
+
+ // "movw %A[result], r26 \n" /* adjust result */
+ // "movw %C[result], r30 \n"
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "bcd2bin_u32_01: \n"
+ "mov __tmp_reg__,r25 \n"
+ "mov r25,r24 \n"
+ "mov r24,r23 \n"
+ "mov r23,r22 \n"
+ "mov r22,__tmp_reg__ \n"
+ "dec %[result_bytes] \n"
+ "brne bcd2bin_u32_01 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
+ );
+ return result;
+}
+#endif
+
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
+ /*shift next bit*/
+ result >>= 1;
+ if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
+ data >>= 1;
+ /* result BCD correction */
+ for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
+ u8 tmp_byte = (data >> 24);
+ if (tmp_byte & 0x80) tmp_byte -= 0x30;
+ if (tmp_byte & 0x08) tmp_byte -= 0x03;
+ data <<= 8;
+ data |= tmp_byte;
+ }
+ }
+ /*adjust result bytes*/
+ for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
+ result >>= 8;
+ return(result);
+}
+
+u8 asc2bin_u8(u8 data) {
+ if ((data >= '0') && (data <= '9')) data -= '0';
+ else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
+ else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
+ else data = 0xf0;
+ return(data);
+}
+
+u8 bin2asc_u8(u8 data) {
+ data &= 0xf;
+ return (data > 9) ? (data + 'A' - 10) : (data + '0');
+}
+
+u32 asc2bin_u32(u8 *buf, s8 size) {
+ u32 result;
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ result = 0;
+ while(size) {
+ u8 tmp_u8 = asc2bin_u8(*buf);
+ if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
+ result <<= 4;
+ result |= tmp_u8;
+ }
+ size--;
+ if (flag_negative) buf--;
+ else buf++; /*go to next symbol*/
+ }
+ return(result);
+}
+
+void bin2asc_u32(u32 data, u8 *buf, s8 size) {
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ while (size) {
+ *buf = bin2asc_u8(data);
+ data >>= 4;
+ if (flag_negative) buf--;
+ else buf++;
+ size--;
+ if (data == 0) size = 0; /*stop conversion on zero*/
+ }
+}
+
+void num2asc_s32(s32 data, u8 *buf, u8 flags) {
+ u8 cnt_chars = (flags & 7); //number of digits
+ //convert negative to positive, set '-' flag
+ if (data < 0) {data = -data; flags |= 1;}
+ else flags &= ~1;
+ //if necessary, convert to BCD
+ //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
+ cnt_chars++;
+ //calculate point position
+ u8 point_pos = cnt_chars - ((flags >> 4) & 7);
+ if (point_pos) point_pos++;
+ flags |= 2;
+ while (cnt_chars) { //digits conversion loop
+ if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
+ if (flags & 1) *buf = asc_minus;
+ else if (flags & 2) *buf = '0';
+ else *buf = asc_space;
+ flags &= ~1;
+ } else {
+ //show point
+ if ((cnt_chars == point_pos) && (flags & 0x70)) {
+ *buf-- = asc_point;
+ cnt_chars--;
+ }
+ *buf = bin2asc_u8(data); //show ASCII digit
+ }
+ cnt_chars--;
+ buf--;
+ data >>= 4;
+ flags &= ~2;
+ }
+ if (flags & 1) *buf = asc_minus;
+}
+
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
+{
+ uint8_t len_msg = 0;
+ uint8_t i = 0;
+ uint8_t check = 160;
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x00)
+ Str[j] = '@';
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x11)
+ Str[j] = '_';
+
+ while((i < len) && (check--))
+ {
+ if(*Str == 0x1B)
+ {
+ // |
+ if(*(uint16_t*)Str == 0x401B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '|';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // "\"
+ if(*(uint16_t*)Str == 0x2F1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '\\';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ^
+ if(*(uint16_t*)Str == 0x141B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '^';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // [
+ if(*(uint16_t*)Str == 0x3C1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '[';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ]
+ if(*(uint16_t*)Str == 0x3E1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = ']';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // {
+ if(*(uint16_t*)Str == 0x281B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '{';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // }
+ if(*(uint16_t*)Str == 0x291B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '}';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ~
+ if(*(uint16_t*)Str == 0x3D1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '~';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // euro
+ if(*(uint16_t*)Str == 0x651B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '?';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+ }
+ else
+ {
+ i++;
+ len_msg++;
+ Str++;
+ }
+ }
+
+ return len_msg;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_7to8(uint8_t *a, uint8_t len)
+{
+ //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
+ //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
+ //'Hello!' -> C8 32 9B FD 0E 01
+ if (len == 0)
+ len = s_len(a,0);
+
+ a[len] = 0;
+ len++;
+
+ // Correct symbol @
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '@')
+ a[j] = 0x00;
+
+ // Correct symbol _
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '_')
+ a[j] = 0x11;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len-2); i1++)
+ {
+ for (uint8_t i2=(len-1); i2>i1; i2--)
+ {
+ a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
+ a[i2] >>= 1;
+ }
+ }
+ }
+
+ len--;
+
+ return len - (len >> 3);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_8to7(uint8_t *a, uint8_t len)
+{
+ uint8_t len1 = len + (len >> 3);
+
+ while (len < len1)
+ a[len++] = 0;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len1-1); i1++)
+ for (uint8_t i2=(len1-1); i2>i1; i2--)
+ a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
+ }
+
+ for (uint8_t i=0; i= n) ? (in_len - n) : 0;
+// }
+// }
+// return out_len;
+//}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t swap8 (uint8_t b)
+{
+ return (b << 4)|(b >> 4);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t swap16(uint16_t w)
+{
+ return (w << 8)|(w >> 8);
+}
+#include
+#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
+{
+ if (len == 0)
+ return;
+
+ len >>= 1;
+
+ while (len--)
+ {
+ *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
+ h += 2;
+ }
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
+{
+ if (len == 0)
+ return;
+
+ b += len-1; h += ((uint16_t)len << 1) - 1;
+ while (len--)
+ {
+ *h-- = s_b2h4(*b & 0xF);
+ *h-- = s_b2h4(*b-- >> 4);
+ }
+}
+
+
+uint8_t convert_binary_coded_to_decimal(uint8_t hex)
+{
+ uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
+ return dec;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+/*DCS decoding function*/
+dcs_struct pdu_decode_dcs(uint8_t tp_dcs)
+{
+ dcs_struct sm_dcs;
+ uint8_t alpha_byte, class_byte;
+
+ if ( ( (tp_dcs & 0xc0) == 0)) /* coding group: 00xx */
+ {
+ if ( tp_dcs & 0x20 )
+ sm_dcs.smCompressed = 1; /* compressed */
+ else
+ sm_dcs.smCompressed = 0;
+
+
+ alpha_byte = ( tp_dcs & 0x0c ) >> 2; /* alphabet */
+ if ( alpha_byte == 0 )
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ else if ( alpha_byte == 1 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else if ( alpha_byte == 2 )
+ sm_dcs.smAlphabet = PDU_DCS_UCS2;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_AUTO;
+
+ if ( tp_dcs & 0x10 ) /* bit 1 and 0 have class meaning */
+ {
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ }
+ else
+ sm_dcs.smClass = noClass;
+
+ } else if ( (tp_dcs >> 4) == 0x0f ){ /* coding group: 1111 */
+ sm_dcs.smCompressed = 0;
+
+ if ( tp_dcs & 0x04 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_7;
+
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ } else {/* reserved codings groups: assume 7 bit, uncompressed, class 2 */
+
+ sm_dcs.smCompressed = 0;
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ sm_dcs.smClass = class2;
+ }
+ return sm_dcs;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ int8_t tz_sign = 1;
+ dcs_struct sm_dcs; /*Added dcs decoding in alphabet, class and compressed*/
+
+ if (len == 0)
+ len = s_len(in, 0);
+
+ len >>= 1;
+
+ out->smsc.len = in[0];
+ out->smsc.bytes = out->smsc.len - 1;
+
+ if (in[0] == 7)
+ {
+ out->smsc.type = in[1];
+ for (uint8_t i=0; i<(out->smsc.bytes); i++)
+ out->smsc.data[i] = in[i+2];
+ }
+
+ in += out->smsc.len + 1;
+
+ out->first = *in++;
+ out->sender.len = *in++;
+ out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
+ out->sender.type = *in++;
+ for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
+ out->sender.data[i] = *in++;
+
+ out->tp_pid = *in++;
+ out->tp_dcs = *in++;
+
+ out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
+ //*in = 0x4a;
+ out->tz = swap8( *in++ );
+
+ if ((out->tz & 0x80) == 0x80)
+ {
+ tz_sign = -1;
+ }
+
+ out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
+
+ out->msg.len = out->msg.bytes = *in++;
+
+ // correction for 7-bit encoding
+
+ /*Now dcs has been correctly decoded*/
+ sm_dcs = pdu_decode_dcs(out->tp_dcs);
+ out->tp_dcs = sm_dcs.smAlphabet;
+ /**/
+ if (out->tp_dcs == PDU_DCS_7)
+ out->msg.bytes -= (out->msg.bytes >> 3);
+ // decode message text (if output buffer is given)
+ out->msg.data = in;
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ pdu_hex2bytes(in, len, in);
+ pdu_in_decode_binary(in, len, out);
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+#if 1
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+ if (pdu_get_output_format() == UTF8_default) {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ } else if(pdu_get_output_format() == HEX_raw) {
+ uint16_t i, j;
+ uint8_t tmpByte;
+
+ j = 0;
+
+ for ( i = 0; i < in_bytes; i++ )
+ {
+
+ tmpByte = ( in[i] & 0x00FF );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0xF0 ) >> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+
+ }
+
+ in_bytes = j;
+ out += in_bytes;
+ }
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ for (uint8_t i=0; i> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+ }
+ //out[j] = '\0';
+ in_bytes = j;
+ out += in_bytes;
+ } else {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ }
+ }
+ }
+
+ *out = 0;
+
+ return in_bytes;
+}
+
+
+#else //original
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ }
+
+ for (uint8_t i=0; ismsc.len;
+ // fill SMSC data
+ if (in->smsc.len)
+ {
+ *out++ = in->smsc.type;
+ for (uint8_t i=0; i<(in->smsc.len-1); i++)
+ *out++ = in->smsc.data[i];
+ len = in->smsc.len;
+ }
+
+ *out++ = in->first; // 1st octet (0x11)
+ *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+
+ in->sender.bytes = pdu_phone_bytes(in->sender.data);
+ in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
+ *out++ = in->sender.len; // address length, digits
+ *out++ = in->sender.type; // type-of-address
+ for (uint8_t i=0; isender.bytes; i++)
+ *out++ = in->sender.data[i];
+
+ *out++ = in->tp_pid; // TP-PID. Protocol identifier
+
+ if (in->tp_dcs == PDU_DCS_AUTO)
+ in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
+
+ *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
+
+ *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
+ len += in->sender.bytes + 8;
+
+ // add message
+ in->msg.len = s_len(in->msg.data,0);
+
+ if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
+ {
+ in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
+ *out++ = in->msg.len;
+ }
+ else
+ {
+ *out++ = in->msg.len;
+ s_copy(in->msg.data, 0, out);
+ if (in->tp_dcs == PDU_DCS_7)
+ in->msg.bytes = pdu_7to8(out, in->msg.len);
+ else
+ in->msg.bytes = in->msg.len;
+ }
+
+ out -= len;
+ len += in->msg.bytes;
+ pdu_bytes2hex(out, len, out);
+ in->len_bytes = len << 1;
+ in->len_cmgs = len - in->smsc.len - 1;
+ out[in->len_bytes] = 0;
+
+ return in->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
+{
+ pdu->first = 0x11;
+ pdu->tp_msg_ref = 0;
+ pdu->tp_pid = 0;
+ pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
+
+ pdu->smsc.len = 0;
+
+ pdu->sender.type = PDU_TYPE_INTERNATIONAL;
+
+
+ if (pdu_phone_is_packed((uint8_t *)sender)) {
+ pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
+ }
+ else{
+ pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
+ }
+
+
+ //pdu->tp_dcs = PDU_DCS_AUTO;
+ //pdu->tp_dcs = PDU_DCS_8;
+ pdu->tp_dcs = dcs;
+ pdu->msg.data = (uint8_t *)msg;
+
+ pdu_out_encode(pdu, out);
+
+ return pdu->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
+{
+ uint8_t n = 0;
+
+ if (*in == '+')
+ in++;
+
+ while ((*in >= '0')&&(*in <= '9'))
+ {
+ *out = s_h2b4(*in++);
+ if (*in)
+ {
+ *out |= s_h2b4(*in) << 4;
+ in++;
+ n++;
+ }
+ else
+ *out |= 0xF0;
+
+ n++;
+ out++;
+ }
+
+ *out = 0xFF;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
+{
+ uint8_t n = 0;
+
+ if (type == PDU_TYPE_INTERNATIONAL)
+ *out++ = '+';
+
+ while (len--)
+ {
+ *out++ = s_b2h4(*in & 0xF);
+ n++;
+
+ if ((*in & 0xF0) != 0xF0)
+ {
+ *out++ = s_b2h4(*in >> 4);
+ n++;
+ }
+
+ in++;
+ }
+
+ *out = 0;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_is_packed(uint8_t *phone)
+{
+ return *phone != '+';
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits_bytes(uint8_t digits)
+{
+ return (digits + (digits & 1)) >> 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_bytes(uint8_t *in)
+{
+ uint8_t len = 0;
+
+ while (*in++ != 0xFF)
+ len++;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
+{
+ uint8_t len = bytes << 1;
+
+ if ((in[bytes-1] & 0xF0) == 0xF0)
+ len--;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
+{
+ if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
+ return 0;
+
+ while (in1_bytes--) if (*in1++ != *in2++)
+ return 0;
+
+ return 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_phone_copy(uint8_t *in, uint8_t *out)
+{
+ if (in == out)
+ return;
+
+ uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
+
+ while (*in != eop)
+ *out++ = *in++;
+
+ *out = eop;
+}
+
+//Functions to convert SMS text in raw hex output (as specified by 3GPP TS 27.005)
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format)
+{
+ out_fmt = output_format;
+}
+
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void)
+{
+ return out_fmt;
+}
+
+static const uint8_t ha_form[] =
+{
+ '0',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F'
+};
+
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb)
+{
+ /* convert it into ASCII code */
+ return (ha_form[(LV_nmb & 0x0F)]);
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h
new file mode 100755
index 00000000..33438ac2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduCommon.h
@@ -0,0 +1,369 @@
+/*
+ * azx_common.h
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#ifndef AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+#define AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+
+#include
+#include
+
+#ifndef offsetof
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+#endif
+#ifndef countof
+#define countof(arg) (sizeof(arg) / sizeof(arg[0]))
+#endif
+
+//attributes
+#define WEAK __attribute__ ((weak))
+#define NAKED __attribute__ ((naked))
+#define INTERRUPT __attribute__ ((__interrupt__))
+#define USED __attribute__ ((used))
+#define NORETURN __attribute__ ((noreturn))
+#define SECTION(s) __attribute__ ((section(s)))
+#define NOINIT SECTION(".noinit")
+#define ALIAS(a) __attribute__ ((weak, alias (a)))
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define OPTIMIZE(level) __attribute__ ((optimize(level)))
+
+//architecture-specific inlines
+#ifdef __AVR
+#define wdr() asm volatile("wdr")
+#define nop() asm volatile("nop")
+#define sleep() asm volatile("sleep")
+#else
+#define PROGMEM
+#endif
+
+#ifdef __i8051
+#define cli() EI = 0
+#define sei() EI = 1
+#endif
+
+#ifdef __STM8
+#define cli() _asm("sim")
+#define sei() _asm("rim")
+#define nop() _asm("nop")
+#define wdr() { IWDG_KR = 0xAA; }
+#endif
+
+#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
+#define cli() asm volatile ( "CPSID i \n" )
+#define sei() asm volatile ( "CPSIE i \n" )
+#endif
+
+//short named types
+typedef uint8_t u8;
+typedef int8_t s8;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+typedef int64_t s64;
+typedef float f32;
+typedef double f64;
+#ifdef __float128
+typedef __float128 f128;
+#endif
+
+//bit mask
+#define B(_b) (1 << (_b))
+#define BIT(_b) (1 << (_b))
+
+//Increment/decrement, Add/Subtract with range rollover/limit
+#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
+#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
+#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
+#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
+#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
+#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
+#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
+#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
+#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
+#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
+#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
+#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+#ifdef __ARM_ARCH_7M__
+//ARM Cortex BitBand access macros
+#define BITBAND_SRAM_REF 0x20000000
+#define BITBAND_SRAM_BASE 0x22000000
+// Convert SRAM address
+#define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
+#define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
+
+#define BITBAND_PERI_REF 0x40000000
+#define BITBAND_PERI_BASE 0x42000000
+// Convert PERIPHERAL address
+#define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
+#define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
+#endif
+
+//memset - simple verion
+void *memset2(void *dest, int val, size_t len);
+//memcpy - simple verion
+void *memcpy2(void *dest, const void *src, size_t len);
+
+extern u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n);
+
+
+// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
+// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
+
+// convert UCS2 codepoint to UTF8, returns number of bytes processed
+u8 ucs2_to_utf8(u32 in, u8 *out);
+// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
+
+
+// find length of line, terminated by eol char
+u16 s_len(u8 *s, u8 eol);
+
+// number of lines, separated by eol char
+u8 s_lines(u8 *s, u16 len, u8 eol);
+
+u8 c_upcase(u8 c);
+// uppercase string, in-place
+void s_upcase(u8 *s, u16 len);
+
+u8 s_h2b4(u8 hex);
+u8 s_b2h4(u8 b);
+
+// find start of line, delimited by eol char
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
+
+// skip CR/LF chars
+u8 *s_skip_crlf(u8 *s);
+
+// compare 2 strings, returns 1 if equal
+u8 s_cmp(u8 *s1, u8 *s2, u16 len);
+// compare 2 strings, upper-casing each char, returns 1 if equal
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
+
+// check if s starts with start
+u8 s_starts(u8 *s, char *start);
+// check if s ends with end
+u8 s_ends(u8 *s, char *end);
+
+// finds 1st occurence of char c, returns NULL if not found
+u8 *s_cpos(u8 *s, u8 c, u8 eol);
+
+// check if string is 7-bit
+u8 s_is_7bit(u8 *s, u8 eol);
+
+// copy in string (terminated by eol char) to out
+u8 *s_copy(u8 *in, u8 eol, u8 *out);
+
+
+// append string out to in, returns pointer after last char
+u8 *s_append_s (u8 *out, char *in);
+// append char to string buffer
+u8 *s_append_c (u8 *out, u8 c);
+// append Hex char to string buffer
+u8 *s_append_h4 (u8 *out, u8 n);
+// append Hex byte to string buffer
+u8 *s_append_h8 (u8 *out, u8 n);
+// append 16-bit Hex to string buffer
+u8 *s_append_h16(u8 *out, u16 n);
+// append 24-bit Hex to string buffer
+u8 *s_append_h24(u8 *out, u32 n);
+// append 32-bit Hex to string buffer
+u8 *s_append_h32(u8 *out, u32 n);
+
+
+// parse decimal number
+u32 s_parse_dec(u8 *s, u8 len);
+// parse hex number
+u32 s_parse_hex(u8 *s, u8 len);
+
+extern u8 asc_point;
+extern u8 asc_space;
+extern u8 asc_minus;
+
+/** convert lower nibble to HEX symbol */
+#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
+
+/** 8-bit BCD->BIN conversion */
+u8 bcd2bin_u8( u8 bcd );
+/** 8-bit BIN->BCD conversion */
+u8 bin2bcd_u8( u8 bin );
+
+// 32-bit BIN->BCD conversion using shifts and correction
+//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
+
+// 32-bit BIN->BCD conversion using hardware divider
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using ldiv
+u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using fast soft div
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
+
+// 32-bit BCD->BIN conversion
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
+
+u8 asc2bin_u8(u8 data);
+u8 bin2asc_u8(u8 data);
+u32 asc2bin_u32(u8 *buf, s8 size);
+void bin2asc_u32(u32 data, u8 *buf, s8 size);
+
+// AVR-optimized conversions
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
+u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
+#endif
+
+/** convert 32-bit signed data to ASCII number to buffer (right to left)
+ * options & 7 - width-1,
+ * (options >> 4) & 7 - point position,
+ * options & 0x08 - supress leading zeros,
+ * options & 0x80 - convert to BCD.
+ */
+#define NUM2ASC_BCD (u8)0x80
+#define NUM2ASC_NOZEROS (u8)0x08
+#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
+#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
+#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
+void num2asc_s32(s32 data, u8 *buf, u8 flags);
+inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
+
+// calculate number width
+
+inline u8 width_i32(s32 n){
+ u8 s = 0;
+ if (n < 0){ s = 1; n = -n; }
+ return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
+ ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
+}
+
+#define SMS_PDU_MAX_SIZE 400
+
+// data coding scheme
+enum
+{
+ PDU_DCS_7 = 0,
+ PDU_DCS_8 = 0x4,
+ PDU_DCS_UCS2 = 0x08,
+ PDU_DCS_AUTO = 0xFF
+};
+
+//SMS classes
+enum
+{
+ class0 = 0,
+ class1,
+ class2,
+ class3,
+ noClass = 0xFF
+};
+
+//Output format
+typedef enum
+{
+
+ HEX_raw = 0,
+ UTF8_default
+}SMS_TXT_OUT_FMT_E;
+
+// number format
+enum
+{
+ PDU_TYPE_NATIONAL = 0xA1,
+ PDU_TYPE_INTERNATIONAL = 0x91,
+ PDU_TYPE_ALPHADET = 0xD0,
+ PDU_TYPE_NETWORK = 0xB1
+};
+
+typedef struct
+{
+ // SMSC number
+ struct{ uint8_t len, bytes, type, data[14]; }smsc;
+ // caller/sender number
+ struct{ uint8_t len, bytes, type, data[14]; }sender;
+ // input/output zero-terminated message (7bit/8bit/UTF8)
+ struct{ uint16_t len, bytes; uint8_t *data; }msg;
+
+ uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
+ uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+ uint8_t tp_pid; // Protocol identifier (0)
+ uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
+ uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
+
+ // incoming SMS timestamp
+ uint8_t year, month, date; // date
+ uint8_t hour, min, sec; // time
+ int8_t tz; // zone
+
+ // PDU length in bytes and for CMGS command
+ uint16_t len_bytes, len_cmgs;
+}pdu_struct;
+
+typedef struct
+{
+
+ uint8_t smCompressed;
+ uint8_t smAlphabet;
+ uint8_t smClass;
+
+}dcs_struct;
+
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format);
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void);
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb);
+
+// Change GSM 7-bit table to ANSI
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
+// pack 7-bit array to 8-bit
+uint8_t pdu_7to8(uint8_t *a, uint8_t len);
+// unpack 8-bit array to 7-bit
+uint8_t pdu_8to7(uint8_t *a, uint8_t len);
+
+// convert HEX line to bytes, len - length of input buffer
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
+// convert bytes to HEX line, len - length of input buffer
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
+
+// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
+
+// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
+// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
+
+// encode outcoming PDU
+uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
+// encode outcoming PDU, simple interface
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
+
+// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
+// unpack phone number to string, returns number of unpacked digits
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
+// check if phone is packed
+uint8_t pdu_phone_is_packed(uint8_t *phone);
+
+// get number of bytes from number of digits
+uint8_t pdu_phone_digits_bytes(uint8_t digits);
+// get number of bytes of packed phone
+uint8_t pdu_phone_bytes(uint8_t *in);
+// count number of digits
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
+
+// compare 2 packed phones
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
+// copy packed phone
+void pdu_phone_copy(uint8_t *in, uint8_t *out);
+
+#endif /* AZX_PDU_CODEC_AZX_PDUCOMMON_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
index fcc37bb3..42ad15d1 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.c
@@ -28,7 +28,7 @@
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduDec.h"
/* Local defines ================================================================================*/
@@ -87,9 +87,10 @@ INT32 azx_pdu_decode(UINT8 *pdu, UINT32 pdu_len, pdu_struct *packet, CHAR *numbe
//fill result buffer
+ /*Now dcs has been correctly decoded, including 8 bit case*/
pdu_in_decode_text(packet->msg.data,
packet->msg.len,
- (packet->tp_dcs == 0x00 ? PDU_DCS_7:PDU_DCS_UCS2),
+ (packet->tp_dcs),
(UINT8*)msg);
len_msg = packet->msg.len;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
index d0042998..3e6fb59d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduDec.h
@@ -29,7 +29,7 @@
/** \defgroup pduDecUsage Usage of pdu decoding functionalities
* Functions usable to retrieve ASCII message and other info from a PDU message in binary format
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
index 525a6654..68617866 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.c
@@ -26,7 +26,8 @@
#include
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
index efe858ff..42a85ef4 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/azx_pduEnc.h
@@ -30,7 +30,7 @@
/** \defgroup pduEncUsage Usage of pdu encoding functionalities
* Functions usable to create a PDU message from a string text
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
/**
@brief
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/readme b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/readme
old mode 100644
new mode 100755
index be00a200..98184a07
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/readme
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/readme
@@ -1,3 +1,3 @@
@brief Utility code to simplify parse/encode binary PDU to be used with `m2mb_sms_*` APIs
-@version 1.0.0
+@version 1.0.3
@dependencies
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c
deleted file mode 100755
index 7f4c0530..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * gsm_pdu.c
- *
- * Created on: Sep 15, 2014
- * Author: qwer
- */
-#include
-#include
-#include "ul_gsm_pdu.h"
-#include "ul_s.h"
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
-{
- uint8_t len_msg = 0;
- uint8_t i = 0;
- uint8_t check = 160;
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x00)
- Str[j] = '@';
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x11)
- Str[j] = '_';
-
- while((i < len) && (check--))
- {
- if(*Str == 0x1B)
- {
- // |
- if(*(uint16_t*)Str == 0x401B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '|';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // "\"
- if(*(uint16_t*)Str == 0x2F1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '\\';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ^
- if(*(uint16_t*)Str == 0x141B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '^';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // [
- if(*(uint16_t*)Str == 0x3C1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '[';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ]
- if(*(uint16_t*)Str == 0x3E1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = ']';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // {
- if(*(uint16_t*)Str == 0x281B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '{';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // }
- if(*(uint16_t*)Str == 0x291B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '}';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ~
- if(*(uint16_t*)Str == 0x3D1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '~';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // euro
- if(*(uint16_t*)Str == 0x651B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '?';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
- }
- else
- {
- i++;
- len_msg++;
- Str++;
- }
- }
-
- return len_msg;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_7to8(uint8_t *a, uint8_t len)
-{
- //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
- //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
- //'Hello!' -> C8 32 9B FD 0E 01
- if (len == 0)
- len = s_len(a,0);
-
- a[len] = 0;
- len++;
-
- // Correct symbol @
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '@')
- a[j] = 0x00;
-
- // Correct symbol _
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '_')
- a[j] = 0x11;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len-2); i1++)
- {
- for (uint8_t i2=(len-1); i2>i1; i2--)
- {
- a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
- a[i2] >>= 1;
- }
- }
- }
-
- len--;
-
- return len - (len >> 3);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_8to7(uint8_t *a, uint8_t len)
-{
- uint8_t len1 = len + (len >> 3);
-
- while (len < len1)
- a[len++] = 0;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len1-1); i1++)
- for (uint8_t i2=(len1-1); i2>i1; i2--)
- a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
- }
-
- for (uint8_t i=0; i= n) ? (in_len - n) : 0;
-// }
-// }
-// return out_len;
-//}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t swap8 (uint8_t b)
-{
- return (b << 4)|(b >> 4);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t swap16(uint16_t w)
-{
- return (w << 8)|(w >> 8);
-}
-#include
-#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
-{
- if (len == 0)
- return;
-
- len >>= 1;
-
- while (len--)
- {
- *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
- h += 2;
- }
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
-{
- if (len == 0)
- return;
-
- b += len-1; h += ((uint16_t)len << 1) - 1;
- while (len--)
- {
- *h-- = s_b2h4(*b & 0xF);
- *h-- = s_b2h4(*b-- >> 4);
- }
-}
-
-
-uint8_t convert_binary_coded_to_decimal(uint8_t hex)
-{
- uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
- return dec;
-}
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- int8_t tz_sign = 1;
- if (len == 0)
- len = s_len(in, 0);
-
- len >>= 1;
-
- out->smsc.len = in[0];
- out->smsc.bytes = out->smsc.len - 1;
-
- if (in[0] == 7)
- {
- out->smsc.type = in[1];
- for (uint8_t i=0; i<(out->smsc.bytes); i++)
- out->smsc.data[i] = in[i+2];
- }
-
- in += out->smsc.len + 1;
-
- out->first = *in++;
- out->sender.len = *in++;
- out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
- out->sender.type = *in++;
- for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
- out->sender.data[i] = *in++;
-
- out->tp_pid = *in++;
- out->tp_dcs = *in++;
-
- out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
- //*in = 0x4a;
- out->tz = swap8( *in++ );
-
- if ((out->tz & 0x80) == 0x80)
- {
- tz_sign = -1;
- }
-
- out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
-
- out->msg.len = out->msg.bytes = *in++;
-
- // correction for 7-bit encoding
- if (out->tp_dcs == PDU_DCS_7)
- out->msg.bytes -= (out->msg.bytes >> 3);
-
- // decode message text (if output buffer is given)
- out->msg.data = in;
-}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- pdu_hex2bytes(in, len, in);
- pdu_in_decode_binary(in, len, out);
-}
-
-
-
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
-{
- if (in_dcs == PDU_DCS_UCS2)
- {
- in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
- out += in_bytes;
- }
- else
- {
- if (in_dcs == PDU_DCS_7)
- {
- in_bytes += in_bytes >> 3;
- pdu_8to7(in, in_bytes);
- }
-
- for (uint8_t i=0; ismsc.len;
- // fill SMSC data
- if (in->smsc.len)
- {
- *out++ = in->smsc.type;
- for (uint8_t i=0; i<(in->smsc.len-1); i++)
- *out++ = in->smsc.data[i];
- len = in->smsc.len;
- }
-
- *out++ = in->first; // 1st octet (0x11)
- *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
-
- in->sender.bytes = pdu_phone_bytes(in->sender.data);
- in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
- *out++ = in->sender.len; // address length, digits
- *out++ = in->sender.type; // type-of-address
- for (uint8_t i=0; isender.bytes; i++)
- *out++ = in->sender.data[i];
-
- *out++ = in->tp_pid; // TP-PID. Protocol identifier
-
- if (in->tp_dcs == PDU_DCS_AUTO)
- in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
-
- *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
-
- *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
- len += in->sender.bytes + 8;
-
- // add message
- in->msg.len = s_len(in->msg.data,0);
-
- if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
- {
- in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
- *out++ = in->msg.len;
- }
- else
- {
- *out++ = in->msg.len;
- s_copy(in->msg.data, 0, out);
- if (in->tp_dcs == PDU_DCS_7)
- in->msg.bytes = pdu_7to8(out, in->msg.len);
- else
- in->msg.bytes = in->msg.len;
- }
-
- out -= len;
- len += in->msg.bytes;
- pdu_bytes2hex(out, len, out);
- in->len_bytes = len << 1;
- in->len_cmgs = len - in->smsc.len - 1;
- out[in->len_bytes] = 0;
-
- return in->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
-{
- pdu->first = 0x11;
- pdu->tp_msg_ref = 0;
- pdu->tp_pid = 0;
- pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
-
- pdu->smsc.len = 0;
-
- pdu->sender.type = PDU_TYPE_INTERNATIONAL;
-
-
- if (pdu_phone_is_packed((uint8_t *)sender)) {
- pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
- }
- else{
- pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
- }
-
-
- //pdu->tp_dcs = PDU_DCS_AUTO;
- //pdu->tp_dcs = PDU_DCS_8;
- pdu->tp_dcs = dcs;
- pdu->msg.data = (uint8_t *)msg;
-
- pdu_out_encode(pdu, out);
-
- return pdu->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
-{
- uint8_t n = 0;
-
- if (*in == '+')
- in++;
-
- while ((*in >= '0')&&(*in <= '9'))
- {
- *out = s_h2b4(*in++);
- if (*in)
- {
- *out |= s_h2b4(*in) << 4;
- in++;
- n++;
- }
- else
- *out |= 0xF0;
-
- n++;
- out++;
- }
-
- *out = 0xFF;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
-{
- uint8_t n = 0;
-
- if (type == PDU_TYPE_INTERNATIONAL)
- *out++ = '+';
-
- while (len--)
- {
- *out++ = s_b2h4(*in & 0xF);
- n++;
-
- if ((*in & 0xF0) != 0xF0)
- {
- *out++ = s_b2h4(*in >> 4);
- n++;
- }
-
- in++;
- }
-
- *out = 0;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_is_packed(uint8_t *phone)
-{
- return *phone != '+';
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits_bytes(uint8_t digits)
-{
- return (digits + (digits & 1)) >> 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_bytes(uint8_t *in)
-{
- uint8_t len = 0;
-
- while (*in++ != 0xFF)
- len++;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
-{
- uint8_t len = bytes << 1;
-
- if ((in[bytes-1] & 0xF0) == 0xF0)
- len--;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
-{
- if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
- return 0;
-
- while (in1_bytes--) if (*in1++ != *in2++)
- return 0;
-
- return 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_phone_copy(uint8_t *in, uint8_t *out)
-{
- if (in == out)
- return;
-
- uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
-
- while (*in != eop)
- *out++ = *in++;
-
- *out = eop;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h
deleted file mode 100755
index 7fc1fa34..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_gsm_pdu.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===================================================================================*/
-/*>>> Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved. <<<*/
-/* See LICENSE file in the project root for full license information. */
-/**
- @file
- ul_gsm_pdu.h
-
- @brief
- PDU defines
- @details
- porting of original code at https://github.com/tardigrade888/c-pdu
-
- @note
- Dependencies:
- m2mb_types.h
-
- @author
-
- @date
- 24/10/2018
-*/
-#ifndef HDR_UL_GSM_PDU_H_
-#define HDR_UL_GSM_PDU_H_
-
-// data coding scheme
-enum
-{
- PDU_DCS_7 = 0,
- PDU_DCS_8 = 0x4,
- PDU_DCS_UCS2 = 0x08,
- PDU_DCS_AUTO = 0xFF
-};
-
-// number format
-enum
-{
- PDU_TYPE_NATIONAL = 0xA1,
- PDU_TYPE_INTERNATIONAL = 0x91,
- PDU_TYPE_ALPHADET = 0xD0,
- PDU_TYPE_NETWORK = 0xB1
-};
-
-typedef struct
-{
- // SMSC number
- struct{ uint8_t len, bytes, type, data[14]; }smsc;
- // caller/sender number
- struct{ uint8_t len, bytes, type, data[14]; }sender;
- // input/output zero-terminated message (7bit/8bit/UTF8)
- struct{ uint16_t len, bytes; uint8_t *data; }msg;
-
- uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
- uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
- uint8_t tp_pid; // Protocol identifier (0)
- uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
- uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
-
- // incoming SMS timestamp
- uint8_t year, month, date; // date
- uint8_t hour, min, sec; // time
- int8_t tz; // zone
-
- // PDU length in bytes and for CMGS command
- uint16_t len_bytes, len_cmgs;
-}pdu_struct;
-
-// Change GSM 7-bit table to ANSI
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
-// pack 7-bit array to 8-bit
-uint8_t pdu_7to8(uint8_t *a, uint8_t len);
-// unpack 8-bit array to 7-bit
-uint8_t pdu_8to7(uint8_t *a, uint8_t len);
-
-// convert HEX line to bytes, len - length of input buffer
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
-// convert bytes to HEX line, len - length of input buffer
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
-
-// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
-
-// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
-// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
-
-// encode outcoming PDU
-uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
-// encode outcoming PDU, simple interface
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
-
-// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
-// unpack phone number to string, returns number of unpacked digits
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
-// check if phone is packed
-uint8_t pdu_phone_is_packed(uint8_t *phone);
-
-// get number of bytes from number of digits
-uint8_t pdu_phone_digits_bytes(uint8_t digits);
-// get number of bytes of packed phone
-uint8_t pdu_phone_bytes(uint8_t *in);
-// count number of digits
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
-
-// compare 2 packed phones
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
-// copy packed phone
-void pdu_phone_copy(uint8_t *in, uint8_t *out);
-
-#endif /* HDR_UL_GSM_PDU_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c
deleted file mode 100644
index 338ee2d1..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.c
+++ /dev/null
@@ -1,356 +0,0 @@
-#include "ul_math_bcd.h"
-#include
-
-u8 asc_point = '.';
-u8 asc_space = ' ';
-u8 asc_minus = '-';
-
-u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
-
-u8 bin2bcd_u8( u8 bin ) {
- u8 tens = 0;
- while (bin > 9) { bin -= 10; tens++; }
- return ( (tens << 4) + bin );
-}
-
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
-
- "bin2bcd_u32_00: \n" // correct input number by left shifts
- "mov r31, %A[data] \n"
- "mov %A[data], %B[data] \n"
- "mov %B[data], %C[data] \n"
- "mov %C[data], %D[data] \n"
- "mov %D[data], r31 \n"
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_00 \n"
-
- "eor r26, r26 \n" // result=0
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %[result_bytes] \n"
- "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bin2bcd_u32_01: \n" // bits shift and correction loop
- "subi r26,-0x33 \n" // add 0x33
- "sbrs r26, 3 \n" // if carry to bit 3,
- "subi r26, 3 \n" // subtract 3
- "sbrs r26, 7 \n" // if carry to bit 7,
- "subi r26, 0x30 \n" // subtract 0x30
- "subi r27,-0x33 \n" // add 0x33
- "sbrs r27, 3 \n" // if carry to bit 3,
- "subi r27, 3 \n" // subtract 3
- "sbrs r27, 7 \n" // if carry to bit 7,
- "subi r27, 0x30 \n" // subtract 0x30
- "subi r30,-0x33 \n" // add 0x33
- "sbrs r30, 3 \n" // if carry to bit 3,
- "subi r30, 3 \n" // subtract 3
- "sbrs r30, 7 \n" // if carry to bit 7,
- "subi r30, 0x30 \n" // subtract 0x30
- "subi r31,-0x33 \n" // add 0x33
- "sbrs r31, 3 \n" // if carry to bit 3,
- "subi r31, 3 \n" // subtract 3
- "sbrs r31, 7 \n" // if carry to bit 7,
- "subi r31, 0x30 \n" // subtract 0x30
- "lsl r26 \n" // shift result number
- "rol r27 \n"
- "rol r30 \n"
- "rol r31 \n"
-
- "sbrc %D[data], 7 \n" // skip if msbit of input == 0
- "ori r26, 1 \n" // set lsb of output
- "lsl %A[data] \n" // shift input number
- "rol %B[data] \n"
- "rol %C[data] \n"
- "rol %D[data] \n"
-
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_01 \n" // repeat for all bits
-
- //"mov %A[result], r26 \n" // move to result
- //"mov %B[result], r27 \n"
- //"mov %C[result], r30 \n"
- //"mov %D[result], r31 \n"
-
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result) // output
- :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
- :"r26","r27","r30","r31" // clobbers
- );
- return result;
- }
-#endif
-
-u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
- data <<= 8;
- for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
- /*result BCD nibbles correction*/
- result += 0x33333333;
- /*result correction loop*/
- for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
- u8 corr_byte = result >> 24;
- if (!(corr_byte & 0x08)) corr_byte -= 0x03;
- if (!(corr_byte & 0x80)) corr_byte -= 0x30;
- result <<= 8; /*shift result*/
- result += corr_byte; /*set 8 bits of result*/
- }
- /*shift next bit of input to result*/
- result <<= 1;
- if (((u8)(data >> 24)) & 0x80)
- result |= 1;
- data <<= 1;
- }
- return(result);
-}
-
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
- u32 result = 0;
- result_bytes = 0;
- while (data > 0) {
- result += (data % 10) << result_bytes;
- data /= 10;
- result_bytes += 4;
- }
- return result;
-}
-
-u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
- static ldiv_t bin2bcd_ldiv_result;
- bin2bcd_ldiv_result.quot = value;
- u32 result = 0;
- nbytes = 0;
- while (bin2bcd_ldiv_result.quot > 0) {
- bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
- result += bin2bcd_ldiv_result.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-struct divmod10_t {
- uint32_t quot;
- uint8_t rem;
-} divmodu10_res;
-inline static void divmodu10(u32 n) {
- divmodu10_res.quot = n >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 4;
- divmodu10_res.quot += divmodu10_res.quot >> 8;
- divmodu10_res.quot += divmodu10_res.quot >> 16;
- u32 qq = divmodu10_res.quot & ~7ul;
- divmodu10_res.quot >>= 3;
- divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
- if (divmodu10_res.rem > 9) {
- divmodu10_res.rem -= 10;
- divmodu10_res.quot++;
- }
-}
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
- u32 result = 0; nbytes = 0;
- divmodu10_res.quot = value;
- while (divmodu10_res.quot != 0) {
- divmodu10(divmodu10_res.quot);
- result += divmodu10_res.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-#ifdef __AVR__
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "eor r26, r26 \n" /* result = 0 */
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bcd2bin_u32_00: \n" /* bits shift and correction loop */
- "lsr r31 \n" /* shift out buffer */
- "ror r30 \n"
- "ror r27 \n"
- "ror r26 \n"
-
- "sbrc %A[data], 0 \n" /* move lowest bit to result */
- "ori r31, 0x80 \n"
-
- "lsr %D[data] \n"
- "ror %C[data] \n"
- "ror %B[data] \n"
- "ror %A[data] \n"
-
- "sbrc %D[data], 7 \n" /* if carry to bit 7, */
- "subi %D[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %D[data], 3 \n" /* if carry to bit 3, */
- "subi %D[data], 3 \n" /* subtract 3 */
- "sbrc %C[data], 7 \n" /* if carry to bit 7, */
-
- "subi %C[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %C[data], 3 \n" /* if carry to bit 3, */
- "subi %C[data], 3 \n" /* subtract 0x30 */
- "sbrc %B[data], 7 \n" /* if carry to bit 7, */
- "subi %B[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %B[data], 3 \n" /* if carry to bit 3, */
- "subi %B[data], 3 \n" /* subtract 3 */
- "sbrc %A[data], 7 \n" /* if carry to bit 7, */
- "subi %A[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %A[data], 3 \n" /* if carry to bit 3, */
- "subi %A[data], 3 \n" /* subtract 3 */
-
- "dec __tmp_reg__ \n" /* repeat for all bits */
- "brne bcd2bin_u32_00 \n"
-
-// "movw %A[result], r26 \n" /* adjust result */
-// "movw %C[result], r30 \n"
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "bcd2bin_u32_01: \n"
- "mov __tmp_reg__,r25 \n"
- "mov r25,r24 \n"
- "mov r24,r23 \n"
- "mov r23,r22 \n"
- "mov r22,__tmp_reg__ \n"
- "dec %[result_bytes] \n"
- "brne bcd2bin_u32_01 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
- );
- return result;
- }
-#endif
-
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
- /*shift next bit*/
- result >>= 1;
- if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
- data >>= 1;
- /* result BCD correction */
- for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
- u8 tmp_byte = (data >> 24);
- if (tmp_byte & 0x80) tmp_byte -= 0x30;
- if (tmp_byte & 0x08) tmp_byte -= 0x03;
- data <<= 8;
- data |= tmp_byte;
- }
- }
- /*adjust result bytes*/
- for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
- result >>= 8;
- return(result);
-}
-
-u8 asc2bin_u8(u8 data) {
- if ((data >= '0') && (data <= '9')) data -= '0';
- else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
- else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
- else data = 0xf0;
- return(data);
-}
-
-u8 bin2asc_u8(u8 data) {
- data &= 0xf;
- return (data > 9) ? (data + 'A' - 10) : (data + '0');
-}
-
-u32 asc2bin_u32(u8 *buf, s8 size) {
- u32 result;
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- result = 0;
- while(size) {
- u8 tmp_u8 = asc2bin_u8(*buf);
- if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
- result <<= 4;
- result |= tmp_u8;
- }
- size--;
- if (flag_negative) buf--;
- else buf++; /*go to next symbol*/
- }
- return(result);
-}
-
-void bin2asc_u32(u32 data, u8 *buf, s8 size) {
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- while (size) {
- *buf = bin2asc_u8(data);
- data >>= 4;
- if (flag_negative) buf--;
- else buf++;
- size--;
- if (data == 0) size = 0; /*stop conversion on zero*/
- }
-}
-
-void num2asc_s32(s32 data, u8 *buf, u8 flags) {
- u8 cnt_chars = (flags & 7); //number of digits
- //convert negative to positive, set '-' flag
- if (data < 0) {data = -data; flags |= 1;}
- else flags &= ~1;
- //if necessary, convert to BCD
- //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
- cnt_chars++;
- //calculate point position
- u8 point_pos = cnt_chars - ((flags >> 4) & 7);
- if (point_pos) point_pos++;
- flags |= 2;
- while (cnt_chars) { //digits conversion loop
- if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
- if (flags & 1) *buf = asc_minus;
- else if (flags & 2) *buf = '0';
- else *buf = asc_space;
- flags &= ~1;
- } else {
- //show point
- if ((cnt_chars == point_pos) && (flags & 0x70)) {
- *buf-- = asc_point;
- cnt_chars--;
- }
- *buf = bin2asc_u8(data); //show ASCII digit
- }
- cnt_chars--;
- buf--;
- data >>= 4;
- flags &= ~2;
- }
- if (flags & 1) *buf = asc_minus;
-}
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h
deleted file mode 100644
index cbb417f9..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_math_bcd.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ul_bcd.h
- *
- * Created on: Sep 11, 2011
- * Author: qwer1
- */
-
-#ifndef UL_BCD_H_
-#define UL_BCD_H_
-
-#include "ul_other.h"
-
-extern u8 asc_point;
-extern u8 asc_space;
-extern u8 asc_minus;
-
-/** convert lower nibble to HEX symbol */
-#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
-
-/** 8-bit BCD->BIN conversion */
-u8 bcd2bin_u8( u8 bcd );
-/** 8-bit BIN->BCD conversion */
-u8 bin2bcd_u8( u8 bin );
-
-// 32-bit BIN->BCD conversion using shifts and correction
-//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
-
-// 32-bit BIN->BCD conversion using hardware divider
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using ldiv
-u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using fast soft div
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
-
-// 32-bit BCD->BIN conversion
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
-
-u8 asc2bin_u8(u8 data);
-u8 bin2asc_u8(u8 data);
-u32 asc2bin_u32(u8 *buf, s8 size);
-void bin2asc_u32(u32 data, u8 *buf, s8 size);
-
-// AVR-optimized conversions
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
- u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
-#endif
-
-/** convert 32-bit signed data to ASCII number to buffer (right to left)
- * options & 7 - width-1,
- * (options >> 4) & 7 - point position,
- * options & 0x08 - supress leading zeros,
- * options & 0x80 - convert to BCD.
- */
-#define NUM2ASC_BCD (u8)0x80
-#define NUM2ASC_NOZEROS (u8)0x08
-#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
-#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
-#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
-void num2asc_s32(s32 data, u8 *buf, u8 flags);
-inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
-
-// calculate number width
-
- inline u8 width_i32(s32 n){
- u8 s = 0;
- if (n < 0){ s = 1; n = -n; }
- return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
- ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
-}
-
-
-#endif /* UL_BCD_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.c
deleted file mode 100644
index 052a3565..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ul_other.c
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#include "ul_other.h"
-
-void *memset2(void *dest, int val, size_t len) {
- u8 *dest1 = (u8*) dest;
- while (len--) *dest1++ = (u8)val;
- return dest;
-}
-
-void *memcpy2(void *dest, const void *src, size_t len) {
- u8 *dest1 = (u8 *) dest;
- u8 *src1 = (u8 *)src;
- while (len--) *dest1++ = *src1++;
- return dest;
-}
-
-u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n) {
- u32 quot = n >> 1;
- quot += quot >> 1;
- quot += quot >> 4;
- quot += quot >> 8;
- quot += quot >> 16;
- u32 qq = quot & ~7ul;
- quot >>= 3;
- divmod10_u32_rem = n - ((quot << 1) + qq);
- if (divmod10_u32_rem > 9) {
- divmod10_u32_rem -= 10;
- quot++;
- }
- return quot;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.h
deleted file mode 100644
index 6248c057..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_other.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ul_other.h
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#ifndef UL_OTHER_H_
-#define UL_OTHER_H_
-
-#include
-#include
-
-#ifndef offsetof
- #define offsetof(s,m) (size_t)&(((s *)0)->m)
-#endif
-#ifndef countof
- #define countof(arg) (sizeof(arg) / sizeof(arg[0]))
-#endif
-
-//attributes
-#define WEAK __attribute__ ((weak))
-#define NAKED __attribute__ ((naked))
-#define INTERRUPT __attribute__ ((__interrupt__))
-#define USED __attribute__ ((used))
-#define NORETURN __attribute__ ((noreturn))
-#define SECTION(s) __attribute__ ((section(s)))
-#define NOINIT SECTION(".noinit")
-#define ALIAS(a) __attribute__ ((weak, alias (a)))
-#define ALWAYS_INLINE __attribute__ ((always_inline))
-#define OPTIMIZE(level) __attribute__ ((optimize(level)))
-
-//architecture-specific inlines
-#ifdef __AVR
- #define wdr() asm volatile("wdr")
- #define nop() asm volatile("nop")
- #define sleep() asm volatile("sleep")
-#else
- #define PROGMEM
-#endif
-
-#ifdef __i8051
- #define cli() EI = 0
- #define sei() EI = 1
-#endif
-
-#ifdef __STM8
- #define cli() _asm("sim")
- #define sei() _asm("rim")
- #define nop() _asm("nop")
- #define wdr() { IWDG_KR = 0xAA; }
-#endif
-
-#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
- #define cli() asm volatile ( "CPSID i \n" )
- #define sei() asm volatile ( "CPSIE i \n" )
-#endif
-
-//short named types
-typedef uint8_t u8;
-typedef int8_t s8;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef float f32;
-typedef double f64;
-#ifdef __float128
- typedef __float128 f128;
-#endif
-
-//bit mask
-#define B(_b) (1 << (_b))
-#define BIT(_b) (1 << (_b))
-
-//Increment/decrement, Add/Subtract with range rollover/limit
-#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
-#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
-#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
-#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
-#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
-#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
-#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
-#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
-#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
-#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
-#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
-#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-#ifdef __ARM_ARCH_7M__
- //ARM Cortex BitBand access macros
- #define BITBAND_SRAM_REF 0x20000000
- #define BITBAND_SRAM_BASE 0x22000000
- // Convert SRAM address
- #define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
- #define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
-
- #define BITBAND_PERI_REF 0x40000000
- #define BITBAND_PERI_BASE 0x42000000
- // Convert PERIPHERAL address
- #define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
- #define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
-#endif
-
-//memset - simple verion
-void *memset2(void *dest, int val, size_t len);
-//memcpy - simple verion
-void *memcpy2(void *dest, const void *src, size_t len);
-
-extern u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n);
-
-#endif /* OTHER_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.c
deleted file mode 100755
index 909e46b5..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ul_s.c
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#include "ul_s.h"
-#include "ul_math_bcd.h"
-
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
- u8 n = 0; u16 o;
- if (in[0] < 0x80){ n = 1; o = in[0]; }
- else if ((in[0] & 0xE0) == 0xE0){
- if ((in[1] != 0) && (in[2] != 0)){
- n = 3;
- o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
- }
- } else if ((in[0] & 0xC0) == 0xC0){
- if (in[1] != 0){
- n = 2;
- o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
- }
- }
- if (n){
- if (be){
- *((u8 *)out) = o >> 8;
- *((u8 *)out + 1) = o;
- } else {
- *((u8 *)out) = o;
- *((u8 *)out + 1) = o >> 8;
- }
- }
- return n;
-}
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
- if (in_len == 0) in_len = s_len(in,0);
- u16 out_len = 0;
- while (in_len){
- u8 n = utf8_to_ucs2(in, out, be);
- if (n == 0) in_len = 0;
- else {
- in += n;
- out++; out_len++;
- in_len = (in_len >= n) ? (in_len - n) : 0;
- }
- }
- return out_len;
-}
-
-
-u8 ucs2_to_utf8(u32 in, u8 *out){
- u8 n = 0;
- if (in < 0x80){
- out[0] = in;
- out[1] = 0;
- n = 1;
- }
- else if ((in >= 0x80) && (in < 0x800)){
- out[0] = (in >> 6) | 0xC0;
- out[1] = (in & 0x3F) | 0x80;
- out[2] = 0;
- n = 2;
- }
- else if ((in >= 0x800) && (in < 0xFFFF)){
- if (!((in >= 0xD800) && (in <= 0xDFFF))){
- out[0] = (in >> 12) | 0xE0;
- out[1] = ((in >> 6 ) & 0x3F) | 0x80;
- out[2] = (in & 0x3F) | 0x80;
- out[3] = 0;
- n = 3;
- }
- }
- else if ((in >= 0x10000) && (in < 0x10FFFF)){
- out[0] = 0xF0 | (in >> 18);
- out[1] = 0x80 | ((in >> 12) & 0x3F);
- out[2] = 0x80 | ((in >> 6) & 0x3F);
- out[3] = 0x80 | ((in & 0x3F));
- out[4] = 0;
- return 4;
- }
- return n;
-}
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
- u16 out_len = 0;
- while (in_len){
- u8 n = ucs2_to_utf8(
- (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
- if (n == 0) in_len = 0;
- else {
- in++; in_len--;
- out += n; out_len += n;
- }
- }
- return out_len;
-}
-
-u16 s_len(u8 *s, u8 eol){
- if (s == NULL) return 0;
- u16 l = 0;
- while (*s++ != eol) l++;
- return l;
-}
-u8 s_lines(u8 *s, u16 len, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 n = 0;
- while (len--) if (*s++ == eol) n++;
- return n;
-}
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 l = 0;
- while (len-- && (l < line))
- if (*s++ == eol) l++;
- return (len == 0) ? NULL : s;
-}
-u8 *s_skip_crlf(u8 *s){
- while ((*s == '\r')||(*s == '\n')) s++;
- return s;
-}
-
-u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
-void s_upcase(u8 *s, u16 len){
- if (len == 0) len = s_len(s, 0);
- while (len--){
- *s = c_upcase(*s);
- s++;
- }
-}
-
-u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
-u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
-
-u8 s_cmp(u8 *s1, u8 *s2, u16 len){
- while (len--) if (*s1++ != *s2++) return 0;
- return 1;
-}
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
- while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
- return 1;
-}
-
-u8 s_starts(u8 *s, char *start){
- while (*start != 0) if (*s++ != *start++) return 0;
- return 1;
-}
-u8 s_ends(u8 *s, char *end){
- u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
- if ((el > 0)&&(sl >= el)){
- s += sl - 1; end += el - 1;
- while (el--) if (*s-- != *end--) return 0;
- return 1;
- }
- return 0;
-}
-
-u8 *s_cpos(u8 *s, u8 c, u8 eol){
- while(*s != eol){
- if (*s == c) return s;
- s++;
- }
- return NULL;
-}
-
-u32 s_parse_dec(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
- return n;
-}
-u32 s_parse_hex(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
- n = (n << 4) + s_h2b4( *s++ );
- return n;
-}
-
-u8 s_is_7bit(u8 *s, u8 eol){
- while (*s != eol) if (*s++ > 0x7F) return 0;
- return 1;
-}
-
-u8 *s_copy(u8 *in, u8 eol, u8 *out){
- if (in == out) return out;
- while (*in != eol) *out++ = *in++;
- *out = eol;
- return out;
-}
-
-u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
-u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
-u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
-u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
-u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
-u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
-u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
-
-#if 0
-u8 *s_append_u32(u8 *out, u32 n) {
- if (n){
- n = bin2bcd_u32(n, 4); u8 digs = 8;
- while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
- while(digs--){
- *out++ = s_b2h4(n >> 28);
- n <<= 4;
- }
- } else *out++ = '0';
- *out = 0;
- return out;
-}
-
-
-u8 *s_append_s32(u8 *out, s32 n) {
- if (n < 0){
- out = s_append_c(out, '-');
- n = -n;
- }
- return s_append_u32(out, n);
-}
-#endif
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.h
deleted file mode 100644
index 8d46bd02..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/ul_s.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ul_s.h
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#ifndef UL_S_H_
-#define UL_S_H_
-
-#include "ul_other.h"
-
-
-// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
-// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
-
-// convert UCS2 codepoint to UTF8, returns number of bytes processed
-u8 ucs2_to_utf8(u32 in, u8 *out);
-// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
-
-
-// find length of line, terminated by eol char
-u16 s_len(u8 *s, u8 eol);
-
-// number of lines, separated by eol char
-u8 s_lines(u8 *s, u16 len, u8 eol);
-
-u8 c_upcase(u8 c);
-// uppercase string, in-place
-void s_upcase(u8 *s, u16 len);
-
-u8 s_h2b4(u8 hex);
-u8 s_b2h4(u8 b);
-
-// find start of line, delimited by eol char
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
-
-// skip CR/LF chars
-u8 *s_skip_crlf(u8 *s);
-
-// compare 2 strings, returns 1 if equal
-u8 s_cmp(u8 *s1, u8 *s2, u16 len);
-// compare 2 strings, upper-casing each char, returns 1 if equal
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
-
-// check if s starts with start
-u8 s_starts(u8 *s, char *start);
-// check if s ends with end
-u8 s_ends(u8 *s, char *end);
-
-// finds 1st occurence of char c, returns NULL if not found
-u8 *s_cpos(u8 *s, u8 c, u8 eol);
-
-// check if string is 7-bit
-u8 s_is_7bit(u8 *s, u8 eol);
-
-// copy in string (terminated by eol char) to out
-u8 *s_copy(u8 *in, u8 eol, u8 *out);
-
-
-// append string out to in, returns pointer after last char
-u8 *s_append_s (u8 *out, char *in);
-// append char to string buffer
-u8 *s_append_c (u8 *out, u8 c);
-// append Hex char to string buffer
-u8 *s_append_h4 (u8 *out, u8 n);
-// append Hex byte to string buffer
-u8 *s_append_h8 (u8 *out, u8 n);
-// append 16-bit Hex to string buffer
-u8 *s_append_h16(u8 *out, u16 n);
-// append 24-bit Hex to string buffer
-u8 *s_append_h24(u8 *out, u32 n);
-// append 32-bit Hex to string buffer
-u8 *s_append_h32(u8 *out, u32 n);
-
-
-// parse decimal number
-u32 s_parse_dec(u8 *s, u8 len);
-// parse hex number
-u32 s_parse_hex(u8 *s, u8 len);
-
-#endif /* UL_S_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/version.txt
index b0b37441..5f14daa7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/azx/pdu_codec/version.txt
@@ -1,3 +1,7 @@
+1.0.3
+New dcs decoding functionality
+Output encoding selection
+-----------
1.0.2
azx_pdu_convertZeroPaddedHexIntoByte arrays initialization and casting
-----------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/metadata.json
old mode 100755
new mode 100644
index 1264290a..39e79151
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/M2MB_main.c
index 713e2584..7a540e8f 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/M2MB_main.c
@@ -14,7 +14,7 @@
Sample application showcasing how to create and decode PDUs to be used with m2mb_sms_* API set. A SIM card and antenna must be present. Debug prints on MAIN UART
@version
- 1.0.4
+ 1.0.5
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -42,7 +42,7 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
@@ -52,7 +52,7 @@
/* Local defines ================================================================================*/
-#define SMS_PDU_MAX_SIZE 400
+
#define SENDER_NUMBER "+391234567890" //remember to store the phone number in international format
@@ -241,6 +241,10 @@ void M2MB_main( int argc, char **argv )
AZX_LOG_ERROR("SMS not sent! - unexpected value %d returned\r\n", osRes);
}
+ //App waiting for incoming SMSs
+ AZX_LOG_INFO( "Waiting for an incoming SMS...\r\n" );
+
+
#ifdef LE910CXL
/* On Linux based LE910CX Linux, the end fo M2MB_main causes the return of the application.
Add a loop to allow reception of messages*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/callbacks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/callbacks.c
index e3cec8f2..1e30aee2 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/callbacks.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_PDU/src/callbacks.c
@@ -34,11 +34,12 @@
#include "azx_log.h"
#include "azx_utils.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
#include "callbacks.h"
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
@@ -118,7 +119,7 @@ void Sms_Callback(M2MB_SMS_HANDLE h, M2MB_SMS_IND_E sms_event, UINT16 resp_size,
{
pdu_struct packet;
static char number[32];
- static char message[161];
+ static char message[SMS_PDU_MAX_SIZE]; //more bytes needed due to HEX_raw outtput format
INT32 len;
AZX_LOG_INFO("M2MB_SMS_READ_RESP Callback\r\n\n");
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/Makefile.in
index 59b129cb..f0e01926 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c
new file mode 100755
index 00000000..786e2684
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.c
@@ -0,0 +1,1418 @@
+/*
+ * azx_common.c
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#include "azx_pduCommon.h"
+
+#include
+#include
+#include
+
+
+/*
+ Setting out_fmt variable, output can be represented in hex raw (if coding is 8-bit or UCS2) or utf8. Default is utf8.
+ Variable can be set/read runtime using function pdu_set_output_format/get_set_output_format
+ */
+
+static SMS_TXT_OUT_FMT_E out_fmt = UTF8_default;
+//SMS_TXT_OUT_FMT_E out_fmt = HEX_raw;
+
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
+ u8 n = 0; u16 o;
+ if (in[0] < 0x80){ n = 1; o = in[0]; }
+ else if ((in[0] & 0xE0) == 0xE0){
+ if ((in[1] != 0) && (in[2] != 0)){
+ n = 3;
+ o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
+ }
+ } else if ((in[0] & 0xC0) == 0xC0){
+ if (in[1] != 0){
+ n = 2;
+ o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
+ }
+ }
+ if (n){
+ if (be){
+ *((u8 *)out) = o >> 8;
+ *((u8 *)out + 1) = o;
+ } else {
+ *((u8 *)out) = o;
+ *((u8 *)out + 1) = o >> 8;
+ }
+ }
+ return n;
+}
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
+ if (in_len == 0) in_len = s_len(in,0);
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = utf8_to_ucs2(in, out, be);
+ if (n == 0) in_len = 0;
+ else {
+ in += n;
+ out++; out_len++;
+ in_len = (in_len >= n) ? (in_len - n) : 0;
+ }
+ }
+ return out_len;
+}
+
+
+u8 ucs2_to_utf8(u32 in, u8 *out){
+ u8 n = 0;
+ if (in < 0x80){
+ out[0] = in;
+ out[1] = 0;
+ n = 1;
+ }
+ else if ((in >= 0x80) && (in < 0x800)){
+ out[0] = (in >> 6) | 0xC0;
+ out[1] = (in & 0x3F) | 0x80;
+ out[2] = 0;
+ n = 2;
+ }
+ else if ((in >= 0x800) && (in < 0xFFFF)){
+ if (!((in >= 0xD800) && (in <= 0xDFFF))){
+ out[0] = (in >> 12) | 0xE0;
+ out[1] = ((in >> 6 ) & 0x3F) | 0x80;
+ out[2] = (in & 0x3F) | 0x80;
+ out[3] = 0;
+ n = 3;
+ }
+ }
+ else if ((in >= 0x10000) && (in < 0x10FFFF)){
+ out[0] = 0xF0 | (in >> 18);
+ out[1] = 0x80 | ((in >> 12) & 0x3F);
+ out[2] = 0x80 | ((in >> 6) & 0x3F);
+ out[3] = 0x80 | ((in & 0x3F));
+ out[4] = 0;
+ return 4;
+ }
+ return n;
+}
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = ucs2_to_utf8(
+ (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
+ if (n == 0) in_len = 0;
+ else {
+ in++; in_len--;
+ out += n; out_len += n;
+ }
+ }
+ return out_len;
+}
+
+u16 s_len(u8 *s, u8 eol){
+ if (s == NULL) return 0;
+ u16 l = 0;
+ while (*s++ != eol) l++;
+ return l;
+}
+u8 s_lines(u8 *s, u16 len, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 n = 0;
+ while (len--) if (*s++ == eol) n++;
+ return n;
+}
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 l = 0;
+ while (len-- && (l < line))
+ if (*s++ == eol) l++;
+ return (len == 0) ? NULL : s;
+}
+u8 *s_skip_crlf(u8 *s){
+ while ((*s == '\r')||(*s == '\n')) s++;
+ return s;
+}
+
+u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
+void s_upcase(u8 *s, u16 len){
+ if (len == 0) len = s_len(s, 0);
+ while (len--){
+ *s = c_upcase(*s);
+ s++;
+ }
+}
+
+u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
+u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
+
+u8 s_cmp(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (*s1++ != *s2++) return 0;
+ return 1;
+}
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
+ return 1;
+}
+
+u8 s_starts(u8 *s, char *start){
+ while (*start != 0) if (*s++ != *start++) return 0;
+ return 1;
+}
+u8 s_ends(u8 *s, char *end){
+ u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
+ if ((el > 0)&&(sl >= el)){
+ s += sl - 1; end += el - 1;
+ while (el--) if (*s-- != *end--) return 0;
+ return 1;
+ }
+ return 0;
+}
+
+u8 *s_cpos(u8 *s, u8 c, u8 eol){
+ while(*s != eol){
+ if (*s == c) return s;
+ s++;
+ }
+ return NULL;
+}
+
+u32 s_parse_dec(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
+ return n;
+}
+u32 s_parse_hex(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
+ n = (n << 4) + s_h2b4( *s++ );
+ return n;
+}
+
+u8 s_is_7bit(u8 *s, u8 eol){
+ while (*s != eol) if (*s++ > 0x7F) return 0;
+ return 1;
+}
+
+u8 *s_copy(u8 *in, u8 eol, u8 *out){
+ if (in == out) return out;
+ while (*in != eol) *out++ = *in++;
+ *out = eol;
+ return out;
+}
+
+u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
+u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
+u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
+u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
+u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
+u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
+u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
+
+#if 0
+u8 *s_append_u32(u8 *out, u32 n) {
+ if (n){
+ n = bin2bcd_u32(n, 4); u8 digs = 8;
+ while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
+ while(digs--){
+ *out++ = s_b2h4(n >> 28);
+ n <<= 4;
+ }
+ } else *out++ = '0';
+ *out = 0;
+ return out;
+}
+
+
+u8 *s_append_s32(u8 *out, s32 n) {
+ if (n < 0){
+ out = s_append_c(out, '-');
+ n = -n;
+ }
+ return s_append_u32(out, n);
+}
+#endif
+
+void *memset2(void *dest, int val, size_t len) {
+ u8 *dest1 = (u8*) dest;
+ while (len--) *dest1++ = (u8)val;
+ return dest;
+}
+
+void *memcpy2(void *dest, const void *src, size_t len) {
+ u8 *dest1 = (u8 *) dest;
+ u8 *src1 = (u8 *)src;
+ while (len--) *dest1++ = *src1++;
+ return dest;
+}
+
+u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n) {
+ u32 quot = n >> 1;
+ quot += quot >> 1;
+ quot += quot >> 4;
+ quot += quot >> 8;
+ quot += quot >> 16;
+ u32 qq = quot & ~7ul;
+ quot >>= 3;
+ divmod10_u32_rem = n - ((quot << 1) + qq);
+ if (divmod10_u32_rem > 9) {
+ divmod10_u32_rem -= 10;
+ quot++;
+ }
+ return quot;
+}
+
+u8 asc_point = '.';
+u8 asc_space = ' ';
+u8 asc_minus = '-';
+
+u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
+
+u8 bin2bcd_u8( u8 bin ) {
+ u8 tens = 0;
+ while (bin > 9) { bin -= 10; tens++; }
+ return ( (tens << 4) + bin );
+}
+
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
+
+ "bin2bcd_u32_00: \n" // correct input number by left shifts
+ "mov r31, %A[data] \n"
+ "mov %A[data], %B[data] \n"
+ "mov %B[data], %C[data] \n"
+ "mov %C[data], %D[data] \n"
+ "mov %D[data], r31 \n"
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_00 \n"
+
+ "eor r26, r26 \n" // result=0
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %[result_bytes] \n"
+ "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bin2bcd_u32_01: \n" // bits shift and correction loop
+ "subi r26,-0x33 \n" // add 0x33
+ "sbrs r26, 3 \n" // if carry to bit 3,
+ "subi r26, 3 \n" // subtract 3
+ "sbrs r26, 7 \n" // if carry to bit 7,
+ "subi r26, 0x30 \n" // subtract 0x30
+ "subi r27,-0x33 \n" // add 0x33
+ "sbrs r27, 3 \n" // if carry to bit 3,
+ "subi r27, 3 \n" // subtract 3
+ "sbrs r27, 7 \n" // if carry to bit 7,
+ "subi r27, 0x30 \n" // subtract 0x30
+ "subi r30,-0x33 \n" // add 0x33
+ "sbrs r30, 3 \n" // if carry to bit 3,
+ "subi r30, 3 \n" // subtract 3
+ "sbrs r30, 7 \n" // if carry to bit 7,
+ "subi r30, 0x30 \n" // subtract 0x30
+ "subi r31,-0x33 \n" // add 0x33
+ "sbrs r31, 3 \n" // if carry to bit 3,
+ "subi r31, 3 \n" // subtract 3
+ "sbrs r31, 7 \n" // if carry to bit 7,
+ "subi r31, 0x30 \n" // subtract 0x30
+ "lsl r26 \n" // shift result number
+ "rol r27 \n"
+ "rol r30 \n"
+ "rol r31 \n"
+
+ "sbrc %D[data], 7 \n" // skip if msbit of input == 0
+ "ori r26, 1 \n" // set lsb of output
+ "lsl %A[data] \n" // shift input number
+ "rol %B[data] \n"
+ "rol %C[data] \n"
+ "rol %D[data] \n"
+
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_01 \n" // repeat for all bits
+
+ //"mov %A[result], r26 \n" // move to result
+ //"mov %B[result], r27 \n"
+ //"mov %C[result], r30 \n"
+ //"mov %D[result], r31 \n"
+
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result) // output
+ :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
+ :"r26","r27","r30","r31" // clobbers
+ );
+ return result;
+}
+#endif
+
+u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
+ data <<= 8;
+ for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
+ /*result BCD nibbles correction*/
+ result += 0x33333333;
+ /*result correction loop*/
+ for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
+ u8 corr_byte = result >> 24;
+ if (!(corr_byte & 0x08)) corr_byte -= 0x03;
+ if (!(corr_byte & 0x80)) corr_byte -= 0x30;
+ result <<= 8; /*shift result*/
+ result += corr_byte; /*set 8 bits of result*/
+ }
+ /*shift next bit of input to result*/
+ result <<= 1;
+ if (((u8)(data >> 24)) & 0x80)
+ result |= 1;
+ data <<= 1;
+ }
+ return(result);
+}
+
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
+ u32 result = 0;
+ result_bytes = 0;
+ while (data > 0) {
+ result += (data % 10) << result_bytes;
+ data /= 10;
+ result_bytes += 4;
+ }
+ return result;
+}
+
+u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
+ static ldiv_t bin2bcd_ldiv_result;
+ bin2bcd_ldiv_result.quot = value;
+ u32 result = 0;
+ nbytes = 0;
+ while (bin2bcd_ldiv_result.quot > 0) {
+ bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
+ result += bin2bcd_ldiv_result.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+struct divmod10_t {
+ uint32_t quot;
+ uint8_t rem;
+} divmodu10_res;
+inline static void divmodu10(u32 n) {
+ divmodu10_res.quot = n >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 4;
+ divmodu10_res.quot += divmodu10_res.quot >> 8;
+ divmodu10_res.quot += divmodu10_res.quot >> 16;
+ u32 qq = divmodu10_res.quot & ~7ul;
+ divmodu10_res.quot >>= 3;
+ divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
+ if (divmodu10_res.rem > 9) {
+ divmodu10_res.rem -= 10;
+ divmodu10_res.quot++;
+ }
+}
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
+ u32 result = 0; nbytes = 0;
+ divmodu10_res.quot = value;
+ while (divmodu10_res.quot != 0) {
+ divmodu10(divmodu10_res.quot);
+ result += divmodu10_res.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+#ifdef __AVR__
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "eor r26, r26 \n" /* result = 0 */
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bcd2bin_u32_00: \n" /* bits shift and correction loop */
+ "lsr r31 \n" /* shift out buffer */
+ "ror r30 \n"
+ "ror r27 \n"
+ "ror r26 \n"
+
+ "sbrc %A[data], 0 \n" /* move lowest bit to result */
+ "ori r31, 0x80 \n"
+
+ "lsr %D[data] \n"
+ "ror %C[data] \n"
+ "ror %B[data] \n"
+ "ror %A[data] \n"
+
+ "sbrc %D[data], 7 \n" /* if carry to bit 7, */
+ "subi %D[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %D[data], 3 \n" /* if carry to bit 3, */
+ "subi %D[data], 3 \n" /* subtract 3 */
+ "sbrc %C[data], 7 \n" /* if carry to bit 7, */
+
+ "subi %C[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %C[data], 3 \n" /* if carry to bit 3, */
+ "subi %C[data], 3 \n" /* subtract 0x30 */
+ "sbrc %B[data], 7 \n" /* if carry to bit 7, */
+ "subi %B[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %B[data], 3 \n" /* if carry to bit 3, */
+ "subi %B[data], 3 \n" /* subtract 3 */
+ "sbrc %A[data], 7 \n" /* if carry to bit 7, */
+ "subi %A[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %A[data], 3 \n" /* if carry to bit 3, */
+ "subi %A[data], 3 \n" /* subtract 3 */
+
+ "dec __tmp_reg__ \n" /* repeat for all bits */
+ "brne bcd2bin_u32_00 \n"
+
+ // "movw %A[result], r26 \n" /* adjust result */
+ // "movw %C[result], r30 \n"
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "bcd2bin_u32_01: \n"
+ "mov __tmp_reg__,r25 \n"
+ "mov r25,r24 \n"
+ "mov r24,r23 \n"
+ "mov r23,r22 \n"
+ "mov r22,__tmp_reg__ \n"
+ "dec %[result_bytes] \n"
+ "brne bcd2bin_u32_01 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
+ );
+ return result;
+}
+#endif
+
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
+ /*shift next bit*/
+ result >>= 1;
+ if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
+ data >>= 1;
+ /* result BCD correction */
+ for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
+ u8 tmp_byte = (data >> 24);
+ if (tmp_byte & 0x80) tmp_byte -= 0x30;
+ if (tmp_byte & 0x08) tmp_byte -= 0x03;
+ data <<= 8;
+ data |= tmp_byte;
+ }
+ }
+ /*adjust result bytes*/
+ for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
+ result >>= 8;
+ return(result);
+}
+
+u8 asc2bin_u8(u8 data) {
+ if ((data >= '0') && (data <= '9')) data -= '0';
+ else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
+ else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
+ else data = 0xf0;
+ return(data);
+}
+
+u8 bin2asc_u8(u8 data) {
+ data &= 0xf;
+ return (data > 9) ? (data + 'A' - 10) : (data + '0');
+}
+
+u32 asc2bin_u32(u8 *buf, s8 size) {
+ u32 result;
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ result = 0;
+ while(size) {
+ u8 tmp_u8 = asc2bin_u8(*buf);
+ if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
+ result <<= 4;
+ result |= tmp_u8;
+ }
+ size--;
+ if (flag_negative) buf--;
+ else buf++; /*go to next symbol*/
+ }
+ return(result);
+}
+
+void bin2asc_u32(u32 data, u8 *buf, s8 size) {
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ while (size) {
+ *buf = bin2asc_u8(data);
+ data >>= 4;
+ if (flag_negative) buf--;
+ else buf++;
+ size--;
+ if (data == 0) size = 0; /*stop conversion on zero*/
+ }
+}
+
+void num2asc_s32(s32 data, u8 *buf, u8 flags) {
+ u8 cnt_chars = (flags & 7); //number of digits
+ //convert negative to positive, set '-' flag
+ if (data < 0) {data = -data; flags |= 1;}
+ else flags &= ~1;
+ //if necessary, convert to BCD
+ //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
+ cnt_chars++;
+ //calculate point position
+ u8 point_pos = cnt_chars - ((flags >> 4) & 7);
+ if (point_pos) point_pos++;
+ flags |= 2;
+ while (cnt_chars) { //digits conversion loop
+ if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
+ if (flags & 1) *buf = asc_minus;
+ else if (flags & 2) *buf = '0';
+ else *buf = asc_space;
+ flags &= ~1;
+ } else {
+ //show point
+ if ((cnt_chars == point_pos) && (flags & 0x70)) {
+ *buf-- = asc_point;
+ cnt_chars--;
+ }
+ *buf = bin2asc_u8(data); //show ASCII digit
+ }
+ cnt_chars--;
+ buf--;
+ data >>= 4;
+ flags &= ~2;
+ }
+ if (flags & 1) *buf = asc_minus;
+}
+
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
+{
+ uint8_t len_msg = 0;
+ uint8_t i = 0;
+ uint8_t check = 160;
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x00)
+ Str[j] = '@';
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x11)
+ Str[j] = '_';
+
+ while((i < len) && (check--))
+ {
+ if(*Str == 0x1B)
+ {
+ // |
+ if(*(uint16_t*)Str == 0x401B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '|';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // "\"
+ if(*(uint16_t*)Str == 0x2F1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '\\';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ^
+ if(*(uint16_t*)Str == 0x141B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '^';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // [
+ if(*(uint16_t*)Str == 0x3C1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '[';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ]
+ if(*(uint16_t*)Str == 0x3E1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = ']';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // {
+ if(*(uint16_t*)Str == 0x281B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '{';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // }
+ if(*(uint16_t*)Str == 0x291B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '}';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ~
+ if(*(uint16_t*)Str == 0x3D1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '~';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // euro
+ if(*(uint16_t*)Str == 0x651B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '?';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+ }
+ else
+ {
+ i++;
+ len_msg++;
+ Str++;
+ }
+ }
+
+ return len_msg;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_7to8(uint8_t *a, uint8_t len)
+{
+ //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
+ //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
+ //'Hello!' -> C8 32 9B FD 0E 01
+ if (len == 0)
+ len = s_len(a,0);
+
+ a[len] = 0;
+ len++;
+
+ // Correct symbol @
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '@')
+ a[j] = 0x00;
+
+ // Correct symbol _
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '_')
+ a[j] = 0x11;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len-2); i1++)
+ {
+ for (uint8_t i2=(len-1); i2>i1; i2--)
+ {
+ a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
+ a[i2] >>= 1;
+ }
+ }
+ }
+
+ len--;
+
+ return len - (len >> 3);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_8to7(uint8_t *a, uint8_t len)
+{
+ uint8_t len1 = len + (len >> 3);
+
+ while (len < len1)
+ a[len++] = 0;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len1-1); i1++)
+ for (uint8_t i2=(len1-1); i2>i1; i2--)
+ a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
+ }
+
+ for (uint8_t i=0; i= n) ? (in_len - n) : 0;
+// }
+// }
+// return out_len;
+//}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t swap8 (uint8_t b)
+{
+ return (b << 4)|(b >> 4);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t swap16(uint16_t w)
+{
+ return (w << 8)|(w >> 8);
+}
+#include
+#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
+{
+ if (len == 0)
+ return;
+
+ len >>= 1;
+
+ while (len--)
+ {
+ *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
+ h += 2;
+ }
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
+{
+ if (len == 0)
+ return;
+
+ b += len-1; h += ((uint16_t)len << 1) - 1;
+ while (len--)
+ {
+ *h-- = s_b2h4(*b & 0xF);
+ *h-- = s_b2h4(*b-- >> 4);
+ }
+}
+
+
+uint8_t convert_binary_coded_to_decimal(uint8_t hex)
+{
+ uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
+ return dec;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+/*DCS decoding function*/
+dcs_struct pdu_decode_dcs(uint8_t tp_dcs)
+{
+ dcs_struct sm_dcs;
+ uint8_t alpha_byte, class_byte;
+
+ if ( ( (tp_dcs & 0xc0) == 0)) /* coding group: 00xx */
+ {
+ if ( tp_dcs & 0x20 )
+ sm_dcs.smCompressed = 1; /* compressed */
+ else
+ sm_dcs.smCompressed = 0;
+
+
+ alpha_byte = ( tp_dcs & 0x0c ) >> 2; /* alphabet */
+ if ( alpha_byte == 0 )
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ else if ( alpha_byte == 1 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else if ( alpha_byte == 2 )
+ sm_dcs.smAlphabet = PDU_DCS_UCS2;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_AUTO;
+
+ if ( tp_dcs & 0x10 ) /* bit 1 and 0 have class meaning */
+ {
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ }
+ else
+ sm_dcs.smClass = noClass;
+
+ } else if ( (tp_dcs >> 4) == 0x0f ){ /* coding group: 1111 */
+ sm_dcs.smCompressed = 0;
+
+ if ( tp_dcs & 0x04 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_7;
+
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ } else {/* reserved codings groups: assume 7 bit, uncompressed, class 2 */
+
+ sm_dcs.smCompressed = 0;
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ sm_dcs.smClass = class2;
+ }
+ return sm_dcs;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ int8_t tz_sign = 1;
+ dcs_struct sm_dcs; /*Added dcs decoding in alphabet, class and compressed*/
+
+ if (len == 0)
+ len = s_len(in, 0);
+
+ len >>= 1;
+
+ out->smsc.len = in[0];
+ out->smsc.bytes = out->smsc.len - 1;
+
+ if (in[0] == 7)
+ {
+ out->smsc.type = in[1];
+ for (uint8_t i=0; i<(out->smsc.bytes); i++)
+ out->smsc.data[i] = in[i+2];
+ }
+
+ in += out->smsc.len + 1;
+
+ out->first = *in++;
+ out->sender.len = *in++;
+ out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
+ out->sender.type = *in++;
+ for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
+ out->sender.data[i] = *in++;
+
+ out->tp_pid = *in++;
+ out->tp_dcs = *in++;
+
+ out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
+ //*in = 0x4a;
+ out->tz = swap8( *in++ );
+
+ if ((out->tz & 0x80) == 0x80)
+ {
+ tz_sign = -1;
+ }
+
+ out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
+
+ out->msg.len = out->msg.bytes = *in++;
+
+ // correction for 7-bit encoding
+
+ /*Now dcs has been correctly decoded*/
+ sm_dcs = pdu_decode_dcs(out->tp_dcs);
+ out->tp_dcs = sm_dcs.smAlphabet;
+ /**/
+ if (out->tp_dcs == PDU_DCS_7)
+ out->msg.bytes -= (out->msg.bytes >> 3);
+ // decode message text (if output buffer is given)
+ out->msg.data = in;
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ pdu_hex2bytes(in, len, in);
+ pdu_in_decode_binary(in, len, out);
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+#if 1
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+ if (pdu_get_output_format() == UTF8_default) {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ } else if(pdu_get_output_format() == HEX_raw) {
+ uint16_t i, j;
+ uint8_t tmpByte;
+
+ j = 0;
+
+ for ( i = 0; i < in_bytes; i++ )
+ {
+
+ tmpByte = ( in[i] & 0x00FF );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0xF0 ) >> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+
+ }
+
+ in_bytes = j;
+ out += in_bytes;
+ }
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ for (uint8_t i=0; i> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+ }
+ //out[j] = '\0';
+ in_bytes = j;
+ out += in_bytes;
+ } else {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ }
+ }
+ }
+
+ *out = 0;
+
+ return in_bytes;
+}
+
+
+#else //original
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ }
+
+ for (uint8_t i=0; ismsc.len;
+ // fill SMSC data
+ if (in->smsc.len)
+ {
+ *out++ = in->smsc.type;
+ for (uint8_t i=0; i<(in->smsc.len-1); i++)
+ *out++ = in->smsc.data[i];
+ len = in->smsc.len;
+ }
+
+ *out++ = in->first; // 1st octet (0x11)
+ *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+
+ in->sender.bytes = pdu_phone_bytes(in->sender.data);
+ in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
+ *out++ = in->sender.len; // address length, digits
+ *out++ = in->sender.type; // type-of-address
+ for (uint8_t i=0; isender.bytes; i++)
+ *out++ = in->sender.data[i];
+
+ *out++ = in->tp_pid; // TP-PID. Protocol identifier
+
+ if (in->tp_dcs == PDU_DCS_AUTO)
+ in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
+
+ *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
+
+ *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
+ len += in->sender.bytes + 8;
+
+ // add message
+ in->msg.len = s_len(in->msg.data,0);
+
+ if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
+ {
+ in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
+ *out++ = in->msg.len;
+ }
+ else
+ {
+ *out++ = in->msg.len;
+ s_copy(in->msg.data, 0, out);
+ if (in->tp_dcs == PDU_DCS_7)
+ in->msg.bytes = pdu_7to8(out, in->msg.len);
+ else
+ in->msg.bytes = in->msg.len;
+ }
+
+ out -= len;
+ len += in->msg.bytes;
+ pdu_bytes2hex(out, len, out);
+ in->len_bytes = len << 1;
+ in->len_cmgs = len - in->smsc.len - 1;
+ out[in->len_bytes] = 0;
+
+ return in->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
+{
+ pdu->first = 0x11;
+ pdu->tp_msg_ref = 0;
+ pdu->tp_pid = 0;
+ pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
+
+ pdu->smsc.len = 0;
+
+ pdu->sender.type = PDU_TYPE_INTERNATIONAL;
+
+
+ if (pdu_phone_is_packed((uint8_t *)sender)) {
+ pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
+ }
+ else{
+ pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
+ }
+
+
+ //pdu->tp_dcs = PDU_DCS_AUTO;
+ //pdu->tp_dcs = PDU_DCS_8;
+ pdu->tp_dcs = dcs;
+ pdu->msg.data = (uint8_t *)msg;
+
+ pdu_out_encode(pdu, out);
+
+ return pdu->len_bytes;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
+{
+ uint8_t n = 0;
+
+ if (*in == '+')
+ in++;
+
+ while ((*in >= '0')&&(*in <= '9'))
+ {
+ *out = s_h2b4(*in++);
+ if (*in)
+ {
+ *out |= s_h2b4(*in) << 4;
+ in++;
+ n++;
+ }
+ else
+ *out |= 0xF0;
+
+ n++;
+ out++;
+ }
+
+ *out = 0xFF;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
+{
+ uint8_t n = 0;
+
+ if (type == PDU_TYPE_INTERNATIONAL)
+ *out++ = '+';
+
+ while (len--)
+ {
+ *out++ = s_b2h4(*in & 0xF);
+ n++;
+
+ if ((*in & 0xF0) != 0xF0)
+ {
+ *out++ = s_b2h4(*in >> 4);
+ n++;
+ }
+
+ in++;
+ }
+
+ *out = 0;
+
+ return n;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_is_packed(uint8_t *phone)
+{
+ return *phone != '+';
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits_bytes(uint8_t digits)
+{
+ return (digits + (digits & 1)) >> 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_bytes(uint8_t *in)
+{
+ uint8_t len = 0;
+
+ while (*in++ != 0xFF)
+ len++;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
+{
+ uint8_t len = bytes << 1;
+
+ if ((in[bytes-1] & 0xF0) == 0xF0)
+ len--;
+
+ return len;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
+{
+ if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
+ return 0;
+
+ while (in1_bytes--) if (*in1++ != *in2++)
+ return 0;
+
+ return 1;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_phone_copy(uint8_t *in, uint8_t *out)
+{
+ if (in == out)
+ return;
+
+ uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
+
+ while (*in != eop)
+ *out++ = *in++;
+
+ *out = eop;
+}
+
+//Functions to convert SMS text in raw hex output (as specified by 3GPP TS 27.005)
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format)
+{
+ out_fmt = output_format;
+}
+
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void)
+{
+ return out_fmt;
+}
+
+static const uint8_t ha_form[] =
+{
+ '0',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F'
+};
+
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb)
+{
+ /* convert it into ASCII code */
+ return (ha_form[(LV_nmb & 0x0F)]);
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h
new file mode 100755
index 00000000..33438ac2
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduCommon.h
@@ -0,0 +1,369 @@
+/*
+ * azx_common.h
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#ifndef AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+#define AZX_PDU_CODEC_AZX_PDUCOMMON_H_
+
+#include
+#include
+
+#ifndef offsetof
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+#endif
+#ifndef countof
+#define countof(arg) (sizeof(arg) / sizeof(arg[0]))
+#endif
+
+//attributes
+#define WEAK __attribute__ ((weak))
+#define NAKED __attribute__ ((naked))
+#define INTERRUPT __attribute__ ((__interrupt__))
+#define USED __attribute__ ((used))
+#define NORETURN __attribute__ ((noreturn))
+#define SECTION(s) __attribute__ ((section(s)))
+#define NOINIT SECTION(".noinit")
+#define ALIAS(a) __attribute__ ((weak, alias (a)))
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define OPTIMIZE(level) __attribute__ ((optimize(level)))
+
+//architecture-specific inlines
+#ifdef __AVR
+#define wdr() asm volatile("wdr")
+#define nop() asm volatile("nop")
+#define sleep() asm volatile("sleep")
+#else
+#define PROGMEM
+#endif
+
+#ifdef __i8051
+#define cli() EI = 0
+#define sei() EI = 1
+#endif
+
+#ifdef __STM8
+#define cli() _asm("sim")
+#define sei() _asm("rim")
+#define nop() _asm("nop")
+#define wdr() { IWDG_KR = 0xAA; }
+#endif
+
+#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
+#define cli() asm volatile ( "CPSID i \n" )
+#define sei() asm volatile ( "CPSIE i \n" )
+#endif
+
+//short named types
+typedef uint8_t u8;
+typedef int8_t s8;
+typedef uint16_t u16;
+typedef int16_t s16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+typedef int64_t s64;
+typedef float f32;
+typedef double f64;
+#ifdef __float128
+typedef __float128 f128;
+#endif
+
+//bit mask
+#define B(_b) (1 << (_b))
+#define BIT(_b) (1 << (_b))
+
+//Increment/decrement, Add/Subtract with range rollover/limit
+#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
+#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
+#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
+#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
+#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
+#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
+#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
+#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
+#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
+#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
+#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
+#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+#ifdef __ARM_ARCH_7M__
+//ARM Cortex BitBand access macros
+#define BITBAND_SRAM_REF 0x20000000
+#define BITBAND_SRAM_BASE 0x22000000
+// Convert SRAM address
+#define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
+#define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
+
+#define BITBAND_PERI_REF 0x40000000
+#define BITBAND_PERI_BASE 0x42000000
+// Convert PERIPHERAL address
+#define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
+#define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
+#endif
+
+//memset - simple verion
+void *memset2(void *dest, int val, size_t len);
+//memcpy - simple verion
+void *memcpy2(void *dest, const void *src, size_t len);
+
+extern u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n);
+
+
+// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
+// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
+
+// convert UCS2 codepoint to UTF8, returns number of bytes processed
+u8 ucs2_to_utf8(u32 in, u8 *out);
+// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
+
+
+// find length of line, terminated by eol char
+u16 s_len(u8 *s, u8 eol);
+
+// number of lines, separated by eol char
+u8 s_lines(u8 *s, u16 len, u8 eol);
+
+u8 c_upcase(u8 c);
+// uppercase string, in-place
+void s_upcase(u8 *s, u16 len);
+
+u8 s_h2b4(u8 hex);
+u8 s_b2h4(u8 b);
+
+// find start of line, delimited by eol char
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
+
+// skip CR/LF chars
+u8 *s_skip_crlf(u8 *s);
+
+// compare 2 strings, returns 1 if equal
+u8 s_cmp(u8 *s1, u8 *s2, u16 len);
+// compare 2 strings, upper-casing each char, returns 1 if equal
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
+
+// check if s starts with start
+u8 s_starts(u8 *s, char *start);
+// check if s ends with end
+u8 s_ends(u8 *s, char *end);
+
+// finds 1st occurence of char c, returns NULL if not found
+u8 *s_cpos(u8 *s, u8 c, u8 eol);
+
+// check if string is 7-bit
+u8 s_is_7bit(u8 *s, u8 eol);
+
+// copy in string (terminated by eol char) to out
+u8 *s_copy(u8 *in, u8 eol, u8 *out);
+
+
+// append string out to in, returns pointer after last char
+u8 *s_append_s (u8 *out, char *in);
+// append char to string buffer
+u8 *s_append_c (u8 *out, u8 c);
+// append Hex char to string buffer
+u8 *s_append_h4 (u8 *out, u8 n);
+// append Hex byte to string buffer
+u8 *s_append_h8 (u8 *out, u8 n);
+// append 16-bit Hex to string buffer
+u8 *s_append_h16(u8 *out, u16 n);
+// append 24-bit Hex to string buffer
+u8 *s_append_h24(u8 *out, u32 n);
+// append 32-bit Hex to string buffer
+u8 *s_append_h32(u8 *out, u32 n);
+
+
+// parse decimal number
+u32 s_parse_dec(u8 *s, u8 len);
+// parse hex number
+u32 s_parse_hex(u8 *s, u8 len);
+
+extern u8 asc_point;
+extern u8 asc_space;
+extern u8 asc_minus;
+
+/** convert lower nibble to HEX symbol */
+#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
+
+/** 8-bit BCD->BIN conversion */
+u8 bcd2bin_u8( u8 bcd );
+/** 8-bit BIN->BCD conversion */
+u8 bin2bcd_u8( u8 bin );
+
+// 32-bit BIN->BCD conversion using shifts and correction
+//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
+
+// 32-bit BIN->BCD conversion using hardware divider
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using ldiv
+u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
+
+// 32-bit BIN->BCD conversion using fast soft div
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
+
+// 32-bit BCD->BIN conversion
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
+
+u8 asc2bin_u8(u8 data);
+u8 bin2asc_u8(u8 data);
+u32 asc2bin_u32(u8 *buf, s8 size);
+void bin2asc_u32(u32 data, u8 *buf, s8 size);
+
+// AVR-optimized conversions
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
+u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
+#endif
+
+/** convert 32-bit signed data to ASCII number to buffer (right to left)
+ * options & 7 - width-1,
+ * (options >> 4) & 7 - point position,
+ * options & 0x08 - supress leading zeros,
+ * options & 0x80 - convert to BCD.
+ */
+#define NUM2ASC_BCD (u8)0x80
+#define NUM2ASC_NOZEROS (u8)0x08
+#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
+#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
+#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
+void num2asc_s32(s32 data, u8 *buf, u8 flags);
+inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
+
+// calculate number width
+
+inline u8 width_i32(s32 n){
+ u8 s = 0;
+ if (n < 0){ s = 1; n = -n; }
+ return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
+ ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
+}
+
+#define SMS_PDU_MAX_SIZE 400
+
+// data coding scheme
+enum
+{
+ PDU_DCS_7 = 0,
+ PDU_DCS_8 = 0x4,
+ PDU_DCS_UCS2 = 0x08,
+ PDU_DCS_AUTO = 0xFF
+};
+
+//SMS classes
+enum
+{
+ class0 = 0,
+ class1,
+ class2,
+ class3,
+ noClass = 0xFF
+};
+
+//Output format
+typedef enum
+{
+
+ HEX_raw = 0,
+ UTF8_default
+}SMS_TXT_OUT_FMT_E;
+
+// number format
+enum
+{
+ PDU_TYPE_NATIONAL = 0xA1,
+ PDU_TYPE_INTERNATIONAL = 0x91,
+ PDU_TYPE_ALPHADET = 0xD0,
+ PDU_TYPE_NETWORK = 0xB1
+};
+
+typedef struct
+{
+ // SMSC number
+ struct{ uint8_t len, bytes, type, data[14]; }smsc;
+ // caller/sender number
+ struct{ uint8_t len, bytes, type, data[14]; }sender;
+ // input/output zero-terminated message (7bit/8bit/UTF8)
+ struct{ uint16_t len, bytes; uint8_t *data; }msg;
+
+ uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
+ uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
+ uint8_t tp_pid; // Protocol identifier (0)
+ uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
+ uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
+
+ // incoming SMS timestamp
+ uint8_t year, month, date; // date
+ uint8_t hour, min, sec; // time
+ int8_t tz; // zone
+
+ // PDU length in bytes and for CMGS command
+ uint16_t len_bytes, len_cmgs;
+}pdu_struct;
+
+typedef struct
+{
+
+ uint8_t smCompressed;
+ uint8_t smAlphabet;
+ uint8_t smClass;
+
+}dcs_struct;
+
+void pdu_set_output_format(SMS_TXT_OUT_FMT_E output_format);
+SMS_TXT_OUT_FMT_E pdu_get_output_format(void);
+uint8_t pdu_hex_to_ascii_format (uint8_t LV_nmb);
+
+// Change GSM 7-bit table to ANSI
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
+// pack 7-bit array to 8-bit
+uint8_t pdu_7to8(uint8_t *a, uint8_t len);
+// unpack 8-bit array to 7-bit
+uint8_t pdu_8to7(uint8_t *a, uint8_t len);
+
+// convert HEX line to bytes, len - length of input buffer
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
+// convert bytes to HEX line, len - length of input buffer
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
+
+// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
+
+// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
+// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
+
+// encode outcoming PDU
+uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
+// encode outcoming PDU, simple interface
+uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
+
+// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
+uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
+// unpack phone number to string, returns number of unpacked digits
+uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
+// check if phone is packed
+uint8_t pdu_phone_is_packed(uint8_t *phone);
+
+// get number of bytes from number of digits
+uint8_t pdu_phone_digits_bytes(uint8_t digits);
+// get number of bytes of packed phone
+uint8_t pdu_phone_bytes(uint8_t *in);
+// count number of digits
+uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
+
+// compare 2 packed phones
+uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
+// copy packed phone
+void pdu_phone_copy(uint8_t *in, uint8_t *out);
+
+#endif /* AZX_PDU_CODEC_AZX_PDUCOMMON_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
index fcc37bb3..42ad15d1 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.c
@@ -28,7 +28,7 @@
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
#include "azx_pduDec.h"
/* Local defines ================================================================================*/
@@ -87,9 +87,10 @@ INT32 azx_pdu_decode(UINT8 *pdu, UINT32 pdu_len, pdu_struct *packet, CHAR *numbe
//fill result buffer
+ /*Now dcs has been correctly decoded, including 8 bit case*/
pdu_in_decode_text(packet->msg.data,
packet->msg.len,
- (packet->tp_dcs == 0x00 ? PDU_DCS_7:PDU_DCS_UCS2),
+ (packet->tp_dcs),
(UINT8*)msg);
len_msg = packet->msg.len;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
index d0042998..3e6fb59d 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduDec.h
@@ -29,7 +29,7 @@
/** \defgroup pduDecUsage Usage of pdu decoding functionalities
* Functions usable to retrieve ASCII message and other info from a PDU message in binary format
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
index 525a6654..68617866 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.c
@@ -26,7 +26,8 @@
#include
#include "m2mb_types.h"
-#include "ul_gsm_pdu.h"
+
+#include "azx_pduCommon.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
index efe858ff..42a85ef4 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/azx_pduEnc.h
@@ -30,7 +30,7 @@
/** \defgroup pduEncUsage Usage of pdu encoding functionalities
* Functions usable to create a PDU message from a string text
*/
-
+#include "azx_pduCommon.h"
/*-----------------------------------------------------------------------------------------------*/
/**
@brief
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/readme b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/readme
old mode 100644
new mode 100755
index be00a200..98184a07
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/readme
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/readme
@@ -1,3 +1,3 @@
@brief Utility code to simplify parse/encode binary PDU to be used with `m2mb_sms_*` APIs
-@version 1.0.0
+@version 1.0.3
@dependencies
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c
deleted file mode 100755
index 7f4c0530..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * gsm_pdu.c
- *
- * Created on: Sep 15, 2014
- * Author: qwer
- */
-#include
-#include
-#include "ul_gsm_pdu.h"
-#include "ul_s.h"
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
-{
- uint8_t len_msg = 0;
- uint8_t i = 0;
- uint8_t check = 160;
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x00)
- Str[j] = '@';
-
- for(uint8_t j = 0; j < len; j++)
- if(Str[j] == 0x11)
- Str[j] = '_';
-
- while((i < len) && (check--))
- {
- if(*Str == 0x1B)
- {
- // |
- if(*(uint16_t*)Str == 0x401B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '|';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // "\"
- if(*(uint16_t*)Str == 0x2F1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '\\';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ^
- if(*(uint16_t*)Str == 0x141B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '^';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // [
- if(*(uint16_t*)Str == 0x3C1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '[';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ]
- if(*(uint16_t*)Str == 0x3E1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = ']';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // {
- if(*(uint16_t*)Str == 0x281B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '{';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // }
- if(*(uint16_t*)Str == 0x291B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '}';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // ~
- if(*(uint16_t*)Str == 0x3D1B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '~';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
-
- // euro
- if(*(uint16_t*)Str == 0x651B)
- {
- char BuffEnd[161];
- char *a = Str + 2;
- strcpy(&BuffEnd[0], a);
- *Str = '?';
- Str++;
- *Str = 0;
- strcat(Str, &BuffEnd[0]);
- i+=2;
- len_msg++;
- }
- }
- else
- {
- i++;
- len_msg++;
- Str++;
- }
- }
-
- return len_msg;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_7to8(uint8_t *a, uint8_t len)
-{
- //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
- //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
- //'Hello!' -> C8 32 9B FD 0E 01
- if (len == 0)
- len = s_len(a,0);
-
- a[len] = 0;
- len++;
-
- // Correct symbol @
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '@')
- a[j] = 0x00;
-
- // Correct symbol _
- for(uint8_t j = 0; j < len; j++)
- if(a[j] == '_')
- a[j] = 0x11;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len-2); i1++)
- {
- for (uint8_t i2=(len-1); i2>i1; i2--)
- {
- a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
- a[i2] >>= 1;
- }
- }
- }
-
- len--;
-
- return len - (len >> 3);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_8to7(uint8_t *a, uint8_t len)
-{
- uint8_t len1 = len + (len >> 3);
-
- while (len < len1)
- a[len++] = 0;
-
- if (len > 0)
- {
- for (uint8_t i1=0; i1<(len1-1); i1++)
- for (uint8_t i2=(len1-1); i2>i1; i2--)
- a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
- }
-
- for (uint8_t i=0; i= n) ? (in_len - n) : 0;
-// }
-// }
-// return out_len;
-//}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t swap8 (uint8_t b)
-{
- return (b << 4)|(b >> 4);
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t swap16(uint16_t w)
-{
- return (w << 8)|(w >> 8);
-}
-#include
-#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
-{
- if (len == 0)
- return;
-
- len >>= 1;
-
- while (len--)
- {
- *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
- h += 2;
- }
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
-{
- if (len == 0)
- return;
-
- b += len-1; h += ((uint16_t)len << 1) - 1;
- while (len--)
- {
- *h-- = s_b2h4(*b & 0xF);
- *h-- = s_b2h4(*b-- >> 4);
- }
-}
-
-
-uint8_t convert_binary_coded_to_decimal(uint8_t hex)
-{
- uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
- return dec;
-}
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- int8_t tz_sign = 1;
- if (len == 0)
- len = s_len(in, 0);
-
- len >>= 1;
-
- out->smsc.len = in[0];
- out->smsc.bytes = out->smsc.len - 1;
-
- if (in[0] == 7)
- {
- out->smsc.type = in[1];
- for (uint8_t i=0; i<(out->smsc.bytes); i++)
- out->smsc.data[i] = in[i+2];
- }
-
- in += out->smsc.len + 1;
-
- out->first = *in++;
- out->sender.len = *in++;
- out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
- out->sender.type = *in++;
- for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
- out->sender.data[i] = *in++;
-
- out->tp_pid = *in++;
- out->tp_dcs = *in++;
-
- out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
- out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
- //*in = 0x4a;
- out->tz = swap8( *in++ );
-
- if ((out->tz & 0x80) == 0x80)
- {
- tz_sign = -1;
- }
-
- out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
-
- out->msg.len = out->msg.bytes = *in++;
-
- // correction for 7-bit encoding
- if (out->tp_dcs == PDU_DCS_7)
- out->msg.bytes -= (out->msg.bytes >> 3);
-
- // decode message text (if output buffer is given)
- out->msg.data = in;
-}
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
-{
- pdu_hex2bytes(in, len, in);
- pdu_in_decode_binary(in, len, out);
-}
-
-
-
-
-
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
-{
- if (in_dcs == PDU_DCS_UCS2)
- {
- in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
- out += in_bytes;
- }
- else
- {
- if (in_dcs == PDU_DCS_7)
- {
- in_bytes += in_bytes >> 3;
- pdu_8to7(in, in_bytes);
- }
-
- for (uint8_t i=0; ismsc.len;
- // fill SMSC data
- if (in->smsc.len)
- {
- *out++ = in->smsc.type;
- for (uint8_t i=0; i<(in->smsc.len-1); i++)
- *out++ = in->smsc.data[i];
- len = in->smsc.len;
- }
-
- *out++ = in->first; // 1st octet (0x11)
- *out++ = in->tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
-
- in->sender.bytes = pdu_phone_bytes(in->sender.data);
- in->sender.len = pdu_phone_digits(in->sender.data, in->sender.bytes);
- *out++ = in->sender.len; // address length, digits
- *out++ = in->sender.type; // type-of-address
- for (uint8_t i=0; isender.bytes; i++)
- *out++ = in->sender.data[i];
-
- *out++ = in->tp_pid; // TP-PID. Protocol identifier
-
- if (in->tp_dcs == PDU_DCS_AUTO)
- in->tp_dcs = s_is_7bit(in->msg.data, 0) ? PDU_DCS_7 : PDU_DCS_UCS2;
-
- *out++ = in->tp_dcs; // TP-DCS. Data coding scheme
-
- *out++ = in->tp_vp; // TP-Validity-Period. "AA" means 4 days
- len += in->sender.bytes + 8;
-
- // add message
- in->msg.len = s_len(in->msg.data,0);
-
- if (in->tp_dcs == PDU_DCS_UCS2)// UCS2 ? Convert from UTF8
- {
- in->msg.bytes = in->msg.len = (s_utf8_to_ucs2(in->msg.data, in->msg.len, (uint16_t *)(out+1), 1) << 1);
- *out++ = in->msg.len;
- }
- else
- {
- *out++ = in->msg.len;
- s_copy(in->msg.data, 0, out);
- if (in->tp_dcs == PDU_DCS_7)
- in->msg.bytes = pdu_7to8(out, in->msg.len);
- else
- in->msg.bytes = in->msg.len;
- }
-
- out -= len;
- len += in->msg.bytes;
- pdu_bytes2hex(out, len, out);
- in->len_bytes = len << 1;
- in->len_cmgs = len - in->smsc.len - 1;
- out[in->len_bytes] = 0;
-
- return in->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp,int dcs)
-{
- pdu->first = 0x11;
- pdu->tp_msg_ref = 0;
- pdu->tp_pid = 0;
- pdu->tp_vp = (tp_vp == 0) ? 0xAA : tp_vp;
-
- pdu->smsc.len = 0;
-
- pdu->sender.type = PDU_TYPE_INTERNATIONAL;
-
-
- if (pdu_phone_is_packed((uint8_t *)sender)) {
- pdu_phone_copy((uint8_t *)sender, pdu->sender.data);
- }
- else{
- pdu_phone_pack((uint8_t *)sender, pdu->sender.data);
- }
-
-
- //pdu->tp_dcs = PDU_DCS_AUTO;
- //pdu->tp_dcs = PDU_DCS_8;
- pdu->tp_dcs = dcs;
- pdu->msg.data = (uint8_t *)msg;
-
- pdu_out_encode(pdu, out);
-
- return pdu->len_bytes;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out)
-{
- uint8_t n = 0;
-
- if (*in == '+')
- in++;
-
- while ((*in >= '0')&&(*in <= '9'))
- {
- *out = s_h2b4(*in++);
- if (*in)
- {
- *out |= s_h2b4(*in) << 4;
- in++;
- n++;
- }
- else
- *out |= 0xF0;
-
- n++;
- out++;
- }
-
- *out = 0xFF;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type)
-{
- uint8_t n = 0;
-
- if (type == PDU_TYPE_INTERNATIONAL)
- *out++ = '+';
-
- while (len--)
- {
- *out++ = s_b2h4(*in & 0xF);
- n++;
-
- if ((*in & 0xF0) != 0xF0)
- {
- *out++ = s_b2h4(*in >> 4);
- n++;
- }
-
- in++;
- }
-
- *out = 0;
-
- return n;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_is_packed(uint8_t *phone)
-{
- return *phone != '+';
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits_bytes(uint8_t digits)
-{
- return (digits + (digits & 1)) >> 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_bytes(uint8_t *in)
-{
- uint8_t len = 0;
-
- while (*in++ != 0xFF)
- len++;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes)
-{
- uint8_t len = bytes << 1;
-
- if ((in[bytes-1] & 0xF0) == 0xF0)
- len--;
-
- return len;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes)
-{
- if ((in1_bytes != in2_bytes)||(in1_bytes == 0))
- return 0;
-
- while (in1_bytes--) if (*in1++ != *in2++)
- return 0;
-
- return 1;
-}
-
-/*******************************************************************************
- * *
- *******************************************************************************/
-void pdu_phone_copy(uint8_t *in, uint8_t *out)
-{
- if (in == out)
- return;
-
- uint8_t eop = pdu_phone_is_packed(in) ? 0xFF : 0;
-
- while (*in != eop)
- *out++ = *in++;
-
- *out = eop;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h
deleted file mode 100755
index 7fc1fa34..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_gsm_pdu.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===================================================================================*/
-/*>>> Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved. <<<*/
-/* See LICENSE file in the project root for full license information. */
-/**
- @file
- ul_gsm_pdu.h
-
- @brief
- PDU defines
- @details
- porting of original code at https://github.com/tardigrade888/c-pdu
-
- @note
- Dependencies:
- m2mb_types.h
-
- @author
-
- @date
- 24/10/2018
-*/
-#ifndef HDR_UL_GSM_PDU_H_
-#define HDR_UL_GSM_PDU_H_
-
-// data coding scheme
-enum
-{
- PDU_DCS_7 = 0,
- PDU_DCS_8 = 0x4,
- PDU_DCS_UCS2 = 0x08,
- PDU_DCS_AUTO = 0xFF
-};
-
-// number format
-enum
-{
- PDU_TYPE_NATIONAL = 0xA1,
- PDU_TYPE_INTERNATIONAL = 0x91,
- PDU_TYPE_ALPHADET = 0xD0,
- PDU_TYPE_NETWORK = 0xB1
-};
-
-typedef struct
-{
- // SMSC number
- struct{ uint8_t len, bytes, type, data[14]; }smsc;
- // caller/sender number
- struct{ uint8_t len, bytes, type, data[14]; }sender;
- // input/output zero-terminated message (7bit/8bit/UTF8)
- struct{ uint16_t len, bytes; uint8_t *data; }msg;
-
- uint8_t first; // 1st octet of the SMS-SUBMIT message (0x11)
- uint8_t tp_msg_ref; // TP-Message-Reference. The "00" value here lets the phone set the message reference number itself
- uint8_t tp_pid; // Protocol identifier (0)
- uint8_t tp_dcs; // Data coding scheme.This message is coded according to the 7bit default alphabet. Having "02" instead of "00" here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc)
- uint8_t tp_vp; // TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
-
- // incoming SMS timestamp
- uint8_t year, month, date; // date
- uint8_t hour, min, sec; // time
- int8_t tz; // zone
-
- // PDU length in bytes and for CMGS command
- uint16_t len_bytes, len_cmgs;
-}pdu_struct;
-
-// Change GSM 7-bit table to ANSI
-uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len);
-// pack 7-bit array to 8-bit
-uint8_t pdu_7to8(uint8_t *a, uint8_t len);
-// unpack 8-bit array to 7-bit
-uint8_t pdu_8to7(uint8_t *a, uint8_t len);
-
-// convert HEX line to bytes, len - length of input buffer
-void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b);
-// convert bytes to HEX line, len - length of input buffer
-void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h);
-
-// decode incoming PDU (in binary stream format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out);
-
-// decode incoming PDU (in ASCII string format) to out structure, out->msg.data points to start of incoming text
-void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out);
-// decode text PDU, in - start of incoming text, in_bytes - its length in bytes, in_dcs - Data Coding Scheme, out - output buffer, returns number of chars
-uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out);
-
-// encode outcoming PDU
-uint16_t pdu_out_encode(pdu_struct *in, uint8_t *out);
-// encode outcoming PDU, simple interface
-uint16_t pdu_out_encode_simple(pdu_struct *pdu, uint8_t *out, void *sender, void *msg, uint8_t tp_vp, int dsc);
-
-// pack text phone number to bytes, returns number of packed digits (11/12), not including terminating F
-uint8_t pdu_phone_pack(uint8_t *in, uint8_t *out);
-// unpack phone number to string, returns number of unpacked digits
-uint8_t pdu_phone_unpack(uint8_t *in, uint8_t len, uint8_t *out, uint8_t type);
-// check if phone is packed
-uint8_t pdu_phone_is_packed(uint8_t *phone);
-
-// get number of bytes from number of digits
-uint8_t pdu_phone_digits_bytes(uint8_t digits);
-// get number of bytes of packed phone
-uint8_t pdu_phone_bytes(uint8_t *in);
-// count number of digits
-uint8_t pdu_phone_digits(uint8_t *in, uint8_t bytes);
-
-// compare 2 packed phones
-uint8_t pdu_phone_cmp(uint8_t *in1, uint8_t in1_bytes, uint8_t *in2, uint8_t in2_bytes);
-// copy packed phone
-void pdu_phone_copy(uint8_t *in, uint8_t *out);
-
-#endif /* HDR_UL_GSM_PDU_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c
deleted file mode 100644
index 338ee2d1..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.c
+++ /dev/null
@@ -1,356 +0,0 @@
-#include "ul_math_bcd.h"
-#include
-
-u8 asc_point = '.';
-u8 asc_space = ' ';
-u8 asc_minus = '-';
-
-u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
-
-u8 bin2bcd_u8( u8 bin ) {
- u8 tens = 0;
- while (bin > 9) { bin -= 10; tens++; }
- return ( (tens << 4) + bin );
-}
-
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
-
- "bin2bcd_u32_00: \n" // correct input number by left shifts
- "mov r31, %A[data] \n"
- "mov %A[data], %B[data] \n"
- "mov %B[data], %C[data] \n"
- "mov %C[data], %D[data] \n"
- "mov %D[data], r31 \n"
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_00 \n"
-
- "eor r26, r26 \n" // result=0
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %[result_bytes] \n"
- "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bin2bcd_u32_01: \n" // bits shift and correction loop
- "subi r26,-0x33 \n" // add 0x33
- "sbrs r26, 3 \n" // if carry to bit 3,
- "subi r26, 3 \n" // subtract 3
- "sbrs r26, 7 \n" // if carry to bit 7,
- "subi r26, 0x30 \n" // subtract 0x30
- "subi r27,-0x33 \n" // add 0x33
- "sbrs r27, 3 \n" // if carry to bit 3,
- "subi r27, 3 \n" // subtract 3
- "sbrs r27, 7 \n" // if carry to bit 7,
- "subi r27, 0x30 \n" // subtract 0x30
- "subi r30,-0x33 \n" // add 0x33
- "sbrs r30, 3 \n" // if carry to bit 3,
- "subi r30, 3 \n" // subtract 3
- "sbrs r30, 7 \n" // if carry to bit 7,
- "subi r30, 0x30 \n" // subtract 0x30
- "subi r31,-0x33 \n" // add 0x33
- "sbrs r31, 3 \n" // if carry to bit 3,
- "subi r31, 3 \n" // subtract 3
- "sbrs r31, 7 \n" // if carry to bit 7,
- "subi r31, 0x30 \n" // subtract 0x30
- "lsl r26 \n" // shift result number
- "rol r27 \n"
- "rol r30 \n"
- "rol r31 \n"
-
- "sbrc %D[data], 7 \n" // skip if msbit of input == 0
- "ori r26, 1 \n" // set lsb of output
- "lsl %A[data] \n" // shift input number
- "rol %B[data] \n"
- "rol %C[data] \n"
- "rol %D[data] \n"
-
- "dec __tmp_reg__ \n"
- "brne bin2bcd_u32_01 \n" // repeat for all bits
-
- //"mov %A[result], r26 \n" // move to result
- //"mov %B[result], r27 \n"
- //"mov %C[result], r30 \n"
- //"mov %D[result], r31 \n"
-
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result) // output
- :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
- :"r26","r27","r30","r31" // clobbers
- );
- return result;
- }
-#endif
-
-u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
- data <<= 8;
- for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
- /*result BCD nibbles correction*/
- result += 0x33333333;
- /*result correction loop*/
- for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
- u8 corr_byte = result >> 24;
- if (!(corr_byte & 0x08)) corr_byte -= 0x03;
- if (!(corr_byte & 0x80)) corr_byte -= 0x30;
- result <<= 8; /*shift result*/
- result += corr_byte; /*set 8 bits of result*/
- }
- /*shift next bit of input to result*/
- result <<= 1;
- if (((u8)(data >> 24)) & 0x80)
- result |= 1;
- data <<= 1;
- }
- return(result);
-}
-
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
- u32 result = 0;
- result_bytes = 0;
- while (data > 0) {
- result += (data % 10) << result_bytes;
- data /= 10;
- result_bytes += 4;
- }
- return result;
-}
-
-u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
- static ldiv_t bin2bcd_ldiv_result;
- bin2bcd_ldiv_result.quot = value;
- u32 result = 0;
- nbytes = 0;
- while (bin2bcd_ldiv_result.quot > 0) {
- bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
- result += bin2bcd_ldiv_result.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-struct divmod10_t {
- uint32_t quot;
- uint8_t rem;
-} divmodu10_res;
-inline static void divmodu10(u32 n) {
- divmodu10_res.quot = n >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 1;
- divmodu10_res.quot += divmodu10_res.quot >> 4;
- divmodu10_res.quot += divmodu10_res.quot >> 8;
- divmodu10_res.quot += divmodu10_res.quot >> 16;
- u32 qq = divmodu10_res.quot & ~7ul;
- divmodu10_res.quot >>= 3;
- divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
- if (divmodu10_res.rem > 9) {
- divmodu10_res.rem -= 10;
- divmodu10_res.quot++;
- }
-}
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
- u32 result = 0; nbytes = 0;
- divmodu10_res.quot = value;
- while (divmodu10_res.quot != 0) {
- divmodu10(divmodu10_res.quot);
- result += divmodu10_res.rem << nbytes;
- nbytes += 4;
- }
- return result;
-}
-
-#ifdef __AVR__
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
- u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
- u32 result;
- asm volatile (
- "push __tmp_reg__ \n"
- "eor r26, r26 \n" /* result = 0 */
- "eor r27, r27 \n"
- "eor r30, r30 \n"
- "eor r31, r31 \n"
- "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
- "lsl __tmp_reg__ \n"
-
- "bcd2bin_u32_00: \n" /* bits shift and correction loop */
- "lsr r31 \n" /* shift out buffer */
- "ror r30 \n"
- "ror r27 \n"
- "ror r26 \n"
-
- "sbrc %A[data], 0 \n" /* move lowest bit to result */
- "ori r31, 0x80 \n"
-
- "lsr %D[data] \n"
- "ror %C[data] \n"
- "ror %B[data] \n"
- "ror %A[data] \n"
-
- "sbrc %D[data], 7 \n" /* if carry to bit 7, */
- "subi %D[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %D[data], 3 \n" /* if carry to bit 3, */
- "subi %D[data], 3 \n" /* subtract 3 */
- "sbrc %C[data], 7 \n" /* if carry to bit 7, */
-
- "subi %C[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %C[data], 3 \n" /* if carry to bit 3, */
- "subi %C[data], 3 \n" /* subtract 0x30 */
- "sbrc %B[data], 7 \n" /* if carry to bit 7, */
- "subi %B[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %B[data], 3 \n" /* if carry to bit 3, */
- "subi %B[data], 3 \n" /* subtract 3 */
- "sbrc %A[data], 7 \n" /* if carry to bit 7, */
- "subi %A[data], 0x30 \n" /* subtract 0x30 */
- "sbrc %A[data], 3 \n" /* if carry to bit 3, */
- "subi %A[data], 3 \n" /* subtract 3 */
-
- "dec __tmp_reg__ \n" /* repeat for all bits */
- "brne bcd2bin_u32_00 \n"
-
-// "movw %A[result], r26 \n" /* adjust result */
-// "movw %C[result], r30 \n"
- "mov r22, r26 \n" // move to result
- "mov r23, r27 \n"
- "mov r24, r30 \n"
- "mov r25, r31 \n"
-
- "bcd2bin_u32_01: \n"
- "mov __tmp_reg__,r25 \n"
- "mov r25,r24 \n"
- "mov r24,r23 \n"
- "mov r23,r22 \n"
- "mov r22,__tmp_reg__ \n"
- "dec %[result_bytes] \n"
- "brne bcd2bin_u32_01 \n"
-
- "pop __tmp_reg__ \n"
- "ret \n"
- :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
- );
- return result;
- }
-#endif
-
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
- u32 result = 0; /*result*/
- for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
- /*shift next bit*/
- result >>= 1;
- if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
- data >>= 1;
- /* result BCD correction */
- for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
- u8 tmp_byte = (data >> 24);
- if (tmp_byte & 0x80) tmp_byte -= 0x30;
- if (tmp_byte & 0x08) tmp_byte -= 0x03;
- data <<= 8;
- data |= tmp_byte;
- }
- }
- /*adjust result bytes*/
- for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
- result >>= 8;
- return(result);
-}
-
-u8 asc2bin_u8(u8 data) {
- if ((data >= '0') && (data <= '9')) data -= '0';
- else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
- else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
- else data = 0xf0;
- return(data);
-}
-
-u8 bin2asc_u8(u8 data) {
- data &= 0xf;
- return (data > 9) ? (data + 'A' - 10) : (data + '0');
-}
-
-u32 asc2bin_u32(u8 *buf, s8 size) {
- u32 result;
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- result = 0;
- while(size) {
- u8 tmp_u8 = asc2bin_u8(*buf);
- if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
- result <<= 4;
- result |= tmp_u8;
- }
- size--;
- if (flag_negative) buf--;
- else buf++; /*go to next symbol*/
- }
- return(result);
-}
-
-void bin2asc_u32(u32 data, u8 *buf, s8 size) {
- u8 flag_negative;
- if (size < 0) {
- flag_negative = 1;
- size = -size;
- } else
- flag_negative = 0;
- while (size) {
- *buf = bin2asc_u8(data);
- data >>= 4;
- if (flag_negative) buf--;
- else buf++;
- size--;
- if (data == 0) size = 0; /*stop conversion on zero*/
- }
-}
-
-void num2asc_s32(s32 data, u8 *buf, u8 flags) {
- u8 cnt_chars = (flags & 7); //number of digits
- //convert negative to positive, set '-' flag
- if (data < 0) {data = -data; flags |= 1;}
- else flags &= ~1;
- //if necessary, convert to BCD
- //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
- cnt_chars++;
- //calculate point position
- u8 point_pos = cnt_chars - ((flags >> 4) & 7);
- if (point_pos) point_pos++;
- flags |= 2;
- while (cnt_chars) { //digits conversion loop
- if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
- if (flags & 1) *buf = asc_minus;
- else if (flags & 2) *buf = '0';
- else *buf = asc_space;
- flags &= ~1;
- } else {
- //show point
- if ((cnt_chars == point_pos) && (flags & 0x70)) {
- *buf-- = asc_point;
- cnt_chars--;
- }
- *buf = bin2asc_u8(data); //show ASCII digit
- }
- cnt_chars--;
- buf--;
- data >>= 4;
- flags &= ~2;
- }
- if (flags & 1) *buf = asc_minus;
-}
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h
deleted file mode 100644
index cbb417f9..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_math_bcd.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ul_bcd.h
- *
- * Created on: Sep 11, 2011
- * Author: qwer1
- */
-
-#ifndef UL_BCD_H_
-#define UL_BCD_H_
-
-#include "ul_other.h"
-
-extern u8 asc_point;
-extern u8 asc_space;
-extern u8 asc_minus;
-
-/** convert lower nibble to HEX symbol */
-#define to_hex(bbb) (((bbb) & 0xF) > 9 ? ((bbb) & 0xF) + ('a' - 10) : ((bbb) & 0xF) + '0')
-
-/** 8-bit BCD->BIN conversion */
-u8 bcd2bin_u8( u8 bcd );
-/** 8-bit BIN->BCD conversion */
-u8 bin2bcd_u8( u8 bin );
-
-// 32-bit BIN->BCD conversion using shifts and correction
-//u32 bin2bcd_u32_soft(u32 data, u8 result_bytes); AlbertoLe: function never called by our test, implementation not present, commented
-
-// 32-bit BIN->BCD conversion using hardware divider
-u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using ldiv
-u32 bin2bcd_u32_ldiv(u32 data, u8 result_bytes);
-
-// 32-bit BIN->BCD conversion using fast soft div
-u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes);
-
-// 32-bit BCD->BIN conversion
-u32 bcd2bin_u32_soft(u32 data, u8 input_bytes);
-
-u8 asc2bin_u8(u8 data);
-u8 bin2asc_u8(u8 data);
-u32 asc2bin_u32(u8 *buf, s8 size);
-void bin2asc_u32(u32 data, u8 *buf, s8 size);
-
-// AVR-optimized conversions
-#ifdef __AVR__
- u32 bin2bcd_u32_avr(u32 data, u8 result_bytes);
- u32 bcd2bin_u32_avr(u32 data, u8 input_bytes);
-#endif
-
-/** convert 32-bit signed data to ASCII number to buffer (right to left)
- * options & 7 - width-1,
- * (options >> 4) & 7 - point position,
- * options & 0x08 - supress leading zeros,
- * options & 0x80 - convert to BCD.
- */
-#define NUM2ASC_BCD (u8)0x80
-#define NUM2ASC_NOZEROS (u8)0x08
-#define NUM2ASC_FLAGS( w, p, bcd, nozeros) (u8)( (((u8)((w)-1))&7) + ((u8)((p)<<4)) + ((bcd) * NUM2ASC_BCD) + ((nozeros) * NUM2ASC_NOZEROS) )
-#define NUM2ASC_s32( data, buf, w, p, bcd, nozeros ) num2asc_s32( data, buf, NUM2ASC_FLAGS( (w), (p), (bcd), (nozeros) ))
-#define NUM2ASC_WIDTH( flags ) ((flags & 7) + 1)
-void num2asc_s32(s32 data, u8 *buf, u8 flags);
-inline void num2asc_i32(u8 *buf, s32 n, u8 w, u8 p, u8 bcd, u8 nozeros){ NUM2ASC_s32(n, buf, w,p, bcd,nozeros); }
-
-// calculate number width
-
- inline u8 width_i32(s32 n){
- u8 s = 0;
- if (n < 0){ s = 1; n = -n; }
- return (((u32)n < 10uL) ? 1 : ((u32)n < 100uL) ? 2 : ((u32)n < 1000uL) ? 3 : ((u32)n < 10000uL) ? 4 : ((u32)n < 100000uL) ? 5 :
- ((u32)n < 1000000uL) ? 6 : ((u32)n < 10000000uL) ? 7 : ((u32)n < 100000000uL) ? 8 : ((u32)n < 1000000000uL) ? 9 : 10) + s;
-}
-
-
-#endif /* UL_BCD_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.c
deleted file mode 100644
index 052a3565..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ul_other.c
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#include "ul_other.h"
-
-void *memset2(void *dest, int val, size_t len) {
- u8 *dest1 = (u8*) dest;
- while (len--) *dest1++ = (u8)val;
- return dest;
-}
-
-void *memcpy2(void *dest, const void *src, size_t len) {
- u8 *dest1 = (u8 *) dest;
- u8 *src1 = (u8 *)src;
- while (len--) *dest1++ = *src1++;
- return dest;
-}
-
-u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n) {
- u32 quot = n >> 1;
- quot += quot >> 1;
- quot += quot >> 4;
- quot += quot >> 8;
- quot += quot >> 16;
- u32 qq = quot & ~7ul;
- quot >>= 3;
- divmod10_u32_rem = n - ((quot << 1) + qq);
- if (divmod10_u32_rem > 9) {
- divmod10_u32_rem -= 10;
- quot++;
- }
- return quot;
-}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.h
deleted file mode 100644
index 6248c057..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_other.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ul_other.h
- *
- * Created on: Sep 27, 2011
- * Author: qwer1
- */
-
-#ifndef UL_OTHER_H_
-#define UL_OTHER_H_
-
-#include
-#include
-
-#ifndef offsetof
- #define offsetof(s,m) (size_t)&(((s *)0)->m)
-#endif
-#ifndef countof
- #define countof(arg) (sizeof(arg) / sizeof(arg[0]))
-#endif
-
-//attributes
-#define WEAK __attribute__ ((weak))
-#define NAKED __attribute__ ((naked))
-#define INTERRUPT __attribute__ ((__interrupt__))
-#define USED __attribute__ ((used))
-#define NORETURN __attribute__ ((noreturn))
-#define SECTION(s) __attribute__ ((section(s)))
-#define NOINIT SECTION(".noinit")
-#define ALIAS(a) __attribute__ ((weak, alias (a)))
-#define ALWAYS_INLINE __attribute__ ((always_inline))
-#define OPTIMIZE(level) __attribute__ ((optimize(level)))
-
-//architecture-specific inlines
-#ifdef __AVR
- #define wdr() asm volatile("wdr")
- #define nop() asm volatile("nop")
- #define sleep() asm volatile("sleep")
-#else
- #define PROGMEM
-#endif
-
-#ifdef __i8051
- #define cli() EI = 0
- #define sei() EI = 1
-#endif
-
-#ifdef __STM8
- #define cli() _asm("sim")
- #define sei() _asm("rim")
- #define nop() _asm("nop")
- #define wdr() { IWDG_KR = 0xAA; }
-#endif
-
-#if defined( __ARM_ARCH_7M__ ) || defined( __ARM_ARCH_6M__ )
- #define cli() asm volatile ( "CPSID i \n" )
- #define sei() asm volatile ( "CPSIE i \n" )
-#endif
-
-//short named types
-typedef uint8_t u8;
-typedef int8_t s8;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef float f32;
-typedef double f64;
-#ifdef __float128
- typedef __float128 f128;
-#endif
-
-//bit mask
-#define B(_b) (1 << (_b))
-#define BIT(_b) (1 << (_b))
-
-//Increment/decrement, Add/Subtract with range rollover/limit
-#define INC_ROLL(a, min, max) { if ((a) >= (max)) (a) = (min); else (a)++; }
-#define INC_LIMIT(a, max) { if ((a) < (max)) (a)++; }
-#define ADD_LIMIT(a, b, max) { (a) += (b); if ((a) > (max)) (a) = (max); }
-#define DEC_ROLL(a, min, max) { if ((a) <= (min)) (a) = (max); else (a)--; }
-#define DEC_LIMIT(a, min) { if ((a) > (min)) (a)--; }
-#define SUB_LIMIT(a, b, min) { (a) -= (b); if ((a) < (min)) (a) = (min); }
-#define IN_RANGE(a, min, max) (((min) <= (a))&&((a) <= (max)))
-#define TO_UPPER(c) ((IN_RANGE(c,'a','z')) ? ((c) - ('a' - 'A')) : (c))
-#define TO_LOWER(c) ((IN_RANGE(c,'A','Z')) ? ((c) + ('a' - 'A')) : (c))
-#define TO_HEX(bbb) (((bbb) < 10) ? ((bbb) + '0') : ((bbb) + ('A' - 10)))
-#define IS_ALPHA(c) (IN_RANGE(c,'a','z') || IN_RANGE(c,'A','Z'))
-#define IS_DIGIT(c) (IN_RANGE(c,'0','9'))
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-#ifdef __ARM_ARCH_7M__
- //ARM Cortex BitBand access macros
- #define BITBAND_SRAM_REF 0x20000000
- #define BITBAND_SRAM_BASE 0x22000000
- // Convert SRAM address
- #define BITBAND_SRAM(addr, bit) ((volatile u8 *)((BITBAND_SRAM_BASE + ((u32)(addr)-BITBAND_SRAM_REF)*32 + (bit*4))))
- #define BBM( addr, bit ) (BITBAND_SRAM(addr,bit))
-
- #define BITBAND_PERI_REF 0x40000000
- #define BITBAND_PERI_BASE 0x42000000
- // Convert PERIPHERAL address
- #define BITBAND_PERI(addr, bit) ((volatile u8 *)((BITBAND_PERI_BASE + ((u32)(addr)-BITBAND_PERI_REF)*32 + (bit*4))))
- #define BBP( addr, bit ) (BITBAND_PERI(addr,bit))
-#endif
-
-//memset - simple verion
-void *memset2(void *dest, int val, size_t len);
-//memcpy - simple verion
-void *memcpy2(void *dest, const void *src, size_t len);
-
-extern u8 divmod10_u32_rem;
-u32 divmod10_u32(u32 n);
-
-#endif /* OTHER_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.c
deleted file mode 100755
index 909e46b5..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ul_s.c
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#include "ul_s.h"
-#include "ul_math_bcd.h"
-
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
- u8 n = 0; u16 o;
- if (in[0] < 0x80){ n = 1; o = in[0]; }
- else if ((in[0] & 0xE0) == 0xE0){
- if ((in[1] != 0) && (in[2] != 0)){
- n = 3;
- o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
- }
- } else if ((in[0] & 0xC0) == 0xC0){
- if (in[1] != 0){
- n = 2;
- o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
- }
- }
- if (n){
- if (be){
- *((u8 *)out) = o >> 8;
- *((u8 *)out + 1) = o;
- } else {
- *((u8 *)out) = o;
- *((u8 *)out + 1) = o >> 8;
- }
- }
- return n;
-}
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
- if (in_len == 0) in_len = s_len(in,0);
- u16 out_len = 0;
- while (in_len){
- u8 n = utf8_to_ucs2(in, out, be);
- if (n == 0) in_len = 0;
- else {
- in += n;
- out++; out_len++;
- in_len = (in_len >= n) ? (in_len - n) : 0;
- }
- }
- return out_len;
-}
-
-
-u8 ucs2_to_utf8(u32 in, u8 *out){
- u8 n = 0;
- if (in < 0x80){
- out[0] = in;
- out[1] = 0;
- n = 1;
- }
- else if ((in >= 0x80) && (in < 0x800)){
- out[0] = (in >> 6) | 0xC0;
- out[1] = (in & 0x3F) | 0x80;
- out[2] = 0;
- n = 2;
- }
- else if ((in >= 0x800) && (in < 0xFFFF)){
- if (!((in >= 0xD800) && (in <= 0xDFFF))){
- out[0] = (in >> 12) | 0xE0;
- out[1] = ((in >> 6 ) & 0x3F) | 0x80;
- out[2] = (in & 0x3F) | 0x80;
- out[3] = 0;
- n = 3;
- }
- }
- else if ((in >= 0x10000) && (in < 0x10FFFF)){
- out[0] = 0xF0 | (in >> 18);
- out[1] = 0x80 | ((in >> 12) & 0x3F);
- out[2] = 0x80 | ((in >> 6) & 0x3F);
- out[3] = 0x80 | ((in & 0x3F));
- out[4] = 0;
- return 4;
- }
- return n;
-}
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
- u16 out_len = 0;
- while (in_len){
- u8 n = ucs2_to_utf8(
- (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
- if (n == 0) in_len = 0;
- else {
- in++; in_len--;
- out += n; out_len += n;
- }
- }
- return out_len;
-}
-
-u16 s_len(u8 *s, u8 eol){
- if (s == NULL) return 0;
- u16 l = 0;
- while (*s++ != eol) l++;
- return l;
-}
-u8 s_lines(u8 *s, u16 len, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 n = 0;
- while (len--) if (*s++ == eol) n++;
- return n;
-}
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
- if (len == 0) len = s_len(s, 0);
- u8 l = 0;
- while (len-- && (l < line))
- if (*s++ == eol) l++;
- return (len == 0) ? NULL : s;
-}
-u8 *s_skip_crlf(u8 *s){
- while ((*s == '\r')||(*s == '\n')) s++;
- return s;
-}
-
-u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
-void s_upcase(u8 *s, u16 len){
- if (len == 0) len = s_len(s, 0);
- while (len--){
- *s = c_upcase(*s);
- s++;
- }
-}
-
-u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
-u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
-
-u8 s_cmp(u8 *s1, u8 *s2, u16 len){
- while (len--) if (*s1++ != *s2++) return 0;
- return 1;
-}
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
- while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
- return 1;
-}
-
-u8 s_starts(u8 *s, char *start){
- while (*start != 0) if (*s++ != *start++) return 0;
- return 1;
-}
-u8 s_ends(u8 *s, char *end){
- u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
- if ((el > 0)&&(sl >= el)){
- s += sl - 1; end += el - 1;
- while (el--) if (*s-- != *end--) return 0;
- return 1;
- }
- return 0;
-}
-
-u8 *s_cpos(u8 *s, u8 c, u8 eol){
- while(*s != eol){
- if (*s == c) return s;
- s++;
- }
- return NULL;
-}
-
-u32 s_parse_dec(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
- return n;
-}
-u32 s_parse_hex(u8 *s, u8 len){
- u32 n = 0;
- if (len == 0) len = 255;
- while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
- n = (n << 4) + s_h2b4( *s++ );
- return n;
-}
-
-u8 s_is_7bit(u8 *s, u8 eol){
- while (*s != eol) if (*s++ > 0x7F) return 0;
- return 1;
-}
-
-u8 *s_copy(u8 *in, u8 eol, u8 *out){
- if (in == out) return out;
- while (*in != eol) *out++ = *in++;
- *out = eol;
- return out;
-}
-
-u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
-u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
-u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
-u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
-u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
-u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
-u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
-
-#if 0
-u8 *s_append_u32(u8 *out, u32 n) {
- if (n){
- n = bin2bcd_u32(n, 4); u8 digs = 8;
- while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
- while(digs--){
- *out++ = s_b2h4(n >> 28);
- n <<= 4;
- }
- } else *out++ = '0';
- *out = 0;
- return out;
-}
-
-
-u8 *s_append_s32(u8 *out, s32 n) {
- if (n < 0){
- out = s_append_c(out, '-');
- n = -n;
- }
- return s_append_u32(out, n);
-}
-#endif
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.h
deleted file mode 100644
index 8d46bd02..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/ul_s.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ul_s.h
- *
- * Created on: Sep 21, 2014
- * Author: qwer
- */
-
-#ifndef UL_S_H_
-#define UL_S_H_
-
-#include "ul_other.h"
-
-
-// convert UTF8 to UCS2 codepoint, returns number of bytes processed, be=1 for big-endian
-u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be);
-// convert string in UTF8 to UCS2, returns number of UCS code points, be=1 for big-endian
-u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be);
-
-// convert UCS2 codepoint to UTF8, returns number of bytes processed
-u8 ucs2_to_utf8(u32 in, u8 *out);
-// convert string of UCS2 codepoints to UTF8, returns number of UTF8 bytes, be=1 for big-endian
-u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be);
-
-
-// find length of line, terminated by eol char
-u16 s_len(u8 *s, u8 eol);
-
-// number of lines, separated by eol char
-u8 s_lines(u8 *s, u16 len, u8 eol);
-
-u8 c_upcase(u8 c);
-// uppercase string, in-place
-void s_upcase(u8 *s, u16 len);
-
-u8 s_h2b4(u8 hex);
-u8 s_b2h4(u8 b);
-
-// find start of line, delimited by eol char
-u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol);
-
-// skip CR/LF chars
-u8 *s_skip_crlf(u8 *s);
-
-// compare 2 strings, returns 1 if equal
-u8 s_cmp(u8 *s1, u8 *s2, u16 len);
-// compare 2 strings, upper-casing each char, returns 1 if equal
-u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len);
-
-// check if s starts with start
-u8 s_starts(u8 *s, char *start);
-// check if s ends with end
-u8 s_ends(u8 *s, char *end);
-
-// finds 1st occurence of char c, returns NULL if not found
-u8 *s_cpos(u8 *s, u8 c, u8 eol);
-
-// check if string is 7-bit
-u8 s_is_7bit(u8 *s, u8 eol);
-
-// copy in string (terminated by eol char) to out
-u8 *s_copy(u8 *in, u8 eol, u8 *out);
-
-
-// append string out to in, returns pointer after last char
-u8 *s_append_s (u8 *out, char *in);
-// append char to string buffer
-u8 *s_append_c (u8 *out, u8 c);
-// append Hex char to string buffer
-u8 *s_append_h4 (u8 *out, u8 n);
-// append Hex byte to string buffer
-u8 *s_append_h8 (u8 *out, u8 n);
-// append 16-bit Hex to string buffer
-u8 *s_append_h16(u8 *out, u16 n);
-// append 24-bit Hex to string buffer
-u8 *s_append_h24(u8 *out, u32 n);
-// append 32-bit Hex to string buffer
-u8 *s_append_h32(u8 *out, u32 n);
-
-
-// parse decimal number
-u32 s_parse_dec(u8 *s, u8 len);
-// parse hex number
-u32 s_parse_hex(u8 *s, u8 len);
-
-#endif /* UL_S_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/version.txt
index b0b37441..5f14daa7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/azx/pdu_codec/version.txt
@@ -1,3 +1,7 @@
+1.0.3
+New dcs decoding functionality
+Output encoding selection
+-----------
1.0.2
azx_pdu_convertZeroPaddedHexIntoByte arrays initialization and casting
-----------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/metadata.json
old mode 100755
new mode 100644
index b5b5e06f..43d0cd3f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/M2MB_main.c
index 5d85d936..7096d724 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/M2MB_main.c
@@ -14,7 +14,7 @@
Sample application showcasing how to receive an SMS containing an AT command, process the AT command and send its answer to sender (configurable in sms_config.txt). A SIM card and antenna must be present. Debug prints on MAIN UART
@version
- 1.0.4
+ 1.0.5
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -44,7 +44,6 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/callbacks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/callbacks.c
index 30f1592f..083d4060 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/callbacks.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SMS_atCmd/src/callbacks.c
@@ -41,9 +41,9 @@
#include "app_cfg.h"
-#include "ul_gsm_pdu.h"
#include "azx_pduEnc.h"
#include "azx_pduDec.h"
+#include "azx_pduCommon.h"
#include "at_utils.h"
@@ -51,7 +51,7 @@
/* Local defines ================================================================================*/
-#define SMS_PDU_MAX_SIZE 400
+
#define CONFIG_FILE LOCALPATH "/sms_config.txt"
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/metadata.json
old mode 100755
new mode 100644
index ca2a7727..56c10e2d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Echo/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,8 +41,14 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/metadata.json
old mode 100755
new mode 100644
index 032109f2..66fa5088
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SPI_Sensors/metadata.json
@@ -16,14 +16,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,8 +41,14 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/metadata.json
old mode 100755
new mode 100644
index 19df2c34..7afcb63d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SW_Timer/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/metadata.json
old mode 100755
new mode 100644
index abb19d31..1ab47f19
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/SecureMS/metadata.json
@@ -13,18 +13,19 @@
"MXXXXC1": {
"firmwares": [
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/metadata.json
old mode 100755
new mode 100644
index b10989e2..061519f4
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-IP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/metadata.json
old mode 100755
new mode 100644
index 6aec30ac..2c0ffa5f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP-State/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/metadata.json
old mode 100755
new mode 100644
index e7e5a073..daa9519a
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TCP_Server/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/metadata.json
old mode 100755
new mode 100644
index 9dede96f..682d64e8
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/metadata.json
@@ -16,14 +16,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -41,9 +43,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/src/ssl_test.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/src/ssl_test.c
index 05dd0268..e689e69c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/src/ssl_test.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/TLS_SSL_CLIENT/src/ssl_test.c
@@ -9,11 +9,11 @@
The file contains the TLS/SSL utilities
@details
-
- @version
- 1.1.4
+
+ @version
+ 1.1.6
@note
-
+
@author
@@ -52,7 +52,7 @@
/* Local defines ================================================================================*/
/* 0: test using HTTPS server with client authentication (port 20443)
- 1: test using HTTPS server on port 443 with server authentication;
+ 1: test using HTTPS server on port 443 with server authentication;
*/
#define HTTP_443 1
@@ -65,17 +65,11 @@
CHAR queryBuf[] = "GET / HTTP/1.1\r\nHost: modules.telit.com\r\n\r\n";;
M2MB_SSL_AUTH_TYPE_E SSL_AUTH_MODE = M2MB_SSL_SERVER_AUTH;
#else //https with client cert
- #define WRONG_CLIENT_TEST 0 //test with wrong certificates to verify the secure socket on the server
#define SERVER "modules.telit.com"
#define CA_CERT_PATH LOCALPATH "/ssl_certs/modulesCA.crt"
-#if WRONG_CLIENT_TEST
- #define CLIENT_CERT_PATH LOCALPATH "/ssl_certs/wrong_Client.crt"
- #define CLIENT_KEY_PATH LOCALPATH "/ssl_certs/wrong_Client_pkcs1.key"
-#else
#define CLIENT_CERT_PATH LOCALPATH "/ssl_certs/modulesClient.crt"
#define CLIENT_KEY_PATH LOCALPATH "/ssl_certs/modulesClient_pkcs1.key" //Only RSA Private keys are supported
-#endif
#define SERVER_PORT 20443 //echo client+server
M2MB_SSL_AUTH_TYPE_E SSL_AUTH_MODE = M2MB_SSL_SERVER_CLIENT_AUTH;
@@ -156,7 +150,7 @@ void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size,
{
(void)resp_size;
(void)myUserdata;
-
+
M2MB_NET_REG_STATUS_T *stat_info;
switch (net_event)
@@ -198,7 +192,7 @@ void PdpCallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *u
m2mb_pdp_get_my_ip(h, cid, M2MB_PDP_IPV4, &CBtmpAddress.sin_addr.s_addr);
m2mb_socket_bsd_inet_ntop( M2MB_SOCKET_BSD_AF_INET, &CBtmpAddress.sin_addr.s_addr, ( CHAR * )&( CBtmpIPaddr ), sizeof( CBtmpIPaddr ) );
AZX_LOG_DEBUG( "IP address: %s\r\n", CBtmpIPaddr);
-
+
m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_SET);
break;
@@ -217,7 +211,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
(void)type;
(void)param1;
(void)param2;
-
+
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_OS_RESULT_E osRes;
@@ -294,6 +288,16 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
AZX_LOG_DEBUG("m2mb_ssl_create_config PASSED \r\n");
}
+ sslRes = m2mb_ssl_config( sslConfigHndl, M2MB_SSL_NAME_SNI, (void*)SERVER );
+ if(sslRes != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
+ }
+
sslCtxtHndl = m2mb_ssl_create_ctxt();
if( sslCtxtHndl == NULL )
@@ -469,7 +473,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
{
AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
}
-
+
/*Wait for network registration event to occur (released in NetCallback function) */
m2mb_os_ev_get(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
@@ -507,7 +511,7 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
return -1;
}
}
-
+
/*Wait for pdp activation event to occur (released in PDPCallback function) */
m2mb_os_ev_get(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
@@ -663,17 +667,17 @@ INT32 msgHTTPSTask(INT32 type, INT32 param1, INT32 param2)
m2mb_ssl_delete_config( sslConfigHndl );
-
+
if(SSL_AUTH_MODE == M2MB_SSL_SERVER_AUTH || SSL_AUTH_MODE == M2MB_SSL_SERVER_CLIENT_AUTH)
{
m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*) "CAListTest" );
}
-
+
if(SSL_AUTH_MODE == M2MB_SSL_SERVER_CLIENT_AUTH)
{
m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*) "ClientCertTest" );
}
-
+
m2mb_ssl_delete_ctxt( sslCtxtHndl );
ret = m2mb_pdp_deactivate(pdpHandle, PDP_CTX);
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/metadata.json
old mode 100755
new mode 100644
index 0822464c..ba629ac7
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UART_to_server/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,7 +42,10 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/metadata.json
old mode 100755
new mode 100644
index 0f02a8ba..649ef17a
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/UDP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/Makefile.in
index 9e5de5da..0126abeb 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/metadata.json
old mode 100755
new mode 100644
index 6fdb79d9..db354d98
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB-Cable_Check/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -33,8 +35,16 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/Makefile.in
new file mode 100755
index 00000000..0126abeb
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_MAIN_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/README.md
new file mode 100755
index 00000000..56ff5e97
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/README.md
@@ -0,0 +1,32 @@
+
+### Basic USB read/write example
+
+Sample application that shows how to use the basic read/write USB apis. Synchronous or asynchronous mode is available setting SYNC to 1 or 0. Debug prints on **MAIN UART**
+
+
+**Features**
+
+
+- Read and write on USB (synchoronous mode)
+- Read and write on USB (asynchronous mode)
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Open USB port (USB0)
+- Set rx and tx timeouts
+- **SYNC**
+ - read until some data are availableon USB
+ - as soon as some data are available on USB read them and write on USB data received
+
+- **ASYNC**
+ - set the USB callback
+ - write some data on USB and wait for data to be read
+ - as soon as some data are available on USB M2MB_USB_RX_EVENT is generated and handled by callback. Data are read and printed on serial com port.
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /** (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/description.txt
new file mode 100644
index 00000000..9fd806cf
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/description.txt
@@ -0,0 +1 @@
+Sample application that shows how to use the basic read/write USB apis. Synchronous or asynchronous mode is available setting SYNC to 1 or 0. Debug prints on MAIN UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/metadata.json
new file mode 100755
index 00000000..3f19a738
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/metadata.json
@@ -0,0 +1,53 @@
+{
+ "name": "Sample App for USB read/write",
+ "type": "sample-app",
+ "description": "A sample app that shows how to use basic USB apis to read and write on usb.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "USB",
+ "read",
+ "write"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": [
+ "25.21.xx0"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/src/M2MB_main.c
new file mode 100755
index 00000000..c5551f5d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/USB_TxRxBasic/src/M2MB_main.c
@@ -0,0 +1,264 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows how to use the basic read/write USB apis. Synchronous or asynchronous mode is available setting SYNC to 1 or 0. Debug prints on MAIN UART
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta galeazzo
+
+ @date
+ 04/11/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_usb.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define BUF_LEN 32
+#define WR_BYTE_VAL 0x41
+#define CYCLE 1 //set to one to read all bytes with a cycle, to read byte using callback length (resp_struct) set 0
+#define SYNC 1 //for synchronous read/write, to have asynchronous read/write set to 0
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+BOOLEAN is_USB_connected;
+INT32 g_USBfd = -1;
+BOOLEAN state = FALSE;
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+#if !SYNC
+static void USB_Cb( INT32 fd, M2MB_USB_IND_E usb_event, UINT16 resp_size, void *resp_struct, void *userdata )
+{
+ (void)fd;
+ (void)userdata;
+ (void)resp_size;
+ INT32 dataToRead, writtenData;
+ INT32 dataRead;
+ CHAR recBuf[BUF_LEN], buff[1024 + 1];
+
+ switch(usb_event)
+ {
+ case M2MB_USB_CABLE_CONNECTED_EVENT:
+ {
+ is_USB_connected = *((BOOLEAN*)(resp_struct));
+ AZX_LOG_INFO("Usb cable check event, USB status: %d\r\n", is_USB_connected);
+ }
+ break;
+
+ case M2MB_USB_RX_EVENT:
+ {
+
+#if CYCLE
+ memset(buff, 0, 1024);
+ do
+ {
+ dataToRead = BUF_LEN;
+ dataRead = m2mb_usb_read(fd, recBuf, dataToRead);
+ if(dataRead > 0)//read fixed number of bytes bytes until buffer is empty
+ strncat(buff, recBuf, dataRead);
+ AZX_LOG_INFO("USB read bytes %d\r\n", dataRead);
+ }while (dataRead > 0);
+
+
+ AZX_LOG_INFO("Rec from USB: %s\r\n", buff);
+#else
+ dataToRead = *((INT32*)resp_struct); //use resp_struct information to read data
+ dataRead = m2mb_usb_read(fd, buff, dataToRead);
+ AZX_LOG_INFO("USB read bytes %d\r\n", dataRead);
+ buff[dataRead] = 0;
+ AZX_LOG_INFO("Rec from USB: %s\r\n", buff);
+#endif
+ }
+ break;
+
+ case M2MB_USB_TX_EVENT:
+ {
+ writtenData = *((INT32*)resp_struct);
+ AZX_LOG_INFO("Written bytes: %d\r\n", writtenData);
+
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+}
+#endif
+/*-----------------------------------------------------------------------------------------------*/
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+ (void)argc;
+ (void)argv;
+
+ INT32 retVal;
+ INT32 wrBytes;
+#if SYNC
+ INT32 rdBytes;
+ UINT8 dstBuf[BUF_LEN];
+#else
+ UINT8 srcBuf[BUF_LEN];
+ M2MB_USB_CFG_T cfg;
+#endif
+
+ azx_sleep_ms(5000);
+
+ /*Set log configuration */
+ AZX_LOG_INIT();
+
+ AZX_LOG_INFO("\r\n\r\nStarting USB read write demo app. This is v%s built on %s %s.\r\n\r\n",
+ VERSION, __DATE__, __TIME__);
+
+ //open usb port
+ AZX_LOG_INFO("\r\nOpen USB port\r\n");
+ g_USBfd = m2mb_usb_open("/dev/USB0", 0);
+ if ( g_USBfd != -1 )
+ {
+ AZX_LOG_INFO( "m2mb_usb_open succeeded\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR( "m2mb_usb_open failed\r\n");
+ return;
+ }
+
+
+ retVal = m2mb_usb_ioctl(g_USBfd, M2MB_USB_IOCTL_GET_CABLE_STATE, &state);
+ if ( retVal != -1 )
+ {
+ AZX_LOG_INFO( "m2mb_usb_ioctl: got cable status\r\n");
+ if (state == 0)
+ {
+ AZX_LOG_INFO( "USB cable DISCONNECTED, status: %d\r\n", state);
+ }
+ else
+ {
+ AZX_LOG_INFO( "USB cable CONNECTED, status: %d\r\n", state);
+ }
+ }
+ else
+ {
+ AZX_LOG_ERROR( "Failure getting USB cable state event\r\n\r\n");
+ return;
+ }
+
+ m2mb_usb_ioctl( g_USBfd, M2MB_USB_IOCTL_SET_CB, NULL ); // reset callback function
+ m2mb_usb_ioctl( g_USBfd, M2MB_USB_IOCTL_SET_TX_TIMEOUT, 10); // set 5000 ms of timeout for writing (just to check if it's blocking)
+ m2mb_usb_ioctl( g_USBfd, M2MB_USB_IOCTL_SET_RX_TIMEOUT, 1000 ); // set 5000 ms of timeout for reading (just to check if it's blocking)
+
+ wrBytes = m2mb_usb_write(g_USBfd, "READY", 5);
+ if (wrBytes <= 0)
+ {
+ AZX_LOG_ERROR( "No bytes written\r\n");
+ }
+
+#if SYNC
+ AZX_LOG_INFO( "Synchronous read and write\r\n" );
+ azx_sleep_ms(3000);
+
+ //synchronous reading
+ AZX_LOG_INFO( "Read until some bytes are received...\r\n");
+
+ do
+ {
+ rdBytes = m2mb_usb_read(g_USBfd, dstBuf, BUF_LEN);
+ if( rdBytes < 0 )
+ {
+ AZX_LOG_ERROR( "m2mb_usb_read failure\r\n" );
+ }
+ else if( rdBytes == 0 )
+ {
+ AZX_LOG_INFO( "rx timeout expired\r\n" );
+ }
+ else
+ {
+ AZX_LOG_INFO( "m2mb_usb_read read %d Bytes\r\n", rdBytes );
+ azx_sleep_ms(1000);
+ wrBytes = m2mb_usb_write(g_USBfd, "REC:", 4);
+ wrBytes = m2mb_usb_write(g_USBfd, dstBuf, rdBytes);
+ if( wrBytes < 0 )
+ {
+ AZX_LOG_ERROR( "m2mb_usb_write failure\r\n" );
+ }
+ else if( wrBytes == 0 )
+ {
+ AZX_LOG_INFO( "tx timeout expired\r\n" );
+ }
+ else
+ {
+ AZX_LOG_INFO( "m2mb_usb_write sent %d Bytes\r\n", wrBytes );
+ }
+ }
+ }while (1);
+
+ azx_sleep_ms(3000);
+
+#else
+ //ASYNCHRONOUS reading/writing with callback, and cable check
+ memset(srcBuf, WR_BYTE_VAL, BUF_LEN);
+ srcBuf[BUF_LEN]=0;
+ azx_sleep_ms(2000);
+ AZX_LOG_INFO( "Asynchronous read and write\r\n" );
+ retVal = m2mb_usb_ioctl(g_USBfd, M2MB_USB_IOCTL_GET_CFG, &cfg);
+ if ( retVal != -1 )
+ {
+ AZX_LOG_INFO("\r\nSet USB callback\r\n\r\n");
+ retVal = m2mb_usb_ioctl(g_USBfd, M2MB_USB_IOCTL_SET_CB, &USB_Cb);
+ if ( retVal != -1 )
+ {
+ AZX_LOG_INFO( "m2mb_usb_ioctl: set usb callback, OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR( "Failure setting USB callback\r\n");
+ return;
+ }
+ }
+
+ azx_sleep_ms(3000);
+ AZX_LOG_INFO( "Write 32 bytes...\r\n" );
+ m2mb_usb_ioctl( g_USBfd, M2MB_USB_IOCTL_SET_TX_TIMEOUT, 5000 ); // set 5000 ms of timeout for writing (just to check if it's blocking)
+ wrBytes = m2mb_usb_write(g_USBfd, srcBuf, BUF_LEN);
+ if( wrBytes < 0 )
+ {
+ AZX_LOG_ERROR( "m2mb_usb_write failure" );
+ }
+
+ AZX_LOG_INFO( "waiting for characters to be read\r\n");
+
+#endif
+}
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/Makefile.in
new file mode 100755
index 00000000..0126abeb
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_MAIN_UART
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/README.md
new file mode 100755
index 00000000..970ba142
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/README.md
@@ -0,0 +1,26 @@
+
+### Watchdog example
+
+Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
+
+
+**Features**
+
+
+- Enable watchdog on Task_1
+- Handle watchdog kicks with a timer
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Create Task_1 that will be put under watchdog control
+- In Task_1 watchdog is ebnabled on it and a timer created to handle watchdog kicks. Then task enters in a loop where kicks are sent. After 5 kicks a task lock is simulated waiting for an event release (with a timeout longer that task watchdog inactivity timeout)
+- As soon as watchdog inactivity timeout expired M2MB_WDOG_TIMEOUT_IND is generated and handled in WDcallback (in this case the event is released, no further actions are done)
+- No further actions are performed by Task_1 (no kicks are sent) so after watchdog system timeout expiration app is rebooted.
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_utils.h
new file mode 100755
index 00000000..cccb3c54
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/hdr/azx_utils.h
@@ -0,0 +1,89 @@
+/*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.3
+ * @dependencies core/azx_log
+ * @author Ioannis Demetriou
+ * @author Sorin Basca
+ * @date 10/02/2019
+ *
+ * @brief Various helpful utilities
+ */
+#include "m2mb_types.h"
+#include "azx_log.h"
+
+
+/**
+ * @brief Limits a value to a certain interval
+ *
+ * This is defined as a macro so it works with any types that support ordering.
+ *
+ * @param val The value to limit
+ * @param min The minimum allowed value
+ * @param max The maximum allowed value
+ *
+ * @return The original value if it was inside the limits, or min, or max, if it was less than, or
+ * greater than the limits.
+ */
+#define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/description.txt
new file mode 100644
index 00000000..2b702b5a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/description.txt
@@ -0,0 +1 @@
+Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/WatchDog.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/WatchDog.h
new file mode 100755
index 00000000..dc1d96ea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/WatchDog.h
@@ -0,0 +1,37 @@
+/*
+ * M2M_WatchDog.h
+ *
+ * Created on: 10 May 2021
+ * Author: Alberto Lendini
+ */
+
+#ifndef HDR_M2MB_WDOG_H_
+#define HDR_M2MB_WDOG_H_
+
+INT32 M2MB_msgTask1(INT32 type, INT32 param1, INT32 param2);
+INT32 M2MB_msgTask2(INT32 type, INT32 param1, INT32 param2);
+
+typedef enum {
+ TASK_START=0,
+ LOOP,
+ WD_KICK
+} STATES;
+
+/* EVENTS */
+#define EV_WDOG_KICK (UINT32)0x00000001
+#define EV_WDOG_REMOVE (UINT32)0x00000002
+#define EV_WDOG_RESET (UINT32)0x00000004
+#define EV_WDOG_TEST (UINT32)0x00000008
+
+/* TIMEOUTS */
+#define WDOG_WAIT_TO 120000
+#define WDOG_REFERENCE_TIME 41500
+
+/* FLAG FILE */
+#define WDOG_FLAG "wdog_flag.txt"
+
+/* FUNCTIONS */
+void WDcallback( M2MB_WDOG_HANDLE hDog, M2MB_WDOG_IND_E wDog_event, UINT16 resp_size, void *resp_struct, void *userdata );
+void WDog_test(void);
+
+#endif /* HDR_M2MB_WDOG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/metadata.json
new file mode 100755
index 00000000..f23b9b66
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/metadata.json
@@ -0,0 +1,55 @@
+{
+ "name": "Sample App for watchdog functionality",
+ "type": "sample-app",
+ "description": "A sample app that shows how to set and implement a watchdog.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "Watchdog"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_tasks": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/src/M2MB_main.c
new file mode 100755
index 00000000..d73cd342
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/Watchdog/src/M2MB_main.c
@@ -0,0 +1,363 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows how to set and implement a watchdog. Task has been locked waitng for an event with a timeout longer than wd inactivity timeout. If no wd kick or no actions
+ are executed during system timeout a system reboot is performed. Debug prints on MAIN UART
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 05/11/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+#include "m2mb_gpio.h"
+#include "m2mb_wDog.h"
+#include "m2mb_rtc.h"
+#include "m2mb_os_tmr.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "azx_tasks.h"
+
+#include "app_cfg.h"
+
+#include "WatchDog.h"
+
+
+
+
+/* Local defines ================================================================================*/
+#define WAKE_UP_TICKS 20 //to be used in m2mb_wDog_enable
+#define CTRL_TICKS_TO_REBOOT 6 //to be used in m2mb_wDog_enable
+#define WD_TOUT_COUNT 3 //to be used in m2mb_wDog_addTask
+
+#define TIMER_TOUT 5000
+
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+M2MB_OS_TASK_HANDLE Task1_H = NULL;
+INT8 taskID_1;
+M2MB_WDOG_HANDLE h_wDog;
+M2MB_OS_EV_HANDLE evHandle;
+
+/*Timer to perform wd kick*/
+M2MB_OS_TMR_ATTR_HANDLE tmrAttrHandle;
+M2MB_OS_TMR_HANDLE tmrHandle;
+UINT32 timeval1, timeval2, diff;
+UINT32 wd_tick_s;
+
+/* Local function prototypes ====================================================================*/
+void WDog_Init(void);
+
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+static void TimerCb(M2MB_OS_TMR_HANDLE tHandle, void *argCb )
+{
+static unsigned int Count = 0;
+
+ (void)tHandle;
+ (void)argCb;
+
+ AZX_LOG_TRACE("\r\nCallback Count: [%u]\r\n", Count++);
+ if (Count < 5)
+ {
+ AZX_LOG_INFO("WD kick\r\n");
+ azx_tasks_sendMessageToTask(taskID_1, WD_KICK, 0, 0);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n...stop WD kicks and simulate infinite loop\r\n");
+ azx_tasks_sendMessageToTask(taskID_1, LOOP, 0, 0);
+ m2mb_os_tmr_stop(tmrHandle);
+ }
+}
+
+void timer_Init(void)
+{
+M2MB_OS_RESULT_E res;
+
+ res = m2mb_os_tmr_setAttrItem( &tmrAttrHandle,
+ CMDS_ARGS
+ (
+ M2MB_OS_TMR_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TMR_SEL_CMD_NAME, "mytmr",
+ M2MB_OS_TMR_SEL_CMD_USRNAME, "myUsrtmr",
+ M2MB_OS_TMR_SEL_CMD_CB_FUNC, &TimerCb,
+ M2MB_OS_TMR_SEL_CMD_ARG_CB, &tmrHandle,
+ M2MB_OS_TMR_SEL_CMD_TICKS_PERIOD, M2MB_OS_MS2TICKS(TIMER_TOUT),
+ M2MB_OS_TMR_SEL_CMD_PERIODIC, M2MB_OS_TMR_PERIODIC_TMR
+ )
+ );
+
+ if( res != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR("Timer attribute creation fail, error: %d\r\n", res);
+ return;
+ }
+ else
+ {
+ AZX_LOG_TRACE("Timer attribute creation OK\r\n" );
+ }
+ //Define the timer and pass the parameters structure to it.
+ res = m2mb_os_tmr_init( &tmrHandle, &tmrAttrHandle );
+ if( res != M2MB_OS_SUCCESS )
+ {
+ //delete the parameters structure
+ m2mb_os_tmr_setAttrItem( &tmrAttrHandle, 1, M2MB_OS_TMR_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_ERROR("Timer creation fail, error: %d\r\n", res);
+ }
+ else
+ {
+ AZX_LOG_INFO("Timer creation OK\r\n" );
+ }
+
+}
+
+INT32 get_timeval(UINT32 *pOutTime)
+{
+INT32 fd;
+M2MB_RTC_TIMEVAL_T timeval;
+
+ fd = m2mb_rtc_open("/dev/rtc0", 0);
+ /* protection from invalid handle */
+ if (fd == -1)
+ return -3;
+
+ if (m2mb_rtc_ioctl(fd, M2MB_RTC_IOCTL_GET_TIMEVAL, &timeval) == -1)
+ {
+ m2mb_rtc_close(fd);
+ return -1;
+ }
+ (*pOutTime) = timeval.msec + (timeval.sec * 1000);
+
+ if (m2mb_rtc_close(fd) == -1)
+ return -2;
+ return 0;
+}
+
+void WDcallback(M2MB_WDOG_HANDLE hDog, M2MB_WDOG_IND_E wDog_event,UINT16 resp_size, void *resp_struct, void *userdata)
+{
+ (void)hDog;
+ (void)resp_size;
+ (void)resp_struct;
+ (void)userdata;
+
+ switch (wDog_event)
+ {
+ case M2MB_WDOG_TIMEOUT_IND:
+ {
+ AZX_LOG_INFO("Watchdog expired!\r\n");
+ /*release the event to unlock the task*/
+ get_timeval(&timeval2);
+ m2mb_os_ev_set(evHandle, EV_WDOG_TEST, M2MB_OS_EV_SET);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void WDog_Init(void)
+{
+M2MB_RESULT_E res;
+MEM_W time_ms;
+
+ AZX_LOG_INFO("\r\nInit WatchDog\r\n");
+ res = m2mb_wDog_init(&h_wDog, WDcallback, 0);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_init OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_init Fail, error: %d\r\n", res);
+ return;
+ }
+
+ /* Verifying tick duration */
+ res = m2mb_wDog_getItem(h_wDog, M2MB_WDOG_SELECT_CMD_TICK_DURATION_MS, 0, &time_ms);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ wd_tick_s = time_ms/1000;
+ AZX_LOG_INFO("Tick duration: %ds\r\n", wd_tick_s);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Get tick duration Fail, error: %d\r\n", res);
+ }
+
+
+ AZX_LOG_INFO("Adding Task under WD control with inactivity timeout of %ds\r\n", WD_TOUT_COUNT * WAKE_UP_TICKS * wd_tick_s);
+ /* wdTimeout (inactivity timeout of the task) is set to WD_TOUT_COUNT (3 in this case).
+ * This counter is decreased every time a control is done and no kick have been received. Control is done every WAKE_UP_TICKS.
+ * When the counter reaches 0 a further control is done and if it's still 0 then callback is called,
+ * so task inactivity timeout will be more or less WD_TOUT_COUNT * WAKE_UP_TICKS * 1s
+ */
+ res = m2mb_wDog_addTask(h_wDog, Task1_H, WD_TOUT_COUNT);
+
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_addTask OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_addTask Fail\r\n");
+ }
+
+ AZX_LOG_INFO("Enabling the WatchDog\r\n");
+ /* WAKE_UP_TICKS defines the number of ticks of every control, by default the tick is every 1s
+ * CTRL_TICKS_TO_REBOOT this defines the number of controls the wd does before rebooting the app if no kick are received (or no action is done in watchdog callback )
+ * so timeout to reboot is WAKE_UP_TICKS * CTRL_TICKS_TO_REBOOT * 1s
+ */
+ res = m2mb_wDog_enable(h_wDog, WAKE_UP_TICKS, CTRL_TICKS_TO_REBOOT);
+ if (res == M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_INFO("m2mb_wDog_enable OK\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_wDog_enable Fail, error: %d\r\n", res);
+ }
+
+}
+
+
+INT32 M2MB_msgTask1(INT32 type, INT32 param1, INT32 param2)
+{
+M2MB_OS_RESULT_E osRes;
+UINT32 ev_bits;
+
+ (void)param1;
+ (void)param2;
+ //AZX_LOG_INFO(".\r\n");
+ switch (type)
+ {
+ case TASK_START:
+ AZX_LOG_INFO("\r\nTask started\r\n");
+ Task1_H = m2mb_os_taskGetId();
+
+ WDog_Init();
+ timer_Init();
+
+ AZX_LOG_INFO("\r\nStart WD kick every %ds...\r\n", TIMER_TOUT/1000);
+ m2mb_os_tmr_start(tmrHandle);
+
+ break;
+
+ case LOOP:
+ /*
+ * Simulate an infinite loop waiting an event for WDOG_WAIT_TO that should be bigger than WD_TOUT_COUNT * WAKE_UP_TICKS * 1s
+ */
+ AZX_LOG_INFO("Waiting for EV_WDOG_TEST event to simulate task lock\r\n");
+ get_timeval(&timeval1);
+ osRes = m2mb_os_ev_get(evHandle, EV_WDOG_TEST,
+ M2MB_OS_EV_GET_ALL_AND_CLEAR, &ev_bits,
+ WDOG_WAIT_TO);
+ if (M2MB_OS_SUCCESS == osRes)
+ {
+ AZX_LOG_INFO("Event EV_WDOG_TEST received - watchdog performed as expected after %d ms\r\n",(timeval2-timeval1));
+ }
+ else
+ {
+ AZX_LOG_ERROR("Event EV_WDOG_TEST not received in time %d, code %d\r\n",
+ WDOG_WAIT_TO, osRes);
+ }
+ AZX_LOG_INFO("Task doing nothing and no kicks, waiting for app restart in %ds", CTRL_TICKS_TO_REBOOT * WAKE_UP_TICKS * wd_tick_s);
+ break;
+
+ case WD_KICK:
+ m2mb_wDog_kick(h_wDog, Task1_H);
+ AZX_LOG_INFO("WD kick done\r\n");
+ break;
+
+ }
+
+ return 0;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+M2MB_OS_RESULT_E os_res;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+
+ (void)argc;
+ (void)argv;
+
+ azx_tasks_init();
+
+ azx_sleep_ms(5000);
+
+ /*SET output channel */
+ AZX_LOG_INIT();
+
+ AZX_LOG_INFO("\r\n\r\nStarting WATCHDOG demo app. This is v%s built on %s %s.\r\n\r\n",VERSION, __DATE__, __TIME__);
+
+ // *********** event initialization **************
+
+ m2mb_os_ev_setAttrItem(&evAttrHandle, 2, M2MB_OS_EV_SEL_CMD_CREATE_ATTR,
+ M2MB_OS_EV_SEL_CMD_NAME, NULL, "MyEv");
+
+ os_res = m2mb_os_ev_init(&evHandle, &evAttrHandle);
+ if (os_res != M2MB_OS_SUCCESS)
+ {
+ m2mb_os_ev_setAttrItem(&evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR,
+ NULL);
+ }
+ else
+ {
+ AZX_LOG_INFO("Event correctly initialized \r\n");
+ }
+
+ ////************** TASK INITIALIZATION *************
+ taskID_1 = azx_tasks_createTask((char*) "TASK_1", AZX_TASKS_STACK_L, 1, AZX_TASKS_MBOX_M, M2MB_msgTask1);
+
+ AZX_LOG_TRACE("Task ID: %d\r\n", taskID_1);
+
+ if (taskID_1 > 0)
+ {
+ azx_tasks_sendMessageToTask( taskID_1, TASK_START, 0, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("cannot create task!\r\n");
+ return;
+ }
+
+ azx_sleep_ms(2000);
+
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/Makefile.in
index 492442f9..6a1d480a 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/metadata.json
old mode 100755
new mode 100644
index 9bf4bf6d..d0171af7
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MAIN_UART/ZLIB/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/Makefile.in
index cf586748..3dc3f1f3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/metadata.json
old mode 100755
new mode 100644
index 12ab8f1f..ea40f604
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-MISC/GPIO_Toggle/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,7 +41,10 @@
}
},
"groups": [
- {"name": "MISC", "limitations": []}
+ {
+ "name": "MISC",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/metadata.json
old mode 100755
new mode 100644
index 17af47bd..f7bf7b8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/ATI/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/metadata.json
old mode 100755
new mode 100644
index a7823d91..5add0c1e
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/src/aws_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/src/aws_demo.c
index 4dbc01ce..f4bf8843 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/src/aws_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AWS/src/aws_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.2
+ 1.0.3
@note
@@ -157,26 +157,31 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
}
/* clean everything */
- res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
- if(res==0)
- {
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
- }
- else
- {
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
- }
- res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
- if(res==0)
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
- AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
- else
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
{
- AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
}
-
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -253,28 +258,28 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
}
#if HOSTMISMATCH_ENABLE
- ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
- if(ret != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
- }
+ ret = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_CHECK, (void*)AWS_BROKER_ADDRESS );
+ if(ret != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config NAME CHECK succeeded\r\n");
+ }
#endif
#if SNI_ENABLE
- res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
- if(res != 0)
- {
- AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
- }
+ res = m2mb_ssl_config( *p_hSSLConfig, M2MB_SSL_NAME_SNI, (void*)AWS_BROKER_ADDRESS );
+ if(res != 0)
+ {
+ AZX_LOG_ERROR("m2mb_ssl_config SNI failed\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("m2mb_ssl_config SNI succeeded\r\n");
+ }
#endif
{
@@ -357,18 +362,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx, M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
{
- AZX_LOG_DEBUG("Client certificate file %s \r\n",CLIENTCERTFILE);
+ AZX_LOG_DEBUG("Client certificate file %s \r\n", CLIENTCERTFILE);
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
@@ -379,7 +386,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -389,7 +397,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -416,7 +425,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_ERROR("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_TRACE("Reading content from file. Size: %u\r\n", st.st_size);
@@ -426,7 +436,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_ERROR("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -443,13 +454,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -754,6 +767,11 @@ INT32 AWS_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/metadata.json
old mode 100755
new mode 100644
index 222b8ebb..55db5226
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/AppManager/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -33,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/Makefile.in
index 64009498..9e48d6f7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/metadata.json
old mode 100755
new mode 100644
index c4ce79b1..0150cc83
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/App_OTA_FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/Makefile.in
index 13cf8bc7..00b04d02 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/metadata.json
old mode 100755
new mode 100644
index dcffa0b2..fae62b53
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/CJSON/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/metadata.json
old mode 100755
new mode 100644
index 8dd7984c..4c7906ea
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Crypto_ECC/metadata.json
@@ -13,18 +13,19 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/Makefile.in
index 5dac824d..d8e6db64 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
index 64f0b1eb..08534830 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/i2c_utils.c
@@ -122,7 +122,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c || !pData)
{
@@ -153,11 +153,7 @@ INT32 EEPROM_i2c_write(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 *pData, UINT
msgs[0].buf = (UINT8*)buf;
msgs[0].flags = I2C_M_WR;
msgs[0].len = bufsize; // 2 address bytes + data
-
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
+
memcpy(buf + 2, pData, size );
rdrw_data.msgs = &msgs[0];
@@ -191,7 +187,7 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
M2MB_I2C_CFG_T configrw = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
if(!hi2c)
{
@@ -219,10 +215,6 @@ INT32 EEPROM_i2c_write_byte(EEPROM_I2C_T *hi2c, UINT16 memAddress, UINT8 data)
msgs[0].flags = I2C_M_WR;
msgs[0].len = sizeof(buf); // 2 address bytes + data
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
-
rdrw_data.msgs = &msgs[0];
rdrw_data.nmsgs = 1;
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/version.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/version.txt
index 80bd7f30..dda66918 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/version.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/azx/eeprom_24XX256/version.txt
@@ -1,3 +1,5 @@
+1.0.2
+-----------
1.0.1
-----------
1.0.0
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/metadata.json
old mode 100755
new mode 100644
index 0e7c35b6..2295fd77
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EEPROM_AA256/metadata.json
@@ -12,19 +12,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -34,9 +35,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/Makefile.in
index 6129e947..9e949d34 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/metadata.json
old mode 100755
new mode 100644
index 49c8691e..6aba0ce3
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/EasyAT/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/metadata.json
old mode 100755
new mode 100644
index 4433aaea..51964612
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/metadata.json
old mode 100755
new mode 100644
index 9ff2af61..ac9ab71d
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Events_Barrier/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/metadata.json
old mode 100755
new mode 100644
index a602504c..bee71bbe
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FOTA/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/Makefile.in
index 64009498..9e48d6f7 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/metadata.json
old mode 100755
new mode 100644
index 0e43fa56..5ef7d293
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/FTP/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/metadata.json
old mode 100755
new mode 100644
index a957497a..0f86126c
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/File_System/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/README.md
index 0bc2297f..b8ed34e5 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/README.md
@@ -10,16 +10,22 @@ Sample application showing how to use GNSS functionality. Debug prints on **USB0
- How to enable GNSS receiver on module
- How to collect location information from receiver
+**Note:** on MEx10G1 product family both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
**Application workflow**
**`M2MB_main.c`**
- Open USB/UART/UART_AUX
-- Init gnss, enable position report and start it.
-- When a fix is available, a message will be printed by the GNSS callback function
+- Print a welcome message
+- Create GNSS task and send a message to it
-
+**`gps_task.c`**
+- Init Info feature and get module type
+- Init gnss, enable position/NMEA report and start it.
+- When a fix or a NMEA sentence is available, a message will be printed by the GNSS callback function
+
+
---------------------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/hdr/azx_tasks.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/hdr/azx_tasks.h
new file mode 100755
index 00000000..e392af6a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/hdr/azx_tasks.h
@@ -0,0 +1,292 @@
+/*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_TASKS_H_
+#define HDR_AZX_TASKS_H_
+/**
+ * @file azx_tasks.h
+ * @version 1.0.4
+ * @dependencies core/azx_log core/azx_utils
+ * @author Alessio Quieti
+ * @date 07/04/2018
+ *
+ * @brief Tasks related utilities
+ *
+ * Functions usable to simplify the tasks creation and usage
+ * (instead of directly using m2mb_os_q.h low level APIs, which in turn allow
+ * much greater control of the tasks)
+ *
+ * The library is modelled after the way tasks were handled in the old M2M API.
+ */
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "azx_log.h"
+
+/** @defgroup taskUsage Usage of tasks example functionalities
+ * Functions usable to simplify the tasks creation and usage
+*/
+
+/**
+ * @brief Task user callback signature
+ *
+ * This is the structure of the task user callback. Each time a message is
+ * received by an user task, a callback with this structure will be called.
+ *
+ * It is responsibility of the user to define the callback logic.
+ *
+ * @ingroup taskUsage
+ *
+ * @see azx_tasks_init()
+*/
+typedef INT32 (*USER_TASK_CB)(INT32, INT32, INT32);
+
+/** @addtogroup taskUsage
+@{ */
+
+/**
+ * @name Stack defines
+ * @brief Available ranges for tasks
+ * @{ */
+#define AZX_TASKS_MIN_STACK_SIZE 1024 /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/hdr/gnss_task.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/hdr/gnss_task.h
new file mode 100755
index 00000000..87d7919e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/hdr/gnss_task.h
@@ -0,0 +1,23 @@
+/*
+ * gps_task.h
+ *
+ * Created on: 23 apr 2021
+ * Author: robertaga
+ */
+
+#ifndef HDR_GPS_TASK_H_
+#define HDR_GPS_TASK_H_
+
+#include "m2mb_types.h"
+
+typedef enum {
+ START_GPS,
+ STOP_GPS
+
+} GPS_APP_STATUS;
+
+
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2);
+
+
+#endif /* HDR_GPS_TASK_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/metadata.json
index b57e11d4..36f2c370 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
@@ -58,6 +71,7 @@
],
"requires": {
"core/azx_log": "master",
- "core/azx_utils": "master"
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
}
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/M2MB_main.c
index 366f7604..3c6540ae 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/M2MB_main.c
@@ -13,16 +13,16 @@
@description
Sample application showing how to use GNSS functionality. Debug prints on USB0
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@author
-
+ Roberta Galeazzo
@date
- 23/10/2019
+ 12/10/2021
*/
/* Include files ================================================================================*/
@@ -36,71 +36,22 @@
#include "m2mb_os_api.h"
#include "m2mb_os.h"
#include "m2mb_os_sem.h"
-#include "m2mb_gnss.h"
+
+#include "gnss_task.h"
#include "azx_log.h"
#include "azx_utils.h"
-
+#include "azx_tasks.h"
#include "app_cfg.h"
/* Local defines ================================================================================*/
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
+INT32 gpsTask;
-void sleep_ms(UINT32 ms)
-{
- m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
-}
-
-
-void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
-{
- locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
-
- AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
- AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
-
- AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
- AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
-
- AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
- AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
-
- AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
- AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
-
- AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
- AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
- AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
- AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
-
- AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
- AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
-
- AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
- AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
-
- return;
-}
-
-void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
-{
- (void)handle;
- (void)resp_size;
- (void)userdata;
-
- if(event == M2MB_GNSS_INDICATION_POSITION_REPORT)
- {
- printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
- }
- else
- {
- AZX_LOG_INFO("gnssCallback_test => event FAIL\r\n");
- }
-}
@@ -119,65 +70,31 @@ void M2MB_main( int argc, char **argv )
(void)argc;
(void)argv;
- void *userdata = NULL;
-
- M2MB_GNSS_HANDLE handle1;
-
- azx_sleep_ms(2000);
-
- AZX_LOG_INIT();
- AZX_LOG_INFO("Starting GNSS demo app. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
- {
- return;
- }
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
-
- AZX_LOG_INFO("m2mb_gnss_enable OK\r\n");
-
-
-
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
- {
- return;
- }
+ azx_sleep_ms(2000);
- AZX_LOG_INFO("m2mb_gnss_start OK\r\n");
+ AZX_LOG_INIT();
+ azx_tasks_init();
+ AZX_LOG_INFO("\r\nStarting GNSS demo app. This is v%s built on %s %s.\r\n\r\n",
+ VERSION, __DATE__, __TIME__);
- /*
- * System will start to execute the callback function.
- */
+ gpsTask = azx_tasks_createTask((char*) "myGPSTask", AZX_TASKS_STACK_L, 1, AZX_TASKS_MBOX_S, GPS_task);
- azx_sleep_ms(120000);
+ azx_sleep_ms(1000);
+ if (gpsTask > 0){
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+ azx_tasks_sendMessageToTask(gpsTask, START_GPS, 0, 0 );
+ AZX_LOG_TRACE("Tasks %d created!\r\n", gpsTask);
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, M2MB_GNSS_SERVICE_POSITION_REPORT ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+ } else{
- if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
- {
- return;
- }
- AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ AZX_LOG_ERROR("Cannot create tasks!\r\n");
+ return;
+ }
+ azx_sleep_ms(2000);
+
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/gnss_task.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/gnss_task.c
new file mode 100755
index 00000000..bd1d23a3
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GNSS/src/gnss_task.c
@@ -0,0 +1,365 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application showing how to use GNSS functionality. Debug prints on $OUTPUT
+ @version
+ 1.0.2
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 12/10/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+#include "m2mb_os_sem.h"
+#include "m2mb_gnss.h"
+#include "m2mb_info.h"
+
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+#include "gnss_task.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define GPS_BIT (UINT32)0x1 /*0x0000000000000001*/
+
+#ifndef M2MB_GNSS_WWAN_GNSS_PRIORITY_E
+ #define GNSS_MEX10G1 0
+#else
+ #define GNSS_MEX10G1 1
+#endif
+/* Local typedefs ===============================================================================*/
+
+typedef enum{
+ MEX10C1,
+ MEX10G1,
+ LE910CX,
+ LE910CX_X,
+ NONE
+} MODULE_TYPE_E;
+
+/* Local statics ================================================================================*/
+
+void *userdata = NULL;
+
+M2MB_GNSS_HANDLE handle1;
+UINT8 priority;
+UINT32 TBF;
+UINT8 constellation;
+
+const CHAR *gnssServ[] = {"POSITION", "NMEA sentences"};
+
+M2MB_GNSS_SERVICE_E gnss_service;
+MODULE_TYPE_E moduleType;
+static M2MB_OS_EV_HANDLE gps_evHandle = NULL;
+//static UINT32 sentenceNum = 0;
+
+extern INT32 gpsTask;
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+MODULE_TYPE_E getModuleType(void)
+{
+M2MB_RESULT_E res;
+M2MB_INFO_HANDLE hInfo;
+CHAR *info;
+MODULE_TYPE_E moduleType = NONE;
+
+ res = m2mb_info_init(&hInfo);
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible init info\r\n");
+ }
+ else
+ {
+ res = m2mb_info_get(hInfo, M2MB_INFO_GET_MODEL, &info);
+
+ if (res != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Impossible to get model\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("Model: %s\r\n", info);
+ if (strstr(info, "G1") != NULL)
+ {
+ AZX_LOG_TRACE("Type: %d\r\n", MEX10G1);
+ moduleType = MEX10G1;
+ }
+ else if (info[0] == 'M' && strstr(info, "C1"))
+ {
+ AZX_LOG_TRACE("type: %d\r\n", MEX10C1);
+ moduleType = MEX10C1;
+ }
+ else if ( strstr(info, "LE910C"))
+ {
+ if (info[strlen(info) -1 ] == 'X')
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX_X);
+ moduleType = LE910CX_X;
+ }
+ else
+ {
+ AZX_LOG_TRACE("type: %d\r\n", LE910CX);
+ moduleType = LE910CX;
+ }
+ }
+ }
+ m2mb_info_deinit(hInfo);
+ }
+ return moduleType;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void printGnssInfo_test( M2MB_GNSS_POSITION_REPORT_INFO_T *locData )
+{
+ locData->speed.speed = sqrt( pow( locData->speed.speed_horizontal,2 ) + pow( locData->speed.speed_vertical,2 ) );
+
+ AZX_LOG_INFO("latitude_valid: %d - ", locData->latitude_valid );
+ AZX_LOG_INFO("latitude: %f\r\n", locData->latitude );
+
+ AZX_LOG_INFO("longitude_valid: %d - ", locData->longitude_valid );
+ AZX_LOG_INFO("longitude: %f\r\n", locData->longitude );
+
+ AZX_LOG_INFO("altitude_valid: %d - ", locData->altitude_valid );
+ AZX_LOG_INFO("altitude: %f\r\n", locData->altitude );
+
+ AZX_LOG_INFO("uncertainty_valid: %d - ", locData->uncertainty_valid );
+ AZX_LOG_INFO("uncertainty: %f\r\n", locData->uncertainty );
+
+ AZX_LOG_INFO("velocity_valid: %d - ", locData->velocity_valid );
+ AZX_LOG_INFO("codingType: %d\r\n", locData->velocity.codingType );
+ AZX_LOG_INFO("speed_horizontal: %f\r\n", locData->velocity.speed_horizontal );
+ AZX_LOG_INFO("bearing: %f\r\n", locData->velocity.bearing );
+
+ AZX_LOG_INFO("timestamp_valid: %d -", locData->timestamp_valid );
+ AZX_LOG_INFO("timestamp: %llu\r\n", locData->timestamp ); // milliseconds since Jan. 1, 1970
+
+ AZX_LOG_INFO("speed_valid: %d - ", locData->speed_valid );
+ AZX_LOG_INFO("speed: %f\r\n\r\n", locData->speed.speed );
+
+ return;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+void gnssCallbackFN( M2MB_GNSS_HANDLE handle, M2MB_GNSS_IND_E event, UINT16 resp_size, void *resp, void *userdata )
+{
+ (void)handle;
+ (void)resp_size;
+ (void)userdata;
+ //INT32 retVal;
+
+ //AZX_LOG_DEBUG("gnssCallback[%d]\r\n", sentenceNum);
+ switch (event){
+
+ case M2MB_GNSS_INDICATION_POSITION_REPORT:
+ {
+ printGnssInfo_test( (M2MB_GNSS_POSITION_REPORT_INFO_T *)resp );
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+#if GNSS_MEX10G1
+ case M2MB_GNSS_INDICATION_NMEA_REPORT:
+ {
+ AZX_LOG_INFO("NMEA: %s\r\n", (CHAR*)resp);
+ m2mb_os_ev_set(gps_evHandle,GPS_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+#endif
+ default:
+ AZX_LOG_WARN("unexpected event\r\n");
+ break;
+ }
+ //sentenceNum++;
+
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/***************************************************************************************************
+ GPS_task handles GPS init, configuration, start and stop
+ **************************************************************************************************/
+INT32 GPS_task(INT32 type, INT32 param1, INT32 param2){
+
+M2MB_OS_RESULT_E osRes;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+//INT32 retVal;
+#if GNSS_MEX10G1
+M2MB_RESULT_E res;
+#endif
+ (void)param1;
+ (void)param2;
+
+
+ switch(type){
+
+ case START_GPS:
+ {
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "gps_ev"));
+ osRes = m2mb_os_ev_init( &gps_evHandle, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS ){
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return -1;
+ } else {
+
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+
+ }
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_init( &handle1, gnssCallbackFN, userdata ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable NMEA REPORT, failed!\r\n");
+ return -1;
+ }
+
+ moduleType = getModuleType();
+
+ /*this part is available ONLY for MEX10G1 products*/
+#if GNSS_MEX10G1
+ if(moduleType == MEX10G1){
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_PRIORITY, &priority);
+
+ AZX_LOG_INFO("Priority: %d\r\n", priority);
+
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_TBF, &TBF);
+ AZX_LOG_INFO("TBF: %d\r\n", TBF);
+ m2mb_gnss_getcfg(handle1, M2MB_GNSS_CONSTELLATION, &constellation);
+ AZX_LOG_INFO("constellation: %d\r\n", constellation);
+
+ /*To start getting GPS position priority MUST be set to GNSS */
+ res = m2mb_gnss_set_prio_runtime(handle1, GNSS_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to GNSS_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to GNSS_PRIORITY, start GPS\r\n");
+ }
+
+ }
+#endif
+ /*
+ * on MEX10G1 both M2MB_GNSS_SERVICE_NMEA_REPORT and M2MB_GNSS_SERVICE_POSITION_REPORT services are available, while
+ * on ME910C1 product family only M2MB_GNSS_SERVICE_POSITION_REPORT is available
+ */
+
+ if(moduleType == MEX10G1){
+ //gnss_service = M2MB_GNSS_SERVICE_NMEA_REPORT; /*On MEx10G1 family NMEA report sentences can be enabled as well*/
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ } else {
+ gnss_service = M2MB_GNSS_SERVICE_POSITION_REPORT;
+ }
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_enable( handle1, gnss_service) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_enable %s REPORT, failed!\r\n", gnssServ[gnss_service]);
+ return -1;
+ }
+
+ AZX_LOG_INFO("\r\nm2mb_gnss_enable, %s OK\r\n",gnssServ[gnss_service]);
+
+
+ /*
+ * System will start to execute the callback function.
+ */
+
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_start( handle1 ) )
+ {
+ AZX_LOG_ERROR("Failed to start GPS\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("\r\nm2mb_gnss_start OK, waiting for position/nmea sentences...\r\n");
+ /*Wait for GPS fix/NMEA sentences event to occur (released in gnssCallbackFN function) */
+ m2mb_os_ev_get(gps_evHandle, GPS_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ AZX_LOG_INFO("\r\n***** Wait 120 seconds and then stop GPS *****\r\n\r\n");
+
+ azx_sleep_ms(120000);
+
+ azx_tasks_sendMessageToTask(gpsTask, STOP_GPS, 0, 0 );
+
+ }
+ break;
+
+ case STOP_GPS:
+ {
+ AZX_LOG_INFO("***** 120 seconds expired *****\r\n\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_stop( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_stop fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_stop OK\r\n");
+
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_disable( handle1, gnss_service ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_disable fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_disable OK\r\n");
+
+#if GNSS_MEX10G1
+ /*Restore priority to WWAN */
+ if(moduleType == MEX10G1){
+ res = m2mb_gnss_set_prio_runtime(handle1, WWAN_PRIORITY);
+ if(res != M2MB_RESULT_SUCCESS){
+ AZX_LOG_ERROR("Can't change the priority to WWAN_PRIORITY!\r\n");
+ } else {
+ AZX_LOG_INFO("Priority changed to WWAN_PRIORITY, stop GPS\r\n");
+ }
+ }
+#endif
+ if( M2MB_RESULT_SUCCESS != m2mb_gnss_deinit( handle1 ) )
+ {
+ AZX_LOG_ERROR("m2mb_gnss_deinit fail\r\n");
+ return -1;
+ }
+ AZX_LOG_INFO("m2mb_gnss_deinit OK\r\n");
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ return 0;
+
+
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/metadata.json
old mode 100755
new mode 100644
index b1b1cf51..cfc78137
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/GPIO_Interrupt/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/metadata.json
old mode 100755
new mode 100644
index ab02a67b..8f676908
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/General_INFO/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/Makefile.in
index 16c1cc4e..6766a0cc 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/metadata.json
old mode 100755
new mode 100644
index 3747302d..060974df
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HTTP_Client/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/metadata.json
old mode 100755
new mode 100644
index 4f8edfd2..15b9cfd0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HW_Timer/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -40,9 +42,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/metadata.json
old mode 100755
new mode 100644
index bf0d29f9..423336f2
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/HelloWorld/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/metadata.json
old mode 100755
new mode 100644
index 61742456..52fc9d8f
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -37,9 +39,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/README.md
index 567efd48..88962d64 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/README.md
@@ -1,7 +1,7 @@
### I2C Combined
-Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on **USB0**
+Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
**Features**
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/description.txt
index 33a38b73..0121c0d4 100644
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/description.txt
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/description.txt
@@ -1 +1 @@
-Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on USB0
+Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/metadata.json
old mode 100755
new mode 100644
index fbc342c8..e4331c15
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/metadata.json
@@ -11,19 +11,20 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -33,9 +34,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/src/M2MB_main.c
index 82f4c0f7..ed55f5cc 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/I2C_Combined/src/M2MB_main.c
@@ -11,9 +11,9 @@
@details
@description
- Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on USB0
+ Sample application showing how to communicate with an I2C slave device with I2C raw mode. Debug prints on MAIN UART
@version
- 1.0.1
+ 1.0.2
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -266,7 +266,7 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
M2MB_I2C_CFG_T i2c_data = {0};
M2MB_I2C_RDWR_IOCTL_DATA rdrw_data = {0};
- M2MB_I2C_MSG msgs[2];
+ M2MB_I2C_MSG msgs[1];
/* Retrieve current channel config */
i2c_res = m2mb_i2c_ioctl(fd, M2MB_I2C_IOCTL_GET_CFG, (void *)&i2c_data);
@@ -291,9 +291,6 @@ INT32 configI2CRegister(INT32 fd, UINT8 regAddr, const char* regName, UINT8 byte
msgs[0].len = 2; /* How many bytes to be written: register + data*/
msgs[0].buf = i2cbuf_wr; /* Assign write buffer to message struct [0]*/
- msgs[1].buf = NULL;
- msgs[1].flags = 0;
- msgs[1].len = 0;
/* Set i2c data struct rw parameters messages pointer to msgs */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/Makefile.in
index df1330cb..2da0cfe4 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/metadata.json
old mode 100755
new mode 100644
index 4e7fc877..fc5d00f0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LFS2/metadata.json
@@ -15,14 +15,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,8 +40,14 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/README.md
index 1b542c09..d2ecaeb6 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/README.md
@@ -21,6 +21,16 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage write, read and monitoring resources changed from the portal
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
**Application workflow**
**`M2MB_main.c`**
@@ -35,8 +45,6 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
**`msgLWM2MTask`**
- Check registration status
-- Configure APN to the correct one for CID 1
-
- Initialize LWM2M client,
- Check for XML file fo custom object
@@ -51,7 +59,9 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Wait for client to register to Portal
- - Send integer and string values
+ - Performs all operations (set, read, get, write) on the related resources
+
+ - Performs a set with notify ack enabled
- Wait for events from server
@@ -61,6 +71,15 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage events arriving from client \(operations completion status and unsolicited events\)
- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
#### Custom Object configuration
The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
@@ -86,10 +105,10 @@ Copy the xml file content and paste it in the new Object form
-Also, the application requires the XML file `/xml/object_35000.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+Also, the application requires the XML file `/xml/object_32010.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
It can be done with
-`AT#M2MWRITE=/XML/object_35000.xml,`
+`AT#M2MWRITE=/XML/object_32010.xml,`
To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
@@ -110,7 +129,14 @@ The file is successfully loaded on the module

-
+
+
+
+
+
+
+
+
After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
@@ -125,7 +151,7 @@ For example, executing the two Exec Resources at the bottom of the list, the app

-Writing a string resource (id /35000/0/11 ), the application will notify the change
+Writing a string resource (id /32010/0/11 ), the application will notify the change

diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_demo.h
index abb12868..0eb5f70e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_demo.h
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_demo.h
@@ -14,6 +14,7 @@
@note
Dependencies:
m2mb_types.h
+ m2mb_lwm2m.h
@author
@@ -28,9 +29,7 @@
/* Global declarations ==========================================================================*/
-/*cellular event bits*/
-#define EV_NET_BIT (UINT32)0x1
-#define EV_PDP_BIT (UINT32)0x2
+
/*LWM2M event bits*/
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
@@ -42,11 +41,90 @@
#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000100
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000200
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00001000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
#define EV_MON_URC_RECEIVED 2
#define EV_URC_TO_BE_ENABLED 3
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32010
+#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
+#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
+#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
+#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
+#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
+#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
+#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
+
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
+#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
+#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
+#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
+#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
+#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
+#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
+#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
+#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
+#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
+
+#define DEMO_STRING_W_RES_ID 41 /* single string resource, Write only*/
+#define DEMO_INT_W_RES_ID 42 /* single integer resource, Write only*/
+#define DEMO_FLOAT_W_RES_ID 43 /* single floating point resource, Write only*/
+#define DEMO_BOOL_W_RES_ID 44 /* single boolean resource, Write only*/
+#define DEMO_OPAQUE_W_RES_ID 45 /* single opaque (raw data) resource, Write only*/
+#define DEMO_TIME_W_RES_ID 46 /* single time resource, Write only*/
+#define DEMO_OBJLINK_W_RES_ID 47 /* single object link resource, Write only*/
+
+#define DEMO_MULTI_STRING_W_RES_ID 51 /* multiple string resource, Write only*/
+#define DEMO_MULTI_INT_W_RES_ID 52 /* multiple integer resource, Write only*/
+#define DEMO_MULTI_FLOAT_W_RES_ID 53 /* multiple floating point resource, Write only*/
+#define DEMO_MULTI_BOOL_W_RES_ID 54 /* multiple boolean resource, Write only*/
+#define DEMO_MULTI_OPAQUE_W_RES_ID 55 /* multiple opaque (raw data) resource, Write only*/
+#define DEMO_MULTI_TIME_W_RES_ID 56 /* multiple time resource, Write only*/
+#define DEMO_MULTI_OBJLINK_W_RES_ID 57 /* multiple object link resource, Write only*/
+
+#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
+
+
+#define OBJECT_XML_NAME "object_32010.xml"
+
/* Global typedefs ==============================================================================*/
typedef enum {
@@ -55,9 +133,9 @@ typedef enum {
APPLICATION_EXIT
} APP_STATES;
-/* Global functions =============================================================================*/
+/* Global functions =============================================================================*/
/**
@brief Initialize OneEdge connection
@@ -67,10 +145,5 @@ typedef enum {
*/
UINT8 oneedge_init( void );
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value);
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result);
-
-
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..1d975a09
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"617276d580cbbb0af346d50a","name":"LwM2M resources demo","observations":[{"objId":32010,"instId":0,"resId":2}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/metadata.json
index 79edba62..3562cf60 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/metadata.json
@@ -13,31 +13,40 @@
"MXXXXC1": {
"firmwares": [
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
- "firmwares": [
- "25.30.xx1",
- "25.30.xx2"
- ]
+ "firmwares": []
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c
index e1c1442a..d4ba1e10 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -75,11 +75,7 @@ void M2MB_main( int argc, char **argv )
AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_demo.c
index 764c7cb3..ff66f157 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_demo.c
@@ -10,8 +10,8 @@
@details
- @version
- 1.0.2
+ @version
+ 1.0.4
@note
@@ -46,70 +46,12 @@
#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
/* Local defines ================================================================================*/
-#define APN "web.omnitel.it"
#define CTX_ID 1 /*PDP context ID*/
-/*OBJECTs and RESOURCEs IDs*/
-#define DEVICE_OBJ_ID 3
-#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
-
-
-#define LOCATION_OBJ_ID 6
-#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
-#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
-
-#define CONN_STATS_OBJ_ID 7
-#define CONN_STATS_STOP_EXEC_RES_ID 7
-#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
-
-#define APN_CONN_PROFILE_OBJ_ID 11
-#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
-
-#define M2MB_LWM2M_DEMO_OBJ_ID 35000
-#define DEMO_STRING_R_RES_ID 1 /* single string resource, Read only*/
-#define DEMO_INT_R_RES_ID 2 /* single integer resource, Read only*/
-#define DEMO_FLOAT_R_RES_ID 3 /* single floating point resource, Read only*/
-#define DEMO_BOOL_R_RES_ID 4 /* single boolean resource, Read only*/
-#define DEMO_OPAQUE_R_RES_ID 5 /* single opaque (raw data) resource, Read only*/
-#define DEMO_TIME_R_RES_ID 6 /* single time resource, Read only*/
-#define DEMO_OBJLINK_R_RES_ID 7 /* single object link resource, Read only*/
-
-#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
-#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
-#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
-#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
-#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
-#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
-#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
-
-#define DEMO_MULTI_STRING_R_RES_ID 21 /* multiple string resource, Read only*/
-#define DEMO_MULTI_INT_R_RES_ID 22 /* multiple integer resource, Read only*/
-#define DEMO_MULTI_FLOAT_R_RES_ID 23 /* multiple floating point resource, Read only*/
-#define DEMO_MULTI_BOOL_R_RES_ID 24 /* multiple boolean resource, Read only*/
-#define DEMO_MULTI_OPAQUE_R_RES_ID 25 /* multiple opaque (raw data) resource, Read only*/
-#define DEMO_MULTI_TIME_R_RES_ID 26 /* multiple time resource, Read only*/
-#define DEMO_MULTI_OBJLINK_R_RES_ID 27 /* multiple object link resource, Read only*/
-
-#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
-#define DEMO_MULTI_INT_RW_RES_ID 32 /* multiple integer resource, Read + Write*/
-#define DEMO_MULTI_FLOAT_RW_RES_ID 33 /* multiple floating point resource, Read + Write*/
-#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
-#define DEMO_MULTI_OPAQUE_RW_RES_ID 35 /* multiple opaque (raw data) resource, Read + Write*/
-#define DEMO_MULTI_TIME_RW_RES_ID 36 /* multiple time resource, Read + Write*/
-#define DEMO_MULTI_OBJLINK_RW_RES_ID 37 /* multiple object link resource, Read + Write*/
-
-#define DEMO_EXEC1_RES_ID 101 /* execute resource 1*/
-#define DEMO_EXEC2_RES_ID 102 /* execute resource 2*/
-
-
-#define OBJECT_XML_NAME "object_35000.xml"
-
-
-
-
/* Local typedefs ===============================================================================*/
/* Local statics ================================================================================*/
@@ -135,24 +77,17 @@ const char *CL_STATUS_STRING[] =
"M2MB_LWM2M_CL_STATE_SUSPENDED"
};
-
-M2MB_OS_EV_HANDLE net_pdp_evHandle = NULL;
-
-static M2MB_PDP_HANDLE pdpHandle = NULL;
-
static INT8 lwm2m_taskID;
/*===== ONEEDGE =====*/
/*Handles*/
static M2MB_LWM2M_HANDLE lwm2mHandle;
-static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
/*URI objects*/
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
- 33211, 0,
- 0,1};
+ 33211, 0, 0, 1};
/* Local function prototypes ====================================================================*/
@@ -186,57 +121,46 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz)
/* Static functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
(void) param2;
- MEM_W data_buffer[256] = {0};
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
INT32 data_int = 0;
- UINT32 data_time = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
double data_float = 0;
- M2MB_RESULT_E retVal;
+
+ INT32 retVal;
M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
M2MB_LWM2M_OBJ_URI_T uri = *pUri;
- M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
m2mb_os_free(pUri);
uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
switch(event)
{
- case EV_MON_URC_RECEIVED:
+ case EV_MON_URC_RECEIVED:
AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
-
- memset(data_buffer,0,sizeof(data_buffer));
- retVal = m2mb_lwm2m_read( lwm2mHandle, &(uri), data_buffer, sizeof(data_buffer));
-
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "LWM2M read request succeeded\r\n" );
- }
- else
- {
- AZX_LOG_ERROR("Read request failed\r\n");
- return retVal;
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
{
switch(uri.resource)
@@ -253,16 +177,21 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_STRING_RW_RES_ID:
/*fallback*/
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_STRING;
AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- data_buffer );
-
+ string_buffer );
break;
-
-
/* ==================
*
* INTEGER TYPES
@@ -277,13 +206,14 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = (INT32) ( (INT32 *)data_buffer )[0];
-
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_int);
-
break;
/* ==================
@@ -300,13 +230,16 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
- /*Cast the data buffer as an integers array and take the first element*/
- data_float = (double) ( (double *)data_buffer )[0];
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_float );
-
break;
@@ -321,15 +254,15 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
case DEMO_MULTI_BOOL_RW_RES_ID:
/*fallback*/
- /*Store data_type for further management*/
- data_type = M2MB_LWM2M_DATA_TYPE_BOOLEAN;
-
- /*Cast the data buffer as an integers array and take the first element*/
- data_int = !!((INT32) ( (INT32 *)data_buffer )[0]);
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
- (data_int>0)? "true":"false");
+ (data_bool)? "true":"false");
break;
@@ -348,13 +281,17 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_TIME;
- /*Cast the data buffer as an integers array and take the first element*/
- data_time = (INT32) ( (INT32 *)data_buffer )[0];
- convertUnixTimeToRTC_TIME((time_t) (data_time), &time_struct, 0);
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
- AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %d"
- "(%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
uri.obj, uri.objInst, uri.resource, uri.resourceInst,
data_time,
time_struct.year, time_struct.mon, time_struct.day,
@@ -375,16 +312,151 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
{
/*fallback*/
int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+
+
+
+ /* *************************
+ *
+ * WRITE ONLY TYPES
+ *
+ * *************************/
+
+ case DEMO_STRING_W_RES_ID:
+ case DEMO_MULTI_STRING_W_RES_ID:
+ /*fallback*/
+
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = get_write_only_string_resource(lwm2mHandle, &(uri), string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ case DEMO_INT_W_RES_ID:
+ case DEMO_MULTI_INT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = get_write_only_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ case DEMO_FLOAT_W_RES_ID:
+ case DEMO_MULTI_FLOAT_W_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = get_write_only_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+ case DEMO_BOOL_W_RES_ID:
+ case DEMO_MULTI_BOOL_W_RES_ID:
+ /*fallback*/
+
+ retVal = get_write_only_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+ break;
+
+ case DEMO_TIME_W_RES_ID:
+ case DEMO_MULTI_TIME_W_RES_ID:
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = get_write_only_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ break;
+
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,data_size);
+ retVal = get_write_only_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
/*Store data_type for further management*/
data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
- AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content:\r\n",
- uri.obj, uri.objInst, uri.resource, uri.resourceInst);
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
- for (i=0; i < (int)(sizeof(data_buffer) / sizeof(data_buffer[0])); i++)
+ for (i=0; i < data_size; i++)
{
- AZX_LOG_INFO("%02X ", data_buffer[i]);
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
}
AZX_LOG_INFO("\r\n");
}
@@ -413,13 +485,23 @@ static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
return 1;
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
( void ) h;
( void ) resp_size;
- ( void ) userdata;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
/* Client generated events */
switch( event )
@@ -432,11 +514,35 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_INFO( "LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -448,11 +554,12 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -461,20 +568,22 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
case M2MB_LWM2M_READ_RES:
{
M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
- AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
- AZX_LOG_DEBUG("Read type: %d; size: %u\r\n",
- resp->resType,
- resp->len
- );
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
}
else
{
AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -486,14 +595,50 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if(resp->result == M2MB_LWM2M_RES_SUCCESS)
{
AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
}
else
{
- AZX_LOG_WARN( "Enable write %d\r\n", resp->result );
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
}
break;
}
+
/* event in response to m2mb_lwm2m_new_inst() */
case M2MB_LWM2M_NEW_INST_RES:
{
@@ -541,7 +686,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
case M2MB_LWM2M_CL_STATE_REGISTERED:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
break;
case M2MB_LWM2M_CL_STATE_DEREGISTERING:
AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
@@ -587,6 +732,68 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
break;
}
+ case M2MB_LWM2M_NFYACK_URI_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_uri */
+ M2MB_LWM2M_NFYACK_URI_RES_T *resp = ( M2MB_LWM2M_NFYACK_URI_RES_T * )resp_struct;
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_uri response OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_STATUS_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_status */
+ M2MB_LWM2M_NFYACK_STATUS_RES_T *resp = ( M2MB_LWM2M_NFYACK_STATUS_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "Current status for Notify Ack reporting is %s\r\n\r\n", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_LIST_RES:
+ {
+ /* event in response to the m2mb_lwm2m_nfy_ack_list */
+ M2MB_LWM2M_NFYACK_LIST_RES_T *resp = ( M2MB_LWM2M_NFYACK_LIST_RES_T * )resp_struct;
+
+ if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_LIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_NFYACK_INFO_IND:
+ {
+ /* event that brings a Notify Ack information */
+ M2MB_LWM2M_NFYACK_INFO_IND_T *pInfo = ( M2MB_LWM2M_NFYACK_INFO_IND_T * )resp_struct;
+
+ if( pInfo )
+ {
+ AZX_LOG_TRACE( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s\r\n",
+ pInfo->agent,
+ pInfo->shServerId,
+ pInfo->uri.obj,
+ pInfo->uri.objInst,
+ pInfo->uri.resource,
+ ( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
+
+ if(pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
case M2MB_LWM2M_SESSION_INFO_IND:
{
AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
@@ -606,9 +813,6 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC1_RES_ID);
break;
- case DEMO_EXEC2_RES_ID:
- AZX_LOG_INFO("Asked to execute resource %d\r\n", DEMO_EXEC2_RES_ID);
- break;
default:
AZX_LOG_WARN("\r\nUnexpected exec resource URI {%u/%u/%u/%u (%u)}!\r\n",
execUri.obj, execUri.objInst, execUri.resource, execUri.resourceInst, execUri.uriLen );
@@ -634,7 +838,7 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
@@ -650,18 +854,24 @@ static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UI
{
AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
}
break;
}
-
default:
AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
break;
}
}
-
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
static int check_xml_file(const char* name)
{
char path[64] = {0};
@@ -692,7 +902,16 @@ static int check_xml_file(const char* name)
}
}
-//strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&now)
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
{
struct tm *_utctime = NULL;
@@ -717,279 +936,47 @@ static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT
}
-
/* Global functions =============================================================================*/
-INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, int value)
+
+UINT8 oneedge_init( void)
{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- value);
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
}
- else
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- value);
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
}
- M2MB_RESULT_E retVal = m2mb_lwm2m_set( h, pUri, &value, sizeof(int));
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M set timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-INT32 write_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
-{
- UINT32 curEvBits;
- if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
- {
- AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to %s on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource,
- data);
- }
- else
- {
- AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
- pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
- data);
- }
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, data, strlen(data));
-
- //retVal is just the return value of the API, not the completed operation
- //the completed operation ends when an event is raised into the callback
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
- return -1;
- }
-
- if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
- )
- )
- {
- AZX_LOG_ERROR("LWM2M write timeout!\r\n");
- return -2;
- }
- else
- {
- return 0;
- }
-
-}
-
-
-M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result)
-{
- int data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for integer from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%d> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-M2MB_RESULT_E read_double_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *result)
-{
- double data[2];
- M2MB_RESULT_E retVal;
-
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
-
- AZX_LOG_TRACE("m2mb_lwm2m_read for double from {%d/%d/%d}\r\n",
- pUri->obj, pUri->objInst, pUri->resource );
-
- retVal = m2mb_lwm2m_read( h, pUri, data, sizeof(data));
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_lwm2m_read request succeeded\r\n" );
- }
-
- /*wait for event*/
- AZX_LOG_TRACE("Waiting LWM2M read complete (10 seconds)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(10000));
- if(osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M read timeout!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- *result = data[0];
- AZX_LOG_TRACE("Received data <%f> from portal\r\n", *result);
- return M2MB_RESULT_SUCCESS;
-}
-
-
-
-void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
-{
- (void)resp_size;
- (void)myUserdata;
-
- M2MB_NET_REG_STATUS_T *stat_info;
-
- switch (net_event)
- {
-
-
-
- case M2MB_NET_GET_REG_STATUS_INFO_RESP:
- stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
- if (stat_info->stat == 1 || stat_info->stat == 5)
- {
- AZX_LOG_TRACE("Module is registered to cell 0x%X!\r\n", stat_info->cellID);
- m2mb_os_ev_set(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- m2mb_net_get_reg_status_info(h); //try again
- }
- break;
-
-
- default:
- AZX_LOG_DEBUG("unexpected net_event: %d\r\n", net_event);
- break;
-
- }
-}
-
-void PdpCallback(M2MB_PDP_HANDLE h, M2MB_PDP_IND_E pdp_event, UINT8 cid, void *userdata)
-{
- (void)userdata;
- struct M2MB_SOCKET_BSD_SOCKADDR_IN CBtmpAddress;
- CHAR CBtmpIPaddr[32];
-
- switch (pdp_event)
- {
- case M2MB_PDP_UP:
- AZX_LOG_DEBUG ("Context activated!\r\n");
- m2mb_pdp_get_my_ip(h, cid, M2MB_PDP_IPV4, &CBtmpAddress.sin_addr.s_addr);
- m2mb_socket_bsd_inet_ntop( M2MB_SOCKET_BSD_AF_INET, &CBtmpAddress.sin_addr.s_addr, ( CHAR * )&( CBtmpIPaddr ), sizeof( CBtmpIPaddr ) );
- AZX_LOG_TRACE( "IP address: %s\r\n", CBtmpIPaddr);
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_SET);
- break;
-
- case M2MB_PDP_DOWN:
- AZX_LOG_TRACE ("Context deactivated!\r\n");
- m2mb_os_ev_set(net_pdp_evHandle, EV_PDP_BIT, M2MB_OS_EV_CLEAR);
- break;
- default:
- AZX_LOG_DEBUG("unexpected pdp_event: %d\r\n", pdp_event);
- break;
-
- }
-}
-
-UINT8 oneedge_init( void)
-{
- M2MB_RESULT_E retVal;
- M2MB_LWM2M_ENABLE_REQ_T pars;
-
- INT32 service_enable = 1;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
- UINT32 curEvBits;
-
-
- if(0 != check_xml_file(OBJECT_XML_NAME))
- {
- AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
- return 1;
- }
-
-
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
- osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
-
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
-
- //get the handle of the lwm2m client on _h
- retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )NULL );
-
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- return 1;
- }
-
- retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
- if( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
-
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
}
lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_S, lwm2m_taskCB);
@@ -998,7 +985,6 @@ UINT8 oneedge_init( void)
if(lwm2m_taskID <= 0)
{
AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
@@ -1014,12 +1000,11 @@ UINT8 oneedge_init( void)
if( retVal != M2MB_RESULT_SUCCESS )
{
AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
m2mb_lwm2m_deinit( lwm2mHandle );
return 1;
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_ENABLE_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1028,40 +1013,80 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
azx_sleep_ms(2000);
m2mb_lwm2m_deinit(lwm2mHandle);
return 1;
}
-
-
azx_sleep_ms(1000);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ /* query of the custom object URI for agent 0 (Telit)*/
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_R_RES_ID;
+ exist_uri.resourceInst = 0;
- /*Create an instance of the demo's custom object*/
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
{
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
- M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
- new_inst_params.agent = 0; /*Telit Agent*/
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
- /*If OK the instance was not present, and so it was created. If an error
- is received in the callback, it is likely because the instance already exists. */
- retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
- if( retVal != M2MB_RESULT_SUCCESS )
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
{
- AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
- m2mb_os_ev_deinit( eventsHandleLwm2m );
- m2mb_lwm2m_deinit( lwm2mHandle );
- return 1;
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
}
}
+
/*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
{
M2MB_LWM2M_MON_REQ_T mon;
@@ -1082,7 +1107,7 @@ UINT8 oneedge_init( void)
}
if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_MON_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1091,7 +1116,7 @@ UINT8 oneedge_init( void)
)
{
AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1101,11 +1126,11 @@ UINT8 oneedge_init( void)
}
AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_MS2TICKS(120000));
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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( eventsHandleLwm2m );
+
m2mb_lwm2m_disable(lwm2mHandle);
azx_sleep_ms(2000);
@@ -1116,6 +1141,8 @@ UINT8 oneedge_init( void)
return 0;
}
+/*-----------------------------------------------------------------------------------------------*/
+
INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
{
@@ -1123,104 +1150,22 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
(void)param1;
(void)param2;
- M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
-
- M2MB_OS_RESULT_E osRes;
- M2MB_OS_EV_ATTR_HANDLE evAttrHandle = NULL;
UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_OBJ_URI_T resource_uri = {0};
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- M2MB_NET_HANDLE netHandle = NULL;
INT32 ret = 0;
+ M2MB_RTC_TIMEVAL_T currTime = {1234567890, 0}; /*dummy value as fallback*/
+ INT32 rtcfd = -1;
int task_status = type;
- void *myUserdata = NULL;
do
{
AZX_LOG_INFO("Initializing resources...\r\n");
- /* Init events handler */
- osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
- osRes = m2mb_os_ev_init( &net_pdp_evHandle, &evAttrHandle );
-
- if ( osRes != M2MB_OS_SUCCESS )
- {
- m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
- AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
- task_status = APPLICATION_EXIT;
- break;
- }
- else
- {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- /* check network registration and configure PDP context */
- retVal = m2mb_net_init(&netHandle, NetCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- AZX_LOG_TRACE("Waiting for registration...\r\n");
-
- retVal = m2mb_net_get_reg_status_info(netHandle);
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- /*Wait for network registration event to occur (released in NetCallback function) */
- m2mb_os_ev_get(net_pdp_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
-
-
-
- AZX_LOG_TRACE("PDP context initialization\r\n");
- retVal = m2mb_pdp_init(&pdpHandle, PdpCallback, myUserdata);
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_init returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_init did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
-
- /*
- * Just set the APN, as LwM2M agent will automatically manage the connection.
- * !! This could require a reboot if LTE networks are in use !!
- *
- * */
- retVal = m2mb_pdp_APN_set( pdpHandle, 1 /*LWM2M uses CID 1 by default*/, (char*)APN );
- if ( retVal == M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_TRACE( "m2mb_pdp_APN_set returned M2MB_RESULT_SUCCESS\r\n");
- }
- else
- {
- AZX_LOG_ERROR( "m2mb_pdp_APN_set did not return M2MB_RESULT_SUCCESS\r\n" );
- task_status = APPLICATION_EXIT;
- break;
- }
-
- m2mb_pdp_deinit(pdpHandle);
-
-
+ init_sync();
azx_sleep_ms(8000);
@@ -1232,15 +1177,20 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
break;
}
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1){
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ } else {
- AZX_LOG_INFO("\r\nWaiting for events from portal. Write on monitored resource or call an exec\r\n\r\n");
+ AZX_LOG_ERROR("Cannot open RTC!");
+ }
/*Checking client status*/
m2mb_lwm2m_get_stat(lwm2mHandle);
if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
- eventsHandleLwm2m,
+ get_lwm2mEvents_handle(),
EV_LWM2M_GET_STAT_RES_BIT,
M2MB_OS_EV_GET_ANY_AND_CLEAR,
&curEvBits,
@@ -1251,12 +1201,17 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
return -2;
}
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
/* ==================================================
- * Sending a read only resource with a SET operation
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
resource_uri.resource = DEMO_INT_R_RES_ID;
@@ -1264,8 +1219,23 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 50);
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
* Filling resource URI with required parameters (multi instance read only integer, in this case)
@@ -1278,6 +1248,7 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 10);
+ azx_sleep_ms(5000);
/* ==================================================
* Sending a read only multi-instance resource with a SET operation
@@ -1288,47 +1259,768 @@ INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
set_read_only_integer_resource(lwm2mHandle, &resource_uri, 11);
+ azx_sleep_ms(5000);
-
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
/* ==================================================
- * Sending a string resource with a WRITE operation
+ * Sending a read only float resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only double, in this case)
* ==================================================*/
-
- /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
resource_uri.objInst = 0;
- resource_uri.resource = DEMO_STRING_RW_RES_ID;
- resource_uri.resourceInst = 0;
+ resource_uri.resource = DEMO_FLOAT_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- write_string_resource(lwm2mHandle, &resource_uri, (CHAR *)"demo_string");
+ set_read_only_double_resource(lwm2mHandle, &resource_uri, 20.5);
- while(1)
{
- /*Wait*/
- azx_sleep_ms(1000);
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
}
- task_status = APPLICATION_EXIT;
- } while(0);
- if (task_status == APPLICATION_EXIT)
- {
- if(pdpHandle)
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only boolean resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ set_read_only_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+
+ /* ==================================================
+ * Sending a read only timestamp resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only timestamp, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = (UINT64)currTime.sec;
+ //m2mb_lwm2m_set(lwm2mHandle, &resource_uri, &value, sizeof(value));
+ set_read_only_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+ /*Try and read again the set value*/
+ value = 0;
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a read only opaque resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ set_read_only_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a read only string resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_R_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ set_read_only_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /*------------------------ RW ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "READ-WRITE RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a r/w integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(read_rw_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a r/w boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(read_rw_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(read_rw_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_RW_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(read_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a r/w string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance rw string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_RW_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(read_rw_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+
+ /*------------------------ Write-only ------------------------------------*/
+
+
+ AZX_LOG_INFO("\r\n================================\r\n"
+ "WRITE-ONLY RESOURCES\r\n"
+ "================================\r\n");
+
+ /* ==================================================
+ * Sending a write-only integer resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w integer, in this case)
+ * ==================================================*/
+
+ /* Fill resource URI with required parameters (single instance read only integer, in this case)*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_integer_resource(lwm2mHandle, &resource_uri, 50);
+
+
+ {
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(get_write_only_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+
+ }
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only float resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w float, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_FLOAT_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_double_resource(lwm2mHandle, &resource_uri, 20.5);
+
+ {
+ /*Try and read again the set value*/
+ double value = 0;
+ if(get_write_only_double_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Double value is now %f\r\n", value);
+ }
+
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+
+ /* ==================================================
+ * Sending a write-only boolean resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w boolean, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_BOOL_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ write_rw_boolean_resource(lwm2mHandle, &resource_uri, TRUE);
+
+ {
+ /*Try and read again the set value*/
+ BOOLEAN value = 0;
+ if(get_write_only_boolean_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Boolean value is now %s\r\n", value? "true": "false");
+ }
+
+ }
+
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only time resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w time, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_TIME_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ if(m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime) == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %u\r\n", currTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time from module RTC!");
+ currTime.sec = 1583881200; /*dummy date*/
+ }
+
+ {
+ UINT64 value = currTime.sec;
+ write_rw_timestamp_resource(lwm2mHandle, &resource_uri, value);
+
+
+ /*Try and read again the set value*/
+ if(get_write_only_timestamp_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Timestamp value is now %llu\r\n", value);
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only opaque resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w opaque, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_OPAQUE_W_RES_ID;
+ resource_uri.resourceInst = 0; /*set instance 0*/
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ {
+ UINT8 buf[20] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ UINT16 recvDatalen = sizeof(buf);
+ write_rw_opaque_resource(lwm2mHandle, &resource_uri, buf, 10);
+ azx_sleep_ms(5000);
+ /*Try and read again the set value*/
+ memset(buf, 0, sizeof(buf));
+ if(get_write_only_opaque_resource(lwm2mHandle, &resource_uri, buf, &recvDatalen))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ int _index;
+ AZX_LOG_INFO("\r\n---Opaque content is now (%u bytes): ", recvDatalen);
+ for (_index = 0; _index < (int)recvDatalen; _index++)
+ {
+ AZX_LOG_INFO("0x%02X ", buf[_index]);
+ }
+
+ AZX_LOG_INFO("\r\n");
+ }
+ }
+
+
+ azx_sleep_ms(5000);
+ AZX_LOG_INFO("\r\n---------------------------------------------------\r\n");
+
+ /* ==================================================
+ * Sending a write-only string resource with a WRITE operation
+ * Filling resource URI with required parameters (single instance w string, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_STRING_W_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ {
+ CHAR string[20] = {0};
+ sprintf(string, "Hello World!");
+ write_rw_string_resource(lwm2mHandle, &resource_uri, string);
+
+ /*Try and read again the set value*/
+ memset(string, 0, sizeof(string));
+ if(get_write_only_string_resource(lwm2mHandle, &resource_uri, string, sizeof(string)))
+ {
+ AZX_LOG_ERROR("Failed getting resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---String content is now: <%s>\r\n", string);
+ }
+ }
+
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nResources operations examples done.\r\n"
+ "-----------------------------------\r\n");
+
+
+ AZX_LOG_INFO("\r\n-----------------------------------"
+ "\r\nWill perform a SET with notify ACK enabled.\r\n"
+ "-----------------------------------\r\n");
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = 0;
+ resource_uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_INFO("Enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* The resource URI must match all observations set in the device profile for this device */
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &resource_uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYADD_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_uri timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /* setting the status to ENABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, TRUE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ azx_sleep_ms(2000);
+
+ /* ==================================================
+ * Sending a read only integer resource with a SET operation
+ * Filling resource URI with required parameters (single instance read only integer, in this case)
+ * ==================================================*/
+ resource_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ resource_uri.objInst = 0;
+ resource_uri.resource = DEMO_INT_R_RES_ID;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /* Setting a different value on this resource so the notification will be sent to the server */
+ set_read_only_integer_resource(lwm2mHandle, &resource_uri, 60);
+ {
+
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(30000) /*wait 30 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("lwm2m notify ack timeout!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nACK received from server!\r\n");
+ /*Try and read again the set value*/
+ INT32 value = 0;
+ if(read_rw_integer_resource(lwm2mHandle, &resource_uri, &value))
+ {
+ AZX_LOG_ERROR("Failed reading resource!\r\n");
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\n---Integer value is now %d\r\n", value);
+ }
+ }
+ }
+
+ AZX_LOG_INFO("\r\nDisable notify ack\r\n");
+ /* setting the status to DISABLED */
+ retVal = m2mb_lwm2m_nfy_ack_status( lwm2mHandle, TRUE, FALSE );
+ if ( retVal != M2MB_RESULT_SUCCESS )
{
- m2mb_pdp_deinit(pdpHandle);
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_status request failed" );
+ task_status = APPLICATION_EXIT;
+ break;
}
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(get_lwm2mEvents_handle(),
+ EV_LWM2M_NFYSTAT_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_nfy_ack_status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ AZX_LOG_INFO("Done.\r\n");
- if(netHandle)
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+
+ while(1)
{
- m2mb_net_deinit(netHandle);
+ /*Wait*/
+ azx_sleep_ms(10000);
}
+ task_status = APPLICATION_EXIT;
+ } while(0);
- if(net_pdp_evHandle)
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
{
- m2mb_os_ev_deinit(net_pdp_evHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
}
+ deinit_sync();
+ if (rtcfd != -1)
+ {
+ m2mb_rtc_close(rtcfd);
+ }
AZX_LOG_DEBUG("Application complete.\r\n");
}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_utils.c
new file mode 100755
index 00000000..cd2c7249
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/src/lwm2m_utils.c
@@ -0,0 +1,922 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_W_RES_ID:
+ case DEMO_MULTI_OPAQUE_W_RES_ID:
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Get - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_R_RES_ID:
+ case DEMO_OPAQUE_RW_RES_ID:
+ case DEMO_MULTI_OPAQUE_R_RES_ID:
+ case DEMO_MULTI_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_32010.xml
similarity index 69%
rename from LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_32010.xml
index 1fc773af..f90edc57 100755
--- a/LE910Cx_X/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_32010.xml
@@ -3,8 +3,8 @@
m2mb lwm2m demo
object related to all OMA types resources usable in demos
- 35000
- urn:oma:lwm2m:x:35000
+ 32010
+ urn:oma:lwm2m:x:32010
1.0
1.0
Single
@@ -73,7 +73,7 @@
-
Read Only Objlnk
R
- Multiple
+ Single
Mandatory
Objlnk
@@ -82,7 +82,7 @@
- -
+
-
Read Write String
RW
Single
@@ -145,7 +145,7 @@
-
Read Write Objlnk
RW
- Multiple
+ Single
Mandatory
Objlnk
@@ -298,28 +298,159 @@
- -
-
Executable 1
- E
+ -
+
Write Only String
+ W
Single
Mandatory
-
+ String
-
- -
-
Executable 2
- E
+ -
+
Write Only Integer
+ W
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only Float
+ W
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only Boolean
+ W
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only Opaque
+ W
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only Time
+ W
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only Objlnk
+ W
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Write Only MultiInstance String
+ W
Multiple
Mandatory
+ String
+
+
+
+
+ -
+
Write Only MultiInstance Integer
+ W
+ Multiple
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Write Only MultiInstance Float
+ W
+ Multiple
+ Mandatory
+ Float
+
+
+
+
+ -
+
Write Only MultiInstance Boolean
+ W
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Write Only MultiInstance Opaque
+ W
+ Multiple
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Write Only MultiInstance Time
+ W
+ Multiple
+ Mandatory
+ Time
+
+
+
+
+ -
+
Write Only MultiInstance Objlnk
+ W
+ Multiple
+ Mandatory
+ Objlnk
+
+
+
+
+
+ -
+
Executable
+ E
+ Single
+ Mandatory
-
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml
deleted file mode 100755
index 1fc773af..00000000
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M/xml/object_35000.xml
+++ /dev/null
@@ -1,326 +0,0 @@
-
-
-
- m2mb lwm2m demo
- object related to all OMA types resources usable in demos
- 35000
- urn:oma:lwm2m:x:35000
- 1.0
- 1.0
- Single
- Optional
-
- -
-
Read Only String
- R
- Single
- Mandatory
- String
-
-
-
-
- -
-
Read Only Integer
- R
- Single
- Mandatory
- Integer
-
-
-
-
- -
-
Read Only Float
- R
- Single
- Mandatory
- Float
-
-
-
-
- -
-
Read Only Boolean
- R
- Single
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Only Opaque
- R
- Single
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Only Time
- R
- Single
- Mandatory
- Time
-
-
-
-
- -
-
Read Only Objlnk
- R
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
- -
-
Read Write String
- RW
- Single
- Mandatory
- String
-
-
-
-
- -
-
Read Write Integer
- RW
- Single
- Mandatory
- Integer
-
-
-
-
- -
-
Read Write Float
- RW
- Single
- Mandatory
- Float
-
-
-
-
- -
-
Read Write Boolean
- RW
- Single
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Write Opaque
- RW
- Single
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Write Time
- RW
- Single
- Mandatory
- Time
-
-
-
-
- -
-
Read Write Objlnk
- RW
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
-
- -
-
Read only MultiInstance String
- R
- Multiple
- Mandatory
- String
-
-
-
-
- -
-
Read only MultiInstance Integer
- R
- Multiple
- Mandatory
- Integer
-
-
-
-
- -
-
Read only MultiInstance Float
- R
- Multiple
- Mandatory
- Float
-
-
-
-
- -
-
Read only MultiInstance Boolean
- R
- Multiple
- Mandatory
- Boolean
-
-
-
-
- -
-
Read only MultiInstance Opaque
- R
- Multiple
- Mandatory
- Opaque
-
-
-
-
- -
-
Read only MultiInstance Time
- R
- Multiple
- Mandatory
- Time
-
-
-
-
- -
-
Read only MultiInstance Objlnk
- R
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
-
- -
-
Read Write MultiInstance String
- RW
- Multiple
- Mandatory
- String
-
-
-
-
- -
-
Read Write MultiInstance Integer
- RW
- Multiple
- Mandatory
- Integer
-
-
-
-
- -
-
Read Write MultiInstance Float
- RW
- Multiple
- Mandatory
- Float
-
-
-
-
- -
-
Read Write MultiInstance Boolean
- RW
- Multiple
- Mandatory
- Boolean
-
-
-
-
- -
-
Read Write MultiInstance Opaque
- RW
- Multiple
- Mandatory
- Opaque
-
-
-
-
- -
-
Read Write MultiInstance Time
- RW
- Multiple
- Mandatory
- Time
-
-
-
-
- -
-
Read Write MultiInstance Objlnk
- RW
- Multiple
- Mandatory
- Objlnk
-
-
-
-
-
- -
-
Executable 1
- E
- Single
- Mandatory
-
-
-
-
-
-
- -
-
Executable 2
- E
- Multiple
- Mandatory
-
-
-
-
-
-
-
-
-
-
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/Makefile.in
new file mode 100755
index 00000000..d4d68f4c
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_USB0
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/README.md
similarity index 60%
rename from LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/README.md
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/README.md
index 89e65312..3019377b 100755
--- a/LE910Cx_X/AppZoneSampleApps-AUX_UART/LWM2M/README.md
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/README.md
@@ -1,7 +1,7 @@
-### LWM2M
+### LWM2M OBJ_GET AND OBJ_SET
-Sample application showcasing LWM2M client usage with M2MB API. Debug prints on **AUX UART**
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on **USB0**
**Features**
@@ -11,16 +11,24 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Create an instance of a custom object
-- Set an integer value on a read only resource
+- Create a Json string
-- Set two integer values on a multi-instance read only resource
+- Set string, integer, float, boolean, timestamp and opaque values with `m2mb_lwm2m_objset`
-- write a string on a read/write resource
-
-- Manage exec requests from the portal
+- Get all resources values with `m2mb_lwm2m_objget`
- Manage write, read and monitoring resources changed from the portal
+**Requirements**
+
+This application expects the user to configure the PDP context ID 1 with the proper APN.
+it can be done with the following AT command:
+
+`AT+CGDCONT=1,"IPV4V6",""`
+
+Depending on the Mobiler Network Operator and Access Technology, the APN might be automatically set by the network itself. In this case, nothing must be done by the user.
+
+
**Application workflow**
**`M2MB_main.c`**
@@ -35,24 +43,22 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
**`msgLWM2MTask`**
- Check registration status
-- Configure APN to the correct one for CID 1
-
-- Initialize LWM2M client,
+- Initialize LWM2M client,
- Check for XML file fo custom object
-
+
- Enable unsolicited messages from client
-
+
- Create a task \(lwm2m_taskCB is its callback function \)to manage events from Portal
-
+
- Enable LwM2M client
-
+
- Create a new instance for the custom object
-
+
- Wait for client to register to Portal
-
- - Send integer and string values
-
+
+ - Performs obj_set and obj_get operations on the related resources
+
- Wait for events from server
@@ -61,6 +67,15 @@ Sample application showcasing LWM2M client usage with M2MB API. Debug prints on
- Manage events arriving from client \(operations completion status and unsolicited events\)
- Run lwm2m_taskCB when a monitored resource changes, to manage the action to be done
+#### Device Profile upload
+
+**LWM2M resources demo** device profile must be imported to have a real-time update of resources values on the LWM2M browser.
+
+To do so, import the file `lwm2m_resources_demo.json` on section `Developer` > `Device profiles` of OneEdge IoT portal:
+
+
+
+
#### Custom Object configuration
The XML file content must be loaded on the Telit IoT Portal for the demo application to be fully executed.
@@ -86,10 +101,10 @@ Copy the xml file content and paste it in the new Object form
-Also, the application requires the XML file `/xml/object_35000.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
-It can be done with
+Also, the application requires the XML file `/xml/object_32011.xml` (provided with the sample files) to be stored in module's `/XML/` folder.
+It can be done with
-`AT#M2MWRITE=/XML/object_35000.xml,`
+`AT#M2MWRITE=/XML/object_32011.xml,`
To load the XML file in the module, Telit AT Controller (TATC) can be used. Once the command above is issued, press the load content button:
@@ -110,24 +125,20 @@ The file is successfully loaded on the module

-
+
+
+
-After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
-
-
-An instance of the object will be present and the resources can be modified.
-
-
-For example, executing the two Exec Resources at the bottom of the list, the application will react accordingly:
+After the Demo completes the initialization, it is possible to access the object resources from the Portal Object Browser
-
+
-Writing a string resource (id /35000/0/11 ), the application will notify the change
+An instance of the object will be present and the resources can be modified.
-
+
---------------------
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /**
+ `struct (INT32 type, INT32 param1, INT32 param2)` */
+#define AZX_TASKS_TASK_NAME_SIZE 64 /**"` will be given, where `` is
+ * the id of the created task. Max length 64.
+ * @param[in] stack_size Task stack size in bytes. Can be any value, within the
+ * range: @ref AZX_TASKS_MIN_STACK_SIZE - @ref AZX_TASKS_MAX_STACK_SIZE
+ * @param[in] priority Task priority. The greater the value, the smaller the
+ * priority of the task. Accepted range:
+ * @ref AZX_TASKS_PRIORITY_MAX - @ref AZX_TASKS_PRIORITY_MIN
+ * @param[in] msg_q_size Task message queue slots number. Accepted range:
+ * @ref AZX_TASKS_MIN_QUEUE_SIZE - @ref AZX_TASKS_MAX_QUEUE_SIZE
+ * @param[in] cb The user callback that will be executed every time a message is
+ * received in task message queue. See @ref USER_TASK_CB for signature.
+ *
+ * @return One of
+ * Task id number from 1 to 32 on success
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_WRONG_PRIO_ERR
+ * @ref AZX_TASKS_STACK_SIZE_ERR
+ * @ref AZX_TASKS_MSG_Q_SIZE_ERR
+ * @ref AZX_TASKS_NO_FREE_SLOTS_ERR
+ * @ref AZX_TASKS_ALLOC_ERR
+ * @ref AZX_TASKS_Q_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_Q_INIT_ERR
+ * @ref AZX_TASKS_ATTRIB_SET_ERR
+ * @ref AZX_TASKS_CREATE_ERR
+ * -1 on internal failure.
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+ */
+INT32 azx_tasks_createTask( CHAR *task_name, INT32 stack_size, INT32 priority,
+ INT32 msg_q_size, USER_TASK_CB cb);
+
+/**
+ * @brief Destroys an user task.
+ *
+ * This will destroy the specified user task.
+ *
+ * @param[in] task_id The task id number to be destroyed,
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ *
+ * @return One of:
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * One of @ref M2MB_OS_RESULT_E values
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_destroyTask(INT8 task_id);
+
+/**
+ * @brief Sends a message to a task
+ *
+ * Sends a message to the provided task id, passing 3 integer parameters as
+ * message parameters.
+ *
+ * @param[in] task_id The task id to receive the message
+ * range: 1 - @ref AZX_TASKS_MAX_TASKS
+ * @param[in] type User parameter
+ * @param[in] param1 User parameter
+ * @param[in] param2 User parameter
+ *
+ * @return One of
+ * @ref AZX_TASKS_OK
+ * @ref AZX_TASKS_INVALID_ID_ERR
+ * @ref AZX_TASKS_ID_NOT_DEFINED_ERR
+ * @ref AZX_TASKS_MSG_SEND_ERR
+ *
+ * @see azx_tasks_init()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_sendMessageToTask( INT8 task_id, INT32 type, INT32 param1, INT32 param2 );
+
+
+/**
+ * @brief Retrieves the current task ID value
+ *
+ * Retrieves the value of the current running task id (1-32)
+ *
+ * @return The current the task ID;
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+INT32 azx_tasks_getCurrentTaskId( void );
+
+/**
+ * @brief Retrieves the current task name string
+ *
+ * @param[out] name The current task name.
+ *
+ * @return The current the task name pointer (same as the input parameter).
+ *
+ * @see azx_tasks_init()
+ * @see azx_tasks_createTask()
+ *
+ * @ingroup taskUsage
+*/
+CHAR* azx_tasks_getCurrentTaskName( CHAR *name );
+
+/**
+ * Returns the number of messages in the queue of a task.
+ *
+ * @param[in] The ID of the task whose queue should be checked.
+ *
+ * @return The number of messages that are queued. In case of error, -1 is returned.
+ */
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id );
+
+#endif /* HDR_AZX_TASKS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
new file mode 100755
index 00000000..cccb3c54
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/hdr/azx_utils.h
@@ -0,0 +1,89 @@
+/*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.3
+ * @dependencies core/azx_log
+ * @author Ioannis Demetriou
+ * @author Sorin Basca
+ * @date 10/02/2019
+ *
+ * @brief Various helpful utilities
+ */
+#include "m2mb_types.h"
+#include "azx_log.h"
+
+
+/**
+ * @brief Limits a value to a certain interval
+ *
+ * This is defined as a macro so it works with any types that support ordering.
+ *
+ * @param val The value to limit
+ * @param min The minimum allowed value
+ * @param max The maximum allowed value
+ *
+ * @return The original value if it was inside the limits, or min, or max, if it was less than, or
+ * greater than the limits.
+ */
+#define AZX_LIMIT(val, min, max) (val = (val < (min) ? (min) : (val > (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
new file mode 100755
index 00000000..1ce61456
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_tasks.c
@@ -0,0 +1,441 @@
+/*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
+
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_os.h"
+
+#include "azx_log.h"
+
+#include "azx_tasks.h"
+
+
+/* Global variables =============================================================================*/
+_AZX_TASKS_PARAMS m2mb_tasks;
+
+INT32 azx_tasks_init(void)
+{
+ INT32 ret;
+ int i;
+ for(i = 0; i < AZX_TASKS_MAX_TASKS; i++ )
+ {
+ m2mb_tasks.task_slots[i].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[i].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[i].Task_NameBuf[0] = '\0';
+ m2mb_tasks.task_slots[i].SlotInUse = 0;
+ }
+
+ m2mb_tasks.M2MMain_Handle = m2mb_os_taskGetId(); //store
+ m2mb_tasks.isInit = 1;
+
+ ret = M2MB_OS_SUCCESS;
+
+ return ret;
+}
+
+static INT8 find_free_task_slot(void)
+{
+ int i;
+
+ if (! m2mb_tasks.isInit)
+ {
+ return -1;
+ }
+
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 0)
+ {
+ m2mb_tasks.task_slots[i].SlotInUse = 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
+static INT8 find_slot_by_handle(M2MB_OS_TASK_HANDLE h)
+{
+ int i;
+ for (i=0; i< AZX_TASKS_MAX_TASKS; i++)
+ {
+ if(m2mb_tasks.task_slots[i].SlotInUse == 1)
+ {
+ AZX_LOG_TRACE("comparing task handle %p with current slot %d handle %p\r\n", h, i, m2mb_tasks.task_slots[i].Task_H );
+ if (h == m2mb_tasks.task_slots[i].Task_H)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+
+}
+
+//char* name must be big enough to contain task names.
+char * azx_tasks_getCurrentTaskName(char *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ if (taskHandle == m2mb_tasks.M2MMain_Handle)
+ {
+ strcpy(name, "M2M_MAIN");
+ }
+ else
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL ))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ }
+ }
+ return name;
+}
+
+INT32 azx_tasks_getCurrentTaskId(void)
+{
+ M2MB_OS_TASK_HANDLE h = m2mb_os_taskGetId();
+ return find_slot_by_handle(h) + 1;
+}
+
+
+INT32 azx_tasks_sendMessageToTask( INT8 TaskProcID, INT32 type, INT32 param1, INT32 param2 )
+{
+ AZX_TASKS_MESSAGE_T tmpMsg;
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_Q_HANDLE Queue_H;
+
+ INT8 slot = TaskProcID - 1;
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ Queue_H = m2mb_tasks.task_slots[slot].Task_Queue_H;
+
+
+ tmpMsg.type = type;
+ tmpMsg.param1 = param1;
+ tmpMsg.param2 = param2;
+
+ AZX_LOG_TRACE( "message ==> type=%d; par1=%d; par2=%d\r\n", tmpMsg.type, tmpMsg.param1, tmpMsg.param2 );
+ osRes = m2mb_os_q_tx( Queue_H, (void*)&tmpMsg, M2MB_OS_NO_WAIT, 0 );
+
+ if( osRes != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "Send message to Task %d failed; error %d\r\n", TaskProcID, osRes );
+ return AZX_TASKS_MSG_SEND_ERR; // failure
+ }
+ else
+ {
+ AZX_LOG_TRACE("Message sent.\r\n");
+ return AZX_TASKS_OK; // success
+ }
+}
+
+
+/*
+ * Task --> EntryFn
+ */
+void Task_EntryFn( void *arg )
+{
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+ AZX_TASKS_MESSAGE_T inPars;
+
+ INT32 slot = (INT32)arg;
+ MEM_W task_name = 0;
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("Cannot find slot for handle %d\r\n", taskHandle);
+ return;
+ }
+
+ AZX_LOG_TRACE("slot: %d\r\n", slot);
+
+
+ m2mb_os_taskGetItem( taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &task_name, NULL );
+
+ AZX_LOG_TRACE( "\r\n==>Task %s started!\r\n", (char*) task_name);
+
+ while( 1 )
+ {
+ if(M2MB_OS_SUCCESS != m2mb_os_q_rx( m2mb_tasks.task_slots[slot].Task_Queue_H, (void*)&inPars, M2MB_OS_WAIT_FOREVER ))
+ {
+ break;
+ }
+
+ AZX_LOG_TRACE( "%s received a message: \r\n"
+ "- type = %d\r\n"
+ "- param1 = %d\r\n"
+ "- param2 = %d\r\n\r\n",
+ (char*) task_name, inPars.type, inPars.param1, inPars.param2 );
+ m2mb_tasks.task_slots[slot].Task_UserCB( inPars.type, inPars.param1, inPars.param2 );
+ }
+
+ AZX_LOG_TRACE("exiting entry function. \r\n");
+}
+
+
+INT32 azx_tasks_createTask( char *task_name, INT32 stack_size, INT32 priority, INT32 msg_q_size, USER_TASK_CB cb)
+{
+ M2MB_OS_RESULT_E os_res;
+
+ M2MB_OS_TASK_ATTR_HANDLE Task_Attr_H;
+ M2MB_OS_Q_ATTR_HANDLE Task_Queue_Attr_H;
+
+ INT32 task_prio;
+ UINT32 queue_area_size;
+ INT8 slot;
+
+
+
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (priority < 1 || priority > 32)
+ {
+ AZX_LOG_ERROR("priority out of bounds\r\n");
+ return AZX_TASKS_WRONG_PRIO_ERR;
+ }
+ else
+ {
+ task_prio = priority + 200; //201 to 232
+ }
+
+ if (stack_size < AZX_TASKS_MIN_STACK_SIZE || stack_size > AZX_TASKS_MAX_STACK_SIZE) //1 to 32KB
+ {
+ AZX_LOG_ERROR("stack size out of bounds\r\n");
+ return AZX_TASKS_STACK_SIZE_ERR;
+ }
+
+ if (msg_q_size < AZX_TASKS_MIN_QUEUE_SIZE || msg_q_size > AZX_TASKS_MAX_QUEUE_SIZE)
+ {
+ AZX_LOG_ERROR("message queue size out of bounds\r\n");
+ return AZX_TASKS_MSG_Q_SIZE_ERR;
+ }
+
+ queue_area_size = msg_q_size * BYTES_FOR_MSG(AZX_TASKS_MESSAGE_T);
+
+ //input parameters are valid, now get a free slot.
+ slot = find_free_task_slot();
+
+ if (slot == -1)
+ {
+ AZX_LOG_ERROR("No free slots!\r\n");
+ return AZX_TASKS_NO_FREE_SLOTS_ERR;
+ }
+
+ memset(m2mb_tasks.task_slots[slot].Task_NameBuf,0, AZX_TASKS_TASK_NAME_SIZE);
+
+ if (task_name)
+ {
+ strncpy(m2mb_tasks.task_slots[slot].Task_NameBuf, task_name, AZX_TASKS_TASK_NAME_SIZE - 1);
+ }
+ else
+ {
+ sprintf(m2mb_tasks.task_slots[slot].Task_NameBuf, "Task%d", slot + 1);
+ }
+
+ AZX_LOG_TRACE("task_name_buf: %s\r\n", m2mb_tasks.task_slots[slot].Task_NameBuf);
+
+ m2mb_tasks.task_slots[slot].Task_UserCB = cb;
+
+ AZX_LOG_TRACE( "Create task messages queue\r\n" );
+ if ( m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_CREATE_ATTR,NULL) != M2MB_OS_SUCCESS )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL --> SKIP QUEUE CREATION !!!\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ os_res = m2mb_os_q_setAttrItem( &Task_Queue_Attr_H,
+ CMDS_ARGS
+ (
+ M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG(AZX_TASKS_MESSAGE_T),
+ M2MB_OS_Q_SEL_CMD_QSIZE, queue_area_size
+ ));
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET QUEUE ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Set queue attributes done\r\n" );
+
+ os_res = m2mb_os_q_init( &(m2mb_tasks.task_slots[slot].Task_Queue_H), &Task_Queue_Attr_H );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "QUEUE CREATE - FAIL\r\n" );
+ m2mb_os_q_setAttrItem( &Task_Queue_Attr_H, 1,M2MB_OS_Q_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_Q_INIT_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "QUEUE CREATE - PASS\r\n" );
+ os_res = m2mb_os_taskSetAttrItem( &Task_Attr_H,
+ CMDS_ARGS(
+ M2MB_OS_TASK_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_TASK_SEL_CMD_STACK_SIZE, (void*)stack_size,
+ M2MB_OS_TASK_SEL_CMD_NAME, m2mb_tasks.task_slots[slot].Task_NameBuf,
+ M2MB_OS_TASK_SEL_CMD_PRIORITY, task_prio, /* Use priority values above 200. max value: 255 (less priority) */
+ M2MB_OS_TASK_SEL_CMD_PREEMPTIONTH, task_prio,
+ M2MB_OS_TASK_SEL_CMD_AUTOSTART, M2MB_OS_TASK_AUTOSTART,
+ M2MB_OS_TASK_SEL_CMD_USRNAME, m2mb_tasks.task_slots[slot].Task_NameBuf
+ )
+ );
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "SET TASK ATTRIBUTES - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_ATTRIB_SET_ERR;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "SET TASK ATTRIBUTES - PASS\r\n" );
+ }
+
+ AZX_LOG_TRACE( "Creating the task\r\n" );
+ os_res = m2mb_os_taskCreate(
+ &(m2mb_tasks.task_slots[slot].Task_H),
+ &Task_Attr_H,
+ &Task_EntryFn,
+ (void*)( (INT32) slot )
+ );
+
+ if ( M2MB_OS_SUCCESS != os_res )
+ {
+ AZX_LOG_ERROR( "TASK CREATION FAIL\r\n" );
+ m2mb_os_taskSetAttrItem( &Task_Attr_H, 1,M2MB_OS_TASK_SEL_CMD_DEL_ATTR,NULL);
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return AZX_TASKS_CREATE_ERR;
+ }
+ else
+ {
+ if ( M2MB_OS_TASK_INVALID == m2mb_tasks.task_slots[slot].Task_H )
+ {
+ AZX_LOG_ERROR( "INVALID TASK HANDLE - FAIL\r\n" );
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+ return -1;
+ }
+ AZX_LOG_TRACE("Task created successfully with handle %p\r\n", m2mb_tasks.task_slots[slot].Task_H);
+
+ return slot + 1;
+ }
+
+ }
+ }
+ }
+}
+
+
+
+INT32 azx_tasks_destroyTask(INT8 TaskProcID)
+{
+ INT8 slot = TaskProcID - 1;
+ M2MB_OS_RESULT_E res;
+ MEM_W out = 0;
+
+ AZX_LOG_TRACE("destroy...\r\n");
+ if (! m2mb_tasks.isInit)
+ {
+ AZX_LOG_ERROR("m2m task first init not performed yet\r\n");
+ return AZX_TASKS_NOTINIT_ERR;
+ }
+
+ if (slot < 0 || slot > AZX_TASKS_MAX_TASKS -1 )
+ {
+ AZX_LOG_ERROR("task id %d not valid!\r\n", TaskProcID);
+ return AZX_TASKS_INVALID_ID_ERR;
+ }
+
+ if(m2mb_tasks.task_slots[slot].SlotInUse == 0)
+ {
+ AZX_LOG_ERROR("task id %d not existing\r\n", TaskProcID);
+ return AZX_TASKS_ID_NOT_DEFINED_ERR;
+ }
+
+ AZX_LOG_TRACE("Trying to terminate task...\r\n");
+ res = m2mb_os_taskTerminate(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot terminate task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_os_taskGetItem( m2mb_tasks.task_slots[slot].Task_H, M2MB_OS_TASK_SEL_CMD_STATE, &out, NULL );
+ AZX_LOG_TRACE ( "Task state: %d\r\n", out );
+
+ AZX_LOG_TRACE("Trying to delete task with handle %d...\r\n", m2mb_tasks.task_slots[slot].Task_H);
+ res = m2mb_os_taskDelete(m2mb_tasks.task_slots[slot].Task_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot delete task %d\r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to clear task queue...\r\n");
+ res = m2mb_os_q_clear(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot clear task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ AZX_LOG_TRACE("Trying to deinit task queue...\r\n");
+ res = m2mb_os_q_deinit(m2mb_tasks.task_slots[slot].Task_Queue_H);
+ if (res != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot deinit task %d queue \r\n", TaskProcID);
+ return res;
+ }
+
+ m2mb_tasks.task_slots[slot].Task_H = M2MB_OS_TASK_INVALID;
+ m2mb_tasks.task_slots[slot].Task_Queue_H = M2MB_OS_Q_INVALID;
+ m2mb_tasks.task_slots[slot].SlotInUse = 0;
+
+ return 0;
+}
+
+INT32 azx_tasks_getEnqueuedCount( INT8 task_id )
+{
+ INT8 slot = task_id - 1;
+ MEM_W out = 0;
+ M2MB_OS_Q_HANDLE queueHandle = m2mb_tasks.task_slots[slot].Task_Queue_H;
+ M2MB_OS_RESULT_E result = m2mb_os_q_getItem( queueHandle, M2MB_OS_Q_SEL_CMD_ENQUEUED, &out, NULL );
+ if(result != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("Cannot read enqueued message count: %d\r\n", result);
+ return -1;
+ }
+
+ return (INT32)out;
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/description.txt
new file mode 100644
index 00000000..a208e29b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/description.txt
@@ -0,0 +1 @@
+Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on USB0
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
new file mode 100755
index 00000000..9bfb403a
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_demo.h
@@ -0,0 +1,103 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.h
+
+ @brief
+ demo related definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author
+
+
+ @date
+ 22/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_DEMO_H_
+#define HDR_LWM2M_DEMO_H_
+
+
+/* Global declarations ==========================================================================*/
+
+
+/*LWM2M event bits*/
+#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000040
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000080
+
+#define EV_LWM2M_EXIST_RES_BIT (UINT32)0x00000400
+
+#define EV_LWM2M_OBJGET_RES_BIT (UINT32)0x00100000
+#define EV_LWM2M_OBJSET_RES_BIT (UINT32)0x00200000
+#define EV_LWM2M_FAIL_RES_BIT (UINT32)0x80000000
+#define EV_MON_URC_RECEIVED 2
+#define EV_URC_TO_BE_ENABLED 3
+
+
+/*OBJECTs and RESOURCEs IDs*/
+#define DEVICE_OBJ_ID 3
+#define DEVICE_BATTERY_RES_ID 9 /*integer, percentage*/
+
+
+#define LOCATION_OBJ_ID 6
+#define LOCATION_LATITUDE_RES_ID 0 /*float, degrees*/
+#define LOCATION_LONGITUDE_RES_ID 1 /*float, degrees*/
+
+#define CONN_STATS_OBJ_ID 7
+#define CONN_STATS_STOP_EXEC_RES_ID 7
+#define CONN_STATS_COLLECTION_PERIOD_RES_ID 8 /* integer, in seconds */
+
+#define APN_CONN_PROFILE_OBJ_ID 11
+#define APN_PROFILE_APN_1_RES_ID 1 /*first CID apn string*/
+
+#define M2MB_LWM2M_DEMO_OBJ_ID 32011
+#define DEMO_STRING_RW_RES_ID 11 /* single string resource, Read + Write*/
+#define DEMO_INT_RW_RES_ID 12 /* single integer resource, Read + Write*/
+#define DEMO_FLOAT_RW_RES_ID 13 /* single floating point resource, Read + Write*/
+#define DEMO_BOOL_RW_RES_ID 14 /* single boolean resource, Read + Write*/
+#define DEMO_OPAQUE_RW_RES_ID 15 /* single opaque (raw data) resource, Read + Write*/
+#define DEMO_TIME_RW_RES_ID 16 /* single time resource, Read + Write*/
+#define DEMO_OBJLINK_RW_RES_ID 17 /* single object link resource, Read + Write*/
+
+#define DEMO_MULTI_STRING_RW_RES_ID 31 /* multiple string resource, Read + Write*/
+#define DEMO_MULTI_BOOL_RW_RES_ID 34 /* multiple boolean resource, Read + Write*/
+
+#define OBJECT_XML_NAME "object_32011.xml"
+
+
+/* Global typedefs ==============================================================================*/
+typedef enum {
+ INIT=0,
+
+ APPLICATION_EXIT
+} APP_STATES;
+
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Initialize OneEdge connection
+ @param[in] obj_id Object ID to be used for initialization
+ @return result of initialization
+
+*/
+UINT8 oneedge_init( void );
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2);
+#endif /* HDR_LWM2M_DEMO_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
new file mode 100755
index 00000000..8e1934d4
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/hdr/lwm2m_utils.h
@@ -0,0 +1,411 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.h
+
+ @brief
+ lwm2m utilities definitions
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author
+
+
+ @date
+ 23/11/2021
+*/
+
+
+#ifndef HDR_LWM2M_UTILS_H_
+#define HDR_LWM2M_UTILS_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+/* Used for event responses in the indication callback */
+typedef struct
+{
+ M2MB_LWM2M_RESULT_E result;
+ M2MB_LWM2M_OBJ_URI_T uri;
+ UINT16 resp_len;
+} LWM2M_EVENT_RES_S;
+
+/* Used for event responses in the indication callback */
+
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Returns the Critical section semaphore handle
+ @retval CS semaphore handle
+ */
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void);
+
+
+/**
+ @brief Returns the events section semaphore handle
+ @retval events handle
+ */
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void);
+
+/**
+ @brief Returns the static event res structure pointer
+ @retval events result structure pointer
+ */
+LWM2M_EVENT_RES_S *get_event_res_p(void);
+
+/**
+ @brief Initializes the synchronization related resources
+ @retval 0 if OK, other values error
+ */
+INT32 init_sync(void);
+
+/**
+ @brief Releases the synchronization related resources
+ @retval none
+ */
+void deinit_sync(void);
+
+/**
+ @brief Sets a generic read-only resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be set
+ @param[in] inbuflen size of the data to be set
+
+ @retval 0 if OK, other values error
+ */
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen );
+
+/**
+ @brief Writes a generic r/w resource to the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be written
+ @param[in] inbuflen size of the data to be written
+
+ @retval 0 if OK, other values error
+ */
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen);
+
+/**
+ @brief Gets a generic read-only resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be received
+ @param[inout] inbuflen max size of the data to be received. In case of opaque, it returns the amount of gotten data
+
+ @retval 0 if OK, other values error
+ */
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/**
+ @brief Reads a generic r/w resource from the provided URI, and waits the response of the LWM2M Client
+
+ @param[in] h LWM2M handle
+ @param[in] uri pointer to the uri structure
+ @param[in] inbuf generic pointer to the data to be read
+ @param[inout] inbuflen max size of the data to be read. In case of opaque, it returns the amount of read data
+
+ @retval 0 if OK, other values error
+ */
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen);
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to set a read only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to set a read only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to set a read only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to set a read only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to set a read only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to set a read only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * WRITE RW (OR WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to write a write only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/*!
+ * @brief Used to write a write only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value);
+
+/*!
+ * @brief Used to write a write only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value);
+
+/*!
+ * @brief Used to write a write only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value);
+
+/*!
+ * @brief Used to write a write only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen);
+
+/*!
+ * @brief Used to write a write only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value value to be set
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+/*!
+ * @brief Used to get a write only integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to get a write only timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to get a write only double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to get a write only boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to get a write only opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to get a write only string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+/*!
+ * @brief Used to read a read-only or read-write integer resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write timestamp resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value);
+
+/*!
+ * @brief Used to read a read-only or read-write double resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value);
+
+/*!
+ * @brief Used to read a read-only or read-write boolean resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value);
+
+/*!
+ * @brief Used to read a read-only or read-write opaque resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen);
+
+/*!
+ * @brief Used to read a read-only or read-write string resource on LwM2M
+ *
+ * @param[in] h The agent handle
+ * @param[in] pUri pointer to uri structure to be set
+ * @param[in] value pointer to the variable that will hold the retrieved value
+ * @retval 0 if OK, other values error
+ *
+ */
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size);
+
+
+#endif /* HDR_LWM2M_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
new file mode 100755
index 00000000..d69e680b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/json/lwm2m_resources_demo.json
@@ -0,0 +1 @@
+[{"id":"619e27be14c97817d38a452c","name":"LwM2M resources objset - objget demo","observations":[{"objId":32011,"instId":0}],"smsc":"infobip","bootstrapServers":[{"type":"self","securityMode":"dtls-psk","shortId":99,"lifetime":60,"notificationStoring":true,"binding":"UQ","smsNumber":"inherit"}],"coapAckTimeout":5,"coapMaxRetransmit":3,"firmware":{"objId":5,"instId":0,"resId":7,"encoding":0,"protocol":"http","checkOnUpdate":false,"setObsAttrs":false},"locationDonationEnabled":false}]
\ No newline at end of file
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/metadata.json
new file mode 100755
index 00000000..e41eab0c
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/metadata.json
@@ -0,0 +1,65 @@
+{
+ "name": "Sample App for LwM2M with OBJSET and OBJGET calls",
+ "type": "sample-app",
+ "description": "A sample app that shows LwM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage.",
+ "copyright": "Telit Communications, 2021",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "LwM2M",
+ "OneEdge"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": []
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Alessio Quieti",
+ "email": "alessio.quieti@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master",
+ "core/azx_tasks": "master"
+ }
+}
diff --git a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/M2MB_main.c
similarity index 74%
rename from LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c
rename to ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/M2MB_main.c
index a1f760a4..7e8134d7 100755
--- a/LE910Cx_X/AppZoneSampleApps-MAIN_UART/LWM2M/src/M2MB_main.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/M2MB_main.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */
/**
@@ -9,11 +9,11 @@
The file contains the main user entry point of Appzone
@details
-
+
@description
- Sample application showcasing LWM2M client usage with M2MB API. Debug prints on MAIN UART
- @version
- 1.0.1
+ Sample application showcasing LWM2M client m2mb_lwm2m_objget and m2mb_lwm2m_objset M2MB APIs usage. Debug prints on USB0
+ @version
+ 1.0.0
@note
Start of Appzone: Entry point
User code entry is in function M2MB_main()
@@ -22,7 +22,7 @@
@date
- 27/05/2020
+ 22/11/2021
*/
/* Include files ================================================================================*/
@@ -62,7 +62,7 @@ void M2MB_main( int argc, char **argv )
{
(void)argc;
(void)argv;
-
+
INT32 taskID;
azx_tasks_init();
@@ -72,21 +72,16 @@ void M2MB_main( int argc, char **argv )
/*SET output channel */
AZX_LOG_INIT();
- AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",
- VERSION, __DATE__, __TIME__);
+ AZX_LOG_INFO("Starting lwm2m demo. This is v%s built on %s %s.\r\n",VERSION, __DATE__, __TIME__);
- AZX_LOG_INFO("On OneEdge portal, be sure that observations are enabled for the following object resources:\r\n"
- "{35000/0/01} {35000/0/02} {35000/0/03} {35000/0/04} {35000/0/05} {35000/0/06} {35000/0/07}\r\n"
- "{35000/0/11} {35000/0/12} {35000/0/13} {35000/0/14} {35000/0/15} {35000/0/16} {35000/0/17}\r\n"
- "{35000/0/21} {35000/0/22} {35000/0/23} {35000/0/24} {35000/0/25} {35000/0/26} {35000/0/27}\r\n"
- "{35000/0/31} {35000/0/32} {35000/0/33} {35000/0/34} {35000/0/35} {35000/0/36} {35000/0/37}\r\n\r\n");
+ AZX_LOG_INFO("On OneEdge portal, be sure that the 'lwm2m resources objset - objget demo' Device Profile has been uploaded on the IoT Portal\r\n\r\n");
taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_M, msgLWM2MTask);
AZX_LOG_TRACE("Task ID: %d.\r\n", taskID);
-
+
azx_sleep_ms(1000);
-
+
if (taskID > 0)
{
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
new file mode 100755
index 00000000..d453b7c5
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_demo.c
@@ -0,0 +1,1111 @@
+/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_demo.c
+
+ @brief
+ The file contains the LWM2M utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+ Alessio Quieti
+
+ @date
+ 22/11/2021
+*/
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_net.h"
+#include "m2mb_pdp.h"
+#include "m2mb_socket.h"
+
+#include "m2mb_fs_stdio.h"
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+/* Local defines ================================================================================*/
+#define CTX_ID 1 /*PDP context ID*/
+
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+const char *IF_STATUS_STRING[] = { "M2MB_LWM2M_IF_STATE_NONE",
+ "M2MB_LWM2M_IF_STATE_DISABLED", "M2MB_LWM2M_IF_STATE_ACK_WAIT",
+ "M2MB_LWM2M_IF_STATE_ACTIVE", "M2MB_LWM2M_IF_STATE_IDLE",
+ "M2MB_LWM2M_IF_STATE_DEREG_WAIT", "M2MB_LWM2M_IF_STATE_DEREGISTERING" };
+
+const char *CL_STATUS_STRING[] = { "M2MB_LWM2M_CL_STATE_DISABLED",
+ "M2MB_LWM2M_CL_STATE_BOOTSTRAPPING", "M2MB_LWM2M_CL_STATE_BOOTSTRAPPED",
+ "M2MB_LWM2M_CL_STATE_REGISTERING", "M2MB_LWM2M_CL_STATE_REGISTERED",
+ "M2MB_LWM2M_CL_STATE_DEREGISTERING", "M2MB_LWM2M_CL_STATE_SUSPENDED" };
+
+static INT8 lwm2m_taskID;
+
+/*===== ONEEDGE =====*/
+
+/*Handles*/
+static M2MB_LWM2M_HANDLE lwm2mHandle;
+
+/*URI objects*/
+
+static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { M2MB_LWM2M_URI_4_FIELDS,
+ 33211, 0, 0, 1};
+
+/* Local function prototypes ====================================================================*/
+
+static INT32 lwm2m_taskCB( INT32 event, INT32 info, INT32 param2);
+
+/**
+ @brief Callback function for Client generated LWM2M events
+
+ WARNING: do not place blocking action within callback, since it is issued by the agent's task!!
+
+ @param[in] h LWM2M handle
+ @param[in] event Event Identification
+ @param[in] resp_size Size of the response buffer
+ @param[in] resp_struct Address of response buffer
+ @param[in] userdata Address of user data
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event,
+ UINT16 resp_size, void *resp_struct, void *userdata );
+
+
+/*!
+ * @brief Check existence of XML object description file in XML directory
+ *
+ * @param[in] name Name of the file to be checked
+ * @retval 0 if OK, other values error
+ *
+ */
+static int check_xml_file(const char* name);
+
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *time, INT16 tz);
+
+/* Static functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Task callback function. It is called when a data event arrives in the LwM2M CB
+ *
+ * @param[in] event The incoming event. EV_MON_URC_RECEIVED is supported for now
+ * @param[in] i_uri uri structure carrying the object and resource ids
+ * @param[in] param2 unused
+ * @retval 0 if OK, other values error
+ *
+ */
+static INT32 lwm2m_taskCB( INT32 event, INT32 i_uri, INT32 param2)
+{
+ (void) param2;
+ UINT8 opaque_buffer[1024] = {0};
+ CHAR string_buffer[256] = {0};
+
+ INT32 data_int = 0;
+ BOOLEAN data_bool = FALSE;
+ UINT64 data_time = 0;
+ double data_float = 0;
+
+
+ INT32 retVal;
+ M2MB_LWM2M_OBJ_URI_T *pUri = (M2MB_LWM2M_OBJ_URI_T *) i_uri;
+ M2MB_LWM2M_OBJ_URI_T uri = *pUri;
+
+
+
+ M2MB_LWM2M_DATA_TYPE_E data_type = M2MB_LWM2M_DATA_TYPE_INVALID;
+
+ m2mb_os_free(pUri);
+
+ uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
+ switch(event)
+ {
+ case EV_MON_URC_RECEIVED:
+
+ AZX_LOG_TRACE("Asking a read operation for {%u/%u/%u/%u (%u)}\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+
+ if (uri.obj == M2MB_LWM2M_DEMO_OBJ_ID)
+ {
+ switch(uri.resource)
+ {
+
+ /* ==================
+ *
+ * STRING TYPES
+ *
+ * ==================*/
+ case DEMO_STRING_RW_RES_ID:
+ case DEMO_MULTI_STRING_RW_RES_ID:
+ /*fallback*/
+
+ memset(string_buffer,0,sizeof(string_buffer));
+ retVal = read_rw_string_resource(lwm2mHandle, &(uri),
+ string_buffer, (UINT16)sizeof(string_buffer));
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_STRING;
+ AZX_LOG_INFO("\r\nString data in {%u/%u/%u/%u} resource was updated to new content: <%s>\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ string_buffer );
+ break;
+
+ /* ==================
+ *
+ * INTEGER TYPES
+ *
+ * ==================*/
+ case DEMO_INT_RW_RES_ID:
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_INTEGER;
+
+ retVal = read_rw_integer_resource(lwm2mHandle, &(uri), &data_int);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ AZX_LOG_INFO("\r\nInteger data in {%u/%u/%u/%u} resource was updated to new value: %d\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_int);
+ break;
+
+ /* ==================
+ *
+ * FLOAT TYPES
+ *
+ * ==================*/
+ case DEMO_FLOAT_RW_RES_ID:
+ /*fallback*/
+
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_FLOAT;
+
+ retVal = read_rw_double_resource(lwm2mHandle, &(uri), &data_float);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+
+ AZX_LOG_INFO("\r\nFloat data in {%u/%u/%u/%u} resource was updated to new value: %f\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_float );
+ break;
+
+
+ /* ==================
+ *
+ * BOOLEAN TYPES
+ *
+ * ==================*/
+ case DEMO_BOOL_RW_RES_ID:
+ case DEMO_MULTI_BOOL_RW_RES_ID:
+ /*fallback*/
+
+ retVal = read_rw_boolean_resource(lwm2mHandle, &(uri), &data_bool);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ AZX_LOG_INFO("\r\nBoolean data in {%u/%u/%u/%u} resource was updated to new value: %s\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ (data_bool)? "true":"false");
+
+ break;
+
+ /* ==================
+ *
+ * TIME TYPES
+ *
+ * ==================*/
+ case DEMO_TIME_RW_RES_ID:
+ {
+ /*fallback*/
+ M2MB_RTC_TIME_T time_struct;
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_TIME;
+
+
+ retVal = read_rw_timestamp_resource(lwm2mHandle, &(uri), &data_time);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+
+ convertUnixTimeToRTC_TIME((time_t)(data_time), &time_struct, 0);
+
+ AZX_LOG_INFO("\r\nTime data in {%u/%u/%u/%u} resource was updated to new value: %llu"
+ " (%04d/%02d/%02dT%02d:%02d:%02d+00:00)\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst,
+ data_time,
+ time_struct.year, time_struct.mon, time_struct.day,
+ time_struct.hour, time_struct.min, time_struct.sec);
+ }
+ break;
+
+
+ /* ==================
+ *
+ * OPAQUE TYPES
+ *
+ * ==================*/
+ case DEMO_OPAQUE_RW_RES_ID:
+ {
+ /*fallback*/
+ int i;
+ UINT16 data_size = (UINT16)sizeof(opaque_buffer);
+ memset(opaque_buffer,0,sizeof(opaque_buffer));
+ retVal = read_rw_opaque_resource(lwm2mHandle, &(uri), opaque_buffer, &data_size);
+ if(retVal != 0)
+ {
+ return retVal;
+ }
+ /*Store data_type for further management*/
+ data_type = M2MB_LWM2M_DATA_TYPE_OPAQUE;
+
+ AZX_LOG_INFO("\r\nOpaque data in {%u/%u/%u/%u} resource was updated to new content (%u bytes):\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, data_size);
+
+ for (i=0; i < data_size; i++)
+ {
+ AZX_LOG_INFO("%02X ", opaque_buffer[i]);
+ }
+ AZX_LOG_INFO("\r\n");
+ }
+ break;
+ break;
+
+ default:
+ AZX_LOG_WARN("\r\nUnexpected resource URI {%u/%u/%u/%u (%u)}!\r\n",
+ uri.obj, uri.objInst, uri.resource, uri.resourceInst, uri.uriLen );
+ break;
+ } /* switch(uri.resource) */
+
+ AZX_LOG_TRACE("Data type: %d\r\n", data_type);
+ }
+ else
+ {
+ AZX_LOG_WARN("Unexpected object ID %u\r\n", uri.obj);
+ }
+
+ break;
+
+ default:
+ AZX_LOG_WARN("Unmanaged task event %d\r\n", event);
+ break;
+ } /* switch(event) */
+
+ return 1;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief LwM2M indication callback function. It is called when any event happens LwM2M wise
+ *
+ * @param[in] h The LwM2M client handle
+ * @param[in] event the specific event
+ * @param[in] resp_size unused here
+ * @param[in] resp_struct Depending on the event, the structure carrying the data
+ * @retval none
+ *
+ */
+static void lwm2mIndicationCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
+ void *userdata )
+{
+ ( void ) h;
+ ( void ) resp_size;
+ LWM2M_EVENT_RES_S *pEvRes = (LWM2M_EVENT_RES_S *)userdata;
+
+ /* Client generated events */
+ switch( event )
+ {
+
+ /* event in response to m2mb_lwm2m_enable() */
+ case M2MB_LWM2M_ENABLE_RES:
+ {
+ M2MB_LWM2M_ENABLE_RES_T *resp = ( M2MB_LWM2M_ENABLE_RES_T * ) resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_INFO( "LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_ENABLE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "Enable result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get() */
+ case M2MB_LWM2M_GET_RES:
+ {
+ M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_GET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "get result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_set() */
+ case M2MB_LWM2M_SET_RES:
+ {
+ M2MB_LWM2M_SET_RES_T *resp = ( M2MB_LWM2M_SET_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_SET_RES, result OK\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "set result %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_read() */
+ case M2MB_LWM2M_READ_RES:
+ {
+ M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
+
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->len;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ AZX_LOG_TRACE( "M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_READ_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_write() */
+ case M2MB_LWM2M_WRITE_RES:
+ {
+ M2MB_LWM2M_WRITE_RES_T *resp = ( M2MB_LWM2M_WRITE_RES_T * )resp_struct;
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS)
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_WRITE_RES, result OK\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_WRITE_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_WARN( "write res %d\r\n", resp->result );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_EXIST_RES:
+ {
+ M2MB_LWM2M_EXIST_RES_T *resp = ( M2MB_LWM2M_EXIST_RES_T * )resp_struct;
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = resp->isExistent;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+
+ }
+ else
+ {
+ /*if the result is not SUCCESS, but it is M2MB_LWM2M_RES_FAIL_BAD_URI, the URI is not present.*/
+ if(resp->result == M2MB_LWM2M_RES_FAIL_BAD_URI )
+ {
+ /*copy in the event result structure (provided during m2mb_lwm2m_init) the relevant info*/
+ pEvRes->resp_len = 0;
+ pEvRes->uri = resp->reqURI;
+ pEvRes->result = resp->result;
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_EXIST_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ /*Generic failure*/
+ AZX_LOG_WARN( "exist res %d\r\n", resp->result);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_new_inst() */
+ case M2MB_LWM2M_NEW_INST_RES:
+ {
+ // event in response to the m2mb_lwm2m_newinst
+ M2MB_LWM2M_NEW_INST_RES_T *resp = ( M2MB_LWM2M_NEW_INST_RES_T * )resp_struct;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+ AZX_LOG_TRACE( "New Instance created successfully\r\n" );
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_DEBUG( "New instance creation not allowed (already present?)\r\n" );
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance failed. Result: %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SRV_INFO_IND:
+ {
+
+ M2MB_LWM2M_SRV_INFO_IND_T *resp = ( M2MB_LWM2M_SRV_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND, resp->info = %d\r\n", resp->info);
+
+ switch(resp->info)
+ {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n" );
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_SRV_REG_BIT, M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n" );
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_INFO( "resp->info == M2MB_LWM2M_CL_STATE_SUSPENDED\r\n" );
+ break;
+ default:
+ AZX_LOG_WARN( "resp->info: unexpected value!! %d\r\n", resp->info);
+ break;
+ }
+ break;
+ }
+
+ /* event in case a resource changed (if monitoring is enabled) */
+ case M2MB_LWM2M_MON_INFO_IND:
+ {
+ /*
+ An URC was received, like
+ #LWM2MMON: UPD,"/3311/x/5850/0
+ */
+ /* event that brings a resource change information */
+ M2MB_LWM2M_OBJ_URI_T * p_uri = (M2MB_LWM2M_OBJ_URI_T *)m2mb_os_malloc(sizeof(M2MB_LWM2M_OBJ_URI_T));
+
+ M2MB_LWM2M_MON_INFO_IND_T *pInfo = ( M2MB_LWM2M_MON_INFO_IND_T * )resp_struct;
+
+ AZX_LOG_TRACE("\r\nM2MB_LWM2M_MON_INFO_IND\r\n");
+
+ if(p_uri)
+ {
+ memcpy(p_uri, &(pInfo->uri), sizeof(M2MB_LWM2M_OBJ_URI_T));
+ AZX_LOG_INFO( "\r\nResource /%u/%u/%u/%u changed!\r\n",
+ p_uri->obj, p_uri->objInst,
+ p_uri->resource, p_uri->resourceInst
+ );
+
+ azx_tasks_sendMessageToTask( lwm2m_taskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE( "\r\nM2MB_LWM2M_SESSION_INFO_IND\r\n" );
+
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ M2MB_LWM2M_MON_RES_T *resp = ( M2MB_LWM2M_MON_RES_T * )resp_struct;
+ AZX_LOG_TRACE( "Resource change monitor setting result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_DEBUG("Monitoring enabled.\r\n\r\n");
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ M2MB_LWM2M_GET_STAT_RES_T *resp = ( M2MB_LWM2M_GET_STAT_RES_T * )resp_struct;
+
+ AZX_LOG_TRACE( "Get Stat result: %d\r\n", resp->result );
+
+ if( resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_INFO("GET STATUS.\r\nIF Status: %s\r\nClient Status: %s\r\n",
+ IF_STATUS_STRING[resp->status], CL_STATUS_STRING[resp->clStatus]);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_GET_STAT_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+ }
+ case M2MB_LWM2M_OBJSET_RES:
+ {
+ M2MB_LWM2M_OBJSET_RES_T *resp = (M2MB_LWM2M_OBJSET_RES_T *) resp_struct;
+
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+
+ case M2MB_LWM2M_OBJGET_RES:
+ {
+ M2MB_LWM2M_OBJGET_RES_T *resp = (M2MB_LWM2M_OBJGET_RES_T *) resp_struct;
+ AZX_LOG_TRACE("resp RESULT <%d>\r\n", resp->result);
+ if(resp->result == M2MB_LWM2M_RES_SUCCESS )
+ {
+ AZX_LOG_TRACE("objGet string <%s>\r\n", resp->dataString);
+ AZX_LOG_TRACE("objGet string size <%d>\r\n", resp->dataStringSize);
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_SET);
+ }
+ }
+ break;
+ default:
+ AZX_LOG_DEBUG( "LWM2M EVENT %d\r\n", event );
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief Checks if the input XML file is present in the device filesystem
+ *
+ * @param[in] name The file name (without path)
+ * @retval 0 in case of success, negative value otherwise
+ *
+ */
+static int check_xml_file(const char* name)
+{
+ char path[64] = {0};
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+
+ AZX_LOG_TRACE("Looking for <%s> file..\r\n", path);
+
+ if(0 == m2mb_fs_stat(path, &info))
+ {
+ AZX_LOG_TRACE("File is present.\r\n");
+ return 0;
+ }
+ else
+ {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if(last_errno == M2MB_FS_ENOENT)
+ {
+ AZX_LOG_WARN("File %s not found.\r\n", path);
+ return -1;
+ }
+ else
+ {
+ AZX_LOG_ERROR("error with m2mb_fs_stat, errno is: %d\r\n", last_errno);
+ return -2;
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ * @brief used to convert a unix timestamp into a RTC structure
+ *
+ * @param[in] t The input timestamp
+ * @param[in] p_rtc_time pointer to the structure to be filled
+ * @param[in] tz timezone to be used
+ * @retval none
+ *
+ */
+static void convertUnixTimeToRTC_TIME(time_t t, M2MB_RTC_TIME_T *p_rtc_time, INT16 tz)
+{
+ struct tm *_utctime = NULL;
+
+ if(!p_rtc_time)
+ {
+ return;
+ }
+
+ memset(p_rtc_time,0,sizeof(M2MB_RTC_TIME_T));
+ _utctime = gmtime((const time_t *)&t);
+ if(_utctime)
+ {
+ p_rtc_time->year = _utctime->tm_year + 1900;
+ p_rtc_time->mon = _utctime->tm_mon + 1;
+ p_rtc_time->day = _utctime->tm_mday;
+ p_rtc_time->hour = _utctime->tm_hour;
+ p_rtc_time->min = _utctime->tm_min;
+ p_rtc_time->sec = _utctime->tm_sec;
+ p_rtc_time->tz = tz;
+ }
+}
+
+
+/* Global functions =============================================================================*/
+
+UINT8 oneedge_init( void)
+{
+ M2MB_RESULT_E retVal;
+ M2MB_LWM2M_ENABLE_REQ_T pars;
+
+ INT32 service_enable = 1;
+ M2MB_LWM2M_OBJ_URI_T exist_uri;
+
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+ UINT16 agentID = 0; /* Telit agent ID */
+
+ memset(get_event_res_p(),0, sizeof(LWM2M_EVENT_RES_S));
+
+ if(0 != check_xml_file(OBJECT_XML_NAME))
+ {
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ return 1;
+ }
+
+ //get the handle of the lwm2m client on _h
+ retVal = m2mb_lwm2m_init( &lwm2mHandle, lwm2mIndicationCB, ( void * )get_event_res_p() );
+
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_init returned error %d\r\n", retVal );
+
+ return 1;
+ }
+
+ m2mb_lwm2m_agent_config( lwm2mHandle, agentID );
+
+ retVal = m2mb_lwm2m_write( lwm2mHandle, &_obj_telit_service_uri, &service_enable, sizeof( INT32 ) );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ lwm2m_taskID = azx_tasks_createTask((char*) "LWM2M_TASK", AZX_TASKS_STACK_M, 4, AZX_TASKS_MBOX_M, lwm2m_taskCB);
+
+ AZX_LOG_TRACE("Task ID: %d.\r\n", lwm2m_taskID);
+ if(lwm2m_taskID <= 0)
+ {
+ AZX_LOG_ERROR("Cannot create lwm2m managing task!\r\n");
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ pars.apnclass = CTX_ID; /*CID*/
+ pars.guardRequestEventSecs = 5;
+ pars.guardReleaseEventSecs = 5;
+ pars.commandType = M2MB_LWM2MENA_CMD_TYPE_SET;
+ pars.mode = M2MB_LWM2M_MODE_NO_ACK;
+
+ retVal = m2mb_lwm2m_enable( lwm2mHandle, &pars );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_enable returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_enable timeout!\r\n");
+
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+ m2mb_os_ev_set(get_lwm2mEvents_handle(), EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ /* query of the custom object URI for agent 0 (Telit)*/
+
+ exist_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ exist_uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ exist_uri.objInst = 0;
+ exist_uri.resource = DEMO_STRING_RW_RES_ID;
+ exist_uri.resourceInst = 0;
+
+ retVal = m2mb_lwm2m_exist( lwm2mHandle, &exist_uri );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_exist returned error %d\r\n", retVal );
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+
+ osRes = m2mb_os_ev_get( get_lwm2mEvents_handle(),
+ EV_LWM2M_EXIST_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(5000));
+ if(osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M exists timeout!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ else
+ {
+ /*len is 0 if the object does not exist, 1 otherwise*/
+ if(get_event_res_p()->resp_len == 0)
+ {
+ /*Create an instance of the demo's custom object*/
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+ M2MB_LWM2M_OBJ_URI_T uri_new_inst = { M2MB_LWM2M_URI_3_FIELDS, M2MB_LWM2M_DEMO_OBJ_ID, 0, 0, 0};
+
+ new_inst_params.agent = agentID; /*Telit Agent*/
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received in the callback, it is likely because the instance already exists. */
+ retVal = m2mb_lwm2m_newinst( lwm2mHandle, &uri_new_inst, &new_inst_params );
+ if( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_newinst returned error %d\r\n", retVal );
+
+ m2mb_lwm2m_deinit( lwm2mHandle );
+ return 1;
+ }
+ }
+ }
+
+
+
+ /*Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon*/
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+
+ M2MB_LWM2M_OBJ_URI_T uri_mon = {
+ M2MB_LWM2M_URI_4_FIELDS,
+ M2MB_LWM2M_DEMO_OBJ_ID, 0,
+ 0, 0
+ };
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded\r\n" );
+ }
+
+ if(M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_MON_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+ AZX_LOG_INFO("Waiting LWM2M Registering (120 seconds timeout)...\r\n");
+ osRes = m2mb_os_ev_get(get_lwm2mEvents_handle(), 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_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 msgLWM2MTask(INT32 type, INT32 param1, INT32 param2)
+{
+ (void)type;
+ (void)param1;
+ (void)param2;
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJGET_PARAM_T objGetReq;
+
+ UINT16 objGetRespSize = 8000; //size of the buffer where to write the response
+ CHAR* objGetRespString = NULL;
+ M2MB_RESULT_E objres;
+
+ int json_size = 400;
+ char * json_string = NULL;
+
+ INT32 ret = 0;
+ int i;
+ int task_status = type;
+
+ do
+ {
+ AZX_LOG_INFO("Initializing resources...\r\n");
+
+ init_sync();
+
+ azx_sleep_ms(8000);
+
+ /*Initialize LWM2M*/
+ ret = oneedge_init();
+ if (ret != 0)
+ {
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+
+ /*Checking client status*/
+ m2mb_lwm2m_get_stat(lwm2mHandle);
+
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_GET_STAT_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M get status timeout!\r\n");
+ return -2;
+ }
+
+ /*Obj_set on the custom object*/
+ json_string = (char *) m2mb_os_malloc(json_size * sizeof(char));
+ M2MB_LWM2M_OBJSET_PARAM_T obj_struct;
+
+ /*New multiple set with JSON string*/
+ sprintf(json_string, "{\"bn\":\"/%d/0/\",\"e\":"
+ "["
+ "{\"n\":\"11\",\"sv\":\"hello world\"}," /*String*/
+ "{\"n\":\"12\",\"v\":70}," /*integer*/
+ "{\"n\":\"13\",\"v\":-12.5}," /*float*/
+ "{\"n\":\"15\",\"sv\":\"aGVsbG8gd29ybGQ=\"}," /*opaque: data must be in BASE64 format*/
+ "{\"n\":\"16\",\"v\":1620828702}," /*time*/
+ "{\"n\":\"31/0\",\"sv\":\"Greetings\"}," /*String multi-instance*/
+ "{\"n\":\"31/1\",\"sv\":\"from\"}," /*String multi-instance*/
+ "{\"n\":\"31/2\",\"sv\":\"AppZone!\"}," /*String multi-instance*/
+ "{\"n\":\"34/0\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/1\",\"bv\":false}," /*Boolean multi-instance*/
+ "{\"n\":\"34/2\",\"bv\":true}," /*Boolean multi-instance*/
+ "{\"n\":\"34/3\",\"bv\":false}" /*Boolean multi-instance*/
+ "]}",
+ M2MB_LWM2M_DEMO_OBJ_ID
+ );
+
+ obj_struct.objectId = M2MB_LWM2M_DEMO_OBJ_ID;
+ obj_struct.objectInstanceId = 0;
+ obj_struct.dataString = json_string;
+ obj_struct.dataStringSize = json_size;
+
+ if (m2mb_lwm2m_objset(lwm2mHandle, &obj_struct) == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJSET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objset status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objset SUCCESS \r\n");
+ }
+ }
+ else
+ {
+ AZX_LOG_ERROR("\r\nm2mb_lwm2m_objset failed\r\n");
+ }
+
+ m2mb_os_free(json_string);
+ json_string = NULL;
+
+ azx_sleep_ms(10000);
+
+ i = 5;
+ AZX_LOG_INFO("\r\nWaiting %d seconds before the m2mb_lwm2m_objget\r\n", i);
+
+ while(i > 0)
+ {
+ AZX_LOG_INFO("\r\nWaiting: %d\r\n", i);
+ azx_sleep_ms(1000);
+ i--;
+ }
+
+ objGetRespString = (CHAR*)m2mb_os_calloc(objGetRespSize * sizeof(CHAR));
+
+ memset(&objGetReq, 0, sizeof(M2MB_LWM2M_OBJGET_PARAM_T));
+
+ objGetReq.agentId = 0;
+ objGetReq.uri.obj = M2MB_LWM2M_DEMO_OBJ_ID;
+ objGetReq.uri.objInst = 0;
+ objGetReq.uri.uriLen = M2MB_LWM2M_URI_2_FIELDS;
+
+ objres = m2mb_lwm2m_objget(lwm2mHandle, &objGetReq, objGetRespString,
+ objGetRespSize);
+
+ if (objres == M2MB_RESULT_SUCCESS)
+ {
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ get_lwm2mEvents_handle(),
+ EV_LWM2M_OBJGET_RES_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits, M2MB_OS_MS2TICKS(2000) /*wait 2 seconds for the event to occur*/
+ ))
+ {
+ AZX_LOG_ERROR("LWM2M OBJget status timeout!\r\n");
+ task_status = APPLICATION_EXIT;
+ break;
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nm2mb_lwm2m_objget SUCCESS \r\n");
+ AZX_LOG_INFO("\r\nContent: \r\n<%s>\r\n\r\n", objGetRespString);
+ }
+ } else
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_objget failed\r\n");
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for events from the OneEdge portal. Please write on monitored resources or call an 'exec' one.\r\n\r\n");
+ while(1)
+ {
+ /*Wait*/
+ azx_sleep_ms(10000);
+ }
+ task_status = APPLICATION_EXIT;
+ } while(0);
+
+ if (task_status == APPLICATION_EXIT)
+ {
+ if(lwm2mHandle)
+ {
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ }
+
+ if(json_string)
+ {
+ m2mb_os_free(json_string);
+ }
+
+ deinit_sync();
+ AZX_LOG_DEBUG("Application complete.\r\n");
+ }
+
+ return 0;
+}
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
new file mode 100755
index 00000000..fa70f5ea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/src/lwm2m_utils.c
@@ -0,0 +1,909 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ lwm2m_utils.c
+
+ @brief
+ The file contains the LWM2M resources utilities
+
+ @details
+
+ @version
+ 1.0.0
+ @note
+
+
+ @author
+
+
+ @date
+ 23/11/2021
+ */
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_rtc.h"
+
+#include "m2mb_lwm2m.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "lwm2m_demo.h"
+#include "lwm2m_utils.h"
+
+static M2MB_OS_SEM_HANDLE lwm2mCSSemHandle = NULL;
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static LWM2M_EVENT_RES_S event_res;
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_SEM_HANDLE get_lwm2mCSsem_handle(void)
+{
+ return lwm2mCSSemHandle;
+}
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_OS_EV_HANDLE get_lwm2mEvents_handle(void)
+{
+ return eventsHandleLwm2m;
+}
+
+LWM2M_EVENT_RES_S *get_event_res_p(void)
+{
+ return &event_res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 init_sync(void)
+{
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ INT32 result = 0;
+
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN));
+
+ osRes = m2mb_os_sem_init( &lwm2mCSSemHandle, &semAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_sem_setAttrItem( &semAttrHandle, M2MB_OS_SEM_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_sem_init failed!\r\n");
+ lwm2mCSSemHandle = NULL;
+ result = -1;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_sem_init success\r\n");
+ result = 0;
+ }
+ }
+
+ if (NULL == eventsHandleLwm2m)
+ {
+ /* Init events handler */
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "lwm2m_ev"));
+ osRes = m2mb_os_ev_init( &eventsHandleLwm2m, &evAttrHandle );
+
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ eventsHandleLwm2m = NULL;
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ result += -2;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ result = 0;
+ }
+ }
+
+ return result;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*releases the synchronization resources*/
+void deinit_sync(void)
+{
+ if(eventsHandleLwm2m)
+ {
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+ eventsHandleLwm2m = NULL;
+ }
+ if(lwm2mCSSemHandle)
+ {
+ m2mb_os_sem_deinit( lwm2mCSSemHandle );
+ lwm2mCSSemHandle = NULL;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen )
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_set( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_set returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_SET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ retVal = m2mb_lwm2m_write( h, uri, inbuf, inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_write returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_WRITE_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_write timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 get_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+ M2MB_RESULT_E retVal;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ retVal = m2mb_lwm2m_get( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_get returned error %d\r\n",retVal );
+
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_GET_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_get timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 read_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 *inbuflen)
+{
+ UINT32 curEvBits;
+ INT32 res = -1;
+
+ /*Get critical section*/
+ m2mb_os_sem_get(lwm2mCSSemHandle, M2MB_OS_WAIT_FOREVER);
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_FAIL_RES_BIT, M2MB_OS_EV_CLEAR);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_read( h, uri, inbuf, *inbuflen);
+
+ //retVal is just the return value of the API, not the completed operation
+ //the completed operation ends when an event is raised into the callback
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_read returned error %d\r\n",retVal );
+ }
+ else
+ {
+ if( M2MB_OS_SUCCESS != m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_READ_RES_BIT | EV_LWM2M_FAIL_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ )
+ )
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_read timeout!\r\n");
+ res = -2;
+ }
+ else
+ {
+ if ((curEvBits & EV_LWM2M_FAIL_RES_BIT) == EV_LWM2M_FAIL_RES_BIT)
+ {
+ AZX_LOG_ERROR("Failure event arrived!\r\n");
+ res = -3;
+ }
+ else
+ {
+ switch(event_res.uri.resource)
+ {
+ case DEMO_OPAQUE_RW_RES_ID:
+
+ *inbuflen = event_res.resp_len;
+ AZX_LOG_TRACE("Read - opaque size: %u\r\n", *inbuflen);
+ break;
+
+ default:
+ break;
+ }
+ res = 0;
+ }
+ }
+ }
+ /*release critical section*/
+ m2mb_os_sem_put(lwm2mCSSemHandle);
+ return res;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * SET READ ONLY RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 set_read_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 set_read_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return set_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return set_resource(h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return set_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 set_read_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nSetting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+
+ return set_resource(h, pUri, data, (UINT16)strlen(data));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+/*=====================================
+ * WRITE RW (or WRITE-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+
+INT32 write_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting integer resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(INT32));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting timestamp resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+
+ return write_resource( h, pUri, &value, (UINT16)sizeof(UINT64));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting double resource {%u/%u/%u/%u} value to %f on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(double));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN value)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ value);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting boolean resource {%u/%u/%u/%u} value to %d on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ value);
+ }
+ return write_resource(h, pUri, &value, (UINT16)sizeof(int));
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 write_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ return write_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 write_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource,
+ data);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nWriting string resource {%u/%u/%u/%u} value to <%s> on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst,
+ data);
+ }
+ return write_resource(h, pUri, data, strlen(data));
+}
+
+
+/*=====================================
+ * GET WRITE ONLY RESOURCES UTILITIES
+ * ===================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u} valueon LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = get_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 get_write_only_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nGetting string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return get_resource(h, pUri, string, &dataLen );
+}
+
+
+
+
+/*=====================================
+ * READ RW (OR READ-ONLY) RESOURCES UTILITIES
+ * ===================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading integer resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_timestamp_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT64 *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading timestamp resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ UINT64 *pData = (UINT64 *)data;
+ *value = pData[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_double_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, double *value)
+{
+ double data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading double resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_boolean_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, BOOLEAN *value)
+{
+ INT32 data[2];
+ UINT16 datasize = sizeof(data);
+ INT32 retVal;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading boolean resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ retVal = read_resource( h, pUri, data, &datasize);
+ if(retVal == 0)
+ {
+ *value = (BOOLEAN)data[0];
+ }
+ return retVal;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT16 *datalen)
+{
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading opaque resource {%u/%u/%u/%u} on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, data, datalen);
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+
+INT32 read_rw_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *string, UINT16 string_max_size)
+{
+ UINT16 dataLen = string_max_size;
+ if(pUri->uriLen == M2MB_LWM2M_URI_3_FIELDS)
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource);
+ }
+ else
+ {
+ AZX_LOG_INFO("\r\nReading string resource {%u/%u/%u/%u} value on LWM2M client.\r\n",
+ pUri->obj, pUri->objInst, pUri->resource, pUri->resourceInst);
+ }
+
+ return read_resource(h, pUri, string, &dataLen );
+}
+
+/**/
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/xml/object_32011.xml b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/xml/object_32011.xml
new file mode 100755
index 00000000..b275635e
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/LWM2M_OBJ_SET_GET/xml/object_32011.xml
@@ -0,0 +1,106 @@
+
+
+
+ m2mb lwm2m objset-get demo
+ object providing OMA resources required for the m2mb_lwm2m_objget and m2mb_lwm2m_objset DEMO
+ 32011
+ urn:oma:lwm2m:x:32011
+ 1.0
+ 1.0
+ Single
+ Optional
+
+ -
+
Read Write String
+ RW
+ Single
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write Integer
+ RW
+ Single
+ Mandatory
+ Integer
+
+
+
+
+ -
+
Read Write Float
+ RW
+ Single
+ Mandatory
+ Float
+
+
+
+
+ -
+
Read Write Boolean
+ RW
+ Single
+ Mandatory
+ Boolean
+
+
+
+
+ -
+
Read Write Opaque
+ RW
+ Single
+ Mandatory
+ Opaque
+
+
+
+
+ -
+
Read Write Time
+ RW
+ Single
+ Mandatory
+ Time
+
+
+
+
+ -
+
Read Write Objlnk
+ RW
+ Single
+ Mandatory
+ Objlnk
+
+
+
+
+ -
+
Read Write MultiInstance String
+ RW
+ Multiple
+ Mandatory
+ String
+
+
+
+
+ -
+
Read Write MultiInstance Boolean
+ RW
+ Multiple
+ Mandatory
+ Boolean
+
+
+
+
+
+
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/metadata.json
old mode 100755
new mode 100644
index b6d942ec..8e467776
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Logging/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/metadata.json
old mode 100755
new mode 100644
index 522467fd..63477194
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MD5/metadata.json
@@ -14,13 +14,15 @@
"firmwares": [
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -38,9 +40,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/metadata.json
old mode 100755
new mode 100644
index 158ad703..40e55098
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/metadata.json
@@ -11,13 +11,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -34,9 +36,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/src/mqtt_demo.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/src/mqtt_demo.c
index fc7554f7..00741d9e 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/src/mqtt_demo.c
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MQTT/src/mqtt_demo.c
@@ -11,7 +11,7 @@
@details
@version
- 1.0.5
+ 1.0.6
@note
@@ -141,9 +141,8 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
return;
}
- if ((ssl_auth_mode == M2MB_SSL_SERVER_AUTH) || (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH))
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_AUTH)
{
-
/* clean everything */
res = m2mb_ssl_cert_delete( M2MB_SSL_CACERT, (CHAR*)SSL_CERT_CA_NAME );
if(res==0)
@@ -155,6 +154,20 @@ static void CleanSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SSL_C
AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
}
}
+
+ if(ssl_auth_mode >= M2MB_SSL_SERVER_CLIENT_AUTH)
+ {
+ res = m2mb_ssl_cert_delete( M2MB_SSL_CERT, (CHAR*)SSL_CLIENT_NAME );
+ if(res==0)
+ {
+ AZX_LOG_TRACE("m2mb_ssl_cert_delete PASS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("m2mb_ssl_cert_delete failed with code %d\r\n",res);
+ }
+ }
+
res = m2mb_ssl_delete_config(*p_hSSLConfig);
if(res==0)
{
@@ -265,18 +278,20 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CACERT,SSL_info,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_NO_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CACERT,(CHAR*) SSL_CERT_CA_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
}
- if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
+ if (ssl_auth_mode == M2MB_SSL_SERVER_CLIENT_AUTH)
{
AZX_LOG_DEBUG("server + client authentication is chosen \r\n");
AZX_LOG_DEBUG("ca cert file %s \r\n",CLIENTCERTFILE);
@@ -284,14 +299,14 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 ==m2mb_fs_stat(CLIENTCERTFILE, &st))
{
AZX_LOG_DEBUG("file size: %u\r\n", st.st_size);
-
}
fd = m2mb_fs_open(CLIENTCERTFILE, M2MB_O_RDONLY); /*open in read only mode*/
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTCERTFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -301,7 +316,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Buffer successfully received from file. %d bytes were loaded.\r\n", res);
@@ -329,7 +345,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (fd == -1 )
{
AZX_LOG_DEBUG("Cannot open file %s \r\n",CLIENTKEYFILE);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
AZX_LOG_DEBUG("Reading content from file. Size: %u\r\n", st.st_size);
@@ -339,7 +356,8 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
{
AZX_LOG_DEBUG("Failed reading buffer into file.\r\n");
m2mb_fs_close(fd);
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
else
{
@@ -356,13 +374,15 @@ static INT32 PrepareSSLEnvironment(M2MB_SSL_CONFIG_HANDLE* p_hSSLConfig, M2MB_SS
if (0 != m2mb_ssl_cert_store( M2MB_SSL_CERT,SSL_info,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_store FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_AUTH);
+ return -1;
}
if (0 != m2mb_ssl_cert_load( *p_hSSLCtx,M2MB_SSL_CERT,(CHAR*) SSL_CLIENT_NAME ))
{
AZX_LOG_ERROR("m2mb_ssl_cert_load FAILED\r\n" );
- CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, ssl_auth_mode);
+ CleanSSLEnvironment(p_hSSLConfig, p_hSSLCtx, M2MB_SSL_SERVER_CLIENT_AUTH);
+ return -1;
}
}
@@ -543,7 +563,11 @@ INT32 MQTT_Task( INT32 type, INT32 param1, INT32 param2 )
break;
}
}
-
+ else
+ {
+ AZX_LOG_ERROR("PrepareSSLEnvironment() failed!\r\n");
+ break;
+ }
/* Init events handler */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/metadata.json
old mode 100755
new mode 100644
index 58b49b5e..85d4fef0
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/MultiTask/metadata.json
@@ -14,14 +14,16 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -39,9 +41,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/metadata.json
old mode 100755
new mode 100644
index c100619c..e06bc734
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/Mutex/metadata.json
@@ -15,19 +15,20 @@
"30.00.xx6",
"30.00.xx7",
"30.00.xx8",
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx1",
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
- "firmwares": [
- ]
+ "firmwares": []
},
"LE910Cx-X": {
"firmwares": [
@@ -37,9 +38,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/Makefile.in
index c1e9460f..d4d68f4c 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/metadata.json
old mode 100755
new mode 100644
index 9137e03f..4af20f01
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/metadata.json
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/NTP/metadata.json
@@ -12,13 +12,15 @@
"availability": {
"MXXXXC1": {
"firmwares": [
- "30.00.xx9"
+ "30.00.xx9",
+ "30.01.xx0.0"
]
},
"MXXXXG1": {
"firmwares": [
"37.00.xx2",
- "37.00.xx3"
+ "37.00.xx3",
+ "37.00.xx4.1"
]
},
"LE910Cx-L": {
@@ -35,9 +37,20 @@
}
},
"groups": [
- {"name": "MAIN_UART", "limitations": []},
- {"name": "AUX_UART", "limitations": ["LE910Cx-L"]},
- {"name": "USB0", "limitations": []}
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
],
"platform": "GCC",
"license": "MIT",
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/LICENSE.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/LICENSE.txt
new file mode 100755
index 00000000..165f3c47
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/LICENSE.txt
@@ -0,0 +1,11 @@
+Copyright 2020, Telit
+All rights reserved.
+
+MIT License
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/Makefile.in
new file mode 100755
index 00000000..d4d68f4c
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/Makefile.in
@@ -0,0 +1,50 @@
+# Log settings
+LOGS_ENABLE = 1
+
+# If logs are enabled, channel can be: MAIN_UART AUX_UART USB0 USB1
+LOGS_CHANNEL = AZX_LOG_TO_USB0
+
+# How detailed should the logs be. See AZX_LOG_LEVEL_E
+LOGS_LEVEL = DEBUG
+
+# Enable to add ANSI colours to the logs
+LOGS_COLOUR = 0
+
+
+# -------------------------
+
+## ---- do not touch below this line
+
+SW_VER = 1.1.13
+
+CLEAN_BEFORE_BUILD = clean
+
+# The current version of the API
+CPPFLAGS += -DVERSION=\"$(SW_VER)\"
+
+
+ifeq ($(strip $(LOGS_ENABLE)),1)
+CPPFLAGS += -DAZX_LOG_ENABLE
+CPPFLAGS += -DLOG_CHANNEL=$(LOGS_CHANNEL)
+CPPFLAGS += -DAZX_LOG_LEVEL=AZX_LOG_LEVEL_$(LOGS_LEVEL)
+
+CPPFLAGS += -DAZX_LOG_ENABLE_COLOURS=$(LOGS_COLOUR)
+
+endif
+
+
+# Disable the missing-field-initializers as GCC sometimes complains about
+# legitimate struct initialization
+# (https://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru)
+
+
+ifneq (,$(filter $(TOOLCHAIN),GCC GCC_LINUX GNUEABI))
+ CPPFLAGS += -Wall -Werror -Wextra -Wunreachable-code -Wno-missing-field-initializers -Wno-format
+else
+ CPPFLAGS += --diag_suppress=111,177,1293
+endif
+# --------------------------------------------------------------------------
+
+
+CPPFLAGS += -I azx/hdr
+OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/README.md b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/README.md
new file mode 100755
index 00000000..3048353b
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/README.md
@@ -0,0 +1,28 @@
+
+### RTC example
+
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on **USB0**
+
+
+**Features**
+
+
+- How to read module timestamp
+- How to read module system time
+- How to set new system time
+
+
+**Application workflow**
+
+**`M2MB_main.c`**
+
+- Init log azx and print a welcome message
+- Init net functionality and wait for module registration
+- Init RTC functionality and get module time in timestamp format (seconds from the epoch)
+- Get moudle system time in date/time format
+- Add 1 hour to timestamp, convert it to system time and set it to module
+
+
+
+---------------------
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/hdr/azx_log.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/hdr/azx_log.h
new file mode 100755
index 00000000..76d26eea
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/hdr/azx_log.h
@@ -0,0 +1,331 @@
+/*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.9
+ * @dependencies
+ * @author Fabio Pintus
+ * @author Ioannis Demetriou
+ * @date 13/01/2017
+ *
+ * @brief Logging utilities to print on available output channels
+ *
+ * This library code will give user the possibility to print debug messages on
+ * their application.
+ */
+#include "m2mb_types.h"
+
+
+/* Global declarations =======================================================*/
+
+
+/* Global typedefs ===========================================================*/
+
+/** @defgroup logConf Configuration of logging functionalities
+ * Configuration functions, macros and enumerators can be used to set the
+ * logging channel (Main UART, Auxiliary UART, USB0/ USB1) and the logging mask
+ * (which allows to enable each log level independently)
+ */
+
+/** @defgroup logUsage Usage of logging functionalities
+ * Macros that can be used to actually print log messages
+ */
+
+/**
+ * @brief Logging levels
+ * \ingroup logConf
+ */
+typedef enum
+{
+ 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;
+
+
+/**
+ * @brief Logging errors
+ * \ingroup logUsage
+ */
+typedef enum
+{
+ AZX_LOG_NOT_INIT, /** (max) ? (max) : val)))
+
+/**
+ * @brief Puts the task to sleep for a specified time.
+ *
+ * This function returns once the specified number of milliseconds elapses.
+ *
+ * @param[in] ms The number of milliseconds to wait before returning.
+ */
+void azx_sleep_ms(UINT32 ms);
+
+/* @{ */
+#define AZX_UTILS_HEX_DUMP_BUFFER_SIZE 250
+/**
+ * @brief Dumps HEX data to string
+ *
+ * Useful for logging binary data. If the data gets trimmed, adjust
+ * @ref AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.
+ *
+ * @param[in] data The data to print in hex format
+ * @param[in] len The number of bytes
+ *
+ * @return A string with the hex data. The string is valid until the subsequent
+ * call to azx_hex_dump().
+ */
+const CHAR* azx_hex_dump(const void* data, UINT32 len);
+/** @} */
+
+/**
+ @brief Reboots the modem straight away.
+
+ @details
+ This utility will ask the module to reboot. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_reboot_now(void);
+
+/**
+ @brief Shuts the modem down straight away.
+
+ @details
+ This utility will ask the module to shutdown. It will not be executed immediately, so
+ code flow must take care of instructions after this one.
+
+ @return None
+
+*/
+/*-----------------------------------------------------------------------------------------------*/
+void azx_shutdown_now(void);
+
+
+
+
+#endif /* HDR_AZX_UTILS_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_log.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_log.c
new file mode 100755
index 00000000..3cb669c7
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_log.c
@@ -0,0 +1,782 @@
+/*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 =============================================================*/
+
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#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"
+#define DARK "\033[2m"
+#define UNDERLINE "\033[4m"
+#define BLINK "\033[5m"
+#define REVERSE "\033[7m"
+#define CONCEALED "\033[8m"
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define MAGENTA "\033[35m"
+#define CYAN "\033[36m"
+#define WHITE "\033[37m"
+
+#define ON_BLACK "\033[40m"
+#define ON_RED "\033[41m"
+#define ON_GREEN "\033[42m"
+#define ON_YELLOW "\033[43m"
+#define ON_BLUE "\033[44m"
+#define ON_MAGENTA "\033[45m"
+#define ON_CYAN "\033[46m"
+#define ON_WHITE "\033[47m"
+
+#define LOG_TRACE_COLOR CYAN
+#define LOG_DEBUG_COLOR YELLOW
+#define LOG_INFO_COLOR BOLD WHITE
+#define LOG_WARN_COLOR BOLD YELLOW
+#define LOG_ERROR_COLOR BOLD RED
+#define LOG_CRITICAL_COLOR BOLD RED ON_WHITE
+
+
+#define LOG_PREFIX(tag) \
+ case AZX_LOG_LEVEL_##tag: \
+ offset = snprintf(log_buffer, LOG_BUFFER_SIZE, \
+ (log_cfg.colouredLogs)? prefix_fmt_colour : prefix_fmt_no_colour, \
+ (log_cfg.colouredLogs)? LOG_##tag##_COLOR: "", #tag, (log_cfg.colouredLogs)? NO_COLOUR :"", \
+ now / 1000.0, \
+ get_file_title(file), line, \
+ function, \
+ get_current_task_name(task_name) \
+ ); \
+ 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
+{
+ BOOLEAN isInit;
+ AZX_LOG_LEVEL_E level;
+ AZX_LOG_HANDLE_E channel;
+ 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};
+
+
+
+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 =================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message);
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message : Message to print
+ \return sent bytes, negative in case of error
+
+ \details Using channel:USB_CH_DEFAULT uses channel assigned to instance
+ USER_USB_INSTANCE_0
+ */
+/*----------------------------------------------------------------------------*/
+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(void);
+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(void);
+
+/* Static functions ==========================================================*/
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the main UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty0", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Print directly on the auxiliary UART
+
+ \param [in] message: the string to print
+ \return sent bytes
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_print_to_AUX_UART(const CHAR *message)
+{
+ INT32 sent = 0;
+
+ /* Get a UART handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_uart_open( "/dev/tty1", 0 );
+ }
+
+ if ( -1 != log_cfg.ch_fd)
+ {
+ sent = m2mb_uart_write(log_cfg.ch_fd, (char*) message, strlen(message));
+
+ //m2mb_uart_close(g_AUX_fd);
+ }
+ return sent;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints as log_printToUart but using a specified USB channel
+
+ \param [in] path: USB resource path where to print (e.g. /dev/USB0
+ \param [in] message: Message to print
+ \return sent bytes, negative in case of error
+
+ */
+/*-----------------------------------------------------------------------------*/
+static INT32 log_print_to_USB (const CHAR *path, const CHAR *message )
+{
+ INT32 ch;
+ INT32 result;
+ INT32 sent = 0;
+
+ /* get the requested channel from the path,
+ * so the related semaphore can be retrieved */
+ result = sscanf(path, "/dev/USB%d", &ch);
+ if(!result)
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+
+
+ /* Get a USB handle first */
+ if(log_cfg.ch_fd == -1)
+ {
+ log_cfg.ch_fd = m2mb_usb_open(path, 0);
+ }
+ if ( log_cfg.ch_fd == -1 )
+ {
+ return AZX_LOG_CANNOT_OPEN_USB_CHANNEL;
+ }
+ sent = m2mb_usb_write( log_cfg.ch_fd, (const void*) message, strlen(message));
+
+ /* in case of concurrency using m2m_hw_usb...
+ * Comment the next API to avoid closing */
+ //(void)m2mb_usb_close(log_cfg.ch_fd);
+
+ return sent;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief returns the system uptime in milliseconds
+
+ \return the system uptime
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static UINT32 get_uptime(void)
+{
+
+ UINT32 sysTicks = m2mb_os_getSysTicks();
+
+ FLOAT32 ms_per_tick = m2mb_os_getSysTickDuration_ms();
+
+ return (UINT32) (sysTicks * ms_per_tick); //milliseconds
+}
+
+
+static CHAR fileTitle[12] = "";
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Removes the file path from the provided path, leaving only filename
+
+ \param [in] path: the file path
+ \return the filename(+ extension) extracted from the path
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+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 == '\\') {
+ start = p + 1;
+ }
+
+ if(*p == '.') {
+ end = p;
+ }
+
+ p++;
+ }
+
+ if(end <= start) {
+ end = p;
+ }
+
+ snprintf(fileTitle, sizeof(fileTitle), "%.*s", (INT32)(end - start), start);
+ return fileTitle;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*!
+ \brief Returns the current task name
+
+ \param [in] name: the buffer where the task name will be saved
+ \return a reference to name variable
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+static char* get_current_task_name(CHAR *name)
+{
+ MEM_W out;
+ M2MB_OS_TASK_HANDLE taskHandle = m2mb_os_taskGetId();
+
+ if(M2MB_OS_SUCCESS !=
+ m2mb_os_taskGetItem(taskHandle, M2MB_OS_TASK_SEL_CMD_NAME, &out, NULL))
+ {
+ return NULL;
+ }
+ else
+ {
+ strcpy(name, (CHAR*)out);
+ return 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 ==========================================================*/
+
+
+void azx_log_init(AZX_LOG_CFG_T *cfg)
+{
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if(log_cfg.isInit == TRUE)
+ {
+ return;
+ }
+
+ log_cfg.level = cfg->log_level;
+ log_cfg.channel = cfg->log_channel;
+ log_cfg.colouredLogs = cfg->log_colours;
+ log_cfg.ch_fd = -1;
+
+ if (NULL == log_cfg.CSSemHandle)
+ {
+ m2mb_os_sem_setAttrItem(&semAttrHandle,
+ CMDS_ARGS(M2MB_OS_SEM_SEL_CMD_CREATE_ATTR, NULL,
+ M2MB_OS_SEM_SEL_CMD_COUNT, 1 /*CS*/,
+ M2MB_OS_SEM_SEL_CMD_TYPE, M2MB_OS_SEM_GEN,
+ M2MB_OS_SEM_SEL_CMD_NAME, "CSSem"));
+ m2mb_os_sem_init( &log_cfg.CSSemHandle, &semAttrHandle );
+ }
+ log_cfg.isInit = TRUE;
+}
+
+
+INT32 azx_log_deinit(void)
+{
+ INT32 rc = AZX_LOG_NOT_INIT;
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_uart_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB0:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ case AZX_LOG_TO_USB1:
+ if(log_cfg.ch_fd != -1)
+ {
+ rc = m2mb_usb_close(log_cfg.ch_fd);
+ }
+ break;
+ default:
+ rc = AZX_LOG_UNEXPECTED_CHANNEL;
+ break;
+ }
+ log_cfg.ch_fd = -1;
+
+ //destroy lock related to USB that can not be opened
+ m2mb_os_sem_deinit(log_cfg.CSSemHandle);
+ log_cfg.CSSemHandle = NULL;
+
+ log_cfg.isInit = FALSE;
+ return rc;
+}
+
+void azx_log_setLevel(AZX_LOG_LEVEL_E level)
+{
+
+ log_cfg.level = level;
+}
+
+AZX_LOG_LEVEL_E azx_log_getLevel(void)
+{
+ if(log_cfg.isInit)
+ {
+ return log_cfg.level;
+ }
+
+ return AZX_LOG_LEVEL_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the requested log channel (USB, UART, AUX)
+
+ \param [in] msg: message to be printed on output
+ \return amount of printed bytes, negative value in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+static INT32 log_base_function(const char *msg)
+{
+ INT32 result = 0;
+
+
+ if ( ! log_cfg.isInit)
+ {
+ return AZX_LOG_NOT_INIT;
+ }
+
+ switch(log_cfg.channel)
+ {
+ case AZX_LOG_TO_MAIN_UART:
+ result = log_print_to_UART(msg);
+ break;
+ case AZX_LOG_TO_AUX_UART:
+ result = log_print_to_AUX_UART(msg);
+ break;
+ case AZX_LOG_TO_USB0:
+ result = log_print_to_USB("/dev/USB0", msg);
+ break;
+ case AZX_LOG_TO_USB1:
+ result = log_print_to_USB("/dev/USB1", msg);
+ break;
+ default:
+ //TODO return some error
+ break;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
+ \brief Prints on the defined stream (UART or USB channel)
+ *
+ \param [in] level: Logging level. see AZX_LOG_LEVEL_E enum
+ \param [in] function: source function name to add to the output if log is verbose
+ \param [in] file: source file path to add to the output if log is verbose
+ \param [in] line: source file line to add to the output if log is verbose
+ \param [in] fmt : string format with parameters to print
+ \param [in] ... : ...
+ \return the number of sent bytes.
+ 0 if logging level is not enabled, negative in case of error
+
+ */
+/*----------------------------------------------------------------------------*/
+INT32 azx_log_formatted(AZX_LOG_LEVEL_E level,
+ const char* function, const char* file, int line, const CHAR *fmt, ... )
+{
+ INT32 sent = 0;
+ va_list arg;
+ INT32 offset = 0;
+ UINT32 now;
+
+ /* If the selected log level is set */
+ if(level >= azx_log_getLevel())
+ {
+ m2mb_os_sem_get(log_cfg.CSSemHandle, M2MB_OS_WAIT_FOREVER );
+
+ now = get_uptime();
+ /*Prepare buffer*/
+ memset(log_buffer,0,LOG_BUFFER_SIZE);
+
+ switch(level)
+ {
+ LOG_PREFIX(TRACE);
+ LOG_PREFIX(DEBUG);
+ LOG_PREFIX(WARN);
+ LOG_PREFIX(ERROR);
+ LOG_PREFIX(CRITICAL);
+ default:
+ break;
+ }
+
+ va_start(arg, fmt);
+ vsnprintf(log_buffer + offset, LOG_BUFFER_SIZE-offset, fmt, arg);
+ va_end(arg);
+
+ /* 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/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_utils.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_utils.c
new file mode 100755
index 00000000..c9d3928d
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/azx/src/azx_utils.c
@@ -0,0 +1,68 @@
+/*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
+#include "m2mb_types.h"
+#include "m2mb_os_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_power.h"
+
+#include "azx_log.h"
+
+#include "azx_utils.h"
+
+void azx_sleep_ms(UINT32 ms)
+{
+ m2mb_os_taskSleep( M2MB_OS_MS2TICKS(ms) );
+}
+
+
+#define MIN(i,j) (((i) < (j)) ? (i) : (j))
+const CHAR* azx_hex_dump(const void* data, UINT32 len)
+{
+ static CHAR buff[AZX_UTILS_HEX_DUMP_BUFFER_SIZE];
+ UINT32 i;
+
+ memset(buff, 0, AZX_UTILS_HEX_DUMP_BUFFER_SIZE);
+ if (data == NULL)
+ {
+ snprintf(buff, AZX_UTILS_HEX_DUMP_BUFFER_SIZE, "(null)");
+ goto end;
+ }
+
+ len = MIN(len, AZX_UTILS_HEX_DUMP_BUFFER_SIZE/5);
+
+ for (i = 0; i < len; ++i)
+ {
+ snprintf(buff + 5*i, AZX_UTILS_HEX_DUMP_BUFFER_SIZE - 5*i,
+ "0x%02x ", ((const UINT8*)data)[i]);
+ }
+
+end:
+ return buff;
+}
+
+void azx_reboot_now(void)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ 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)
+{
+ M2MB_POWER_HANDLE h = NULL;
+
+ if(M2MB_RESULT_SUCCESS == m2mb_power_init(&h, NULL, NULL))
+ {
+ AZX_LOG_DEBUG("It's dead, Jim!\r\n");
+ AZX_LOG_INFO("Shutting down device\r\n");
+ m2mb_power_shutdown(h);
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/description.txt b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/description.txt
new file mode 100644
index 00000000..1bd61d04
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/description.txt
@@ -0,0 +1 @@
+Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on USB0
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/hdr/app_cfg.h b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/hdr/app_cfg.h
new file mode 100755
index 00000000..4e3c70f6
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/hdr/app_cfg.h
@@ -0,0 +1,25 @@
+/*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_APP_CFG_H_
+#define HDR_APP_CFG_H_
+/**
+ * @file app_cfg.h
+ * @version 1.0.0
+ * @date 10/02/2019
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ * This file contains macros that a programmer can alter to easily modify the
+ * behaviour of the application an **compile** time.
+ */
+
+/** @cond DEV*/
+#define QUOTE(str) #str
+#define EXPAND_AND_QUOTE(str) QUOTE(str)
+/** @endcond*/
+
+/*Local basepath for samples that need local files usage*/
+#define LOCALPATH "/mod"
+
+#endif /* HDR_APP_CFG_H_ */
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/metadata.json b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/metadata.json
new file mode 100755
index 00000000..62dc4bec
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/metadata.json
@@ -0,0 +1,77 @@
+{
+ "name": "Sample App to set/get module RTC",
+ "type": "sample-app",
+ "description": "A sample app that shows how to set and get module system time and timestamp.",
+ "copyright": "Telit Communications, 2020",
+ "homepage": "https://www.telit.com/",
+ "keywords": [
+ "IoT AppZone",
+ "RTC",
+ "Time"
+ ],
+ "availability": {
+ "MXXXXC1": {
+ "firmwares": [
+ "30.00.xx6",
+ "30.00.xx7",
+ "30.00.xx8",
+ "30.00.xx9",
+ "30.01.xx0.0"
+ ]
+ },
+ "MXXXXG1": {
+ "firmwares": [
+ "37.00.xx1",
+ "37.00.xx2",
+ "37.00.xx3",
+ "37.00.xx4.1"
+ ]
+ },
+ "LE910Cx-L": {
+ "firmwares": [
+ "25.20.xx8",
+ "25.20.xx9",
+ "25.21.xx0"
+ ]
+ },
+ "LE910Cx-X": {
+ "firmwares": [
+ "25.30.xx1",
+ "25.30.xx2"
+ ]
+ }
+ },
+ "groups": [
+ {
+ "name": "MAIN_UART",
+ "limitations": []
+ },
+ {
+ "name": "AUX_UART",
+ "limitations": [
+ "LE910Cx-L"
+ ]
+ },
+ {
+ "name": "USB0",
+ "limitations": []
+ }
+ ],
+ "platform": "GCC",
+ "license": "MIT",
+ "support": {
+ "email": "ts-emea@telit.com"
+ },
+ "authors": [
+ {
+ "name": "Roberta Galeazzo",
+ "email": "Roberta.Galeazzo@telit.com",
+ "homepage": "http://www.telit.com/",
+ "role": "Developer"
+ }
+ ],
+ "requires": {
+ "core/azx_log": "master",
+ "core/azx_utils": "master"
+ }
+}
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/src/M2MB_main.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/src/M2MB_main.c
new file mode 100755
index 00000000..de72e676
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/RTC/src/M2MB_main.c
@@ -0,0 +1,280 @@
+/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
+/* See LICENSE file in the project root for full license information. */
+
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ Sample application that shows RTC apis functionalities: how to get/set moudle system time and timestamp. Debug prints on USB0
+ @version
+ 1.0.0
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author
+ Roberta Galeazzo
+
+ @date
+ 11/10/2021
+*/
+
+/* Include files ================================================================================*/
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+
+#include "m2mb_os_api.h"
+#include "m2mb_net.h"
+#include "m2mb_rtc.h"
+#include "app_cfg.h"
+
+/* Local defines ================================================================================*/
+#define EV_NET_BIT (UINT32)0x1 /*0x0000000000000001*/
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+static M2MB_OS_EV_HANDLE net_evHandle = NULL;
+M2MB_NET_HANDLE hNet;
+
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+void NetCallback(M2MB_NET_HANDLE h, M2MB_NET_IND_E net_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
+{
+ (void)resp_size;
+ (void)myUserdata;
+
+ M2MB_NET_REG_STATUS_T *stat_info;
+
+ switch (net_event)
+ {
+
+ case M2MB_NET_GET_REG_STATUS_INFO_RESP:
+ stat_info = (M2MB_NET_REG_STATUS_T*)resp_struct;
+ if (stat_info->stat == 1 || stat_info->stat == 5)
+ {
+ AZX_LOG_INFO("Module is registered!\r\n");
+ m2mb_os_ev_set(net_evHandle, EV_NET_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ m2mb_net_get_reg_status_info(h); //call it again
+ }
+ break;
+
+
+ default:
+ AZX_LOG_TRACE("unexpected net_event: %d\r\n", net_event);
+ break;
+
+ }
+}
+
+
+/***************************************************************************************************
+ \User Entry Point of Appzone
+
+ \param [in] Module Id
+
+ \details Main of the appzone user
+**************************************************************************************************/
+void M2MB_main( int argc, char **argv )
+{
+(void)argc;
+(void)argv;
+M2MB_OS_RESULT_E osRes;
+M2MB_RESULT_E res;
+INT32 retVal;
+M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+UINT32 curEvBits;
+void *myUserdata = NULL;
+
+
+struct tm dateTime;
+time_t currTime;
+INT32 rtcfd;
+M2MB_RTC_TIME_T newTime;
+INT16 timeZone;
+
+
+
+ AZX_LOG_INIT();
+ azx_sleep_ms(5000);
+
+ AZX_LOG_INFO( "\r\n Start RTC demo application. This is v%s built on %s %s.\r\n",
+ VERSION, __DATE__, __TIME__);
+
+ osRes = m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL, M2MB_OS_EV_SEL_CMD_NAME, "net_pdp_ev"));
+ osRes = m2mb_os_ev_init( &net_evHandle, &evAttrHandle );
+ if ( osRes != M2MB_OS_SUCCESS )
+ {
+ m2mb_os_ev_setAttrItem( &evAttrHandle, M2MB_OS_EV_SEL_CMD_DEL_ATTR, NULL );
+ AZX_LOG_CRITICAL("m2mb_os_ev_init failed!\r\n");
+ return;
+ }
+ else
+ {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ res = m2mb_net_init(&hNet, NetCallback, myUserdata);
+ if ( res == M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_TRACE( "m2mb_net_init returned M2MB_RESULT_SUCCESS\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR( "m2mb_net_init did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ AZX_LOG_INFO("\r\nWaiting for registration...\r\n");
+
+ res = m2mb_net_get_reg_status_info(hNet);
+ if ( res != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_net_get_reg_status_info did not return M2MB_RESULT_SUCCESS\r\n" );
+ }
+
+ /*Wait for network registration event to occur (released in NetCallback function) */
+ m2mb_os_ev_get(net_evHandle, EV_NET_BIT, M2MB_OS_EV_GET_ANY_AND_CLEAR, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ rtcfd = m2mb_rtc_open("/dev/rtc0",0);
+ if (rtcfd != -1)
+ {
+ AZX_LOG_TRACE( "RTC opened\r\n");
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot open RTC!");
+ return;
+ }
+
+ /*
+ * Get time and date in timestamp and date/time format and print them
+ */
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+
+ }
+ else
+ {
+
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("Module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ if (newTime.tz != 255)
+ {
+ timeZone = newTime.tz;
+ }
+ else
+ {
+ timeZone = 0;
+ }
+
+ /*
+ * Get time and date in timestamp format, add one hour, convert it into date/time format, setthis new value
+ */
+ AZX_LOG_INFO("\r\nGet current time and add an hour\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &currTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("\r\nCurrent time in seconds from the epoch: %d\r\n", currTime);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get current time!");
+ return;
+ }
+
+ //Add 1 hour -> 3600 sec
+
+ currTime += 3600;
+ {
+ struct tm *tmp = localtime(&currTime);
+ if (tmp != NULL)
+ {
+ dateTime = *tmp;
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get local time!");
+ return;
+ }
+ }
+
+ AZX_LOG_TRACE("Current time converted: %d-%02d-%02d, %02d:%02d:%02d\r\n", dateTime.tm_year + 1900, dateTime.tm_mon + 1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min, dateTime.tm_sec);
+
+ newTime.hour = dateTime.tm_hour;
+ newTime.min = dateTime.tm_min;
+ newTime.sec = dateTime.tm_sec;
+ newTime.day = dateTime.tm_mday;
+ newTime.mon = dateTime.tm_mon + 1; //January is 0
+ newTime.year = dateTime.tm_year + 1900;
+ newTime.dlst = (UINT8)dateTime.tm_isdst;
+ newTime.tz = timeZone;
+
+ AZX_LOG_INFO("New time to be set: %d-%02d-%02d, %02d:%02d:%02d, tz:%d, dlst:%d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec, newTime.tz, newTime.dlst);
+
+
+ //set module system time
+ AZX_LOG_INFO("\r\nSet new time and check the setting\r\n");
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_SET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_TRACE("\r\nSet new system time done\r\n");
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot set new system time!");
+ return;
+ }
+
+ //check if value has changed
+ retVal = m2mb_rtc_ioctl(rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &newTime);
+ if(retVal == 0)
+ {
+ AZX_LOG_INFO("NEW module system time is: %d-%02d-%02d, %02d:%02d:%02d\r\n", newTime.year, newTime.mon, newTime.day, newTime.hour, newTime.min, newTime.sec);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot get module System time!");
+ return;
+ }
+
+ azx_sleep_ms(2000);
+
+ m2mb_rtc_close(rtcfd);
+}
+
+
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/Makefile.in b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/Makefile.in
index 27a30a77..a350b9a3 100755
--- a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/Makefile.in
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.1.10
+SW_VER = 1.1.13
CLEAN_BEFORE_BUILD = clean
diff --git a/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/azx/pdu_codec/azx_pduCommon.c b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
new file mode 100755
index 00000000..786e2684
--- /dev/null
+++ b/ME310G1-ME910G1-ML865G1/AppZoneSampleApps-USB0/SMS_PDU/azx/pdu_codec/azx_pduCommon.c
@@ -0,0 +1,1418 @@
+/*
+ * azx_common.c
+ *
+ * Created on: 17 set 2021
+ * Author: robertaga
+ */
+
+#include "azx_pduCommon.h"
+
+#include
+#include
+#include
+
+
+/*
+ Setting out_fmt variable, output can be represented in hex raw (if coding is 8-bit or UCS2) or utf8. Default is utf8.
+ Variable can be set/read runtime using function pdu_set_output_format/get_set_output_format
+ */
+
+static SMS_TXT_OUT_FMT_E out_fmt = UTF8_default;
+//SMS_TXT_OUT_FMT_E out_fmt = HEX_raw;
+
+u8 utf8_to_ucs2(u8 *in, u16 *out, u8 be){
+ u8 n = 0; u16 o;
+ if (in[0] < 0x80){ n = 1; o = in[0]; }
+ else if ((in[0] & 0xE0) == 0xE0){
+ if ((in[1] != 0) && (in[2] != 0)){
+ n = 3;
+ o = ((u16)(in[0] & 0x0F) << 12) | ((u16)(in[1] & 0x3F) << 6) | (in[2] & 0x3F);
+ }
+ } else if ((in[0] & 0xC0) == 0xC0){
+ if (in[1] != 0){
+ n = 2;
+ o = ((u16)(in[0] & 0x1F) << 6) | ((u16)(in[1] & 0x3F));
+ }
+ }
+ if (n){
+ if (be){
+ *((u8 *)out) = o >> 8;
+ *((u8 *)out + 1) = o;
+ } else {
+ *((u8 *)out) = o;
+ *((u8 *)out + 1) = o >> 8;
+ }
+ }
+ return n;
+}
+u16 s_utf8_to_ucs2(u8 *in, u16 in_len, u16 *out, u8 be){
+ if (in_len == 0) in_len = s_len(in,0);
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = utf8_to_ucs2(in, out, be);
+ if (n == 0) in_len = 0;
+ else {
+ in += n;
+ out++; out_len++;
+ in_len = (in_len >= n) ? (in_len - n) : 0;
+ }
+ }
+ return out_len;
+}
+
+
+u8 ucs2_to_utf8(u32 in, u8 *out){
+ u8 n = 0;
+ if (in < 0x80){
+ out[0] = in;
+ out[1] = 0;
+ n = 1;
+ }
+ else if ((in >= 0x80) && (in < 0x800)){
+ out[0] = (in >> 6) | 0xC0;
+ out[1] = (in & 0x3F) | 0x80;
+ out[2] = 0;
+ n = 2;
+ }
+ else if ((in >= 0x800) && (in < 0xFFFF)){
+ if (!((in >= 0xD800) && (in <= 0xDFFF))){
+ out[0] = (in >> 12) | 0xE0;
+ out[1] = ((in >> 6 ) & 0x3F) | 0x80;
+ out[2] = (in & 0x3F) | 0x80;
+ out[3] = 0;
+ n = 3;
+ }
+ }
+ else if ((in >= 0x10000) && (in < 0x10FFFF)){
+ out[0] = 0xF0 | (in >> 18);
+ out[1] = 0x80 | ((in >> 12) & 0x3F);
+ out[2] = 0x80 | ((in >> 6) & 0x3F);
+ out[3] = 0x80 | ((in & 0x3F));
+ out[4] = 0;
+ return 4;
+ }
+ return n;
+}
+u16 s_ucs2_to_utf8(u16 *in, u16 in_len, u8 *out, u8 be){
+ u16 out_len = 0;
+ while (in_len){
+ u8 n = ucs2_to_utf8(
+ (be) ? ((u16)(*(u8 *)in) << 8) | *(((u8 *)in) + 1) : ((u16)(*(u8 *)in)) | ((u16)(*(((u8 *)in) + 1)) << 8), out);
+ if (n == 0) in_len = 0;
+ else {
+ in++; in_len--;
+ out += n; out_len += n;
+ }
+ }
+ return out_len;
+}
+
+u16 s_len(u8 *s, u8 eol){
+ if (s == NULL) return 0;
+ u16 l = 0;
+ while (*s++ != eol) l++;
+ return l;
+}
+u8 s_lines(u8 *s, u16 len, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 n = 0;
+ while (len--) if (*s++ == eol) n++;
+ return n;
+}
+u8 *s_line_start(u8 *s, u16 len, u8 line, u8 eol){
+ if (len == 0) len = s_len(s, 0);
+ u8 l = 0;
+ while (len-- && (l < line))
+ if (*s++ == eol) l++;
+ return (len == 0) ? NULL : s;
+}
+u8 *s_skip_crlf(u8 *s){
+ while ((*s == '\r')||(*s == '\n')) s++;
+ return s;
+}
+
+u8 c_upcase(u8 c){ return ((c >= 'a')&&(c <= 'z')) ? (c - ('a' - 'A')) : c; }
+void s_upcase(u8 *s, u16 len){
+ if (len == 0) len = s_len(s, 0);
+ while (len--){
+ *s = c_upcase(*s);
+ s++;
+ }
+}
+
+u8 s_h2b4(u8 hex){ return ((hex >= '0')&&(hex <= '9')) ? (hex - '0') : ((hex >= 'a')&&(hex <= 'f')) ? (hex - ('a' - 10)) : ((hex >= 'A')&&(hex <= 'F')) ? (hex - ('A' - 10)) : 0; }
+u8 s_b2h4(u8 b){ return (b < 10) ? (b + '0') : (b < 16) ? (b + ('A'-10)) : '0'; }
+
+u8 s_cmp(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (*s1++ != *s2++) return 0;
+ return 1;
+}
+u8 s_cmp_upcase(u8 *s1, u8 *s2, u16 len){
+ while (len--) if (c_upcase(*s1++) != c_upcase(*s2++)) return 0;
+ return 1;
+}
+
+u8 s_starts(u8 *s, char *start){
+ while (*start != 0) if (*s++ != *start++) return 0;
+ return 1;
+}
+u8 s_ends(u8 *s, char *end){
+ u16 sl = s_len(s,0), el = s_len((u8 *)end,0);
+ if ((el > 0)&&(sl >= el)){
+ s += sl - 1; end += el - 1;
+ while (el--) if (*s-- != *end--) return 0;
+ return 1;
+ }
+ return 0;
+}
+
+u8 *s_cpos(u8 *s, u8 c, u8 eol){
+ while(*s != eol){
+ if (*s == c) return s;
+ s++;
+ }
+ return NULL;
+}
+
+u32 s_parse_dec(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((*s >= '0')&&(*s <= '9')&&(len--)) n = (n * 10uL) + s_h2b4( *s++ );
+ return n;
+}
+u32 s_parse_hex(u8 *s, u8 len){
+ u32 n = 0;
+ if (len == 0) len = 255;
+ while ((((*s >= '0')&&(*s <= '9'))||((*s >= 'a')&&(*s <= 'f'))||((*s >= 'A')&&(*s <= 'F')))&&(len--))
+ n = (n << 4) + s_h2b4( *s++ );
+ return n;
+}
+
+u8 s_is_7bit(u8 *s, u8 eol){
+ while (*s != eol) if (*s++ > 0x7F) return 0;
+ return 1;
+}
+
+u8 *s_copy(u8 *in, u8 eol, u8 *out){
+ if (in == out) return out;
+ while (*in != eol) *out++ = *in++;
+ *out = eol;
+ return out;
+}
+
+u8 *s_append_c (u8 *out, u8 c) { *out++ = c; *out = 0; return out; }
+u8 *s_append_s (u8 *out, char *in){ while (*in != 0) *out++ = *in++; *out = 0; return out; }
+u8 *s_append_h4 (u8 *out, u8 n) { *out++ = s_b2h4(n & 0xF); *out = 0; return out; }
+u8 *s_append_h8 (u8 *out, u8 n) { out = s_append_h4(out,n >> 4); out = s_append_h4(out,n); return out; }
+u8 *s_append_h16(u8 *out, u16 n) { out = s_append_h8(out,n >> 8); out = s_append_h8(out,n); return out; }
+u8 *s_append_h24(u8 *out, u32 n) { out = s_append_h8(out,n >> 16); out = s_append_h16(out,n); return out; }
+u8 *s_append_h32(u8 *out, u32 n) { out = s_append_h16(out,n >> 16); out = s_append_h16(out,n); return out; }
+
+#if 0
+u8 *s_append_u32(u8 *out, u32 n) {
+ if (n){
+ n = bin2bcd_u32(n, 4); u8 digs = 8;
+ while(((u8)(n >> 24) & 0xF0) == 0) { n <<= 4; digs--; }
+ while(digs--){
+ *out++ = s_b2h4(n >> 28);
+ n <<= 4;
+ }
+ } else *out++ = '0';
+ *out = 0;
+ return out;
+}
+
+
+u8 *s_append_s32(u8 *out, s32 n) {
+ if (n < 0){
+ out = s_append_c(out, '-');
+ n = -n;
+ }
+ return s_append_u32(out, n);
+}
+#endif
+
+void *memset2(void *dest, int val, size_t len) {
+ u8 *dest1 = (u8*) dest;
+ while (len--) *dest1++ = (u8)val;
+ return dest;
+}
+
+void *memcpy2(void *dest, const void *src, size_t len) {
+ u8 *dest1 = (u8 *) dest;
+ u8 *src1 = (u8 *)src;
+ while (len--) *dest1++ = *src1++;
+ return dest;
+}
+
+u8 divmod10_u32_rem;
+u32 divmod10_u32(u32 n) {
+ u32 quot = n >> 1;
+ quot += quot >> 1;
+ quot += quot >> 4;
+ quot += quot >> 8;
+ quot += quot >> 16;
+ u32 qq = quot & ~7ul;
+ quot >>= 3;
+ divmod10_u32_rem = n - ((quot << 1) + qq);
+ if (divmod10_u32_rem > 9) {
+ divmod10_u32_rem -= 10;
+ quot++;
+ }
+ return quot;
+}
+
+u8 asc_point = '.';
+u8 asc_space = ' ';
+u8 asc_minus = '-';
+
+u8 bcd2bin_u8( u8 bcd ){ return ( (bcd & 0xF) + (bcd >> 4) * 10 ); }
+
+u8 bin2bcd_u8( u8 bin ) {
+ u8 tens = 0;
+ while (bin > 9) { bin -= 10; tens++; }
+ return ( (tens << 4) + bin );
+}
+
+#ifdef __AVR__
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bin2bcd_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "mov __tmp_reg__, %[result_bytes] \n" // __tmp_reg__ = number of bytes of result
+
+ "bin2bcd_u32_00: \n" // correct input number by left shifts
+ "mov r31, %A[data] \n"
+ "mov %A[data], %B[data] \n"
+ "mov %B[data], %C[data] \n"
+ "mov %C[data], %D[data] \n"
+ "mov %D[data], r31 \n"
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_00 \n"
+
+ "eor r26, r26 \n" // result=0
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %[result_bytes] \n"
+ "lsl __tmp_reg__ \n" // __tmp_reg__ = size in bits
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bin2bcd_u32_01: \n" // bits shift and correction loop
+ "subi r26,-0x33 \n" // add 0x33
+ "sbrs r26, 3 \n" // if carry to bit 3,
+ "subi r26, 3 \n" // subtract 3
+ "sbrs r26, 7 \n" // if carry to bit 7,
+ "subi r26, 0x30 \n" // subtract 0x30
+ "subi r27,-0x33 \n" // add 0x33
+ "sbrs r27, 3 \n" // if carry to bit 3,
+ "subi r27, 3 \n" // subtract 3
+ "sbrs r27, 7 \n" // if carry to bit 7,
+ "subi r27, 0x30 \n" // subtract 0x30
+ "subi r30,-0x33 \n" // add 0x33
+ "sbrs r30, 3 \n" // if carry to bit 3,
+ "subi r30, 3 \n" // subtract 3
+ "sbrs r30, 7 \n" // if carry to bit 7,
+ "subi r30, 0x30 \n" // subtract 0x30
+ "subi r31,-0x33 \n" // add 0x33
+ "sbrs r31, 3 \n" // if carry to bit 3,
+ "subi r31, 3 \n" // subtract 3
+ "sbrs r31, 7 \n" // if carry to bit 7,
+ "subi r31, 0x30 \n" // subtract 0x30
+ "lsl r26 \n" // shift result number
+ "rol r27 \n"
+ "rol r30 \n"
+ "rol r31 \n"
+
+ "sbrc %D[data], 7 \n" // skip if msbit of input == 0
+ "ori r26, 1 \n" // set lsb of output
+ "lsl %A[data] \n" // shift input number
+ "rol %B[data] \n"
+ "rol %C[data] \n"
+ "rol %D[data] \n"
+
+ "dec __tmp_reg__ \n"
+ "brne bin2bcd_u32_01 \n" // repeat for all bits
+
+ //"mov %A[result], r26 \n" // move to result
+ //"mov %B[result], r27 \n"
+ //"mov %C[result], r30 \n"
+ //"mov %D[result], r31 \n"
+
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result) // output
+ :[data]"r"(data),[result_bytes]"r"(result_bytes) // input
+ :"r26","r27","r30","r31" // clobbers
+ );
+ return result;
+}
+#endif
+
+u32 bin2bcd_u32_shift(u32 data, u8 result_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bytes=(4 - result_bytes); cnt_bytes; cnt_bytes--) /* adjust input bytes */
+ data <<= 8;
+ for (u8 cnt_bits=(result_bytes << 3); cnt_bits; cnt_bits--) { /* bits shift loop */
+ /*result BCD nibbles correction*/
+ result += 0x33333333;
+ /*result correction loop*/
+ for (u8 cnt_bytes=4; cnt_bytes; cnt_bytes--) {
+ u8 corr_byte = result >> 24;
+ if (!(corr_byte & 0x08)) corr_byte -= 0x03;
+ if (!(corr_byte & 0x80)) corr_byte -= 0x30;
+ result <<= 8; /*shift result*/
+ result += corr_byte; /*set 8 bits of result*/
+ }
+ /*shift next bit of input to result*/
+ result <<= 1;
+ if (((u8)(data >> 24)) & 0x80)
+ result |= 1;
+ data <<= 1;
+ }
+ return(result);
+}
+
+u32 bin2bcd_u32_hwdiv(u32 data, u8 result_bytes) {
+ u32 result = 0;
+ result_bytes = 0;
+ while (data > 0) {
+ result += (data % 10) << result_bytes;
+ data /= 10;
+ result_bytes += 4;
+ }
+ return result;
+}
+
+u32 bin2bcd_u32_ldiv(u32 value, u8 nbytes) {
+ static ldiv_t bin2bcd_ldiv_result;
+ bin2bcd_ldiv_result.quot = value;
+ u32 result = 0;
+ nbytes = 0;
+ while (bin2bcd_ldiv_result.quot > 0) {
+ bin2bcd_ldiv_result = ldiv(bin2bcd_ldiv_result.quot, 10);
+ result += bin2bcd_ldiv_result.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+struct divmod10_t {
+ uint32_t quot;
+ uint8_t rem;
+} divmodu10_res;
+inline static void divmodu10(u32 n) {
+ divmodu10_res.quot = n >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 1;
+ divmodu10_res.quot += divmodu10_res.quot >> 4;
+ divmodu10_res.quot += divmodu10_res.quot >> 8;
+ divmodu10_res.quot += divmodu10_res.quot >> 16;
+ u32 qq = divmodu10_res.quot & ~7ul;
+ divmodu10_res.quot >>= 3;
+ divmodu10_res.rem = n - ((divmodu10_res.quot << 1) + qq);
+ if (divmodu10_res.rem > 9) {
+ divmodu10_res.rem -= 10;
+ divmodu10_res.quot++;
+ }
+}
+u32 bin2bcd_u32_fdiv(u32 value, u8 nbytes) {
+ u32 result = 0; nbytes = 0;
+ divmodu10_res.quot = value;
+ while (divmodu10_res.quot != 0) {
+ divmodu10(divmodu10_res.quot);
+ result += divmodu10_res.rem << nbytes;
+ nbytes += 4;
+ }
+ return result;
+}
+
+#ifdef __AVR__
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) __attribute__((naked)) __attribute__((noinline));
+u32 bcd2bin_u32_avr(u32 data, u8 result_bytes) {
+ u32 result;
+ asm volatile (
+ "push __tmp_reg__ \n"
+ "eor r26, r26 \n" /* result = 0 */
+ "eor r27, r27 \n"
+ "eor r30, r30 \n"
+ "eor r31, r31 \n"
+ "mov __tmp_reg__, %A[result_bytes] \n" /* __tmp_reg__ = size in bits of input parameter */
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+ "lsl __tmp_reg__ \n"
+
+ "bcd2bin_u32_00: \n" /* bits shift and correction loop */
+ "lsr r31 \n" /* shift out buffer */
+ "ror r30 \n"
+ "ror r27 \n"
+ "ror r26 \n"
+
+ "sbrc %A[data], 0 \n" /* move lowest bit to result */
+ "ori r31, 0x80 \n"
+
+ "lsr %D[data] \n"
+ "ror %C[data] \n"
+ "ror %B[data] \n"
+ "ror %A[data] \n"
+
+ "sbrc %D[data], 7 \n" /* if carry to bit 7, */
+ "subi %D[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %D[data], 3 \n" /* if carry to bit 3, */
+ "subi %D[data], 3 \n" /* subtract 3 */
+ "sbrc %C[data], 7 \n" /* if carry to bit 7, */
+
+ "subi %C[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %C[data], 3 \n" /* if carry to bit 3, */
+ "subi %C[data], 3 \n" /* subtract 0x30 */
+ "sbrc %B[data], 7 \n" /* if carry to bit 7, */
+ "subi %B[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %B[data], 3 \n" /* if carry to bit 3, */
+ "subi %B[data], 3 \n" /* subtract 3 */
+ "sbrc %A[data], 7 \n" /* if carry to bit 7, */
+ "subi %A[data], 0x30 \n" /* subtract 0x30 */
+ "sbrc %A[data], 3 \n" /* if carry to bit 3, */
+ "subi %A[data], 3 \n" /* subtract 3 */
+
+ "dec __tmp_reg__ \n" /* repeat for all bits */
+ "brne bcd2bin_u32_00 \n"
+
+ // "movw %A[result], r26 \n" /* adjust result */
+ // "movw %C[result], r30 \n"
+ "mov r22, r26 \n" // move to result
+ "mov r23, r27 \n"
+ "mov r24, r30 \n"
+ "mov r25, r31 \n"
+
+ "bcd2bin_u32_01: \n"
+ "mov __tmp_reg__,r25 \n"
+ "mov r25,r24 \n"
+ "mov r24,r23 \n"
+ "mov r23,r22 \n"
+ "mov r22,__tmp_reg__ \n"
+ "dec %[result_bytes] \n"
+ "brne bcd2bin_u32_01 \n"
+
+ "pop __tmp_reg__ \n"
+ "ret \n"
+ :[result]"=r"(result):[data]"r"(data),[result_bytes]"r"(result_bytes):"r0","r26","r27","r30","r31" /*input and output parameters*/
+ );
+ return result;
+}
+#endif
+
+u32 bcd2bin_u32_soft(u32 data, u8 input_bytes) {
+ u32 result = 0; /*result*/
+ for (u8 cnt_bits = (input_bytes << 3); cnt_bits; cnt_bits--) {
+ /*shift next bit*/
+ result >>= 1;
+ if (((u8)(data)) & (u8)0x01) result |= 0x80000000;
+ data >>= 1;
+ /* result BCD correction */
+ for (u8 cnt_bytes = 4; cnt_bytes; cnt_bytes--) {
+ u8 tmp_byte = (data >> 24);
+ if (tmp_byte & 0x80) tmp_byte -= 0x30;
+ if (tmp_byte & 0x08) tmp_byte -= 0x03;
+ data <<= 8;
+ data |= tmp_byte;
+ }
+ }
+ /*adjust result bytes*/
+ for (u8 cnt_bits = (4 - input_bytes); cnt_bits; cnt_bits--)
+ result >>= 8;
+ return(result);
+}
+
+u8 asc2bin_u8(u8 data) {
+ if ((data >= '0') && (data <= '9')) data -= '0';
+ else if ((data >= 'a') && (data <= 'f')) data -= ('a' - 0xa);
+ else if ((data >= 'A') && (data <= 'F')) data -= ('A' - 0xa);
+ else data = 0xf0;
+ return(data);
+}
+
+u8 bin2asc_u8(u8 data) {
+ data &= 0xf;
+ return (data > 9) ? (data + 'A' - 10) : (data + '0');
+}
+
+u32 asc2bin_u32(u8 *buf, s8 size) {
+ u32 result;
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ result = 0;
+ while(size) {
+ u8 tmp_u8 = asc2bin_u8(*buf);
+ if (tmp_u8 <= 0xf) { /*skip non-HEX symbols*/
+ result <<= 4;
+ result |= tmp_u8;
+ }
+ size--;
+ if (flag_negative) buf--;
+ else buf++; /*go to next symbol*/
+ }
+ return(result);
+}
+
+void bin2asc_u32(u32 data, u8 *buf, s8 size) {
+ u8 flag_negative;
+ if (size < 0) {
+ flag_negative = 1;
+ size = -size;
+ } else
+ flag_negative = 0;
+ while (size) {
+ *buf = bin2asc_u8(data);
+ data >>= 4;
+ if (flag_negative) buf--;
+ else buf++;
+ size--;
+ if (data == 0) size = 0; /*stop conversion on zero*/
+ }
+}
+
+void num2asc_s32(s32 data, u8 *buf, u8 flags) {
+ u8 cnt_chars = (flags & 7); //number of digits
+ //convert negative to positive, set '-' flag
+ if (data < 0) {data = -data; flags |= 1;}
+ else flags &= ~1;
+ //if necessary, convert to BCD
+ //if (flags & 0x80) data = bin2bcd_u32_soft(data, (cnt_chars >> 1) + 1); //AlbertoLe: function not present
+ cnt_chars++;
+ //calculate point position
+ u8 point_pos = cnt_chars - ((flags >> 4) & 7);
+ if (point_pos) point_pos++;
+ flags |= 2;
+ while (cnt_chars) { //digits conversion loop
+ if ((flags & 8) && (data == 0) && (cnt_chars < point_pos)) {
+ if (flags & 1) *buf = asc_minus;
+ else if (flags & 2) *buf = '0';
+ else *buf = asc_space;
+ flags &= ~1;
+ } else {
+ //show point
+ if ((cnt_chars == point_pos) && (flags & 0x70)) {
+ *buf-- = asc_point;
+ cnt_chars--;
+ }
+ *buf = bin2asc_u8(data); //show ASCII digit
+ }
+ cnt_chars--;
+ buf--;
+ data >>= 4;
+ flags &= ~2;
+ }
+ if (flags & 1) *buf = asc_minus;
+}
+
+uint8_t pdu_corr_sym_unpack_dcs7(char *Str, uint8_t len)
+{
+ uint8_t len_msg = 0;
+ uint8_t i = 0;
+ uint8_t check = 160;
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x00)
+ Str[j] = '@';
+
+ for(uint8_t j = 0; j < len; j++)
+ if(Str[j] == 0x11)
+ Str[j] = '_';
+
+ while((i < len) && (check--))
+ {
+ if(*Str == 0x1B)
+ {
+ // |
+ if(*(uint16_t*)Str == 0x401B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '|';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // "\"
+ if(*(uint16_t*)Str == 0x2F1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '\\';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ^
+ if(*(uint16_t*)Str == 0x141B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '^';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // [
+ if(*(uint16_t*)Str == 0x3C1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '[';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ]
+ if(*(uint16_t*)Str == 0x3E1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = ']';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // {
+ if(*(uint16_t*)Str == 0x281B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '{';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // }
+ if(*(uint16_t*)Str == 0x291B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '}';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // ~
+ if(*(uint16_t*)Str == 0x3D1B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '~';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+
+ // euro
+ if(*(uint16_t*)Str == 0x651B)
+ {
+ char BuffEnd[161];
+ char *a = Str + 2;
+ strcpy(&BuffEnd[0], a);
+ *Str = '?';
+ Str++;
+ *Str = 0;
+ strcat(Str, &BuffEnd[0]);
+ i+=2;
+ len_msg++;
+ }
+ }
+ else
+ {
+ i++;
+ len_msg++;
+ Str++;
+ }
+ }
+
+ return len_msg;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_7to8(uint8_t *a, uint8_t len)
+{
+ //'123456789abc' -> 31 D9 8C 56 B3 DD 70 B9 B0 78 OC
+ //'hellohello' -> E8 32 9B FD 46 97 D9 EC 37
+ //'Hello!' -> C8 32 9B FD 0E 01
+ if (len == 0)
+ len = s_len(a,0);
+
+ a[len] = 0;
+ len++;
+
+ // Correct symbol @
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '@')
+ a[j] = 0x00;
+
+ // Correct symbol _
+ for(uint8_t j = 0; j < len; j++)
+ if(a[j] == '_')
+ a[j] = 0x11;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len-2); i1++)
+ {
+ for (uint8_t i2=(len-1); i2>i1; i2--)
+ {
+ a[i2-1] = a[i2-1] | ((a[i2] & 1) ? 0x80 : 0);
+ a[i2] >>= 1;
+ }
+ }
+ }
+
+ len--;
+
+ return len - (len >> 3);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t pdu_8to7(uint8_t *a, uint8_t len)
+{
+ uint8_t len1 = len + (len >> 3);
+
+ while (len < len1)
+ a[len++] = 0;
+
+ if (len > 0)
+ {
+ for (uint8_t i1=0; i1<(len1-1); i1++)
+ for (uint8_t i2=(len1-1); i2>i1; i2--)
+ a[i2] = (a[i2] << 1) | !!(a[i2-1] & 0x80);
+ }
+
+ for (uint8_t i=0; i= n) ? (in_len - n) : 0;
+// }
+// }
+// return out_len;
+//}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint8_t swap8 (uint8_t b)
+{
+ return (b << 4)|(b >> 4);
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+uint16_t swap16(uint16_t w)
+{
+ return (w << 8)|(w >> 8);
+}
+#include
+#define M2M_LOG_INFO(a...) ({ printf(a); fflush(stdout); })
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_hex2bytes(uint8_t *h, uint16_t len, uint8_t *b)
+{
+ if (len == 0)
+ return;
+
+ len >>= 1;
+
+ while (len--)
+ {
+ *b++ = (s_h2b4(*h) << 4) | s_h2b4(*(h+1));
+ h += 2;
+ }
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_bytes2hex(uint8_t *b, uint16_t len, uint8_t *h)
+{
+ if (len == 0)
+ return;
+
+ b += len-1; h += ((uint16_t)len << 1) - 1;
+ while (len--)
+ {
+ *h-- = s_b2h4(*b & 0xF);
+ *h-- = s_b2h4(*b-- >> 4);
+ }
+}
+
+
+uint8_t convert_binary_coded_to_decimal(uint8_t hex)
+{
+ uint8_t dec = ((hex & 0xf0) >> 4) * 10 + (hex & 0x0f);
+ return dec;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+/*DCS decoding function*/
+dcs_struct pdu_decode_dcs(uint8_t tp_dcs)
+{
+ dcs_struct sm_dcs;
+ uint8_t alpha_byte, class_byte;
+
+ if ( ( (tp_dcs & 0xc0) == 0)) /* coding group: 00xx */
+ {
+ if ( tp_dcs & 0x20 )
+ sm_dcs.smCompressed = 1; /* compressed */
+ else
+ sm_dcs.smCompressed = 0;
+
+
+ alpha_byte = ( tp_dcs & 0x0c ) >> 2; /* alphabet */
+ if ( alpha_byte == 0 )
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ else if ( alpha_byte == 1 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else if ( alpha_byte == 2 )
+ sm_dcs.smAlphabet = PDU_DCS_UCS2;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_AUTO;
+
+ if ( tp_dcs & 0x10 ) /* bit 1 and 0 have class meaning */
+ {
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ }
+ else
+ sm_dcs.smClass = noClass;
+
+ } else if ( (tp_dcs >> 4) == 0x0f ){ /* coding group: 1111 */
+ sm_dcs.smCompressed = 0;
+
+ if ( tp_dcs & 0x04 )
+ sm_dcs.smAlphabet = PDU_DCS_8;
+ else
+ sm_dcs.smAlphabet = PDU_DCS_7;
+
+ class_byte = ( tp_dcs & 0x03 );
+ if ( class_byte == 0 )
+ sm_dcs.smClass = class0;
+ else if ( class_byte == 1 )
+ sm_dcs.smClass = class1;
+ else if ( class_byte == 2 )
+ sm_dcs.smClass = class2;
+ else /* if ( class_byte == 3 ) */
+ sm_dcs.smClass = class3;
+ } else {/* reserved codings groups: assume 7 bit, uncompressed, class 2 */
+
+ sm_dcs.smCompressed = 0;
+ sm_dcs.smAlphabet = PDU_DCS_7;
+ sm_dcs.smClass = class2;
+ }
+ return sm_dcs;
+}
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode_binary(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ int8_t tz_sign = 1;
+ dcs_struct sm_dcs; /*Added dcs decoding in alphabet, class and compressed*/
+
+ if (len == 0)
+ len = s_len(in, 0);
+
+ len >>= 1;
+
+ out->smsc.len = in[0];
+ out->smsc.bytes = out->smsc.len - 1;
+
+ if (in[0] == 7)
+ {
+ out->smsc.type = in[1];
+ for (uint8_t i=0; i<(out->smsc.bytes); i++)
+ out->smsc.data[i] = in[i+2];
+ }
+
+ in += out->smsc.len + 1;
+
+ out->first = *in++;
+ out->sender.len = *in++;
+ out->sender.bytes = (out->sender.len + (out->sender.len & 1)) >> 1;
+ out->sender.type = *in++;
+ for (uint8_t i=0; i<((out->sender.len + (out->sender.len & 1)) >> 1); i++)
+ out->sender.data[i] = *in++;
+
+ out->tp_pid = *in++;
+ out->tp_dcs = *in++;
+
+ out->year = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->month = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->date = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->hour = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->min = convert_binary_coded_to_decimal( swap8( *in++ ));
+ out->sec = convert_binary_coded_to_decimal( swap8( *in++ ));
+ //*in = 0x4a;
+ out->tz = swap8( *in++ );
+
+ if ((out->tz & 0x80) == 0x80)
+ {
+ tz_sign = -1;
+ }
+
+ out->tz = tz_sign * convert_binary_coded_to_decimal((out->tz & 0x7F));
+
+ out->msg.len = out->msg.bytes = *in++;
+
+ // correction for 7-bit encoding
+
+ /*Now dcs has been correctly decoded*/
+ sm_dcs = pdu_decode_dcs(out->tp_dcs);
+ out->tp_dcs = sm_dcs.smAlphabet;
+ /**/
+ if (out->tp_dcs == PDU_DCS_7)
+ out->msg.bytes -= (out->msg.bytes >> 3);
+ // decode message text (if output buffer is given)
+ out->msg.data = in;
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+void pdu_in_decode(uint8_t *in, uint16_t len, pdu_struct *out)
+{
+ pdu_hex2bytes(in, len, in);
+ pdu_in_decode_binary(in, len, out);
+}
+
+
+/*******************************************************************************
+ * *
+ *******************************************************************************/
+#if 1
+uint16_t pdu_in_decode_text(uint8_t *in, uint16_t in_bytes, uint8_t in_dcs, uint8_t *out)
+{
+ if (in_dcs == PDU_DCS_UCS2)
+ {
+ if (pdu_get_output_format() == UTF8_default) {
+ in_bytes = s_ucs2_to_utf8( (uint16_t *)in, in_bytes >> 1, out, 1 );
+ out += in_bytes;
+ } else if(pdu_get_output_format() == HEX_raw) {
+ uint16_t i, j;
+ uint8_t tmpByte;
+
+ j = 0;
+
+ for ( i = 0; i < in_bytes; i++ )
+ {
+
+ tmpByte = ( in[i] & 0x00FF );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0xF0 ) >> 4 );
+ out[j++] = pdu_hex_to_ascii_format( ( tmpByte & 0x0F ) );
+
+ }
+
+ in_bytes = j;
+ out += in_bytes;
+ }
+
+ }
+ else
+ {
+ if (in_dcs == PDU_DCS_7)
+ {
+ in_bytes += in_bytes >> 3;
+ pdu_8to7(in, in_bytes);
+ for (uint8_t i=0; i