diff --git a/Samples/AZX_Docs/html/annotated.html b/Samples/AZX_Docs/html/annotated.html
index d53265f..3658861 100644
--- a/Samples/AZX_Docs/html/annotated.html
+++ b/Samples/AZX_Docs/html/annotated.html
@@ -34,7 +34,7 @@
diff --git a/Samples/AZX_Docs/html/azx__tasks_8h.html b/Samples/AZX_Docs/html/azx__tasks_8h.html
index 3d8e576..2da5265 100644
--- a/Samples/AZX_Docs/html/azx__tasks_8h.html
+++ b/Samples/AZX_Docs/html/azx__tasks_8h.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/azx__tasks_8h_source.html b/Samples/AZX_Docs/html/azx__tasks_8h_source.html
index 2e7afa3..8a6c162 100644
--- a/Samples/AZX_Docs/html/azx__tasks_8h_source.html
+++ b/Samples/AZX_Docs/html/azx__tasks_8h_source.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/azx__utils_8h.html b/Samples/AZX_Docs/html/azx__utils_8h.html
index 2839186..a19a3b5 100644
--- a/Samples/AZX_Docs/html/azx__utils_8h.html
+++ b/Samples/AZX_Docs/html/azx__utils_8h.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
@@ -143,7 +143,7 @@
Various helpful utilities.
-
- Version
- 1.0.2
+
- Version
- 1.0.3
- Dependencies
- core/azx_log
- Author
- Ioannis Demetriou
-
diff --git a/Samples/AZX_Docs/html/azx__utils_8h_source.html b/Samples/AZX_Docs/html/azx__utils_8h_source.html
index d6e7393..4f1c49e 100644
--- a/Samples/AZX_Docs/html/azx__utils_8h_source.html
+++ b/Samples/AZX_Docs/html/azx__utils_8h_source.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/azx_tasks_example_8c-example.html b/Samples/AZX_Docs/html/azx_tasks_example_8c-example.html
index 7e3831e..5c6ccac 100644
--- a/Samples/AZX_Docs/html/azx_tasks_example_8c-example.html
+++ b/Samples/AZX_Docs/html/azx_tasks_example_8c-example.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/classes.html b/Samples/AZX_Docs/html/classes.html
index b7eed60..d3230c0 100644
--- a/Samples/AZX_Docs/html/classes.html
+++ b/Samples/AZX_Docs/html/classes.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html b/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
index 192a741..af35b1b 100644
--- a/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
+++ b/Samples/AZX_Docs/html/dir_0045f852bf8045b6d5abd9c9eb54a446.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/examples.html b/Samples/AZX_Docs/html/examples.html
index 4a1e03a..02bd4c5 100644
--- a/Samples/AZX_Docs/html/examples.html
+++ b/Samples/AZX_Docs/html/examples.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/files.html b/Samples/AZX_Docs/html/files.html
index 71b07d0..13767a3 100644
--- a/Samples/AZX_Docs/html/files.html
+++ b/Samples/AZX_Docs/html/files.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/functions.html b/Samples/AZX_Docs/html/functions.html
index a66ea2f..aed5d79 100644
--- a/Samples/AZX_Docs/html/functions.html
+++ b/Samples/AZX_Docs/html/functions.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/functions_vars.html b/Samples/AZX_Docs/html/functions_vars.html
index 21f1103..a9338ba 100644
--- a/Samples/AZX_Docs/html/functions_vars.html
+++ b/Samples/AZX_Docs/html/functions_vars.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals.html b/Samples/AZX_Docs/html/globals.html
index 2da3fd2..0852d95 100644
--- a/Samples/AZX_Docs/html/globals.html
+++ b/Samples/AZX_Docs/html/globals.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
@@ -172,6 +172,9 @@ - a -
- AZX_LOG_TO_USB1
: azx_log.h
+- AZX_LOG_UNEXPECTED_CHANNEL
+: azx_log.h
+
- AZX_LOG_USB_CABLE_UNPLUGGED
: azx_log.h
diff --git a/Samples/AZX_Docs/html/globals_defs.html b/Samples/AZX_Docs/html/globals_defs.html
index 19f002c..87aee88 100644
--- a/Samples/AZX_Docs/html/globals_defs.html
+++ b/Samples/AZX_Docs/html/globals_defs.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_enum.html b/Samples/AZX_Docs/html/globals_enum.html
index 75abeb3..04f699c 100644
--- a/Samples/AZX_Docs/html/globals_enum.html
+++ b/Samples/AZX_Docs/html/globals_enum.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_eval.html b/Samples/AZX_Docs/html/globals_eval.html
index 41a7567..0f6d162 100644
--- a/Samples/AZX_Docs/html/globals_eval.html
+++ b/Samples/AZX_Docs/html/globals_eval.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
@@ -136,6 +136,9 @@ - a -
- AZX_LOG_TO_USB1
: azx_log.h
+- AZX_LOG_UNEXPECTED_CHANNEL
+: azx_log.h
+
- AZX_LOG_USB_CABLE_UNPLUGGED
: azx_log.h
diff --git a/Samples/AZX_Docs/html/globals_func.html b/Samples/AZX_Docs/html/globals_func.html
index 309d4a1..845c63a 100644
--- a/Samples/AZX_Docs/html/globals_func.html
+++ b/Samples/AZX_Docs/html/globals_func.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/globals_type.html b/Samples/AZX_Docs/html/globals_type.html
index 3552822..d24b2a9 100644
--- a/Samples/AZX_Docs/html/globals_type.html
+++ b/Samples/AZX_Docs/html/globals_type.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/graph_legend.html b/Samples/AZX_Docs/html/graph_legend.html
index bd5f9e2..82eba7e 100644
--- a/Samples/AZX_Docs/html/graph_legend.html
+++ b/Samples/AZX_Docs/html/graph_legend.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/group__log_conf.html b/Samples/AZX_Docs/html/group__log_conf.html
index 684517d..6322faf 100644
--- a/Samples/AZX_Docs/html/group__log_conf.html
+++ b/Samples/AZX_Docs/html/group__log_conf.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/group__log_usage.html b/Samples/AZX_Docs/html/group__log_usage.html
index 4f2acc9..2727ba4 100644
--- a/Samples/AZX_Docs/html/group__log_usage.html
+++ b/Samples/AZX_Docs/html/group__log_usage.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
@@ -109,7 +109,8 @@
AZX_LOG_NO_USB_INSTANCE_AVAILABLE,
AZX_LOG_CANNOT_OPEN_USB_CHANNEL,
- AZX_LOG_MAX_ERROR_LEN
+ AZX_LOG_UNEXPECTED_CHANNEL,
+AZX_LOG_MAX_ERROR_LEN
}
| Logging errors. More...
|
@@ -140,6 +141,8 @@ AZX_LOG_CANNOT_OPEN_USB_CHANNEL Cannot open the specified USB channel
|
+AZX_LOG_UNEXPECTED_CHANNEL | Cannot open the specified channel, out of range
+ |
diff --git a/Samples/AZX_Docs/html/group__log_usage.js b/Samples/AZX_Docs/html/group__log_usage.js
index e556631..5814840 100644
--- a/Samples/AZX_Docs/html/group__log_usage.js
+++ b/Samples/AZX_Docs/html/group__log_usage.js
@@ -4,6 +4,7 @@ var group__log_usage =
[ "AZX_LOG_NOT_INIT", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12", null ],
[ "AZX_LOG_USB_CABLE_UNPLUGGED", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b", null ],
[ "AZX_LOG_NO_USB_INSTANCE_AVAILABLE", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0", null ],
- [ "AZX_LOG_CANNOT_OPEN_USB_CHANNEL", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c", null ]
+ [ "AZX_LOG_CANNOT_OPEN_USB_CHANNEL", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c", null ],
+ [ "AZX_LOG_UNEXPECTED_CHANNEL", "group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7", null ]
] ]
];
\ No newline at end of file
diff --git a/Samples/AZX_Docs/html/group__task_usage.html b/Samples/AZX_Docs/html/group__task_usage.html
index db062ae..c8a18d0 100644
--- a/Samples/AZX_Docs/html/group__task_usage.html
+++ b/Samples/AZX_Docs/html/group__task_usage.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/index.html b/Samples/AZX_Docs/html/index.html
index cff79cc..f46517d 100644
--- a/Samples/AZX_Docs/html/index.html
+++ b/Samples/AZX_Docs/html/index.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/modules.html b/Samples/AZX_Docs/html/modules.html
index 3279701..04505e5 100644
--- a/Samples/AZX_Docs/html/modules.html
+++ b/Samples/AZX_Docs/html/modules.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/navtreeindex0.js b/Samples/AZX_Docs/html/navtreeindex0.js
index be83378..66f25d0 100644
--- a/Samples/AZX_Docs/html/navtreeindex0.js
+++ b/Samples/AZX_Docs/html/navtreeindex0.js
@@ -45,8 +45,8 @@ var NAVTREEINDEX0 =
"globals_func.html":[3,1,1],
"globals_type.html":[3,1,2],
"group__log_conf.html":[1,0],
-"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[3,0,0,1,10],
"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[1,0,0],
+"group__log_conf.html#ga03b618927cb5d884386832ab76781760":[3,0,0,1,10],
"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[1,0,2],
"group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af":[3,0,0,1,16],
"group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5":[1,0,1],
@@ -57,13 +57,13 @@ var NAVTREEINDEX0 =
"group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841":[3,0,0,1,10,2],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3":[3,0,0,1,10,0],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3":[1,0,0,0],
-"group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286":[3,0,0,1,10,3],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286":[1,0,0,3],
+"group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286":[3,0,0,1,10,3],
"group__log_conf.html#gga03b618927cb5d884386832ab76781760acd8c06c121bab2a0f3aede4b76afde39":[3,0,0,1,10,4],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[3,0,0,1,11,3],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8":[1,0,1,3],
-"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[3,0,0,1,11,2],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[1,0,1,2],
+"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25":[3,0,0,1,11,2],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[1,0,1,5],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c":[3,0,0,1,11,5],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4":[1,0,1,6],
@@ -75,17 +75,19 @@ var NAVTREEINDEX0 =
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[1,0,1,0],
"group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497":[3,0,0,1,11,0],
"group__log_usage.html":[1,1],
-"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[1,1,0],
"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[3,0,0,1,9],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[1,1,0,0],
+"group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0":[1,1,0],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[3,0,0,1,9,0],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a19881bc82e9c47a02c88b541c58a04c8":[3,0,0,1,9,4],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12":[1,1,0,0],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a19881bc82e9c47a02c88b541c58a04c8":[3,0,0,1,9,5],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7":[3,0,0,1,9,4],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7":[1,1,0,4],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c":[1,1,0,3],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c":[3,0,0,1,9,3],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b":[1,1,0,1],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b":[3,0,0,1,9,1],
-"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[3,0,0,1,9,2],
"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[1,1,0,2],
+"group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0":[3,0,0,1,9,2],
"group__task_usage.html":[1,2],
"group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac":[3,0,0,2,11],
"group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac":[1,2,12],
@@ -111,34 +113,34 @@ var NAVTREEINDEX0 =
"group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196":[1,2,4],
"group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6":[1,2,17],
"group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6":[3,0,0,2,16],
-"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[1,2,3],
"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[3,0,0,2,2],
-"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[1,2,2],
+"group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94":[1,2,3],
"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[3,0,0,2,1],
+"group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da":[1,2,2],
"group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623":[1,2,16],
"group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623":[3,0,0,2,15],
"group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd":[3,0,0,2,8],
"group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd":[1,2,9],
-"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[1,2,14],
"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[3,0,0,2,13],
-"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[3,0,0,2,4],
+"group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c":[1,2,14],
"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[1,2,5],
+"group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e":[3,0,0,2,4],
"group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416":[3,0,0,2,9],
"group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416":[1,2,10],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[3,0,0,2,11,0],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[1,2,12,0],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e":[3,0,0,2,11,0],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf":[3,0,0,2,11,3],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf":[1,2,12,3],
-"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[3,0,0,2,11,2],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[1,2,12,2],
+"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1":[3,0,0,2,11,2],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9":[3,0,0,2,11,1],
"group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9":[1,2,12,1],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998":[3,0,0,2,12,3],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998":[1,2,13,3],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[3,0,0,2,12,1],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[1,2,13,1],
-"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[1,2,13,0],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a":[3,0,0,2,12,1],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[3,0,0,2,12,0],
+"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2":[1,2,13,0],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837":[3,0,0,2,12,2],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837":[1,2,13,2],
"group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa":[3,0,0,2,12,4],
@@ -151,26 +153,26 @@ var NAVTREEINDEX0 =
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d":[3,0,0,2,10,3],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b":[3,0,0,2,10,11],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b":[1,2,11,11],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[1,2,11,9],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[3,0,0,2,10,9],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e":[1,2,11,9],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457":[3,0,0,2,10,10],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457":[1,2,11,10],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[3,0,0,2,10,2],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[1,2,11,2],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[1,2,11,4],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836":[3,0,0,2,10,2],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[3,0,0,2,10,4],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[3,0,0,2,10,5],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b":[1,2,11,4],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[1,2,11,5],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[1,2,11,7],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f":[3,0,0,2,10,5],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[3,0,0,2,10,7],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7":[1,2,11,7],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e":[3,0,0,2,10,8],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e":[1,2,11,8],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[3,0,0,2,10,13],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[1,2,11,13],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b":[3,0,0,2,10,13],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c":[3,0,0,2,10,0],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c":[1,2,11,0],
-"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[1,2,11,12],
"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[3,0,0,2,10,12],
+"group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10":[1,2,11,12],
"index.html":[0],
"index.html":[],
"modules.html":[1],
diff --git a/Samples/AZX_Docs/html/search/all_0.js b/Samples/AZX_Docs/html/search/all_0.js
index c93f4aa..6c6c3b1 100644
--- a/Samples/AZX_Docs/html/search/all_0.js
+++ b/Samples/AZX_Docs/html/search/all_0.js
@@ -28,53 +28,54 @@ var searchData=
['azx_5flog_5fto_5fmain_5fuart_25',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
['azx_5flog_5fto_5fusb0_26',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
['azx_5flog_5fto_5fusb1_27',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
- ['azx_5flog_5fusb_5fcable_5funplugged_28',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
- ['azx_5freboot_5fnow_29',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
- ['azx_5fshutdown_5fnow_30',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
- ['azx_5fsleep_5fms_31',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
- ['azx_5ftasks_2eh_32',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
- ['azx_5ftasks_5falloc_5ferr_33',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fattrib_5fset_5ferr_34',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fcreate_5ferr_35',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fcreatetask_36',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fdestroytask_37',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
- ['azx_5ftasks_5ferr_5fe_38',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskid_39',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskname_40',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetenqueuedcount_41',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_42',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finit_43',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finvalid_5fid_5ferr_44',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmax_5fqueue_5fsize_45',['AZX_TASKS_MAX_QUEUE_SIZE',['../group__task_usage.html#ga56dfe0df57f53da981c1b7ec7ff782fe',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmax_5fstack_5fsize_46',['AZX_TASKS_MAX_STACK_SIZE',['../group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmax_5ftasks_47',['AZX_TASKS_MAX_TASKS',['../group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fl_48',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5flimit_49',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fm_50',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fs_51',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fsize_52',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmessage_5ft_53',['AZX_TASKS_MESSAGE_T',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html',1,'']]],
- ['azx_5ftasks_5fmin_5fqueue_5fsize_54',['AZX_TASKS_MIN_QUEUE_SIZE',['../group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmin_5fstack_5fsize_55',['AZX_TASKS_MIN_STACK_SIZE',['../group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_56',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fsend_5ferr_57',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_58',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fnotinit_5ferr_59',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fok_60',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fpriority_5fmax_61',['AZX_TASKS_PRIORITY_MAX',['../group__task_usage.html#ga3fe3fea325c9badf3a7cf5e2aea7012e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fpriority_5fmin_62',['AZX_TASKS_PRIORITY_MIN',['../group__task_usage.html#ga8c8cb01a85069a084d2e1dd17e299722',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_63',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5finit_5ferr_64',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fqueue_5fmsg_5fsize_65',['AZX_TASKS_QUEUE_MSG_SIZE',['../group__task_usage.html#ga146f8901751b1510a2d8add0cfafb8d6',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fsendmessagetotask_66',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fl_67',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fm_68',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fs_69',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_70',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_5ferr_71',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fxl_72',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
- ['azx_5ftasks_5ftask_5fname_5fsize_73',['AZX_TASKS_TASK_NAME_SIZE',['../group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fwrong_5fprio_5ferr_74',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]],
- ['azx_5futils_2eh_75',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
- ['azx_20sample_20modules_20documentation_76',['AZX sample modules documentation',['../index.html',1,'']]]
+ ['azx_5flog_5funexpected_5fchannel_28',['AZX_LOG_UNEXPECTED_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7',1,'azx_log.h']]],
+ ['azx_5flog_5fusb_5fcable_5funplugged_29',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
+ ['azx_5freboot_5fnow_30',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
+ ['azx_5fshutdown_5fnow_31',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
+ ['azx_5fsleep_5fms_32',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
+ ['azx_5ftasks_2eh_33',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
+ ['azx_5ftasks_5falloc_5ferr_34',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fattrib_5fset_5ferr_35',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fcreate_5ferr_36',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fcreatetask_37',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fdestroytask_38',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5ferr_5fe_39',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskid_40',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskname_41',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetenqueuedcount_42',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_43',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finit_44',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finvalid_5fid_5ferr_45',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmax_5fqueue_5fsize_46',['AZX_TASKS_MAX_QUEUE_SIZE',['../group__task_usage.html#ga56dfe0df57f53da981c1b7ec7ff782fe',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmax_5fstack_5fsize_47',['AZX_TASKS_MAX_STACK_SIZE',['../group__task_usage.html#gaca58a3aeea96e8ce05bb432bb30164da',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmax_5ftasks_48',['AZX_TASKS_MAX_TASKS',['../group__task_usage.html#gac5f0a50ac4788640701c1c1221d64a94',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fl_49',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5flimit_50',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fm_51',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fs_52',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fsize_53',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmessage_5ft_54',['AZX_TASKS_MESSAGE_T',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html',1,'']]],
+ ['azx_5ftasks_5fmin_5fqueue_5fsize_55',['AZX_TASKS_MIN_QUEUE_SIZE',['../group__task_usage.html#ga8f4f0e001d405f9c499b8f1d9fb78196',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmin_5fstack_5fsize_56',['AZX_TASKS_MIN_STACK_SIZE',['../group__task_usage.html#gaf2e2b6cef11a0e0c0f24ca2253a22e1e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_57',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fsend_5ferr_58',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_59',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fnotinit_5ferr_60',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fok_61',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fpriority_5fmax_62',['AZX_TASKS_PRIORITY_MAX',['../group__task_usage.html#ga3fe3fea325c9badf3a7cf5e2aea7012e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fpriority_5fmin_63',['AZX_TASKS_PRIORITY_MIN',['../group__task_usage.html#ga8c8cb01a85069a084d2e1dd17e299722',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_64',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5finit_5ferr_65',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fqueue_5fmsg_5fsize_66',['AZX_TASKS_QUEUE_MSG_SIZE',['../group__task_usage.html#ga146f8901751b1510a2d8add0cfafb8d6',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fsendmessagetotask_67',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fl_68',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fm_69',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fs_70',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_71',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_5ferr_72',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fxl_73',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5ftask_5fname_5fsize_74',['AZX_TASKS_TASK_NAME_SIZE',['../group__task_usage.html#gad435a24bea52cb07521128b0b84b4afd',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fwrong_5fprio_5ferr_75',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]],
+ ['azx_5futils_2eh_76',['azx_utils.h',['../azx__utils_8h.html',1,'']]],
+ ['azx_20sample_20modules_20documentation_77',['AZX sample modules documentation',['../index.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_1.js b/Samples/AZX_Docs/html/search/all_1.js
index c7a0091..2615d2d 100644
--- a/Samples/AZX_Docs/html/search/all_1.js
+++ b/Samples/AZX_Docs/html/search/all_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['configuration_20of_20logging_20functionalities_77',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
+ ['configuration_20of_20logging_20functionalities_78',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_2.js b/Samples/AZX_Docs/html/search/all_2.js
index 9a3396c..847476c 100644
--- a/Samples/AZX_Docs/html/search/all_2.js
+++ b/Samples/AZX_Docs/html/search/all_2.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['log_5fchannel_78',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_79',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_80',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
+ ['log_5fchannel_79',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_80',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_81',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_3.js b/Samples/AZX_Docs/html/search/all_3.js
index e79478e..aae5457 100644
--- a/Samples/AZX_Docs/html/search/all_3.js
+++ b/Samples/AZX_Docs/html/search/all_3.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['m2m_5fos_5ftask_5fstack_5flimit_81',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
+ ['m2m_5fos_5ftask_5fstack_5flimit_82',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_4.js b/Samples/AZX_Docs/html/search/all_4.js
index 4b67631..018c113 100644
--- a/Samples/AZX_Docs/html/search/all_4.js
+++ b/Samples/AZX_Docs/html/search/all_4.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['param1_82',['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_83',['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']]]
+ ['param1_83',['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_84',['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']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_5.js b/Samples/AZX_Docs/html/search/all_5.js
index f0da29d..e58fe37 100644
--- a/Samples/AZX_Docs/html/search/all_5.js
+++ b/Samples/AZX_Docs/html/search/all_5.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['type_84',['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_85',['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']]]
];
diff --git a/Samples/AZX_Docs/html/search/all_6.js b/Samples/AZX_Docs/html/search/all_6.js
index 49fd6df..4275524 100644
--- a/Samples/AZX_Docs/html/search/all_6.js
+++ b/Samples/AZX_Docs/html/search/all_6.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_85',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
- ['usage_20of_20tasks_20example_20functionalities_86',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]],
- ['user_5ftask_5fcb_87',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
+ ['usage_20of_20logging_20functionalities_86',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
+ ['usage_20of_20tasks_20example_20functionalities_87',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]],
+ ['user_5ftask_5fcb_88',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/classes_0.js b/Samples/AZX_Docs/html/search/classes_0.js
index 8c9935f..aa190c6 100644
--- a/Samples/AZX_Docs/html/search/classes_0.js
+++ b/Samples/AZX_Docs/html/search/classes_0.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['azx_5flog_5fcfg_5ft_88',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]],
- ['azx_5ftasks_5fmessage_5ft_89',['AZX_TASKS_MESSAGE_T',['../struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html',1,'']]]
+ ['azx_5flog_5fcfg_5ft_89',['AZX_LOG_CFG_T',['../struct_a_z_x___l_o_g___c_f_g___t.html',1,'']]],
+ ['azx_5ftasks_5fmessage_5ft_90',['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/Samples/AZX_Docs/html/search/defines_0.js b/Samples/AZX_Docs/html/search/defines_0.js
index 7703ec0..f0dfb9c 100644
--- a/Samples/AZX_Docs/html/search/defines_0.js
+++ b/Samples/AZX_Docs/html/search/defines_0.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['azx_5flimit_162',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
- ['azx_5flog_5finit_163',['AZX_LOG_INIT',['../azx__log_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'azx_log.h']]]
+ ['azx_5flimit_164',['AZX_LIMIT',['../azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9',1,'azx_utils.h']]],
+ ['azx_5flog_5finit_165',['AZX_LOG_INIT',['../azx__log_8h.html#a4af7b5c67a5df4ffbcafe9a91a4677bc',1,'azx_log.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/enums_0.js b/Samples/AZX_Docs/html/search/enums_0.js
index 498175a..cbaf584 100644
--- a/Samples/AZX_Docs/html/search/enums_0.js
+++ b/Samples/AZX_Docs/html/search/enums_0.js
@@ -1,9 +1,9 @@
var searchData=
[
- ['azx_5flog_5ferrors_5fe_118',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
- ['azx_5flog_5fhandle_5fe_119',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fe_120',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
- ['azx_5ftasks_5ferr_5fe_121',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fsize_122',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_123',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]]
+ ['azx_5flog_5ferrors_5fe_119',['AZX_LOG_ERRORS_E',['../group__log_usage.html#gabe77e5a2f7b57b5029c6f7cdfa7e3dd0',1,'azx_log.h']]],
+ ['azx_5flog_5fhandle_5fe_120',['AZX_LOG_HANDLE_E',['../group__log_conf.html#ga03b618927cb5d884386832ab76781760',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fe_121',['AZX_LOG_LEVEL_E',['../group__log_conf.html#gae9fa7be40e4fcae6093707def57f82a5',1,'azx_log.h']]],
+ ['azx_5ftasks_5ferr_5fe_122',['AZX_TASKS_ERR_E',['../group__task_usage.html#ga5b29dff3d5b477adbbf73a1515983c6b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fsize_123',['AZX_TASKS_MBOX_SIZE',['../group__task_usage.html#ga026eeb136a0744da96699ab01272a1ac',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_124',['AZX_TASKS_STACK_SIZE',['../group__task_usage.html#ga036b9cf9c298d9d53b608bf3942e3fb3',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/enumvalues_0.js b/Samples/AZX_Docs/html/search/enumvalues_0.js
index 57a478b..f79852a 100644
--- a/Samples/AZX_Docs/html/search/enumvalues_0.js
+++ b/Samples/AZX_Docs/html/search/enumvalues_0.js
@@ -1,40 +1,41 @@
var searchData=
[
- ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_124',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fcritical_125',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fdebug_126',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ferror_127',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5finfo_128',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fnone_129',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5ftrace_130',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
- ['azx_5flog_5flevel_5fwarn_131',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
- ['azx_5flog_5fno_5fusb_5finstance_5favailable_132',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
- ['azx_5flog_5fnot_5finit_133',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
- ['azx_5flog_5fto_5faux_5fuart_134',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fmain_5fuart_135',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb0_136',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
- ['azx_5flog_5fto_5fusb1_137',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
- ['azx_5flog_5fusb_5fcable_5funplugged_138',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
- ['azx_5ftasks_5falloc_5ferr_139',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fattrib_5fset_5ferr_140',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fcreate_5ferr_141',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_142',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finvalid_5fid_5ferr_143',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fl_144',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5flimit_145',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fm_146',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmbox_5fs_147',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_148',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fmsg_5fsend_5ferr_149',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_150',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fnotinit_5ferr_151',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fok_152',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_153',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fq_5finit_5ferr_154',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fl_155',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fm_156',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fs_157',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fsize_5ferr_158',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fstack_5fxl_159',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fwrong_5fprio_5ferr_160',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]]
+ ['azx_5flog_5fcannot_5fopen_5fusb_5fchannel_125',['AZX_LOG_CANNOT_OPEN_USB_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0aadebfaa08c22d4ad0729e98b50ce880c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fcritical_126',['AZX_LOG_LEVEL_CRITICAL',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a51671d346b1e7d44f8993fa9d2ca174c',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fdebug_127',['AZX_LOG_LEVEL_DEBUG',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5aa77afa2490f92d58d965e30ce97c8048',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ferror_128',['AZX_LOG_LEVEL_ERROR',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5acc52fcbd7aa2088fe583a11661b4abf2',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5finfo_129',['AZX_LOG_LEVEL_INFO',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a2bdb3bd46fb4a347265f0c966ded4f25',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fnone_130',['AZX_LOG_LEVEL_NONE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a8f609b972c7fd17cec42b2c216dc68b4',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5ftrace_131',['AZX_LOG_LEVEL_TRACE',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5adc5cc122c3a06700e09e4c6d1cc17497',1,'azx_log.h']]],
+ ['azx_5flog_5flevel_5fwarn_132',['AZX_LOG_LEVEL_WARN',['../group__log_conf.html#ggae9fa7be40e4fcae6093707def57f82a5a0d4c7c18f82729850d7a1c3e35e2f0b8',1,'azx_log.h']]],
+ ['azx_5flog_5fno_5fusb_5finstance_5favailable_133',['AZX_LOG_NO_USB_INSTANCE_AVAILABLE',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab7e169017c26c73457fe21f879b299f0',1,'azx_log.h']]],
+ ['azx_5flog_5fnot_5finit_134',['AZX_LOG_NOT_INIT',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a12ddd7346038a59740724ffcc8c20e12',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5faux_5fuart_135',['AZX_LOG_TO_AUX_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a0af771a438449471f0f1fb0a6e5d65d4',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fmain_5fuart_136',['AZX_LOG_TO_MAIN_UART',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a371b4156625be29814df43770a9150a3',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb0_137',['AZX_LOG_TO_USB0',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760a2b9fdc468ce514e4118797ad0e624841',1,'azx_log.h']]],
+ ['azx_5flog_5fto_5fusb1_138',['AZX_LOG_TO_USB1',['../group__log_conf.html#gga03b618927cb5d884386832ab76781760ab87a0049b27ce615b28ea77f51118286',1,'azx_log.h']]],
+ ['azx_5flog_5funexpected_5fchannel_139',['AZX_LOG_UNEXPECTED_CHANNEL',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0a90e600d320bbca44c2c869025835b1c7',1,'azx_log.h']]],
+ ['azx_5flog_5fusb_5fcable_5funplugged_140',['AZX_LOG_USB_CABLE_UNPLUGGED',['../group__log_usage.html#ggabe77e5a2f7b57b5029c6f7cdfa7e3dd0ab2beedfe225418d618c1d2e12410b72b',1,'azx_log.h']]],
+ ['azx_5ftasks_5falloc_5ferr_141',['AZX_TASKS_ALLOC_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba3349a0eb5bc758b0d352c74ed6544994',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fattrib_5fset_5ferr_142',['AZX_TASKS_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7613e94662a1b9b4f834e8c3571c595e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fcreate_5ferr_143',['AZX_TASKS_CREATE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba7b2631b8fb7565c607a86f9555e35457',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fid_5fnot_5fdefined_5ferr_144',['AZX_TASKS_ID_NOT_DEFINED_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baff0009833effaf091c786391904bff10',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finvalid_5fid_5ferr_145',['AZX_TASKS_INVALID_ID_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba671695a5dacb80dfa6d27451e9fe146b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fl_146',['AZX_TASKS_MBOX_L',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acaaa903abed6f7f967786e9151d871bfc1',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5flimit_147',['AZX_TASKS_MBOX_LIMIT',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca91707d07c80f749afe0086a4810766cf',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fm_148',['AZX_TASKS_MBOX_M',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1acad6829c834a06843b3ababd44a04394e9',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmbox_5fs_149',['AZX_TASKS_MBOX_S',['../group__task_usage.html#gga026eeb136a0744da96699ab01272a1aca6b3b1d1fe700fff393ef0236d1d5956e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fq_5fsize_5ferr_150',['AZX_TASKS_MSG_Q_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac30b652879c433e8b861f0efb37e7c9b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fmsg_5fsend_5ferr_151',['AZX_TASKS_MSG_SEND_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bae659d2da10c13fa8459f28743671970b',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fno_5ffree_5fslots_5ferr_152',['AZX_TASKS_NO_FREE_SLOTS_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac51d2e655c0ba38ad63d8143e782b42f',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fnotinit_5ferr_153',['AZX_TASKS_NOTINIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba1b01166c9c9033d0b500bbd79a81d234',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fok_154',['AZX_TASKS_OK',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6baf0fd3cefaa03e18813132ae02b6fb26c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5fattrib_5fset_5ferr_155',['AZX_TASKS_Q_ATTRIB_SET_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bac9d57051c665eaee27c1c5644bc9c1b7',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fq_5finit_5ferr_156',['AZX_TASKS_Q_INIT_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6bad46a06307a59a1bc9c8940a7777c827e',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fl_157',['AZX_TASKS_STACK_L',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a55c48feee3f1357cd3d4f8a4a89e2837',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fm_158',['AZX_TASKS_STACK_M',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a242b75e65efab695f4fc7679cea1865a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fs_159',['AZX_TASKS_STACK_S',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a362d3e4a3c2d32d01c7235f373738ca2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fsize_5ferr_160',['AZX_TASKS_STACK_SIZE_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba361acaceb888ed48b248ca7f63e82f3d',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fstack_5fxl_161',['AZX_TASKS_STACK_XL',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3a23b2068ca2a946f91a92d87c14dd9998',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fwrong_5fprio_5ferr_162',['AZX_TASKS_WRONG_PRIO_ERR',['../group__task_usage.html#gga5b29dff3d5b477adbbf73a1515983c6ba9b72007e8acc9145ebc512e144e5b836',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/enumvalues_1.js b/Samples/AZX_Docs/html/search/enumvalues_1.js
index 650851c..0b3b799 100644
--- a/Samples/AZX_Docs/html/search/enumvalues_1.js
+++ b/Samples/AZX_Docs/html/search/enumvalues_1.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['m2m_5fos_5ftask_5fstack_5flimit_161',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
+ ['m2m_5fos_5ftask_5fstack_5flimit_163',['M2M_OS_TASK_STACK_LIMIT',['../group__task_usage.html#gga036b9cf9c298d9d53b608bf3942e3fb3ab517d507287a275651ea4c6bb28320aa',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/files_0.js b/Samples/AZX_Docs/html/search/files_0.js
index 43defd1..47f513d 100644
--- a/Samples/AZX_Docs/html/search/files_0.js
+++ b/Samples/AZX_Docs/html/search/files_0.js
@@ -1,7 +1,7 @@
var searchData=
[
- ['app_5fcfg_2eh_90',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
- ['azx_5flog_2eh_91',['azx_log.h',['../azx__log_8h.html',1,'']]],
- ['azx_5ftasks_2eh_92',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
- ['azx_5futils_2eh_93',['azx_utils.h',['../azx__utils_8h.html',1,'']]]
+ ['app_5fcfg_2eh_91',['app_cfg.h',['../app__cfg_8h.html',1,'']]],
+ ['azx_5flog_2eh_92',['azx_log.h',['../azx__log_8h.html',1,'']]],
+ ['azx_5ftasks_2eh_93',['azx_tasks.h',['../azx__tasks_8h.html',1,'']]],
+ ['azx_5futils_2eh_94',['azx_utils.h',['../azx__utils_8h.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/functions_0.js b/Samples/AZX_Docs/html/search/functions_0.js
index c54401f..71857d5 100644
--- a/Samples/AZX_Docs/html/search/functions_0.js
+++ b/Samples/AZX_Docs/html/search/functions_0.js
@@ -1,20 +1,20 @@
var searchData=
[
- ['azx_5fhex_5fdump_94',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
- ['azx_5flog_5fdeinit_95',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
- ['azx_5flog_5fflush_5fto_5ffile_96',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
- ['azx_5flog_5fgetlevel_97',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
- ['azx_5flog_5finit_98',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
- ['azx_5flog_5fsend_5fto_5ffile_99',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
- ['azx_5flog_5fsetlevel_100',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
- ['azx_5freboot_5fnow_101',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
- ['azx_5fshutdown_5fnow_102',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
- ['azx_5fsleep_5fms_103',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
- ['azx_5ftasks_5fcreatetask_104',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fdestroytask_105',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskid_106',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetcurrenttaskname_107',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fgetenqueuedcount_108',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
- ['azx_5ftasks_5finit_109',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
- ['azx_5ftasks_5fsendmessagetotask_110',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]]
+ ['azx_5fhex_5fdump_95',['azx_hex_dump',['../azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f',1,'azx_utils.h']]],
+ ['azx_5flog_5fdeinit_96',['azx_log_deinit',['../azx__log_8h.html#a1cff830ca498f89db8a6ba0882441231',1,'azx_log.h']]],
+ ['azx_5flog_5fflush_5fto_5ffile_97',['azx_log_flush_to_file',['../azx__log_8h.html#a3e999a06dd697da3196e357039081124',1,'azx_log.h']]],
+ ['azx_5flog_5fgetlevel_98',['azx_log_getLevel',['../azx__log_8h.html#ab2c4e9406084c9f69c1314a718cc90d8',1,'azx_log.h']]],
+ ['azx_5flog_5finit_99',['azx_log_init',['../group__log_conf.html#ga08e797515ecc2b71223a72c77c6dc6af',1,'azx_log.h']]],
+ ['azx_5flog_5fsend_5fto_5ffile_100',['azx_log_send_to_file',['../azx__log_8h.html#af64520b985c9e8b97fda9dd77279bdd3',1,'azx_log.h']]],
+ ['azx_5flog_5fsetlevel_101',['azx_log_setLevel',['../azx__log_8h.html#a7b0daaed2d1a5700a26365e409593a4b',1,'azx_log.h']]],
+ ['azx_5freboot_5fnow_102',['azx_reboot_now',['../azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf',1,'azx_utils.h']]],
+ ['azx_5fshutdown_5fnow_103',['azx_shutdown_now',['../azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df',1,'azx_utils.h']]],
+ ['azx_5fsleep_5fms_104',['azx_sleep_ms',['../azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5',1,'azx_utils.h']]],
+ ['azx_5ftasks_5fcreatetask_105',['azx_tasks_createTask',['../group__task_usage.html#gaec2329e432960a7d210982ebc379cd0c',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fdestroytask_106',['azx_tasks_destroyTask',['../group__task_usage.html#ga1feb12b83b0e76cca5471d8720082708',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskid_107',['azx_tasks_getCurrentTaskId',['../group__task_usage.html#gad1da66a5e55a1b33471d1eec1bfd6623',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetcurrenttaskname_108',['azx_tasks_getCurrentTaskName',['../group__task_usage.html#gaadfe1b6031c35086447241b51b39bfb6',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fgetenqueuedcount_109',['azx_tasks_getEnqueuedCount',['../azx__tasks_8h.html#afba61203db27eb36059b90f658d7bb9a',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5finit_110',['azx_tasks_init',['../group__task_usage.html#ga1fddaf02d721c17e85a1dd9997d296e2',1,'azx_tasks.h']]],
+ ['azx_5ftasks_5fsendmessagetotask_111',['azx_tasks_sendMessageToTask',['../group__task_usage.html#ga8bb45f0fffe4cd52bf53cd00b83a2ee2',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/groups_0.js b/Samples/AZX_Docs/html/search/groups_0.js
index 9ad2dc4..0bf46f6 100644
--- a/Samples/AZX_Docs/html/search/groups_0.js
+++ b/Samples/AZX_Docs/html/search/groups_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['configuration_20of_20logging_20functionalities_164',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
+ ['configuration_20of_20logging_20functionalities_166',['Configuration of logging functionalities',['../group__log_conf.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/groups_1.js b/Samples/AZX_Docs/html/search/groups_1.js
index b11152c..4a10fc3 100644
--- a/Samples/AZX_Docs/html/search/groups_1.js
+++ b/Samples/AZX_Docs/html/search/groups_1.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['usage_20of_20logging_20functionalities_165',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
- ['usage_20of_20tasks_20example_20functionalities_166',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]]
+ ['usage_20of_20logging_20functionalities_167',['Usage of logging functionalities',['../group__log_usage.html',1,'']]],
+ ['usage_20of_20tasks_20example_20functionalities_168',['Usage of tasks example functionalities',['../group__task_usage.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/pages_0.js b/Samples/AZX_Docs/html/search/pages_0.js
index 710a982..a481d1f 100644
--- a/Samples/AZX_Docs/html/search/pages_0.js
+++ b/Samples/AZX_Docs/html/search/pages_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['azx_20sample_20modules_20documentation_167',['AZX sample modules documentation',['../index.html',1,'']]]
+ ['azx_20sample_20modules_20documentation_169',['AZX sample modules documentation',['../index.html',1,'']]]
];
diff --git a/Samples/AZX_Docs/html/search/typedefs_0.js b/Samples/AZX_Docs/html/search/typedefs_0.js
index b2be71e..d334ea5 100644
--- a/Samples/AZX_Docs/html/search/typedefs_0.js
+++ b/Samples/AZX_Docs/html/search/typedefs_0.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['user_5ftask_5fcb_117',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
+ ['user_5ftask_5fcb_118',['USER_TASK_CB',['../group__task_usage.html#gaf5abdb36b530c6d64d58a14555a68416',1,'azx_tasks.h']]]
];
diff --git a/Samples/AZX_Docs/html/search/variables_0.js b/Samples/AZX_Docs/html/search/variables_0.js
index 58f6ca6..73cc72b 100644
--- a/Samples/AZX_Docs/html/search/variables_0.js
+++ b/Samples/AZX_Docs/html/search/variables_0.js
@@ -1,6 +1,6 @@
var searchData=
[
- ['log_5fchannel_111',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
- ['log_5fcolours_112',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
- ['log_5flevel_113',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
+ ['log_5fchannel_112',['log_channel',['../struct_a_z_x___l_o_g___c_f_g___t.html#a609c698186c3593727637d0d4afcad9a',1,'AZX_LOG_CFG_T']]],
+ ['log_5fcolours_113',['log_colours',['../struct_a_z_x___l_o_g___c_f_g___t.html#aa034a943c56f918fe8dbbf6a06ade44c',1,'AZX_LOG_CFG_T']]],
+ ['log_5flevel_114',['log_level',['../struct_a_z_x___l_o_g___c_f_g___t.html#afc9a3bd60f8958c7cccaf707612d2ae2',1,'AZX_LOG_CFG_T']]]
];
diff --git a/Samples/AZX_Docs/html/search/variables_1.js b/Samples/AZX_Docs/html/search/variables_1.js
index cd8a9e0..623ac60 100644
--- a/Samples/AZX_Docs/html/search/variables_1.js
+++ b/Samples/AZX_Docs/html/search/variables_1.js
@@ -1,5 +1,5 @@
var searchData=
[
- ['param1_114',['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_115',['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']]]
+ ['param1_115',['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_116',['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']]]
];
diff --git a/Samples/AZX_Docs/html/search/variables_2.js b/Samples/AZX_Docs/html/search/variables_2.js
index e5b0e62..8868e9e 100644
--- a/Samples/AZX_Docs/html/search/variables_2.js
+++ b/Samples/AZX_Docs/html/search/variables_2.js
@@ -1,4 +1,4 @@
var searchData=
[
- ['type_116',['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_117',['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']]]
];
diff --git a/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html b/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
index d57638c..6099f5a 100644
--- a/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
+++ b/Samples/AZX_Docs/html/struct_a_z_x___l_o_g___c_f_g___t.html
@@ -34,7 +34,7 @@
 |
AZX (AppZone eXtensions) documentation
- 1.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html b/Samples/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html
index d689a61..4bfc27f 100644
--- a/Samples/AZX_Docs/html/struct_a_z_x___t_a_s_k_s___m_e_s_s_a_g_e___t.html
+++ b/Samples/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.0.7
+ 1.0.8
A set of companion utilities that make AZ development easier
|
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/BOSCH/BME680/bme680.c b/Samples/BRAVO_Environment_BSEC_Demo/BOSCH/BME680/bme680.c
index 5b138c0..7fafc30 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/BOSCH/BME680/bme680.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/BOSCH/BME680/bme680.c
@@ -619,7 +619,7 @@ int8_t bme680_set_sensor_mode(struct bme680_dev *dev)
int8_t bme680_get_sensor_mode(struct bme680_dev *dev)
{
int8_t rslt;
- uint8_t mode;
+ uint8_t mode = 0;
/* Check for null pointer in the device structure*/
rslt = null_ptr_check(dev);
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/Makefile.in b/Samples/BRAVO_Environment_BSEC_Demo/Makefile.in
index 3fbc0c6..d9bf071 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/Makefile.in
+++ b/Samples/BRAVO_Environment_BSEC_Demo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.0.7
+SW_VER = 1.0.8
CLEAN_BEFORE_BUILD = clean
@@ -50,9 +50,18 @@ CPPFLAGS += -I azx/hdr
OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
CPPFLAGS += -I src/demo_utils
OBJS += $(patsubst %.c,%.o,$(wildcard src/demo_utils/*.c))
+
+ifneq ($(strip $(BOSCH_BSEC)),0)
+
+CPPFLAGS += -DBOSCH_BSEC=1
+
CPPFLAGS += -I BOSCH/BHI160/firmware -I BOSCH/BHI160/inc
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BHI160/src/*.c))
CPPFLAGS += -I BOSCH/BME680
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BME680/*.c))
CPPFLAGS += -I BOSCH/BSEC
LDDFLAGS += ./BOSCH/BSEC/libalgobsec.ar -lc -lm -lnosys -lgcc --gc-sections --no-keep-memory
+else
+CPPFLAGS += -DBOSCH_BSEC=0
+endif
+
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/README.md b/Samples/BRAVO_Environment_BSEC_Demo/README.md
index 3bec0b5..a5bb8ee 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/README.md
+++ b/Samples/BRAVO_Environment_BSEC_Demo/README.md
@@ -32,7 +32,7 @@ Now from Developer webpage, go in **Thing Definitions** page from the list on th
Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_EnvironmentalDemo_device_profile.json`, then press `Import`.
-** External Libraries **
+**External Libraries**
To build the application it is required to put `libalgobsec.ar` file into the project's BOSCH/BSEC folder. The library can be retrieved at the link
https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.4.7.4 version archive, then extract the library `libalgobsec.a` from the ZIP file and rename as `libalgobsec.ar`. It can be found in the directory
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
index aacac59..76d26ee 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Environment_BSEC_Demo/azx/hdr/azx_log.h
@@ -5,7 +5,7 @@
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.8
+ * @version 1.0.9
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -60,6 +60,7 @@ typedef enum
AZX_LOG_USB_CABLE_UNPLUGGED, /**
3)
{
- return -1;
+ return ret;
}
sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
@@ -137,20 +133,17 @@ int open_LED( int index )
M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
);
-
- if( ret == -1 )
+ if( ret != -1 )
{
- return -1;
+ ret = 0;
}
-
- return 0;
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/i2c.c b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/i2c.c
index ae9a145..a5b6d43 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/i2c.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/i2c.c
@@ -180,16 +180,16 @@ int8_t sensor_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t s
{
size = size - tmpsize;
reg = reg + tmpsize;
- p_buf = p_buf + tmpsize;
+
AZX_LOG_TRACE( "Reading Success.\r\n" );
AZX_LOG_TRACE( "i2c->" );
-
- for( int i = 1; i < i2c_res; i++ )
+ for( int i = 0; i < i2c_res; i++ )
{
AZX_LOG_TRACE( " %02x", p_buf[i] );
}
-
AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
}
else
{
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
index c98d520..12199e9 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.c
@@ -44,9 +44,9 @@
#include "lwm2m.h"
/* Local defines ================================================================================*/
-#define GPIO_INDEX_RED 0
-#define GPIO_INDEX_YELLOW 1
-#define GPIO_INDEX_GREEN 2
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
/* Local typedefs ===============================================================================*/
@@ -54,848 +54,1272 @@
static INT32 dataTaskID = -1;
static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+static BOOLEAN bootstrapped = FALSE;
+
/* HANDLER */
static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
-static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
/* ONEEDGE */
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
- .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
- 1, 0 };
+ 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
- 2, 0 };
+ 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
- 3, 0 };
+ 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
- 0, 4, 0 };
+ 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
- { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
- { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
- { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
- { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
- { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
- LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
- { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
};
/* Local function prototypes ====================================================================*/
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId);
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
/* Static functions =============================================================================*/
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId) {
- (void)event;
-
- AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
-
- UINT32 curEvBits;
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- /* Fill resource URI with required parameters */
- resource_uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
- resource_uri.objInst = index;
- resource_uri.resourceInst = 0;
- resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
-
- AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
- light_control_obj_table[index].appType);
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
- light_control_obj_table[index].appType,
- strlen(light_control_obj_table[index].appType));
- //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;
- }
-
- /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
-
-
- AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
- INT32 r = azx_tasks_destroyTask((INT8) taskId);
- AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
- taskId);
-
- return 1;
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
}
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
- INT8 appTypeTaskID;
- appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
- AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
- writeLightControlAppTypeTask);
-
- AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
- if (appTypeTaskID <= 0) {
- AZX_LOG_ERROR(
- "Cannot create lwm2m application type managing task!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
- (INT32) appTypeTaskID);
-
- return M2MB_RESULT_SUCCESS;
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
}
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
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;
-
- /* Client generated events */
- switch (event) {
-
- 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_TRACE("LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
-
- AZX_LOG_WARN("Enable result %d\r\n", resp->result);
- }
- break;
- }
-
- 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_DEBUG("LWM2M set result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("set result %d\r\n", resp->result);
- }
- 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;
- AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
- AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
- if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
- }
- break;
- }
-
- 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("LWM2M write result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("Enable write %d\r\n", resp->result);
- }
- 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 && dataTaskID != -1)
- {
- 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);
- p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
- }
- else
- {
- AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
- }
-
- break;
- }
-
- 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;
-
- LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
-
- switch( resp->result )
- {
- case M2MB_LWM2M_RES_SUCCESS:
-
- AZX_LOG_TRACE("New Instance created successfully\r\n");
-
- if (userdata)
- {
- INT32 objId = data->objID;
- INT16 *index = (INT16*) data->data;
- AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
-
- switch (objId)
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
-
- azx_sleep_ms(4000);
-
- // start task to write the resource
- if (writeLightControlApplicationType(
- M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("Error writing application Type resource\r\n");
- }
-
- /* free the resource allocated in to oneedge_init */
- m2mb_os_free((INT16*) data->data);
-
- break;
-
- default:
- AZX_LOG_INFO("Unknown object instance. <%d>\r\n", objId);
- break;
- }
- }
- break;
-
- case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
- AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
- break;
-
- default:
- AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
- break;
- }
-
- break;
- }
-
- case M2MB_LWM2M_SRV_INFO_IND: {
-
- AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
- M2MB_LWM2M_SRV_INFO_IND_T *resp =
- (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
-
- switch (resp->info) {
- case M2MB_LWM2M_CL_STATE_DISABLED:
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERING:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
- M2MB_OS_EV_SET);
- break;
- case M2MB_LWM2M_CL_STATE_DEREGISTERING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_SUSPENDED:
- AZX_LOG_DEBUG("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;
- }
-
- case M2MB_LWM2M_SESSION_INFO_IND:
- {
- AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
- M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
-
- if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
- {
- M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
- AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
- /* example
- if( currData->obj == 3303 && currData->resource == 5605)
- {
- AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("executed another resource");
- }*/
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_mon() */
- case M2MB_LWM2M_MON_RES:
- {
- AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
-
- 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_get_stat() */
- case M2MB_LWM2M_GET_STAT_RES:
- {
- AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
- break;
- }
-
- default:
- AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
- break;
- }
+ UINT16 resp_size, void *resp_struct, void *userdata) {
+ (void) h;
+ (void) resp_size;
+ (void) userdata;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
}
/*-----------------------------------------------------------------------------------------------*/
uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
- 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;
-
- lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
-
- int i;
- M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
-
- if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
- }
-
- AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
-
- /* 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");
- return -1;
- } else {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- //get the handle of the lwm2m client on lwm2mHandle
- retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
-
- 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- 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_os_sem_deinit(lwm2m_CSSemHandle);
-
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
-
- //AT#LWM2MENA=1
- memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
-
- 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_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- if (M2MB_OS_SUCCESS
- != m2mb_os_ev_get(eventsHandleLwm2m,
- 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");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- azx_sleep_ms(1000);
-
-
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- AZX_LOG_DEBUG("LWM2M registered\r\n");
-
- azx_sleep_ms(1000);
-
- for (i = 0; i < obj_num; i++)
- {
- M2MB_LWM2M_OBJ_URI_T uri;
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
-
- /*new object instance information*/
- uri.obj = objs[i].obj_id;
-
- new_inst_params.agent = 0; /*Telit Agent*/
-
- int j;
- for (j = 0; j < objs[i].inst_num; j++)
- {
-
- AZX_LOG_TRACE( "Creating new instance %d\r\n", j);
-
- uri.objInst = objs[i].instances_ids[j];
- uri.resource = 0;
- uri.resourceInst = 0;
- uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- /*If OK the instance was not present, and so it was created. If an error
- is received, it is likely because the instance already exists.*/
-
- INT16 *index = NULL;
-
- if (lwm2mUserData)
- {
-
- switch( lwm2mUserData->objID )
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
- {
- index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
- if(!index)
- {
- AZX_LOG_ERROR( "Cannot allocate memory\r\n");
- //TODO check if needed free resources
- return M2MB_RESULT_FAIL;
- }
- *index = objs[i].instances_ids[j];
- lwm2mUserData->data = (void*) index;
-
- break;
- }
- default:
- break;
- }
- }
-
- retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- return M2MB_RESULT_FAIL;
- }
-
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_NEW_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(1000) /*wait 10 seconds for the event to occur*/
- );
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- azx_sleep_ms(2000);
- return M2MB_RESULT_FAIL;
- }
-
- AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
-
- } //for (j = 0; j < objs[i].inst_num; j++)
-
-
- } //for (i = 0; i < obj_num; i++)
-
- return 0;
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
}
/*-----------------------------------------------------------------------------------------------*/
void update_tamper_LWM2MObject(int value)
{
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
- &value, sizeof(int));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
- &_t, sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
-
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
- INT16 _acc) {
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int check_xml_file(const char *name) {
- char path[64] = { 0 };
- struct M2MB_STAT info;
- sprintf(path, "/XML/%s", name);
- AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
-
- if (0 == m2mb_fs_stat(path, &info)) {
- AZX_LOG_DEBUG("File is present, continue...\r\n");
- return 0;
- } else {
- INT32 last_errno = m2mb_fs_get_errno_value();
-
- if (last_errno == M2MB_FS_ENOENT) {
- AZX_LOG_WARN("File not found.\r\n");
- return -1;
- } else {
- AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
- last_errno);
- return -2;
- }
- }
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
{
-
- *lightObjs = light_control_obj_table;
-
- return 1;
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
int copy_xml_file(const char *name) {
- char inpath[64] = { 0 };
- char outpath[64] = { 0 };
- char data[256];
- INT32 in_fd, out_fd;
- sprintf(inpath, "/mod/%s", name);
- sprintf(outpath, "/XML/%s", name);
- in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
-
- if (-1 == in_fd) {
- AZX_LOG_ERROR("cannot find input file! abort.\r\n");
- return -1;
- } else {
- out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
-
- if (-1 == out_fd) {
- AZX_LOG_ERROR("cannot create output file! abort.\r\n");
- return -2;
- } else {
- struct M2MB_STAT stats;
- UINT32 filesize;
- UINT32 written = 0;
- UINT32 chunk = sizeof(data);
- AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
-
- if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
- AZX_LOG_ERROR("cannot stat input file! abort\r\n");
- return -3;
- } else {
- filesize = stats.st_size;
- AZX_LOG_DEBUG("File size: %u\r\n", filesize);
-
- if (chunk > filesize) {
- AZX_LOG_DEBUG(
- "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
- chunk, filesize);
- chunk = filesize;
- }
-
- while (1) {
- SSIZE_T res = 0;
- res = m2mb_fs_read(in_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "read is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -4;
- }
-
- res = m2mb_fs_write(out_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "written is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -5;
- }
-
- AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
- chunk);
- written += chunk;
-
- if ((filesize - written) < chunk) {
- chunk = filesize - written;
- }
-
- if (written == filesize) {
- AZX_LOG_DEBUG("file written. \r\n");
- break;
- }
- }
-
- return 0;
- }
- }
- }
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
}
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
{
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
- if (lwm2mHandle == NULL)
- {
- AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
- return -1;
- }
- retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
- return -1;
- }
- AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- 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*/
- );
-
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- return 1;
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
}
int lwm2m_ReadTaskRegister(INT32 taskID) {
- if (taskID > 0) {
- dataTaskID = taskID;
- return 1;
- }
- return -1;
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
}
M2MB_LWM2M_HANDLE getLwM2mHandle()
{
- return lwm2mHandle;
+ return lwm2mHandle;
}
M2MB_OS_EV_HANDLE getEventHandle()
{
- return eventsHandleLwm2m;
+ return eventsHandleLwm2m;
}
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.h b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.h
index 0a5c667..b991703 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.h
+++ b/Samples/BRAVO_Environment_BSEC_Demo/src/demo_utils/lwm2m.h
@@ -30,8 +30,9 @@
/* Global defines ================================================================================*/
/*OBJECTs and RESOURCEs IDs*/
-#define M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID 3311
-#define OBJECT_XML_NAME "object_3311.xml"
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
#define LIGHT_CONTROL_OBJ_TIME_ID 5852
@@ -40,18 +41,35 @@
#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
#define TAMPERING_OBJ_ID 26242
#define ENVIRONMENT_OBJ_ID 26251
#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
-#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
-#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000003
-#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_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
#define EV_MON_URC_RECEIVED 2
#define EV_LWM2M_WRITE_APP_TYPE 3
#define CTX_ID 1 //default cid used by lwm2m
@@ -107,6 +125,19 @@ void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size
void *userdata );
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
/**
@brief Initialize OneEdge connection
@param[in] obj_id Object ID to be used for initialization
@@ -190,12 +221,12 @@ int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
int lwm2m_ReadTaskRegister( INT32 taskID);
/**
- @brief Retrun the lwm2m handle
+ @brief Return the lwm2m handle
*/
M2MB_LWM2M_HANDLE getLwM2mHandle();
/**
- @brief Retrun the event lwm2m handle
+ @brief Return the event lwm2m handle
*/
M2MB_OS_EV_HANDLE getEventHandle();
@@ -212,5 +243,42 @@ M2MB_OS_EV_HANDLE getEventHandle();
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_Environment_BSEC_Demo/src/i2c_bme680.c b/Samples/BRAVO_Environment_BSEC_Demo/src/i2c_bme680.c
index d02b4cf..cf18882 100644
--- a/Samples/BRAVO_Environment_BSEC_Demo/src/i2c_bme680.c
+++ b/Samples/BRAVO_Environment_BSEC_Demo/src/i2c_bme680.c
@@ -209,16 +209,16 @@ int8_t bme680_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t s
{
size = size - tmpsize;
reg = reg + tmpsize;
- p_buf = p_buf + tmpsize;
+
AZX_LOG_TRACE( "Reading Success.\r\n" );
AZX_LOG_TRACE( "i2c->" );
-
- for( int i = 1; i < i2c_res; i++ )
+ for( int i = 0; i < i2c_res; i++ )
{
AZX_LOG_TRACE( " %02x", p_buf[i] );
}
-
AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
}
else
{
diff --git a/Samples/BRAVO_LED_Demo/Makefile.in b/Samples/BRAVO_LED_Demo/Makefile.in
index 3765f24..2fb5199 100644
--- a/Samples/BRAVO_LED_Demo/Makefile.in
+++ b/Samples/BRAVO_LED_Demo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.0.7
+SW_VER = 1.0.8
CLEAN_BEFORE_BUILD = clean
diff --git a/Samples/BRAVO_LED_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_LED_Demo/azx/hdr/azx_log.h
index aacac59..76d26ee 100644
--- a/Samples/BRAVO_LED_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_LED_Demo/azx/hdr/azx_log.h
@@ -5,7 +5,7 @@
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.8
+ * @version 1.0.9
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -60,6 +60,7 @@ typedef enum
AZX_LOG_USB_CABLE_UNPLUGGED, /** \r\n", data_int);
@@ -228,7 +228,7 @@ static INT32 demoAppTask(INT32 type, INT32 param1, INT32 param2)
M2MB_OS_EV_ATTR_HANDLE evAttrHandle = NULL;
UINT32 curEvBits;
- M2MB_NET_HANDLE netHandle;
+ M2MB_NET_HANDLE netHandle = NULL;
INT32 ret;
int task_status = type;
@@ -312,17 +312,17 @@ static INT32 demoAppTask(INT32 type, INT32 param1, INT32 param2)
task_status = APPLICATION_EXIT;
break;
}
- lwm2mUserData->objID = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
+ lwm2mUserData->objID = LWM2M_LIGHT_CONTROL_OBJ_ID;
INT16 instances[] = {0, 1, 2};
- LWM2M_OBJ_REG_T obj = {M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID, 3, instances };
+ LWM2M_OBJ_REG_T obj = {LWM2M_LIGHT_CONTROL_OBJ_ID, 3, instances };
/* Check XML file*/
- AZX_LOG_INFO("Looking for <%s> file..\r\n", OBJECT_XML_NAME);
- if( 0 != check_xml_file(OBJECT_XML_NAME) )
+ AZX_LOG_INFO("Looking for <%s> file..\r\n", LWM2M_LIGHT_OBJECT_XML_NAME);
+ if( 0 != check_xml_file(LWM2M_LIGHT_OBJECT_XML_NAME) )
{
- AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", OBJECT_XML_NAME);
+ AZX_LOG_CRITICAL("%s file is not present in XML folder!\r\n", LWM2M_LIGHT_OBJECT_XML_NAME);
task_status = APPLICATION_EXIT;
break;
}
@@ -351,11 +351,11 @@ static INT32 demoAppTask(INT32 type, INT32 param1, INT32 param2)
mon.action = M2MB_LWM2M_MON_ENABLE;
M2MB_LWM2M_OBJ_URI_T uri_mon = {
- M2MB_LWM2M_URI_3_FIELDS, // UINT8 uriLen;
- M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID, // UINT16 obj;
- 0, // UINT16 objInst;
- 0, // UINT16 resource;
- 0 // UINT16 resourceInst;
+ M2MB_LWM2M_URI_3_FIELDS, // UINT8 uriLen;
+ LWM2M_LIGHT_CONTROL_OBJ_ID, // UINT16 obj;
+ 0, // UINT16 objInst;
+ 0, // UINT16 resource;
+ 0 // UINT16 resourceInst;
};
AZX_LOG_INFO( "Register monitor resources\r\n");
@@ -413,14 +413,11 @@ static INT32 demoAppTask(INT32 type, INT32 param1, INT32 param2)
/* Global functions =============================================================================*/
-M2MB_RESULT_E closeAllGPIO ( void )
+M2MB_RESULT_E closeAllGPIO ( void )
{
- LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs;
- if (getLightControlObjTable(&lightObjs) < 0)
- {
- AZX_LOG_ERROR("Cannot get the objs table!\r\n");
- }
-
+ LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs = NULL;
+ getLightControlObjTable(&lightObjs);
+
int error = 0;
for (; lightObjs->index != -1; lightObjs++)
@@ -444,7 +441,7 @@ M2MB_RESULT_E closeAllGPIO ( void )
}
-M2MB_RESULT_E restoreGpio ( void )
+M2MB_RESULT_E restoreGpio ( void )
{
MEM_W data_buffer[256] = {0};
M2MB_RESULT_E retVal;
@@ -457,16 +454,14 @@ M2MB_RESULT_E restoreGpio ( void )
/* Fill resource URI with required parameters */
- uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
+ uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
uri.resourceInst = 0;
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.resource = LIGHT_CONTROL_OBJ_ON_OFF_ID;
- LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs;
- if (getLightControlObjTable(&lightObjs) < 0)
- {
- AZX_LOG_ERROR("Cannot get the objs table!\r\n");
- }
+ LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs = NULL;
+ getLightControlObjTable(&lightObjs);
+
M2MB_LWM2M_HANDLE lwm2mHandle = getLwM2mHandle();
M2MB_OS_EV_HANDLE eventsHandleLwm2m = getEventHandle();
@@ -521,13 +516,9 @@ M2MB_RESULT_E restoreGpio ( void )
M2MB_RESULT_E setGpio(UINT16 index, INT32 v)
{
- LIGHT_CONTROL_OBJ_INSTANCE_S *instance;
-
- if (getLightControlObjTable(&instance) < 0)
- {
- AZX_LOG_ERROR("Cannot get the objs table!\r\n");
- }
-
+ LIGHT_CONTROL_OBJ_INSTANCE_S *instance = NULL;
+ getLightControlObjTable(&instance);
+
AZX_LOG_TRACE("index = %d, value = %d\r\n", index, v);
AZX_LOG_TRACE("instance.index = %d, instance->fd = %d, pin = %d\r\n",
instance[index].index, instance[index].fd, instance[index].pin);
@@ -540,15 +531,12 @@ M2MB_RESULT_E setGpio(UINT16 index, INT32 v)
UINT8 gpioInit(void)
{
-
- LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs;
+ LIGHT_CONTROL_OBJ_INSTANCE_S *lightObjs = NULL;
-#if 1 /* only for debug */
- if (getLightControlObjTable(&lightObjs) < 0)
- {
- AZX_LOG_ERROR("Cannot get the objs table!\r\n");
- }
+#if 1 /* only for debug */
+ getLightControlObjTable(&lightObjs);
+
for (; lightObjs->index != -1; lightObjs++)
{
INT32 pin = getGpioPinByIndex(lightObjs->index);
@@ -557,10 +545,8 @@ UINT8 gpioInit(void)
#endif
- if (getLightControlObjTable(&lightObjs) < 0)
- {
- AZX_LOG_ERROR("Cannot get the objs table!\r\n");
- }
+ getLightControlObjTable(&lightObjs);
+
for (; lightObjs->index != -1; lightObjs++)
{
INT32 fd;
@@ -570,14 +556,14 @@ UINT8 gpioInit(void)
if (ret)
{
AZX_LOG_CRITICAL("Cannot set GPIO descriptors <%d>!\r\n", lightObjs->pin);
- return -1;
+ return 1;
}
fd = getGpioDescriptor(lightObjs->index);
if (fd == -1)
{
AZX_LOG_ERROR("GPIO pin is not valid!\r\n");
- return -1;
+ return 1;
}
lightObjs->fd = fd;
diff --git a/Samples/BRAVO_LED_Demo/src/demo_utils/gpio.c b/Samples/BRAVO_LED_Demo/src/demo_utils/gpio.c
index 7ce3425..0c7a008 100644
--- a/Samples/BRAVO_LED_Demo/src/demo_utils/gpio.c
+++ b/Samples/BRAVO_LED_Demo/src/demo_utils/gpio.c
@@ -72,7 +72,7 @@ int close_gpio( int *pin )
/*-----------------------------------------------------------------------------------------------*/
int open_gpio( int pin )
{
- INT32 ret;
+ INT32 ret = -1;
char path[32];
memset( path, 0, sizeof( path ) );
sprintf( path, "/dev/GPIO%d", pin );
@@ -96,33 +96,29 @@ int open_gpio( int pin )
M2MB_GPIO_IOCTL_INIT_INTR, ( UINT32 )NULL ) /*enable interrupts*/
);
- if( ret == -1 )
- {
- return -1;
- }
- else
+ if( ret != -1 )
{
- return 0;
+ ret = 0;
}
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
int open_LED( int index )
{
- INT32 ret;
+ INT32 ret = -1;
char path[32];
memset( path, 0, sizeof( path ) );
if (index < 0 || index > 3)
{
- return -1;
+ return ret;
}
sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
@@ -137,20 +133,17 @@ int open_LED( int index )
M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
);
-
- if( ret == -1 )
+ if( ret != -1 )
{
- return -1;
+ ret = 0;
}
-
- return 0;
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.c
index c98d520..12199e9 100644
--- a/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.c
@@ -44,9 +44,9 @@
#include "lwm2m.h"
/* Local defines ================================================================================*/
-#define GPIO_INDEX_RED 0
-#define GPIO_INDEX_YELLOW 1
-#define GPIO_INDEX_GREEN 2
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
/* Local typedefs ===============================================================================*/
@@ -54,848 +54,1272 @@
static INT32 dataTaskID = -1;
static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+static BOOLEAN bootstrapped = FALSE;
+
/* HANDLER */
static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
-static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
/* ONEEDGE */
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
- .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
- 1, 0 };
+ 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
- 2, 0 };
+ 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
- 3, 0 };
+ 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
- 0, 4, 0 };
+ 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
- { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
- { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
- { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
- { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
- { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
- LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
- { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
};
/* Local function prototypes ====================================================================*/
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId);
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
/* Static functions =============================================================================*/
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId) {
- (void)event;
-
- AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
-
- UINT32 curEvBits;
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- /* Fill resource URI with required parameters */
- resource_uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
- resource_uri.objInst = index;
- resource_uri.resourceInst = 0;
- resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
-
- AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
- light_control_obj_table[index].appType);
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
- light_control_obj_table[index].appType,
- strlen(light_control_obj_table[index].appType));
- //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;
- }
-
- /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
-
-
- AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
- INT32 r = azx_tasks_destroyTask((INT8) taskId);
- AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
- taskId);
-
- return 1;
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
}
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
- INT8 appTypeTaskID;
- appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
- AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
- writeLightControlAppTypeTask);
-
- AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
- if (appTypeTaskID <= 0) {
- AZX_LOG_ERROR(
- "Cannot create lwm2m application type managing task!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
- (INT32) appTypeTaskID);
-
- return M2MB_RESULT_SUCCESS;
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
}
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
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;
-
- /* Client generated events */
- switch (event) {
-
- 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_TRACE("LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
-
- AZX_LOG_WARN("Enable result %d\r\n", resp->result);
- }
- break;
- }
-
- 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_DEBUG("LWM2M set result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("set result %d\r\n", resp->result);
- }
- 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;
- AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
- AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
- if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
- }
- break;
- }
-
- 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("LWM2M write result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("Enable write %d\r\n", resp->result);
- }
- 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 && dataTaskID != -1)
- {
- 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);
- p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
- }
- else
- {
- AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
- }
-
- break;
- }
-
- 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;
-
- LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
-
- switch( resp->result )
- {
- case M2MB_LWM2M_RES_SUCCESS:
-
- AZX_LOG_TRACE("New Instance created successfully\r\n");
-
- if (userdata)
- {
- INT32 objId = data->objID;
- INT16 *index = (INT16*) data->data;
- AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
-
- switch (objId)
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
-
- azx_sleep_ms(4000);
-
- // start task to write the resource
- if (writeLightControlApplicationType(
- M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("Error writing application Type resource\r\n");
- }
-
- /* free the resource allocated in to oneedge_init */
- m2mb_os_free((INT16*) data->data);
-
- break;
-
- default:
- AZX_LOG_INFO("Unknown object instance. <%d>\r\n", objId);
- break;
- }
- }
- break;
-
- case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
- AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
- break;
-
- default:
- AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
- break;
- }
-
- break;
- }
-
- case M2MB_LWM2M_SRV_INFO_IND: {
-
- AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
- M2MB_LWM2M_SRV_INFO_IND_T *resp =
- (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
-
- switch (resp->info) {
- case M2MB_LWM2M_CL_STATE_DISABLED:
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERING:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
- M2MB_OS_EV_SET);
- break;
- case M2MB_LWM2M_CL_STATE_DEREGISTERING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_SUSPENDED:
- AZX_LOG_DEBUG("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;
- }
-
- case M2MB_LWM2M_SESSION_INFO_IND:
- {
- AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
- M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
-
- if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
- {
- M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
- AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
- /* example
- if( currData->obj == 3303 && currData->resource == 5605)
- {
- AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("executed another resource");
- }*/
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_mon() */
- case M2MB_LWM2M_MON_RES:
- {
- AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
-
- 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_get_stat() */
- case M2MB_LWM2M_GET_STAT_RES:
- {
- AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
- break;
- }
-
- default:
- AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
- break;
- }
+ UINT16 resp_size, void *resp_struct, void *userdata) {
+ (void) h;
+ (void) resp_size;
+ (void) userdata;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
}
/*-----------------------------------------------------------------------------------------------*/
uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
- 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;
-
- lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
-
- int i;
- M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
-
- if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
- }
-
- AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
-
- /* 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");
- return -1;
- } else {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- //get the handle of the lwm2m client on lwm2mHandle
- retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
-
- 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- 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_os_sem_deinit(lwm2m_CSSemHandle);
-
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
-
- //AT#LWM2MENA=1
- memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
-
- 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_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- if (M2MB_OS_SUCCESS
- != m2mb_os_ev_get(eventsHandleLwm2m,
- 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");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- azx_sleep_ms(1000);
-
-
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- AZX_LOG_DEBUG("LWM2M registered\r\n");
-
- azx_sleep_ms(1000);
-
- for (i = 0; i < obj_num; i++)
- {
- M2MB_LWM2M_OBJ_URI_T uri;
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
-
- /*new object instance information*/
- uri.obj = objs[i].obj_id;
-
- new_inst_params.agent = 0; /*Telit Agent*/
-
- int j;
- for (j = 0; j < objs[i].inst_num; j++)
- {
-
- AZX_LOG_TRACE( "Creating new instance %d\r\n", j);
-
- uri.objInst = objs[i].instances_ids[j];
- uri.resource = 0;
- uri.resourceInst = 0;
- uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- /*If OK the instance was not present, and so it was created. If an error
- is received, it is likely because the instance already exists.*/
-
- INT16 *index = NULL;
-
- if (lwm2mUserData)
- {
-
- switch( lwm2mUserData->objID )
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
- {
- index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
- if(!index)
- {
- AZX_LOG_ERROR( "Cannot allocate memory\r\n");
- //TODO check if needed free resources
- return M2MB_RESULT_FAIL;
- }
- *index = objs[i].instances_ids[j];
- lwm2mUserData->data = (void*) index;
-
- break;
- }
- default:
- break;
- }
- }
-
- retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- return M2MB_RESULT_FAIL;
- }
-
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_NEW_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(1000) /*wait 10 seconds for the event to occur*/
- );
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- azx_sleep_ms(2000);
- return M2MB_RESULT_FAIL;
- }
-
- AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
-
- } //for (j = 0; j < objs[i].inst_num; j++)
-
-
- } //for (i = 0; i < obj_num; i++)
-
- return 0;
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
}
/*-----------------------------------------------------------------------------------------------*/
void update_tamper_LWM2MObject(int value)
{
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
- &value, sizeof(int));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
- &_t, sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
-
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
- INT16 _acc) {
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int check_xml_file(const char *name) {
- char path[64] = { 0 };
- struct M2MB_STAT info;
- sprintf(path, "/XML/%s", name);
- AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
-
- if (0 == m2mb_fs_stat(path, &info)) {
- AZX_LOG_DEBUG("File is present, continue...\r\n");
- return 0;
- } else {
- INT32 last_errno = m2mb_fs_get_errno_value();
-
- if (last_errno == M2MB_FS_ENOENT) {
- AZX_LOG_WARN("File not found.\r\n");
- return -1;
- } else {
- AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
- last_errno);
- return -2;
- }
- }
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
{
-
- *lightObjs = light_control_obj_table;
-
- return 1;
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
int copy_xml_file(const char *name) {
- char inpath[64] = { 0 };
- char outpath[64] = { 0 };
- char data[256];
- INT32 in_fd, out_fd;
- sprintf(inpath, "/mod/%s", name);
- sprintf(outpath, "/XML/%s", name);
- in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
-
- if (-1 == in_fd) {
- AZX_LOG_ERROR("cannot find input file! abort.\r\n");
- return -1;
- } else {
- out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
-
- if (-1 == out_fd) {
- AZX_LOG_ERROR("cannot create output file! abort.\r\n");
- return -2;
- } else {
- struct M2MB_STAT stats;
- UINT32 filesize;
- UINT32 written = 0;
- UINT32 chunk = sizeof(data);
- AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
-
- if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
- AZX_LOG_ERROR("cannot stat input file! abort\r\n");
- return -3;
- } else {
- filesize = stats.st_size;
- AZX_LOG_DEBUG("File size: %u\r\n", filesize);
-
- if (chunk > filesize) {
- AZX_LOG_DEBUG(
- "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
- chunk, filesize);
- chunk = filesize;
- }
-
- while (1) {
- SSIZE_T res = 0;
- res = m2mb_fs_read(in_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "read is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -4;
- }
-
- res = m2mb_fs_write(out_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "written is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -5;
- }
-
- AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
- chunk);
- written += chunk;
-
- if ((filesize - written) < chunk) {
- chunk = filesize - written;
- }
-
- if (written == filesize) {
- AZX_LOG_DEBUG("file written. \r\n");
- break;
- }
- }
-
- return 0;
- }
- }
- }
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
}
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
{
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
- if (lwm2mHandle == NULL)
- {
- AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
- return -1;
- }
- retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
- return -1;
- }
- AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- 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*/
- );
-
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- return 1;
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
}
int lwm2m_ReadTaskRegister(INT32 taskID) {
- if (taskID > 0) {
- dataTaskID = taskID;
- return 1;
- }
- return -1;
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
}
M2MB_LWM2M_HANDLE getLwM2mHandle()
{
- return lwm2mHandle;
+ return lwm2mHandle;
}
M2MB_OS_EV_HANDLE getEventHandle()
{
- return eventsHandleLwm2m;
+ return eventsHandleLwm2m;
}
diff --git a/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.h b/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.h
index 0a5c667..b991703 100644
--- a/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.h
+++ b/Samples/BRAVO_LED_Demo/src/demo_utils/lwm2m.h
@@ -30,8 +30,9 @@
/* Global defines ================================================================================*/
/*OBJECTs and RESOURCEs IDs*/
-#define M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID 3311
-#define OBJECT_XML_NAME "object_3311.xml"
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
#define LIGHT_CONTROL_OBJ_TIME_ID 5852
@@ -40,18 +41,35 @@
#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
#define TAMPERING_OBJ_ID 26242
#define ENVIRONMENT_OBJ_ID 26251
#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
-#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
-#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000003
-#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_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
#define EV_MON_URC_RECEIVED 2
#define EV_LWM2M_WRITE_APP_TYPE 3
#define CTX_ID 1 //default cid used by lwm2m
@@ -107,6 +125,19 @@ void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size
void *userdata );
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
/**
@brief Initialize OneEdge connection
@param[in] obj_id Object ID to be used for initialization
@@ -190,12 +221,12 @@ int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
int lwm2m_ReadTaskRegister( INT32 taskID);
/**
- @brief Retrun the lwm2m handle
+ @brief Return the lwm2m handle
*/
M2MB_LWM2M_HANDLE getLwM2mHandle();
/**
- @brief Retrun the event lwm2m handle
+ @brief Return the event lwm2m handle
*/
M2MB_OS_EV_HANDLE getEventHandle();
@@ -212,5 +243,42 @@ M2MB_OS_EV_HANDLE getEventHandle();
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_MultiSensorsDemo/BOSCH/BME680/bme680.c b/Samples/BRAVO_MultiSensorsDemo/BOSCH/BME680/bme680.c
index 5b138c0..7fafc30 100644
--- a/Samples/BRAVO_MultiSensorsDemo/BOSCH/BME680/bme680.c
+++ b/Samples/BRAVO_MultiSensorsDemo/BOSCH/BME680/bme680.c
@@ -619,7 +619,7 @@ int8_t bme680_set_sensor_mode(struct bme680_dev *dev)
int8_t bme680_get_sensor_mode(struct bme680_dev *dev)
{
int8_t rslt;
- uint8_t mode;
+ uint8_t mode = 0;
/* Check for null pointer in the device structure*/
rslt = null_ptr_check(dev);
diff --git a/Samples/BRAVO_MultiSensorsDemo/Makefile.in b/Samples/BRAVO_MultiSensorsDemo/Makefile.in
index 3fbc0c6..d9bf071 100644
--- a/Samples/BRAVO_MultiSensorsDemo/Makefile.in
+++ b/Samples/BRAVO_MultiSensorsDemo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.0.7
+SW_VER = 1.0.8
CLEAN_BEFORE_BUILD = clean
@@ -50,9 +50,18 @@ CPPFLAGS += -I azx/hdr
OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
CPPFLAGS += -I src/demo_utils
OBJS += $(patsubst %.c,%.o,$(wildcard src/demo_utils/*.c))
+
+ifneq ($(strip $(BOSCH_BSEC)),0)
+
+CPPFLAGS += -DBOSCH_BSEC=1
+
CPPFLAGS += -I BOSCH/BHI160/firmware -I BOSCH/BHI160/inc
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BHI160/src/*.c))
CPPFLAGS += -I BOSCH/BME680
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BME680/*.c))
CPPFLAGS += -I BOSCH/BSEC
LDDFLAGS += ./BOSCH/BSEC/libalgobsec.ar -lc -lm -lnosys -lgcc --gc-sections --no-keep-memory
+else
+CPPFLAGS += -DBOSCH_BSEC=0
+endif
+
diff --git a/Samples/BRAVO_MultiSensorsDemo/azx/hdr/azx_log.h b/Samples/BRAVO_MultiSensorsDemo/azx/hdr/azx_log.h
index aacac59..76d26ee 100644
--- a/Samples/BRAVO_MultiSensorsDemo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_MultiSensorsDemo/azx/hdr/azx_log.h
@@ -5,7 +5,7 @@
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.8
+ * @version 1.0.9
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -60,6 +60,7 @@ typedef enum
AZX_LOG_USB_CABLE_UNPLUGGED, /** 3)
{
- return -1;
+ return ret;
}
sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
@@ -137,20 +133,17 @@ int open_LED( int index )
M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
);
-
- if( ret == -1 )
+ if( ret != -1 )
{
- return -1;
+ ret = 0;
}
-
- return 0;
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/i2c.c b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/i2c.c
index ae9a145..a5b6d43 100644
--- a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/i2c.c
+++ b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/i2c.c
@@ -180,16 +180,16 @@ int8_t sensor_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t s
{
size = size - tmpsize;
reg = reg + tmpsize;
- p_buf = p_buf + tmpsize;
+
AZX_LOG_TRACE( "Reading Success.\r\n" );
AZX_LOG_TRACE( "i2c->" );
-
- for( int i = 1; i < i2c_res; i++ )
+ for( int i = 0; i < i2c_res; i++ )
{
AZX_LOG_TRACE( " %02x", p_buf[i] );
}
-
AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
}
else
{
diff --git a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.c b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.c
index c98d520..12199e9 100644
--- a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.c
@@ -44,9 +44,9 @@
#include "lwm2m.h"
/* Local defines ================================================================================*/
-#define GPIO_INDEX_RED 0
-#define GPIO_INDEX_YELLOW 1
-#define GPIO_INDEX_GREEN 2
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
/* Local typedefs ===============================================================================*/
@@ -54,848 +54,1272 @@
static INT32 dataTaskID = -1;
static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+static BOOLEAN bootstrapped = FALSE;
+
/* HANDLER */
static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
-static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
/* ONEEDGE */
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
- .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
- 1, 0 };
+ 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
- 2, 0 };
+ 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
- 3, 0 };
+ 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
- 0, 4, 0 };
+ 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
- { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
- { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
- { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
- { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
- { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
- LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
- { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
};
/* Local function prototypes ====================================================================*/
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId);
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
/* Static functions =============================================================================*/
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId) {
- (void)event;
-
- AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
-
- UINT32 curEvBits;
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- /* Fill resource URI with required parameters */
- resource_uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
- resource_uri.objInst = index;
- resource_uri.resourceInst = 0;
- resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
-
- AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
- light_control_obj_table[index].appType);
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
- light_control_obj_table[index].appType,
- strlen(light_control_obj_table[index].appType));
- //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;
- }
-
- /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
-
-
- AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
- INT32 r = azx_tasks_destroyTask((INT8) taskId);
- AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
- taskId);
-
- return 1;
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
}
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
- INT8 appTypeTaskID;
- appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
- AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
- writeLightControlAppTypeTask);
-
- AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
- if (appTypeTaskID <= 0) {
- AZX_LOG_ERROR(
- "Cannot create lwm2m application type managing task!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
- (INT32) appTypeTaskID);
-
- return M2MB_RESULT_SUCCESS;
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
}
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
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;
-
- /* Client generated events */
- switch (event) {
-
- 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_TRACE("LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
-
- AZX_LOG_WARN("Enable result %d\r\n", resp->result);
- }
- break;
- }
-
- 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_DEBUG("LWM2M set result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("set result %d\r\n", resp->result);
- }
- 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;
- AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
- AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
- if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
- }
- break;
- }
-
- 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("LWM2M write result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("Enable write %d\r\n", resp->result);
- }
- 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 && dataTaskID != -1)
- {
- 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);
- p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
- }
- else
- {
- AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
- }
-
- break;
- }
-
- 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;
-
- LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
-
- switch( resp->result )
- {
- case M2MB_LWM2M_RES_SUCCESS:
-
- AZX_LOG_TRACE("New Instance created successfully\r\n");
-
- if (userdata)
- {
- INT32 objId = data->objID;
- INT16 *index = (INT16*) data->data;
- AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
-
- switch (objId)
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
-
- azx_sleep_ms(4000);
-
- // start task to write the resource
- if (writeLightControlApplicationType(
- M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("Error writing application Type resource\r\n");
- }
-
- /* free the resource allocated in to oneedge_init */
- m2mb_os_free((INT16*) data->data);
-
- break;
-
- default:
- AZX_LOG_INFO("Unknown object instance. <%d>\r\n", objId);
- break;
- }
- }
- break;
-
- case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
- AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
- break;
-
- default:
- AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
- break;
- }
-
- break;
- }
-
- case M2MB_LWM2M_SRV_INFO_IND: {
-
- AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
- M2MB_LWM2M_SRV_INFO_IND_T *resp =
- (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
-
- switch (resp->info) {
- case M2MB_LWM2M_CL_STATE_DISABLED:
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERING:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
- M2MB_OS_EV_SET);
- break;
- case M2MB_LWM2M_CL_STATE_DEREGISTERING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_SUSPENDED:
- AZX_LOG_DEBUG("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;
- }
-
- case M2MB_LWM2M_SESSION_INFO_IND:
- {
- AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
- M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
-
- if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
- {
- M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
- AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
- /* example
- if( currData->obj == 3303 && currData->resource == 5605)
- {
- AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("executed another resource");
- }*/
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_mon() */
- case M2MB_LWM2M_MON_RES:
- {
- AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
-
- 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_get_stat() */
- case M2MB_LWM2M_GET_STAT_RES:
- {
- AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
- break;
- }
-
- default:
- AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
- break;
- }
+ UINT16 resp_size, void *resp_struct, void *userdata) {
+ (void) h;
+ (void) resp_size;
+ (void) userdata;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
}
/*-----------------------------------------------------------------------------------------------*/
uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
- 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;
-
- lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
-
- int i;
- M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
-
- if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
- }
-
- AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
-
- /* 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");
- return -1;
- } else {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- //get the handle of the lwm2m client on lwm2mHandle
- retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
-
- 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- 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_os_sem_deinit(lwm2m_CSSemHandle);
-
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
-
- //AT#LWM2MENA=1
- memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
-
- 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_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- if (M2MB_OS_SUCCESS
- != m2mb_os_ev_get(eventsHandleLwm2m,
- 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");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- azx_sleep_ms(1000);
-
-
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- AZX_LOG_DEBUG("LWM2M registered\r\n");
-
- azx_sleep_ms(1000);
-
- for (i = 0; i < obj_num; i++)
- {
- M2MB_LWM2M_OBJ_URI_T uri;
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
-
- /*new object instance information*/
- uri.obj = objs[i].obj_id;
-
- new_inst_params.agent = 0; /*Telit Agent*/
-
- int j;
- for (j = 0; j < objs[i].inst_num; j++)
- {
-
- AZX_LOG_TRACE( "Creating new instance %d\r\n", j);
-
- uri.objInst = objs[i].instances_ids[j];
- uri.resource = 0;
- uri.resourceInst = 0;
- uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- /*If OK the instance was not present, and so it was created. If an error
- is received, it is likely because the instance already exists.*/
-
- INT16 *index = NULL;
-
- if (lwm2mUserData)
- {
-
- switch( lwm2mUserData->objID )
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
- {
- index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
- if(!index)
- {
- AZX_LOG_ERROR( "Cannot allocate memory\r\n");
- //TODO check if needed free resources
- return M2MB_RESULT_FAIL;
- }
- *index = objs[i].instances_ids[j];
- lwm2mUserData->data = (void*) index;
-
- break;
- }
- default:
- break;
- }
- }
-
- retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- return M2MB_RESULT_FAIL;
- }
-
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_NEW_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(1000) /*wait 10 seconds for the event to occur*/
- );
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- azx_sleep_ms(2000);
- return M2MB_RESULT_FAIL;
- }
-
- AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
-
- } //for (j = 0; j < objs[i].inst_num; j++)
-
-
- } //for (i = 0; i < obj_num; i++)
-
- return 0;
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
}
/*-----------------------------------------------------------------------------------------------*/
void update_tamper_LWM2MObject(int value)
{
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
- &value, sizeof(int));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
- &_t, sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
-
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
- INT16 _acc) {
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int check_xml_file(const char *name) {
- char path[64] = { 0 };
- struct M2MB_STAT info;
- sprintf(path, "/XML/%s", name);
- AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
-
- if (0 == m2mb_fs_stat(path, &info)) {
- AZX_LOG_DEBUG("File is present, continue...\r\n");
- return 0;
- } else {
- INT32 last_errno = m2mb_fs_get_errno_value();
-
- if (last_errno == M2MB_FS_ENOENT) {
- AZX_LOG_WARN("File not found.\r\n");
- return -1;
- } else {
- AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
- last_errno);
- return -2;
- }
- }
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
{
-
- *lightObjs = light_control_obj_table;
-
- return 1;
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
int copy_xml_file(const char *name) {
- char inpath[64] = { 0 };
- char outpath[64] = { 0 };
- char data[256];
- INT32 in_fd, out_fd;
- sprintf(inpath, "/mod/%s", name);
- sprintf(outpath, "/XML/%s", name);
- in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
-
- if (-1 == in_fd) {
- AZX_LOG_ERROR("cannot find input file! abort.\r\n");
- return -1;
- } else {
- out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
-
- if (-1 == out_fd) {
- AZX_LOG_ERROR("cannot create output file! abort.\r\n");
- return -2;
- } else {
- struct M2MB_STAT stats;
- UINT32 filesize;
- UINT32 written = 0;
- UINT32 chunk = sizeof(data);
- AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
-
- if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
- AZX_LOG_ERROR("cannot stat input file! abort\r\n");
- return -3;
- } else {
- filesize = stats.st_size;
- AZX_LOG_DEBUG("File size: %u\r\n", filesize);
-
- if (chunk > filesize) {
- AZX_LOG_DEBUG(
- "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
- chunk, filesize);
- chunk = filesize;
- }
-
- while (1) {
- SSIZE_T res = 0;
- res = m2mb_fs_read(in_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "read is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -4;
- }
-
- res = m2mb_fs_write(out_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "written is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -5;
- }
-
- AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
- chunk);
- written += chunk;
-
- if ((filesize - written) < chunk) {
- chunk = filesize - written;
- }
-
- if (written == filesize) {
- AZX_LOG_DEBUG("file written. \r\n");
- break;
- }
- }
-
- return 0;
- }
- }
- }
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
}
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
{
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
- if (lwm2mHandle == NULL)
- {
- AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
- return -1;
- }
- retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
- return -1;
- }
- AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- 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*/
- );
-
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- return 1;
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
}
int lwm2m_ReadTaskRegister(INT32 taskID) {
- if (taskID > 0) {
- dataTaskID = taskID;
- return 1;
- }
- return -1;
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
}
M2MB_LWM2M_HANDLE getLwM2mHandle()
{
- return lwm2mHandle;
+ return lwm2mHandle;
}
M2MB_OS_EV_HANDLE getEventHandle()
{
- return eventsHandleLwm2m;
+ return eventsHandleLwm2m;
}
diff --git a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.h b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.h
index 0a5c667..b991703 100644
--- a/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.h
+++ b/Samples/BRAVO_MultiSensorsDemo/src/demo_utils/lwm2m.h
@@ -30,8 +30,9 @@
/* Global defines ================================================================================*/
/*OBJECTs and RESOURCEs IDs*/
-#define M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID 3311
-#define OBJECT_XML_NAME "object_3311.xml"
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
#define LIGHT_CONTROL_OBJ_TIME_ID 5852
@@ -40,18 +41,35 @@
#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
#define TAMPERING_OBJ_ID 26242
#define ENVIRONMENT_OBJ_ID 26251
#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
-#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
-#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000003
-#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_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
#define EV_MON_URC_RECEIVED 2
#define EV_LWM2M_WRITE_APP_TYPE 3
#define CTX_ID 1 //default cid used by lwm2m
@@ -107,6 +125,19 @@ void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size
void *userdata );
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
/**
@brief Initialize OneEdge connection
@param[in] obj_id Object ID to be used for initialization
@@ -190,12 +221,12 @@ int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
int lwm2m_ReadTaskRegister( INT32 taskID);
/**
- @brief Retrun the lwm2m handle
+ @brief Return the lwm2m handle
*/
M2MB_LWM2M_HANDLE getLwM2mHandle();
/**
- @brief Retrun the event lwm2m handle
+ @brief Return the event lwm2m handle
*/
M2MB_OS_EV_HANDLE getEventHandle();
@@ -212,5 +243,42 @@ M2MB_OS_EV_HANDLE getEventHandle();
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_MultiSensorsDemo/src/sensors_demo.c b/Samples/BRAVO_MultiSensorsDemo/src/sensors_demo.c
index ebaae33..d4c6531 100644
--- a/Samples/BRAVO_MultiSensorsDemo/src/sensors_demo.c
+++ b/Samples/BRAVO_MultiSensorsDemo/src/sensors_demo.c
@@ -13,7 +13,7 @@
m2mb_types.h
@author
- FabioPi
+ FabioPi
@date
01/12/2020
*/
@@ -434,6 +434,7 @@ static void state_save( const uint8_t *state_buffer, uint32_t length )
/*-----------------------------------------------------------------------------------------------*/
static uint32_t config_load( uint8_t *config_buffer, uint32_t n_buffer )
{
+ uint32_t ret = 0;
// ...
// Load a library config from non-volatile memory, if available.
//
@@ -443,15 +444,15 @@ static uint32_t config_load( uint8_t *config_buffer, uint32_t n_buffer )
if( n_buffer < sizeof( bsec_config_iaq ) )
{
memcpy( config_buffer, bsec_config_iaq, n_buffer );
- return n_buffer;
+ ret = n_buffer;
}
else
{
memcpy( config_buffer, bsec_config_iaq, sizeof( bsec_config_iaq ) );
- return sizeof( bsec_config_iaq );
+ ret = sizeof( bsec_config_iaq );
}
- return 0;
+ return ret;
}
@@ -710,7 +711,7 @@ void trace_log( const char *fmt, ... )
va_start( arg, fmt );
vsnprintf( log_buffer, sizeof( log_buffer ), fmt, arg );
va_end( arg );
- AZX_LOG_INFO( log_buffer );
+ AZX_LOG_INFO( "%s", log_buffer );
}
/* Global functions =============================================================================*/
diff --git a/Samples/BRAVO_Rotation_Demo/Makefile.in b/Samples/BRAVO_Rotation_Demo/Makefile.in
index fa8e001..98ba78d 100644
--- a/Samples/BRAVO_Rotation_Demo/Makefile.in
+++ b/Samples/BRAVO_Rotation_Demo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.0.7
+SW_VER = 1.0.8
CLEAN_BEFORE_BUILD = clean
@@ -50,5 +50,14 @@ CPPFLAGS += -I azx/hdr
OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
CPPFLAGS += -I src/demo_utils
OBJS += $(patsubst %.c,%.o,$(wildcard src/demo_utils/*.c))
+
+ifneq ($(strip $(BOSCH_BSEC)),0)
+
+CPPFLAGS += -DBOSCH_BSEC=1
+
CPPFLAGS += -I BOSCH/BHI160/firmware -I BOSCH/BHI160/inc
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BHI160/src/*.c))
+else
+CPPFLAGS += -DBOSCH_BSEC=0
+endif
+
diff --git a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
index aacac59..76d26ee 100644
--- a/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Rotation_Demo/azx/hdr/azx_log.h
@@ -5,7 +5,7 @@
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.8
+ * @version 1.0.9
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -60,6 +60,7 @@ typedef enum
AZX_LOG_USB_CABLE_UNPLUGGED, /** 3)
{
- return -1;
+ return ret;
}
sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
@@ -137,20 +133,17 @@ int open_LED( int index )
M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
);
-
- if( ret == -1 )
+ if( ret != -1 )
{
- return -1;
+ ret = 0;
}
-
- return 0;
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_Rotation_Demo/src/demo_utils/i2c.c b/Samples/BRAVO_Rotation_Demo/src/demo_utils/i2c.c
index ae9a145..a5b6d43 100644
--- a/Samples/BRAVO_Rotation_Demo/src/demo_utils/i2c.c
+++ b/Samples/BRAVO_Rotation_Demo/src/demo_utils/i2c.c
@@ -180,16 +180,16 @@ int8_t sensor_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t s
{
size = size - tmpsize;
reg = reg + tmpsize;
- p_buf = p_buf + tmpsize;
+
AZX_LOG_TRACE( "Reading Success.\r\n" );
AZX_LOG_TRACE( "i2c->" );
-
- for( int i = 1; i < i2c_res; i++ )
+ for( int i = 0; i < i2c_res; i++ )
{
AZX_LOG_TRACE( " %02x", p_buf[i] );
}
-
AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
}
else
{
diff --git a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
index c98d520..12199e9 100644
--- a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.c
@@ -44,9 +44,9 @@
#include "lwm2m.h"
/* Local defines ================================================================================*/
-#define GPIO_INDEX_RED 0
-#define GPIO_INDEX_YELLOW 1
-#define GPIO_INDEX_GREEN 2
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
/* Local typedefs ===============================================================================*/
@@ -54,848 +54,1272 @@
static INT32 dataTaskID = -1;
static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+static BOOLEAN bootstrapped = FALSE;
+
/* HANDLER */
static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
-static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
/* ONEEDGE */
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
- .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
- 1, 0 };
+ 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
- 2, 0 };
+ 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
- 3, 0 };
+ 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
- 0, 4, 0 };
+ 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
- { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
- { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
- { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
- { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
- { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
- LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
- { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
};
/* Local function prototypes ====================================================================*/
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId);
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
/* Static functions =============================================================================*/
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId) {
- (void)event;
-
- AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
-
- UINT32 curEvBits;
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- /* Fill resource URI with required parameters */
- resource_uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
- resource_uri.objInst = index;
- resource_uri.resourceInst = 0;
- resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
-
- AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
- light_control_obj_table[index].appType);
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
- light_control_obj_table[index].appType,
- strlen(light_control_obj_table[index].appType));
- //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;
- }
-
- /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
-
-
- AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
- INT32 r = azx_tasks_destroyTask((INT8) taskId);
- AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
- taskId);
-
- return 1;
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
}
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
- INT8 appTypeTaskID;
- appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
- AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
- writeLightControlAppTypeTask);
-
- AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
- if (appTypeTaskID <= 0) {
- AZX_LOG_ERROR(
- "Cannot create lwm2m application type managing task!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
- (INT32) appTypeTaskID);
-
- return M2MB_RESULT_SUCCESS;
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
}
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
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;
-
- /* Client generated events */
- switch (event) {
-
- 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_TRACE("LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
-
- AZX_LOG_WARN("Enable result %d\r\n", resp->result);
- }
- break;
- }
-
- 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_DEBUG("LWM2M set result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("set result %d\r\n", resp->result);
- }
- 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;
- AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
- AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
- if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
- }
- break;
- }
-
- 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("LWM2M write result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("Enable write %d\r\n", resp->result);
- }
- 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 && dataTaskID != -1)
- {
- 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);
- p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
- }
- else
- {
- AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
- }
-
- break;
- }
-
- 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;
-
- LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
-
- switch( resp->result )
- {
- case M2MB_LWM2M_RES_SUCCESS:
-
- AZX_LOG_TRACE("New Instance created successfully\r\n");
-
- if (userdata)
- {
- INT32 objId = data->objID;
- INT16 *index = (INT16*) data->data;
- AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
-
- switch (objId)
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
-
- azx_sleep_ms(4000);
-
- // start task to write the resource
- if (writeLightControlApplicationType(
- M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("Error writing application Type resource\r\n");
- }
-
- /* free the resource allocated in to oneedge_init */
- m2mb_os_free((INT16*) data->data);
-
- break;
-
- default:
- AZX_LOG_INFO("Unknown object instance. <%d>\r\n", objId);
- break;
- }
- }
- break;
-
- case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
- AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
- break;
-
- default:
- AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
- break;
- }
-
- break;
- }
-
- case M2MB_LWM2M_SRV_INFO_IND: {
-
- AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
- M2MB_LWM2M_SRV_INFO_IND_T *resp =
- (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
-
- switch (resp->info) {
- case M2MB_LWM2M_CL_STATE_DISABLED:
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERING:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
- M2MB_OS_EV_SET);
- break;
- case M2MB_LWM2M_CL_STATE_DEREGISTERING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_SUSPENDED:
- AZX_LOG_DEBUG("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;
- }
-
- case M2MB_LWM2M_SESSION_INFO_IND:
- {
- AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
- M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
-
- if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
- {
- M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
- AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
- /* example
- if( currData->obj == 3303 && currData->resource == 5605)
- {
- AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("executed another resource");
- }*/
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_mon() */
- case M2MB_LWM2M_MON_RES:
- {
- AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
-
- 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_get_stat() */
- case M2MB_LWM2M_GET_STAT_RES:
- {
- AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
- break;
- }
-
- default:
- AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
- break;
- }
+ UINT16 resp_size, void *resp_struct, void *userdata) {
+ (void) h;
+ (void) resp_size;
+ (void) userdata;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
}
/*-----------------------------------------------------------------------------------------------*/
uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
- 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;
-
- lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
-
- int i;
- M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
-
- if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
- }
-
- AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
-
- /* 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");
- return -1;
- } else {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- //get the handle of the lwm2m client on lwm2mHandle
- retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
-
- 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- 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_os_sem_deinit(lwm2m_CSSemHandle);
-
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
-
- //AT#LWM2MENA=1
- memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
-
- 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_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- if (M2MB_OS_SUCCESS
- != m2mb_os_ev_get(eventsHandleLwm2m,
- 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");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- azx_sleep_ms(1000);
-
-
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- AZX_LOG_DEBUG("LWM2M registered\r\n");
-
- azx_sleep_ms(1000);
-
- for (i = 0; i < obj_num; i++)
- {
- M2MB_LWM2M_OBJ_URI_T uri;
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
-
- /*new object instance information*/
- uri.obj = objs[i].obj_id;
-
- new_inst_params.agent = 0; /*Telit Agent*/
-
- int j;
- for (j = 0; j < objs[i].inst_num; j++)
- {
-
- AZX_LOG_TRACE( "Creating new instance %d\r\n", j);
-
- uri.objInst = objs[i].instances_ids[j];
- uri.resource = 0;
- uri.resourceInst = 0;
- uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- /*If OK the instance was not present, and so it was created. If an error
- is received, it is likely because the instance already exists.*/
-
- INT16 *index = NULL;
-
- if (lwm2mUserData)
- {
-
- switch( lwm2mUserData->objID )
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
- {
- index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
- if(!index)
- {
- AZX_LOG_ERROR( "Cannot allocate memory\r\n");
- //TODO check if needed free resources
- return M2MB_RESULT_FAIL;
- }
- *index = objs[i].instances_ids[j];
- lwm2mUserData->data = (void*) index;
-
- break;
- }
- default:
- break;
- }
- }
-
- retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- return M2MB_RESULT_FAIL;
- }
-
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_NEW_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(1000) /*wait 10 seconds for the event to occur*/
- );
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- azx_sleep_ms(2000);
- return M2MB_RESULT_FAIL;
- }
-
- AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
-
- } //for (j = 0; j < objs[i].inst_num; j++)
-
-
- } //for (i = 0; i < obj_num; i++)
-
- return 0;
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
}
/*-----------------------------------------------------------------------------------------------*/
void update_tamper_LWM2MObject(int value)
{
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
- &value, sizeof(int));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
- &_t, sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
-
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
- INT16 _acc) {
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int check_xml_file(const char *name) {
- char path[64] = { 0 };
- struct M2MB_STAT info;
- sprintf(path, "/XML/%s", name);
- AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
-
- if (0 == m2mb_fs_stat(path, &info)) {
- AZX_LOG_DEBUG("File is present, continue...\r\n");
- return 0;
- } else {
- INT32 last_errno = m2mb_fs_get_errno_value();
-
- if (last_errno == M2MB_FS_ENOENT) {
- AZX_LOG_WARN("File not found.\r\n");
- return -1;
- } else {
- AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
- last_errno);
- return -2;
- }
- }
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
{
-
- *lightObjs = light_control_obj_table;
-
- return 1;
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
int copy_xml_file(const char *name) {
- char inpath[64] = { 0 };
- char outpath[64] = { 0 };
- char data[256];
- INT32 in_fd, out_fd;
- sprintf(inpath, "/mod/%s", name);
- sprintf(outpath, "/XML/%s", name);
- in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
-
- if (-1 == in_fd) {
- AZX_LOG_ERROR("cannot find input file! abort.\r\n");
- return -1;
- } else {
- out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
-
- if (-1 == out_fd) {
- AZX_LOG_ERROR("cannot create output file! abort.\r\n");
- return -2;
- } else {
- struct M2MB_STAT stats;
- UINT32 filesize;
- UINT32 written = 0;
- UINT32 chunk = sizeof(data);
- AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
-
- if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
- AZX_LOG_ERROR("cannot stat input file! abort\r\n");
- return -3;
- } else {
- filesize = stats.st_size;
- AZX_LOG_DEBUG("File size: %u\r\n", filesize);
-
- if (chunk > filesize) {
- AZX_LOG_DEBUG(
- "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
- chunk, filesize);
- chunk = filesize;
- }
-
- while (1) {
- SSIZE_T res = 0;
- res = m2mb_fs_read(in_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "read is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -4;
- }
-
- res = m2mb_fs_write(out_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "written is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -5;
- }
-
- AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
- chunk);
- written += chunk;
-
- if ((filesize - written) < chunk) {
- chunk = filesize - written;
- }
-
- if (written == filesize) {
- AZX_LOG_DEBUG("file written. \r\n");
- break;
- }
- }
-
- return 0;
- }
- }
- }
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
}
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
{
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
- if (lwm2mHandle == NULL)
- {
- AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
- return -1;
- }
- retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
- return -1;
- }
- AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- 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*/
- );
-
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- return 1;
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
}
int lwm2m_ReadTaskRegister(INT32 taskID) {
- if (taskID > 0) {
- dataTaskID = taskID;
- return 1;
- }
- return -1;
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
}
M2MB_LWM2M_HANDLE getLwM2mHandle()
{
- return lwm2mHandle;
+ return lwm2mHandle;
}
M2MB_OS_EV_HANDLE getEventHandle()
{
- return eventsHandleLwm2m;
+ return eventsHandleLwm2m;
}
diff --git a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.h b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.h
index 0a5c667..b991703 100644
--- a/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.h
+++ b/Samples/BRAVO_Rotation_Demo/src/demo_utils/lwm2m.h
@@ -30,8 +30,9 @@
/* Global defines ================================================================================*/
/*OBJECTs and RESOURCEs IDs*/
-#define M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID 3311
-#define OBJECT_XML_NAME "object_3311.xml"
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
#define LIGHT_CONTROL_OBJ_TIME_ID 5852
@@ -40,18 +41,35 @@
#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
#define TAMPERING_OBJ_ID 26242
#define ENVIRONMENT_OBJ_ID 26251
#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
-#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
-#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000003
-#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_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
#define EV_MON_URC_RECEIVED 2
#define EV_LWM2M_WRITE_APP_TYPE 3
#define CTX_ID 1 //default cid used by lwm2m
@@ -107,6 +125,19 @@ void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size
void *userdata );
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
/**
@brief Initialize OneEdge connection
@param[in] obj_id Object ID to be used for initialization
@@ -190,12 +221,12 @@ int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
int lwm2m_ReadTaskRegister( INT32 taskID);
/**
- @brief Retrun the lwm2m handle
+ @brief Return the lwm2m handle
*/
M2MB_LWM2M_HANDLE getLwM2mHandle();
/**
- @brief Retrun the event lwm2m handle
+ @brief Return the event lwm2m handle
*/
M2MB_OS_EV_HANDLE getEventHandle();
@@ -212,5 +243,42 @@ M2MB_OS_EV_HANDLE getEventHandle();
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_Tampering_Demo/Makefile.in b/Samples/BRAVO_Tampering_Demo/Makefile.in
index fa8e001..98ba78d 100644
--- a/Samples/BRAVO_Tampering_Demo/Makefile.in
+++ b/Samples/BRAVO_Tampering_Demo/Makefile.in
@@ -15,7 +15,7 @@ LOGS_COLOUR = 0
## ---- do not touch below this line
-SW_VER = 1.0.7
+SW_VER = 1.0.8
CLEAN_BEFORE_BUILD = clean
@@ -50,5 +50,14 @@ CPPFLAGS += -I azx/hdr
OBJS += $(patsubst %.c,%.o,$(wildcard azx/src/*.c))
CPPFLAGS += -I src/demo_utils
OBJS += $(patsubst %.c,%.o,$(wildcard src/demo_utils/*.c))
+
+ifneq ($(strip $(BOSCH_BSEC)),0)
+
+CPPFLAGS += -DBOSCH_BSEC=1
+
CPPFLAGS += -I BOSCH/BHI160/firmware -I BOSCH/BHI160/inc
OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BHI160/src/*.c))
+else
+CPPFLAGS += -DBOSCH_BSEC=0
+endif
+
diff --git a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
index aacac59..76d26ee 100644
--- a/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
+++ b/Samples/BRAVO_Tampering_Demo/azx/hdr/azx_log.h
@@ -5,7 +5,7 @@
#define HDR_AZX_LOG_H_
/**
* @file azx_log.h
- * @version 1.0.8
+ * @version 1.0.9
* @dependencies
* @author Fabio Pintus
* @author Ioannis Demetriou
@@ -60,6 +60,7 @@ typedef enum
AZX_LOG_USB_CABLE_UNPLUGGED, /**data_scalar_s16.data;
float time_stamp = ( float )( bhy_system_timestamp ) / TICKS_IN_ONE_SECOND;
-
+
BHI_TAMPER_STATUS_E status = STATUS_INVALID;
-
+
write_LED( M2MB_GPIO_HIGH_VALUE );
@@ -286,7 +286,7 @@ static void demo_sensor( void )
/* firmware, you need to contact your local FAE of Bosch Sensortec. */
//bhy_read_parameter_page(BHY_PAGE_2, PAGE2_CUS_FIRMWARE_VERSION, (uint8_t*)&bhy_cus_version, sizeof(struct cus_version_t));
//DEBUG("cus version base:%d major:%d minor:%d\n", bhy_cus_version.base, bhy_cus_version.major, bhy_cus_version.minor);
-
+
/* enables the activity recognition and assigns the callback */
bhy_enable_virtual_sensor( VS_TYPE_ACTIVITY_RECOGNITION, VS_NON_WAKEUP, 1, 0, VS_FLUSH_NONE, 0, 0 );
bhy_install_sensor_callback( VS_TYPE_ACTIVITY_RECOGNITION, VS_NON_WAKEUP, sensors_tamper_callback );
@@ -301,7 +301,7 @@ static void demo_sensor( void )
azx_sleep_ms( 100 );
write_LED( M2MB_GPIO_LOW_VALUE );
azx_sleep_ms( 100 );
-
+
AZX_LOG_INFO( "System is now monitoring activity.\r\n" );
/* wait for the push-button to be pressed */
@@ -379,10 +379,10 @@ void M2MB_main( int argc, char **argv )
{
( void )argc;
( void )argv;
-
+
INT16 instances[] = {0};
LWM2M_OBJ_REG_T obj = {TAMPERING_OBJ_ID, 1, instances };
-
+
/* SET output channel */
AZX_LOG_INIT();
AZX_LOG_INFO( "Starting Tampering Demo app. This is v%s built on %s %s.\r\n",
diff --git a/Samples/BRAVO_Tampering_Demo/src/demo_utils/gpio.c b/Samples/BRAVO_Tampering_Demo/src/demo_utils/gpio.c
index 7ce3425..0c7a008 100644
--- a/Samples/BRAVO_Tampering_Demo/src/demo_utils/gpio.c
+++ b/Samples/BRAVO_Tampering_Demo/src/demo_utils/gpio.c
@@ -72,7 +72,7 @@ int close_gpio( int *pin )
/*-----------------------------------------------------------------------------------------------*/
int open_gpio( int pin )
{
- INT32 ret;
+ INT32 ret = -1;
char path[32];
memset( path, 0, sizeof( path ) );
sprintf( path, "/dev/GPIO%d", pin );
@@ -96,33 +96,29 @@ int open_gpio( int pin )
M2MB_GPIO_IOCTL_INIT_INTR, ( UINT32 )NULL ) /*enable interrupts*/
);
- if( ret == -1 )
- {
- return -1;
- }
- else
+ if( ret != -1 )
{
- return 0;
+ ret = 0;
}
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
int open_LED( int index )
{
- INT32 ret;
+ INT32 ret = -1;
char path[32];
memset( path, 0, sizeof( path ) );
if (index < 0 || index > 3)
{
- return -1;
+ return ret;
}
sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
@@ -137,20 +133,17 @@ int open_LED( int index )
M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
);
-
- if( ret == -1 )
+ if( ret != -1 )
{
- return -1;
+ ret = 0;
}
-
- return 0;
}
else
{
- return 1;
+ ret = 1;
}
- return 0;
+ return ret;
}
/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_Tampering_Demo/src/demo_utils/i2c.c b/Samples/BRAVO_Tampering_Demo/src/demo_utils/i2c.c
index ae9a145..a5b6d43 100644
--- a/Samples/BRAVO_Tampering_Demo/src/demo_utils/i2c.c
+++ b/Samples/BRAVO_Tampering_Demo/src/demo_utils/i2c.c
@@ -180,16 +180,16 @@ int8_t sensor_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t s
{
size = size - tmpsize;
reg = reg + tmpsize;
- p_buf = p_buf + tmpsize;
+
AZX_LOG_TRACE( "Reading Success.\r\n" );
AZX_LOG_TRACE( "i2c->" );
-
- for( int i = 1; i < i2c_res; i++ )
+ for( int i = 0; i < i2c_res; i++ )
{
AZX_LOG_TRACE( " %02x", p_buf[i] );
}
-
AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
}
else
{
diff --git a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
index c98d520..12199e9 100644
--- a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
+++ b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.c
@@ -44,9 +44,9 @@
#include "lwm2m.h"
/* Local defines ================================================================================*/
-#define GPIO_INDEX_RED 0
-#define GPIO_INDEX_YELLOW 1
-#define GPIO_INDEX_GREEN 2
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
/* Local typedefs ===============================================================================*/
@@ -54,848 +54,1272 @@
static INT32 dataTaskID = -1;
static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+static BOOLEAN bootstrapped = FALSE;
+
/* HANDLER */
static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
-static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
/* ONEEDGE */
static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
- .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
- 1, 0 };
+ 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
- 2, 0 };
+ 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
- 3, 0 };
+ 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
- 0, 4, 0 };
+ 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
- { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
- { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
- { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
- { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
- { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
- LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
- LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
- { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
};
/* Local function prototypes ====================================================================*/
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId);
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
/* Static functions =============================================================================*/
static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
- INT32 taskId) {
- (void)event;
-
- AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
-
- UINT32 curEvBits;
- M2MB_LWM2M_OBJ_URI_T resource_uri;
-
- /* Fill resource URI with required parameters */
- resource_uri.obj = M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID;
- resource_uri.objInst = index;
- resource_uri.resourceInst = 0;
- resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
- resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
-
- AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
- light_control_obj_table[index].appType);
-
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
- light_control_obj_table[index].appType,
- strlen(light_control_obj_table[index].appType));
- //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;
- }
-
- /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
-
-
- AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
- INT32 r = azx_tasks_destroyTask((INT8) taskId);
- AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
- taskId);
-
- return 1;
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
}
static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
- INT8 appTypeTaskID;
- appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
- AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
- writeLightControlAppTypeTask);
-
- AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
- if (appTypeTaskID <= 0) {
- AZX_LOG_ERROR(
- "Cannot create lwm2m application type managing task!\r\n");
- return M2MB_RESULT_FAIL;
- }
-
- azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
- (INT32) appTypeTaskID);
-
- return M2MB_RESULT_SUCCESS;
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
}
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
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;
-
- /* Client generated events */
- switch (event) {
-
- 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_TRACE("LWM2M enable result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
-
- AZX_LOG_WARN("Enable result %d\r\n", resp->result);
- }
- break;
- }
-
- 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_DEBUG("LWM2M set result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("set result %d\r\n", resp->result);
- }
- 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;
- AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
- AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
- if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
- }
- break;
- }
-
- 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("LWM2M write result OK\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_SET);
- } else {
- AZX_LOG_WARN("Enable write %d\r\n", resp->result);
- }
- 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 && dataTaskID != -1)
- {
- 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);
- p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
- }
- else
- {
- AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
- }
-
- break;
- }
-
- 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;
-
- LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
-
- switch( resp->result )
- {
- case M2MB_LWM2M_RES_SUCCESS:
-
- AZX_LOG_TRACE("New Instance created successfully\r\n");
-
- if (userdata)
- {
- INT32 objId = data->objID;
- INT16 *index = (INT16*) data->data;
- AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
-
- switch (objId)
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
-
- azx_sleep_ms(4000);
-
- // start task to write the resource
- if (writeLightControlApplicationType(
- M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("Error writing application Type resource\r\n");
- }
-
- /* free the resource allocated in to oneedge_init */
- m2mb_os_free((INT16*) data->data);
-
- break;
-
- default:
- AZX_LOG_INFO("Unknown object instance. <%d>\r\n", objId);
- break;
- }
- }
- break;
-
- case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
- AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
- break;
-
- default:
- AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
- break;
- }
-
- break;
- }
-
- case M2MB_LWM2M_SRV_INFO_IND: {
-
- AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
- M2MB_LWM2M_SRV_INFO_IND_T *resp =
- (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
-
- switch (resp->info) {
- case M2MB_LWM2M_CL_STATE_DISABLED:
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERING:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_REGISTERED:
- AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
- M2MB_OS_EV_SET);
- break;
- case M2MB_LWM2M_CL_STATE_DEREGISTERING:
- AZX_LOG_DEBUG(
- "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
- break;
- case M2MB_LWM2M_CL_STATE_SUSPENDED:
- AZX_LOG_DEBUG("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;
- }
-
- case M2MB_LWM2M_SESSION_INFO_IND:
- {
- AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
- M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
-
- if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
- {
- M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
- AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
- /* example
- if( currData->obj == 3303 && currData->resource == 5605)
- {
- AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
- }
- else
- {
- AZX_LOG_DEBUG("executed another resource");
- }*/
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_mon() */
- case M2MB_LWM2M_MON_RES:
- {
- AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
-
- 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
- }
- else
- {
- AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
- }
-
- break;
- }
-
- /* event in response to m2mb_lwm2m_get_stat() */
- case M2MB_LWM2M_GET_STAT_RES:
- {
- AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
- break;
- }
-
- default:
- AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
- break;
- }
+ UINT16 resp_size, void *resp_struct, void *userdata) {
+ (void) h;
+ (void) resp_size;
+ (void) userdata;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
}
/*-----------------------------------------------------------------------------------------------*/
uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
- 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;
-
- lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
-
- int i;
- M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
-
- if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
- }
-
- AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
-
- /* 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");
- return -1;
- } else {
- AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
- }
-
- //get the handle of the lwm2m client on lwm2mHandle
- retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
-
- 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- 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_os_sem_deinit(lwm2m_CSSemHandle);
-
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
-
- //AT#LWM2MENA=1
- memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
-
- 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_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- if (M2MB_OS_SUCCESS
- != m2mb_os_ev_get(eventsHandleLwm2m,
- 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");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- azx_sleep_ms(1000);
-
-
- AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return 1;
- }
-
- AZX_LOG_DEBUG("LWM2M registered\r\n");
-
- azx_sleep_ms(1000);
-
- for (i = 0; i < obj_num; i++)
- {
- M2MB_LWM2M_OBJ_URI_T uri;
- M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
-
- /*new object instance information*/
- uri.obj = objs[i].obj_id;
-
- new_inst_params.agent = 0; /*Telit Agent*/
-
- int j;
- for (j = 0; j < objs[i].inst_num; j++)
- {
-
- AZX_LOG_TRACE( "Creating new instance %d\r\n", j);
-
- uri.objInst = objs[i].instances_ids[j];
- uri.resource = 0;
- uri.resourceInst = 0;
- uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
-
- /*If OK the instance was not present, and so it was created. If an error
- is received, it is likely because the instance already exists.*/
-
- INT16 *index = NULL;
-
- if (lwm2mUserData)
- {
-
- switch( lwm2mUserData->objID )
- {
- case M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID:
- {
- index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
- if(!index)
- {
- AZX_LOG_ERROR( "Cannot allocate memory\r\n");
- //TODO check if needed free resources
- return M2MB_RESULT_FAIL;
- }
- *index = objs[i].instances_ids[j];
- lwm2mUserData->data = (void*) index;
-
- break;
- }
- default:
- break;
- }
- }
-
- retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
- if (retVal != M2MB_RESULT_SUCCESS)
- {
- AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- return M2MB_RESULT_FAIL;
- }
-
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- EV_LWM2M_NEW_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR,
- &curEvBits,
- M2MB_OS_MS2TICKS(1000) /*wait 10 seconds for the event to occur*/
- );
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
- m2mb_os_ev_deinit(eventsHandleLwm2m);
- m2mb_os_sem_deinit(lwm2m_CSSemHandle);
- m2mb_lwm2m_deinit(lwm2mHandle);
- if (index)
- {
- m2mb_os_free(index);
- }
- azx_sleep_ms(2000);
- return M2MB_RESULT_FAIL;
- }
-
- AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
-
- } //for (j = 0; j < objs[i].inst_num; j++)
-
-
- } //for (i = 0; i < obj_num; i++)
-
- return 0;
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
}
/*-----------------------------------------------------------------------------------------------*/
void update_tamper_LWM2MObject(int value)
{
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
- &value, sizeof(int));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
- &_t, sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
- sizeof(float));
- azx_sleep_ms(10);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
-
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
- INT16 _acc) {
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
- sizeof(float));
- //azx_sleep_ms(100);
- retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
- sizeof(INT16));
-
- osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
- M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
- if (osRes != M2MB_OS_SUCCESS) {
- AZX_LOG_ERROR("LWM2M write failure\r\n");
-
- }
-
- m2mb_os_sem_put(lwm2m_CSSemHandle);
- if (retVal != M2MB_RESULT_SUCCESS) {
- AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
- return;
- }
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int check_xml_file(const char *name) {
- char path[64] = { 0 };
- struct M2MB_STAT info;
- sprintf(path, "/XML/%s", name);
- AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
-
- if (0 == m2mb_fs_stat(path, &info)) {
- AZX_LOG_DEBUG("File is present, continue...\r\n");
- return 0;
- } else {
- INT32 last_errno = m2mb_fs_get_errno_value();
-
- if (last_errno == M2MB_FS_ENOENT) {
- AZX_LOG_WARN("File not found.\r\n");
- return -1;
- } else {
- AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
- last_errno);
- return -2;
- }
- }
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
}
/*-----------------------------------------------------------------------------------------------*/
int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
{
-
- *lightObjs = light_control_obj_table;
-
- return 1;
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
}
/*-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------*/
int copy_xml_file(const char *name) {
- char inpath[64] = { 0 };
- char outpath[64] = { 0 };
- char data[256];
- INT32 in_fd, out_fd;
- sprintf(inpath, "/mod/%s", name);
- sprintf(outpath, "/XML/%s", name);
- in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
-
- if (-1 == in_fd) {
- AZX_LOG_ERROR("cannot find input file! abort.\r\n");
- return -1;
- } else {
- out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
-
- if (-1 == out_fd) {
- AZX_LOG_ERROR("cannot create output file! abort.\r\n");
- return -2;
- } else {
- struct M2MB_STAT stats;
- UINT32 filesize;
- UINT32 written = 0;
- UINT32 chunk = sizeof(data);
- AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
-
- if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
- AZX_LOG_ERROR("cannot stat input file! abort\r\n");
- return -3;
- } else {
- filesize = stats.st_size;
- AZX_LOG_DEBUG("File size: %u\r\n", filesize);
-
- if (chunk > filesize) {
- AZX_LOG_DEBUG(
- "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
- chunk, filesize);
- chunk = filesize;
- }
-
- while (1) {
- SSIZE_T res = 0;
- res = m2mb_fs_read(in_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "read is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -4;
- }
-
- res = m2mb_fs_write(out_fd, data, chunk);
-
- if (res != (SSIZE_T) chunk) {
- AZX_LOG_ERROR(
- "written is less than expected: %d instead of %d\r\n",
- res, chunk);
- return -5;
- }
-
- AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
- chunk);
- written += chunk;
-
- if ((filesize - written) < chunk) {
- chunk = filesize - written;
- }
-
- if (written == filesize) {
- AZX_LOG_DEBUG("file written. \r\n");
- break;
- }
- }
-
- return 0;
- }
- }
- }
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
}
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
{
- M2MB_RESULT_E retVal;
- M2MB_OS_RESULT_E osRes;
- UINT32 curEvBits;
-
- if (lwm2mHandle == NULL)
- {
- AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
- return -1;
- }
- retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
- if ( retVal != M2MB_RESULT_SUCCESS )
- {
- AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
- return -1;
- }
- AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
- osRes = m2mb_os_ev_get(
- eventsHandleLwm2m,
- 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*/
- );
-
- if (osRes != M2MB_OS_SUCCESS)
- {
- AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
- m2mb_os_ev_deinit( eventsHandleLwm2m );
-
- m2mb_lwm2m_disable(lwm2mHandle);
- azx_sleep_ms(2000);
- m2mb_lwm2m_deinit(lwm2mHandle);
- return -1;
- }
-
- return 1;
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
}
int lwm2m_ReadTaskRegister(INT32 taskID) {
- if (taskID > 0) {
- dataTaskID = taskID;
- return 1;
- }
- return -1;
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
}
M2MB_LWM2M_HANDLE getLwM2mHandle()
{
- return lwm2mHandle;
+ return lwm2mHandle;
}
M2MB_OS_EV_HANDLE getEventHandle()
{
- return eventsHandleLwm2m;
+ return eventsHandleLwm2m;
}
diff --git a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.h b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.h
index 0a5c667..b991703 100644
--- a/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.h
+++ b/Samples/BRAVO_Tampering_Demo/src/demo_utils/lwm2m.h
@@ -30,8 +30,9 @@
/* Global defines ================================================================================*/
/*OBJECTs and RESOURCEs IDs*/
-#define M2MB_LWM2M_LIGHT_CONTROL_OBJ_ID 3311
-#define OBJECT_XML_NAME "object_3311.xml"
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
#define LIGHT_CONTROL_OBJ_TIME_ID 5852
@@ -40,18 +41,35 @@
#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
#define TAMPERING_OBJ_ID 26242
#define ENVIRONMENT_OBJ_ID 26251
#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
-#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000002
-#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000003
-#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_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
#define EV_MON_URC_RECEIVED 2
#define EV_LWM2M_WRITE_APP_TYPE 3
#define CTX_ID 1 //default cid used by lwm2m
@@ -107,6 +125,19 @@ void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size
void *userdata );
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
/**
@brief Initialize OneEdge connection
@param[in] obj_id Object ID to be used for initialization
@@ -190,12 +221,12 @@ int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
int lwm2m_ReadTaskRegister( INT32 taskID);
/**
- @brief Retrun the lwm2m handle
+ @brief Return the lwm2m handle
*/
M2MB_LWM2M_HANDLE getLwM2mHandle();
/**
- @brief Retrun the event lwm2m handle
+ @brief Return the event lwm2m handle
*/
M2MB_OS_EV_HANDLE getEventHandle();
@@ -212,5 +243,42 @@ M2MB_OS_EV_HANDLE getEventHandle();
int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/Bosch_BHI160_Orientation.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/Bosch_BHI160_Orientation.h
new file mode 100644
index 0000000..8843ff7
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/Bosch_BHI160_Orientation.h
@@ -0,0 +1,1767 @@
+/* This code was generated by fw2h utility, please don't make change to it directly.
+ * FW2H version: 1.0.0.3. */
+
+#ifndef BHY_FW_D224DB1EB8B56338_H
+#define BHY_FW_D224DB1EB8B56338_H
+
+const uint8_t bhy1_fw[28104] = {
+ 0x2a, 0x65, 0x00, 0x1a, 0xcd, 0xe0, 0xd6, 0x67, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x6d, 0x00, 0x00,
+ 0xac, 0xe5, 0x7f, 0x00, 0x4c, 0x5e, 0x00, 0x00, 0xc0, 0x8d, 0x7f, 0x00, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,
+ 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,
+ 0x34, 0x50, 0x60, 0x00, 0xa4, 0x53, 0x60, 0x00, 0x04, 0x52, 0x60, 0x00, 0xb4, 0x94, 0x60, 0x00,
+ 0xc0, 0x8d, 0x7f, 0x00, 0xc0, 0x8d, 0x7f, 0x00, 0xc0, 0x8d, 0x7f, 0x00, 0xc0, 0x8d, 0x7f, 0x00,
+ 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00,
+ 0x4c, 0x8d, 0x60, 0x00, 0x4c,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cf, 0x04, 0x21, 0x03, 0xcf, 0x04, 0x45, 0x03, 0xcf, 0x04,
+ 0x4d, 0x03, 0xcf, 0x04, 0x61, 0x03, 0xcf, 0x04, 0x71, 0x03, 0xcf, 0x04, 0xc9, 0x03, 0xcf, 0x04,
+ 0xdd, 0x03, 0xcf, 0x04, 0x49, 0x05, 0xcf, 0x04, 0x55, 0x05, 0xcf, 0x04, 0x61, 0x05, 0xcf, 0x04,
+ 0x65, 0x05, 0xcf, 0x04, 0x69, 0x05, 0xcf, 0x04, 0x6d, 0x05, 0xcf, 0x04, 0x99, 0x05, 0xcf, 0x04,
+ 0x2d, 0x00, 0x0f, 0x05, 0xad, 0x00, 0x0f, 0x05, 0xf9, 0x00, 0x0f, 0x05, 0x41, 0x01, 0x0f, 0x05,
+ 0xe1, 0x01, 0x0f, 0x05, 0x09, 0x02, 0x0f, 0x05, 0xf1, 0x02, 0x0f, 0x05, 0xfd, 0x02, 0x0f, 0x05,
+ 0x21, 0x03, 0x0f, 0x05, 0x3d, 0x03, 0x0f, 0x05, 0x91, 0x03, 0x0f, 0x05, 0xad, 0x03, 0x0f, 0x05,
+ 0xb9, 0x03, 0x0f, 0x05, 0xdd, 0x03, 0x0f, 0x05, 0xed, 0x03, 0x0f, 0x05, 0xf5, 0x03, 0x0f, 0x05,
+ 0x55, 0x06, 0xc0, 0x00, 0x15, 0x06, 0x0f, 0x05, 0xa1, 0x06, 0x0f, 0x05, 0xb1, 0x06, 0x0f, 0x05,
+ 0xb9, 0x06, 0x0f, 0x05, 0xc1, 0x06, 0x0f, 0x05, 0xd5, 0x06, 0x0f, 0x05, 0x25, 0x07, 0x0f, 0x05,
+ 0x69, 0x07, 0x0f, 0x05, 0x71, 0x07, 0x0f, 0x05, 0x0d, 0x00, 0x4f, 0x05, 0x29, 0x00, 0x4f, 0x05,
+ 0x39, 0x00, 0x4f, 0x05, 0x6d, 0x00, 0x4f, 0x05, 0x79, 0x00, 0x4f, 0x05, 0x9d, 0x00, 0x4f, 0x05,
+ 0xe5, 0x01, 0x4f, 0x05, 0x1d, 0x02, 0x4f, 0x05, 0x2d, 0x02, 0x4f, 0x05, 0x31, 0x02, 0x4f, 0x05,
+ 0x45, 0x02, 0x4f, 0x05, 0x29, 0x03, 0x4f, 0x05, 0x65, 0x03, 0x4f, 0x05, 0x01, 0x04, 0x4f, 0x05,
+ 0x0d, 0x04, 0x4f, 0x05, 0x19, 0x04, 0x4f, 0x05, 0x4d, 0x04, 0x4f, 0x05, 0x59, 0x04, 0x4f, 0x05,
+ 0xd9, 0x04, 0x4f, 0x05, 0x81, 0x05, 0x4f, 0x05, 0x85, 0x05, 0x4f, 0x05, 0xad, 0x05, 0x4f, 0x05,
+ 0xfd, 0x05, 0x4f, 0x05, 0x05, 0x06, 0x4f, 0x05, 0x0d, 0x06, 0x4f, 0x05, 0x39, 0x06, 0x4f, 0x05,
+ 0x71, 0x00, 0x8f, 0x05, 0xe9, 0x00, 0x8f, 0x05, 0xf9, 0x00, 0x8f, 0x05, 0x09, 0x01, 0x8f, 0x05,
+ 0xb5, 0x01, 0x8f, 0x05, 0xc1, 0x01, 0x8f, 0x05, 0xe1, 0x01, 0x8f, 0x05, 0xed, 0x01, 0x8f, 0x05,
+ 0x01, 0x02, 0x8f, 0x05, 0x0d, 0x02, 0x8f, 0x05, 0x19, 0x02, 0x8f, 0x05, 0x49, 0x02, 0x8f, 0x05,
+ 0x55, 0x02, 0x8f, 0x05, 0x1d, 0x03, 0x8f, 0x05, 0x91, 0x03, 0x8f, 0x05, 0xe5, 0x03, 0x8f, 0x05,
+ 0x25, 0x04, 0x8f, 0x05, 0x95, 0x04, 0x8f, 0x05, 0xb5, 0x04, 0x8f, 0x05, 0x29, 0x05, 0x8f, 0x05,
+ 0xa5, 0x05, 0x8f, 0x05, 0x31, 0x06, 0x8f, 0x05, 0x39, 0x06, 0x8f, 0x05, 0x41, 0x06, 0x8f, 0x05,
+ 0x49, 0x06, 0x8f, 0x05, 0x65, 0x07, 0x8f, 0x05,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
+ 0x19, 0x02, 0x0f, 0x06, 0x25, 0x02, 0x0f, 0x06, 0x39, 0x02, 0x0f, 0x06, 0x45, 0x02, 0x0f, 0x06,
+ 0x55, 0x02, 0x0f, 0x06, 0x81, 0x02, 0x0f, 0x06, 0xa1, 0x02, 0x0f, 0x06, 0xb5, 0x02, 0x0f, 0x06,
+ 0xc1, 0x02, 0x0f, 0x06, 0xc9, 0x02, 0x0f, 0x06, 0xd5, 0x02, 0x0f, 0x06, 0x31, 0x03, 0x0f, 0x06,
+ 0x41, 0x03, 0x0f, 0x06, 0x51, 0x03, 0x0f, 0x06, 0x5d, 0x03, 0x0f, 0x06, 0x65, 0x03, 0x0f, 0x06,
+ 0x75, 0x03, 0x0f, 0x06, 0xcd, 0x03, 0x0f, 0x06, 0xf9, 0x03, 0x0f, 0x06, 0x05, 0x04, 0x0f, 0x06,
+ 0x59, 0x06, 0x0f, 0x06, 0x61, 0x06, 0x0f, 0x06, 0xc1, 0x06, 0x0f, 0x06, 0xd5, 0x06, 0x0f, 0x06,
+ 0xd9, 0x06, 0x0f, 0x06, 0xdd, 0x06, 0x0f, 0x06, 0x79, 0x04, 0x4f, 0x06, 0x91, 0x04, 0x4f, 0x06,
+ 0xa9, 0x04, 0x4f, 0x06, 0x01, 0x05, 0x4f, 0x06, 0x35, 0x05, 0x4f, 0x06, 0x65, 0x05, 0x4f, 0x06,
+ 0x2d, 0x06, 0x4f, 0x06, 0x45, 0x06, 0x4f, 0x06, 0x69, 0x06, 0x4f, 0x06, 0x6d, 0x06, 0x4f, 0x06,
+ 0x71, 0x06, 0x4f, 0x06, 0x75, 0x06, 0x4f, 0x06, 0x79, 0x06, 0x4f, 0x06, 0x7d, 0x06, 0x4f, 0x06,
+ 0x81, 0x06, 0x4f, 0x06, 0x85, 0x06, 0x4f, 0x06, 0x89, 0x06, 0x4f, 0x06, 0x8d, 0x06, 0x4f, 0x06,
+ 0x91, 0x06, 0x4f, 0x06, 0x95, 0x06, 0x4f, 0x06, 0xa1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0x3d, 0x02, 0x0f, 0x07, 0x9d, 0x02, 0x0f, 0x07, 0xc5, 0x02, 0x0f, 0x07, 0xed, 0x02, 0x0f, 0x07,
+ 0x15, 0x03, 0x0f, 0x07, 0x51, 0x03, 0x0f, 0x07, 0xa9, 0x03, 0x0f, 0x07, 0xcd, 0x03, 0x0f, 0x07,
+ 0xe5, 0x03, 0x0f, 0x07, 0xf5, 0x03, 0x0f, 0x07, 0x05, 0x04, 0x0f, 0x07, 0x2d, 0x04, 0x0f, 0x07,
+ 0x55, 0x04, 0x0f, 0x07, 0x99, 0x04, 0x0f, 0x07, 0xcd, 0x04, 0x0f, 0x07, 0xf1, 0x04, 0x0f, 0x07,
+ 0x09, 0x05, 0x0f, 0x07, 0x41, 0x05, 0x0f, 0x07, 0xc1, 0x05, 0x0f, 0x07, 0xe9, 0x05, 0x0f, 0x07,
+ 0x19, 0x07, 0x0f, 0x07, 0x59, 0x07, 0x0f, 0x07, 0x71, 0x07, 0x0f, 0x07, 0x89, 0x07, 0x0f, 0x07,
+ 0xa1, 0x07, 0x0f, 0x07, 0xe5, 0x07, 0x0f, 0x07, 0x55, 0x00, 0x4f, 0x07, 0x79, 0x00, 0x4f, 0x07,
+ 0xb9, 0x00, 0x4f, 0x07, 0x6d, 0x01, 0x4f, 0x07, 0xb5, 0x01, 0x4f, 0x07, 0x4d, 0x03, 0x4f, 0x07,
+ 0x21, 0x04, 0x4f, 0x07, 0x5d, 0x04, 0x4f, 0x07, 0x85, 0x04, 0x4f, 0x07, 0xf9, 0x04, 0x4f, 0x07,
+ 0x65, 0x05, 0x4f, 0x07, 0x81, 0x05, 0x4f, 0x07, 0xd9, 0x00, 0x8f, 0x07, 0x35, 0x01, 0x8f, 0x07,
+ 0x69, 0x01, 0x8f, 0x07, 0x75, 0x01, 0x8f, 0x07, 0xad, 0x01, 0x8f, 0x07, 0xed, 0x01, 0x8f, 0x07,
+ 0x19, 0x02, 0x8f, 0x07, 0x41, 0x02, 0x8f, 0x07, 0x4d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, 0x00, 0x00, 0xe1, 0x20, 0xc1, 0x07, 0x74, 0x70, 0xe1, 0x20,
+ 0xc1, 0x07, 0xc2, 0x21, 0x41, 0x00, 0x41, 0x2a, 0x42, 0x05, 0x8d, 0x70, 0x60, 0x44, 0x0c, 0x24,
+ 0x80, 0x8f, 0x01, 0x00, 0x00, 0x00, 0xc1, 0x2c, 0x26, 0x04, 0xc0, 0x24, 0x25, 0x14, 0x8c, 0x24,
+ 0x04, 0x80, 0xc1, 0x2c, 0x26, 0x02, 0xc0, 0x24, 0x25, 0x12, 0x4c, 0x24, 0x00, 0x84, 0xc1, 0x2c,
+ 0x26, 0x01, 0xc0, 0x24, 0x25, 0x11, 0x94, 0x74, 0xc1, 0x2c, 0xa6, 0x00, 0xc0, 0x24, 0xa5, 0x10,
+ 0x94, 0x72, 0xc0, 0x24, 0x65, 0x10, 0x85, 0x71, 0x00, 0x2b, 0x03, 0x03, 0x69, 0xbc, 0x82, 0x7a,
+ 0x40, 0x2a, 0x02, 0x05, 0x2f, 0x21, 0x40, 0x80, 0x2f, 0x21, 0x84, 0x00, 0x41, 0x2b, 0x0c, 0x03,
+ 0x85, 0x79, 0xe0, 0x7f, 0x40, 0x2b, 0x00, 0x05, 0x2f, 0x24, 0x40, 0x90, 0x02, 0x24, 0x83, 0x1f,
+ 0x00, 0x70, 0x00, 0x00, 0x40, 0x2b, 0xc2, 0x00, 0x2f, 0x22, 0x84, 0x00, 0x02, 0x23, 0x83, 0x0f,
+ 0x20, 0x00, 0x00, 0x00, 0xd3, 0x73, 0xc0, 0x1f, 0x00, 0x00, 0x40, 0x28, 0x03, 0x01, 0x1a, 0x00,
+ 0x26, 0x00, 0x41, 0x28, 0x40, 0x87, 0x45, 0x78, 0x44, 0x20, 0x41, 0x00, 0x05, 0x21, 0xc1, 0x80,
+ 0xe0, 0x7f, 0xc1, 0x20, 0x22, 0x00, 0x2f, 0x23, 0xc4, 0x00, 0x45, 0x78, 0x41, 0x2c, 0x4c, 0x15,
+ 0x82, 0x24, 0x0d, 0x9a, 0xe1, 0x20, 0xcb, 0x07, 0xca, 0x20, 0x2b, 0x00, 0x42, 0x24, 0x0c, 0x96,
+ 0x53, 0x20, 0x81, 0x05, 0x22, 0x00, 0x2c, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x05, 0x21, 0xc1, 0x80,
+ 0x2f, 0x20, 0x84, 0x0f, 0x80, 0xff, 0x00, 0x00, 0xd0, 0x20, 0xa1, 0x05, 0x8c, 0x24, 0xd1, 0x9f,
+ 0xe0, 0x7f, 0xd0, 0x20, 0xa2, 0x05, 0x4e, 0x24, 0x02, 0x10, 0x97, 0xb9, 0x01, 0x29, 0x80, 0x00,
+ 0x2f, 0x20, 0x04, 0x80, 0xe1, 0x20, 0xc6, 0x07, 0x4e, 0x22, 0xcc, 0x07, 0x13, 0x21, 0x01, 0x03,
+ 0x05, 0x21, 0xc1, 0x80, 0xd1, 0x20, 0x21, 0x80, 0xe0, 0x7f, 0xc0, 0x20, 0x62, 0x00, 0xe0, 0x78,
+ 0xcb, 0x44, 0xe0, 0xff, 0x00, 0x00, 0x14, 0x24, 0x44, 0x10, 0x14, 0x24, 0xc5, 0x10, 0xb6, 0xbc,
+ 0x0c, 0x24, 0x00, 0x83, 0xcc, 0x25, 0x05, 0x83, 0xc2, 0x00, 0x26, 0x00, 0x96, 0xbc, 0x41, 0x2c,
+ 0x44, 0x05, 0x41, 0x2d, 0x45, 0x05, 0x00, 0x25, 0x05, 0x01, 0x82, 0x25, 0x8f, 0x0f, 0x8c, 0x25,
+ 0xdf, 0x8e, 0xf4, 0x00, 0x26, 0x00, 0x07, 0x21, 0xcc, 0x80, 0x40, 0x25, 0x47, 0x00, 0x94, 0xb9,
+ 0xd4, 0xb9, 0x94, 0xbb, 0xcf, 0x27, 0xe4, 0x02, 0x40, 0x2b, 0xc3, 0x02, 0x41, 0x2a, 0x45, 0x05,
+ 0x40, 0x2a, 0xc2, 0x82, 0x1d, 0x20, 0x84, 0x00, 0x05, 0x23, 0x43, 0x01, 0x1c, 0x20, 0x8c, 0x00,
+ 0x94, 0x70, 0x1d, 0x20, 0xc4, 0x00, 0xcf, 0x27, 0xe2, 0x07, 0x1c, 0x20, 0xc5, 0x00, 0x00, 0x24,
+ 0x0c, 0x91, 0x1d, 0x21, 0x84, 0x00, 0x41, 0x25, 0x00, 0x00, 0x1c, 0x21, 0x85, 0x00, 0x00, 0x24,
+ 0x0c, 0x91, 0x1d, 0x21, 0xc4, 0x00, 0x01, 0x20, 0x40, 0x81, 0x1c, 0x21, 0xc5, 0x00, 0x41, 0x26,
+ 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x81, 0x01, 0x21, 0x41, 0x01, 0x1b, 0x09,
+ 0x3f, 0x05, 0x00, 0x24, 0x0c, 0x93, 0x42, 0x27, 0x47, 0x00, 0x01, 0x20, 0x00, 0x80, 0x01, 0x21,
+ 0x41, 0x00, 0x00, 0x24, 0x0c, 0x93, 0x40, 0x2f, 0x04, 0x05, 0xe1, 0x20, 0xc6, 0x07, 0x80, 0x71,
+ 0x40, 0x29, 0xc5, 0x07, 0x05, 0x25, 0xc5, 0x81, 0xcf, 0x25, 0xe2, 0x07, 0x41, 0x2d, 0xc5, 0x07,
+ 0x00, 0x20, 0x40, 0x81, 0xe0, 0x7f, 0x41, 0x21, 0x01, 0x00, 0x02, 0x24, 0x04, 0x83, 0xcc, 0x20,
+ 0x21, 0x80, 0xe1, 0x20, 0xc1, 0x07, 0xca, 0x21, 0x21, 0x00, 0x02, 0x25, 0x05, 0x83, 0xcc, 0x22,
+ 0x21, 0x80, 0xca, 0x20, 0x21, 0x00, 0xe1, 0x20, 0xc1, 0x07, 0xca, 0x21, 0x21, 0x00, 0x0c, 0x24,
+ 0x00, 0x83, 0xcc, 0x25, 0x05, 0x83, 0x20, 0x00, 0x25, 0x00, 0x0c, 0x24, 0x40, 0x81, 0xcc, 0x20,
+ 0x81, 0x80, 0xca, 0x20, 0x85, 0x00, 0xca, 0x21, 0xc5, 0x00, 0x07, 0x23, 0x43, 0x80, 0xe0, 0x7f,
+ 0xcf, 0x21, 0xe4, 0x07, 0x2f, 0x25, 0xc0, 0x80, 0x41, 0x26, 0x04, 0x70, 0x00, 0x00, 0x00, 0x00,
+ 0xcc, 0x22, 0x21, 0x80, 0x08, 0x03, 0x21, 0x00, 0x2f, 0x21, 0x40, 0x90, 0xc7, 0x24, 0x65, 0x00,
+ 0xcc, 0x20, 0x21, 0x80, 0xd4, 0x02, 0x01, 0x00, 0x41, 0x29, 0x46, 0x95, 0x06, 0x21, 0x81, 0x0f,
+ 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x21, 0x82, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x22, 0x00,
+ 0x00, 0x40, 0xcb, 0x42, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00,
+ 0xc4, 0x71, 0x04, 0x21, 0xbe, 0x82, 0x42, 0x26, 0x46, 0x00, 0x12, 0x00, 0x02, 0x00, 0x2f, 0x20,
+ 0x00, 0x80, 0xf3, 0x07, 0xef, 0xff, 0x2f, 0x21, 0x4b, 0x00, 0x41, 0x2d, 0x47, 0x85, 0x06, 0x23,
+ 0x88, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x20, 0x82, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00,
+ 0x22, 0x00, 0x40, 0x42, 0xcb, 0x42, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x22, 0x80, 0x80, 0x2f, 0x20,
+ 0x0b, 0x12, 0xe4, 0x71, 0x04, 0x20, 0xbe, 0x92, 0x42, 0x27, 0x47, 0x00, 0x10, 0x00, 0x02, 0x00,
+ 0x2f, 0x22, 0x80, 0x80, 0xf1, 0x07, 0xef, 0xff, 0x2f, 0x20, 0x0b, 0x12, 0x8c, 0x26, 0xdf, 0x8f,
+ 0xf2, 0x01, 0x01, 0x00, 0x8c, 0x27, 0xdf, 0x8f, 0x1c, 0x02, 0x21, 0x00, 0x1d, 0x20, 0x8a, 0x00,
+ 0x00, 0x26, 0xc6, 0x01, 0x1c, 0x20, 0x8b, 0x00, 0x1d, 0x21, 0x87, 0x00, 0x82, 0x26, 0xcf, 0x0f,
+ 0x1c, 0x21, 0x8c, 0x00, 0x00, 0x23, 0xcb, 0x91, 0x41, 0x24, 0x02, 0x10, 0x1d, 0x20, 0x07, 0x02,
+ 0x1c, 0x20, 0x0c, 0x02, 0x00, 0x23, 0xcb, 0x91, 0x01, 0x22, 0x02, 0x03, 0x1d, 0x21, 0x07, 0x02,
+ 0x1c, 0x21, 0x0c, 0x02, 0x00, 0x22, 0xc2, 0x81, 0x41, 0x24, 0x09, 0x10, 0x40, 0x29, 0x01, 0x13,
+ 0x41, 0x2a, 0x03, 0x05, 0x65, 0x79, 0x40, 0x2a, 0x07, 0x03, 0x40, 0x2a, 0x00, 0x03, 0x41, 0x2b,
+ 0x03, 0x15, 0x65, 0x78, 0x40, 0x2b, 0x0c, 0x13, 0x55, 0x70, 0xc5, 0x24, 0xa2, 0x10, 0xd4, 0x70,
+ 0x40, 0x00, 0x0c, 0x00, 0x04, 0x21, 0xbe, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x12, 0x00, 0x01, 0x00,
+ 0xc4, 0x71, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x80, 0x2f, 0x24, 0x04, 0x13, 0x95, 0x70,
+ 0x36, 0x00, 0x0a, 0x00, 0x04, 0x24, 0xbe, 0x9f, 0xff, 0x7f, 0xff, 0xff, 0x0c, 0x00, 0x02, 0x00,
+ 0x44, 0x20, 0x7e, 0x80, 0x22, 0x00, 0x01, 0x00, 0x40, 0x20, 0x40, 0x80, 0x41, 0x21, 0x01, 0x00,
+ 0x04, 0x21, 0xbe, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0xc4, 0x71, 0x2f, 0x21,
+ 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x8c, 0x26, 0xdf, 0x8f, 0x0e, 0x01, 0x0a, 0x00, 0xd4, 0x70,
+ 0x1a, 0x00, 0x0c, 0x00, 0x06, 0x21, 0x81, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x40, 0x2e, 0x02, 0x05,
+ 0x45, 0x79, 0x2f, 0x22, 0x03, 0x01, 0x45, 0x79, 0xe0, 0x7e, 0x8c, 0x26, 0xff, 0x82, 0xfa, 0x00,
+ 0x0b, 0x00, 0x02, 0x26, 0x8a, 0x71, 0x00, 0x00, 0x00, 0x00, 0x42, 0x22, 0x4a, 0x90, 0x4a, 0x26,
+ 0x00, 0x70, 0x88, 0x00, 0x0b, 0x00, 0x8c, 0x00, 0x01, 0x00, 0x4c, 0x22, 0x00, 0x98, 0x4a, 0x26,
+ 0x00, 0x70, 0x2a, 0x00, 0x0b, 0x00, 0x42, 0x22, 0x0a, 0x18, 0x05, 0x24, 0x0c, 0x90, 0x6d, 0x77,
+ 0x10, 0x00, 0x02, 0x00, 0x00, 0x2b, 0x8b, 0x12, 0x87, 0x23, 0xff, 0x1f, 0x04, 0x21, 0xcc, 0x02,
+ 0x01, 0x29, 0x80, 0x02, 0x5d, 0x00, 0x20, 0x00, 0x2c, 0x70, 0x95, 0x70, 0x6d, 0x77, 0x1e, 0x00,
+ 0x02, 0x00, 0x4c, 0x22, 0x00, 0x98, 0xc2, 0x23, 0xca, 0x12, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x2b,
+ 0x8b, 0x12, 0x87, 0x23, 0xff, 0x1f, 0x04, 0x20, 0xcc, 0x02, 0x02, 0x26, 0x8b, 0xf2, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x29, 0xcb, 0x02, 0x14, 0x00, 0x09, 0x00, 0x40, 0x22, 0x0b, 0x18, 0x01, 0x29,
+ 0xc0, 0x02, 0x15, 0x00, 0x20, 0x00, 0x2c, 0x70, 0x01, 0x28, 0x80, 0x02, 0x01, 0x29, 0x81, 0x02,
+ 0x05, 0x20, 0xc0, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00,
+ 0x44, 0x20, 0xbe, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x1c, 0x00, 0x01, 0x00, 0x44, 0x20, 0x4a, 0x01,
+ 0x05, 0x22, 0x3e, 0x93, 0x4a, 0x26, 0x00, 0x70, 0x0c, 0x00, 0x01, 0x00, 0x40, 0x20, 0x80, 0x80,
+ 0x41, 0x21, 0x01, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21, 0x42, 0x80,
+ 0x2f, 0x20, 0x04, 0x00, 0x02, 0x26, 0x86, 0x01, 0x04, 0x21, 0xbe, 0x8f, 0x10, 0x00, 0x00, 0x00,
+ 0xc0, 0x26, 0x62, 0x00, 0x80, 0xf1, 0x8a, 0x26, 0xdf, 0x0f, 0xc3, 0x41, 0x10, 0x00, 0x00, 0x00,
+ 0xf5, 0x06, 0xef, 0xff, 0x0c, 0x70, 0x02, 0x26, 0x86, 0x01, 0x2c, 0x70, 0xe9, 0x06, 0xef, 0xff,
+ 0x0c, 0x70, 0xd3, 0x71, 0x10, 0x00, 0x00, 0x00, 0xcc, 0x20, 0x21, 0x80, 0x2f, 0x21, 0x03, 0x01,
+ 0xc5, 0x21, 0x82, 0x0f, 0xf8, 0x7f, 0x00, 0x00, 0xc0, 0x78, 0x70, 0xf5, 0x8c, 0x27, 0xdf, 0x8f,
+ 0x14, 0x00, 0x01, 0x00, 0x2f, 0x21, 0x03, 0x01, 0x05, 0x21, 0x81, 0x0f, 0xf0, 0x7f, 0x00, 0x00,
+ 0x0c, 0x70, 0x64, 0xf1, 0x0c, 0x20, 0x80, 0x9f, 0x10, 0x00, 0x00, 0x00, 0xcc, 0x22, 0x21, 0x80,
+ 0x2f, 0x21, 0x03, 0x01, 0xc5, 0x21, 0x82, 0x0f, 0xf8, 0x7f, 0x00, 0x00, 0xc5, 0x21, 0x81, 0x0f,
+ 0xf0, 0x7f, 0x00, 0x00, 0x0c, 0x70, 0x52, 0xf1, 0x0c, 0x25, 0x80, 0x8f, 0xe0, 0xff, 0x00, 0x00,
+ 0x4a, 0x26, 0x00, 0x70, 0x2a, 0x00, 0x06, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x0c, 0x70, 0x2c, 0x70,
+ 0x94, 0x70, 0xc5, 0x21, 0x82, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x40, 0xf1, 0xc7, 0x24, 0x65, 0x00,
+ 0x0c, 0x21, 0x80, 0x9f, 0xe0, 0xff, 0x00, 0x00, 0xb2, 0xf7, 0x4a, 0x26, 0x00, 0x70, 0xc3, 0x41,
+ 0xf8, 0x7f, 0x00, 0x00, 0x0c, 0x70, 0x32, 0xf1, 0x07, 0x21, 0x81, 0x0f, 0x00, 0x80, 0x00, 0x00,
+ 0x0d, 0x00, 0x00, 0x00, 0x07, 0x23, 0x83, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x00, 0x21, 0x44, 0x00,
+ 0x00, 0x23, 0xc5, 0x00, 0x0c, 0x24, 0x40, 0x81, 0xcc, 0x20, 0x81, 0x80, 0x10, 0x00, 0x06, 0x00,
+ 0x08, 0x44, 0x40, 0x40, 0x81, 0x42, 0x28, 0x44, 0x60, 0x41, 0x81, 0x43, 0x8a, 0x24, 0xdf, 0x1f,
+ 0x40, 0x2c, 0x4c, 0x15, 0x14, 0x24, 0x44, 0x10, 0x14, 0x24, 0xc5, 0x10, 0x40, 0x2c, 0x8c, 0x10,
+ 0x0c, 0x24, 0x00, 0x83, 0xcc, 0x25, 0x05, 0x83, 0x92, 0x01, 0x06, 0x00, 0x41, 0x29, 0x04, 0x05,
+ 0x41, 0x2b, 0x05, 0x05, 0x02, 0x24, 0x46, 0x01, 0x53, 0x26, 0x86, 0x02, 0x07, 0x21, 0xc7, 0x00,
+ 0x40, 0x29, 0xc1, 0x02, 0x41, 0x28, 0x4c, 0x05, 0x85, 0x79, 0x40, 0x28, 0xc0, 0x02, 0x40, 0x2b,
+ 0xc3, 0x02, 0x41, 0x2a, 0x4c, 0x05, 0x85, 0x7b, 0x40, 0x2a, 0xc2, 0x02, 0x9f, 0xbb, 0x4e, 0x26,
+ 0x0c, 0x88, 0x1c, 0x00, 0x2d, 0x00, 0x01, 0x2a, 0x85, 0x01, 0x8c, 0x26, 0x01, 0x80, 0x01, 0x2b,
+ 0x85, 0x01, 0xca, 0x25, 0x26, 0x00, 0x17, 0x00, 0x20, 0x00, 0x8d, 0x70, 0xd4, 0x70, 0x00, 0x2b,
+ 0x0c, 0x03, 0xc5, 0x25, 0x02, 0x03, 0x01, 0x2b, 0x8c, 0x01, 0x41, 0x2f, 0xc7, 0x87, 0x62, 0x00,
+ 0x22, 0x00, 0x9f, 0xb9, 0x00, 0x25, 0x05, 0x80, 0x01, 0x24, 0x4c, 0x90, 0x10, 0x00, 0x26, 0x00,
+ 0xc2, 0x24, 0x66, 0x00, 0x2f, 0x24, 0x04, 0x93, 0x2f, 0x25, 0x44, 0x01, 0x41, 0x2d, 0xc0, 0x82,
+ 0x40, 0x2c, 0x41, 0x15, 0x25, 0x78, 0x41, 0x2c, 0xc1, 0x12, 0x40, 0x2c, 0x04, 0x05, 0xe1, 0x20,
+ 0xc6, 0x07, 0x80, 0x71, 0x4c, 0x26, 0x00, 0x88, 0xca, 0x23, 0x85, 0x00, 0xca, 0x22, 0x25, 0x00,
+ 0x13, 0x23, 0x83, 0x01, 0x05, 0x23, 0x83, 0x80, 0xd3, 0x25, 0x61, 0x82, 0xd1, 0x20, 0x21, 0x80,
+ 0xca, 0x27, 0x62, 0x00, 0x00, 0x20, 0xc0, 0x81, 0xe0, 0x7f, 0x41, 0x21, 0x01, 0x00, 0x0e, 0x25,
+ 0x05, 0x80, 0x03, 0x21, 0x0c, 0x83, 0x52, 0x00, 0x23, 0x00, 0x0c, 0x70, 0x41, 0x2d, 0xc0, 0x82,
+ 0x40, 0x2c, 0x41, 0x15, 0x25, 0x78, 0x41, 0x2c, 0xc1, 0x12, 0x42, 0x24, 0x44, 0x00, 0x40, 0x2c,
+ 0x04, 0x05, 0xe1, 0x20, 0xc6, 0x07, 0x80, 0x71, 0x4c, 0x26, 0x00, 0x88, 0xca, 0x23, 0x85, 0x00,
+ 0xca, 0x22, 0x25, 0x00, 0x13, 0x23, 0x83, 0x01, 0x05, 0x23, 0x83, 0x80, 0xca, 0x27, 0x22, 0x00,
+ 0x04, 0x27, 0x07, 0x80, 0xd3, 0x25, 0x61, 0x82, 0xca, 0x27, 0x62, 0x00, 0x00, 0x20, 0xc0, 0x81,
+ 0xe0, 0x7f, 0x41, 0x21, 0x01, 0x00, 0xcc, 0x25, 0x21, 0x80, 0xe1, 0x20, 0xc1, 0x07, 0x2c, 0x70,
+ 0x00, 0x25, 0x45, 0x81, 0x01, 0x24, 0x0c, 0x93, 0xf8, 0x07, 0xe3, 0xff, 0x04, 0x71, 0x53, 0x24,
+ 0x81, 0x02, 0x0e, 0x20, 0x40, 0x80, 0x04, 0x24, 0x84, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x12, 0x00,
+ 0x22, 0x00, 0xc0, 0x20, 0x61, 0x00, 0x2f, 0x24, 0x02, 0x93, 0x2f, 0x25, 0x44, 0x01, 0x80, 0x07,
+ 0xe6, 0xff, 0xc5, 0x24, 0x06, 0x00, 0x4e, 0x20, 0x40, 0x00, 0x4e, 0x20, 0x01, 0x88, 0x1a, 0x00,
+ 0x2d, 0x00, 0x01, 0x2d, 0x05, 0x00, 0xc0, 0xe0, 0x01, 0x2c, 0x05, 0x10, 0xca, 0x25, 0x26, 0x00,
+ 0x15, 0x00, 0x20, 0x00, 0x8d, 0x70, 0x14, 0x70, 0x00, 0x2c, 0x41, 0x10, 0xc5, 0x25, 0x42, 0x00,
+ 0x01, 0x2c, 0x0c, 0x10, 0x49, 0x07, 0xef, 0xff, 0x84, 0x71, 0x2f, 0x22, 0x40, 0x90, 0x41, 0x26,
+ 0x04, 0x70, 0x00, 0x00, 0x00, 0x00, 0x34, 0x02, 0x01, 0x00, 0x2f, 0x23, 0xc0, 0x90, 0x41, 0x26,
+ 0x05, 0x70, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x02, 0x01, 0x00, 0x0c, 0x23, 0x80, 0x92, 0xcc, 0x22,
+ 0x01, 0x80, 0x08, 0x42, 0x14, 0x00, 0x0e, 0x00, 0x40, 0x40, 0x41, 0x42, 0x28, 0x42, 0x60, 0x41,
+ 0x41, 0x43, 0x88, 0x42, 0xa0, 0x44, 0x41, 0x45, 0x2f, 0x26, 0x40, 0x00, 0x41, 0x2e, 0x46, 0x85,
+ 0x06, 0x21, 0x81, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x21, 0x82, 0x0f, 0x10, 0x00, 0x00, 0x00,
+ 0x2e, 0x00, 0x22, 0x00, 0x00, 0x40, 0xcb, 0x42, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80,
+ 0x2f, 0x21, 0x4b, 0x00, 0xc4, 0x71, 0x04, 0x21, 0xbe, 0x82, 0x42, 0x26, 0x46, 0x00, 0x12, 0x00,
+ 0x02, 0x00, 0x2f, 0x20, 0x00, 0x80, 0xf3, 0x07, 0xef, 0xff, 0x2f, 0x21, 0x4b, 0x00, 0x2f, 0x27,
+ 0xc0, 0x00, 0x41, 0x2f, 0x47, 0x85, 0x06, 0x23, 0x88, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x20,
+ 0x82, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x22, 0x00, 0x40, 0x42, 0xcb, 0x42, 0x10, 0x00,
+ 0x00, 0x00, 0x2f, 0x22, 0x80, 0x80, 0x2f, 0x20, 0x0b, 0x12, 0xe4, 0x71, 0x04, 0x20, 0xbe, 0x92,
+ 0x42, 0x27, 0x47, 0x00, 0x10, 0x00, 0x02, 0x00, 0x2f, 0x22, 0x80, 0x80, 0xf1, 0x07, 0xef, 0xff,
+ 0x2f, 0x20, 0x0b, 0x12, 0x8c, 0x26, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70, 0x76, 0x03, 0x01, 0x00,
+ 0x8c, 0x27, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70, 0xc4, 0x03, 0x21, 0x00, 0x02, 0x26, 0xcb, 0x01,
+ 0x4c, 0x23, 0x80, 0x9d, 0x02, 0x21, 0x49, 0x12, 0x3a, 0x01, 0x09, 0x00, 0x42, 0x23, 0x8a, 0x90,
+ 0x4a, 0x26, 0x00, 0x70, 0x8a, 0x00, 0x01, 0x00, 0x24, 0x00, 0x09, 0x00, 0x2f, 0x22, 0x80, 0x80,
+ 0x2f, 0x20, 0x0b, 0x12, 0x40, 0x22, 0x4a, 0x90, 0x4a, 0x26, 0x00, 0x70, 0x72, 0x00, 0x01, 0x00,
+ 0x2f, 0x22, 0x80, 0x80, 0x6b, 0x00, 0x20, 0x00, 0x2f, 0x20, 0x0b, 0x12, 0x4c, 0x22, 0x00, 0x98,
+ 0x6d, 0x70, 0x28, 0x00, 0x2b, 0x00, 0x42, 0x22, 0x0a, 0x18, 0x0a, 0x21, 0x80, 0x90, 0x12, 0x00,
+ 0x02, 0x00, 0x02, 0x26, 0x8b, 0x72, 0x00, 0x00, 0x20, 0x00, 0x00, 0x28, 0xc9, 0x12, 0x01, 0x28,
+ 0x82, 0x12, 0x3f, 0x00, 0x20, 0x00, 0x0d, 0x70, 0x02, 0x26, 0x8b, 0x72, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x2a, 0xc9, 0x02, 0x02, 0x26, 0x8b, 0xf2, 0x00, 0x00, 0x20, 0x00, 0x00, 0x28, 0xcb, 0x12,
+ 0x12, 0x00, 0x09, 0x00, 0x40, 0x22, 0x0b, 0x18, 0x01, 0x28, 0xc2, 0x12, 0x13, 0x00, 0x20, 0x00,
+ 0x0d, 0x70, 0x01, 0x2a, 0x82, 0x02, 0x01, 0x28, 0x88, 0x12, 0x05, 0x22, 0xc2, 0x02, 0x2f, 0x20,
+ 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00, 0x0c, 0x24,
+ 0x40, 0x81, 0x4a, 0x26, 0x00, 0x70, 0xe0, 0x01, 0x02, 0x00, 0x00, 0x20, 0x80, 0x80, 0x01, 0x21,
+ 0x01, 0x02, 0x04, 0x21, 0xbe, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x14, 0x00,
+ 0x01, 0x00, 0xc4, 0x71, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x80, 0xc5, 0x21, 0x65, 0x10,
+ 0x44, 0x20, 0xbe, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x34, 0x00, 0x21, 0x00, 0x35, 0x70, 0xcb, 0x20,
+ 0x61, 0x81, 0x4a, 0x26, 0x00, 0x70, 0x28, 0x00, 0x01, 0x00, 0x40, 0x20, 0x80, 0x80, 0xc0, 0x21,
+ 0x65, 0x00, 0x04, 0x21, 0xbe, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x10, 0x00,
+ 0x01, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0xc4, 0x71, 0x2f, 0x21, 0x42, 0x80,
+ 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0xd4, 0x70, 0x4a, 0x26,
+ 0x00, 0x70, 0x66, 0x00, 0x0c, 0x00, 0x8c, 0x26, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70, 0x3e, 0x01,
+ 0x0a, 0x00, 0x06, 0x21, 0x81, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x40, 0x2e, 0x02, 0x05, 0x45, 0x79,
+ 0x2f, 0x22, 0x03, 0x01, 0x45, 0x79, 0xe0, 0x7e, 0x14, 0x70, 0x4a, 0x26, 0x00, 0x70, 0xce, 0x05,
+ 0xc2, 0xff, 0xd3, 0x73, 0x00, 0x80, 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x7c, 0x71, 0x12, 0x00,
+ 0x02, 0x00, 0x54, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x7c, 0x71, 0xca, 0x21, 0x41, 0x00, 0x40, 0x40,
+ 0xe0, 0x7e, 0x54, 0x70, 0x4a, 0x26, 0x00, 0x70, 0xb2, 0x05, 0xc2, 0xff, 0x4a, 0x26, 0x00, 0x70,
+ 0xe0, 0x7e, 0x4a, 0x26, 0x00, 0x70, 0x02, 0x26, 0x8a, 0x71, 0x00, 0x00, 0x00, 0x00, 0x42, 0x22,
+ 0x4a, 0x90, 0x4a, 0x26, 0x00, 0x70, 0x88, 0x00, 0x0b, 0x00, 0x8c, 0x00, 0x01, 0x00, 0x4c, 0x22,
+ 0x00, 0x98, 0x4a, 0x26, 0x00, 0x70, 0x2a, 0x00, 0x0b, 0x00, 0x42, 0x22, 0x0a, 0x18, 0x05, 0x21,
+ 0x09, 0x90, 0x6d, 0x77, 0x10, 0x00, 0x02, 0x00, 0x00, 0x2b, 0x8b, 0x12, 0x87, 0x23, 0xff, 0x1f,
+ 0x04, 0x21, 0xc9, 0x02, 0x01, 0x29, 0x80, 0x02, 0x5d, 0x00, 0x20, 0x00, 0x2c, 0x70, 0x35, 0x70,
+ 0x6d, 0x77, 0x1e, 0x00, 0x02, 0x00, 0x4c, 0x22, 0x00, 0x98, 0xc2, 0x23, 0xca, 0x12, 0x0a, 0x00,
+ 0x0a, 0x00, 0x00, 0x2b, 0x8b, 0x12, 0x87, 0x23, 0xff, 0x1f, 0x04, 0x20, 0xc9, 0x02, 0x02, 0x26,
+ 0x8b, 0xf2, 0x00, 0x00, 0x20, 0x00, 0x00, 0x29, 0xcb, 0x02, 0x14, 0x00, 0x09, 0x00, 0x40, 0x22,
+ 0x0b, 0x18, 0x01, 0x29, 0xc0, 0x02, 0x15, 0x00, 0x20, 0x00, 0x2c, 0x70, 0x01, 0x28, 0x80, 0x02,
+ 0x01, 0x29, 0x81, 0x02, 0x05, 0x20, 0xc0, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80,
+ 0x2f, 0x21, 0x4b, 0x00, 0x44, 0x20, 0xbe, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x1c, 0x00, 0x01, 0x00,
+ 0x44, 0x20, 0x4a, 0x01, 0x05, 0x22, 0x7e, 0x92, 0x4a, 0x26, 0x00, 0x70, 0x0c, 0x00, 0x01, 0x00,
+ 0x40, 0x20, 0x80, 0x80, 0x41, 0x21, 0x01, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00,
+ 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x02, 0x26, 0x86, 0x01, 0x04, 0x21, 0xbe, 0x8f,
+ 0x10, 0x00, 0x00, 0x00, 0xc0, 0x26, 0x62, 0x00, 0x65, 0xf1, 0x8a, 0x26, 0xdf, 0x0f, 0xc3, 0x41,
+ 0x10, 0x00, 0x00, 0x00, 0x0c, 0x70, 0x5f, 0xf1, 0x02, 0x26, 0x86, 0x01, 0x2c, 0x70, 0xb7, 0x06,
+ 0xef, 0xff, 0x0c, 0x70, 0x02, 0x20, 0x80, 0x80, 0x03, 0x21, 0x01, 0x02, 0x04, 0x21, 0xbe, 0x8f,
+ 0x40, 0x00, 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x20, 0x00, 0x02, 0x00, 0x2f, 0x20, 0x00, 0x80,
+ 0x2f, 0x21, 0x4b, 0x00, 0x42, 0x26, 0x46, 0x00, 0x04, 0x21, 0xbe, 0x8f, 0x40, 0x00, 0x00, 0x00,
+ 0x4a, 0x26, 0x00, 0x70, 0x52, 0x00, 0x01, 0x00, 0x44, 0x20, 0xbe, 0x80, 0x4a, 0x26, 0x00, 0x70,
+ 0x46, 0x00, 0x21, 0x00, 0x44, 0x20, 0x7e, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x1a, 0x00, 0x02, 0x00,
+ 0x35, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x32, 0x00, 0x02, 0x00, 0x44, 0x20, 0x3e, 0x81, 0x4a, 0x26,
+ 0x00, 0x70, 0x26, 0x00, 0x01, 0x00, 0x40, 0x20, 0x80, 0x80, 0x41, 0x21, 0x01, 0x00, 0x04, 0x21,
+ 0xbe, 0x8f, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x26, 0x62, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x2f, 0x21,
+ 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21,
+ 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0xd3, 0x71, 0x10, 0x00, 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70,
+ 0xfc, 0x05, 0xca, 0xff, 0x34, 0x70, 0xcc, 0x20, 0x21, 0x80, 0x4a, 0x26, 0x00, 0x70, 0xa6, 0xf3,
+ 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00, 0xd3, 0x71, 0x10, 0x00, 0x00, 0x00, 0x42, 0x26,
+ 0x46, 0x00, 0xb8, 0xf6, 0xd4, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x3e, 0x06, 0xcc, 0xff, 0xe7, 0x05,
+ 0xcf, 0xff, 0xd3, 0x71, 0x10, 0x00, 0x00, 0x00, 0xcc, 0x20, 0x21, 0x80, 0x2f, 0x21, 0x03, 0x01,
+ 0x02, 0x78, 0x10, 0x00, 0x01, 0x00, 0x05, 0x21, 0x81, 0x0f, 0xf8, 0x7f, 0x00, 0x00, 0xe0, 0x7e,
+ 0x8c, 0x27, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70, 0x28, 0x00, 0x02, 0x00, 0x0c, 0x20, 0x80, 0x9f,
+ 0x10, 0x00, 0x00, 0x00, 0xcc, 0x22, 0x21, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x0a, 0x00, 0x01, 0x00,
+ 0x2f, 0x21, 0x43, 0x01, 0xe9, 0xf1, 0x0c, 0x24, 0x40, 0x81, 0x4a, 0x26, 0x00, 0x70, 0xe5, 0xf5,
+ 0x05, 0x21, 0x81, 0x0f, 0xf0, 0x7f, 0x00, 0x00, 0x0c, 0x70, 0xe0, 0x7e, 0x60, 0x41, 0x40, 0x40,
+ 0xe0, 0x7e, 0xe0, 0x78, 0xfc, 0x1c, 0x88, 0xb1, 0xfc, 0x1c, 0x48, 0xb1, 0xfc, 0x1c, 0x08, 0xb1,
+ 0xe1, 0xc3, 0xe1, 0xc2, 0xe1, 0xc1, 0xe1, 0xc0, 0x07, 0xc0, 0x1c, 0x1c, 0xc0, 0x31, 0xe1, 0xc0,
+ 0xe0, 0x7f, 0x01, 0xc0, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x10, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x78, 0xe0,
+ 0x49, 0x08, 0x40, 0x00, 0x05, 0x20, 0x4c, 0x00, 0x44, 0x24, 0xfe, 0x90, 0xc2, 0x21, 0x22, 0x01,
+ 0x90, 0x00, 0x02, 0x00, 0x40, 0x80, 0x04, 0x11, 0x03, 0x04, 0xcb, 0x43, 0x01, 0x01, 0x01, 0x01,
+ 0x2f, 0x24, 0xc3, 0x12, 0x02, 0x22, 0xca, 0x02, 0x25, 0x0a, 0xc1, 0x00, 0x06, 0x22, 0xca, 0x10,
+ 0x04, 0x22, 0x0a, 0x93, 0x14, 0x00, 0x02, 0x00, 0x04, 0x10, 0x02, 0x02, 0x04, 0x11, 0x03, 0x04,
+ 0xe9, 0x07, 0xef, 0xff, 0x02, 0x22, 0xca, 0x02, 0xe0, 0x7f, 0x0c, 0x70, 0x2f, 0x20, 0x87, 0x80,
+ 0x6f, 0x79, 0x39, 0x08, 0x41, 0x00, 0xfa, 0xf3, 0x2f, 0x22, 0x88, 0x1f, 0xff, 0xff, 0x00, 0xff,
+ 0x04, 0x23, 0x81, 0x02, 0x04, 0x22, 0x80, 0x82, 0x21, 0x08, 0x41, 0x00, 0xee, 0xf3, 0x40, 0x2a,
+ 0x0a, 0x12, 0x04, 0x23, 0x81, 0x02, 0x04, 0x22, 0x80, 0x82, 0x11, 0x08, 0x41, 0x00, 0xe6, 0xf3,
+ 0x41, 0x2b, 0x01, 0x06, 0x41, 0x2a, 0x00, 0x06, 0x09, 0x09, 0x02, 0x00, 0xe0, 0x7f, 0x0c, 0x77,
+ 0xe0, 0x7f, 0x0c, 0x71, 0x0c, 0x71, 0x0a, 0x00, 0x06, 0x00, 0x2f, 0x20, 0xc5, 0x02, 0xe0, 0x7e,
+ 0x40, 0x88, 0x24, 0x73, 0x01, 0x11, 0x83, 0x02, 0x70, 0x72, 0x8a, 0x23, 0xc3, 0x1f, 0xf4, 0xf5,
+ 0x0a, 0x26, 0x80, 0xf0, 0x0c, 0x00, 0x01, 0x00, 0xed, 0x07, 0xef, 0xff, 0x01, 0x10, 0x82, 0x02,
+ 0xe0, 0x7f, 0x0c, 0x70, 0xe0, 0x78, 0xe0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xc3, 0x40, 0x00, 0x00, 0x00, 0x00, 0x84, 0xd7, 0x97, 0x41,
+ 0x00, 0x80, 0xe0, 0x37, 0x79, 0xc3, 0x41, 0x43, 0x17, 0x6e, 0x05, 0xb5, 0xb5, 0xb8, 0x93, 0x46,
+ 0xf5, 0xf9, 0x3f, 0xe9, 0x03, 0x4f, 0x38, 0x4d, 0x32, 0x1d, 0x30, 0xf9, 0x48, 0x77, 0x82, 0x5a,
+ 0x3c, 0xbf, 0x73, 0x7f, 0xdd, 0x4f, 0x15, 0x75, 0x08, 0x44, 0x40, 0x40, 0x81, 0x42, 0x28, 0x44,
+ 0x60, 0x41, 0x81, 0x43, 0xcb, 0x44, 0xe0, 0xff, 0x00, 0x00, 0x14, 0x24, 0x46, 0x10, 0x14, 0x24,
+ 0xca, 0x10, 0xb6, 0xbc, 0x0c, 0x26, 0x00, 0x83, 0xcc, 0x22, 0x05, 0x93, 0xde, 0x00, 0x26, 0x00,
+ 0x96, 0xbc, 0x04, 0x26, 0x06, 0x03, 0x04, 0x22, 0x0a, 0x13, 0x02, 0x26, 0x86, 0x82, 0x2f, 0x26,
+ 0x84, 0x01, 0x00, 0x26, 0x86, 0x0f, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x26, 0x0a, 0x83, 0xcc, 0x26,
+ 0x03, 0x83, 0x50, 0x01, 0x04, 0x00, 0x07, 0x21, 0xca, 0x80, 0xcf, 0x26, 0xe4, 0x07, 0x06, 0x21,
+ 0x04, 0x03, 0x86, 0x7b, 0x4f, 0x24, 0x04, 0x05, 0x94, 0xbb, 0x00, 0x45, 0x0c, 0x24, 0xc0, 0x80,
+ 0xcc, 0x25, 0x81, 0x80, 0x14, 0x00, 0x06, 0x00, 0x02, 0x26, 0x86, 0x0f, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x25, 0x45, 0x81, 0x01, 0x24, 0x04, 0x01, 0x4a, 0x24, 0x80, 0x75, 0x2c, 0x70, 0xa8, 0x20,
+ 0xc0, 0x04, 0x0c, 0x24, 0xc0, 0x80, 0xcc, 0x25, 0x81, 0x80, 0x12, 0x00, 0x05, 0x00, 0x0f, 0x21,
+ 0x01, 0x0f, 0x02, 0x25, 0x85, 0x80, 0x03, 0x24, 0xc4, 0x00, 0x00, 0x25, 0x45, 0x81, 0x01, 0x24,
+ 0x04, 0x01, 0x05, 0x24, 0x40, 0x81, 0x4a, 0x24, 0x00, 0x78, 0x0c, 0x70, 0xe8, 0x20, 0xa2, 0x04,
+ 0x0c, 0x24, 0xc0, 0x80, 0xcc, 0x25, 0x81, 0x80, 0x10, 0x00, 0x05, 0x00, 0x0f, 0x20, 0x00, 0x0f,
+ 0x02, 0x25, 0x85, 0x80, 0x03, 0x24, 0xc4, 0x00, 0x00, 0x25, 0x45, 0x81, 0x01, 0x24, 0x04, 0x01,
+ 0x2f, 0x20, 0x03, 0x00, 0x41, 0x29, 0x81, 0x80, 0x2f, 0x20, 0x04, 0x80, 0xc0, 0x71, 0xe1, 0x20,
+ 0xc6, 0x07, 0x44, 0x20, 0x4c, 0x00, 0x05, 0x24, 0x0c, 0x11, 0x05, 0x24, 0x4c, 0x91, 0xe0, 0x7c,
+ 0x40, 0x20, 0x40, 0x80, 0xe0, 0x7f, 0x41, 0x21, 0x01, 0x00, 0x02, 0x22, 0x0a, 0x93, 0xcc, 0x22,
+ 0x21, 0x80, 0x1a, 0x00, 0x02, 0x00, 0x2f, 0x26, 0x40, 0xf0, 0x2f, 0x21, 0x04, 0x03, 0xcc, 0x20,
+ 0x21, 0x80, 0xcf, 0x21, 0xe1, 0x04, 0xe0, 0x7f, 0x0c, 0x70, 0x0c, 0x22, 0x00, 0x93, 0xcc, 0x22,
+ 0x21, 0x80, 0xca, 0x20, 0x8d, 0x00, 0xe1, 0x20, 0xcd, 0x07, 0xca, 0x21, 0xcd, 0x00, 0x02, 0x26,
+ 0x06, 0x83, 0xcc, 0x20, 0x21, 0x80, 0xe1, 0x20, 0xc1, 0x07, 0xca, 0x21, 0x21, 0x00, 0x0c, 0x26,
+ 0x00, 0x83, 0xcc, 0x22, 0x05, 0x93, 0x4c, 0x00, 0x05, 0x00, 0x0c, 0x26, 0x00, 0x83, 0xcc, 0x20,
+ 0x21, 0x80, 0xe1, 0x20, 0xcd, 0x07, 0x0c, 0x22, 0x00, 0x93, 0xcc, 0x22, 0x21, 0x80, 0xca, 0x20,
+ 0x8d, 0x00, 0xe1, 0x20, 0xcd, 0x07, 0xca, 0x21, 0xcd, 0x00, 0x0c, 0x22, 0x00, 0x93, 0xcc, 0x22,
+ 0x21, 0x80, 0xcc, 0x26, 0x01, 0x83, 0xcc, 0x20, 0x21, 0x80, 0xe1, 0x20, 0xc1, 0x07, 0xcf, 0x21,
+ 0xe1, 0x04, 0x0c, 0x26, 0x00, 0x83, 0xcc, 0x20, 0x21, 0x80, 0xc0, 0x78, 0xe0, 0x7f, 0xc0, 0x79,
+ 0x2f, 0x25, 0xc0, 0x80, 0x41, 0x26, 0x04, 0x70, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x22, 0x21, 0x80,
+ 0x4a, 0x26, 0x00, 0x70, 0xaa, 0x02, 0x21, 0x00, 0x2f, 0x21, 0x40, 0x90, 0xc7, 0x24, 0x65, 0x00,
+ 0xcc, 0x20, 0x21, 0x80, 0x4a, 0x26, 0x00, 0x70, 0xc2, 0x02, 0x01, 0x00, 0x41, 0x29, 0x46, 0x95,
+ 0x06, 0x21, 0x81, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x21, 0x82, 0x0f, 0x10, 0x00, 0x00, 0x00,
+ 0x2e, 0x00, 0x22, 0x00, 0x00, 0x40, 0xcb, 0x42, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80,
+ 0x2f, 0x21, 0x4b, 0x00, 0xc4, 0x71, 0x04, 0x21, 0xbe, 0x82, 0x42, 0x26, 0x46, 0x00, 0x12, 0x00,
+ 0x02, 0x00, 0x2f, 0x20, 0x00, 0x80, 0xf3, 0x07, 0xef, 0xff, 0x2f, 0x21, 0x4b, 0x00, 0x41, 0x2d,
+ 0x47, 0x85, 0x06, 0x23, 0x88, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xc5, 0x20, 0x82, 0x1f, 0x10, 0x00,
+ 0x00, 0x00, 0x30, 0x00, 0x22, 0x00, 0x40, 0x42, 0xcb, 0x42, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x22,
+ 0x80, 0x80, 0x2f, 0x20, 0x0b, 0x12, 0xe4, 0x71, 0x04, 0x20, 0xbe, 0x92, 0x42, 0x27, 0x47, 0x00,
+ 0x10, 0x00, 0x02, 0x00, 0x2f, 0x22, 0x80, 0x80, 0xf1, 0x07, 0xef, 0xff, 0x2f, 0x20, 0x0b, 0x12,
+ 0x8c, 0x26, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70, 0x62, 0x02, 0x01, 0x00, 0x8c, 0x27, 0xdf, 0x8f,
+ 0x4a, 0x26, 0x00, 0x70, 0x8a, 0x02, 0x21, 0x00, 0x02, 0x26, 0xc6, 0x01, 0x80, 0x26, 0xcf, 0x0f,
+ 0x4a, 0x24, 0xc0, 0x7d, 0x6d, 0x70, 0x4d, 0x70, 0xa8, 0x20, 0x40, 0x05, 0x2f, 0x22, 0x80, 0x92,
+ 0x2f, 0x23, 0xcb, 0x12, 0x11, 0x71, 0xcc, 0x20, 0x81, 0x80, 0xc5, 0x22, 0x66, 0x10, 0x0e, 0x00,
+ 0x05, 0x00, 0x02, 0x20, 0x80, 0x80, 0x03, 0x21, 0x01, 0x02, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21,
+ 0x4b, 0x00, 0x05, 0x21, 0x09, 0x00, 0x61, 0x41, 0x41, 0x40, 0x04, 0x21, 0xbe, 0x8f, 0x40, 0x00,
+ 0x00, 0x00, 0xc2, 0x26, 0x61, 0x00, 0x0e, 0x00, 0x02, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21,
+ 0x4b, 0x00, 0xd4, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x72, 0x00, 0x0c, 0x00, 0x44, 0x20, 0xbe, 0x80,
+ 0x4a, 0x26, 0x00, 0x70, 0x34, 0x00, 0x01, 0x00, 0x44, 0x20, 0x4a, 0x01, 0x05, 0x21, 0xbe, 0x92,
+ 0x4a, 0x26, 0x00, 0x70, 0x24, 0x00, 0x01, 0x00, 0x40, 0x20, 0x80, 0x80, 0x41, 0x21, 0x01, 0x00,
+ 0x04, 0x21, 0xbe, 0x8f, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x26, 0x62, 0x00, 0x0c, 0x00, 0x01, 0x00,
+ 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00,
+ 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x8c, 0x26, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70,
+ 0x22, 0x01, 0x0a, 0x00, 0x06, 0x21, 0x81, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x40, 0x2e, 0x02, 0x05,
+ 0x45, 0x79, 0x2f, 0x22, 0x03, 0x01, 0x45, 0x79, 0xe0, 0x7e, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20,
+ 0x04, 0x80, 0xc5, 0x21, 0x65, 0x10, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x80, 0xc5, 0x21,
+ 0x65, 0x10, 0x8c, 0x26, 0xff, 0x82, 0x4a, 0x26, 0x00, 0x70, 0xfa, 0x00, 0x0b, 0x00, 0x02, 0x26,
+ 0x8a, 0x71, 0x00, 0x00, 0x00, 0x00, 0x42, 0x22, 0x4a, 0x90, 0x4a, 0x26, 0x00, 0x70, 0x88, 0x00,
+ 0x0b, 0x00, 0x8c, 0x00, 0x01, 0x00, 0x4c, 0x22, 0x00, 0x98, 0x4a, 0x26, 0x00, 0x70, 0x2a, 0x00,
+ 0x0b, 0x00, 0x42, 0x22, 0x0a, 0x18, 0x05, 0x21, 0x09, 0x90, 0x6d, 0x77, 0x10, 0x00, 0x02, 0x00,
+ 0x00, 0x2b, 0x8b, 0x12, 0x87, 0x23, 0xff, 0x1f, 0x04, 0x21, 0xc9, 0x02, 0x01, 0x29, 0x80, 0x02,
+ 0x5d, 0x00, 0x20, 0x00, 0x2c, 0x70, 0x35, 0x70, 0x6d, 0x77, 0x1e, 0x00, 0x02, 0x00, 0x4c, 0x22,
+ 0x00, 0x98, 0xc2, 0x23, 0xca, 0x12, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x2b, 0x8b, 0x12, 0x87, 0x23,
+ 0xff, 0x1f, 0x04, 0x20, 0xc9, 0x02, 0x02, 0x26, 0x8b, 0xf2, 0x00, 0x00, 0x20, 0x00, 0x00, 0x29,
+ 0xcb, 0x02, 0x14, 0x00, 0x09, 0x00, 0x40, 0x22, 0x0b, 0x18, 0x01, 0x29, 0xc0, 0x02, 0x15, 0x00,
+ 0x20, 0x00, 0x2c, 0x70, 0x01, 0x28, 0x80, 0x02, 0x01, 0x29, 0x81, 0x02, 0x05, 0x20, 0xc0, 0x02,
+ 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x20, 0x00, 0x80, 0x2f, 0x21, 0x4b, 0x00, 0x44, 0x20, 0xbe, 0x80,
+ 0x4a, 0x26, 0x00, 0x70, 0x1c, 0x00, 0x01, 0x00, 0x44, 0x20, 0x4a, 0x01, 0x05, 0x22, 0x7e, 0x92,
+ 0x4a, 0x26, 0x00, 0x70, 0x0c, 0x00, 0x01, 0x00, 0x40, 0x20, 0x80, 0x80, 0x41, 0x21, 0x01, 0x00,
+ 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00, 0x2f, 0x21, 0x42, 0x80, 0x2f, 0x20, 0x04, 0x00,
+ 0x02, 0x26, 0x86, 0x01, 0x04, 0x21, 0xbe, 0x8f, 0x10, 0x00, 0x00, 0x00, 0xc0, 0x26, 0x62, 0x00,
+ 0x72, 0xf1, 0x8a, 0x26, 0xdf, 0x0f, 0xc3, 0x41, 0x10, 0x00, 0x00, 0x00, 0xd9, 0x06, 0xef, 0xff,
+ 0x0c, 0x70, 0x02, 0x26, 0x86, 0x01, 0x2c, 0x70, 0xcd, 0x06, 0xef, 0xff, 0x0c, 0x70, 0xc7, 0x24,
+ 0x65, 0x00, 0xcc, 0x20, 0x21, 0x80, 0x70, 0x00, 0x01, 0x00, 0x0c, 0x21, 0x80, 0x9f, 0xe0, 0xff,
+ 0x00, 0x00, 0xc3, 0x41, 0xf0, 0x7f, 0x00, 0x00, 0x5c, 0x00, 0x0d, 0x00, 0x94, 0x70, 0xc5, 0x21,
+ 0x82, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x0c, 0x70, 0xe0, 0x7e, 0x0c, 0x25, 0x80, 0x8f, 0xe0, 0xff,
+ 0x00, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x40, 0x00, 0x0d, 0x00, 0x2c, 0x70, 0x10, 0x00, 0x05, 0x00,
+ 0xcc, 0x22, 0x21, 0x80, 0x4a, 0x26, 0x00, 0x70, 0x2c, 0x00, 0x02, 0x00, 0x94, 0x70, 0xc5, 0x21,
+ 0x82, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x0c, 0x70, 0xe0, 0x7e, 0xd3, 0x71, 0x10, 0x00, 0x00, 0x00,
+ 0x4a, 0x26, 0x00, 0x70, 0x10, 0x00, 0x02, 0x00, 0x8c, 0x27, 0xdf, 0x8f, 0x4a, 0x26, 0x00, 0x70,
+ 0x0e, 0x00, 0x02, 0x00, 0xc3, 0x41, 0xf8, 0x7f, 0x00, 0x00, 0x0c, 0x70, 0xe0, 0x7e, 0x2f, 0x21,
+ 0x03, 0x01, 0x05, 0x21, 0x81, 0x0f, 0xf0, 0x7f, 0x00, 0x00, 0x0c, 0x70, 0xe0, 0x7e, 0x0c, 0x20,
+ 0x80, 0x9f, 0x10, 0x00, 0x00, 0x00, 0xcc, 0x22, 0x21, 0x80, 0xca, 0x20, 0x21, 0x00, 0xca, 0x21,
+ 0x21, 0x00, 0x08, 0x00, 0x02, 0x00, 0xe0, 0x7e, 0xe6, 0xf1, 0xe0, 0x78, 0x2f, 0x23, 0x40, 0x80,
+ 0x4a, 0x24, 0xc0, 0x02, 0x14, 0x00, 0x26, 0x00, 0x6f, 0x22, 0x0a, 0x00, 0x6f, 0x22, 0x0a, 0x00,
+ 0x2f, 0x22, 0x82, 0x00, 0x4a, 0x24, 0x80, 0x02, 0x2f, 0x24, 0x40, 0x90, 0xc0, 0x22, 0x65, 0x00,
+ 0x41, 0x2c, 0x43, 0x15, 0x8c, 0x23, 0xdf, 0x8f, 0x48, 0x00, 0x21, 0x00, 0x53, 0x21, 0x01, 0x85,
+ 0x8e, 0x23, 0xd0, 0x84, 0x1a, 0x00, 0x24, 0x00, 0x94, 0xb9, 0x9f, 0xe3, 0x01, 0x29, 0xc0, 0x00,
+ 0xca, 0x20, 0x29, 0x00, 0x51, 0x22, 0x00, 0x80, 0xe0, 0x7f, 0xce, 0x20, 0x21, 0x00, 0x4e, 0x23,
+ 0x03, 0x00, 0x90, 0x73, 0x4e, 0x23, 0x0c, 0x08, 0x01, 0x28, 0x00, 0x03, 0x00, 0x29, 0xc1, 0x00,
+ 0x25, 0x78, 0xca, 0x20, 0x89, 0x00, 0xd1, 0x22, 0x2c, 0x80, 0xe0, 0x7f, 0xce, 0x20, 0x21, 0x00,
+ 0xcc, 0x20, 0x21, 0x80, 0x40, 0x40, 0xd1, 0x20, 0x22, 0x80, 0xe0, 0x7f, 0xc0, 0x20, 0x62, 0x00,
+ 0x8d, 0x71, 0x0a, 0x21, 0x00, 0x80, 0xd4, 0x24, 0x04, 0x13, 0x13, 0x00, 0x20, 0x00, 0xce, 0x20,
+ 0x24, 0x00, 0xe0, 0x78, 0x0a, 0x21, 0x00, 0x80, 0x8d, 0x71, 0xe1, 0x20, 0xc1, 0x07, 0x40, 0x2c,
+ 0x8c, 0x17, 0x4c, 0x70, 0x00, 0x41, 0xd3, 0x71, 0x01, 0x00, 0x00, 0x00, 0xc1, 0x29, 0x26, 0x04,
+ 0xc0, 0x22, 0x25, 0x04, 0x8c, 0x21, 0x04, 0x80, 0xc1, 0x29, 0x26, 0x02, 0xc0, 0x22, 0x25, 0x02,
+ 0x90, 0xe1, 0xc1, 0x29, 0x26, 0x01, 0xc0, 0x22, 0x25, 0x01, 0x34, 0x74, 0xc1, 0x29, 0xa6, 0x00,
+ 0xc0, 0x22, 0xa5, 0x00, 0x34, 0x72, 0xc0, 0x22, 0x65, 0x00, 0x00, 0x28, 0x83, 0x00, 0x4e, 0x22,
+ 0xc2, 0x07, 0x40, 0x2a, 0x02, 0x05, 0x85, 0x7a, 0x40, 0x2b, 0x40, 0x05, 0x42, 0x2b, 0xc1, 0x02,
+ 0xe0, 0x7f, 0x59, 0x61, 0x34, 0x78, 0xe0, 0x7f, 0x14, 0x70, 0xe0, 0x78, 0x70, 0x71, 0x04, 0xf4,
+ 0x50, 0x70, 0x09, 0xf2, 0x7b, 0x7b, 0x3b, 0x79, 0x25, 0x78, 0x45, 0x78, 0x05, 0x20, 0xc0, 0x80,
+ 0x0b, 0xf4, 0xc3, 0x40, 0xe0, 0xff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54, 0x80, 0x2a, 0x80, 0x00, 0x80, 0x74, 0x11, 0x07, 0x20, 0x4c, 0x11,
+ 0x06, 0x20, 0x24, 0x11, 0x05, 0x20, 0xfc, 0x11, 0x04, 0xa0, 0x86, 0xc4, 0x41, 0xc4, 0x8a, 0x09,
+ 0x6f, 0x0d, 0x00, 0x1c, 0x81, 0x30, 0x09, 0xc3, 0x08, 0xc2, 0x07, 0xc1, 0x06, 0xc0, 0x5a, 0x09,
+ 0x6f, 0x0d, 0x40, 0x24, 0x04, 0x32, 0x02, 0xc5, 0x2c, 0x70, 0xa1, 0x40, 0x22, 0x0e, 0x6f, 0x03,
+ 0x0e, 0x26, 0x0e, 0x14, 0xc5, 0xf6, 0x05, 0xc3, 0x04, 0xc2, 0x03, 0xc1, 0x10, 0xf0, 0x52, 0x25,
+ 0xcd, 0x17, 0x42, 0xc5, 0x03, 0xc0, 0x52, 0x20, 0xc1, 0x07, 0x43, 0xc1, 0x04, 0xc0, 0x52, 0x20,
+ 0xc2, 0x07, 0x44, 0xc2, 0x05, 0xc0, 0x52, 0x20, 0xc3, 0x07, 0x45, 0xc3, 0x40, 0x24, 0x04, 0x32,
+ 0x4e, 0x08, 0xaf, 0x0d, 0xa1, 0x40, 0x03, 0xc0, 0xd0, 0x79, 0x01, 0x32, 0x82, 0x24, 0x2f, 0x39,
+ 0x43, 0x00, 0xaa, 0x09, 0x6f, 0x08, 0x00, 0x3a, 0x4e, 0x00, 0x00, 0x36, 0x10, 0x10, 0x00, 0x1f,
+ 0x00, 0x14, 0x9a, 0x09, 0x6f, 0x08, 0x04, 0xc0, 0x00, 0x36, 0x12, 0x10, 0x04, 0x1f, 0x80, 0x14,
+ 0x8a, 0x09, 0x6f, 0x08, 0x05, 0xc0, 0xcb, 0x45, 0x0b, 0x42, 0x57, 0xa0, 0x00, 0x36, 0x11, 0x10,
+ 0x02, 0x40, 0xa1, 0x41, 0xaa, 0x0d, 0x6f, 0x03, 0x08, 0x1f, 0x40, 0x14, 0xa9,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, 0x8d, 0x72, 0xed, 0x73, 0x12, 0xf0, 0xed, 0x71, 0x8d, 0x71, 0x0e, 0xf0, 0x0f, 0xdf,
+ 0x06, 0xf0, 0xed, 0x70, 0x6c, 0x70, 0x15, 0x09, 0xf2, 0x02, 0x8d, 0x70, 0x79, 0x24, 0x00, 0x00,
+ 0x68, 0x44, 0x75, 0x68, 0x40, 0x23, 0xcb, 0x0d, 0x40, 0x24, 0xce, 0x37, 0xad, 0x71, 0x20, 0x1c,
+ 0x03, 0x30, 0x08, 0xec, 0x01, 0x2a, 0x00, 0x03, 0x04, 0x22, 0xc3, 0x03, 0x00, 0x42, 0x06, 0xf0,
+ 0x09, 0x2a, 0x43, 0x00, 0x05, 0x2a, 0x42, 0x00, 0x89, 0xe3, 0x30, 0xd8, 0xca, 0x20, 0xc9, 0x02,
+ 0x78, 0x60, 0xa5, 0x71, 0xff, 0x1e, 0x12, 0x90, 0xed, 0xea, 0x21, 0x6e, 0x22, 0x40, 0x36, 0x0e,
+ 0x6f, 0x03, 0xa1, 0x42, 0x0b, 0x08, 0x30, 0x20, 0x09, 0x6d, 0x00, 0x18, 0x00, 0x20, 0x22, 0x40,
+ 0xca, 0xc7, 0xe0, 0x78, 0x40, 0x43, 0x20, 0x42, 0x10, 0xd9, 0x69, 0x07, 0xef, 0xff, 0x8c, 0x71,
+ 0xe4, 0xc0, 0x08, 0x45, 0x0c, 0x70, 0x8d, 0x70, 0xa9, 0x40, 0x12, 0xf0, 0xd3, 0x70, 0x99, 0x19,
+ 0x99, 0x99, 0x5a, 0x20, 0x80, 0x02, 0x4e, 0x23, 0xce, 0x0b, 0xca, 0x24, 0xad, 0x18, 0x10, 0x76,
+ 0x1b, 0x63, 0xa5, 0x71, 0xca, 0x24, 0xa5, 0x18, 0x42, 0x23, 0x00, 0x0c, 0x60, 0x8d, 0x32, 0x23,
+ 0x8e, 0x0f, 0x7f, 0x00, 0x15, 0x9a, 0xd9, 0x0e, 0xbf, 0x90, 0x11, 0x75, 0x6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0xaf, 0x07, 0x80, 0xc0, 0x4d, 0xde, 0x21, 0x08, 0x32, 0x00, 0x0c, 0x7e,
+ 0x48, 0xbe, 0xc5, 0x71, 0x89, 0x26, 0x04, 0x1d, 0x8a, 0x09, 0x60, 0x00, 0xc1, 0x40, 0x00, 0xc2,
+ 0x7a, 0x0d, 0xaf, 0xff, 0x01, 0xc3, 0x0c, 0xf0, 0x4d, 0xe6, 0x48, 0xbe, 0x88, 0x26, 0x3b, 0x13,
+ 0x72, 0x09, 0x60, 0x00, 0xd3, 0x78, 0x00, 0xc2, 0x01, 0xc3, 0x23, 0x5b, 0x10, 0x44, 0x30, 0x43,
+ 0x40, 0xc0, 0x50, 0x21, 0xc0, 0x07, 0x41, 0xc1, 0x05, 0x20, 0x3e, 0x85, 0x48, 0xf2, 0xc3, 0x42,
+ 0x99, 0x99, 0x9a, 0x99, 0xc3, 0x43, 0xb9, 0x3f, 0x99, 0x99, 0x82, 0x40, 0x62, 0x41, 0x50, 0x46,
+ 0x0a, 0x25, 0xc0, 0x20, 0x21, 0x5b, 0x54, 0xf6, 0x4c, 0x70, 0xc3, 0x43, 0x24, 0x40, 0x00, 0x00,
+ 0x82, 0x40, 0x62, 0x41, 0x23, 0x5b, 0xc2, 0x42, 0xa2, 0x43, 0x10, 0x44, 0x30, 0x43, 0xc5, 0x77,
+ 0x21, 0x5b, 0xb4, 0xf6, 0x00, 0x1c, 0x00, 0x35, 0x04, 0x1c, 0xc0, 0x34, 0x4c, 0x70, 0x82, 0x40,
+ 0x62, 0x41, 0xc3, 0x43, 0xf0, 0x3f, 0x00, 0x00, 0x21, 0x5b, 0x97, 0xf6, 0x4c, 0x70, 0xc3, 0x43,
+ 0x24, 0x40, 0x00, 0x00, 0x82, 0x40, 0x02, 0x0d, 0xaf, 0xff, 0x62, 0x41, 0x4c, 0x70, 0xc3, 0x43,
+ 0xf0, 0x3f, 0x00, 0x00, 0x10, 0x44, 0x30, 0x43, 0xc5, 0x71, 0x21, 0x5b, 0x70, 0xf6, 0x00, 0x1c,
+ 0x00, 0x35, 0x04, 0x1c, 0xc0, 0x34, 0x82, 0x40, 0x62, 0x41, 0xc2, 0x42, 0xa2, 0x43, 0x21, 0x5b,
+ 0x46, 0xf6, 0x04, 0x1c, 0x40, 0x35, 0x00, 0x1c, 0x80, 0x35, 0x06, 0xf0, 0x0a, 0x26, 0x00, 0x25,
+ 0x0a, 0x25, 0xc0, 0x24, 0x8c, 0x22, 0xc1, 0xa9, 0x04, 0xf4, 0x19, 0x0d, 0x13, 0x10, 0x09, 0xf0,
+ 0x8c, 0x22, 0x81, 0xa9, 0x06, 0xf4, 0x00, 0x25, 0x8d, 0x93, 0x08, 0x00, 0x03, 0x00, 0xad, 0x70,
+ 0x49, 0x25, 0xc1, 0x14, 0x42, 0x27, 0x40, 0x20, 0x42, 0x27, 0x8d, 0x20, 0x10, 0x71, 0xca, 0x25,
+ 0x4b, 0x10, 0x87, 0x0d, 0x32, 0x10, 0x6e, 0x70, 0xf1, 0x44, 0x06, 0xf0, 0x04, 0x14, 0x15, 0x30,
+ 0x00, 0x14, 0x16, 0x30, 0x4c, 0x70, 0xc3, 0x43, 0x97, 0x41, 0x84, 0xd7, 0xc2, 0x40, 0xa2, 0x41,
+ 0x23, 0x5b, 0x10, 0x45, 0x6a, 0x09, 0xef, 0xff, 0x30, 0x46, 0xfe, 0x09, 0xef, 0xff, 0x10, 0x47,
+ 0xa2, 0x42, 0x8a, 0x0a, 0x6f, 0xff, 0xc2, 0x43, 0x41, 0xc1, 0x40, 0xc0, 0x83, 0xc0, 0x0a, 0xd9,
+ 0x82, 0xc3, 0x8c, 0x70, 0x1e, 0x0d, 0xef, 0xff, 0xe2, 0x42, 0x27, 0x0b, 0x30, 0x20, 0x02, 0xc2,
+ 0x21, 0x0a, 0x33, 0x02, 0x4a, 0x20, 0x00, 0x00, 0x30, 0xd9, 0x01, 0x1c, 0x52, 0x20, 0x02, 0xc2,
+ 0x27, 0x68, 0xf9, 0x0a, 0x62, 0x80, 0x04, 0x77, 0x02, 0x23, 0x13, 0x20, 0x02, 0xf0, 0x6e, 0x70,
+ 0x83, 0xc1, 0xa2, 0x0b, 0x6f, 0x03, 0x82, 0x40, 0x02, 0xc0, 0x00, 0x23, 0x13, 0x20, 0x91, 0x0d,
+ 0xe3, 0x94, 0x00, 0x24, 0x14, 0x20, 0xa8, 0x67, 0x3f, 0x08, 0x74, 0x0d, 0x69, 0x6d, 0xb5, 0x70,
+ 0xca, 0x20, 0xcc, 0x00, 0xd6, 0xf6, 0x79, 0x67, 0x40, 0x89, 0x23, 0x0a, 0x71, 0x0e, 0x30, 0xdc,
+ 0x0a, 0x6d, 0x21, 0x0b, 0x72, 0x00, 0x80, 0xa9, 0x19, 0x67, 0x40, 0x89, 0x11, 0x0a, 0x71, 0x0e,
+ 0x14, 0x70, 0x04, 0x77, 0x80, 0xa9, 0x3a, 0xf6, 0x04, 0xf0, 0x60, 0x40, 0x44, 0x71, 0x40, 0xa9,
+ 0x11, 0x08, 0x32, 0x00, 0x31, 0xd8, 0x8a, 0xed, 0x30, 0xd8, 0xad, 0x71, 0x00, 0xaf, 0x06, 0xf0,
+ 0xc5, 0x71, 0x00, 0xaf, 0x82, 0xed, 0xad, 0x71, 0xb8, 0x67, 0x00, 0x18, 0x02, 0x04, 0x00, 0x19,
+ 0x80, 0x23, 0x8c, 0x22, 0xc1, 0xa9, 0x17, 0xf4, 0x42, 0x25, 0x40, 0x90, 0x13, 0xf2, 0xf8, 0x60,
+ 0x20, 0x88, 0x23, 0x09, 0x11, 0x0c, 0x00, 0x18, 0x02, 0x04, 0x42, 0x25, 0x80, 0x90, 0x0b, 0xf2,
+ 0x19, 0x67, 0x40, 0x89, 0x0f, 0x0a, 0x31, 0x0c, 0x42, 0x20, 0x40, 0x80, 0x00, 0x19, 0x02, 0x04,
+ 0xf8, 0xf5, 0xe1, 0x40, 0xd6, 0xc7, 0xe0, 0x78, 0xfa, 0xc2, 0xfc, 0x1c, 0xc8, 0xb6, 0x82, 0x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0x09, 0x51, 0x0b, 0x80, 0xbe, 0xee, 0xf1, 0x13, 0x09,
+ 0x90, 0x0a, 0xc3, 0x40, 0x7f, 0x00, 0x15, 0x9a, 0x08, 0x61, 0x49, 0x08, 0x9e, 0x00, 0x0c, 0x70,
+ 0xb0, 0xe1, 0x41, 0xc0, 0xca, 0x20, 0x82, 0x00, 0x06, 0xf4, 0x01, 0x6a, 0x40, 0xc0, 0x21, 0x8a,
+ 0x31, 0xda, 0x41, 0xc2, 0x11, 0x09, 0xb1, 0x0a, 0x80, 0xc1, 0x04, 0x71, 0x40, 0xc0, 0x04, 0x10,
+ 0x00, 0x24, 0x05, 0xf0, 0xee, 0x0b, 0xef, 0xff, 0x4c, 0x70, 0x45, 0xc0, 0x05, 0xc0, 0x0b, 0x08,
+ 0x12, 0x00, 0x85, 0xbe, 0x06, 0xf0, 0x05, 0xc0, 0x45, 0x26, 0x4e, 0x18, 0x13, 0x78, 0x45, 0xc0,
+ 0x00, 0xc1, 0x2e, 0x76, 0x00, 0x89, 0x51, 0x08, 0xb1, 0x0b, 0x6e, 0x71, 0x01, 0x69, 0x40, 0xc0,
+ 0x41, 0x89, 0x11, 0x0a, 0x91, 0x0a, 0x02, 0x69, 0x40, 0xc0, 0x04, 0x10, 0x13, 0x24, 0x13, 0xf0,
+ 0x1b, 0x0a, 0x71, 0x0b, 0x4c, 0x70, 0x02, 0x69, 0x40, 0xc0, 0x42, 0x89, 0x23, 0x0a, 0xb1, 0x0a,
+ 0x4c, 0x70, 0x03, 0x69, 0x06, 0x74, 0x40, 0xc0, 0x0e, 0xf0, 0x9a, 0x0b, 0xef, 0xff, 0x80, 0xc1,
+ 0x10, 0x43, 0x15, 0x0b, 0x12, 0x20, 0x86, 0xbe, 0x0a, 0x21, 0xc0, 0x24, 0x04, 0xf0, 0x86, 0x0b,
+ 0xef, 0xff, 0x80, 0xc1, 0x00, 0xc0, 0x6c, 0x70, 0x21, 0x68, 0x40, 0xc1, 0x40, 0x88, 0xcc, 0xe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0x05, 0xcf, 0xff, 0x71, 0x02, 0x00, 0x00, 0x04, 0x10,
+ 0x01, 0x24, 0xe8, 0xe2, 0x16, 0xf4, 0x07, 0xc0, 0x00, 0xb1, 0x16, 0xf0, 0x04, 0x10, 0x19, 0x24,
+ 0x37, 0x70, 0x92, 0x02, 0x22, 0x00, 0x4c, 0x76, 0x02, 0xc0, 0x03, 0xc3, 0xc3, 0x41, 0x7f, 0x00,
+ 0xa0, 0xd3, 0x40, 0x7b, 0x14, 0x77, 0xd2, 0x05, 0xe2, 0xff, 0x0c, 0x77, 0x09, 0x05, 0x00, 0x00,
+ 0x07, 0xc0, 0x00, 0xa1, 0xc3, 0x05, 0xcf, 0xff, 0x07, 0x09, 0x11, 0x20, 0x2e, 0x71, 0xc3, 0x40,
+ 0x7f, 0x00, 0x15, 0x9a, 0x08, 0x65, 0xb1, 0x42, 0x44, 0x20, 0x40, 0x80, 0x4e, 0xc0, 0x01, 0xc0,
+ 0xc0, 0x22, 0x22, 0x28, 0x03, 0xe8, 0x0b, 0x0e, 0x1e, 0x10, 0x0c, 0x70, 0x41, 0xc0, 0x0e, 0x43,
+ 0x06, 0x42, 0x8c, 0x22, 0x41, 0xa9, 0x0a, 0x25, 0x40, 0x04, 0x9d, 0xc0, 0x4f, 0xd9, 0x40, 0x24,
+ 0x06, 0x3c, 0xc0, 0x25, 0x61, 0x00, 0x40, 0x24, 0x07, 0x3d, 0x0a, 0x24, 0x80, 0x04, 0x50, 0x46,
+ 0x8a, 0x0a, 0xef, 0xff, 0x70, 0x45, 0xc3, 0x41, 0x7f, 0x00, 0xa8, 0xd3, 0x96, 0x0f, 0x6f, 0xff,
+ 0x18, 0x41, 0x30, 0x14, 0x13, 0x30, 0x05, 0x23, 0x3e, 0xa0, 0x05, 0xf4, 0x6e, 0x71, 0x30, 0x1c,
+ 0xc0, 0x34, 0xc3, 0x42, 0xff, 0x7f, 0xff, 0xff, 0x2c, 0x70, 0x23, 0x40, 0xba, 0x0e, 0xa0, 0x00,
+ 0x50, 0x44, 0x48, 0xc0, 0x04, 0xe8, 0x08, 0xc0, 0x02, 0x20, 0x54, 0x06, 0x00, 0x11, 0x81, 0x30,
+ 0xc3, 0x40, 0x7f, 0x00, 0x15, 0x9a, 0x08, 0x61, 0x4f, 0x08, 0xbe, 0x00, 0xee, 0x70, 0x24, 0x1c,
+ 0xc0, 0x35, 0x10, 0x1c, 0xc0, 0x35, 0x8c, 0x22, 0x41, 0xa9, 0x4a, 0xf2, 0x8c, 0x22, 0x81, 0xa9,
+ 0x0c, 0xf2, 0x8c, 0x22, 0xc1, 0xa9, 0x1d, 0xf4, 0x8c, 0x23, 0x7f, 0xaf, 0xcc, 0x21, 0xca, 0xa4,
+ 0x7a, 0x00, 0x0b, 0x00, 0x02, 0x21, 0xd1, 0x24, 0x2f, 0x0b, 0x72, 0x20, 0x8a, 0x26, 0x81, 0x29,
+ 0x51, 0x0c, 0xe3, 0x24, 0x4c, 0x70, 0x02, 0x23, 0x00, 0x25, 0x10, 0x1c, 0x00, 0x35, 0x46, 0xc0,
+ 0x58, 0x43, 0x58, 0x40, 0x6c, 0xf0, 0x10, 0x1c, 0x00, 0x35, 0xce, 0x70, 0x90, 0xf0, 0x4c, 0x70,
+ 0x50, 0x46, 0x58, 0x43, 0x1f, 0xf0, 0x4e, 0x23, 0x01, 0x20, 0x42, 0x2b, 0xd3, 0x27, 0x04, 0x23,
+ 0x58, 0x20, 0x0c, 0x71, 0x0c, 0x21, 0x00, 0xa6, 0x18, 0x01, 0x2c, 0x00, 0x46, 0xc0, 0x00, 0x24,
+ 0x00, 0x26, 0x32, 0x70, 0x56, 0x01, 0x2c, 0x00, 0x02, 0x21, 0x1b, 0x26, 0x4c, 0x70, 0x50, 0xf0,
+ 0x02, 0x24, 0xdb, 0x24, 0x4c, 0x70, 0x10, 0x1c, 0xc0, 0x34, 0x0c, 0x23, 0x40, 0xb4, 0xca, 0x23,
+ 0x49, 0x34, 0x0c, 0x70, 0x46, 0xc0, 0x18, 0x40, 0x42, 0xf0, 0x26, 0x77, 0x50, 0x25, 0xd5, 0x27,
+ 0x10, 0x1c, 0x41, 0x30, 0x05, 0x25, 0xbe, 0xa5, 0x06, 0xf4, 0x30, 0x1c, 0xc0, 0x35, 0x2c, 0x70,
+ 0xed, 0x70, 0x0c, 0xf0, 0x42, 0x23, 0x41, 0xa0, 0x41, 0x29, 0xcf, 0x07, 0x0c, 0x00, 0x23, 0x00,
+ 0x4c, 0xc1, 0x4e, 0x23, 0x41, 0x20, 0x4c, 0xc1, 0x9a, 0xc0, 0x42, 0x08, 0xef, 0xff, 0x89, 0xc2,
+ 0x09, 0xc1, 0x1b, 0x09, 0xb3, 0x00, 0x29, 0x68, 0x30, 0xd8, 0xff, 0x19, 0x12, 0x80, 0x09, 0xc0,
+ 0x04, 0x71, 0xf9, 0x08, 0xb2, 0x80, 0x49, 0xc0, 0x01, 0x69, 0x0e, 0xc1, 0x79, 0x27, 0x02, 0x10,
+ 0x42, 0x24, 0x5b, 0x20, 0x75, 0x69, 0x2a, 0x68, 0x48, 0xc1, 0x5b, 0x79, 0x52, 0x23, 0x42, 0x01,
+ 0x2b, 0xe1, 0x45, 0xe2, 0xff, 0x18, 0x42, 0x80, 0xfe, 0x18, 0x82, 0x80, 0x09, 0xc0, 0x2c, 0x70,
+ 0x8a, 0x26, 0x41, 0x29, 0x42, 0x68, 0x38, 0x40, 0x46, 0xc1, 0x49, 0xc2, 0x06, 0xc1, 0x42, 0x43,
+ 0x00, 0x20, 0xc0, 0x36, 0x3a, 0x62, 0x2c, 0x71, 0x44, 0x26, 0x08, 0x12, 0x4a, 0xc1, 0xb8, 0x23,
+ 0xc1, 0x09, 0x3e, 0x21, 0x01, 0x20, 0x78, 0x20, 0x0c, 0x10, 0x65, 0x79, 0x1a, 0x62, 0x0e, 0x20,
+ 0x40, 0x04, 0x04, 0xc7, 0x2b, 0x7c, 0x4b, 0xc0, 0xc0, 0x78, 0x4b, 0xc0, 0x58, 0x60, 0x1f, 0x08,
+ 0x31, 0x10, 0x1f, 0x67, 0x29, 0x09, 0x72, 0x20, 0x0c, 0x70, 0x13, 0x0b, 0x11, 0x30, 0x07, 0xeb,
+ 0x79, 0x20, 0x00, 0x30, 0x2f, 0x08, 0x30, 0x30, 0x4a, 0xc0, 0xe5, 0x71, 0x8e, 0x70, 0x40, 0x20,
+ 0x10, 0x22, 0x92, 0x45, 0x92, 0x41, 0x56, 0x70, 0x9d, 0xf4, 0xb6, 0xf0, 0x4a, 0xc0, 0xf8, 0xf1,
+ 0x4c, 0x70, 0x8c, 0x22, 0xc1, 0xa9, 0x0a, 0x20, 0x40, 0x34, 0x58, 0x43, 0xca, 0x20, 0x21, 0x30,
+ 0xc6, 0xf1, 0x6f, 0x70, 0x7b, 0x40, 0xec, 0xf1, 0x41, 0x2e, 0x80, 0x10, 0x10, 0xd9, 0x44, 0x20,
+ 0x94, 0x00, 0x00, 0x10, 0x0f, 0x20, 0xe8, 0xe2, 0xa1, 0x44, 0xf0, 0x7a, 0xca, 0x27, 0x81, 0x10,
+ 0xf5, 0x70, 0x91, 0xc0, 0x84, 0xc3, 0xb8, 0x24, 0x01, 0x0e, 0xe1, 0x42, 0x86, 0x0f, 0xaf, 0xff,
+ 0xca, 0x24, 0x21, 0x20, 0x18, 0x41, 0x4e, 0x70, 0x52, 0xf0, 0x4c, 0x70, 0x0a, 0x23, 0x00, 0x35,
+ 0xa6, 0xf1, 0xcb, 0x47, 0xff, 0x7f, 0xff, 0xff, 0x2c, 0x70, 0x23, 0x40, 0xba, 0x0c, 0xa0, 0x00,
+ 0xe1, 0x42, 0x48, 0xc0, 0x04, 0xe8, 0x08, 0xc0, 0x02, 0x20, 0x4f, 0x06, 0x3a, 0x23, 0xc1, 0x23,
+ 0x41, 0x2e, 0x80, 0x11, 0xee, 0x70, 0x2b, 0x78, 0xf2, 0x45, 0x7e, 0x77, 0x73, 0xdd, 0xf2, 0x46,
+ 0xb2, 0x41, 0x44, 0xc7, 0x70, 0xf0, 0x04, 0x10, 0x0d, 0x24, 0xee, 0x70, 0xed, 0x71, 0xf2, 0x45,
+ 0x71, 0xc5, 0x54, 0x24, 0x99, 0x38, 0xf2, 0x46, 0xb2, 0x41, 0x44, 0xc7, 0x64, 0xf0, 0x41, 0x2e,
+ 0xc0, 0x10, 0x08, 0xd9, 0x6f, 0xdd, 0x44, 0x20, 0x54, 0x00, 0xbd, 0xf1, 0x04, 0x10, 0x01, 0x24,
+ 0x91, 0xc0, 0xa6, 0x0f, 0xaf, 0xff, 0x84, 0xc2, 0xee, 0x70, 0x04, 0xc7, 0xf2, 0x45, 0x18, 0x41,
+ 0x70, 0xdd, 0xf2, 0x46, 0xb2, 0x41, 0x50, 0xf0, 0x75, 0xdd, 0x4e, 0x70, 0x00, 0x10, 0x0f, 0x20,
+ 0xf5, 0xe5, 0x07, 0xf2, 0x0b, 0x0f, 0x13, 0x10, 0xf3, 0x7f, 0x34, 0x1c, 0xc1, 0x3f, 0x91, 0xc0,
+ 0x84, 0xc2, 0xce, 0x0f, 0xaf, 0xff, 0xe1, 0x41, 0x18, 0x41, 0x8e, 0x70, 0x01, 0xc0, 0xce, 0x70,
+ 0x14, 0x70, 0x0c, 0x70, 0x06, 0xf2, 0x01, 0xc0, 0x46, 0x26, 0xbe, 0x9f, 0x02, 0xf2, 0x0c, 0x70,
+ 0x06, 0x74, 0x05, 0x27, 0xfe, 0x94, 0x10, 0xf2, 0x04, 0xc1, 0x41, 0xc0, 0x78, 0x21, 0x17, 0x00,
+ 0x02, 0x23, 0x40, 0x20, 0xe2, 0x71, 0x08, 0x21, 0xcf, 0x04, 0x72, 0x71, 0xca, 0x27, 0x0b, 0x20,
+ 0x82, 0x77, 0x09, 0xf0, 0x44, 0x1c, 0x82, 0x35, 0x10, 0x1c, 0x80, 0x35, 0xee, 0x70, 0x41, 0xc0,
+ 0xed, 0x70, 0x0d, 0xc0, 0x0a, 0x25, 0xc0, 0x25, 0x87, 0xe8, 0xee, 0x71, 0x4b, 0x26, 0x80, 0x91,
+ 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 0xda, 0x3c, 0xdb, 0xea, 0x0f, 0x2f, 0x08, 0x22, 0x40, 0x08, 0xd9, 0x12, 0x0d,
+ 0x2f, 0x08, 0x22, 0x40, 0x40, 0xd9, 0x2c, 0xda, 0x6c, 0x70, 0xd6, 0x0f, 0x2f, 0x08, 0x22, 0x40,
+ 0xcb, 0x47, 0x48, 0x42, 0x00, 0x00, 0x6c, 0x71, 0x6d, 0xd9, 0x40, 0x24, 0xc2, 0x35, 0xc1, 0x44,
+ 0xc1, 0x45, 0x22, 0x40, 0xe1, 0x46, 0xab, 0x23, 0x61, 0x0a, 0x70, 0x40, 0x17, 0x1c, 0x43, 0x33,
+ 0x36, 0x5b, 0x12, 0xd9, 0x80, 0xc2, 0x6c, 0x76, 0x22, 0x40, 0x31, 0x5b, 0x01, 0x14, 0xcd, 0x30,
+ 0x03, 0x14, 0x80, 0x30, 0x05, 0x14, 0x88, 0x30, 0x20, 0xc4, 0x02, 0x14, 0x8b, 0x30, 0x04, 0x14,
+ 0x89, 0x30, 0x08, 0xbd, 0x08, 0xb8, 0x40, 0x28, 0x08, 0x12, 0x85, 0x7d, 0x05, 0x20, 0xc0, 0x02,
+ 0x08, 0x1c, 0x44, 0x33, 0x0a, 0x1c, 0x04, 0x30, 0x05, 0x20, 0x48, 0x12, 0x6d, 0xd9, 0x40, 0x24,
+ 0xc2, 0x35, 0x6c, 0x71, 0xc1, 0x44, 0xc1, 0x45, 0x22, 0x40, 0xe1, 0x46, 0x0c, 0x1c, 0x04, 0x32,
+ 0xab, 0x20, 0x61, 0x2a, 0x17, 0x1c, 0x43, 0x32, 0x36, 0x5b, 0x12, 0xd9, 0x80, 0xc2, 0x6c, 0x76,
+ 0x22, 0x40, 0x31, 0x5b, 0x01, 0x14, 0xc0, 0x30, 0x03, 0x14, 0x82, 0x30, 0x05, 0x14, 0x8f, 0x30,
+ 0x20, 0xc1, 0x02, 0x14, 0x83, 0x30, 0x21, 0xc4, 0x08, 0xb8, 0x08, 0xba, 0x08, 0xbf, 0x25, 0x78,
+ 0x45, 0x7b, 0xe5, 0x7c, 0x23, 0xd9, 0x10, 0x1c, 0x04, 0x30, 0x12, 0x1c, 0xc4, 0x30, 0x14, 0x1c,
+ 0x04, 0x33, 0xab, 0x20, 0x61, 0x2a, 0x00, 0x1e, 0x40, 0x70, 0x80, 0x00, 0xcc, 0x3b, 0x40, 0x24,
+ 0x81, 0x34, 0x40, 0x24, 0x82, 0x32, 0xed, 0x70, 0x05, 0xf0, 0x02, 0x12, 0x4d, 0x05, 0x02, 0x11,
+ 0x40, 0x05, 0xae, 0x7b, 0x0e, 0x78, 0x62, 0x78, 0x42, 0x28, 0xc3, 0x07, 0x78, 0x60, 0x67, 0x78,
+ 0x10, 0x78, 0x11, 0x08, 0x82, 0x0f, 0x00, 0x00, 0x01, 0x20, 0xef, 0x78, 0x0f, 0x20, 0x8f, 0x03,
+ 0xc5, 0x71, 0xdb, 0x0e, 0xf2, 0x90, 0x3c, 0xdb, 0x7e, 0xd9, 0xb6, 0xda, 0xd2, 0x0e, 0x2f, 0x08,
+ 0x22, 0x40, 0x19, 0x0f, 0x3e, 0x10, 0x61, 0xd8, 0xef, 0x79, 0x11, 0x09, 0x7e, 0x00, 0x62, 0xd8,
+ 0x09, 0x09, 0xbe, 0x00, 0x64, 0xd8, 0x0c, 0x72, 0xca, 0xc7, 0xe0, 0x78, 0xf1, 0xc0, 0x20, 0x45,
+ 0x86, 0x11, 0xc1, 0x00, 0x1d, 0x09, 0x33, 0x00, 0x12, 0xd9, 0xc3, 0x42, 0x80, 0x00, 0x0c, 0x21,
+ 0x02, 0xa2, 0x04, 0x15, 0x80, 0x00, 0x6c, 0x76, 0xc3, 0x44, 0x7f, 0x00, 0x34, 0xb5, 0x32, 0x5b,
+ 0xd1, 0xc0, 0xe0, 0x7e, 0xe6, 0xc2, 0x28, 0x43, 0x9e, 0xe8, 0xc3, 0x40, 0x80, 0x00, 0x08, 0x21,
+ 0x05, 0x10, 0xc1, 0x00, 0x84, 0x88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2f, 0x08, 0xe1, 0x40, 0x8c, 0x20, 0x02, 0x80, 0x3b, 0xf4, 0x04, 0x8f,
+ 0x15, 0x20, 0x8c, 0x23, 0x40, 0xd9, 0x40, 0x24, 0xc2, 0x30, 0x6c, 0x71, 0xa2, 0x8c, 0x31, 0x5b,
+ 0x03, 0x14, 0x81, 0x30, 0xe1, 0x40, 0x7e, 0x0d, 0x2f, 0x08, 0x02, 0x1c, 0x42, 0x30, 0x8c, 0x20,
+ 0x02, 0x80, 0x12, 0xf4, 0x03, 0x14, 0x81, 0x30, 0x53, 0x25, 0xc0, 0x10, 0x87, 0xb8, 0x47, 0x08,
+ 0x60, 0x00, 0x02, 0x1c, 0x02, 0x30, 0x04, 0x8f, 0x40, 0xd9, 0x40, 0x24, 0x82, 0x30, 0x6c, 0x71,
+ 0x33, 0x5b, 0x19, 0xf0, 0x4e, 0x0d, 0x2f, 0x08, 0xe1, 0x40, 0x8c, 0x20, 0xc3, 0x8f, 0x13, 0xf4,
+ 0x03, 0x14, 0x81, 0x30, 0x53, 0x25, 0xc0, 0x10, 0x85, 0xb8, 0x1b, 0x08, 0x60, 0x00, 0x02, 0x1c,
+ 0x02, 0x30, 0x04, 0x8f, 0x8c, 0x70, 0x40, 0xd9, 0x40, 0x24, 0x82, 0x30, 0x6c, 0x71, 0x80, 0x45,
+ 0x34, 0x5b, 0x15, 0x20, 0x80, 0x23, 0x00, 0x90, 0xcb, 0x45, 0x80, 0x00, 0xd4, 0x3b, 0x2f, 0x3a,
+ 0x03, 0x00, 0x0c, 0x70, 0xe1, 0x41, 0x40, 0xa5, 0x43, 0x5b, 0x00, 0x85, 0xca, 0xc7, 0xe0, 0x78,
+ 0x42, 0x28, 0xc1, 0x07, 0x38, 0x60, 0x27, 0x78, 0xe0, 0x7f, 0x0e, 0x78, 0x2c, 0x70, 0x9e, 0xb9,
+ 0x20, 0x42, 0x01, 0x08, 0xa4, 0x00, 0x22, 0xb9, 0x2c, 0x70, 0x0b, 0xea, 0x5b, 0x61, 0x0b, 0x08,
+ 0xc4, 0x00, 0x62, 0x78, 0x54, 0x79, 0x41, 0x2a, 0x82, 0x80, 0x3d, 0x79, 0xf8, 0xf5, 0xe0, 0x7f,
+ 0x30, 0x78, 0xe0, 0x78, 0x80, 0x98, 0x61, 0x98, 0x42, 0x98, 0x89, 0x7c, 0x69, 0x7b, 0x49, 0x7a,
+ 0x98, 0x63, 0xcd, 0x07, 0xef, 0xff, 0x58, 0x60, 0xe2, 0xc2, 0xde, 0x0c, 0x6f, 0x09, 0x08, 0x45,
+ 0x06, 0x1d, 0x05, 0x13, 0xc2, 0xc6, 0xe0, 0x78, 0xe6, 0xc2, 0xcb, 0x45, 0x80, 0x00, 0xf6, 0x1f,
+ 0x60, 0x8d, 0x87, 0x0b, 0x31, 0x00, 0x48, 0x43, 0xcb, 0x46, 0x80, 0x00, 0x9c, 0x1f, 0x65, 0x86,
+ 0x84, 0x86, 0x2f, 0x39, 0x43, 0x00, 0x2f, 0x38, 0x03, 0x00, 0x02, 0x31, 0xc1, 0x00, 0x02, 0x30,
+ 0x00, 0x03, 0x46, 0x86, 0x00, 0x31, 0x41, 0x00, 0x00, 0x30, 0x00, 0x00, 0x01, 0x30, 0x41, 0x00,
+ 0x2f, 0x38, 0xc3, 0x02, 0x02, 0x30, 0x80, 0x00, 0x00, 0x30, 0x00, 0x00, 0x01, 0x31, 0x00, 0x00,
+ 0xc3, 0x41, 0x49, 0x45, 0x9c, 0x53, 0x2a, 0x0b, 0xef, 0x02, 0xe1, 0x8d, 0xc3, 0xf6, 0xe5, 0x71,
+ 0xe1, 0xad, 0xef, 0x78, 0x8c, 0x20, 0x03, 0x82, 0x06, 0xf4, 0x01, 0x95, 0x01, 0x1d, 0x03, 0x10,
+ 0x04, 0x71, 0x01, 0xb5, 0x1e, 0x8e, 0x0f, 0x08, 0x71, 0x00, 0x0c, 0x70, 0x01, 0xad, 0x01, 0xb5,
+ 0x02, 0xf0, 0x01, 0x95, 0x22, 0x95, 0x13, 0x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, 0x09, 0xeb, 0x65, 0x8f, 0x15, 0x0b, 0x71, 0x00, 0x10, 0x43,
+ 0x50, 0x42, 0x20, 0x40, 0x0b, 0xf0, 0x6c, 0x70, 0x60, 0x40, 0xce, 0xc6, 0x84, 0xeb, 0x50, 0x43,
+ 0x30, 0x42, 0x05, 0xf0, 0x10, 0x43, 0x30, 0x42, 0x40, 0x40, 0x04, 0x17, 0xc1, 0x10, 0x29, 0x78,
+ 0x0e, 0x7d, 0x62, 0x40, 0x42, 0x41, 0xc6, 0x09, 0x60, 0x00, 0xa1, 0x42, 0x62, 0x40, 0x42, 0x41,
+ 0x66, 0x0b, 0x20, 0x00, 0xa1, 0x42, 0x62, 0x40, 0x42, 0x41, 0xa1, 0x42, 0x3a, 0x0d, 0x20, 0x00,
+ 0xb1, 0x41, 0x08, 0x97, 0x8c, 0x20, 0x1f, 0x84, 0x11, 0xf4, 0x12, 0x8f, 0x8f, 0xe8, 0x26, 0x97,
+ 0x05, 0x97, 0x8a, 0x22, 0xdf, 0x03, 0x13, 0x08, 0x61, 0x00, 0x48, 0xb7, 0x13, 0x8f, 0x0b, 0x08,
+ 0x51, 0x00, 0xc5, 0xa7, 0xc6, 0xa7, 0x06, 0x1f, 0x43, 0x10, 0x1c, 0x8f, 0x00, 0x17, 0x10, 0x10,
+ 0x98, 0xe8, 0xad, 0x70, 0x02, 0x40, 0x5a, 0x08, 0xef, 0x02, 0xa1, 0x41, 0x02, 0x40, 0x04, 0xf6,
+ 0x02, 0x35, 0x00, 0x14, 0xc3, 0x41, 0xd1, 0x38, 0x17, 0xb7, 0x46, 0x08, 0xef, 0x02, 0xbd, 0x8f,
+ 0x03, 0xf6, 0xb5, 0x70, 0x79, 0xf2, 0xc7, 0xd8, 0x1c, 0x1f, 0x43, 0x10, 0x0f, 0xb7, 0xd0, 0xb7,
+ 0xc3, 0x42, 0x80, 0x00, 0xd6, 0x1f, 0x2f, 0x3c, 0x43, 0x14, 0x26, 0x87, 0x02, 0x34, 0x00, 0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0x00, 0x00, 0xa1, 0x41, 0x66, 0x0f, 0xaf, 0x02, 0x10, 0x40,
+ 0xca, 0x20, 0x49, 0x23, 0x9f, 0xbd, 0x02, 0x40, 0xa1, 0x41, 0x56, 0x0f, 0xaf, 0x02, 0x14, 0x1f,
+ 0x00, 0x14, 0x43, 0xf6, 0xa5, 0xa7, 0xcb, 0x45, 0x80, 0x00, 0xe0, 0x1f, 0x00, 0x95, 0x8c, 0x20,
+ 0x09, 0x86, 0x8d, 0xf7, 0x13, 0x8f, 0x8a, 0x21, 0xc9, 0x05, 0x20, 0xb5, 0xd2, 0xaf, 0x0f, 0x08,
+ 0x71, 0x00, 0x06, 0x1f, 0x43, 0x10, 0xc5, 0xa7, 0xc6, 0xa7, 0x62, 0x40, 0x42, 0x41, 0xae, 0x0b,
+ 0xef, 0xff, 0x22, 0x42, 0x01, 0x95, 0x11, 0x08, 0x74, 0x0f, 0x04, 0x77, 0x01, 0xb5, 0xd2, 0xaf,
+ 0x0c, 0x70, 0x0d, 0xf0, 0xc3, 0x41, 0x16, 0x40, 0x66, 0x66, 0x06, 0x0f, 0xaf, 0x02, 0x05, 0x87,
+ 0x43, 0xf6, 0x0c, 0x72, 0x02, 0xf0, 0x0c, 0x71, 0x12, 0xaf, 0x24, 0x8d, 0x11, 0x09, 0x71, 0x00,
+ 0x6c, 0x70, 0x8d, 0x70, 0x8c, 0xe8, 0x8d, 0x71, 0xc4, 0xad, 0x0a, 0xf0, 0x8d, 0x70, 0x88, 0xe9,
+ 0x0d, 0x08, 0x71, 0x00, 0x8d, 0x70, 0x04, 0x1d, 0x43, 0x10, 0x8d, 0x72, 0x16, 0x08, 0x20, 0x00,
+ 0x81, 0x40, 0x09, 0x6c, 0x14, 0x71, 0x04, 0xf7, 0x81, 0x43, 0x85, 0xad, 0xfd, 0x05, 0xcf, 0xff,
+ 0xc3, 0x41, 0x80, 0x00, 0xfc, 0x1f, 0x40, 0x89, 0x04, 0xea, 0x01, 0x19, 0x03, 0x00, 0x2b, 0xf0,
+ 0x0b, 0x08, 0x51, 0x00, 0x01, 0x19, 0x03, 0x00, 0x15, 0xf0, 0x0d, 0x08, 0x91, 0x00, 0x01, 0x19,
+ 0x43, 0x00, 0x04, 0xf0, 0x01, 0x89, 0x0f, 0xe8, 0x01, 0x91, 0x04, 0x71, 0x01, 0xb1, 0x10, 0x78,
+ 0x1b, 0x08, 0x81, 0x0f, 0x00, 0x00, 0xe0, 0x2e, 0x02, 0x91, 0x02, 0x19, 0x05, 0x00, 0x04, 0x71,
+ 0x03, 0xf0, 0x0c, 0x70, 0x01, 0xb1, 0x02, 0xb1, 0x02, 0xf0, 0x02, 0x91, 0x43, 0x91, 0x10, 0x78,
+ 0x50, 0x70, 0xe0, 0x7d, 0x02, 0x19, 0x05, 0x00, 0x04, 0x19, 0x05, 0x00, 0xe0, 0x7f, 0x00, 0x19,
+ 0x43, 0x00, 0xe0, 0x7e, 0xea, 0xc3, 0xa3, 0xc1, 0xcb, 0x45, 0x80, 0x00, 0x9c, 0x1f, 0x60, 0x95,
+ 0x48, 0x40, 0x20, 0x46, 0x08, 0x41, 0x51, 0x0b, 0x85, 0x0f, 0x00, 0x00, 0x70, 0x17, 0x01, 0x6b,
+ 0xc1, 0x85, 0x10, 0x79, 0x8c, 0x21, 0x03, 0x82, 0x42, 0x00, 0x26, 0x00, 0x00, 0xb5, 0x2f, 0x38,
+ 0x43, 0x02, 0xc3, 0x41, 0x48, 0x43, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x01, 0x30, 0x80, 0x03,
+ 0x42, 0x85, 0x01, 0xa5, 0x2f, 0x38, 0x83, 0x01, 0x00, 0x38, 0x40, 0x00, 0x01, 0x30, 0x80, 0x00,
+ 0x63, 0x85, 0x02, 0xa5, 0x2f, 0x38, 0x03, 0x02, 0x00, 0x38, 0x40, 0x00, 0x01, 0x30, 0xc0, 0x00,
+ 0x03, 0xa5, 0xca, 0xc7, 0x02, 0x1d, 0x83, 0x10, 0xca, 0xc7, 0xed, 0x70, 0x0a, 0xf4, 0x22, 0x85,
+ 0x03, 0x85, 0xc4, 0xa5, 0x25, 0xa5, 0x06, 0xa5, 0xe1, 0xa5, 0xe2, 0xa5, 0xe3, 0xa5, 0xca, 0xc7,
+ 0x10, 0x15, 0x0b, 0x10, 0x2f, 0x3a, 0x43, 0x02, 0x02, 0x32, 0xcb, 0x02, 0xc3, 0x42, 0x48, 0x43,
+ 0x00, 0x00, 0x05, 0x85, 0x00, 0x3b, 0x8b, 0x10, 0x01, 0x33, 0x8e, 0x13, 0x2f, 0x3b, 0x83, 0x11,
+ 0x22, 0x85, 0x02, 0x33, 0x00, 0x10, 0x86, 0x85, 0x00, 0x38, 0x80, 0x00, 0x01, 0x30, 0x41, 0x00,
+ 0x2f, 0x38, 0x03, 0x02, 0x63, 0x85, 0x02, 0x30, 0x00, 0x03, 0x00, 0x38, 0x80, 0x00, 0x01, 0x30,
+ 0xc0, 0x00, 0x40, 0xc6, 0x41, 0xc1, 0xc1, 0xa5, 0x22, 0xa5, 0x03, 0xa5, 0x42, 0xc0, 0x40, 0x24,
+ 0x11, 0x31, 0x0e, 0x70, 0x03, 0xf0, 0x04, 0x11, 0x0e, 0x24, 0xc1, 0x40, 0x82, 0x0d, 0xaf, 0x02,
+ 0x02, 0x41, 0xc1, 0x40, 0x03, 0xf6, 0x02, 0x30, 0x80, 0x23, 0xc3, 0x41, 0x23, 0x44, 0x0b, 0xd7,
+ 0x6e, 0x0d, 0x8f, 0x02, 0x05, 0xf6, 0xe5, 0x71, 0xdf, 0x0f, 0xd2, 0x90, 0x13, 0xf0, 0xc1, 0x40,
+ 0x5e, 0x0d, 0xaf, 0x02, 0x02, 0x41, 0x0c, 0x77, 0xca, 0x20, 0x69, 0x00, 0x1c, 0xad, 0x0c, 0x70,
+ 0xfd, 0xad, 0x02, 0x1d, 0x43, 0x10, 0x01, 0xa5, 0x02, 0xa5, 0x03, 0xa5, 0x04, 0xa5, 0x05, 0xa5,
+ 0x06, 0xa5, 0xca, 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x10, 0x17, 0x15, 0x10, 0x8e, 0x70, 0x2f, 0x38,
+ 0x03, 0x20, 0x2f, 0x3a, 0x43, 0x20, 0xa2, 0x40, 0x82, 0x41, 0x06, 0x0b, 0xaf, 0x02, 0x2f, 0x3e,
+ 0x03, 0x23, 0xc3, 0x42, 0x48, 0x43, 0x00, 0x00, 0xa2, 0x40, 0x04, 0xf6, 0x02, 0x34, 0x40, 0x25,
+ 0x14, 0x17, 0x11, 0x10, 0xc3, 0x41, 0xd1, 0x38, 0x17, 0xb7, 0x00, 0x38, 0x93, 0x20, 0x00, 0x3a,
+ 0x92, 0x20, 0x30, 0x40, 0xda, 0x0a, 0xaf, 0x02, 0x00, 0x3e, 0x96, 0x20, 0x5d, 0xf6, 0x22, 0x40,
+ 0xce, 0x0a, 0xaf, 0x02, 0x82, 0x41, 0x22, 0x40, 0x03, 0xf6, 0x02, 0x34, 0x40, 0x24, 0xc2, 0x0a,
+ 0xaf, 0x02, 0x02, 0x41, 0x51, 0xf6, 0x06, 0x87, 0x82, 0x41, 0xb6, 0x0a, 0xaf, 0x02, 0x10, 0x40,
+ 0x03, 0xf6, 0x02, 0x34, 0x10, 0x24, 0xc3, 0x41, 0xd1, 0x38, 0x17, 0xb7, 0xa2, 0x0a, 0xaf, 0x02,
+ 0x02, 0x40, 0x90, 0x00, 0x0b, 0x00, 0x4a, 0x0d, 0x6f, 0xfe, 0xa2, 0x40, 0xc3, 0x42, 0x99, 0x99,
+ 0x9a, 0x99, 0xc3, 0x43, 0xe9, 0x3f, 0x99, 0x99, 0x50, 0x40, 0x70, 0x44, 0x23, 0x5b, 0x10, 0x47,
+ 0xc2, 0x40, 0x2e, 0x0d, 0x6f, 0xfe, 0x30, 0x46, 0x50, 0x24, 0x43, 0x25, 0x02, 0x42, 0x70, 0x45,
+ 0x23, 0x5b, 0xe2, 0x42, 0xc2, 0x43, 0x22, 0x5b, 0xb2, 0x0d, 0x4f, 0xfe, 0x10, 0x46, 0x12, 0x0d,
+ 0x6f,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xd4, 0x8c, 0x70, 0x61, 0xd9, 0x6c, 0x71, 0x80, 0x45, 0xa1, 0x42, 0xc3, 0x46, 0x80, 0x3f,
+ 0x00, 0x00, 0x37, 0x5b, 0x2c, 0x71, 0x20, 0x40, 0xc2, 0xc6, 0xe0, 0x78, 0xe2, 0xc2, 0xc3, 0x41,
+ 0x80, 0x00, 0x99, 0x7d, 0x1a, 0x08, 0xaf, 0x02, 0x08, 0x45, 0x50, 0xf6, 0x2c, 0x70, 0x12, 0x08,
+ 0xaf, 0x02, 0xa1, 0x40, 0x46, 0x00, 0x2c, 0x00, 0xa1, 0x40, 0x0e, 0x0c, 0x0f, 0x0d, 0x7f, 0xd9,
+ 0x17, 0xb9, 0x00, 0x39, 0x00, 0x00, 0x1a, 0xf0, 0x2f, 0x20, 0x41, 0x03, 0x00, 0x35, 0x82, 0x1f,
+ 0x00, 0x3f, 0x00, 0x00, 0x4a, 0x24, 0x00, 0x71, 0x0e, 0x20, 0x80, 0x0f, 0x37, 0x5f, 0x86, 0x5a,
+ 0xa8, 0x20, 0x00, 0x03, 0x00, 0x30, 0x01, 0x00, 0x00, 0x32, 0x41, 0x00, 0x02, 0x36, 0x41, 0x70,
+ 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, 0xc2, 0xc6, 0xc3, 0x40, 0xc0, 0x7f, 0x00, 0x00,
+ 0xc2, 0xc6, 0xe0, 0x78, 0xe2, 0xc0, 0x8d, 0x70, 0x15, 0xea, 0x60, 0x88, 0x2f, 0x7d, 0xb1, 0x73,
+ 0xca, 0x24, 0x01, 0x10, 0x0f, 0xf2, 0x1f, 0x0a, 0x70, 0x00, 0x40, 0x20, 0x41, 0x00, 0x44, 0x77,
+ 0x00, 0x89, 0x11, 0x08, 0x60, 0x03, 0x42, 0x22, 0x42, 0x80, 0x24, 0x71, 0xfa, 0xf5, 0x03, 0xf0,
+ 0x28, 0x44, 0x81, 0x40, 0xc2, 0xc4, 0xe0, 0x78, 0xe8, 0xc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 0x3c, 0xc3, 0x10, 0xc3, 0x43, 0x03, 0x42, 0x6f, 0x12, 0x00, 0x34, 0xcc, 0x10, 0x00, 0x34,
+ 0xc2, 0x10, 0xc3, 0x43, 0x80, 0x00, 0x9c, 0x1f, 0x85, 0x83, 0xc4, 0x83, 0x2f, 0x38, 0x03, 0x00,
+ 0xe6, 0x83, 0x2f, 0x3b, 0x43, 0x00, 0x02, 0x33, 0x03, 0x03, 0x02, 0x30, 0x80, 0x03, 0x00, 0x33,
+ 0xc3, 0x00, 0x00, 0x30, 0x00, 0x00, 0x01, 0x30, 0xc3, 0x00, 0x2f, 0x38, 0xc3, 0x02, 0x02, 0x30,
+ 0xc0, 0x03, 0x00, 0x30, 0x00, 0x00, 0x01, 0x33, 0x00, 0x00, 0x86, 0x0e, 0x6f, 0x02, 0x40, 0x41,
+ 0x4d, 0xf6, 0x01, 0x95, 0x04, 0x71, 0x01, 0xb5, 0x10, 0x78, 0x8c, 0x20, 0x03, 0x82, 0x06, 0xf4,
+ 0xc7, 0xd8, 0x16, 0x1d, 0x43, 0x10, 0x01, 0xb5, 0xc6, 0xc6, 0x02, 0x1d, 0x05, 0x10, 0x16, 0x1d,
+ 0x03, 0x10, 0xc6, 0xc6, 0xea, 0xc2, 0x30, 0x41, 0x79, 0x23, 0x01, 0x00, 0xf0, 0x26, 0x41, 0x70,
+ 0x7f, 0x00, 0x68, 0xd2, 0x48, 0x45, 0x08, 0x47, 0xc3, 0xba, 0x22, 0x40, 0x60, 0x7f, 0x30, 0x40,
+ 0x8a, 0x26, 0xff, 0x1f, 0x04, 0x71, 0x0e, 0xe8, 0x17, 0x0d, 0x12, 0x14, 0x10, 0xda, 0x22, 0x40,
+ 0x60, 0x7f, 0x02, 0x41, 0x04, 0x71, 0x06, 0xe8, 0x70, 0xbd, 0xf5, 0x0d, 0x13, 0x94, 0xcd, 0x70,
+ 0xc1, 0x40, 0xca, 0xc6, 0xe6, 0xc3, 0xa1, 0xc1, 0x48, 0x45, 0xcb, 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, 0x80, 0x00, 0x0e, 0x7a, 0x9a, 0x0b, 0xef, 0xff,
+ 0x18, 0x4f, 0x32, 0x9e, 0x04, 0x9f, 0x73, 0x9e, 0x42, 0x9f, 0x09, 0x79, 0x18, 0x23, 0x80, 0x00,
+ 0x3f, 0x21, 0x00, 0x00, 0x21, 0x68, 0x00, 0x19, 0x42, 0x20, 0x17, 0x96, 0x1a, 0xe8, 0x2f, 0x20,
+ 0x88, 0x04, 0xc3, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x0e, 0x78, 0x14, 0x70, 0xc6, 0xf6, 0x14, 0x17,
+ 0xc0, 0x10, 0x21, 0x08, 0x13, 0x00, 0x07, 0xf0, 0x4c, 0xf6, 0x14, 0x17, 0xc0, 0x10, 0x15, 0x08,
+ 0x52, 0x00, 0x29, 0x97, 0x13, 0x78, 0x24, 0x71, 0x29, 0xb7, 0x14, 0xaf, 0x00, 0x11, 0x81, 0x20,
+ 0x34, 0x72, 0x07, 0x9f, 0x40, 0x26, 0x03, 0x17, 0x40, 0x26, 0x82, 0x16, 0xca, 0x22, 0xc1, 0x00,
+ 0x2c, 0x71, 0xae, 0x0a, 0xef, 0xff, 0x00, 0x12, 0x14, 0x01, 0x07, 0xb7, 0x42, 0x9f, 0x21, 0x9e,
+ 0x26, 0x0b, 0xef, 0xff, 0xe1, 0x40, 0x42, 0x9f, 0x00, 0x9e, 0x20, 0x9f, 0x58, 0x60, 0x09, 0x09,
+ 0x03, 0x00, 0x00, 0xb7, 0x23, 0x9e, 0xa2, 0x6f, 0xa1, 0x40, 0x0e, 0x0b, 0xef, 0xff, 0xb1, 0x42,
+ 0x22, 0x9e, 0x02, 0x9f, 0x41, 0x9f, 0x31, 0x48, 0x0b, 0x09, 0xa3, 0x00, 0x04, 0x6f, 0x00, 0x1a,
+ 0x44, 0x20, 0x25, 0x9e, 0xf2, 0x0a, 0xef, 0xff, 0x62, 0x42, 0x00, 0x9f, 0xad, 0x70, 0x72, 0x70,
+ 0x0c, 0x70, 0x4e, 0xf6, 0x00, 0x1f, 0xc4, 0x14, 0x2b, 0x8f, 0xad, 0x70, 0x88, 0xe9, 0x27, 0x9f,
+ 0x0d, 0x0c, 0x63, 0x20, 0xad, 0x70, 0xad, 0x71, 0xab, 0xaf, 0x07, 0xb7, 0x00, 0x12, 0x41, 0x21,
+ 0x0b, 0x0b, 0x43, 0x20, 0x02, 0x1f, 0xc4, 0x14, 0x0b, 0xaf, 0x5f, 0x0e, 0x30, 0x20, 0x2c, 0x71,
+ 0x2e, 0x0a, 0xef, 0xff, 0x06, 0x9f, 0x2c, 0x71, 0x06, 0xb7, 0x00, 0x18, 0x42, 0x23, 0x28, 0xed,
+ 0x15, 0x96, 0x09, 0xe8, 0x56, 0x96, 0x23, 0x9f, 0x06, 0x9f, 0x4c, 0x79, 0x04, 0xb8, 0x3e, 0x20,
+ 0x41, 0x00, 0x17, 0x96, 0x6e, 0x70, 0x14, 0x70, 0x0c, 0x70, 0x06, 0xf2, 0x49, 0x97, 0x18, 0x96,
+ 0x3c, 0x20, 0x80, 0x00, 0x40, 0x27, 0x92, 0x12, 0x16, 0xe9, 0x96, 0xe8, 0x24, 0x96, 0x00, 0x12,
+ 0x80, 0x20, 0x3d, 0x08, 0x63, 0x00, 0xa1, 0x68, 0xaf, 0x78, 0x30, 0x70, 0x00, 0x1a, 0x42, 0x23,
+ 0xca, 0x25, 0x2b, 0x10, 0x2b, 0xf0, 0x00, 0x18, 0x42, 0x23, 0x60, 0xf0, 0x06, 0x9f, 0x40, 0x27,
+ 0x92, 0x12, 0x46, 0xf0, 0x0a, 0x1f, 0xc2, 0x14, 0x51, 0x96, 0x8a, 0x21, 0x06, 0x04, 0x54, 0x70,
+ 0x8a, 0x20, 0x0c, 0x08, 0xca, 0x20, 0x41, 0x00, 0x03, 0xb7, 0x33, 0xf0, 0x26, 0x97, 0x03, 0x97,
+ 0x04, 0xb9, 0x1b, 0x78, 0x22, 0x78, 0x9e, 0x0f, 0x2f, 0xff, 0x0e, 0x78, 0x30, 0x96, 0x66, 0x6f,
+ 0x0d, 0x08, 0x63, 0x00, 0xad, 0x71, 0xad, 0x72, 0x00, 0x18, 0x42, 0x23, 0x06, 0x97, 0x26, 0x9e,
+ 0x04, 0xb8, 0x0e, 0x7a, 0x12, 0x0a, 0xef, 0xff, 0x60, 0x40, 0x51, 0x96, 0x03, 0xea, 0xaf, 0x78,
+ 0x1b, 0x7d, 0x2f, 0x20, 0x47, 0x93, 0x15, 0xf2, 0xa6, 0x41, 0x8f, 0x97, 0x28, 0x16, 0x0b, 0x11,
+ 0x4a, 0x20, 0x00, 0x00, 0x61, 0x74, 0x41, 0x2c, 0x03, 0x12, 0x6f, 0x7b, 0x04, 0x71, 0x79, 0x61,
+ 0x0f, 0x7b, 0xf5, 0x0b, 0x24, 0x82, 0x8f, 0x7c, 0x8f, 0xb7, 0x00, 0x1d, 0x40, 0x20, 0x0c, 0x1f,
+ 0xc4, 0x14, 0x04, 0xea, 0x10, 0x1f, 0x43, 0x10, 0x0c, 0x70, 0x09, 0xb7, 0x2f, 0x96, 0x1f, 0x09,
+ 0x23, 0x00, 0x2c, 0x70, 0x2a, 0xaf, 0x11, 0x96, 0x8a, 0x22, 0x06, 0x04, 0x14, 0x70, 0x8a, 0x20,
+ 0x0c, 0x08, 0xca, 0x20, 0x81, 0x00, 0x03, 0xb7, 0x03, 0xf0, 0x00, 0x12, 0x81, 0x20, 0x04, 0x96,
+ 0x09, 0x09, 0x03, 0x00, 0x00, 0x19, 0x03, 0x20, 0x11, 0x96, 0x0f, 0xe8, 0x03, 0x9f, 0x44, 0x28,
+ 0x81, 0x00, 0x06, 0x9f, 0x04, 0xb8, 0x13, 0x08, 0x42, 0x00, 0x10, 0x8f, 0x05, 0xe8, 0x00, 0x18,
+ 0x43, 0x20, 0x10, 0x1f, 0x03, 0x10, 0xd4, 0xc6, 0x05, 0x00, 0x00, 0x00, 0xe2, 0xc0, 0x49, 0x98,
+ 0x6c, 0x70, 0x8e, 0xbb, 0x88, 0x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0x79, 0xf1, 0x09,
+ 0xf4, 0x80, 0x40, 0x24, 0xc6, 0x32, 0xcb, 0x45, 0x80, 0x00, 0x82, 0x1f, 0x60, 0x8d, 0xe2, 0x6d,
+ 0x40, 0x25, 0x51, 0x10, 0xc3, 0x40, 0x80, 0x00, 0x50, 0x1f, 0xc3, 0x41, 0x80, 0x00, 0xc0, 0x22,
+ 0x80, 0xc2, 0xe1, 0x44, 0x72, 0x0c, 0xef, 0xff, 0x0a, 0x25, 0x40, 0x04, 0xc3, 0x41, 0x80, 0x00,
+ 0x90, 0x1f, 0x0b, 0x14, 0x82, 0x30, 0x08, 0x89, 0x09, 0x0a, 0x00, 0x00, 0x06, 0x1d, 0x43, 0x10,
+ 0x00, 0x87, 0x60, 0x81, 0x81, 0x81, 0x07, 0x7b, 0x48, 0xa9, 0x05, 0x23, 0x3e, 0x83, 0x05, 0xf4,
+ 0x00, 0x19, 0x03, 0x20, 0x0e, 0xf0, 0x04, 0x19, 0x01, 0x00, 0x00, 0xa1, 0x08, 0x1c, 0x04, 0x30,
+ 0x00, 0x19, 0x43, 0x20, 0x49, 0x86, 0x82, 0xc1, 0xc1, 0x40, 0x08, 0x18, 0x80, 0x20, 0x3e, 0x5b,
+ 0x0c, 0x70, 0xca, 0xc7, 0xe2, 0xc2, 0xcb, 0x45, 0x80, 0x00, 0x50, 0x1f, 0xc3, 0x42, 0x80, 0x00,
+ 0x24, 0x3b, 0xc3, 0x41, 0x80, 0x00, 0xc0, 0x22, 0xa1, 0x40, 0xb2, 0x0e, 0xef, 0xff, 0x00, 0x1a,
+ 0xc1, 0x0f, 0x0c, 0x70, 0x11, 0xa5, 0x10, 0xa5, 0xc3, 0x42, 0x80, 0x00, 0x98, 0x1f, 0x0c, 0xd8,
+ 0xc3, 0x41, 0x7f, 0x00, 0x10, 0xd2, 0x00, 0x1a, 0xc3, 0x00, 0x3a, 0x5b, 0x0c, 0x70, 0xc2, 0xc6,
+ 0xf1, 0xc0, 0x30, 0x80, 0x40, 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x00, 0x64, 0x69, 0x73, 0x61,
+ 0x62, 0x6c, 0x65, 0x5f, 0x67, 0x79, 0x72, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x56, 0x69, 0x72, 0x74,
+ 0x41, 0x6e, 0x79, 0x4e, 0x6f, 0x4d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x69, 0x73, 0x61,
+ 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x64, 0x6f, 0x6f, 0x72, 0x20, 0x25, 0x64, 0x00,
+ 0x73, 0x6d, 0x61, 0x72, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61,
+ 0x6c, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x6d,
+ 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x25, 0x64, 0x00,
+ 0x74, 0x69, 0x6d, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x00, 0x00, 0x00, 0x00, 0x56, 0x69, 0x72, 0x74,
+ 0x53, 0x6d, 0x61, 0x72, 0x74, 0x20, 0x56, 0x69, 0x72, 0x74, 0x41, 0x6e, 0x79, 0x4e, 0x6f, 0x4d,
+ 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00,
+ 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00,
+ 0x4e, 0x4f, 0x4d, 0x4f, 0x54, 0x49, 0x4f, 0x4e, 0x25, 0x64, 0x00, 0x00, 0x41, 0x4e, 0x59, 0x4d,
+ 0x4f, 0x54, 0x49, 0x4f, 0x4e, 0x25, 0x64, 0x00, 0x70, 0x68, 0x79, 0x5f, 0x61, 0x6e, 0x79, 0x00,
+ 0x70, 0x68, 0x79, 0x5f, 0x6e, 0x6f, 0x00, 0x00, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65,
+ 0x6e, 0x00, 0x00, 0x00, 0x38, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00, 0x53, 0x65, 0x74, 0x5f,
+ 0x6d, 0x6f, 0x64, 0x65, 0x25, 0x64, 0x00, 0x00, 0x31, 0x36, 0x30, 0x49, 0x52, 0x51, 0x5f, 0x61,
+ 0x6e, 0x79, 0x00, 0x00, 0x31, 0x36, 0x30, 0x49, 0x52, 0x51, 0x5f, 0x6e, 0x6f, 0x00, 0x00, 0x00,
+ 0x28, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x69, 0x2f, 0xe8, 0x03, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x1d, 0x0a, 0x00, 0x00, 0x48, 0xc6, 0x7f, 0x00, 0xd0, 0xc6, 0x7f, 0x00, 0xf0, 0xc5, 0x7f, 0x00,
+ 0x8c, 0xc7, 0x7f, 0x00, 0x38, 0xc6, 0x7f, 0x00, 0xc0, 0xc5, 0x7f, 0x00, 0xb4, 0xc5, 0x7f, 0x00,
+ 0x40, 0xc6, 0x7f, 0x00, 0xfc, 0xc5, 0x7f, 0x00, 0xbc, 0xc6, 0x7f, 0x00, 0xec, 0xc5, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf8, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x8f, 0xc2, 0x75, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0xe8, 0x03,
+ 0x30, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0xd8, 0xbc, 0x60, 0x00, 0x78, 0xb5, 0x7f, 0x00, 0x50, 0xbc, 0x60, 0x00, 0x6c, 0xb6, 0x7f, 0x00,
+ 0x84, 0xbc, 0x60, 0x00, 0x08, 0xbc, 0x60, 0x00, 0xd4, 0xbb, 0x60, 0x00, 0x90, 0xbc, 0x60, 0x00,
+ 0x88, 0xb2, 0x7f, 0x00, 0x20, 0xbd, 0x60, 0x00, 0x44, 0xbc, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x3a, 0x80, 0x00,
+ 0x7c, 0xde, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x1e, 0x05, 0x3e,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x10, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x2f, 0xe8, 0x03, 0x31, 0x01, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0xb4, 0xb4, 0x60, 0x00,
+ 0x40, 0xb5, 0x60, 0x00, 0x2c, 0xb4, 0x60, 0x00, 0xa8, 0xb5, 0x60, 0x00, 0x60, 0xb4, 0x60, 0x00,
+ 0xbc, 0xb3, 0x60, 0x00, 0x88, 0xb3, 0x60, 0x00, 0x6c, 0xb4, 0x60, 0x00, 0x38, 0xb4, 0x60, 0x00,
+ 0xfc, 0xb4, 0x60, 0x00, 0x20, 0xb4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x3a, 0x80, 0x00, 0x28, 0xe5, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0xe8, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0xe8, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x94, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x12, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xd1, 0x7f, 0x00, 0xe0, 0xd1, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x54, 0x01, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0xd1, 0x7f, 0x00, 0xf0, 0xd0, 0x7f, 0x00,
+ 0xd4, 0xd0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x22, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00,
+ 0x96, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8c, 0xcd, 0x7f, 0x00, 0xd4, 0xcc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0x97, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xd4, 0xb1, 0x7f, 0x00, 0x98, 0xb1, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xc8, 0x7f, 0x00,
+ 0xf0, 0xc7, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x7d, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00,
+ 0xe9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x34, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x58, 0x49, 0x61, 0x00, 0xe8, 0x48, 0x61, 0x00, 0xd8, 0x48, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0xea, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xec, 0x27, 0x61, 0x00, 0x7c, 0x27, 0x61, 0x00, 0x6c, 0x27, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1f, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9c, 0x60, 0x00,
+ 0xec, 0x9b, 0x60, 0x00, 0xd0, 0x9b, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x48, 0x21, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0xe4, 0x60, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xb8, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0d,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x7b, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xf5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe8, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x9c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xfa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x11, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x61, 0x00,
+ 0x34, 0x64, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xfb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xb0, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x7c, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00,
+ 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd2, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x96, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xcd, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xb0, 0xc7, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1e, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x50, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0xff, 0x60, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00,
+ 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x35, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x24, 0x7e, 0x61, 0x00, 0x1c, 0x7d, 0x61, 0x00, 0x98, 0x7d, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0xec, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x64, 0x70, 0x61, 0x00, 0xf4, 0x6f, 0x61, 0x00, 0xe4, 0x6f, 0x61, 0x00, 0x7c, 0x70, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x28, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0xc8, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xe9, 0x60, 0x00,
+ 0x98, 0xe4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0xc8, 0x00, 0x00,
+ 0x03, 0x1d, 0x00, 0x00, 0xb0, 0x2d, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x03, 0x01,
+ 0x00, 0x09, 0x0c, 0x96, 0x00, 0x10, 0x3c, 0x00, 0x01, 0x00, 0x01, 0x00, 0xb0, 0x04, 0x52, 0x03,
+ 0x00, 0x00, 0x40, 0x41, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0xb4,
+ 0x73, 0x00, 0x00, 0x00, 0x82, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd, 0xcc,
+ 0x0c, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x00,
+ 0x09, 0x04, 0x02, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xbd, 0x37, 0x86, 0x35, 0xbd, 0x37, 0x86, 0x35, 0xbd, 0x37, 0x86, 0x35, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x42, 0xe8, 0x03, 0x05, 0x00, 0x2d, 0x00, 0x84, 0x03, 0xb0,
+ 0x04, 0x96, 0x00, 0x08, 0x96, 0x00, 0x0e, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd,
+ 0xcc, 0x0c, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x01,
+ 0x06, 0x04, 0x02, 0x00, 0x05, 0x00, 0x41, 0x01, 0x40, 0x01, 0x24, 0x00, 0x78, 0x00, 0x04, 0x01,
+ 0x14, 0x14, 0x02, 0x02, 0x00, 0x04, 0x00, 0x00, 0x80, 0x3f, 0xcd, 0xcc, 0xcc, 0x3d, 0x9a, 0x99,
+ 0x99, 0x3f, 0xcd, 0xcc, 0xcc, 0x3e, 0xcd, 0xcc, 0xcc, 0x3d, 0x01, 0x00, 0x14, 0x00, 0x10, 0x04,
+ 0x78, 0x00, 0x08, 0x00, 0x00, 0x05, 0x9a, 0x99, 0x19, 0x3f, 0x9a, 0x99, 0x19, 0x3f, 0x50, 0x00,
+ 0x09, 0x00, 0x1e, 0x00, 0xe8, 0x03, 0x50, 0x00, 0x41, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x80,
+ 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0xb5, 0xfe, 0x16,
+ 0x37, 0xb5, 0xfe, 0x16, 0x37, 0xb5, 0xfe, 0x16, 0x37, 0x8b, 0xde, 0xa9, 0x38, 0x00, 0x00, 0xe0,
+ 0x40, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0xcc, 0x3d, 0x01, 0x09, 0x09, 0x03, 0x13, 0x32,
+ 0xa3, 0x04, 0xcd, 0x0c, 0x19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0x4c, 0x3f, 0x00, 0x00, 0x60, 0x40, 0x00, 0x00, 0x20,
+ 0x40, 0xcd, 0xcc, 0xcc, 0x3d, 0x04, 0x8f, 0xc2, 0xf5, 0x3c, 0x02, 0x01, 0x02, 0x03, 0x04, 0x01,
+ 0x0a, 0xb0, 0x04, 0x64, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x0a, 0xd7, 0x23, 0x3c, 0x01, 0x0a, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0xfa, 0x43, 0x00, 0x00, 0x7a, 0x44, 0x00, 0x00, 0xa0, 0x3f, 0x00, 0x00,
+ 0x48, 0x42, 0x00, 0x00, 0x80, 0x3f, 0x9a, 0x99, 0x19, 0x3e, 0x9a, 0x99, 0x99, 0x3d, 0x00, 0x00,
+ 0x20, 0x42, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x96, 0x18, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x96, 0x18, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x96, 0x18, 0x4b, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7,
+ 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5,
+ 0x27, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x03, 0x04, 0x19, 0x40, 0x12, 0x18, 0x00, 0x40,
+ 0x72, 0x08, 0x00, 0x0e, 0xb3, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x01, 0x01, 0x09, 0x0c, 0x88,
+ 0x13, 0x10, 0x01, 0x01, 0x71, 0x2a, 0x00, 0x00, 0xd4, 0xd3, 0x7f, 0x00, 0xdc, 0xd3, 0x7f, 0x00,
+ 0xdc, 0xd3, 0x7f, 0x00, 0xe4, 0xd3, 0x7f, 0x00, 0xe4, 0xd3, 0x7f, 0x00, 0xe8, 0xd3, 0x7f, 0x00,
+ 0xe8, 0xd3, 0x7f, 0x00, 0xec, 0xd3, 0x7f, 0x00, 0xec, 0xd3, 0x7f, 0x00, 0x00, 0xd4, 0x7f, 0x00,
+ 0x00, 0xd4, 0x7f, 0x00, 0x04, 0xd4, 0x7f, 0x00, 0x04, 0xd4, 0x7f, 0x00, 0x04, 0xd4, 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, 0x0b, 0x08, 0x71, 0x00,
+ 0x00, 0x2b, 0x40, 0x13, 0x05, 0x79, 0x22, 0xba, 0xa5, 0x72, 0x52, 0x6e, 0x0c, 0x71, 0xdb, 0x7c,
+ 0x6c, 0x73, 0x00, 0x28, 0x82, 0x00, 0x00, 0x2b, 0x00, 0x03, 0x06, 0x79, 0xc1, 0x40, 0xab, 0x22,
+ 0xa1, 0x0d, 0xab, 0x21, 0xe2, 0x03, 0x39, 0x5b, 0xd5, 0x08, 0x30, 0x00, 0x1c, 0xd8, 0x4c, 0x72,
+ 0xab, 0x20, 0xd0, 0x02, 0x42, 0x20, 0xc1, 0x03, 0x04, 0x71, 0xf9, 0x09, 0x74, 0x84, 0xab, 0x22,
+ 0x88, 0x01, 0x4a, 0x24, 0x40, 0x71, 0x11, 0xd8, 0xa8, 0x20, 0xc0, 0x02, 0x40, 0x20, 0x02, 0x04,
+ 0x42, 0x20, 0x81, 0x03, 0x04, 0x71, 0xab, 0x22, 0xd0, 0x02, 0xab, 0x21, 0x88, 0x01, 0x8d, 0x70,
+ 0x4a, 0x24, 0x00, 0x73, 0x0c, 0x70, 0xed, 0x71, 0xa8, 0x20, 0x00, 0x02, 0xa8, 0x48, 0x04, 0x71,
+ 0xab, 0x21, 0xd0, 0x02, 0xab, 0x27, 0x88, 0x11, 0x4a, 0x23, 0x80, 0x16, 0x8a, 0x21, 0x10, 0x00,
+ 0x19, 0xde, 0x8a, 0x20, 0x08, 0x00, 0x8a, 0x22, 0x04, 0x00, 0x11, 0xdb, 0xad, 0x70, 0xd3, 0x42,
+ 0x00, 0x00, 0xff, 0xff, 0xab, 0x23, 0xd0, 0x12, 0xab, 0x24, 0x88, 0x11, 0xab, 0x21, 0xe1, 0x0c,
+ 0xab, 0x21, 0x62, 0x07, 0xab, 0x21, 0xa2, 0x06, 0xab, 0x26, 0xd0, 0x12, 0xab, 0x27, 0x88, 0x11,
+ 0xab, 0x20, 0xe2, 0x06, 0xab, 0x20, 0xe1, 0x0c, 0xab, 0x20, 0x62, 0x07, 0xab, 0x20, 0xa2, 0x06,
+ 0xab, 0x22, 0x62, 0x07, 0xab, 0x22, 0xa2, 0x06, 0x3d, 0x08, 0x30, 0x20, 0xab, 0x23, 0xa0, 0x0d,
+ 0x22, 0x42, 0x0c, 0x70, 0x23, 0x92, 0x65, 0x8a, 0x55, 0x22, 0xc2, 0x08, 0xc9, 0xb9, 0x44, 0x23,
+ 0x03, 0x04, 0x3c, 0x21, 0x8e, 0x04, 0x79, 0x21, 0x0f, 0x00, 0x24, 0xbb, 0xcb, 0x7f, 0x65, 0x78,
+ 0x85, 0x71, 0xe5, 0x0c, 0x24, 0x94, 0xca, 0x22, 0x42, 0x20, 0x07, 0xf0, 0xb0, 0xd8, 0x3c, 0x5b,
+ 0xad, 0x70, 0x13, 0xf0, 0x0c, 0x70, 0x7a, 0x0a, 0x4f, 0x0a, 0x3a, 0x0a, 0x6f, 0x0a, 0x42, 0x40,
+ 0x22, 0x40, 0x02, 0x41, 0x82, 0x42, 0x7e, 0x0e, 0xef, 0xff, 0x62, 0x43, 0x05, 0xe8, 0x12, 0xd8,
+ 0xad, 0x71, 0xab, 0x20, 0xa0, 0x0d, 0xa1, 0x40, 0xd0, 0xc6, 0xe0, 0x78, 0xe4, 0xc3, 0x82, 0x24,
+ 0x11, 0x39, 0x8a, 0x21, 0x0c, 0x08, 0x00, 0x24, 0x80, 0x3f, 0x00, 0x00, 0x44, 0x01, 0x80, 0xc2,
+ 0x38, 0x60, 0x0d, 0x0a, 0x25, 0x00, 0x40, 0xc2, 0x00, 0x42, 0x40, 0xc0, 0x81, 0xc0, 0x56, 0x20,
+ 0x00, 0x0a, 0x09, 0x0a, 0x05, 0x00, 0x40, 0xc0, 0xcb, 0x45, 0x80, 0x00, 0xbc, 0x11, 0xcb, 0x46,
+ 0x80, 0x00, 0x20, 0x21, 0xcb, 0x44, 0xa5, 0x5a, 0x6b, 0xb6, 0x00, 0x24, 0x80, 0x3f, 0x00, 0x00,
+ 0x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
+ 0x09, 0x00, 0x00, 0x00, 0x01, 0x30, 0x21, 0x80, 0x00, 0x78, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd3, 0x7f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x40, 0x21, 0x80, 0x00, 0x80, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xe4, 0xd3, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x88, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xe8, 0xd3, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x90, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xec, 0xd3, 0x7f, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x28, 0x21, 0x80,
+ 0x00, 0x38, 0x21, 0x80, 0x00, 0x70, 0x22, 0x80, 0x00, 0xa8, 0x22, 0x80, 0x00, 0xb0, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x68, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0xd4, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x98, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0xd4, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0xa0, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x1f, 0x80, 0x00, 0x32, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x0e, 0x01, 0x2d, 0x01, 0xd4, 0x7b, 0x3b, 0x01, 0xdb, 0x7a, 0x04, 0x00, 0x3f, 0x7b, 0xcd, 0x6c,
+ 0x00, 0x00, 0xc3, 0x04, 0x85, 0x09, 0xc3, 0x04, 0xec, 0xe6, 0x0c, 0x46, 0x00, 0x00, 0x27, 0x00,
+ 0x19, 0x00, 0x00, 0x80, 0x96, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x0c, 0x00, 0xf0, 0x3c, 0x00, 0x01,
+ 0x01, 0x00, 0x03, 0x02, 0x0c, 0xee, 0x8f, 0x0e, 0x02, 0x04, 0x0e, 0x43, 0x07, 0x0f, 0xff, 0x07,
+ 0x09, 0x0f, 0x08, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x00, 0x00, 0xb4,
+ 0x0f, 0x6c, 0xff, 0x3f, 0x0f, 0x23, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,
+ 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x09, 0x10,
+ 0x04, 0x00, 0xe0, 0x05, 0x00, 0x47, 0x02, 0x02, 0x25, 0x09, 0x11, 0x0f, 0x0a, 0x0f, 0x10, 0x05,
+ 0x10, 0x06, 0x02, 0x07, 0xa4, 0xb8, 0x7f, 0x00, 0x0a, 0x15, 0xe2, 0x02, 0x08, 0x6c, 0x02, 0x08,
+ 0x01, 0x02, 0x08, 0x0c, 0xd5, 0x60, 0x00, 0x03, 0x18, 0xd0, 0xd4, 0x60, 0x02, 0x0e, 0x0f, 0x03,
+ 0x0f, 0x10, 0xff, 0x1f, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,
+ 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x05, 0x10, 0x80, 0xa5,
+ 0x60, 0x04, 0x00, 0x00, 0x68, 0x02, 0x04, 0x58, 0x5e, 0x61, 0x00, 0xa4, 0x37, 0x61, 0x00, 0xdc,
+ 0xa2, 0x60, 0x00, 0xc4, 0x10, 0x40, 0xa3, 0x60, 0x00, 0x40, 0x02, 0x04, 0xec, 0xaa, 0x60, 0x00,
+ 0x90, 0xa0, 0x60, 0x00, 0xa0, 0x02, 0x20, 0xf4, 0xc1, 0x42, 0x02, 0x0c, 0x30, 0x1c, 0x61, 0x00,
+ 0x3c, 0x02, 0x0c, 0x03, 0x3a, 0x05, 0x02, 0x05, 0x34, 0xd1, 0x60, 0x00, 0x03, 0x08, 0x08, 0x4a,
+ 0x25, 0xd3, 0x05, 0x08, 0x80, 0x06, 0x10, 0x9c, 0xd2, 0x05, 0x10, 0xac, 0x06, 0x10, 0x5c, 0x06,
+ 0x08, 0xc4, 0xd0, 0x05, 0x18, 0x8c, 0xe6, 0x12, 0x00, 0x7f, 0x34, 0x26, 0xfc, 0xc8, 0x15, 0x80,
+ 0xa0, 0xc7, 0x7f, 0x00, 0x0c, 0xd4, 0x7f, 0x00, 0xb0, 0xd5, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+#endif /*~ BHY_FW_D224DB1EB8B56338_H */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/bosch_pcb_7183_di03_bmi160_bmm150-7183_di03-2-1-11696_20180502.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/bosch_pcb_7183_di03_bmi160_bmm150-7183_di03-2-1-11696_20180502.h
new file mode 100644
index 0000000..45575dc
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/firmware/bosch_pcb_7183_di03_bmi160_bmm150-7183_di03-2-1-11696_20180502.h
@@ -0,0 +1,797 @@
+/* This code was generated by fw2h utility, please don't make change to it directly.
+ * FW2H version: 1.0.0.3. */
+
+#ifndef BHY_FW_7FE91DBFCC120FA4_H
+#define BHY_FW_7FE91DBFCC120FA4_H
+
+const unsigned char bhy_firmware_image[12592] = {
+ 0x2a, 0x65, 0x00, 0x1a, 0x42, 0x80, 0x57, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x20, 0x31, 0x00, 0x00,
+ 0x44, 0xa9, 0x7f, 0x00, 0xbc, 0x21, 0x00, 0x00, 0x84, 0x8d, 0x7f, 0x00, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,
+ 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,
+ 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,
+ 0x34, 0x50, 0x60, 0x00, 0xa4, 0x53, 0x60, 0x00, 0x04, 0x52, 0x60, 0x00, 0xb4, 0x94, 0x60, 0x00,
+ 0x84, 0x8d, 0x7f, 0x00, 0x84, 0x8d, 0x7f, 0x00, 0x84, 0x8d, 0x7f, 0x00, 0x84, 0x8d, 0x7f, 0x00,
+ 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00,
+ 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x59, 0x06, 0x4f, 0x06, 0x91, 0x07, 0x4f, 0x06,
+ 0xb1, 0x02, 0x4f, 0x08, 0xa1, 0x04, 0x4f, 0x08, 0xbd, 0x05, 0x4f, 0x08, 0x05, 0x01, 0x8f, 0x08,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 0x55, 0x01, 0xcf, 0x0a,
+ 0x89, 0x02, 0xcf, 0x0a, 0xc1, 0x05, 0xcf, 0x0a, 0xbd, 0x06, 0xcf, 0x0d, 0x11, 0x07, 0xcf, 0x0d,
+ 0xd9, 0x01, 0x8f, 0x04, 0x09, 0x02, 0x8f, 0x04, 0x15, 0x02, 0x8f, 0x04, 0x21, 0x02, 0x8f, 0x04,
+ 0x39, 0x02, 0x8f, 0x04, 0x5d, 0x02, 0x8f, 0x04, 0x69, 0x02, 0x8f, 0x04, 0x85, 0x00, 0x40, 0x00,
+ 0x49, 0x03, 0x8f, 0x04, 0x89, 0x03, 0x8f, 0x04, 0x95, 0x00, 0x40, 0x00, 0x51, 0x05, 0x8f, 0x04,
+ 0x8d, 0x05, 0x8f, 0x04, 0xa1, 0x05, 0x8f, 0x04, 0xf1, 0x05, 0x8f, 0x04, 0x21, 0x06, 0x8f, 0x04,
+ 0x59, 0x07, 0x8f, 0x04, 0x6d, 0x07, 0x8f, 0x04, 0xc5, 0x07, 0x8f, 0x04, 0xf1, 0x00, 0xcf, 0x04,
+ 0xfd, 0x00, 0xcf, 0x04, 0x05, 0x01, 0xcf, 0x04, 0x95, 0x01, 0xcf, 0x04, 0xfd, 0x01, 0xcf, 0x04,
+ 0x41, 0x02, 0xcf, 0x04, 0x55, 0x02, 0xcf, 0x04, 0xb9, 0x02, 0xcf, 0x04, 0xbd, 0x02, 0xcf, 0x04,
+ 0xc1, 0x02, 0xcf, 0x04, 0x05, 0x03, 0xcf, 0x04, 0x0d, 0x03, 0xcf, 0x04, 0x11, 0x03, 0xcf, 0x04,
+ 0x15, 0x03, 0xcf, 0x04, 0x19, 0x03, 0xcf, 0x04, 0x21, 0x03, 0xcf, 0x04, 0x45, 0x03, 0xcf, 0x04,
+ 0x4d, 0x03, 0xcf, 0x04, 0x61, 0x03, 0xcf, 0x04, 0x71, 0x03, 0xcf, 0x04, 0xc9, 0x03, 0xcf, 0x04,
+ 0xdd, 0x03, 0xcf, 0x04, 0x49, 0x05, 0xcf, 0x04, 0x55, 0x05, 0xcf, 0x04, 0x61, 0x05, 0xcf, 0x04,
+ 0x65, 0x05, 0xcf, 0x04, 0x69, 0x05, 0xcf, 0x04, 0x6d, 0x05, 0xcf, 0x04, 0x99, 0x05, 0xcf, 0x04,
+ 0x2d, 0x00, 0x0f, 0x05, 0xad, 0x00, 0x0f, 0x05, 0xf9, 0x00, 0x0f, 0x05, 0x41, 0x01, 0x0f, 0x05,
+ 0xe1, 0x01, 0x0f, 0x05, 0x09, 0x02, 0x0f, 0x05, 0xf1, 0x02, 0x0f, 0x05, 0xfd, 0x02, 0x0f, 0x05,
+ 0x21, 0x03, 0x0f, 0x05, 0x3d, 0x03, 0x0f, 0x05, 0x91, 0x03, 0x0f, 0x05, 0xad, 0x03, 0x0f, 0x05,
+ 0xb9, 0x03, 0x0f, 0x05, 0xdd, 0x03, 0x0f, 0x05, 0xed, 0x03, 0x0f, 0x05, 0xf5, 0x03, 0x0f, 0x05,
+ 0x35, 0x00, 0x40, 0x00, 0x15, 0x06, 0x0f, 0x05, 0xa1, 0x06, 0x0f, 0x05, 0xb1, 0x06, 0x0f, 0x05,
+ 0xb9, 0x06, 0x0f, 0x05, 0xc1, 0x06, 0x0f, 0x05, 0xd5, 0x06, 0x0f, 0x05, 0x25, 0x07, 0x0f, 0x05,
+ 0x69, 0x07, 0x0f, 0x05, 0x71, 0x07, 0x0f, 0x05, 0x0d, 0x00, 0x4f, 0x05, 0x29, 0x00, 0x4f, 0x05,
+ 0x39, 0x00, 0x4f, 0x05, 0x6d, 0x00, 0x4f, 0x05, 0x79, 0x00, 0x4f, 0x05, 0x9d, 0x00, 0x4f, 0x05,
+ 0xe5, 0x01, 0x4f, 0x05, 0x1d, 0x02, 0x4f, 0x05, 0x2d, 0x02, 0x4f, 0x05, 0x31, 0x02, 0x4f, 0x05,
+ 0x45, 0x02, 0x4f, 0x05, 0x29, 0x03, 0x4f, 0x05, 0x65, 0x03, 0x4f, 0x05, 0x01, 0x04, 0x4f, 0x05,
+ 0x0d, 0x04, 0x4f, 0x05, 0x19, 0x04, 0x4f, 0x05, 0x4d, 0x04, 0x4f, 0x05, 0x59, 0x04, 0x4f, 0x05,
+ 0xd9, 0x04, 0x4f, 0x05, 0x81, 0x05, 0x4f, 0x05, 0x85, 0x05, 0x4f, 0x05, 0xad, 0x05, 0x4f, 0x05,
+ 0xfd, 0x05, 0x4f, 0x05, 0x05, 0x06, 0x4f, 0x05, 0x0d, 0x06, 0x4f, 0x05, 0x39, 0x06, 0x4f, 0x05,
+ 0x71, 0x00, 0x8f, 0x05, 0xe9, 0x00, 0x8f, 0x05, 0xf9, 0x00, 0x8f, 0x05, 0x09, 0x01, 0x8f, 0x05,
+ 0xb5, 0x01, 0x8f, 0x05, 0xc1, 0x01, 0x8f, 0x05, 0xe1, 0x01, 0x8f, 0x05, 0xed, 0x01, 0x8f, 0x05,
+ 0x01, 0x02, 0x8f, 0x05, 0x0d, 0x02, 0x8f, 0x05, 0x19, 0x02, 0x8f, 0x05, 0x49, 0x02, 0x8f, 0x05,
+ 0x55, 0x02, 0x8f, 0x05, 0x1d, 0x03, 0x8f, 0x05, 0x91, 0x03, 0x8f, 0x05, 0xe5, 0x03, 0x8f, 0x05,
+ 0x25, 0x04, 0x8f, 0x05, 0x95, 0x04, 0x8f, 0x05, 0xb5, 0x04, 0x8f, 0x05, 0x29, 0x05, 0x8f, 0x05,
+ 0xa5, 0x05, 0x8f, 0x05, 0x31, 0x06, 0x8f, 0x05, 0x39, 0x06, 0x8f, 0x05, 0x41, 0x06, 0x8f, 0x05,
+ 0x49, 0x06, 0x8f, 0x05, 0x65, 0x07, 0x8f, 0x05, 0x89, 0x07, 0x8f, 0x05, 0x95, 0x07, 0x8f, 0x05,
+ 0xb1, 0x07, 0x8f, 0x05, 0xd9, 0x07, 0x8f, 0x05, 0xe5, 0x07, 0x8f, 0x05, 0x15, 0x00, 0xcf, 0x05,
+ 0xd1, 0x00, 0xcf, 0x05, 0x2d, 0x01, 0xcf, 0x05, 0x45, 0x01, 0xcf, 0x05, 0x75, 0x01, 0xcf, 0x05,
+ 0xa5, 0x01, 0xcf, 0x05, 0xb5, 0x01, 0xcf, 0x05, 0xd1, 0x01, 0xcf, 0x05, 0xf5, 0x01, 0xcf, 0x05,
+ 0xb9, 0x02, 0xcf, 0x05, 0xc5, 0x02, 0xcf, 0x05, 0xfd, 0x02, 0xcf, 0x05, 0x11, 0x03, 0xcf, 0x05,
+ 0x25, 0x03, 0xcf, 0x05, 0x41, 0x03, 0xcf, 0x05, 0x55, 0x03, 0xcf, 0x05, 0x69, 0x03, 0xcf, 0x05,
+ 0x8d, 0x04, 0xcf, 0x05, 0x9d, 0x04, 0xcf, 0x05, 0xad, 0x04, 0xcf, 0x05, 0xd1, 0x04, 0xcf, 0x05,
+ 0xe1, 0x04, 0xcf, 0x05, 0x39, 0x05, 0xcf, 0x05, 0x75, 0x05, 0xcf, 0x05, 0xf9, 0x05, 0xcf, 0x05,
+ 0x05, 0x06, 0xcf, 0x05, 0x11, 0x06, 0xcf, 0x05, 0x25, 0x06, 0xcf, 0x05, 0x35, 0x06, 0xcf, 0x05,
+ 0x49, 0x06, 0xcf, 0x05, 0x5d, 0x06, 0xcf, 0x05, 0x7d, 0x06, 0xcf, 0x05, 0x91, 0x06, 0xcf, 0x05,
+ 0xb5, 0x06, 0xcf, 0x05, 0xd1, 0x06, 0xcf, 0x05, 0xf9, 0x06, 0xcf, 0x05, 0x55, 0x07, 0xcf, 0x05,
+ 0xf1, 0x07, 0xcf, 0x05, 0x09, 0x00, 0x0f, 0x06, 0xdd, 0x00, 0x0f, 0x06, 0xa5, 0x01, 0x0f, 0x06,
+ 0x19, 0x02, 0x0f, 0x06, 0x25, 0x02, 0x0f, 0x06, 0x39, 0x02, 0x0f, 0x06, 0x45, 0x02, 0x0f, 0x06,
+ 0x55, 0x02, 0x0f, 0x06, 0x81, 0x02, 0x0f, 0x06, 0xa1, 0x02, 0x0f, 0x06, 0xb5, 0x02, 0x0f, 0x06,
+ 0xc1, 0x02, 0x0f, 0x06, 0xc9, 0x02, 0x0f, 0x06, 0xd5, 0x02, 0x0f, 0x06, 0x31, 0x03, 0x0f, 0x06,
+ 0x41, 0x03, 0x0f, 0x06, 0x51, 0x03, 0x0f, 0x06, 0x5d, 0x03, 0x0f, 0x06, 0x65, 0x03, 0x0f, 0x06,
+ 0x75, 0x03, 0x0f, 0x06, 0xcd, 0x03, 0x0f, 0x06, 0xf9, 0x03, 0x0f, 0x06, 0x05, 0x04, 0x0f, 0x06,
+ 0x59, 0x06, 0x0f, 0x06, 0x61, 0x06, 0x0f, 0x06, 0xc1, 0x06, 0x0f, 0x06, 0xd5, 0x06, 0x0f, 0x06,
+ 0xd9, 0x06, 0x0f, 0x06, 0xdd, 0x06, 0x0f, 0x06, 0x79, 0x04, 0x4f, 0x06, 0x91, 0x04, 0x4f, 0x06,
+ 0xa9, 0x04, 0x4f, 0x06, 0x01, 0x05, 0x4f, 0x06, 0x35, 0x05, 0x4f, 0x06, 0x65, 0x05, 0x4f, 0x06,
+ 0x2d, 0x06, 0x4f, 0x06, 0x45, 0x06, 0x4f, 0x06, 0x69, 0x06, 0x4f, 0x06, 0x6d, 0x06, 0x4f, 0x06,
+ 0x71, 0x06, 0x4f, 0x06, 0x75, 0x06, 0x4f, 0x06, 0x79, 0x06, 0x4f, 0x06, 0x7d, 0x06, 0x4f, 0x06,
+ 0x81, 0x06, 0x4f, 0x06, 0x85, 0x06, 0x4f, 0x06, 0x89, 0x06, 0x4f, 0x06, 0x8d, 0x06, 0x4f, 0x06,
+ 0x91, 0x06, 0x4f, 0x06, 0x95, 0x06, 0x4f, 0x06, 0xa1, 0x06, 0x4f, 0x06, 0xa9, 0x06, 0x4f, 0x06,
+ 0x69, 0x00, 0x8f, 0x06, 0x75, 0x00, 0x8f, 0x06, 0x8d, 0x00, 0x8f, 0x06, 0x99, 0x00, 0x8f, 0x06,
+ 0xa5, 0x00, 0x8f, 0x06, 0xf1, 0x00, 0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0x0f, 0x07,
+ 0xe5, 0x03, 0x0f, 0x07, 0xf5, 0x03, 0x0f, 0x07, 0x05, 0x04, 0x0f, 0x07, 0x2d, 0x04, 0x0f, 0x07,
+ 0x55, 0x04, 0x0f, 0x07, 0x99, 0x04, 0x0f, 0x07, 0xcd, 0x04, 0x0f, 0x07, 0xf1, 0x04, 0x0f, 0x07,
+ 0x09, 0x05, 0x0f, 0x07, 0x41, 0x05, 0x0f, 0x07, 0xc1, 0x05, 0x0f, 0x07, 0xe9, 0x05, 0x0f, 0x07,
+ 0x19, 0x07, 0x0f, 0x07, 0x59, 0x07, 0x0f, 0x07, 0x71, 0x07, 0x0f, 0x07, 0x89, 0x07, 0x0f, 0x07,
+ 0xa1, 0x07, 0x0f, 0x07, 0xe5, 0x07, 0x0f, 0x07, 0x55, 0x00, 0x4f, 0x07, 0x79, 0x00, 0x4f, 0x07,
+ 0xb9, 0x00, 0x4f, 0x07, 0x6d, 0x01, 0x4f, 0x07, 0xb5, 0x01, 0x4f, 0x07, 0x4d, 0x03, 0x4f, 0x07,
+ 0x21, 0x04, 0x4f, 0x07, 0x5d, 0x04, 0x4f, 0x07, 0x85, 0x04, 0x4f, 0x07, 0xf9, 0x04, 0x4f, 0x07,
+ 0x65, 0x05, 0x4f, 0x07, 0x81, 0x05, 0x4f, 0x07, 0xd9, 0x00, 0x8f, 0x07, 0x35, 0x01, 0x8f, 0x07,
+ 0x69, 0x01, 0x8f, 0x07, 0x75, 0x01, 0x8f, 0x07, 0xad, 0x01, 0x8f, 0x07, 0xed, 0x01, 0x8f, 0x07,
+ 0x19, 0x02, 0x8f, 0x07, 0x41, 0x02, 0x8f, 0x07, 0x4d, 0x02, 0x8f, 0x07, 0x59, 0x02, 0x8f, 0x07,
+ 0xa5, 0x03, 0x8f, 0x07, 0xb9, 0x03, 0x8f, 0x07, 0xc9, 0x03, 0x8f, 0x07, 0xd5, 0x03, 0x8f, 0x07,
+ 0xed, 0x03, 0x8f, 0x07, 0x01, 0x04, 0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 0x02, 0x10, 0x04, 0xf0, 0x04, 0x71, 0x00, 0xa9, 0xbe, 0x15, 0x80, 0x10,
+ 0xc4, 0xc6, 0xe0, 0x78, 0xec, 0xc3, 0xaa, 0xc1, 0x10, 0x41, 0x8a, 0x20, 0x45, 0x0d, 0x22, 0x70,
+ 0x00, 0x88, 0x70, 0x42, 0x2f, 0x08, 0xb4, 0x02, 0x55, 0x21, 0x0f, 0x2a, 0x8a, 0x20, 0x05, 0x0d,
+ 0x22, 0x70, 0x60, 0x88, 0xff, 0xdd, 0x50, 0x78, 0x7d, 0x65, 0x70, 0x40, 0x38, 0x60, 0xc7, 0xe1,
+ 0x8e, 0xf6, 0x0e, 0x78, 0x2f, 0x38, 0x03, 0x00, 0x00, 0x30, 0x80, 0x0f, 0xa3, 0x3c, 0x0a, 0xd7,
+ 0x10, 0xf0, 0x0c, 0x70, 0x00, 0xa7, 0x01, 0xa7, 0x02, 0xa7, 0xa5, 0xf0, 0x95, 0xe1, 0x2c, 0x71,
+ 0x93, 0xf6, 0x0e, 0x78, 0x2f, 0x38, 0x03, 0x00, 0x00, 0x30, 0x80, 0x0f, 0x4c, 0x3e, 0xcd, 0xcc,
+ 0xa6, 0x0c, 0x0f, 0x04, 0x10, 0x79, 0x34, 0x76, 0x07, 0xd9, 0x07, 0xf7, 0x10, 0x79, 0x34, 0x72,
+ 0x2c, 0x71, 0xca, 0x21, 0x06, 0x00, 0xaf, 0x78, 0x30, 0x7e, 0x15, 0x21, 0x00, 0x20, 0x15, 0x21,
+ 0x91, 0x23, 0x7e, 0x80, 0x54, 0x80, 0x2a, 0x80, 0x00, 0x80, 0x74, 0x11, 0x07, 0x20, 0x4c, 0x11,
+ 0x06, 0x20, 0x24, 0x11, 0x05, 0x20, 0xfc, 0x11, 0x04, 0xa0, 0x86, 0xc4, 0x41, 0xc4, 0xaa, 0x0f,
+ 0xef, 0x0d, 0x00, 0x1c, 0x81, 0x30, 0x09, 0xc3, 0x08, 0xc2, 0x07, 0xc1, 0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0x00, 0x1f, 0x83, 0x10, 0x38, 0x5b, 0x00, 0x10, 0x0d, 0x20, 0x24, 0xf0, 0x42, 0x6f, 0x00, 0x1a,
+ 0x82, 0x04, 0x00, 0x19, 0x82, 0x24, 0x04, 0x8e, 0x4b, 0xd9, 0x6c, 0x71, 0x42, 0x44, 0x42, 0x45,
+ 0xc3, 0x46, 0x80, 0x3f, 0x00, 0x00, 0x30, 0x5b, 0x0c, 0x71, 0x00, 0x1f, 0x82, 0x14, 0x21, 0x5b,
+ 0x0c, 0x70, 0xc1, 0x41, 0x00, 0x18, 0x40, 0x23, 0x38, 0x5b, 0x0c, 0xf0, 0xc6, 0x0e, 0x4f, 0x09,
+ 0x00, 0x41, 0xc1, 0x40, 0x37, 0x5b, 0x47, 0x86, 0x0c, 0x71, 0x60, 0x7a, 0xc1, 0x41, 0x10, 0xdd,
+ 0xa1, 0x40, 0xcc, 0xc7, 0x42, 0x28, 0xc1, 0x07, 0x38, 0x60, 0x27, 0x78, 0xe0, 0x7f, 0x0e, 0x78,
+ 0x2c, 0x70, 0x9e, 0xb9, 0x20, 0x42, 0x01, 0x08, 0xa4, 0x00, 0x22, 0xb9, 0x2c, 0x70, 0x0b, 0xea,
+ 0x5b, 0x61, 0x0b, 0x08, 0xc4, 0x00, 0x62, 0x78, 0x54, 0x79, 0x41, 0x2a, 0x82, 0x80, 0x3d, 0x79,
+ 0xf8, 0xf5, 0xe0, 0x7f, 0x30, 0x78, 0xe0, 0x78, 0x80, 0x98, 0x61, 0x98, 0x42, 0x98, 0x89, 0x7c,
+ 0x69, 0x7b, 0x49, 0x7a, 0x98, 0x63, 0xcd, 0x07, 0xef, 0xff, 0x58, 0x60, 0xe2, 0xc2, 0xea, 0x0a,
+ 0xaf, 0x0a, 0x08, 0x45, 0x06, 0x1d, 0x05, 0x13, 0xc2, 0xc6, 0xe0, 0x78, 0xf1, 0xc0, 0xc3, 0x42,
+ 0x80, 0x00, 0x24, 0x21, 0x20, 0x82, 0x20, 0x81, 0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0x40, 0x00, 0x1d, 0x03, 0x00, 0x0a, 0x21,
+ 0x80, 0x21, 0x0a, 0x20, 0x40, 0x21, 0x0a, 0x25, 0x00, 0x21, 0x70, 0x46, 0x28, 0x47, 0x9e, 0x0d,
+ 0xef, 0xff, 0x00, 0x1e, 0xc3, 0x00, 0x10, 0x42, 0x2f, 0x26, 0x06, 0xf0, 0xc3, 0x40, 0x00, 0x00,
+ 0xff, 0x7f, 0x14, 0x16, 0x46, 0x11, 0x16, 0x16, 0x45, 0x11, 0x0e, 0x16, 0x44, 0x11, 0x68, 0x9e,
+ 0x49, 0x9e, 0xca, 0x22, 0x04, 0x20, 0x2f, 0x21, 0x86, 0x04, 0x3a, 0x0f, 0xef, 0xff, 0x2e, 0x4f,
+ 0x2c, 0x96, 0x10, 0x43, 0x0e, 0xe9, 0x14, 0x16, 0x46, 0x11, 0x16, 0x16, 0x45, 0x11, 0x0e, 0x16,
+ 0x44, 0x11, 0x68, 0x9e, 0x49, 0x9e, 0x3a, 0x4f, 0x1a, 0x0f, 0xef, 0xff, 0x62, 0x41, 0x10, 0x43,
+ 0x02, 0x97, 0x02, 0x20, 0xc0, 0x04, 0x12, 0x0d, 0xef, 0xff, 0x0e, 0x78, 0x44, 0x28, 0x00, 0x08,
+ 0x25, 0x9e, 0x09, 0x78, 0x0e, 0x78, 0x44, 0x28, 0x80, 0x00, 0x0e, 0x7a, 0x5e, 0x0f, 0xef, 0xff,
+ 0x18, 0x4f, 0x32, 0x9e, 0x04, 0x9f, 0x73, 0x9e, 0x42, 0x9f, 0x09, 0x79, 0x18, 0x23, 0x80, 0x00,
+ 0x3f, 0x21, 0x00, 0x00, 0x21, 0x68, 0x00, 0x19, 0x42, 0x20, 0x17, 0x96, 0x1a, 0xe8, 0x2f, 0x20,
+ 0x88, 0x04, 0xc3, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x0e, 0x78, 0x14, 0x70, 0xc6, 0xf6, 0x14, 0x17,
+ 0xc0, 0x10, 0x21, 0x08, 0x13, 0x00, 0x07, 0xf0, 0x4c, 0xf6, 0x14, 0x17, 0xc0, 0x10, 0x15, 0x08,
+ 0x52, 0x00, 0x29, 0x97, 0x13, 0x78, 0x24, 0x71, 0x29, 0xb7, 0x14, 0xaf, 0x00, 0x11, 0x81, 0x20,
+ 0x34, 0x72, 0x07, 0x9f, 0x40, 0x26, 0x03, 0x17, 0x40, 0x26, 0x82, 0x16, 0xca, 0x22, 0xc1, 0x00,
+ 0x2c, 0x71, 0x72, 0x0e, 0xef, 0xff, 0x00, 0x12, 0x14, 0x01, 0x07, 0xb7, 0x42, 0x9f, 0x21, 0x9e,
+ 0xea, 0x0e, 0xef, 0xff, 0xe1, 0x40, 0x42, 0x9f, 0x00, 0x9e, 0x20, 0x9f, 0x58, 0x60, 0x09, 0x09,
+ 0x03, 0x00, 0x00, 0xb7, 0x23, 0x9e, 0xa2, 0x6f, 0xa1, 0x40, 0xd2, 0x0e, 0xef, 0xff, 0xb1, 0x42,
+ 0x22, 0x9e, 0x02, 0x9f, 0x41, 0x9f, 0x31, 0x48, 0x0b, 0x09, 0xa3, 0x00, 0x04, 0x6f, 0x00, 0x1a,
+ 0x44, 0x20, 0x25, 0x9e, 0xb6, 0x0e, 0xef, 0xff, 0x62, 0x42, 0x00, 0x9f, 0xad, 0x70, 0x72, 0x70,
+ 0x0c, 0x70, 0x4e, 0xf6, 0x00, 0x1f, 0xc4, 0x14, 0x2b, 0x8f, 0xad, 0x70, 0x88, 0xe9, 0x27, 0x9f,
+ 0x0d, 0x0c, 0x63, 0x20, 0xad, 0x70, 0xad, 0x71, 0xab, 0xaf, 0x07, 0xb7, 0x00, 0x12, 0x41, 0x21,
+ 0x0b, 0x0b, 0x43, 0x20, 0x02, 0x1f, 0xc4, 0x14, 0x0b, 0xaf, 0x5f, 0x0e, 0x30, 0x20, 0x2c, 0x71,
+ 0xf2, 0x0d, 0xef, 0xff, 0x06, 0x9f, 0x2c, 0x71, 0x06, 0xb7, 0x00, 0x18, 0x42, 0x23, 0x28, 0xed,
+ 0x15, 0x96, 0x09, 0xe8, 0x56, 0x96, 0x23, 0x9f, 0x06, 0x9f, 0x4c, 0x79, 0x04, 0xb8, 0x3e, 0x20,
+ 0x41, 0x00, 0x17, 0x96, 0x6e, 0x70, 0x14, 0x70, 0x0c, 0x70, 0x06, 0xf2, 0x49, 0x97, 0x18, 0x96,
+ 0x3c, 0x20, 0x80, 0x00, 0x40, 0x27, 0x92, 0x12, 0x16, 0xe9, 0x96, 0xe8, 0x24, 0x96, 0x00, 0x12,
+ 0x80, 0x20, 0x3d, 0x08, 0x63, 0x00, 0xa1, 0x68, 0xaf, 0x78, 0x30, 0x70, 0x00, 0x1a, 0x42, 0x23,
+ 0xca, 0x25, 0x2b, 0x10, 0x2b, 0xf0, 0x00, 0x18, 0x42, 0x23, 0x60, 0xf0, 0x06, 0x9f, 0x40, 0x27,
+ 0x92, 0x12, 0x46, 0xf0, 0x0a, 0x1f, 0xc2, 0x14, 0x51, 0x96, 0x8a, 0x21, 0x06, 0x04, 0x54, 0x70,
+ 0x8a, 0x20, 0x0c, 0x08, 0xca, 0x20, 0x41, 0x00, 0x03, 0xb7, 0x33, 0xf0, 0x26, 0x97, 0x03, 0x97,
+ 0x04, 0xb9, 0x1b, 0x78, 0x22, 0x78, 0x92, 0x0b, 0xef, 0xff, 0x0e, 0x78, 0x30, 0x96, 0x66, 0x6f,
+ 0x0d, 0x08, 0x63, 0x00, 0xad, 0x71, 0xad, 0x72, 0x00, 0x18, 0x42, 0x23, 0x06, 0x97, 0x26, 0x9e,
+ 0x04, 0xb8, 0x0e, 0x7a, 0xd6, 0x0d, 0xef, 0xff, 0x60, 0x40, 0x51, 0x96, 0x03, 0xea, 0xaf, 0x78,
+ 0x1b, 0x7d, 0x2f, 0x20, 0x47, 0x93, 0x15, 0xf2, 0xa6, 0x41, 0x8f, 0x97, 0x28, 0x16, 0x0b, 0x11,
+ 0x4a, 0x20, 0x00, 0x00, 0x61, 0x74, 0x41, 0x2c, 0x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 0x03, 0xe8, 0x10, 0x19, 0x03, 0x00, 0x14, 0x70, 0x8a, 0x22, 0x06, 0x04, 0x8a, 0x20, 0x0c, 0x08,
+ 0xca, 0x20, 0x81, 0x00, 0x0a, 0x19, 0x03, 0x00, 0x03, 0xb1, 0x14, 0x19, 0x43, 0x00, 0x12, 0x19,
+ 0x05, 0x00, 0xc2, 0xc4, 0xf1, 0xc0, 0xa1, 0xc1, 0x30, 0x80, 0x40, 0x91, 0x00, 0x1c, 0x84, 0x30,
+ 0x42, 0x81, 0x80, 0xc1, 0x36, 0x5b, 0x87, 0x74, 0xd1, 0xc0, 0xe0, 0x7f, 0x0c, 0x70, 0xe0, 0x78,
+ 0xea, 0xc3, 0xa3, 0xc1, 0x40, 0x10, 0x10, 0x00, 0x08, 0x46, 0x26, 0x5b, 0x08, 0x45, 0x22, 0x5b,
+ 0x00, 0x42, 0x0c, 0x71, 0xa1, 0x41, 0x25, 0x5b, 0x30, 0x80, 0xf5, 0x80, 0x60, 0x79, 0x08, 0x45,
+ 0x2a, 0x8d, 0x8d, 0x71, 0x6c, 0xb9, 0x38, 0x7c, 0x4c, 0x70, 0x80, 0xc3, 0x04, 0x17, 0x41, 0x15,
+ 0x44, 0x71, 0x0c, 0x79, 0x04, 0x29, 0x01, 0x03, 0x02, 0x1b, 0x54, 0x00, 0x4f, 0x79, 0xf1, 0x09,
+ 0xf4, 0x80, 0x40, 0x24, 0xc6, 0x32, 0xcb, 0x45, 0x80, 0x00, 0x22, 0x20, 0x60, 0x8d, 0xe2, 0x6d,
+ 0x40, 0x25, 0x51, 0x10, 0xc3, 0x40, 0x80, 0x00, 0xf0, 0x1f, 0xc3, 0x41, 0x80, 0x00, 0xbc, 0x22,
+ 0x80, 0xc2, 0xe1, 0x44, 0x72, 0x0c, 0xef, 0xff, 0x0a, 0x25, 0x40, 0x04, 0xc3, 0x41, 0x80, 0x00,
+ 0x30, 0x20, 0x0b, 0x14, 0x82, 0x30, 0x08, 0x89, 0x09, 0x0a,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 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x2f, 0x90, 0x01,
+ 0x0b, 0x05, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00,
+ 0xdc, 0xcd, 0x60, 0x00, 0xdc, 0x8f, 0x7f, 0x00, 0x10, 0xcd, 0x60, 0x00, 0x18, 0xd0, 0x60, 0x00,
+ 0x3c, 0xcd, 0x60, 0x00, 0xd0, 0xcc, 0x60, 0x00, 0xa4, 0xcc, 0x60, 0x00, 0x48, 0xcd, 0x60, 0x00,
+ 0x1c, 0xcd, 0x60, 0x00, 0xf4, 0xce, 0x60, 0x00, 0x08, 0xcd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x80, 0x00,
+ 0xec, 0xa1, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xd0, 0x07, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0xe8, 0x03, 0x30, 0x01, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0xd8, 0xbc, 0x60, 0x00,
+ 0x64, 0xbd, 0x60, 0x00, 0x50, 0xbc, 0x60, 0x00, 0x40, 0xbe, 0x60, 0x00, 0x84, 0xbc, 0x60, 0x00,
+ 0x08, 0xbc, 0x60, 0x00, 0xd4, 0xbb, 0x60, 0x00, 0x90, 0xbc, 0x60, 0x00, 0x40, 0xb3, 0x60, 0x00,
+ 0x20, 0xbd, 0x60, 0x00, 0x44, 0xbc, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x3a, 0x80, 0x00, 0x14, 0xa2, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x1e, 0x05, 0x3e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x69, 0x2f, 0xe8, 0x03, 0x31, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0xb4, 0xb4, 0x60, 0x00, 0x40, 0xb5, 0x60, 0x00,
+ 0x2c, 0xb4, 0x60, 0x00, 0xa8, 0xb5, 0x60, 0x00, 0x60, 0xb4, 0x60, 0x00, 0xbc, 0xb3, 0x60, 0x00,
+ 0x88, 0xb3, 0x60, 0x00, 0x6c, 0xb4, 0x60, 0x00, 0x38, 0xb4, 0x60, 0x00, 0xfc, 0xb4, 0x60, 0x00,
+ 0x20, 0xb4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x3a, 0x80, 0x00, 0xc0, 0xa8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x90, 0x01, 0xe8, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0x00, 0x00, 0x00, 0x94, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x97, 0x7f, 0x00,
+ 0xd8, 0x97, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x1f, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00,
+ 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x30, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa4, 0x97, 0x7f, 0x00, 0xf0, 0x96, 0x7f, 0x00, 0xd4, 0x96, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xb8, 0x7d, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x19, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x49, 0x61, 0x00,
+ 0xe8, 0x48, 0x61, 0x00, 0xd8, 0x48, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xe8, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x16, 0x01, 0x00, 0x00, 0xea, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x27, 0x61, 0x00, 0x7c, 0x27, 0x61, 0x00,
+ 0x6c, 0x27, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x23, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00,
+ 0xeb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x34, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9c, 0x60, 0x00, 0xec, 0x9b, 0x60, 0x00, 0xd0, 0x9b, 0x60, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x21, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8c, 0xe4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x94, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x7c, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x7b, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfa, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x61, 0x00, 0x34, 0x64, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x8c, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x7a, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
+ 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x34, 0x7c, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x98, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1e, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x50, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0xff, 0x60, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00,
+ 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x35, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x24, 0x7e, 0x61, 0x00, 0x1c, 0x7d, 0x61, 0x00, 0x98, 0x7d, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0xec, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x64, 0x70, 0x61, 0x00, 0xf4, 0x6f, 0x61, 0x00, 0xe4, 0x6f, 0x61, 0x00, 0x7c, 0x70, 0x61, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x24, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0xc8, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xe9, 0x60, 0x00,
+ 0x98, 0xe4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0xc8, 0x00, 0x00,
+ 0x03, 0x18, 0x00, 0x00, 0xb0, 0x2d, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x02, 0x01,
+ 0x14, 0x05, 0x14, 0x05, 0xc4, 0x09, 0x06, 0x09, 0x70, 0x17, 0x00, 0x00, 0x80, 0x3d, 0xcd, 0xcc,
+ 0x4c, 0x3f, 0x00, 0x00, 0xe0, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x86, 0x54, 0x00, 0x25, 0x00, 0x03, 0x01, 0x00, 0x09, 0x0c, 0x96, 0x00, 0x10, 0x3c, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0xb0, 0x04, 0x52, 0x03, 0x00, 0x00, 0x40, 0x41, 0x01, 0x01, 0x01, 0x01,
+ 0x02, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0xb4, 0x73, 0x00, 0x00, 0x00, 0x82, 0x06, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33,
+ 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33,
+ 0x33, 0x3f, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x00, 0x09, 0x04, 0x02, 0x17, 0xb7, 0xd1, 0x38, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
+ 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x37, 0x86, 0x35, 0xbd,
+ 0x37, 0x86, 0x35, 0xbd, 0x37, 0x86, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x42, 0xe8,
+ 0x03, 0x05, 0x00, 0x2d, 0x00, 0x84, 0x03, 0xb0, 0x04, 0x96, 0x00, 0x08, 0x96, 0x00, 0x0e, 0x01,
+ 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33,
+ 0x33, 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0x33,
+ 0x33, 0x33, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x01, 0x06, 0x04, 0x02, 0x00, 0x05, 0x00, 0x41, 0x01,
+ 0x40, 0x01, 0x24, 0x00, 0x78, 0x00, 0x04, 0x01, 0x14, 0x14, 0x02, 0x02, 0x00, 0x04, 0x00, 0x00,
+ 0x80, 0x3f, 0xcd, 0xcc, 0xcc, 0x3d, 0x9a, 0x99, 0x99, 0x3f, 0xcd, 0xcc, 0xcc, 0x3e, 0xcd, 0xcc,
+ 0xcc, 0x3d, 0x01, 0x00, 0x14, 0x00, 0x10, 0x04, 0x78, 0x00, 0x08, 0x00, 0x00, 0x05, 0x9a, 0x99,
+ 0x19, 0x3f, 0x9a, 0x99, 0x19, 0x3f, 0x50, 0x00, 0x09, 0x00, 0x1e, 0x00, 0xe8, 0x03, 0x50, 0x00,
+ 0x41, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x40, 0xb5, 0xfe, 0x16, 0x37, 0xb5, 0xfe, 0x16, 0x37, 0xb5, 0xfe, 0x16,
+ 0x37, 0x8b, 0xde, 0xa9, 0x38, 0x00, 0x00, 0xe0, 0x40, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 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0x80, 0x3e, 0x8f, 0xc2, 0xf5,
+ 0x3c, 0x0a, 0xd7, 0xa3, 0x3c, 0x64, 0x80, 0x34, 0x2d, 0x46, 0x01, 0x0a, 0x00, 0x50, 0x00, 0x00,
+ 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x09, 0x02, 0x00, 0x00, 0xc8, 0x41, 0x00, 0x00, 0x80,
+ 0x42, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0xc0, 0x3f, 0xcd, 0xcc, 0x4c, 0x3d, 0xc2, 0xb8, 0xb2,
+ 0x3d, 0x32, 0x25, 0x3b, 0x18, 0x47, 0x00, 0x00, 0xa0, 0x40, 0x9a, 0x99, 0x19, 0x3f, 0x0a, 0xd7,
+ 0x23, 0x3c, 0x0a, 0xd7, 0x23, 0x3c, 0x02, 0x50, 0x77, 0x56, 0x3d, 0x00, 0x01, 0xcd, 0xcc, 0x4c,
+ 0x3f, 0x00, 0x00, 0x60, 0x40, 0x00, 0x00, 0x20, 0x40, 0xcd, 0xcc, 0xcc, 0x3d, 0x04, 0x8f, 0xc2,
+ 0xf5, 0x3c, 0x02, 0x01, 0x02, 0x03, 0x04, 0x01, 0x0a, 0xb0, 0x04, 0x64, 0x00, 0x0a, 0xd7, 0x23,
+ 0x3c, 0x0a, 0xd7, 0x23, 0x3c, 0x01, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xfa, 0x43, 0x00, 0x00,
+ 0x7a, 0x44, 0x00, 0x00, 0xa0, 0x3f, 0x00, 0x00, 0x48, 0x42, 0x00, 0x00, 0x80, 0x3f, 0x9a, 0x99,
+ 0x19, 0x3e, 0x9a, 0x99, 0x99, 0x3d, 0x00, 0x00, 0x20, 0x42, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x96,
+ 0x18, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x96,
+ 0x18, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x96,
+ 0x18, 0x4b, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x40, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7,
+ 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7,
+ 0xd1, 0x38, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7,
+ 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5,
+ 0x27, 0x37, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24,
+ 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+ 0x03, 0x04,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 0x40,
+ 0x10, 0xda, 0xab, 0x22, 0xa0, 0x0d, 0x55, 0x88, 0x97, 0x88, 0xcc, 0x88, 0x70, 0x44, 0x76, 0x88,
+ 0x14, 0x88, 0x08, 0xba, 0x08, 0xbc, 0x45, 0x78, 0x05, 0x24, 0xc2, 0x10, 0x10, 0xba, 0x30, 0x41,
+ 0x0a, 0x23, 0x00, 0x21, 0xc3, 0x41, 0x00, 0x00, 0xaa, 0x0a, 0xad, 0x70, 0x6d, 0x72, 0x4a, 0x24,
+ 0x00, 0x72, 0xc3, 0xbe, 0x05, 0x7a, 0xa8, 0x20, 0xc0, 0x05, 0x53, 0x22, 0x40, 0x00, 0x4f, 0x20,
+ 0x43, 0x00, 0x15, 0x0b, 0xb1, 0x00, 0x00, 0x2b, 0x43, 0x13, 0x66, 0x79, 0x14, 0x72, 0xcf, 0x21,
+ 0x41, 0x03, 0x07, 0xf2, 0x0b, 0x08, 0x71, 0x00, 0x00, 0x2b, 0x40, 0x13, 0x05, 0x79, 0x22, 0xba,
+ 0xa5, 0x72, 0x52, 0x6e, 0x0c, 0x71, 0xdb, 0x7c, 0x6c, 0x73, 0x00, 0x28, 0x82, 0x00, 0x00, 0x2b,
+ 0x00, 0x03, 0x06, 0x79, 0xc1, 0x40, 0xab, 0x22, 0xa1, 0x0d, 0xab, 0x21, 0xe2, 0x03, 0x32, 0x5b,
+ 0xd5, 0x08, 0x30, 0x00, 0x1c, 0xd8, 0x4c, 0x72, 0xab, 0x20, 0xd0, 0x02, 0x42, 0x20, 0xc1, 0x03,
+ 0x04, 0x71, 0xf9, 0x09, 0x74, 0x84, 0xab, 0x22, 0x88, 0x01, 0x4a, 0x24, 0x40, 0x71, 0x11, 0xd8,
+ 0xa8, 0x20, 0xc0, 0x02, 0x40, 0x20, 0x02, 0x04, 0x42, 0x20, 0x81, 0x03, 0x04, 0x71, 0xab, 0x22,
+ 0xd0, 0x02, 0xab, 0x21, 0x88, 0x01, 0x8d, 0x70, 0x4a, 0x24, 0x00, 0x73, 0x0c, 0x70, 0xed, 0x71,
+ 0xa8, 0x20, 0x00, 0x02, 0xa8, 0x48, 0x04, 0x71, 0xab, 0x21, 0xd0, 0x02, 0xab, 0x27, 0x88, 0x11,
+ 0x4a, 0x23, 0x80, 0x16, 0x8a, 0x21, 0x10, 0x00, 0x19, 0xde, 0x8a, 0x20, 0x08, 0x00, 0x8a, 0x22,
+ 0x04, 0x00, 0x11, 0xdb, 0xad, 0x70, 0xd3, 0x42, 0x00, 0x00, 0xff, 0xff, 0xab, 0x23, 0xd0, 0x12,
+ 0xab, 0x24, 0x88, 0x11, 0xab, 0x21, 0xe1, 0x0c, 0xab, 0x21, 0x62, 0x07, 0xab, 0x21, 0xa2, 0x06,
+ 0xab, 0x26, 0xd0, 0x12, 0xab, 0x27, 0x88, 0x11, 0xab, 0x20, 0xe2, 0x06, 0xab, 0x20, 0xe1, 0x0c,
+ 0xab, 0x20, 0x62, 0x07, 0xab, 0x20, 0xa2, 0x06, 0xab, 0x22, 0x62, 0x07, 0xab, 0x22, 0xa2, 0x06,
+ 0x3d, 0x08, 0x30, 0x20, 0xab, 0x23, 0xa0, 0x0d, 0x22, 0x42, 0x0c, 0x70, 0x23, 0x92, 0x65, 0x8a,
+ 0x55, 0x22, 0xc2, 0x08, 0xc9, 0xb9, 0x44, 0x23, 0x03, 0x04, 0x3c, 0x21, 0x8e, 0x04, 0x79, 0x21,
+ 0x0f, 0x00, 0x24, 0xbb, 0xcb, 0x7f, 0x65, 0x78, 0x85, 0x71, 0xe5, 0x0c, 0x24, 0x94, 0xca, 0x22,
+ 0x42, 0x20, 0x07, 0xf0, 0xb0, 0xd8, 0x35, 0x5b, 0xad, 0x70, 0x13, 0xf0, 0x0c, 0x70, 0xe2, 0x0e,
+ 0x0f, 0x0c, 0xa2, 0x0e, 0x2f, 0x0c, 0x42, 0x40, 0x22, 0x40, 0x02, 0x41, 0x82, 0x42, 0x7e, 0x0e,
+ 0xef, 0xff, 0x62, 0x43, 0x05, 0xe8, 0x12, 0xd8, 0xad, 0x71, 0xab, 0x20, 0xa0, 0x0d, 0xa1, 0x40,
+ 0xd0, 0xc6, 0xe0, 0x78, 0xe4, 0xc3, 0x82, 0x24, 0x11, 0x39, 0x8a, 0x21, 0x0c, 0x08, 0x00, 0x24,
+ 0x80, 0x3f, 0x00, 0x00, 0x44, 0x01, 0x80, 0xc2, 0x38, 0x60, 0x0d, 0x0a, 0x25, 0x00, 0x40, 0xc2,
+ 0x00, 0x42, 0x40, 0xc0, 0x81, 0xc0, 0x56, 0x20, 0x00, 0x0a, 0x09, 0x0a, 0x05, 0x00, 0x40, 0xc0,
+ 0xcb, 0x45, 0x80, 0x00, 0x5c, 0x12, 0xcb, 0x46, 0x80, 0x00, 0x24, 0x21, 0xcb, 0x44, 0xa5, 0x5a,
+ 0x6b, 0xb6, 0x00, 0x24, 0x80, 0x3f, 0x00, 0x00, 0x44, 0x01, 0x28, 0xd9, 0x81, 0xc2, 0x10, 0xdb,
+ 0xa0, 0xa6, 0x1a, 0x0d, 0xef, 0xff, 0x80, 0xa5, 0x44, 0x6d, 0xc3, 0x41, 0x80, 0x00, 0x00, 0x00,
+ 0xc3, 0x43, 0x7f, 0x00, 0xec, 0xa1, 0xc3, 0x44, 0x80, 0x00, 0x00, 0x00, 0xb2, 0x08, 0xaf, 0x0c,
+ 0xa1, 0x40, 0x0c, 0x70, 0xc4, 0xc7, 0xe0, 0x78, 0xf0, 0xc2, 0x70, 0x41, 0x50, 0x42, 0x30, 0x43,
+ 0x10, 0x44, 0xab, 0x0b, 0x30, 0x00, 0xcd, 0x70, 0x8a, 0x20, 0x01, 0x23, 0x1a, 0x26, 0x0f, 0x14,
+ 0x42, 0x77, 0xe1, 0x40, 0x27, 0x5b, 0x0d, 0x08, 0x95, 0x00, 0x22, 0x1f, 0x83, 0x10, 0x0a, 0xf0,
+ 0x11, 0x08, 0x34, 0x02, 0xc1, 0x40, 0x9a, 0x20, 0x01, 0x03, 0x42, 0x70, 0x22, 0x18, 0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 0x02, 0x40, 0x00, 0x22, 0x4e, 0x20, 0x29, 0x5b, 0x27, 0x5b,
+ 0xed, 0x71, 0x22, 0x1e, 0x02, 0x10, 0xde, 0xf1, 0xf5, 0x70, 0xad, 0x70, 0xed, 0x70, 0xdb, 0xf5,
+ 0x0c, 0x71, 0xd0, 0xc6, 0xe2, 0xc2, 0x08, 0x45, 0x01, 0x88, 0xc1, 0xb8, 0x17, 0x08, 0xb0, 0x00,
+ 0x80, 0x8d, 0x14, 0x71, 0x0c, 0x70, 0x09, 0xf7, 0x81, 0x40, 0x60, 0x41, 0x80, 0x42, 0x2c, 0x5b,
+ 0x03, 0xf0, 0x81, 0x40, 0x25, 0x5b, 0x00, 0xa5, 0xc2, 0xc6, 0x00, 0x00, 0x49, 0x4e, 0x49, 0x03,
+ 0xfc, 0x99, 0x60, 0x00, 0xc4, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x74, 0x22, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xc8, 0x98, 0x7f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x21, 0x80,
+ 0x00, 0x7c, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x84, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x8c, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x98, 0x7f, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0x01, 0x2c, 0x21, 0x80, 0x00, 0x34, 0x21, 0x80, 0x00, 0x6c, 0x22, 0x80, 0x00, 0xa4, 0x22, 0x80,
+ 0x00, 0xac, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xec, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x64, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x94, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x98, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x9c, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x80, 0x00, 0x07, 0x01, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x0e, 0x01, 0x2d, 0x01, 0xd4, 0x7b, 0x3b, 0x01, 0xdb, 0x7a, 0x04, 0x00,
+ 0x3f, 0x7b, 0xcd, 0x6c, 0x00, 0x00, 0xc3, 0x04, 0x85, 0x09, 0xc3, 0x04, 0xec, 0xe6, 0x0c, 0x46,
+ 0x00, 0x00, 0x27, 0x00, 0x19, 0x00, 0x00, 0x80, 0x96, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x0c, 0x00,
+ 0xf0, 0x3c, 0x00, 0x01, 0x01, 0x00, 0x03, 0x02, 0x0c, 0xfe, 0xff, 0x0e, 0x02, 0x04, 0x0e, 0x43,
+ 0x0f, 0x0f, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,
+ 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x2b, 0x82, 0x0f, 0x10, 0x0d, 0x10,
+ 0x04, 0x09, 0x0f, 0x0a, 0x02, 0x0b, 0x24, 0x98, 0x7f, 0x14, 0x12, 0x0c, 0xd5, 0x60, 0x00, 0x06,
+ 0x02, 0x10, 0xf8, 0xff, 0xd0, 0xd4, 0x60, 0x02, 0x06, 0x0f, 0x03, 0x0f, 0x10, 0x0f, 0x10, 0x0f,
+ 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f,
+ 0x10, 0x07, 0x01, 0x0f, 0x10, 0x0f, 0x10, 0x05, 0x10, 0x80, 0xa5, 0x60, 0x00, 0x68, 0x02, 0x04,
+ 0x58, 0x5e, 0x61, 0x00, 0xa4, 0x37, 0x61, 0x00, 0x04, 0x00, 0xdc, 0xa2, 0x60, 0x00, 0xc4, 0xa3,
+ 0x60, 0x00, 0x40, 0x02, 0x04, 0xec, 0xaa, 0x60, 0x00, 0x90, 0x50, 0xb0, 0xa0, 0x60, 0x00, 0xa0,
+ 0x02, 0x20, 0xf4, 0x02, 0x0c, 0x30, 0x1c, 0x61, 0x00, 0x3c, 0x02, 0x0c, 0x03, 0x3a, 0x05, 0x02,
+ 0x05, 0x90, 0x52, 0x34, 0xd1, 0x60, 0x00, 0x03, 0x08, 0x08, 0xd3, 0x05, 0x08, 0x80, 0x06, 0x10,
+ 0x9c, 0xd2, 0x05, 0x10, 0xac, 0x06, 0x10, 0x5c, 0x49, 0x04, 0x06, 0x08, 0xc4, 0xd0, 0x05, 0x18,
+ 0x24, 0xaa, 0x16, 0x70, 0x93, 0x7f, 0x00, 0x13, 0x80, 0xfc, 0x92, 0x7f, 0x00, 0xf8, 0x00, 0x00,
+ 0x98, 0x7f, 0x00, 0x9c, 0x9a, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+#endif /*~ BHY_FW_7FE91DBFCC120FA4_H */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy.h
new file mode 100644
index 0000000..699214e
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy.h
@@ -0,0 +1,3075 @@
+/** \mainpage
+*
+****************************************************************************
+* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+*
+* File : bhy.h
+*
+* Date : 2016/01/22
+*
+* Revision : 1.0.4 $
+*
+* Usage: Sensor Driver file for BHY sensor
+*
+****************************************************************************
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* Neither the name of the copyright holder nor the names of the
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+* OR CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+*
+* The information provided is believed to be accurate and reliable.
+* The copyright holder assumes no responsibility
+* for the consequences of use
+* of such information nor for any infringement of patents or
+* other rights of third parties which may result from its use.
+* No license is granted by implication or otherwise under any patent or
+* patent rights of the copyright holder.
+*
+**************************************************************************/
+/*! \file bhy.h
+ \brief BHY Sensor Driver Support Header File */
+
+#ifndef __BHY_H__
+#define __BHY_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+/****************************************************************/
+/**\name DATA TYPES INCLUDES */
+/************************************************************/
+/*!
+* @brief The following definition uses for define the data types
+*
+* @note While porting the API please consider the following
+* @note Please check the version of C standard
+* @note Are you using Linux platform
+*/
+
+/*!
+* @brief For the Linux platform support
+* Please use the types.h for your data types definitions
+*/
+#ifdef __KERNEL__
+
+#include
+/* singed integer type*/
+typedef int8_t s8;/**< used for signed 8bit */
+typedef int16_t s16;/**< used for signed 16bit */
+typedef int32_t s32;/**< used for signed 32bit */
+typedef int64_t s64;/**< used for signed 64bit */
+
+typedef u_int8_t u8;/**< used for unsigned 8bit */
+typedef u_int16_t u16;/**< used for unsigned 16bit */
+typedef u_int32_t u32;/**< used for unsigned 32bit */
+typedef u_int64_t u64;/**< used for unsigned 64bit */
+
+
+
+#else /* ! __KERNEL__ */
+/**********************************************************
+* These definition uses for define the C
+* standard version data types
+***********************************************************/
+# if !defined(__STDC_VERSION__)
+
+/************************************************
+ * compiler is C11 C standard
+************************************************/
+#if (__STDC_VERSION__ == 201112L)
+
+/************************************************/
+#include
+/************************************************/
+
+/*unsigned integer types*/
+typedef uint8_t u8;/**< used for unsigned 8bit */
+typedef uint16_t u16;/**< used for unsigned 16bit */
+typedef uint32_t u32;/**< used for unsigned 32bit */
+typedef uint64_t u64;/**< used for unsigned 64bit */
+
+/*signed integer types*/
+typedef int8_t s8;/**< used for signed 8bit */
+typedef int16_t s16;/**< used for signed 16bit */
+typedef int32_t s32;/**< used for signed 32bit */
+typedef int64_t s64;/**< used for signed 64bit */
+/************************************************
+ * compiler is C99 C standard
+************************************************/
+
+#elif (__STDC_VERSION__ == 199901L)
+
+/* stdint.h is a C99 supported c library.
+which is used to fixed the integer size*/
+/************************************************/
+#include
+/************************************************/
+
+/*unsigned integer types*/
+typedef uint8_t u8;/**< used for unsigned 8bit */
+typedef uint16_t u16;/**< used for unsigned 16bit */
+typedef uint32_t u32;/**< used for unsigned 32bit */
+typedef uint64_t u64;/**< used for unsigned 64bit */
+
+/*signed integer types*/
+typedef int8_t s8;/**< used for signed 8bit */
+typedef int16_t s16;/**< used for signed 16bit */
+typedef int32_t s32;/**< used for signed 32bit */
+typedef int64_t s64;/**< used for signed 64bit */
+/************************************************
+ * compiler is C89 or other C standard
+************************************************/
+#elif __cplusplus
+
+/* stdint.h is a C++ supported c library.
+which is used to fixed the integer size*/
+/************************************************/
+#include
+/************************************************/
+
+/*unsigned integer types*/
+typedef uint8_t u8;/**< used for unsigned 8bit */
+typedef uint16_t u16;/**< used for unsigned 16bit */
+typedef uint32_t u32;/**< used for unsigned 32bit */
+typedef uint64_t u64;/**< used for unsigned 64bit */
+
+/*signed integer types*/
+typedef int8_t s8;/**< used for signed 8bit */
+typedef int16_t s16;/**< used for signed 16bit */
+typedef int32_t s32;/**< used for signed 32bit */
+typedef int64_t s64;/**< used for signed 64bit */
+/************************************************
+ * compiler is C++
+************************************************/
+#else /* !defined(__STDC_VERSION__) */
+/*!
+* @brief By default it is defined as 32 bit machine configuration
+* define your data types based on your
+* machine/compiler/controller configuration
+*/
+#define MACHINE_32_BIT
+/*! @brief
+ * If your machine support 16 bit
+ * define the MACHINE_16_BIT
+ */
+#ifdef MACHINE_16_BIT
+#include
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed long int s32;/**< used for signed 32bit */
+
+#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
+typedef long int s64;/**< used for signed 64bit */
+typedef unsigned long int u64;/**< used for unsigned 64bit */
+#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
+typedef long long int s64;/**< used for signed 64bit */
+typedef unsigned long long int u64;/**< used for unsigned 64bit */
+#else
+#warning Either the correct data type for signed 64 bit integer \
+could not be found, or 64 bit integers are not supported in your environment.
+#warning If 64 bit integers are supported on your platform, \
+please set s64 manually.
+#endif
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned long int u32;/**< used for unsigned 32bit */
+
+/* If your machine support 32 bit
+define the MACHINE_32_BIT*/
+#elif defined MACHINE_32_BIT
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed int s32;/**< used for signed 32bit */
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned int u32;/**< used for unsigned 32bit */
+
+/* If your machine support 64 bit
+define the MACHINE_64_BIT*/
+#elif defined MACHINE_64_BIT
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed int s32;/**< used for signed 32bit */
+typedef signed long int s64;/**< used for signed 64bit */
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned int u32;/**< used for unsigned 32bit */
+typedef unsigned long int u64;/**< used for unsigned 64bit */
+
+#else
+#warning The data types defined above which not supported \
+define the data types manually
+#endif
+#endif
+
+/*** This else will execute for the compilers
+ * which are not supported the C standards
+ * Like C89/C99/C11***/
+#else
+/*!
+* @brief By default it is defined as 32 bit machine configuration
+* define your data types based on your
+* machine/compiler/controller configuration
+*/
+#define MACHINE_32_BIT
+
+/* If your machine support 16 bit
+define the MACHINE_16_BIT*/
+#ifdef MACHINE_16_BIT
+#include
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed long int s32;/**< used for signed 32bit */
+
+#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
+typedef long int s64;/**< used for signed 64bit */
+typedef unsigned long int u64;/**< used for unsigned 64bit */
+#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
+typedef long long int s64;/**< used for signed 64bit */
+typedef unsigned long long int u64;/**< used for unsigned 64bit */
+#else
+#warning Either the correct data type for signed 64 bit integer \
+could not be found, or 64 bit integers are not supported in your environment.
+#warning If 64 bit integers are supported on your platform, \
+please set s64 manually.
+#endif
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned long int u32;/**< used for unsigned 32bit */
+
+/*! @brief If your machine support 32 bit
+define the MACHINE_32_BIT*/
+#elif defined MACHINE_32_BIT
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed int s32;/**< used for signed 32bit */
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned int u32;/**< used for unsigned 32bit */
+
+/* If your machine support 64 bit
+define the MACHINE_64_BIT*/
+#elif defined MACHINE_64_BIT
+/*signed integer types*/
+typedef signed char s8;/**< used for signed 8bit */
+typedef signed short int s16;/**< used for signed 16bit */
+typedef signed int s32;/**< used for signed 32bit */
+typedef signed long int s64;/**< used for signed 64bit */
+
+/*unsigned integer types*/
+typedef unsigned char u8;/**< used for unsigned 8bit */
+typedef unsigned short int u16;/**< used for unsigned 16bit */
+typedef unsigned int u32;/**< used for unsigned 32bit */
+typedef unsigned long int u64;/**< used for unsigned 64bit */
+
+#else
+#warning The data types defined above which not supported \
+define the data types manually
+#endif
+#endif
+#endif
+/***************************************************************/
+/**\name BUS READ AND WRITE FUNCTION POINTERS */
+/***************************************************************/
+/*!
+ @brief Define the calling convention of YOUR bus communication routine.
+ @note This includes types of parameters. This example shows the
+ configuration for an SPI bus link.
+
+ If your communication function looks like this:
+
+ write_my_bus_xy(u8 device_addr, u8 register_addr,
+ u8 * data, u8 length);
+
+ The BHY_WR_FUNC_PTR would equal:
+
+ BHY_WR_FUNC_PTR s8 (* bus_write)(u8,
+ u8, u8 *, u8)
+
+ Parameters can be mixed as needed refer to the
+ @ref BHY_BUS_WRITE_FUNC macro.
+
+
+*/
+#define BHY_WR_FUNC_PTR s8 (*bus_write)(u8, u8,\
+u8 *, u16)
+/**< link macro between API function calls and bus write function
+ @note The bus write function can change since this is a
+ system dependant issue.
+
+ If the bus_write parameter calling order is like: reg_addr,
+ reg_data, wr_len it would be as it is here.
+
+ If the parameters are differently ordered or your communication
+ function like I2C need to know the device address,
+ you can change this macro accordingly.
+
+
+ BHY_BUS_WRITE_FUNC(device_addr, reg_addr, reg_data, wr_len)\
+ bus_write(device_addr, reg_addr, reg_data, wr_len)
+
+ This macro lets all API functions call YOUR communication routine in a
+ way that equals your definition in the
+ @ref BHY_WR_FUNC_PTR definition.
+
+*/
+#define BHY_BUS_WRITE_FUNC(device_addr, reg_addr, reg_data, wr_len)\
+bus_write(device_addr, reg_addr, reg_data, wr_len)
+
+/**< Define the calling convention of YOUR bus communication routine.
+ @note This includes types of parameters. This example shows the
+ configuration for an SPI bus link.
+
+ If your communication function looks like this:
+
+ read_my_bus_xy(u8 device_addr, u8 register_addr,
+ u8 * data, u8 length);
+
+ The BHY_RD_FUNC_PTR would equal:
+
+ BHY_RD_FUNC_PTR s8 (* bus_read)(u8,
+ u8, u8 *, u8)
+
+ Parameters can be mixed as needed refer to the
+ refer BHY_BUS_READ_FUNC macro.
+
+*/
+#define BHY_SPI_READ_MASK 0x80 /* for spi read transactions on SPI the
+ MSB has to be set */
+#define BHY_RD_FUNC_PTR s8 (*bus_read)(u8, u8, u8 *, u16)
+
+#define BHY_BRD_FUNC_PTR s8 (*burst_read)(u8, u8, u8 *, u32)
+
+/**< link macro between API function calls and bus read function
+ @note The bus write function can change since this is a
+ system dependant issue.
+
+ If the bus_read parameter calling order is like: reg_addr,
+ reg_data, wr_len it would be as it is here.
+
+ If the parameters are differently ordered or your communication
+ function like I2C need to know the device address,
+ you can change this macro accordingly.
+
+
+ BHY_BUS_READ_FUNC(device_addr, reg_addr, reg_data, wr_len)\
+ bus_read(device_addr, reg_addr, reg_data, wr_len)
+
+ This macro lets all API functions call YOUR communication routine in a
+ way that equals your definition in the
+ refer BHY_WR_FUNC_PTR definition.
+
+ @note: this macro also includes the "MSB='1'
+ for reading BHY addresses.
+
+*/
+#define BHY_BUS_READ_FUNC(device_addr, reg_addr, reg_data, r_len)\
+ bus_read(device_addr, reg_addr, reg_data, r_len)
+
+#define BHY_BURST_READ_FUNC(device_addr, register_addr, register_data, rd_len)\
+ burst_read(device_addr, register_addr, register_data, rd_len)
+
+
+#define BHY_MDELAY_DATA_TYPE u32
+/***************************************************************/
+/**\name I2C ADDRESS DEFINITIONS */
+/***************************************************************/
+#define BHY_I2C_ADDR1 (0x28)
+#define BHY_I2C_ADDR2 (0x29)
+/***************************************************************/
+/**\name CONSTANTS */
+/***************************************************************/
+#define BHY_INIT_VALUE (0)
+#define BHY_GEN_READ_WRITE_LENGTH (1)
+#define BHY_BYTES_REMAINING_LENGTH (2)
+#define BHY_CRC_HOST_LENGTH (4)
+#define BHY_PARAMETER_ACK_LENGTH (250)
+#define BHY_READ_BUFFER_LENGTH (16)
+#define BHY_PARAMETER_ACK_DELAY (50)
+#define BHY_SIGNATURE_MEM_LEN (17)
+/***************************************************************/
+/**\name BIT SHIFTING DEFINITION */
+/***************************************************************/
+#define BHY_SHIFT_BIT_POSITION_BY_01_BIT (1)
+#define BHY_SHIFT_BIT_POSITION_BY_02_BITS (2)
+#define BHY_SHIFT_BIT_POSITION_BY_03_BITS (3)
+#define BHY_SHIFT_BIT_POSITION_BY_04_BITS (4)
+#define BHY_SHIFT_BIT_POSITION_BY_05_BITS (5)
+#define BHY_SHIFT_BIT_POSITION_BY_06_BITS (6)
+#define BHY_SHIFT_BIT_POSITION_BY_07_BITS (7)
+#define BHY_SHIFT_BIT_POSITION_BY_08_BITS (8)
+#define BHY_SHIFT_BIT_POSITION_BY_16_BITS (16)
+#define BHY_SHIFT_BIT_POSITION_BY_24_BITS (24)
+/****************************************************/
+/**\name ARRAY SIZE DEFINITIONS */
+/***************************************************/
+#define BHY_BYTES_REMAINING_SIZE (2)
+#define BHY_BYTES_REMAINING_LSB (0)
+#define BHY_BYTES_REMAINING_MSB (1)
+
+#define BHY_CRC_HOST_SIZE (4)
+#define BHY_CRC_HOST_LSB (0)
+#define BHY_CRC_HOST_XLSB (1)
+#define BHY_CRC_HOST_XXLSB (2)
+#define BHY_CRC_HOST_MSB (3)
+#define BHY_CRC_HOST_FILE_LSB (4)
+#define BHY_CRC_HOST_FILE_XLSB (5)
+#define BHY_CRC_HOST_FILE_XXLSB (6)
+#define BHY_CRC_HOST_FILE_MSB (7)
+
+#define BHY_INDEX_LEN (19)
+
+#define BHY_WRITE_BUFFER_SIZE (8)
+#define BHY_WRITE_BUFFER_1_REG (0)
+#define BHY_WRITE_BUFFER_2_REG (1)
+#define BHY_WRITE_BUFFER_3_REG (2)
+#define BHY_WRITE_BUFFER_4_REG (3)
+#define BHY_WRITE_BUFFER_5_REG (4)
+#define BHY_WRITE_BUFFER_6_REG (5)
+#define BHY_WRITE_BUFFER_7_REG (6)
+#define BHY_WRITE_BUFFER_8_REG (7)
+
+#define BHY_READ_BUFFER_SIZE (16)
+#define BHY_READ_BUFFER_1_REG (0)
+#define BHY_READ_BUFFER_2_REG (1)
+#define BHY_READ_BUFFER_3_REG (2)
+#define BHY_READ_BUFFER_4_REG (3)
+#define BHY_READ_BUFFER_5_REG (4)
+#define BHY_READ_BUFFER_6_REG (5)
+#define BHY_READ_BUFFER_7_REG (6)
+#define BHY_READ_BUFFER_8_REG (7)
+#define BHY_READ_BUFFER_9_REG (8)
+#define BHY_READ_BUFFER_10_REG (9)
+#define BHY_READ_BUFFER_11_REG (10)
+#define BHY_READ_BUFFER_12_REG (11)
+#define BHY_READ_BUFFER_13_REG (12)
+#define BHY_READ_BUFFER_14_REG (13)
+#define BHY_READ_BUFFER_15_REG (14)
+#define BHY_READ_BUFFER_16_REG (15)
+
+#define BHY_FIFO_SENSOR_DATA_SIZE (100)
+/****************************************************/
+/**\name ERROR CODES */
+/***************************************************/
+
+#define BHY_NULL_PTR ((void *) 0)
+#define BHY_NULL ((u8)0)
+#define BHY_COMM_RES ((s8)-1)
+#define BHY_OUT_OF_RANGE ((s8)-2)
+#define BHY_SUCCESS ((u8)0)
+#define BHY_ERROR ((s8)-3)
+#define BHY_RAMPATCH_NOT_MATCH ((s8)-4)
+#define BHY_RAMPATCH_NOT_SUPPORT ((s8)-5)
+#define BHY_CRC_ERROR ((s8)-6)
+#define BHY_PRODUCT_ID_ERROR ((s8)-7)
+
+/* Constants */
+#define BHY_DELAY_SETTLING_TIME (5)
+#define BHY_FIFO_BUFFER_SIZE (50)
+/*This refers BHY return type as s8 */
+#define BHY_RETURN_FUNCTION_TYPE s8
+/****************************************************/
+/**\name REGISTER DEFINITIONS */
+/***************************************************/
+/****************************************************/
+/**\name I2C REGISTER MAP DEFINITIONS */
+/***************************************************/
+/* i2c buffer read for sensor fifo data*/
+#define BHY_I2C_REG_BUFFER_ZERO_ADDR (0x00)
+#define BHY_I2C_REG_BUFFER_END_ADDR (0x31)
+#define BHY_I2C_REG_BUFFER_LENGTH ((BHY_I2C_REG_BUFFER_END_ADDR) - (BHY_I2C_REG_BUFFER_ZERO_ADDR) + 1)
+/* fifo flush, chip control and status registers*/
+#define BHY_I2C_REG_FIFO_FLUSH_ADDR (0x32)
+#define BHY_I2C_REG_CHIP_CONTROL_ADDR (0x34)
+#define BHY_I2C_REG_HOST_STATUS_ADDR (0x35)
+#define BHY_I2C_REG_INT_STATUS_ADDR (0x36)
+#define BHY_I2C_REG_CHIP_STATUS_ADDR (0x37)
+/* bytes remaining register*/
+#define BHY_I2C_REG_BYTES_REMAINING_LSB_ADDR (0x38)
+#define BHY_I2C_REG_BYTES_REMAINING_MSB_ADDR (0x39)
+#define BHY_I2C_REG_PARAMETER_ACKNOWLEDGE_ADDR (0x3A)
+/* saved parameter */
+#define BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO (0x3B)
+
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR (0x54)
+/**< parameter page selection address*/
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR (0x55)
+/**< host interface control address*/
+/*!
+ * @brief parameter write buffer*/
+#define BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO (0x5C)
+#define BHY_I2C_REG_PARAMETER_REQUEST_ADDR (0x64)
+/**< used to select the respective parameter number*/
+
+/* product and revision id */
+#define BHY_BHY_HOST_IRQ_TIMESTAMP_ADDR (0x6C)
+/**< host IRQ time stamp address*/
+#define BHY_ROM_VERSION_ADDR (0x70)
+/**< ROM version address*/
+#define BHY_RAM_VERSION_ADDR (0x72)
+/**< RAM version address*/
+#define BHY_I2C_REG_PRODUCT_ID_ADDR (0x90)
+/**< product id address*/
+#define BHY_I2C_REG_REVISION_ID_ADDR (0x91)
+/**< revision id address*/
+#define BHY_I2C_REG_UPLOAD_0_ADDR (0x94)
+#define BHY_I2C_REG_UPLOAD_1_ADDR (0x95)
+/**< upload address for RAM patch*/
+#define BHY_I2C_REG_UPLOAD_DATA_ADDR (0x96)
+/**< upload data address for RAM patch*/
+#define BHY_I2C_REG_CRC_HOST_ADDR (0x97)
+/**< CRC register*/
+#define BHY_I2C_REG_RESET_REQUEST_ADDR (0x9B)
+/**< reset register*/
+/****************************************************/
+/**\name ARRAY DEFINITIONS FOR IRQ TIME STAMP*/
+/**************************************************************/
+#define BHY_HOST_IRQ_TIMESTAMP_SIZE (4)
+#define BHY_HOST_IRQ_TIMESTAMP_LSB_DATA (0)
+#define BHY_HOST_IRQ_TIMESTAMP_XLSB_DATA (1)
+#define BHY_HOST_IRQ_TIMESTAMP_XXLSB_DATA (2)
+#define BHY_HOST_IRQ_TIMESTAMP_MSB_DATA (3)
+/****************************************************/
+/**\name ARRAY DEFINITIONS FOR ROM VERSION*/
+/**************************************************************/
+#define BHY_ROM_VERSION_SIZE (2)
+#define BHY_ROM_VERSION_LSB_DATA (0)
+#define BHY_ROM_VERSION_MSB_DATA (1)
+
+#define BHY_RAM_VERSION_SIZE (2)
+#define BHY_RAM_VERSION_LSB_DATA (0)
+#define BHY_RAM_VERSION_MSB_DATA (1)
+#define BHY_FIFO_DATA_BUFFER (200)
+
+#define BHY_ROM_VERSION_DI01 (u16)(0x2112)
+//#define BHY_ROM_VERSION_DI02 (u16)(0x2112) //DI02 is not supported
+#define BHY_ROM_VERSION_DI03 (u16)(0x2DAD)
+/**************************************************************/
+/**\name STRUCTURE DEFINITIONS */
+/**************************************************************/
+/*!
+* @brief BHY structure
+* This structure holds all relevant information about BHY
+*/
+struct bhy_t {
+u8 product_id;/**< product id of BHY */
+u8 device_addr;/**< device address of BHY */
+BHY_WR_FUNC_PTR;/**< bus write function pointer
+used to map the user bus write functions*/
+BHY_RD_FUNC_PTR;/**< bus read function pointer
+used to map the user bus read functions*/
+BHY_BRD_FUNC_PTR;/**< burst read function pointer
+used to map the user burst read functions*/
+void (*delay_msec)(BHY_MDELAY_DATA_TYPE);/**< delay function pointer */
+};
+/*!
+* @brief BHY parameter read buffer
+* structure holds all relevant information about
+* the respective parameter bytes data
+*/
+struct parameter_read_buffer_t {
+u8 parameter_1;/**>11)&0x03)
+#define BHY_ROM_VER_ANY (0x00)
+#define BHY_ROM_VER_DI01 (0x01)
+#define BHY_ROM_VER_DI02 (0x02)
+#define BHY_ROM_VER_DI03 (0x03)
+/**************************************************************/
+/**\name META EVENT DEFINITION */
+/**************************************************************/
+#define BHY_META_EVENT_1 (1)
+#define BHY_META_EVENT_2 (2)
+#define BHY_META_EVENT_3 (3)
+#define BHY_META_EVENT_4 (4)
+#define BHY_META_EVENT_5 (5)
+#define BHY_META_EVENT_6 (6)
+#define BHY_META_EVENT_7 (7)
+#define BHY_META_EVENT_8 (8)
+#define BHY_META_EVENT_9 (9)
+#define BHY_META_EVENT_10 (10)
+#define BHY_META_EVENT_11 (11)
+#define BHY_META_EVENT_12 (12)
+#define BHY_META_EVENT_13 (13)
+#define BHY_META_EVENT_14 (14)
+#define BHY_META_EVENT_15 (15)
+#define BHY_META_EVENT_16 (16)
+#define BHY_META_EVENT_17 (17)
+#define BHY_META_EVENT_18 (18)
+#define BHY_META_EVENT_19 (19)
+#define BHY_META_EVENT_20 (20)
+#define BHY_META_EVENT_21 (21)
+#define BHY_META_EVENT_22 (22)
+#define BHY_META_EVENT_23 (23)
+#define BHY_META_EVENT_24 (24)
+#define BHY_META_EVENT_25 (25)
+#define BHY_META_EVENT_26 (26)
+#define BHY_META_EVENT_27 (27)
+#define BHY_META_EVENT_28 (28)
+#define BHY_META_EVENT_29 (29)
+#define BHY_META_EVENT_30 (30)
+#define BHY_META_EVENT_31 (31)
+#define BHY_META_EVENT_32 (32)
+/**************************************************************/
+/**\name SENSOR ID DEFINITION FOR NON WAKEUP*/
+/**************************************************************/
+#define BHY_NON_WAKEUP_ROTATION_VECTOR (11)
+#define BHY_NON_WAKEUP_GAME_ROTATION_VECTOR (15)
+#define BHY_NON_WAKEUP_GEOMAG_ROTATION_VECTOR (20)
+#define BHY_NON_WAKEUP_ACCELR (1)
+#define BHY_NON_WAKEUP_MAG (2)
+#define BHY_NON_WAKEUP_ORIENTATION (3)
+#define BHY_NON_WAKEUP_GYRO (4)
+#define BHY_NON_WAKEUP_GRAVITY (9)
+#define BHY_NON_WAKEUP_LINEAR_ACCEL (10)
+#define BHY_NON_WAKEUP_LIGHT (5)
+#define BHY_NON_WAKEUP_PROXIMITY (8)
+#define BHY_NON_WAKEUP_HUMIDITY (12)
+#define BHY_NON_WAKEUP_STEP_COUNTER (19)
+#define BHY_NON_WAKEUP_TEMPERATURE (7)
+#define BHY_NON_WAKEUP_AMBIENT_TEMPERATURE (13)
+#define BHY_NON_WAKEUP_BAROMETER (6)
+#define BHY_NON_WAKEUP_SIGNIFICANT_MOTION (17)
+#define BHY_NON_WAKEUP_STEP_DETECTOR (18)
+#define BHY_NON_WAKEUP_TILT_DETECTOR (22)
+#define BHY_NON_WAKEUP_WAKE_GESTURE (23)
+#define BHY_NON_WAKEUP_GLANCE_GESTURE (24)
+#define BHY_NON_WAKEUP_PICKUP_GESTURE (25)
+#define BHY_NON_WAKEUP_UNCALIB_MAG (14)
+#define BHY_NON_WAKEUP_UNCALIB_GYRO (16)
+#define BHY_NON_WAKEUP_HEART_RATE (21)
+#define BHY_NON_WAKEUP_ACTIVITY (31)
+#define BHY_NON_WAKEUP_BSX_C (249)
+#define BHY_NON_WAKEUP_BSX_B (250)
+#define BHY_NON_WAKEUP_BSX_A (251)
+#define BHY_NON_WAKEUP_TIMESTAMP_LSW (252)
+#define BHY_NON_WAKEUP_TIMESTAMP_MSW (253)
+#define BHY_NON_WAKEUP_META_EVENTS (254)
+
+/**************************************************************/
+/**\name SENSOR ID DEFINITION FOR WAKEUP*/
+/**************************************************************/
+#define BHY_WAKEUP_ROTATION_VECTOR (43)
+#define BHY_WAKEUP_GAME_ROTATION_VECTOR (47)
+#define WAKEUP_GEOMAG_ROTATION_VECTOR (52)
+#define BHY_WAKEUP_ACCEL (33)
+#define BHY_WAKEUP_MAG (34)
+#define BHY_WAKEUP_ORIENTATION (35)
+#define BHY_WAKEUP_GYRO (36)
+#define BHY_WAKEUP_GRAVITY (41)
+#define BHY_WAKEUP_LINEAR_ACCEL (42)
+#define BHY_WAKEUP_LIGHT (37)
+#define BHY_WAKEUP_PROXIMITY (40)
+#define BHY_WAKEUP_HUMIDITY (44)
+#define BHY_WAKEUP_STEP_COUNTER (51)
+#define BHY_WAKEUP_TEMPERATURE (39)
+#define BHY_WAKEUP_AMBIENT_TEMPERATURE (45)
+#define BHY_WAKEUP_BAROMETER (38)
+#define BHY_WAKEUP_SIGNIFICANT_MOTION (49)
+#define BHY_WAKEUP_STEP_DETECTOR (50)
+#define BHY_WAKEUP_TILT_DETECTOR (54)
+#define BHY_WAKEUP_WAKE_GESTURE (55)
+#define BHY_WAKEUP_GLANCE_GESTURE (56)
+#define BHY_WAKEUP_PICKUP_GESTURE (57)
+#define BHY_WAKEUP_UNCALIB_MAG (46)
+#define BHY_WAKEUP_UNCALIB_GYRO (48)
+#define BHY_WAKEUP_HEART_RATE (53)
+#define BHY_WAKEUP_ACTIVITY (63)
+#define BHY_WAKEUP_TIMESTAMP_LSW (246)
+#define BHY_WAKEUP_TIMESTAMP_MSW (247)
+#define BHY_WAKEUP_META_EVENTS (248)
+/**************************************************************/
+/**\name USER DATA REGISTERS DEFINITION START */
+/**************************************************************/
+
+/**************************************************************/
+/**\name FIFO FLUSH LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_FIFO_FLUSH__POS (0)
+#define BHY_I2C_REG_FIFO_FLUSH__MSK (0xFF)
+#define BHY_I2C_REG_FIFO_FLUSH__LEN (8)
+#define BHY_I2C_REG_FIFO_FLUSH__REG (BHY_I2C_REG_FIFO_FLUSH_ADDR)
+/**************************************************************/
+/**\name CHIP CONTROL LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_CHIP_CONTROL__POS (0)
+#define BHY_I2C_REG_CHIP_CONTROL__MSK (0xFF)
+#define BHY_I2C_REG_CHIP_CONTROL__LEN (8)
+#define BHY_I2C_REG_CHIP_CONTROL__REG \
+(BHY_I2C_REG_CHIP_CONTROL_ADDR)
+/**************************************************************/
+/**\name HOST STATUS LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_HOST_STATUS__POS (0)
+#define BHY_I2C_REG_HOST_STATUS__MSK (0xFF)
+#define BHY_I2C_REG_HOST_STATUS__LEN (8)
+#define BHY_I2C_REG_HOST_STATUS__REG (BHY_I2C_REG_HOST_STATUS_ADDR)
+
+#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__POS (1)
+#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__MSK (0x02)
+#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__LEN (1)
+#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__REG \
+(BHY_I2C_REG_HOST_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__POS (2)
+#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__MSK (0x1C)
+#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__LEN (3)
+#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__REG \
+(BHY_I2C_REG_HOST_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__POS (5)
+#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__MSK (0xE0)
+#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__LEN (3)
+#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__REG \
+(BHY_I2C_REG_HOST_STATUS_ADDR)
+/**************************************************************/
+/**\name INTERRUPT STATUS LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_INT_STATUS__POS (0)
+#define BHY_I2C_REG_INT_STATUS__MSK (0xFF)
+#define BHY_I2C_REG_INT_STATUS__LEN (8)
+#define BHY_I2C_REG_INT_STATUS__REG (BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__POS (0)
+#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__MSK (0x01)
+#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__LEN (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__REG (BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__POS (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__MSK (0x02)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__LEN (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__POS (2)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__MSK (0x04)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__LEN (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__POS (3)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__MSK (0x08)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__LEN (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__POS (4)
+#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__MSK (0x10)
+#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__LEN (1)
+#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__POS (5)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__MSK (0x20)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__LEN (1)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__POS (6)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__MSK (0x40)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__LEN (1)
+#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__REG \
+(BHY_I2C_REG_INT_STATUS_ADDR)
+/**************************************************************/
+/**\name CHIP STATUS LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_CHIP_STATUS__POS (0)
+#define BHY_I2C_REG_CHIP_STATUS__MSK (0xFF)
+#define BHY_I2C_REG_CHIP_STATUS__LEN (8)
+#define BHY_I2C_REG_CHIP_STATUS__REG (BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__POS (0)
+#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__MSK (0x01)
+#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__LEN (1)
+#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__REG \
+(BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__POS (1)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__MSK (0x02)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__LEN (1)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__REG \
+(BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__POS (2)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__MSK (0x04)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__LEN (1)
+#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__REG \
+(BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__POS (3)
+#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__MSK (0x08)
+#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__LEN (1)
+#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__REG \
+(BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__POS (4)
+#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__MSK (0x10)
+#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__LEN (1)
+#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__REG (BHY_I2C_REG_CHIP_STATUS_ADDR)
+
+/**************************************************************/
+/**\name PAGE SELECT LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__POS (0)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__MSK (0xFF)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__LEN (8)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG \
+(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)
+
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__POS (0)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__MSK (0x0F)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__LEN (4)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__REG \
+(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)
+
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__POS (4)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__MSK (0xF0)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__LEN (4)
+#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__REG \
+(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)
+/**************************************************************/
+/**\name HOST INTERFACE SELECTION LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__POS (0)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__MSK (0xFF)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__LEN (8)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__POS (0)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__MSK (0x01)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__POS (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__MSK (0x02)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__POS (2)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__MSK (0x04)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__POS (3)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__MSK (0x08)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__POS (4)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__MSK (0x10)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__POS (5)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__MSK (0x20)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__POS (6)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__MSK (0x40)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__LEN (1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__POS \
+(7)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__MSK \
+(0x80)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__LEN \
+(1)
+#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG \
+(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)
+/**************************************************************/
+/**\name LOAD PARAMETER REQUEST SELECTION LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__POS (0)
+#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__MSK (0xFF)
+#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__LEN (8)
+#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__REG \
+(BHY_I2C_REG_PARAMETER_REQUEST_ADDR)
+
+/**************************************************************/
+/**\name RESET REQUEST SELECTION LENGTH, POSITION AND MASK */
+/**************************************************************/
+#define BHY_I2C_REG_RESET_REQUEST__POS (0)
+#define BHY_I2C_REG_RESET_REQUEST__MSK (0xFF)
+#define BHY_I2C_REG_RESET_REQUEST__LEN (8)
+#define BHY_I2C_REG_RESET_REQUEST__REG \
+(BHY_I2C_REG_RESET_REQUEST_ADDR)
+
+/**************************************************/
+/**\name BIT SLICE GET AND SET FUNCTIONS */
+/*************************************************/
+#define BHY_GET_BITSLICE(regvar, bitname)\
+ ((regvar & bitname##__MSK) >> bitname##__POS)
+
+
+#define BHY_SET_BITSLICE(regvar, bitname, val)\
+ ((regvar & ~bitname##__MSK) | \
+ ((val< Success
+ * @retval -1 -> Error
+ *
+ * @note
+ * While changing the parameter of the bhy_t
+ * consider the following point:
+ * Changing the reference value of the parameter
+ * will changes the local copy or local reference
+ * make sure your changes will not
+ * affect the reference value of the parameter
+ * (Better case don't change the reference value of the parameter)
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_init(struct bhy_t *bhy);
+/*!
+ * @brief
+ * This API write the data to
+ * the given register
+ *
+ *
+ * @param v_addr_u8 -> Address of the register
+ * @param v_data_u8 -> The data from the register
+ * @param v_len_u8 -> no of bytes to read
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_write_reg(u8 v_addr_u8,
+u8 *v_data_u8, u16 v_len_u16);
+/*!
+ * @brief
+ * This API reads the data from
+ * the given register
+ *
+ *
+ * @param v_addr_u8 -> Address of the register
+ * @param v_data_u8 -> The data from the register
+ * @param v_len_u8 -> no of bytes to read
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_read_reg(u8 v_addr_u8,
+u8 *v_data_u8, u16 v_len_u16);
+/*!
+ * @brief API used to get the FIFO flush from the register 0x32
+ * bit 0 to 7
+ *
+ *
+ * @param v_fifo_flush_u8 : The value of fifo flush
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_flush(u8 *v_fifo_flush_u8);
+/*!
+ * @brief API used to set the FIFO flush from the register 0x32
+ * bit 0 to 7
+ *
+ *
+ * @param v_fifo_flush_u8 : The value of fifo flush
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_fifo_flush(u8 v_fifo_flush_u8);
+/*!
+ * @brief API used to get the chip control from the register 0x34
+ * bit 0 to 7
+ * @note Chip control used to provide the control fundamental
+ * behaviour of the chip
+ *
+ * @param v_chipcontrol_u8 : The value of chip control
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_chip_control(u8 *v_chipcontrol_u8);
+/*!
+ * @brief API used to set the chip control from the register 0x34
+ * bit 0 to 7
+ * @note Chip control used to provide the control fundamental
+ * behaviour of the chip
+ *
+ * @param v_chipcontrol_u8 : The value of chip control
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_chip_control(u8 v_chipcontrol_u8);
+/*!
+ * @brief API used to get the host status from the register 0x35
+ * bit 0 to 7
+ *
+ *
+ * @param v_algo_standby_u8 : The value of algorithm standby duration
+ * @param v_algo_id_u8 : The value of algorithm id
+ * @param v_host_interface_id_u8 : The value of host interface id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_status(
+u8 *v_algo_standby_u8, u8 *v_algo_id_u8,
+u8 *v_host_interface_id_u8);
+/*!
+ * @brief API used to get the interrupt status from the register 0x36
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_int_u8 :
+ * The value of host interrupt status
+ * @param v_wakeup_water_mark_u8 :
+ * The value of wakeup watermark status
+ * @param v_wakeup_latency_u8 :
+ * The value of wakeup latency status
+ * @param v_wakeup_immediate_u8 :
+ * The value of wakeup immediate status
+ * @param v_non_wakeup_water_mark_u8 :
+ * The value of non wakeup watermark status
+ * @param v_non_wakeup_latency_u8 :
+ * The value of non wakeup latency status
+ * @param v_non_wakeup_immediate_u8 :
+ * The value of non wakeup immediate
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_interrupt_status(
+u8 *v_host_int_u8,
+u8 *v_wakeup_water_mark_u8, u8 *v_wakeup_latency_u8,
+u8 *v_wakeup_immediate_u8, u8 *v_non_wakeup_water_mark_u8,
+u8 *v_non_wakeup_latency_u8, u8 *v_non_wakeup_immediate_u8);
+/*!
+ * @brief API used to get the chip status from the register 0x37
+ * bit 0 to 7
+ *
+ *
+ *
+ * @param v_eeprom_detected_u8 : The value of eeprom
+ * detected status
+ * @param v_ee_upload_done_u8 : The value of ee_upload
+ * done status
+ * @param v_ee_upload_error_u8 : The value of ee_upload
+ * done error
+ * @param v_firmware_idle_u8 : The value of firmware error status
+ * @param v_no_eeprom_u8 : The value of no eeprom status
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_chip_status(
+u8 *v_eeprom_detected_u8,
+u8 *v_ee_upload_done_u8, u8 *v_ee_upload_error_u8,
+u8 *v_firmware_idle_u8, u8 *v_no_eeprom_u8);
+/*!
+ * @brief API used to get the bytes remaining from the register 0x38
+ * and 0x39 bit 0 to 7
+ *
+ *
+ * @param v_bytes_remaining_u16 : The value of bytes remaining
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @note This indicates how many bytes are available in the FIFO buffer
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_read_bytes_remaining(
+u16 *v_bytes_remaining_u16);
+/*!
+ * @brief API used to get the parameter
+ * acknowledgement from the register 0x3A
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_acknowledge_u8:
+ * The value of parameter acknowledgement
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @note
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_acknowledge(
+u8 *v_parameter_acknowledge_u8);
+/*!
+ * @brief API used to get the parameter
+ * page select from the register 0x54
+ * bit 0 to 7
+ *
+ *
+ * @param v_page_select_u8 : The value of parameter page selection
+ * page information | value
+ * ------------------------|----------
+ * BHY_PAGE_SELECT_PARAMETER_PAGE | 0
+ * BHY_PAGE_SELECT_PARAMETER_SIZE | 1
+ *
+ * @param v_parameter_page_u8 : The value of page selection
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_page_select(
+u8 v_page_select_u8, u8 *v_parameter_page_u8);
+/*!
+ * @brief API used to set the parameter
+ * page select from the register 0x54
+ * bit 0 to 7
+ *
+ *
+ * @param v_page_select_u8 : The value of parameter page selection
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_parameter_page_select(
+u8 v_page_select_u8);
+/*!
+ * @brief API used to get the host interface control
+ * from the register 0x55
+ * bit 0 to 7
+ *
+ *
+ *
+ * @param v_algo_standby_req_u8 : The value of algorithm standby
+ * request
+ * @param v_abort_transfer_u8 : The value of abort transfer
+ * @param v_update_transfer_cnt_u8 : The value of update
+ * transfer count
+ * @param v_wakeup_fifo_intr_disable_u8 :
+ * The value of wakeup fifo host
+ * interrupt disable
+ * @param v_ned_coordinates_u8 : The value of NED coordinates
+ * @param v_ap_suspend_u8 : The value of AP suspended
+ * @param v_sensor_selftest_u8 : The value of sensor self test
+ * @param v_non_wakeup_fifo_intr_disable_u8:
+ * The value of non wakeup fifo host
+ * interrupt disable
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_interface_control(
+u8 *v_algo_standby_req_u8,
+u8 *v_abort_transfer_u8, u8 *v_update_transfer_cnt_u8,
+u8 *v_wakeup_fifo_intr_disable_u8, u8 *v_ned_coordinates_u8,
+u8 *v_ap_suspend_u8, u8 *v_sensor_selftest_u8,
+u8 *v_non_wakeup_fifo_intr_disable_u8);
+/*!
+ * @brief API used to set the host interface control
+ * from the register 0x55
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_interface_select_u8 : The value of host interface selection
+ * host interface | value
+ * -----------------------------------|----------
+ * BHY_HOST_ALGO_STANDBY_REQUEST | 0
+ * BHY_HOST_ABORT_TRANSFER | 1
+ * BHY_HOST_UPDATE_TRANSFER_COUNT | 2
+ * BHY_HOST_WAKEUP_FIFO_DISABLE | 3
+ * BHY_HOST_NED_COORDINATE | 4
+ * BHY_HOST_AP_SUSPEND | 5
+ * BHY_HOST_SELFTEST | 6
+ * BHY_HOST_NON_WAKEUP_FIFO_DISABLE | 7
+ *
+ * @param v_host_interface_status_u8 : The value of host interface
+ * Data | status
+ * -----------------| -----------
+ * 0 | DISABLE
+ * 1 | ENABLE
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_host_interface_control(
+u8 v_host_interface_select_u8, u8 v_host_interface_status_u8);
+/*!
+ * @brief API used to get the parameter
+ * request from the register 0x64
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_request(
+u8 *v_parameter_request_u8);
+/*!
+ * @brief API used to get the parameter
+ * request from the register 0x64
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_parameter_request(
+u8 v_parameter_request_u8);
+/*!
+ * @brief API used to get the host IRQ time stamp
+ * request from the register 0x6C to 0x6F
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_irq_timestamp_u32 : The value of host irq time stamp
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_irq_timestamp(
+u32 *v_host_irq_timestamp_u32);
+/*!
+ * @brief API used to get the ROM version
+ * request from the register 0x70 to 0x71
+ * bit 0 to 7
+ *
+ *
+ * @param v_rom_version_u16 : The value ROM version
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_rom_version(
+u16 *v_rom_version_u16);
+/*!
+ * @brief API used to get the RAM version
+ * request from the register 0x72 to 0x73
+ * bit 0 to 7
+ *
+ *
+ * @param v_ram_version_u16 : The value RAM version
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_ram_version(
+u16 *v_ram_version_u16);
+/*!
+ * @brief API used to get the product id
+ * request from the register 0x90
+ * bit 0 to 7
+ *
+ *
+ * @param v_product_id_u8 : The value of product id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_product_id(u8 *v_product_id_u8);
+/*!
+ * @brief API used to get the revision id
+ * request from the register 0x91
+ * bit 0 to 7
+ *
+ *
+ * @param v_revision_id_u8 : The value of revision id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_revision_id(u8 *v_revision_id_u8);
+/*!
+ * @brief API used to get the CRC host
+ * request from the register 0x91
+ * bit 0 to 7
+ *
+ *
+ * @param v_crc_host_u32 : The value of CRC host
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_crc_host(u32 *v_crc_host_u32);
+/*!
+ * @brief API used to set the reset
+ * request from the register 0x9B
+ * bit 0 to 7
+ *
+ *
+ * @param v_reset_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_reset_request(u8 v_reset_request_u8);
+/*!
+ * @brief API used to get the meta event control from
+ * system page-1 parameter 1
+ *
+ * @param v_meta_event_u8 : The value of meta event selection
+ * meta event | value
+ * --------------------------|---------------
+ * BHY_META_EVENT_1 | 1
+ * BHY_META_EVENT_2 | 2
+ * BHY_META_EVENT_3 | 3
+ * BHY_META_EVENT_4 | 4
+ * BHY_META_EVENT_5 | 5
+ * BHY_META_EVENT_6 | 6
+ * BHY_META_EVENT_7 | 7
+ * BHY_META_EVENT_8 | 8
+ * BHY_META_EVENT_9 | 9
+ * BHY_META_EVENT_10 | 10
+ * BHY_META_EVENT_11 | 11
+ * BHY_META_EVENT_12 | 12
+ * BHY_META_EVENT_13 | 13
+ * BHY_META_EVENT_14 | 14
+ * BHY_META_EVENT_15 | 15
+ * BHY_META_EVENT_16 | 16
+ * BHY_META_EVENT_17 | 17
+ * BHY_META_EVENT_18 | 18
+ * BHY_META_EVENT_19 | 19
+ * BHY_META_EVENT_20 | 20
+ * BHY_META_EVENT_21 | 21
+ * BHY_META_EVENT_22 | 22
+ * BHY_META_EVENT_23 | 23
+ * BHY_META_EVENT_24 | 24
+ * BHY_META_EVENT_25 | 25
+ * BHY_META_EVENT_26 | 26
+ * BHY_META_EVENT_27 | 27
+ * BHY_META_EVENT_28 | 28
+ * BHY_META_EVENT_29 | 29
+ * BHY_META_EVENT_30 | 30
+ * BHY_META_EVENT_31 | 31
+ * BHY_META_EVENT_32 | 32
+ *
+ * @param meta_intr :
+ * The value of meta event interrupt selection
+ *
+ * @param meta_event :
+ * The value of meta event event selection
+ *
+ * @param v_event_type_u8 : The value of
+ * interrupt or event selection
+ * value | Event
+ * -------------------------|----------------
+ * BHY_META_EVENT_INTR_ENABLE | 0
+ * BHY_META_EVENT_ENABLE | 1
+ *
+ * @param v_meta_parameter_request_u8: The value of parameter request
+ * for wakeup or non wakeup fifo
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_meta_event(
+u8 v_meta_event_u8,
+u8 v_input_data_u8, u8 v_event_type_u8,
+u8 v_meta_parameter_request_u8);
+/*!
+ * @brief API used to get the meta event control from
+ * system page-1 parameter 1
+ *
+ * @param v_meta_event_u8 : The value of meta event selection
+ * meta event | value
+ * --------------------------|---------------
+ * BHY_META_EVENT_1 | 1
+ * BHY_META_EVENT_2 | 2
+ * BHY_META_EVENT_3 | 3
+ * BHY_META_EVENT_4 | 4
+ * BHY_META_EVENT_5 | 5
+ * BHY_META_EVENT_6 | 6
+ * BHY_META_EVENT_7 | 7
+ * BHY_META_EVENT_8 | 8
+ * BHY_META_EVENT_9 | 9
+ * BHY_META_EVENT_10 | 10
+ * BHY_META_EVENT_11 | 11
+ * BHY_META_EVENT_12 | 12
+ * BHY_META_EVENT_13 | 13
+ * BHY_META_EVENT_14 | 14
+ * BHY_META_EVENT_15 | 15
+ * BHY_META_EVENT_16 | 16
+ * BHY_META_EVENT_17 | 17
+ * BHY_META_EVENT_18 | 18
+ * BHY_META_EVENT_19 | 19
+ * BHY_META_EVENT_20 | 20
+ * BHY_META_EVENT_21 | 21
+ * BHY_META_EVENT_22 | 22
+ * BHY_META_EVENT_23 | 23
+ * BHY_META_EVENT_24 | 24
+ * BHY_META_EVENT_25 | 25
+ * BHY_META_EVENT_26 | 26
+ * BHY_META_EVENT_27 | 27
+ * BHY_META_EVENT_28 | 28
+ * BHY_META_EVENT_29 | 29
+ * BHY_META_EVENT_30 | 30
+ * BHY_META_EVENT_31 | 31
+ * BHY_META_EVENT_32 | 32
+ *
+ * @param meta_intr :
+ * The value of meta event interrupt selection
+ *
+ * @param meta_event :
+ * The value of meta event event selection
+ *
+ * @param v_event_type_u8 : The value of
+ * interrupt or event selection
+ * value | Event
+ * -------------------------|----------------
+ * BHY_META_EVENT_INTR_ENABLE | 0
+ * BHY_META_EVENT_ENABLE | 1
+ *
+ * @param v_meta_parameter_request_u8: The value of parameter request
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_meta_event(
+u8 v_meta_event_u8, u8 v_event_type_u8,
+u8* meta_event_intr,
+u8* meta_event_event,
+u8 v_meta_parameter_request_u8);
+/*!
+ * @brief API used to get the fifo water mark from
+ * system page-1 parameter 2
+ *
+ *
+ * @param v_parameter_u8 :
+ * The value of fifo water mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * FIFO_WM_WAKEUP | 0
+ * FIFO_WM_NON_WAKEUP | 1
+ *
+ * @param v_fifo_water_mark_u16: The value of fifo water mark
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_water_mark(
+u8 v_parameter_u8, u16 *v_fifo_water_mark_u16);
+/*!
+ * @brief API used to set the fifo water mark from
+ * system page-1 parameter 2
+ *
+ *
+ * @param v_parameter_u8 :
+ * The value of fifo water mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * FIFO_WM_WAKEUP | 0
+ * FIFO_WM_NON_WAKEUP | 1
+ *
+ * @param v_fifo_water_mark_u16: The value of fifo water mark
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_fifo_water_mark(u8 v_parameter_u8,
+u16 v_fifo_water_mark_u16);
+/*!
+ * @brief API used to get the fifo size from
+ * system page-1 parameter 2
+ * @note wakeup - bytes from 2 and 3
+ * @note non wakeup - bytes from 6 and 7
+ *
+ *
+ * @param v_fifo_size_select_u8 :
+ * The value of fifo size mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * BHY_FIFO_SIZE_WAKEUP | 0
+ * BHY_FIFO_SIZE_NON_WAKEUP | 1
+ *
+ * @param v_fifo_size_u16 : The value of fifo size
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_size(
+u8 v_fifo_size_select_u8, u16 *v_fifo_size_u16);
+
+/*!
+ * @brief API used to get the sensor status bank from
+ * system page-1 parameter 3 to 6
+ * @note Sensor status bank 0 : parameter 3 contains 1 to 16 sensor type
+ * @note Sensor status bank 1 : parameter 4 contains 17 to 32 sensor type
+ * @note Sensor status bank 2 : parameter 5 contains 33 to 48 sensor type
+ * @note Sensor status bank 3 : parameter 6 contains 49 to 64 sensor type
+ *
+ *
+ * @param v_sensor_type_u8 :
+ * The value of sensor status bank sensor type selection
+ * v_sensor_type_u8 | value
+ * -----------------------------------|---------------
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1 | 0
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2 | 1
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3 | 3
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4 | 4
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5 | 5
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6 | 6
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7 | 7
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8 | 8
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9 | 9
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10 | 10
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11 | 11
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12 | 12
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13 | 13
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14 | 14
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15 | 15
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16 | 16
+ *
+ *
+ * @param v_sensor_status_parameter_u8 :
+ * The value of sensor status bank parameter selection
+ * parameter | value
+ * -------------------------------|-----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_sensor_status_bank(
+u8 v_sensor_status_parameter_u8, u8 v_sensor_type_u8);
+/*!
+ * @brief API used to get the host IRQ time
+ * stamp and current time stamp from
+ * system page-1 parameter 30
+ * Host IRQ time stamp bytes 0 to 3
+ * Current time stamp bytes 4 to 7
+ *
+ *
+ * @param v_time_stamp_selection_u8 :
+ * The value of Host IRQ or current time stamp selection
+ * time stamp | value
+ * --------------------------|---------------
+ * BHY_HOST_IRQ_TIMESTAMP | 0
+ * BHY_CURRENT_TIME_STAMP | 1
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @param v_time_stamp_u32 :
+ * The value of Host IRQ or current time stamp
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_time_stamp(
+u8 v_time_stamp_selection_u8, u32 *v_time_stamp_u32);
+/*!
+ * @brief API used to get the physical sensor status
+ * system page-1 parameter 31
+ * @note Accel sample rate byte 0 and 1
+ * @note Accel dynamic range byte 2 and 3
+ * @note Accel flags byte 4
+ * @note Gyro sample rate byte 5 and 6
+ * @note Gyro dynamic range byte 7 and 8
+ * @note Gyro flags byte 9
+ * @note Mag sample rate byte 10 and 11
+ * @note Mag dynamic range byte 12 and 13
+ * @note Mag flags byte 14
+ *
+ * @param accel_status : contains the accel physical status
+ * @param gyro_status : contains the gyro physical status
+ * @param mag_status : contains the mag physical status
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_physical_sensor_status(
+struct accel_physical_status_t *accel_status,
+struct gyro_physical_status_t *gyro_status,
+struct mag_physical_status_t *mag_status);
+/*!
+ * @brief API used to get the non wakeup sensor information,
+ * Sensor page-3 parameter 1 to 31
+ *
+ * @param v_parameter_request_u8 :
+ * Value desired parameter to read non wakeup sensor information
+ * param_request | value
+ * -----------------------------------|------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_1 | 0x01
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_2 | 0x02
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_7 | 0x87
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_8 | 0x88
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_9 | 0x89
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_10 | 0x8A
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_11 | 0x8B
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_12 | 0x8C
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_13 | 0x8D
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_14 | 0x8E
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_15 | 0x8F
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_16 | 0x90
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_17 | 0x91
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_18 | 0x92
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_19 | 0x93
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_20 | 0x94
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_21 | 0x95
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_22 | 0x96
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_23 | 0x97
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_24 | 0x98
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_25 | 0x99
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_31 | 0x9F
+ *
+ * @param sensor_information :
+ * holds the value of non wakeup sensor information
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_information(
+u8 v_parameter_request_u8,
+struct sensor_information_non_wakeup_t *sensor_information);
+/*!
+ * @brief API used to get the wakeup sensor information,
+ * Sensor page-3 parameter 32 to 63
+ *
+ * @param v_parameter_request_u8 :
+ * Value desired parameter to read non wakeup sensor information
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_33 | 0xA1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_34 | 0xA2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_35 | 0xA3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_36 | 0xA4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_37 | 0xA5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_38 | 0xA6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_39 | 0xA7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_40 | 0xA8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_41 | 0xA9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_42 | 0xAA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_43 | 0xAB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_44 | 0xAC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_45 | 0xAD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_46 | 0xAE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_47 | 0xAF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_48 | 0xB0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_49 | 0xB1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_50 | 0xB2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_51 | 0xB3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_52 | 0xB4 | Geomagnetic rotation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_53 | 0xB5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_54 | 0xB6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_55 | 0xB7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_56 | 0xB8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_57 | 0xB9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_63 | 0xBF | Activity
+ *
+ * @param sensor_information :
+ * holds the value of non wakeup sensor information
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_information(
+u8 v_parameter_request_u8,
+struct sensor_information_wakeup_t *sensor_information);
+/*!
+ * @brief API used to set the sensor non wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param sensor_configuration : contains the non wakeup sensor configuration
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_non_wakeup_sensor_configuration(
+struct sensor_configuration_non_wakeup_t *sensor_configuration,
+u8 v_parameter_request_u8);
+/*!
+ * @brief API used to get the sensor non wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param v_sample_rate_u16 : contains the non wakeup sample rate data
+ * @param v_max_report_latency_u16:
+ * contains the non wakeup max report latency
+ * @param v_change_sensitivity_u16: contains the non wakeup sensitivity
+ * @param v_dynamic_range_u16: contains the non wakeup dynamic range
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_configuration(
+u8 v_parameter_request_u8, u16 *v_sample_rate_u16,
+u16 *v_max_report_latency_u16,
+u16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16);
+/*!
+ * @brief API used to set the sensor wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param sensor_configuration : contains the wakeup sensor configuration
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * -----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_wakeup_sensor_configuration(
+struct sensor_configuration_wakeup_t *sensor_configuration,
+u8 v_parameter_request_u8);
+/*!
+ * @brief API used to get the sensor wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param v_sample_rate_u16 : contains the wakeup sample rate data
+ * @param v_max_report_latency_u16: contains the wakeup max report latency
+ * @param v_change_sensitivity_u16: contains the wakeup sensitivity
+ * @param v_dynamic_range_u16: contains the wakeup dynamic range
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * -----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_configuration(
+u8 v_parameter_request_u8, u16 *v_sample_rate_u16,
+u16 *v_max_report_latency_u16,
+u16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16);
+/*!
+ * @brief API used to set the soft pass through
+ * Sensor page-15 parameter 0 to 7
+ *
+ * @param soft_pass_through :
+ * contains the value of soft pass through
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * parameter | value
+ * ------------------------------------|--------------------
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_soft_pass_through(
+struct soft_pass_through_write_t *soft_pass_through,
+u8 v_parameter_request_u8);
+/*!
+ * @brief API used to get the soft pass through
+ * Sensor page-15 parameter 0 to 7
+ *
+ * @param soft_pass_through :
+ * contains the value of soft pass through
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * parameter | value
+ * ------------------------------------|--------------------
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_soft_pass_through(
+struct soft_pass_through_read_t *soft_pass_through,
+u8 v_parameter_request_u8);
+/*!
+ * @brief API used to get the data from the parameter
+ * I2C page register from 0x3B to 0x4A
+ *
+ *
+ * @param v_page_select_u8 : This input value for set the desired page
+ * @param v_parameter_request_u8 :
+ * This input value for set the desired parameter
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_read_parameter_bytes(
+u8 v_page_select_u8, u8 v_parameter_request_u8);
+/*!
+ * @brief API used to set the data from the parameter
+ * I2C page register from 0x5C to 0x63
+ *
+ *
+ * @param v_page_select_u8 : This input value for set the desired page
+ * @param v_parameter_request_u8 :
+ * This input value for set the desired parameter
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_write_parameter_bytes(
+u8 v_page_select_u8, u8 v_parameter_request_u8);
+/*!
+ * @brief API used to flash the ram patch. There is two versions,
+ * one that accepts constant input data
+ *
+ *
+ * @param memory : The value of data from the
+ * ram patch.
+ * @param v_file_length_u32 : Length of the patch data
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_initialize(
+u8 *memory, u32 v_file_length_u32);
+BHY_RETURN_FUNCTION_TYPE bhy_initialize_from_rom(
+const u8 *memory, const u32 v_file_length_u32);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_support.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_support.h
new file mode 100644
index 0000000..ee659b5
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_support.h
@@ -0,0 +1,110 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ *
+ * @file bhy_support.h
+ *
+ * @date 12/19/2016
+ *
+ * @brief driver on MCU for bhy
+ *
+ *
+ */
+
+#ifndef BHY_SUPPORT_H_
+#define BHY_SUPPORT_H_
+#ifdef __cplusplus
+extern "C"{
+#endif
+/********************************************************************************/
+/* HEADER FILES */
+/********************************************************************************/
+#include "bhy.h"
+
+/********************************************************************************/
+/* MACROS */
+/********************************************************************************/
+#define RETRY_NUM 3
+
+/*! determines the I2C slave address of BHy
+* The default I2C address of the BHy device is 0101000b (0x28). */
+/* 0x28 CONFLICTS ON ATMEL DEV KITS WITH THE ONBOARD EDBG!!!! */
+#define BHY_I2C_SLAVE_ADDRESS BHY_I2C_ADDR1
+/*! the delay required to wait for BHY chip to reset */
+#define BHY_RESET_DELAY_MS UINT32_C(50)
+
+/*! these two macros are defined for i2c read/write limitation of host */
+/*! users must modify these two macros according to their own IIC hardware design */
+#define I2C_ONCE_WRITE_MAX_COUNT (8)
+#define I2C_ONCE_READ_MAX_COUNT (8)
+
+/********************************************************************************/
+/* FUNCTION DECLARATIONS */
+/********************************************************************************/
+/*!
+* @brief Initializes BHY smart sensor and its required connections
+*
+*/
+int8_t bhy_initialize_support(void);
+
+/*!
+* @brief Initiates a delay of the length of the argument in milliseconds
+*
+* @param[in] msec Delay length in terms of milliseconds
+*
+*/
+void bhy_delay_msec(uint32_t msec);
+
+/*!
+ * @brief provides a print function to the bhy driver on DD2.0 platform
+ */
+void bhy_printf (const u8 * string);
+
+/*!
+ * @brief provides the mcu reference code version
+ */
+uint8_t *bhy_get_version(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BHY_SUPPORT_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver.h
new file mode 100644
index 0000000..08df408
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver.h
@@ -0,0 +1,259 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ *
+ * @file bhy_uc_driver.h
+ *
+ * @date 12/19/2016
+ *
+ * @brief headfile of driver on MCU for bhy
+ *
+ *
+ */
+
+#ifndef BHY_UC_DRIVER_H_
+#define BHY_UC_DRIVER_H_
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+#include "bhy_support.h"
+#include "bhy_uc_driver_types.h"
+
+/****************************************************************************/
+/* Driver Functions */
+/****************************************************************************/
+
+
+/* initializes the driver, the API and loads the ram patch into the sensor */
+BHY_RETURN_FUNCTION_TYPE bhy_driver_init
+ (const uint8_t *bhy_fw_data);
+
+/* this function configures meta event */
+BHY_RETURN_FUNCTION_TYPE bhy_meta_event_set_config( bhy_meta_event_type_t meta_event_id,
+ bhy_meta_event_fifo_type_t fifo_sel,
+ uint8_t enable_state, uint8_t int_enable_state);
+
+/* this function gets configuration from specific meta event */
+BHY_RETURN_FUNCTION_TYPE bhy_meta_event_get_config( bhy_meta_event_type_t meta_event_id,
+ bhy_meta_event_fifo_type_t fifo_sel,
+ uint8_t* p_enable_state, uint8_t* p_int_enable_state);
+
+/*****************************************************************************
+ * Function : bhy_mapping_matrix_set
+ * Description : Set mapping matrix to a corresponding physical sensor.
+ * Input : index: physical sensor index.
+ * PHYSICAL_SENSOR_INDEX_ACC = 0,
+ * PHYSICAL_SENSOR_INDEX_MAG = 1,
+ * PHYSICAL_SENSOR_INDEX_GYRO = 2,
+ * p_mapping_matrix: pointer to a "int8_t mapping_matrix[9]".
+ * Output : None
+ * Return :
+*****************************************************************************/
+BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_set(bhy_physical_sensor_index_type_t index , int8_t *p_mapping_matrix);
+
+/*****************************************************************************
+ * Function : bhy_mapping_matrix_get
+ * Description : Get mapping matrix from a corresponding physical sensor.
+ * Input : index: physical sensor index.
+ * PHYSICAL_SENSOR_INDEX_ACC = 0,
+ * PHYSICAL_SENSOR_INDEX_MAG = 1,
+ * PHYSICAL_SENSOR_INDEX_GYRO = 2,
+ * Output : p_mapping_matrix: pointer to a "int8_t mapping_matrix[9]".
+ * Return :
+*****************************************************************************/
+BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_get(bhy_physical_sensor_index_type_t index , int8_t *p_mapping_matrix);
+
+/* This function uses the soft pass-through feature to perform single multi-*/
+/* byte transfers in order to write the data. parameters: */
+/* addr i2c address of the slave device */
+/* reg register address to write to */
+/* data pointer to the data buffer with data to write to the */
+/* slave */
+/* length number of bytes to write to the slave */
+/* increment_reg if true, the function will automatically increment the */
+/* register between successive 4-bytes transfers */
+BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_write(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg);
+
+/* This function uses the soft pass-through feature to perform single multi-*/
+/* byte transfers in order to read the data. parameters: */
+/* addr i2c address of the slave device */
+/* reg register address to read from */
+/* data pointer to the data buffer where to place the data read */
+/* from the slave */
+/* length number of bytes to fread from the slave */
+/* increment_reg if true, the function will automatically increment the */
+/* register between successive 4-bytes transfers */
+BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_read(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg);
+
+/*****************************************************************************
+ * Function : bhy_gp_register_write
+ * Description : Write data to specific GP register.
+ * Input : bhy_gp_register_type_t: GP register address.
+ * : p_data: pointer to receive buffer.
+ * Output :
+ * Return :
+*****************************************************************************/
+BHY_RETURN_FUNCTION_TYPE bhy_gp_register_write(bhy_gp_register_type_t gp_reg, uint8_t data);
+
+/*****************************************************************************
+ * Function : bhy_gp_register_read
+ * Description : Read data from specific GP register.
+ * Input : bhy_gp_register_type_t: GP register address.
+ * Output : p_data: pointer to receive buffer.
+ * Return :
+*****************************************************************************/
+BHY_RETURN_FUNCTION_TYPE bhy_gp_register_read(bhy_gp_register_type_t gp_reg, uint8_t *p_data);
+
+/* this functions enables the selected virtual sensor */
+BHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor
+ (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status, uint16_t sample_rate,
+ uint16_t max_report_latency_ms, uint8_t flush_sensor, uint16_t change_sensitivity,
+ uint16_t dynamic_range);
+
+/* this functions disables the selected virtual sensor */
+BHY_RETURN_FUNCTION_TYPE bhy_disable_virtual_sensor
+ (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status);
+
+/* retrieves the fifo data. it needs a buffer of at least 51 bytes to work */
+/* it outputs the data into the variable buffer. the number of bytes read */
+/* into bytes_read and the bytes remaining in the fifo into bytes_left. */
+/* Setting BST_APPLICATION_BOARD to 1 will limit the size to 51 bytes all */
+/* the time. Arguments : */
+/* buffer Pointer to the buffer to use for the fifo readout. */
+/* buffer_size Size of the buffer to work with. Needs to be 51 bytes+ */
+/* bytes_read Pointer to output the number of bytes actually read from*/
+/* the fifo. */
+/* bytes_left Pointer to output the number of bytes still in the fifo.*/
+/* This function automatically keeps track of the current */
+/* fifo readout progress.
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_read_fifo(uint8_t * buffer, uint16_t buffer_size,
+ uint16_t * bytes_read, uint16_t * bytes_left);
+
+/* This function parses the next fifo packet and return it into a generic */
+/* data structure while telling you what the data type is so you can */
+/* retrieve it. Here are the parameters: */
+/* fifo_buffer pointer to the fifo byte that is the start of a */
+/* packet. This pointer will be automatically */
+/* incremented so you can call this function in a loop */
+/* fifo_buffer_length pointer to the amount of data left in the */
+/* fifo_buffer. This data will be automatically */
+/* decremented so you can call this function in a loop */
+/* fifo_data_output buffer in which to place the data */
+/* fifo_data_type data type output */
+BHY_RETURN_FUNCTION_TYPE bhy_parse_next_fifo_packet
+ (uint8_t **fifo_buffer, uint16_t *fifo_buffer_length,
+ bhy_data_generic_t * fifo_data_output, bhy_data_type_t * fifo_data_type);
+
+/* This function will detect the timestamp packet accordingly and update */
+/* either the MSW or the LSW of the system timestamp. Arguments : */
+/* timestamp_packet The timestamp packet processed by the parse_next_ */
+/* fifo_packet, properly typecasted */
+/* system_timestamp Pointer to a 32bit variable holding the system */
+/* timestamp in 1/32000th seconds. it will wrap around */
+/* every 36 hours. */
+BHY_RETURN_FUNCTION_TYPE bhy_update_system_timestamp(bhy_data_scalar_u16_t *timestamp_packet,
+ uint32_t * system_timestamp);
+
+/* This function writes arbitrary data to an arbitrary parameter page. To be*/
+/* used carefully since it can override system configurations. Refer to the */
+/* datasheet for free to use parameter pages. Here are the arguments: */
+/* page Page number. Valid range 1 to 15. */
+/* parameter Parameter number. Valid range 0 to 127. */
+/* data Pointer to the data source to write to. */
+/* length Number of bytes to write. Valid range 1 to 8. */
+BHY_RETURN_FUNCTION_TYPE bhy_write_parameter_page(uint8_t page, uint8_t parameter,
+ uint8_t *data, uint8_t length);
+
+/* This function reads arbitrary data to an arbitrary parameter page. To be*/
+/* used carefully since it can override system configurations. Refer to the */
+/* datasheet for free to use parameter pages. Here are the arguments: */
+/* page Page number. Valid range 1 to 15. */
+/* parameter Parameter number. Valid range 0 to 127. */
+/* data Pointer to the data source to write to. */
+/* length Number of bytes to read. Valid range 1 to 16. */
+BHY_RETURN_FUNCTION_TYPE bhy_read_parameter_page(uint8_t page, uint8_t parameter,
+ uint8_t *data, uint8_t length);
+
+/* This function write a new SIC matrix to the BHy. Arguments are: */
+/* sic_matrix pointer to array of 9 floats with SIC matrix */
+BHY_RETURN_FUNCTION_TYPE bhy_set_sic_matrix(float * sic_matrix);
+
+/* This function reads out the current SIC matrix from BHy. Arguments are: */
+/* sic_matrix pointer to array of 9 floats with SIC matrix */
+BHY_RETURN_FUNCTION_TYPE bhy_get_sic_matrix(float * sic_matrix);
+
+/* This function outputs the debug data to function pointer. You need to */
+/* provide a function that takes as argument a zero-terminated string and */
+/* prints it */
+void bhy_print_debug_packet(bhy_data_debug_t *packet, void (*debug_print_ptr)(const uint8_t *));
+
+BHY_RETURN_FUNCTION_TYPE bhy_sync_cus_evt_size(void);
+
+int8_t bhy_get_cus_evt_size(bhy_virtual_sensor_t sensor_id);
+
+
+#if BHY_CALLBACK_MODE
+/* These functions will install the callback and return an error code if */
+/* there is already a callback installed */
+BHY_RETURN_FUNCTION_TYPE bhy_install_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status, void (*sensor_callback)(bhy_data_generic_t *, bhy_virtual_sensor_t));
+BHY_RETURN_FUNCTION_TYPE bhy_install_timestamp_callback(uint8_t wakeup_status, void (*timestamp_callback)(bhy_data_scalar_u16_t *));
+BHY_RETURN_FUNCTION_TYPE bhy_install_meta_event_callback(bhy_meta_event_type_t meta_event_id, void (*meta_event_callback)(bhy_data_meta_event_t *, bhy_meta_event_type_t));
+
+
+/* These functions will uninstall the callback and return an error code if */
+/* there was no callback installed */
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status);
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_timestamp_callback (uint8_t wakeup_status );
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_meta_event_callback (bhy_meta_event_type_t meta_event_id);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BHY_UC_DRIVER_H_ */
+
+/** @}*/
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_config.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_config.h
new file mode 100644
index 0000000..73f693c
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_config.h
@@ -0,0 +1,74 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ * @file bhy_uc_driver_config.h
+ *
+ * @date 12/15/2016
+ *
+ * @brief header file of bhy_uc_driver.c
+ *
+ */
+
+
+
+
+#ifndef BHY_UC_DRIVER_CONFIG_H_
+#define BHY_UC_DRIVER_CONFIG_H_
+#ifdef __cplusplus
+extern "C"{
+#endif
+/****************************************************************************/
+/* Driver configuration */
+/****************************************************************************/
+#define BHY_MCU_REFERENCE_VERSION "1.1.1.0"
+
+/* Enabling BHY_DEBUG will allow you print all the sensor raw data */
+//#define BHY_DEBUG
+
+/* Enabling BHY_CALLBACK_MODE will allow you to install callback function */
+/* that will be called from the bhy_parse_next_fifo_packet function. is uses*/
+/* ~250 bytes of ROM and ~350 bytes of RAM */
+#define BHY_CALLBACK_MODE 1
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* BHY_UC_DRIVER_CONFIG_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_constants.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_constants.h
new file mode 100644
index 0000000..9cc6bd3
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_constants.h
@@ -0,0 +1,144 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ * @file bhy_uc_driver_constants.h
+ *
+ * @date 12/15/2016
+ *
+ * @brief header file of bhy_uc_driver.c
+ *
+ */
+
+
+#ifndef BHY_UC_DRIVER_CONSTANTS_H_
+#define BHY_UC_DRIVER_CONSTANTS_H_
+#ifdef __cplusplus
+extern "C"{
+#endif
+#include "bhy_uc_driver_config.h"
+
+/****************************************************************************/
+/* Constants definitions */
+/****************************************************************************/
+
+/* definition of all the known IDs. User can add their own IDs to the */
+/* bhy_parse_next_fifo_packet function. follow section 15 table 28 of the */
+/* BHI160 datasheet. */
+#define VS_ID_PADDING 0
+#define VS_ID_ACCELEROMETER 1
+#define VS_ID_MAGNETOMETER 2
+#define VS_ID_ORIENTATION 3
+#define VS_ID_GYROSCOPE 4
+#define VS_ID_LIGHT 5
+#define VS_ID_BAROMETER 6
+#define VS_ID_TEMPERATURE 7
+#define VS_ID_PROXIMITY 8
+#define VS_ID_GRAVITY 9
+#define VS_ID_LINEAR_ACCELERATION 10
+#define VS_ID_ROTATION_VECTOR 11
+#define VS_ID_HUMIDITY 12
+#define VS_ID_AMBIENT_TEMPERATURE 13
+#define VS_ID_UNCALIBRATED_MAGNETOMETER 14
+#define VS_ID_GAME_ROTATION_VECTOR 15
+#define VS_ID_UNCALIBRATED_GYROSCOPE 16
+#define VS_ID_SIGNIFICANT_MOTION 17
+#define VS_ID_STEP_DETECTOR 18
+#define VS_ID_STEP_COUNTER 19
+#define VS_ID_GEOMAGNETIC_ROTATION_VECTOR 20
+#define VS_ID_HEART_RATE 21
+#define VS_ID_TILT_DETECTOR 22
+#define VS_ID_WAKE_GESTURE 23
+#define VS_ID_GLANCE_GESTURE 24
+#define VS_ID_PICKUP_GESTURE 25
+#define VS_ID_CUS1 26
+#define VS_ID_CUS2 27
+#define VS_ID_CUS3 28
+#define VS_ID_CUS4 29
+#define VS_ID_CUS5 30
+#define VS_ID_ACTIVITY 31
+
+#define VS_ID_ACCELEROMETER_WAKEUP (VS_ID_ACCELEROMETER+32)
+#define VS_ID_MAGNETOMETER_WAKEUP (VS_ID_MAGNETOMETER+32)
+#define VS_ID_ORIENTATION_WAKEUP (VS_ID_ORIENTATION+32)
+#define VS_ID_GYROSCOPE_WAKEUP (VS_ID_GYROSCOPE+32)
+#define VS_ID_LIGHT_WAKEUP (VS_ID_LIGHT+32)
+#define VS_ID_BAROMETER_WAKEUP (VS_ID_BAROMETER+32)
+#define VS_ID_TEMPERATURE_WAKEUP (VS_ID_TEMPERATURE+32)
+#define VS_ID_PROXIMITY_WAKEUP (VS_ID_PROXIMITY+32)
+#define VS_ID_GRAVITY_WAKEUP (VS_ID_GRAVITY+32)
+#define VS_ID_LINEAR_ACCELERATION_WAKEUP (VS_ID_LINEAR_ACCELERATION+32)
+#define VS_ID_ROTATION_VECTOR_WAKEUP (VS_ID_ROTATION_VECTOR+32)
+#define VS_ID_HUMIDITY_WAKEUP (VS_ID_HUMIDITY+32)
+#define VS_ID_AMBIENT_TEMPERATURE_WAKEUP (VS_ID_AMBIENT_TEMPERATURE+32)
+#define VS_ID_UNCALIBRATED_MAGNETOMETER_WAKEUP (VS_ID_UNCALIBRATED_MAGNETOMETER+32)
+#define VS_ID_GAME_ROTATION_VECTOR_WAKEUP (VS_ID_GAME_ROTATION_VECTOR+32)
+#define VS_ID_UNCALIBRATED_GYROSCOPE_WAKEUP (VS_ID_UNCALIBRATED_GYROSCOPE+32)
+#define VS_ID_SIGNIFICANT_MOTION_WAKEUP (VS_ID_SIGNIFICANT_MOTION+32)
+#define VS_ID_STEP_DETECTOR_WAKEUP (VS_ID_STEP_DETECTOR+32)
+#define VS_ID_STEP_COUNTER_WAKEUP (VS_ID_STEP_COUNTER+32)
+#define VS_ID_GEOMAGNETIC_ROTATION_VECTOR_WAKEUP (VS_ID_GEOMAGNETIC_ROTATION_VECTOR+32)
+#define VS_ID_HEART_RATE_WAKEUP (VS_ID_HEART_RATE+32)
+#define VS_ID_TILT_DETECTOR_WAKEUP (VS_ID_TILT_DETECTOR+32)
+#define VS_ID_WAKE_GESTURE_WAKEUP (VS_ID_WAKE_GESTURE+32)
+#define VS_ID_GLANCE_GESTURE_WAKEUP (VS_ID_GLANCE_GESTURE+32)
+#define VS_ID_PICKUP_GESTURE_WAKEUP (VS_ID_PICKUP_GESTURE+32)
+#define VS_ID_CUS1_WAKEUP (VS_ID_CUS1+32)
+#define VS_ID_CUS2_WAKEUP (VS_ID_CUS2+32)
+#define VS_ID_CUS3_WAKEUP (VS_ID_CUS3+32)
+#define VS_ID_CUS4_WAKEUP (VS_ID_CUS4+32)
+#define VS_ID_CUS5_WAKEUP (VS_ID_CUS5+32)
+#define VS_ID_ACTIVITY_WAKEUP (VS_ID_ACTIVITY+32)
+
+#define VS_ID_DEBUG 245
+#define VS_ID_TIMESTAMP_LSW_WAKEUP 246
+#define VS_ID_TIMESTAMP_MSW_WAKEUP 247
+#define VS_ID_META_EVENT_WAKEUP 248
+#define VS_ID_BSX_C 249
+#define VS_ID_BSX_B 250
+#define VS_ID_BSX_A 251
+#define VS_ID_TIMESTAMP_LSW 252
+#define VS_ID_TIMESTAMP_MSW 253
+#define VS_ID_META_EVENT 254
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* BHY_UC_DRIVER_CONSTANTS_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_types.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_types.h
new file mode 100644
index 0000000..da7cade
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/inc/bhy_uc_driver_types.h
@@ -0,0 +1,334 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ * @file bhy_uc_driver_types.h
+ *
+ * @date 12/15/2016
+ *
+ * @brief header file of bhy_uc_driver.c
+ *
+ */
+
+
+#ifndef BHY_UC_DRIVER_TYPES_H_
+#define BHY_UC_DRIVER_TYPES_H_
+
+#include "bhy_uc_driver_constants.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+/****************************************************************************/
+/* MACRO */
+/****************************************************************************/
+/* system page */
+#define BHY_PAGE_SYSTEM 1
+#define BHY_PARAM_SYSTEM_META_EVENT_CTRL 1
+#define BHY_PARAM_SYSTEM_FIFO_CTRL 2
+#define BHY_PARAM_SYSTEM_STAUS_BANK_0 3
+#define BHY_PARAM_SYSTEM_STAUS_BANK_1 4
+#define BHY_PARAM_SYSTEM_STAUS_BANK_2 5
+#define BHY_PARAM_SYSTEM_STAUS_BANK_3 6
+#define BHY_PARAM_SYSTEM_CUSTOM_VERSION 24
+#define BHY_PARAM_SYSTEM_WAKE_UP_META_EVENT_CTRL 29
+#define BHY_PARAM_SYSTEM_HOST_IRQ_TIMESTAMP 30
+#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_STATUS 31
+#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_PRESENT 32
+#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 32
+#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_ACC 33
+
+#define VS_NON_WAKEUP 0
+#define VS_WAKEUP 32
+#define VS_FLUSH_NONE 0x00
+#define VS_FLUSH_ALL 0xFF
+#define VS_FLUSH_SINGLE 0x01
+
+#define META_EVENT_1_INT_ENABLE_BIT (1<<0)
+#define META_EVENT_1_ENABLE_BIT (1<<1)
+
+/****************************************************************************/
+/* ENUM */
+/****************************************************************************/
+/* follows section 9.4 table 14 of the BHI160 datasheet */
+typedef enum {
+ VS_TYPE_ACCELEROMETER = VS_ID_ACCELEROMETER,
+ VS_TYPE_GEOMAGNETIC_FIELD = VS_ID_MAGNETOMETER,
+ VS_TYPE_ORIENTATION = VS_ID_ORIENTATION,
+ VS_TYPE_GYROSCOPE = VS_ID_GYROSCOPE,
+ VS_TYPE_LIGHT = VS_ID_LIGHT,
+ VS_TYPE_PRESSURE = VS_ID_BAROMETER,
+ VS_TYPE_TEMPERATURE = VS_ID_TEMPERATURE,
+ VS_TYPE_PROXIMITY = VS_ID_PROXIMITY,
+ VS_TYPE_GRAVITY = VS_ID_GRAVITY,
+ VS_TYPE_LINEAR_ACCELERATION = VS_ID_LINEAR_ACCELERATION,
+ VS_TYPE_ROTATION_VECTOR = VS_ID_ROTATION_VECTOR,
+ VS_TYPE_RELATIVE_HUMIDITY = VS_ID_HUMIDITY,
+ VS_TYPE_AMBIENT_TEMPERATURE = VS_ID_AMBIENT_TEMPERATURE,
+ VS_TYPE_MAGNETIC_FIELD_UNCALIBRATED = VS_ID_UNCALIBRATED_MAGNETOMETER,
+ VS_TYPE_GAME_ROTATION_VECTOR = VS_ID_GAME_ROTATION_VECTOR,
+ VS_TYPE_GYROSCOPE_UNCALIBRATED = VS_ID_UNCALIBRATED_GYROSCOPE,
+ VS_TYPE_SIGNIFICANT_MOTION = VS_ID_SIGNIFICANT_MOTION,
+ VS_TYPE_STEP_DETECTOR = VS_ID_STEP_DETECTOR,
+ VS_TYPE_STEP_COUNTER = VS_ID_STEP_COUNTER,
+ VS_TYPE_GEOMAGNETIC_ROTATION_VECTOR = VS_ID_GEOMAGNETIC_ROTATION_VECTOR,
+ VS_TYPE_HEART_RATE = VS_ID_HEART_RATE,
+ VS_TYPE_TILT = VS_ID_TILT_DETECTOR,
+ VS_TYPE_WAKEUP = VS_ID_WAKE_GESTURE,
+ VS_TYPE_GLANCE = VS_ID_GLANCE_GESTURE,
+ VS_TYPE_PICKUP = VS_ID_PICKUP_GESTURE,
+ VS_TYPE_CUS1 = VS_ID_CUS1,
+ VS_TYPE_CUS2 = VS_ID_CUS2,
+ VS_TYPE_CUS3 = VS_ID_CUS3,
+ VS_TYPE_CUS4 = VS_ID_CUS4,
+ VS_TYPE_CUS5 = VS_ID_CUS5,
+ VS_TYPE_ACTIVITY_RECOGNITION = VS_ID_ACTIVITY
+} bhy_virtual_sensor_t;
+
+typedef enum {
+ BHY_META_EVENT_TYPE_NOT_USED = 0,
+ BHY_META_EVENT_TYPE_FLUSH_COMPLETE = 1,
+ BHY_META_EVENT_TYPE_SAMPLE_RATE_CHANGED = 2,
+ BHY_META_EVENT_TYPE_POWER_MODE_CHANGED = 3,
+ BHY_META_EVENT_TYPE_ERROR = 4,
+ BHY_META_EVENT_TYPE_ALGORITHM = 5,
+ /* IDs 6-10 are reserved */
+ BHY_META_EVENT_TYPE_SENSOR_ERROR = 11,
+ BHY_META_EVENT_TYPE_FIFO_OVERFLOW = 12,
+ BHY_META_EVENT_TYPE_DYNAMIC_RANGE_CHANGED = 13,
+ BHY_META_EVENT_TYPE_FIFO_WATERMARK = 14,
+ BHY_META_EVENT_TYPE_SELF_TEST_RESULTS = 15,
+ BHY_META_EVENT_TYPE_INITIALIZED = 16,
+
+} bhy_meta_event_type_t;
+
+typedef enum {
+ /* group 1 only read for host -s */
+ BHY_GP_REG_20 = 0x4B,
+ BHY_GP_REG_21 = 0x4C,
+ BHY_GP_REG_22 = 0x4D,
+ BHY_GP_REG_23 = 0x4E,
+ BHY_GP_REG_24 = 0x4F,
+ /* group 1 only read for host -e */
+ /* group 2 read & write for host -s */
+ BHY_GP_REG_31 = 0x56,
+ BHY_GP_REG_32 = 0x57,
+ BHY_GP_REG_33 = 0x58,
+ BHY_GP_REG_34 = 0x59,
+ BHY_GP_REG_35 = 0x5A,
+ BHY_GP_REG_36 = 0x5B,
+ /* group 2 read & write for host -e */
+ /* group 3 read & write for host -s */
+ BHY_GP_REG_46 = 0x65,
+ BHY_GP_REG_47 = 0x66,
+ BHY_GP_REG_48 = 0x67,
+ BHY_GP_REG_49 = 0x68,
+ BHY_GP_REG_50 = 0x69,
+ BHY_GP_REG_51 = 0x6A,
+ BHY_GP_REG_52 = 0x6B,
+ /* group 3 read & write for host -e */
+} bhy_gp_register_type_t;
+
+/* follows section 15 of the BHI160 datasheet the order of this enumeration */
+/* is important, do not change it */
+typedef enum {
+ BHY_DATA_TYPE_PADDING = 0,
+ BHY_DATA_TYPE_QUATERNION = 1,
+ BHY_DATA_TYPE_VECTOR = 2,
+ BHY_DATA_TYPE_SCALAR_U8 = 3,
+ BHY_DATA_TYPE_SCALAR_U16 = 4,
+ BHY_DATA_TYPE_SCALAR_S16 = 5,
+ BHY_DATA_TYPE_SCALAR_U24 = 6,
+ BHY_DATA_TYPE_SENSOR_EVENT = 7,
+ BHY_DATA_TYPE_UNCALIB_VECTOR = 8,
+ BHY_DATA_TYPE_META_EVENT = 9,
+ BHY_DATA_TYPE_BSX = 10,
+ BHY_DATA_TYPE_DEBUG = 11,
+ BHY_DATA_TYPE_CUS1 = 12,
+ BHY_DATA_TYPE_CUS2 = 13,
+ BHY_DATA_TYPE_CUS3 = 14,
+ BHY_DATA_TYPE_CUS4 = 15,
+ BHY_DATA_TYPE_CUS5 = 16,
+} bhy_data_type_t;
+
+typedef enum {
+ META_EVENT_IN_NON_WAKEUP_FIFO = 1,
+ META_EVENT_IN_WAKEUP_FIFO = 29,
+} bhy_meta_event_fifo_type_t;
+
+typedef enum
+{
+ PHYSICAL_SENSOR_INDEX_ACC = 0,
+ PHYSICAL_SENSOR_INDEX_MAG,
+ PHYSICAL_SENSOR_INDEX_GYRO,
+ PHYSICAL_SENSOR_COUNT
+} bhy_physical_sensor_index_type_t;
+
+/****************************************************************************/
+/* STRUCTRE DEFINITION */
+/****************************************************************************/
+
+/* definition of structures of all the data types */
+typedef struct {
+ uint8_t sensor_id;
+} bhy_data_padding_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ int16_t w;
+ int16_t estimated_accuracy;
+} bhy_data_quaternion_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ uint8_t status;
+} bhy_data_vector_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint8_t data;
+} bhy_data_scalar_u8_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint16_t data;
+} bhy_data_scalar_u16_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int16_t data;
+} bhy_data_scalar_s16_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint32_t data;
+} bhy_data_scalar_u24_t;
+
+typedef struct {
+ uint8_t sensor_id;
+} bhy_data_sensor_event_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ int16_t x_bias;
+ int16_t y_bias;
+ int16_t z_bias;
+ uint8_t status;
+} bhy_data_uncalib_vector_t;
+
+typedef struct {
+ uint8_t meta_event_id;
+ bhy_meta_event_type_t event_number;
+ uint8_t sensor_type;
+ uint8_t event_specific;
+} bhy_data_meta_event_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int32_t x;
+ int32_t y;
+ int32_t z;
+ uint32_t timestamp;
+} bhy_data_bsx_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint8_t data[13];
+} bhy_data_debug_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ int16_t deltaX;
+ int16_t deltaY;
+ int16_t deltaZ;
+ int16_t confidencelevel;
+ uint16_t direction;
+ uint16_t stepCount;
+} bhy_data_pdr_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint8_t data[16];
+} bhy_data_custom_t;
+
+typedef struct {
+ uint8_t sensor_id;
+ uint8_t status;
+} bhy_data_helmet_t;
+
+/* definition of a generic structure that can contain any data type it */
+/* occupies in RAM the size of the largest data structure, which is 18 bytes*/
+/* as of 08/04/2015 */
+typedef union {
+ bhy_data_padding_t data_padding;
+ bhy_data_quaternion_t data_quaternion;
+ bhy_data_vector_t data_vector;
+ bhy_data_scalar_u8_t data_scalar_u8;
+ bhy_data_scalar_u16_t data_scalar_u16;
+ bhy_data_scalar_s16_t data_scalar_s16;
+ bhy_data_scalar_u24_t data_scalar_u24;
+ bhy_data_sensor_event_t data_sensor_event;
+ bhy_data_uncalib_vector_t data_uncalib_vector;
+ bhy_data_meta_event_t data_meta_event;
+ bhy_data_bsx_t data_bsx;
+ bhy_data_debug_t data_debug;
+ bhy_data_custom_t data_custom;
+ bhy_data_pdr_t data_pdr;
+ bhy_data_helmet_t data_helmet_event;
+ bhy_data_helmet_t data_helmet_wear_status;
+} bhy_data_generic_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* BHY_UC_DRIVER_TYPES_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy.c
new file mode 100644
index 0000000..87a306e
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy.c
@@ -0,0 +1,4309 @@
+/*
+****************************************************************************
+* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+*
+* File : bhy.c
+*
+* Date : 2016/01/22
+*
+* Revision : 1.0.4 $
+*
+* Usage: Sensor Driver for BHY sensor
+*
+****************************************************************************
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* Neither the name of the copyright holder nor the names of the
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+* OR CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+*
+* The information provided is believed to be accurate and reliable.
+* The copyright holder assumes no responsibility
+* for the consequences of use
+* of such information nor for any infringement of patents or
+* other rights of third parties which may result from its use.
+* No license is granted by implication or otherwise under any patent or
+* patent rights of the copyright holder.
+*
+**************************************************************************/
+/*! file
+ brief */
+#include "bhy.h"
+/* static structure for bhy */
+static struct bhy_t *p_bhy;
+/* contain the saved parameters data*/
+static struct parameter_read_buffer_t read_buffer;
+/* contain the load parameters data*/
+static struct parameter_write_buffer_t write_buffer;
+/* Assign the sensor status bank*/
+struct sensor_status_bank_t sensor_status_bank;
+
+/*!
+ * @brief
+ * This function is used for initialize
+ * bus read and bus write functions
+ * and device address
+ * product id is read in the register 0x90 bit from 0 to 7
+ *
+ * @param bhy : structure pointer
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @note
+ * While changing the parameter of the bhy_t
+ * consider the following point:
+ * Changing the reference value of the parameter
+ * will changes the local copy or local reference
+ * make sure your changes will not
+ * affect the reference value of the parameter
+ * (Better case don't change the reference value of the parameter)
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_init(struct bhy_t *bhy)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* assign bhy ptr */
+ p_bhy = bhy;
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PRODUCT_ID_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* read product Id */
+ p_bhy->product_id = v_data_u8;
+ return com_rslt;
+}
+/*!
+ * @brief
+ * This API write the data to
+ * the given register
+ *
+ *
+ * @param v_addr_u8 -> Address of the register
+ * @param v_data_u8 -> The data from the register
+ * @param v_len_u8 -> no of bytes to read
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_write_reg(u8 v_addr_u8,
+u8 *v_data_u8, u16 v_len_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* check the p_bhy structure as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* write data from register*/
+ com_rslt =
+ p_bhy->BHY_BUS_WRITE_FUNC(p_bhy->device_addr,
+ v_addr_u8, v_data_u8, v_len_u16);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief
+ * This API reads the data from
+ * the given register
+ *
+ *
+ * @param v_addr_u8 -> Address of the register
+ * @param v_data_u8 -> The data from the register
+ * @param v_len_u8 -> no of bytes to read
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_read_reg(u8 v_addr_u8,
+u8 *v_data_u8, u16 v_len_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* check the p_bhy structure as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* Read data from register*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ v_addr_u8, v_data_u8, v_len_u16);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the FIFO flush from the register 0x32
+ * bit 0 to 7
+ *
+ *
+ * @param v_fifo_flush_u8 : The value of fifo flush
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_flush(u8 *v_fifo_flush_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_FIFO_FLUSH__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_fifo_flush_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_FIFO_FLUSH);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the FIFO flush from the register 0x32
+ * bit 0 to 7
+ *
+ *
+ * @param v_fifo_flush_u8 : The value of fifo flush
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_fifo_flush(u8 v_fifo_flush_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_FIFO_FLUSH__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_FIFO_FLUSH,
+ v_fifo_flush_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_FIFO_FLUSH__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the chip control from the register 0x34
+ * bit 0 to 7
+ * @note Chip control used to provide the control fundamental
+ * behaviour of the chip
+ *
+ * @param v_chipcontrol_u8 : The value of chip control
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_chip_control(u8 *v_chipcontrol_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy structure as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the chip control status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_CHIP_CONTROL__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_chipcontrol_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_CONTROL);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the chip control from the register 0x34
+ * bit 0 to 7
+ * @note Chip control used to provide the control fundamental
+ * behaviour of the chip
+ *
+ * @param v_chipcontrol_u8 : The value of chip control
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_chip_control(u8 v_chipcontrol_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy structure as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_CHIP_CONTROL__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_CONTROL,
+ v_chipcontrol_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_CHIP_CONTROL__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the host status from the register 0x35
+ * bit 0 to 7
+ *
+ *
+ * @param v_algo_standby_u8 : The value of algorithm standby duration
+ * @param v_algo_id_u8 : The value of algorithm id
+ * @param v_host_interface_id_u8 : The value of host interface id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_status(
+u8 *v_algo_standby_u8, u8 *v_algo_id_u8,
+u8 *v_host_interface_id_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the host status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_STATUS__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* read the host algo status*/
+ *v_algo_standby_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY);
+ /* read the host algo id */
+ *v_algo_id_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID);
+ /* host interface id */
+ *v_host_interface_id_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_HOST_INTERFACE_ID);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the interrupt status from the register 0x36
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_int_u8 :
+ * The value of host interrupt status
+ * @param v_wakeup_water_mark_u8 :
+ * The value of wakeup watermark status
+ * @param v_wakeup_latency_u8 :
+ * The value of wakeup latency status
+ * @param v_wakeup_immediate_u8 :
+ * The value of wakeup immediate status
+ * @param v_non_wakeup_water_mark_u8 :
+ * The value of non wakeup watermark status
+ * @param v_non_wakeup_latency_u8 :
+ * The value of non wakeup latency status
+ * @param v_non_wakeup_immediate_u8 :
+ * The value of non wakeup immediate
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_interrupt_status(
+u8 *v_host_int_u8,
+u8 *v_wakeup_water_mark_u8, u8 *v_wakeup_latency_u8,
+u8 *v_wakeup_immediate_u8, u8 *v_non_wakeup_water_mark_u8,
+u8 *v_non_wakeup_latency_u8, u8 *v_non_wakeup_immediate_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the interrupt status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_INT_STATUS__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* read the host interrupt status*/
+ *v_host_int_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR);
+ /* read the wakeup watermark interrupt status*/
+ *v_wakeup_water_mark_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM);
+ /* read the wakeup latency interrupt status*/
+ *v_wakeup_latency_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY);
+ /* read the wakeup immediate interrupt status*/
+ *v_wakeup_immediate_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE);
+ /* read the non wakeup watermark interrupt status*/
+ *v_non_wakeup_water_mark_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM);
+ /* read the non wakeup latency interrupt status*/
+ *v_non_wakeup_latency_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY);
+ /* read the non wakeup immediate status*/
+ *v_non_wakeup_immediate_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the chip status from the register 0x37
+ * bit 0 to 7
+ *
+ *
+ *
+ * @param v_eeprom_detected_u8 : The value of eeprom
+ * detected status
+ * @param v_ee_upload_done_u8 : The value of ee_upload
+ * done status
+ * @param v_ee_upload_error_u8 : The value of ee_upload
+ * done error
+ * @param v_firmware_idle_u8 : The value of firmware error status
+ * @param v_no_eeprom_u8 : The value of no eeprom status
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_chip_status(
+u8 *v_eeprom_detected_u8,
+u8 *v_ee_upload_done_u8, u8 *v_ee_upload_error_u8,
+u8 *v_firmware_idle_u8, u8 *v_no_eeprom_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the chip status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_CHIP_STATUS__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* read eeprom detected status*/
+ *v_eeprom_detected_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED);
+ /* read eeprom upload done status*/
+ *v_ee_upload_done_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE);
+ /* read eeprom upload error status*/
+ *v_ee_upload_error_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR);
+ /* read firmware idle status*/
+ *v_firmware_idle_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE);
+ /* read no eeprom detected status*/
+ *v_no_eeprom_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_CHIP_STATUS_NO_EEPROM);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the bytes remaining from the register 0x38
+ * and 0x39 bit 0 to 7
+ *
+ *
+ * @param v_bytes_remaining_u16 : The value of bytes remaining
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @note This indicates how many bytes are available in the FIFO buffer
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_read_bytes_remaining(u16 *v_bytes_remaining_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* Array contains the bytes reaming of FIFO lSB and MSB data
+ v_data_u8[LSB_ZERO] - LSB
+ v_data_u8[MSB_ONE] - MSB*/
+ u8 v_data_u8[BHY_BYTES_REMAINING_SIZE] = {BHY_INIT_VALUE,
+ BHY_INIT_VALUE};
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read bytes remaining data */
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_BYTES_REMAINING_LSB_ADDR,
+ v_data_u8, BHY_BYTES_REMAINING_LENGTH);
+ /* get the bytes remaining data*/
+ *v_bytes_remaining_u16 = (u16)
+ ((v_data_u8[BHY_BYTES_REMAINING_MSB]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (v_data_u8[BHY_BYTES_REMAINING_LSB]));
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the parameter
+ * acknowledgement from the register 0x3A
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_acknowledge_u8:
+ * The value of parameter acknowledgement
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_acknowledge(
+u8 *v_parameter_acknowledge_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the parameter acknowledgement*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_ACKNOWLEDGE_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_parameter_acknowledge_u8 = v_data_u8;
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the parameter
+ * page select from the register 0x54
+ * bit 0 to 7
+ *
+ *
+ * @param v_page_select_u8 : The value of parameter page selection
+ * page information | value
+ * ------------------------|----------
+ * BHY_PAGE_SELECT_PARAMETER_PAGE | 0
+ * BHY_PAGE_SELECT_PARAMETER_SIZE | 1
+ *
+ * @param v_parameter_page_u8 : The value of page selection
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_page_select(
+u8 v_page_select_u8, u8 *v_parameter_page_u8)
+{
+/* variable used for return the status of communication result*/
+BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+u8 v_data_u8 = BHY_INIT_VALUE;
+/* check the p_bhy pointer as NULL*/
+if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the parameter page information*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ switch (v_page_select_u8) {
+ case BHY_PAGE_SELECT_PARAMETER_PAGE:
+ *v_parameter_page_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE);
+ break;
+ case BHY_PAGE_SELECT_PARAMETER_SIZE:
+ *v_parameter_page_u8
+ = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+return com_rslt;
+}
+/*!
+ * @brief API used to set the parameter
+ * page select from the register 0x54
+ * bit 0 to 7
+ *
+ *
+ * @param v_page_select_u8 : The value of parameter page selection
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_parameter_page_select(
+u8 v_page_select_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ v_data_u8 = v_page_select_u8;
+ /* read the parameter page information*/
+ com_rslt = p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ return com_rslt;
+ }
+
+/*!
+ * @brief API used to get the host interface control
+ * from the register 0x55
+ * bit 0 to 7
+ *
+ *
+ *
+ * @param v_algo_standby_req_u8 : The value of algorithm standby
+ * request
+ * @param v_abort_transfer_u8 : The value of abort transfer
+ * @param v_update_transfer_cnt_u8 : The value of update
+ * transfer count
+ * @param v_wakeup_fifo_intr_disable_u8 :
+ * The value of wakeup fifo host
+ * interrupt disable
+ * @param v_ned_coordinates_u8 : The value of NED coordinates
+ * @param v_ap_suspend_u8 : The value of AP suspended
+ * @param v_sensor_selftest_u8 : The value of sensor self test
+ * @param v_non_wakeup_fifo_intr_disable_u8:
+ * The value of non wakeup fifo host
+ * interrupt disable
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_interface_control(
+u8 *v_algo_standby_req_u8,
+u8 *v_abort_transfer_u8, u8 *v_update_transfer_cnt_u8,
+u8 *v_wakeup_fifo_intr_disable_u8, u8 *v_ned_coordinates_u8,
+u8 *v_ap_suspend_u8, u8 *v_sensor_selftest_u8,
+u8 *v_non_wakeup_fifo_intr_disable_u8)
+{
+/* variable used for return the status of communication result*/
+BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+u8 v_data_u8 = BHY_INIT_VALUE;
+/* check the p_bhy pointer as NULL*/
+if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the host interrupt status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* read algorithm standby request status*/
+ *v_algo_standby_req_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST);
+ /* read host interrupt control status*/
+ *v_abort_transfer_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER);
+ /* read update transfer control status*/
+ *v_update_transfer_cnt_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT);
+ /* read wakeup fifo host interrupt disable status*/
+ *v_wakeup_fifo_intr_disable_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE);
+ /* read ned coordinates status*/
+ *v_ned_coordinates_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE);
+ /* read AP suspended status*/
+ *v_ap_suspend_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND);
+ /* read self test status*/
+ *v_sensor_selftest_u8 = BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST);
+ /* read non wakeup fifo host interrupt disable status*/
+ *v_non_wakeup_fifo_intr_disable_u8 =
+ BHY_GET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE);
+ }
+return com_rslt;
+}
+/*!
+ * @brief API used to set the host interface control
+ * from the register 0x55
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_interface_select_u8 : The value of host interface selection
+ * host interface | value
+ * -----------------------------------|----------
+ * BHY_HOST_ALGO_STANDBY_REQUEST | 0
+ * BHY_HOST_ABORT_TRANSFER | 1
+ * BHY_HOST_UPDATE_TRANSFER_COUNT | 2
+ * BHY_HOST_WAKEUP_FIFO_DISABLE | 3
+ * BHY_HOST_NED_COORDINATE | 4
+ * BHY_HOST_AP_SUSPEND | 5
+ * BHY_HOST_SELFTEST | 6
+ * BHY_HOST_NON_WAKEUP_FIFO_DISABLE | 7
+ *
+ * @param v_host_interface_status_u8 : The value of host interface
+ * Data | status
+ * -----------------| -----------
+ * 0 | DISABLE
+ * 1 | ENABLE
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_host_interface_control(
+u8 v_host_interface_select_u8, u8 v_host_interface_status_u8)
+{
+/* variable used for return the status of communication result*/
+BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+u8 v_data_u8 = BHY_INIT_VALUE;
+/* check the p_bhy pointer as NULL*/
+if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+} else {
+switch (v_host_interface_select_u8) {
+case BHY_HOST_ALGO_STANDBY_REQUEST:
+ /* write algorithm standby request status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_ABORT_TRANSFER:
+ /* write host interrupt control status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_UPDATE_TRANSFER_COUNT:
+ /* write update transfer control status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_WAKEUP_FIFO_DISABLE:
+ /* write wakeup fifo host interrupt disable status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_NED_COORDINATE:
+ /* write ned coordinates status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_AP_SUSPEND:
+ /* write AP suspended status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_SELFTEST:
+ /* write self test status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+case BHY_HOST_NON_WAKEUP_FIFO_DISABLE:
+/* write non wakeup fifo host interrupt disable status*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ if (BHY_SUCCESS == com_rslt) {
+ v_data_u8 = BHY_SET_BITSLICE(v_data_u8,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE,
+ v_host_interface_status_u8);
+ com_rslt += p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+break;
+default:
+ com_rslt = BHY_OUT_OF_RANGE;
+break;
+}
+}
+return com_rslt;
+}
+/*!
+ * @brief API used to get the parameter
+ * request from the register 0x64
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_parameter_request(
+u8 *v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_REQUEST_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_parameter_request_u8 = v_data_u8;
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the parameter
+ * request from the register 0x64
+ * bit 0 to 7
+ *
+ *
+ * @param v_parameter_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_parameter_request(
+u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* write load parameter request*/
+ v_data_u8 = v_parameter_request_u8;
+ com_rslt = p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_LOAD_PARAMETER_REQUEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the host IRQ time stamp
+ * request from the register 0x6C to 0x6F
+ * bit 0 to 7
+ *
+ *
+ * @param v_host_irq_timestamp_u32 : The value of host irq time stamp
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_host_irq_timestamp(
+u32 *v_host_irq_timestamp_u32)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8[BHY_HOST_IRQ_TIMESTAMP_SIZE] = {BHY_INIT_VALUE,
+ BHY_INIT_VALUE, BHY_INIT_VALUE, BHY_INIT_VALUE};
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_BHY_HOST_IRQ_TIMESTAMP_ADDR,
+ v_data_u8, BHY_HOST_IRQ_TIMESTAMP_SIZE);
+ *v_host_irq_timestamp_u32 =
+ (u32)((v_data_u8[BHY_HOST_IRQ_TIMESTAMP_MSB_DATA]
+ << BHY_SHIFT_BIT_POSITION_BY_24_BITS)
+ |(v_data_u8[BHY_HOST_IRQ_TIMESTAMP_XXLSB_DATA]
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ |(v_data_u8[BHY_HOST_IRQ_TIMESTAMP_XLSB_DATA]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (v_data_u8[BHY_HOST_IRQ_TIMESTAMP_LSB_DATA]));
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the ROM version
+ * request from the register 0x70 to 0x71
+ * bit 0 to 7
+ *
+ *
+ * @param v_rom_version_u16 : The value ROM version
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_rom_version(u16 *v_rom_version_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8[BHY_ROM_VERSION_SIZE] = {BHY_INIT_VALUE,
+ BHY_INIT_VALUE};
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_ROM_VERSION_ADDR,
+ v_data_u8, BHY_ROM_VERSION_SIZE);
+ *v_rom_version_u16 =
+ (u16)((v_data_u8[BHY_ROM_VERSION_MSB_DATA]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (v_data_u8[BHY_ROM_VERSION_LSB_DATA]));
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the RAM version
+ * request from the register 0x72 to 0x73
+ * bit 0 to 7
+ *
+ *
+ * @param v_ram_version_u16 : The value RAM version
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_ram_version(
+u16 *v_ram_version_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8[BHY_RAM_VERSION_SIZE] = {BHY_INIT_VALUE,
+ BHY_INIT_VALUE};
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_RAM_VERSION_ADDR,
+ v_data_u8, BHY_RAM_VERSION_SIZE);
+ *v_ram_version_u16 =
+ (u16)((v_data_u8[BHY_RAM_VERSION_MSB_DATA]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (v_data_u8[BHY_RAM_VERSION_LSB_DATA]));
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the product id
+ * request from the register 0x90
+ * bit 0 to 7
+ *
+ *
+ * @param v_product_id_u8 : The value of product id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_product_id(u8 *v_product_id_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PRODUCT_ID_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_product_id_u8 = v_data_u8;
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the revision id
+ * request from the register 0x91
+ * bit 0 to 7
+ *
+ *
+ * @param v_revision_id_u8 : The value of revision id
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_revision_id(u8 *v_revision_id_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* read the load parameter request rate*/
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_REVISION_ID_ADDR,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ *v_revision_id_u8 = v_data_u8;
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the CRC host
+ * request from the register 0x91
+ * bit 0 to 7
+ *
+ *
+ * @param v_crc_host_u32 : The value of CRC host
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_crc_host(u32 *v_crc_host_u32)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* Array contains the sensor time it is 32 bit data
+ a_data_u8[0] - crc HOST
+ a_data_u8[1] - crc HOST
+ a_data_u8[2] - crc HOST
+ a_data_u8[3] - crc HOST
+ */
+ u8 a_data_u8[BHY_CRC_HOST_SIZE] = {BHY_INIT_VALUE,
+ BHY_INIT_VALUE, BHY_INIT_VALUE, BHY_INIT_VALUE};
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_CRC_HOST_ADDR,
+ a_data_u8, BHY_CRC_HOST_LENGTH);
+ *v_crc_host_u32 = (u32)
+ (((u32)a_data_u8[BHY_CRC_HOST_MSB]
+ << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |
+ ((u32)a_data_u8[BHY_CRC_HOST_XXLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ |(a_data_u8[BHY_CRC_HOST_XLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (a_data_u8[BHY_CRC_HOST_LSB]));
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the reset
+ * request from the register 0x9B
+ * bit 0 to 7
+ *
+ *
+ * @param v_reset_request_u8 : The value of parameter request
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_reset_request(u8 v_reset_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ v_data_u8 = v_reset_request_u8;
+ /* write load parameter request*/
+ com_rslt = p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_RESET_REQUEST__REG,
+ &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to flash the ram patch
+ *
+ *
+ * @param memory : The value of data from the
+ * ram patch.
+ * @param v_file_length_u32 : Length of the patch data
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_initialize(u8 *memory, u32 v_file_length_u32)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_upload_addr = BHY_UPLOAD_DATA;
+ u8 v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_1;
+ u32 v_crc_from_memory_u32 = BHY_INIT_VALUE;
+ u32 v_length_to_process_u32 = BHY_INIT_VALUE;
+ u32 v_crc_host_u32 = BHY_INIT_VALUE;
+ u32 write_data = BHY_INIT_VALUE;
+ u8 data_from_mem[BHY_SIGNATURE_MEM_LEN];
+ u8 data_byte[BHY_RAM_WRITE_LENGTH];
+ u32 read_index_u8 = BHY_INIT_VALUE;
+ s32 reverse_index_s32 = BHY_INIT_VALUE;
+ u32 bytes_to_write_u8 = BHY_RAM_WRITE_LENGTH;
+ u32 read_bytes_index = BHY_INIT_VALUE;
+ u32 write_index_u32 = BHY_INIT_VALUE;
+ u32 write_ram_index = BHY_INIT_VALUE;
+ u32 index_mem = BHY_INIT_VALUE;
+ u32 write_length = BHY_INIT_VALUE;
+ u32 data_to_process = BHY_INIT_VALUE;
+ u8 init_array_data = BHY_INIT_VALUE;
+ /* initialize the array*/
+ for (init_array_data = 0; init_array_data < BHY_SIGNATURE_MEM_LEN; init_array_data++)
+ {
+ data_from_mem[init_array_data] = BHY_INIT_VALUE;
+ }
+ for (init_array_data = BHY_INIT_VALUE; init_array_data < BHY_RAM_WRITE_LENGTH; init_array_data++)
+ {
+ data_byte[init_array_data] = BHY_INIT_VALUE;
+ }
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy)
+ {
+ com_rslt = BHY_NULL;
+ }
+ else
+ {
+ /* Assign the memory data into the local array*/
+ for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 <= BHY_SIGNATURE_LENGTH; read_index_u8++)
+ {
+ data_from_mem[read_index_u8] = *(memory+read_index_u8);
+ }
+ /* Verify the signature of the data*/
+ if ((data_from_mem[BHY_SIGNATURE_1] == BHY_IMAGE_SIGNATURE1)
+ && (data_from_mem[BHY_SIGNATURE_2] == BHY_IMAGE_SIGNATURE2))
+ {
+ com_rslt = BHY_SUCCESS;
+ }
+ else
+ {
+ com_rslt = BHY_ERROR;
+ }
+ /* read the CRC data from memory */
+ v_crc_from_memory_u32 = (u32)
+ (((u32)data_from_mem[BHY_CRC_HOST_FILE_MSB]
+ << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |
+ ((u32)data_from_mem[BHY_CRC_HOST_FILE_XXLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ |(data_from_mem[BHY_CRC_HOST_FILE_XLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (data_from_mem[BHY_CRC_HOST_FILE_LSB]));
+ /* Remove the first 16 bytes*/
+ data_to_process = v_file_length_u32 - BHY_SIGNATURE_LENGTH;
+ /* data to write for length calculation*/
+ v_length_to_process_u32 = (data_to_process / BHY_RAM_WRITE_LENGTH);
+ read_index_u8 = BHY_SIGNATURE_LENGTH;
+ read_bytes_index = BHY_INIT_READ_BYTES;
+ for (write_index_u32 = BHY_INIT_VALUE; write_index_u32 < v_length_to_process_u32;)
+ {
+ /* reverse the data*/
+ if (read_index_u8 <= read_bytes_index && read_bytes_index <= data_to_process)
+ {
+ for (reverse_index_s32 = bytes_to_write_u8 - BHY_INIT_BYTE_MINUS_ONE;
+ reverse_index_s32 >= BHY_INIT_VALUE;)
+ {
+ data_byte[reverse_index_s32] = *(memory + read_index_u8);
+ read_index_u8++;
+ reverse_index_s32--;
+ }
+ }
+ /* write the data into the register*/
+ read_bytes_index = read_bytes_index + BHY_RAM_WRITE_LENGTH;
+ reverse_index_s32 = BHY_INIT_VALUE;
+
+ for (write_ram_index = BHY_INIT_VALUE; write_ram_index <= BHY_CHECK_BYTE;)
+ {
+ *(memory + index_mem) = data_byte[write_ram_index];
+ index_mem++;
+ write_ram_index++;
+ }
+ write_index_u32++;
+ }
+ /* set the reset as 0x01*/
+ com_rslt = bhy_set_reset_request(BHY_RESET_ENABLE);
+ com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR,
+ &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* set the upload data*/
+ com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_0_ADDR,
+ &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);
+ com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_1_ADDR,
+ &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);
+ /* write the chip control register as 0x02*/
+ write_length =
+ data_to_process / BHY_RAM_WRITE_LENGTH_API;
+ read_index_u8 = BHY_INIT_VALUE;
+ /* write the memory of data */
+ if (com_rslt == BHY_SUCCESS) {
+ for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 < write_length; read_index_u8++)
+ {
+ com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_DATA_ADDR, \
+ (u8 *)(memory + write_data), \
+ BHY_RAM_WRITE_LENGTH_API);
+ write_data = write_data + BHY_RAM_WRITE_LENGTH_API;
+ }
+ }
+ /* Check the CRC success*/
+ com_rslt = bhy_get_crc_host(&v_crc_host_u32);
+ if (v_crc_from_memory_u32 == v_crc_host_u32)
+ {
+ com_rslt = BHY_SUCCESS;
+ }
+ else
+ {
+ com_rslt = BHY_ERROR;
+ }
+ /* disable upload mode*/
+ v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_2;
+ /* write the chip control register as 0x02*/
+ com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR, &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);
+ }
+ return com_rslt;
+}
+
+BHY_RETURN_FUNCTION_TYPE bhy_initialize_from_rom( const u8 *memory, const u32 v_file_length_u32)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_upload_addr = BHY_UPLOAD_DATA;
+ u8 v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_1;
+ u32 v_crc_from_memory_u32 = BHY_INIT_VALUE;
+ u32 v_crc_host_u32 = BHY_INIT_VALUE;
+ u32 write_data = BHY_INIT_VALUE;
+ u8 data_from_mem[BHY_SIGNATURE_MEM_LEN];
+ u8 data_byte[BHY_RAM_WRITE_LENGTH_API];
+ u32 read_index_u8 = BHY_INIT_VALUE;
+ u32 reverse_index_u32 = BHY_INIT_VALUE;
+ u32 reverse_block_index_u32 = BHY_INIT_VALUE;
+ u32 write_length = BHY_INIT_VALUE;
+ u32 data_to_process = BHY_INIT_VALUE;
+ u32 packet_length = BHY_INIT_VALUE;;
+ u16 signature_flag = 0;
+ u16 rom_version = 0;
+ u8 rom_ver_exp = 0;
+ u8 i = BHY_INIT_VALUE;
+ /* initialize the array*/
+ for (i=0; i < BHY_SIGNATURE_MEM_LEN; i++)
+ {
+ data_from_mem[i] = BHY_INIT_VALUE;
+ }
+ for (i = BHY_INIT_VALUE; i < BHY_RAM_WRITE_LENGTH; i++)
+ {
+ data_byte[i] = BHY_INIT_VALUE;
+ }
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy)
+ {
+ com_rslt = BHY_NULL;
+ }
+ else
+ {
+ /* Assign the memory data into the local array*/
+ for (read_index_u8 = BHY_INIT_VALUE;read_index_u8 <= BHY_SIGNATURE_LENGTH; read_index_u8++)
+ {
+ data_from_mem[read_index_u8] = *(memory+read_index_u8);
+ }
+ /* Verify the signature of the data*/
+ if ((data_from_mem[BHY_SIGNATURE_1] == BHY_IMAGE_SIGNATURE1)
+ && (data_from_mem[BHY_SIGNATURE_2] == BHY_IMAGE_SIGNATURE2))
+ {
+ com_rslt = BHY_SUCCESS;
+ }
+ else
+ {
+ com_rslt = BHY_ERROR;
+ goto bhy_init_from_rom_return;
+ }
+ /* Verify the signature of the data*/
+ signature_flag = data_from_mem[BHY_SIG_FLAG_1_POS] + ((u16)data_from_mem[BHY_SIG_FLAG_2_POS]<<8);
+ rom_ver_exp = BHY_GET_ROMVEREXP (signature_flag);
+ bhy_get_rom_version(&rom_version);
+ if(BHY_ROM_VER_DI01 == rom_ver_exp)
+ {
+ if(BHY_ROM_VERSION_DI01 == rom_version)
+ {
+ com_rslt = BHY_SUCCESS;
+ }
+ else
+ {
+ com_rslt = BHY_RAMPATCH_NOT_MATCH;
+ goto bhy_init_from_rom_return;
+ }
+ }
+ else if(BHY_ROM_VER_DI03 == rom_ver_exp)
+ {
+ if(BHY_ROM_VERSION_DI03 == rom_version)
+ {
+ com_rslt = BHY_SUCCESS;
+ }
+ else
+ {
+ com_rslt = BHY_RAMPATCH_NOT_MATCH;
+ goto bhy_init_from_rom_return;
+ }
+ }
+ else
+ {
+ com_rslt = BHY_RAMPATCH_NOT_SUPPORT;
+ goto bhy_init_from_rom_return;
+ }
+ /* read the CRC data from memory */
+ v_crc_from_memory_u32 = (u32)
+ (((u32)data_from_mem[BHY_CRC_HOST_FILE_MSB]
+ << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |
+ ((u32)data_from_mem[BHY_CRC_HOST_FILE_XXLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ |(data_from_mem[BHY_CRC_HOST_FILE_XLSB]
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (data_from_mem[BHY_CRC_HOST_FILE_LSB]));
+ /* Remove the first 16 bytes*/
+ data_to_process = v_file_length_u32 - BHY_SIGNATURE_LENGTH;
+
+ /* set the reset as 0x01*/
+ com_rslt = bhy_set_reset_request(BHY_RESET_ENABLE);
+ com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR, &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);
+ /* set the upload data*/
+ com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_0_ADDR, &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);
+ com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_1_ADDR, &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);
+ /* write the chip control register as 0x02*/
+ write_length = data_to_process / BHY_RAM_WRITE_LENGTH_API;
+ read_index_u8 = BHY_INIT_VALUE;
+
+ /* write the memory of data */
+ /*skips first 16 bytes*/
+ write_data += 16;
+ if (com_rslt == BHY_SUCCESS)
+ {
+ for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 <= write_length; read_index_u8++)
+ {
+ packet_length = (read_index_u8 == write_length) ?
+ (data_to_process % BHY_RAM_WRITE_LENGTH_API) / BHY_RAM_WRITE_LENGTH :
+ BHY_RAM_WRITE_LENGTH_API / BHY_RAM_WRITE_LENGTH;
+
+ /*reverse the data*/
+ for (reverse_block_index_u32 = 1; reverse_block_index_u32 <=packet_length ;reverse_block_index_u32++)
+ {
+ for (reverse_index_u32 = 0; reverse_index_u32 Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_meta_event(
+u8 v_meta_event_u8,
+u8 v_input_data_u8, u8 v_event_type_u8,
+u8 v_meta_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_meta_bytes_u8 = BHY_INIT_VALUE;
+ /* read the stored meta events using saved parameter bytes*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, v_meta_parameter_request_u8);
+ if (BHY_SUCCESS == com_rslt) {
+ /* switch for selecting the different meta events*/
+ switch (v_meta_event_u8) {
+ /* case for meta event one*/
+ case BHY_META_EVENT_1:
+ /* switch for selecting interrupt or event*/
+ switch (v_event_type_u8) {
+ /* case for event enable*/
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 1, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ /* case for interrupt enable*/
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 1, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 0))) | (v_input_data_u8));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ /* case for meta event 2*/
+ case BHY_META_EVENT_2:
+ /* case for interrupt or event enable*/
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 2, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 2, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ /* case for meta event 3*/
+ case BHY_META_EVENT_3:
+ switch (v_event_type_u8) {
+ /* case for event or interrupt enable*/
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 3, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 3, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ /* case for meta event four*/
+ case BHY_META_EVENT_4:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 4, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 4, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte0(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_5:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 5, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 5, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_6:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 6, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 6, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_7:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 7, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 7, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_8:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 8, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 8, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte1(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_9:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 9, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 9, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_10:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 10, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 10, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_11:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 11, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 11, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_12:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 12, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 12, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte2(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_13:
+ /* set the meta event 13, event enable*/
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 13, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_14:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 14, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 14, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_15:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 15, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 15, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_16:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 16, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 16, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte3(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_17:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 17, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 17, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_18:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 18, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 18, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_19:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 19, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 19, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_20:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 20, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 20, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte4(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_21:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 21, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 21, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_22:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 22, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 22, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_23:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 23, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 23, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_24:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 24, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 24, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte5(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_25:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 25, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 25, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_26:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 26, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 26, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_27:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 27, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 27, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_28:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 28, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 28, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte6(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_29:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 29, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 1)))|(v_input_data_u8 << 1));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 29, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 0)))|(v_input_data_u8 << 0));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_30:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 30, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 3)))|(v_input_data_u8 << 3));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 30, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 2)))|(v_input_data_u8 << 2));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_31:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 31, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 5)))|(v_input_data_u8 << 5));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 31, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 4)))|(v_input_data_u8 << 4));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_32:
+ switch (v_event_type_u8) {
+ case BHY_META_EVENT_ENABLE:
+ /* set the meta event 32, event enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 7)))|(v_input_data_u8 << 7));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ case BHY_META_INTR_ENABLE:
+ /* set the meta event 32, interrupt enable*/
+ v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 6)))|(v_input_data_u8 << 6));
+ bhy_assign_meta_event_byte7(v_meta_bytes_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ /* write the meta event values to the meta event bytes*/
+ com_rslt += bhy_write_parameter_bytes(
+ BHY_PAGE_1, (v_meta_parameter_request_u8+0x80));
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the meta event control from
+ * system page-1 parameter 1
+ *
+ * @param v_meta_event_u8 : The value of meta event selection
+ * meta event | value
+ * --------------------------|---------------
+ * BHY_META_EVENT_1 | 1
+ * BHY_META_EVENT_2 | 2
+ * BHY_META_EVENT_3 | 3
+ * BHY_META_EVENT_4 | 4
+ * BHY_META_EVENT_5 | 5
+ * BHY_META_EVENT_6 | 6
+ * BHY_META_EVENT_7 | 7
+ * BHY_META_EVENT_8 | 8
+ * BHY_META_EVENT_9 | 9
+ * BHY_META_EVENT_10 | 10
+ * BHY_META_EVENT_11 | 11
+ * BHY_META_EVENT_12 | 12
+ * BHY_META_EVENT_13 | 13
+ * BHY_META_EVENT_14 | 14
+ * BHY_META_EVENT_15 | 15
+ * BHY_META_EVENT_16 | 16
+ * BHY_META_EVENT_17 | 17
+ * BHY_META_EVENT_18 | 18
+ * BHY_META_EVENT_19 | 19
+ * BHY_META_EVENT_20 | 20
+ * BHY_META_EVENT_21 | 21
+ * BHY_META_EVENT_22 | 22
+ * BHY_META_EVENT_23 | 23
+ * BHY_META_EVENT_24 | 24
+ * BHY_META_EVENT_25 | 25
+ * BHY_META_EVENT_26 | 26
+ * BHY_META_EVENT_27 | 27
+ * BHY_META_EVENT_28 | 28
+ * BHY_META_EVENT_29 | 29
+ * BHY_META_EVENT_30 | 30
+ * BHY_META_EVENT_31 | 31
+ * BHY_META_EVENT_32 | 32
+ *
+ * @param meta_intr :
+ * The value of meta event interrupt selection
+ *
+ * @param meta_event :
+ * The value of meta event event selection
+ *
+ * @param v_event_type_u8 : The value of
+ * interrupt or event selection
+ * value | Event
+ * -------------------------|----------------
+ * BHY_META_EVENT_INTR_ENABLE | 0
+ * BHY_META_EVENT_ENABLE | 1
+ *
+ * @param v_meta_parameter_request_u8: The value of parameter request
+ * for wakeup or non wakeup fifo
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_meta_event(
+u8 v_meta_event_u8, u8 v_event_type_u8,
+u8* meta_event_intr,
+u8* meta_event_event,
+u8 v_meta_parameter_request_u8)
+{
+/* variable used for return the status of communication result*/
+BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+u8 v_meta_event_byte_0_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_1_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_2_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_3_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_4_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_5_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_6_u8 = BHY_INIT_VALUE;
+u8 v_meta_event_byte_7_u8 = BHY_INIT_VALUE;
+/* check the p_bhy pointer as NULL*/
+if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+} else {
+ /* input as page 1 and parameter 1 for system page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, v_meta_parameter_request_u8);
+ v_meta_event_byte_0_u8 = read_buffer.parameter_1;
+ v_meta_event_byte_1_u8 = read_buffer.parameter_2;
+ v_meta_event_byte_2_u8 = read_buffer.parameter_3;
+ v_meta_event_byte_3_u8 = read_buffer.parameter_4;
+ v_meta_event_byte_4_u8 = read_buffer.parameter_5;
+ v_meta_event_byte_5_u8 = read_buffer.parameter_6;
+ v_meta_event_byte_6_u8 = read_buffer.parameter_7;
+ v_meta_event_byte_7_u8 = read_buffer.parameter_8;
+ switch (v_meta_event_u8) {
+ case BHY_META_EVENT_1:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_0_u8 &
+ BHY_META_EVENT1_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT1_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_2:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT2_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT2_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_3:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT3_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT3_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_4:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT4_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_0_u8 &
+ BHY_META_EVENT4_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_5:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_1_u8 &
+ BHY_META_EVENT5_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT5_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_6:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT6_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT6_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_7:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT7_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT7_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_8:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT8_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_1_u8 &
+ BHY_META_EVENT8_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_9:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_2_u8 &
+ BHY_META_EVENT9_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT9_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_10:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT10_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT10_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_11:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT11_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT11_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_12:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT12_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_2_u8 &
+ BHY_META_EVENT12_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_13:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_3_u8 &
+ BHY_META_EVENT13_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT13_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_14:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT14_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT14_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_15:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT15_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT15_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_16:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT16_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_3_u8 &
+ BHY_META_EVENT16_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_17:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_4_u8 &
+ BHY_META_EVENT17_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT17_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_18:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT18_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT18_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_19:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT19_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT19_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_20:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT20_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_4_u8 &
+ BHY_META_EVENT20_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_21:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_5_u8 &
+ BHY_META_EVENT21_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT21_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_22:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT22_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT22_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_23:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT23_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT23_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_24:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT24_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_5_u8 &
+ BHY_META_EVENT24_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_25:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_6_u8 &
+ BHY_META_EVENT25_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT25_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_26:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT26_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT26_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_27:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT27_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT27_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_28:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT28_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_6_u8 &
+ BHY_META_EVENT28_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_29:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ (v_meta_event_byte_7_u8 &
+ BHY_META_EVENT29_INTR_ENABLE);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT29_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_30:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT30_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT30_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_31:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT31_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT31_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ case BHY_META_EVENT_32:
+ switch (v_event_type_u8) {
+ case BHY_META_INTR_ENABLE:
+ *meta_event_intr = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT32_INTR_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);
+ break;
+ case BHY_META_EVENT_ENABLE:
+ *meta_event_event = (u8)
+ ((v_meta_event_byte_7_u8 &
+ BHY_META_EVENT32_EVENT_ENABLE)
+ >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+}
+return com_rslt;
+}
+/*!
+ * @brief API used to get the fifo water mark from
+ * system page-1 parameter 2
+ *
+ *
+ * @param v_parameter_u8 :
+ * The value of fifo water mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * FIFO_WM_WAKEUP | 0
+ * FIFO_WM_NON_WAKEUP | 1
+ *
+ * @param v_fifo_water_mark_u16: The value of fifo water mark
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_water_mark(u8 v_parameter_u8, u16 *v_fifo_water_mark_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_fifo_wm_wakeup_lsb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_wm_wakeup_msb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_wm_non_wakeup_lsb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_wm_non_wakeup_msb_u8 = BHY_INIT_VALUE;
+ /* input as page 1 and parameter 2 for system page*/
+ com_rslt = bhy_read_parameter_bytes( BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);
+ if (BHY_SUCCESS == com_rslt)
+ {
+ switch (v_parameter_u8)
+ {
+ case BHY_FIFO_WATER_MARK_WAKEUP:
+ /* fifo wakeup water mark*/
+ v_fifo_wm_wakeup_lsb_u8 = read_buffer.parameter_1;
+ v_fifo_wm_wakeup_msb_u8 = read_buffer.parameter_2;
+ *v_fifo_water_mark_u16 = (u16)((v_fifo_wm_wakeup_msb_u8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\
+ |(v_fifo_wm_wakeup_lsb_u8));
+ break;
+ case BHY_FIFO_WATER_MARK_NON_WAKEUP:
+ /* fifo non wakeup water mark*/
+ v_fifo_wm_non_wakeup_lsb_u8 = read_buffer.parameter_5;
+ v_fifo_wm_non_wakeup_msb_u8 = read_buffer.parameter_6;
+ *v_fifo_water_mark_u16 = (u16)((v_fifo_wm_non_wakeup_msb_u8<< BHY_SHIFT_BIT_POSITION_BY_08_BITS)\
+ |(v_fifo_wm_non_wakeup_lsb_u8));
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the fifo water mark from
+ * system page-1 parameter 2
+ *
+ *
+ * @param v_parameter_u8 :
+ * The value of fifo water mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * FIFO_WM_WAKEUP | 0
+ * FIFO_WM_NON_WAKEUP | 1
+ *
+ * @param v_fifo_water_mark_u16: The value of fifo water mark
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_fifo_water_mark(u8 v_parameter_u8, u16 v_fifo_water_mark_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_fifo_wm_lsb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_wm_msb_u8 = BHY_INIT_VALUE;
+ /* read the fifo water mark using saved parameter bytes*/
+ com_rslt = bhy_read_parameter_bytes( BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);
+ if (BHY_SUCCESS == com_rslt)
+ {
+ v_fifo_wm_lsb_u8 = (u8)(v_fifo_water_mark_u16 & BHY_MASK_LSB_DATA);
+ v_fifo_wm_msb_u8 = (u8)((v_fifo_water_mark_u16 & BHY_MASK_MSB_DATA)>> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ switch (v_parameter_u8)
+ {
+ /* fifo wakeup water mark*/
+ case BHY_FIFO_WATER_MARK_WAKEUP:
+ write_buffer.write_parameter_byte1 = v_fifo_wm_lsb_u8;
+ write_buffer.write_parameter_byte2 = v_fifo_wm_msb_u8;
+ write_buffer.write_parameter_byte5 = read_buffer.parameter_5;
+ write_buffer.write_parameter_byte6 = read_buffer.parameter_6;
+ break;
+ /* fifo non wakeup water mark*/
+ case BHY_FIFO_WATER_MARK_NON_WAKEUP:
+ write_buffer.write_parameter_byte1 = read_buffer.parameter_1;
+ write_buffer.write_parameter_byte2 = read_buffer.parameter_2;
+ write_buffer.write_parameter_byte5 = v_fifo_wm_lsb_u8;
+ write_buffer.write_parameter_byte6 = v_fifo_wm_msb_u8;
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ com_rslt += bhy_write_parameter_bytes(
+ BHY_PAGE_1, BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2);
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the fifo size from
+ * system page-1 parameter 2
+ * @note wakeup - bytes from 2 and 3
+ * @note non wakeup - bytes from 6 and 7
+ *
+ *
+ * @param v_fifo_size_select_u8 :
+ * The value of fifo size mark wakeup or non-wakeup selection
+ * water mark | value
+ * --------------------------|---------------
+ * BHY_FIFO_SIZE_WAKEUP | 0
+ * BHY_FIFO_SIZE_NON_WAKEUP | 1
+ *
+ * @param v_fifo_size_u16 : The value of fifo size
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_fifo_size(
+u8 v_fifo_size_select_u8, u16 *v_fifo_size_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_fifo_size_wakeup_lsb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_size_wakeup_msb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_size_non_wakeup_lsb_u8 = BHY_INIT_VALUE;
+ u8 v_fifo_size_non_wakeup_msb_u8 = BHY_INIT_VALUE;
+ /* check the p_bhy pointer as NULL*/
+ if (BHY_NULL_PTR == p_bhy) {
+ com_rslt = BHY_NULL;
+ } else {
+ /* input as page 1 and parameter 2 for system page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);
+ if (BHY_SUCCESS == com_rslt) {
+ switch (v_fifo_size_select_u8) {
+ case BHY_FIFO_SIZE_WAKEUP:
+ /* fifo size in wakeup*/
+ v_fifo_size_wakeup_lsb_u8 =
+ read_buffer.parameter_3;
+ v_fifo_size_wakeup_msb_u8 =
+ read_buffer.parameter_4;
+ *v_fifo_size_u16 =
+ (u16)((v_fifo_size_wakeup_msb_u8
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ |(v_fifo_size_wakeup_lsb_u8));
+ break;
+ case BHY_FIFO_SIZE_NON_WAKEUP:
+ /* fifo size in non wakeup*/
+ v_fifo_size_non_wakeup_lsb_u8 =
+ read_buffer.parameter_7;
+ v_fifo_size_non_wakeup_msb_u8 =
+ read_buffer.parameter_8;
+ *v_fifo_size_u16 =
+ (u16)((v_fifo_size_non_wakeup_msb_u8
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ |(v_fifo_size_non_wakeup_lsb_u8));
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to assign the sensor status bank data
+ *
+ *
+ * @param v_sensor_status_u8 :
+ * The value for saved parameter data
+ *
+ *
+ * @return Nothing
+ *
+ *
+*/
+static void bhy_assign_sensor_status_bank(u8 v_sensor_status_u8)
+{
+ /* Assign the sensor status bank*/
+ /* data available*/
+ sensor_status_bank.data_available = (u8)
+ (v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_DATA_AVAILABLE);
+ /* i2c nack*/
+ sensor_status_bank.i2c_nack = (u8)
+ ((v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_I2C_NACK)
+ >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);
+ /* device id error*/
+ sensor_status_bank.device_id_error = (u8)
+ ((v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_DEVICE_ID_ERROR)
+ >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);
+ /* transient error*/
+ sensor_status_bank.transient_error = (u8)
+ ((v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_TRANSIENT_ERROR)
+ >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);
+ /* data lost*/
+ sensor_status_bank.data_lost = (u8)
+ ((v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_DATA_LOST)
+ >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);
+ /* sensor power mode*/
+ sensor_status_bank.sensor_power_mode = (u8)
+ ((v_sensor_status_u8
+ & BHY_SENSOR_BANK_STATUS_POWER_MODE)
+ >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);
+
+}
+/*!
+ * @brief API used to get the sensor status bank from
+ * system page-1 parameter 3 to 6
+ * @note Sensor status bank 0 : parameter 3 contains 1 to 16 sensor type
+ * @note Sensor status bank 1 : parameter 4 contains 17 to 32 sensor type
+ * @note Sensor status bank 2 : parameter 5 contains 33 to 48 sensor type
+ * @note Sensor status bank 3 : parameter 6 contains 49 to 64 sensor type
+ *
+ *
+ * @param v_sensor_type_u8 :
+ * The value of sensor status bank sensor type selection
+ * v_sensor_type_u8 | value
+ * -----------------------------------|---------------
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1 | 0
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2 | 1
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3 | 3
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4 | 4
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5 | 5
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6 | 6
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7 | 7
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8 | 8
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9 | 9
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10 | 10
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11 | 11
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12 | 12
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13 | 13
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14 | 14
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15 | 15
+ * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16 | 16
+ *
+ *
+ * @param v_sensor_status_parameter_u8 :
+ * The value of sensor status bank parameter selection
+ * parameter | value
+ * -------------------------------|-----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_sensor_status_bank(
+u8 v_sensor_status_parameter_u8, u8 v_sensor_type_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_data_u8 = BHY_INIT_VALUE;
+ /* input as page 1 and parameter
+ 3(4 or 5 or 6)for system page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, v_sensor_status_parameter_u8);
+ if (BHY_SUCCESS == com_rslt) {
+ switch (v_sensor_type_u8) {
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_1;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_2;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_3;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_4;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_5;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_6;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_7;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_8;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_9;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_10;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_11;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_12;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_13;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_14;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_15;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16:
+ /* sensor status of data available*/
+ v_data_u8 = read_buffer.parameter_16;
+ bhy_assign_sensor_status_bank(v_data_u8);
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the host IRQ time
+ * stamp and current time stamp from
+ * system page-1 parameter 30
+ * Host IRQ time stamp bytes 0 to 3
+ * Current time stamp bytes 4 to 7
+ *
+ *
+ * @param v_time_stamp_selection_u8 :
+ * The value of Host IRQ or current time stamp selection
+ * time stamp | value
+ * --------------------------|---------------
+ * BHY_HOST_IRQ_TIMESTAMP | 0
+ * BHY_CURRENT_TIME_STAMP | 1
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ * @param v_time_stamp_u32 :
+ * The value of Host IRQ or current time stamp
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_time_stamp(
+u8 v_time_stamp_selection_u8, u32 *v_time_stamp_u32)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u16 v_lsb_time_u16 = BHY_INIT_VALUE;
+ u16 v_msb_time_u16 = BHY_INIT_VALUE;
+ /* input as page 1 and parameter 30 for system page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_30);
+ if (BHY_SUCCESS == com_rslt) {
+ switch (v_time_stamp_selection_u8) {
+ case BHY_HOST_IRQ_TIMESTAMP:
+ /* host IRQ time stamp*/
+ /* IRQ time stamp lsb data*/
+ v_lsb_time_u16 = (u16)((read_buffer.parameter_2
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_1));
+ /* IRQ time stamp msb data*/
+ v_msb_time_u16 = (u16)((read_buffer.parameter_4
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_3));
+ /* return IRQ time stamp*/
+ *v_time_stamp_u32 = (u32)(((u32)v_msb_time_u16
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ | (v_lsb_time_u16));
+ break;
+ case BHY_CURRENT_TIME_STAMP:
+ /* current time stamp*/
+ /* current time stamp lsb data*/
+ v_lsb_time_u16 = (u16)((read_buffer.parameter_6
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_5));
+ /* current time stamp msb data*/
+ v_msb_time_u16 = (u16)((read_buffer.parameter_8
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_7));
+ /* return current time stamp*/
+ *v_time_stamp_u32 = (u32)(((u32)v_msb_time_u16
+ << BHY_SHIFT_BIT_POSITION_BY_16_BITS)
+ | (v_lsb_time_u16));
+ break;
+ default:
+ com_rslt = BHY_OUT_OF_RANGE;
+ break;
+ }
+ }
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the physical sensor status
+ * system page-1 parameter 31
+ * @note Accel sample rate byte 0 and 1
+ * @note Accel dynamic range byte 2 and 3
+ * @note Accel flags byte 4
+ * @note Gyro sample rate byte 5 and 6
+ * @note Gyro dynamic range byte 7 and 8
+ * @note Gyro flags byte 9
+ * @note Mag sample rate byte 10 and 11
+ * @note Mag dynamic range byte 12 and 13
+ * @note Mag flags byte 14
+ *
+ * @param accel_status : contains the accel physical status
+ * @param gyro_status : contains the gyro physical status
+ * @param mag_status : contains the mag physical status
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_physical_sensor_status(
+struct accel_physical_status_t *accel_status,
+struct gyro_physical_status_t *gyro_status,
+struct mag_physical_status_t *mag_status)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 1 and parameter 31 for system page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_31);
+ /* accel physical status*/
+ /* accl sample rate*/
+ accel_status->accel_sample_rate = (u16)((read_buffer.parameter_2
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_1));
+ /* accel dynamic range*/
+ accel_status->accel_dynamic_range = (u16)((read_buffer.parameter_4
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_3));
+ /* accel flag*/
+ accel_status->accel_flag = read_buffer.parameter_5;
+ /* gyro physical status*/
+ /* gyro sample rate*/
+ gyro_status->gyro_sample_rate = (u16)((read_buffer.parameter_7
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_6));
+ /* accel dynamic range*/
+ gyro_status->gyro_dynamic_range = (u16)((read_buffer.parameter_9
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_8));
+ /* accel flag*/
+ gyro_status->gyro_flag = (u8)(read_buffer.parameter_10);
+ /* mag physical status*/
+ /* mag sample rate*/
+ mag_status->mag_sample_rate = (u16)((read_buffer.parameter_12
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_11));
+ /* mag dynamic range*/
+ mag_status->mag_dynamic_range = (u16)((read_buffer.parameter_14
+ << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_13));
+ /* accel flag*/
+ mag_status->mag_flag = (u8)(read_buffer.parameter_15);
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the non wakeup sensor information,
+ * Sensor page-3 parameter 1 to 31
+ *
+ * @param v_parameter_request_u8 :
+ * Value desired parameter to read non wakeup sensor information
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_1 | 0x01 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_2 | 0x02 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_7 | 0x87 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_8 | 0x88 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_9 | 0x89 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_10 | 0x8A | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_11 | 0x8B | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_12 | 0x8C | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_13 | 0x8D | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_14 | 0x8E | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_15 | 0x8F | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_16 | 0x90 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_17 | 0x91 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_18 | 0x92 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_19 | 0x93 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_20 | 0x94 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_21 | 0x95 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_22 | 0x96 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_23 | 0x97 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_24 | 0x98 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_25 | 0x99 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_31 | 0x9F | Activity
+ *
+ * @param sensor_information :
+ * holds the value of non wakeup sensor information
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_information(
+u8 v_parameter_request_u8,
+struct sensor_information_non_wakeup_t *sensor_information)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 3 and parameter request for sensor page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+ /* sensor type information */
+ sensor_information->non_wakeup_sensor_type
+ = (u8)(read_buffer.parameter_1);
+ /* driver id information */
+ sensor_information->non_wakeup_driver_id =
+ (u8)(read_buffer.parameter_2);
+ /* driver version information */
+ sensor_information->non_wakeup_driver_version =
+ (u8)(read_buffer.parameter_3);
+ /* power information */
+ sensor_information->non_wakeup_power =
+ (u8)(read_buffer.parameter_4);
+ /* maximum range information */
+ sensor_information->non_wakeup_max_range = (u16)
+ ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_5));
+ /* resolution information */
+ sensor_information->non_wakeup_resolution = (u16)
+ ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_7));
+ /* maximum rate information */
+ sensor_information->non_wakeup_max_rate = (u16)
+ ((read_buffer.parameter_10 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_9));
+ /* fifo reserved information */
+ sensor_information->non_wakeup_fifo_reserved = (u16)
+ ((read_buffer.parameter_12 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_11));
+ /* fifo max information */
+ sensor_information->non_wakeup_fifo_max = (u16)
+ ((read_buffer.parameter_14 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_13));
+ /* event size information */
+ sensor_information->non_wakeup_event_size = read_buffer.parameter_15;
+ /* minimum rate information */
+ sensor_information->non_wakeup_min_rate = read_buffer.parameter_16;
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the wakeup sensor information,
+ * Sensor page-3 parameter 32 to 63
+ *
+ * @param v_parameter_request_u8 :
+ * Value desired parameter to read non wakeup sensor information
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_33 | 0xA1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_34 | 0xA2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_35 | 0xA3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_36 | 0xA4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_37 | 0xA5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_38 | 0xA6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_39 | 0xA7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_40 | 0xA8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_41 | 0xA9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_42 | 0xAA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_43 | 0xAB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_44 | 0xAC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_45 | 0xAD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_46 | 0xAE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_47 | 0xAF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_48 | 0xB0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_49 | 0xB1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_50 | 0xB2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_51 | 0xB3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_52 | 0xB4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_53 | 0xB5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_54 | 0xB6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_55 | 0xB7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_56 | 0xB8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_57 | 0xB9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_63 | 0xBF | Activity
+ *
+ * @param sensor_information :
+ * holds the value of non wakeup sensor information
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_information(
+u8 v_parameter_request_u8,
+struct sensor_information_wakeup_t *sensor_information)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 3 and parameter request for sensor page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+ /* sensor type information */
+ sensor_information->wakeup_sensor_type =
+ (u8)(read_buffer.parameter_1);
+ /* driver id information */
+ sensor_information->wakeup_driver_id =
+ (u8)(read_buffer.parameter_2);
+ /* driver version information */
+ sensor_information->wakeup_driver_version =
+ (u8)(read_buffer.parameter_3);
+ /* power information */
+ sensor_information->wakeup_power =
+ (u8)(read_buffer.parameter_4);
+ /* maximum range information */
+ sensor_information->wakeup_max_range = (u16)
+ ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_5));
+ /* resolution information */
+ sensor_information->wakeup_resolution = (u16)
+ ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_7));
+ /* maximum rate information */
+ sensor_information->wakeup_max_rate = (u16)
+ ((read_buffer.parameter_10 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_9));
+ /* fifo reserved information */
+ sensor_information->wakeup_fifo_reserved = (u16)
+ ((read_buffer.parameter_12 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_11));
+ /* fifo max information */
+ sensor_information->wakeup_fifo_max = (u16)
+ ((read_buffer.parameter_14 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_13));
+ /* event size information */
+ sensor_information->wakeup_event_size = read_buffer.parameter_15;
+ /* minimum rate information */
+ sensor_information->wakeup_min_rate = read_buffer.parameter_16;
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the sensor non wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param sensor_configuration : contains the non wakeup sensor configuration
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_non_wakeup_sensor_configuration(
+struct sensor_configuration_non_wakeup_t *sensor_configuration,
+u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* write sample rate*/
+ write_buffer.write_parameter_byte1 = (u8)(
+ sensor_configuration->non_wakeup_sample_rate & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte2 = (u8)(
+ (sensor_configuration->non_wakeup_sample_rate
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write maximum report latency*/
+ write_buffer.write_parameter_byte3 = (u8)(
+ sensor_configuration->non_wakeup_max_report_latency
+ & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte4 = (u8)(
+ (sensor_configuration->non_wakeup_max_report_latency
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write sensitivity*/
+ write_buffer.write_parameter_byte5 = (u8)(
+ sensor_configuration->non_wakeup_change_sensitivity
+ & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte6 = (u8)(
+ (sensor_configuration->non_wakeup_change_sensitivity
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write dynamic range*/
+ write_buffer.write_parameter_byte7 = (u8)(
+ sensor_configuration->non_wakeup_dynamic_range & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte8 = (u8)(
+ (sensor_configuration->non_wakeup_dynamic_range
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* load the parameter of non wakeup sensor configuration*/
+ com_rslt = bhy_write_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the sensor non wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param v_sample_rate_u16 :
+ * contains the non wakeup sample rate data
+ * @param v_max_report_latency_u16:
+ * contains the non wakeup max report latency
+ * @param v_change_sensitivity_u16:
+ * contains the non wakeup sensitivity
+ * @param v_dynamic_range_u16:
+ * contains the non wakeup dynamic range
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * ----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_configuration(
+u8 v_parameter_request_u8,
+u16 *v_sample_rate_u16, u16 *v_max_report_latency_u16,
+u16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 3 and parameter request for sensor page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+ /* sample rate information */
+ *v_sample_rate_u16 = (u16)
+ ((read_buffer.parameter_2 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_1));
+ /* max report latency information */
+ *v_max_report_latency_u16 = (u16)
+ ((read_buffer.parameter_4 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_3));
+ /* sensitivity information */
+ *v_change_sensitivity_u16 = (u16)
+ ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_5));
+ /* dynamic range information */
+ *v_dynamic_range_u16 = (u16)
+ ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_7));
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the sensor wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param sensor_configuration : contains the wakeup sensor configuration
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * -----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_wakeup_sensor_configuration(
+struct sensor_configuration_wakeup_t *sensor_configuration,
+u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* write sample rate*/
+ write_buffer.write_parameter_byte1 = (u8)(
+ sensor_configuration->wakeup_sample_rate & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte2 = (u8)(
+ (sensor_configuration->wakeup_sample_rate
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write maximum report latency*/
+ write_buffer.write_parameter_byte3 = (u8)(
+ sensor_configuration->wakeup_max_report_latency & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte4 = (u8)(
+ (sensor_configuration->wakeup_max_report_latency
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write change sensitivity*/
+ write_buffer.write_parameter_byte5 = (u8)(
+ sensor_configuration->wakeup_change_sensitivity & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte6 = (u8)(
+ (sensor_configuration->wakeup_change_sensitivity
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* write dynamic range*/
+ write_buffer.write_parameter_byte7 = (u8)(
+ sensor_configuration->wakeup_dynamic_range & BHY_MASK_LSB_DATA);
+ write_buffer.write_parameter_byte8 = (u8)(
+ (sensor_configuration->wakeup_dynamic_range
+ & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);
+ /* load the parameter of non wakeup sensor configuration*/
+ com_rslt = bhy_write_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the sensor wakeup configuration
+ * Sensor page-3 parameter 65 to 89
+ *
+ * @param v_sample_rate_u16 : contains the wakeup sample rate data
+ * @param v_max_report_latency_u16: contains the wakeup max report latency
+ * @param v_change_sensitivity_u16: contains the wakeup sensitivity
+ * @param v_dynamic_range_u16: contains the wakeup dynamic range
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * param_request | value | Virtual sensor
+ * -----------------------------------|-------|----------------
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture
+ * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_configuration(
+u8 v_parameter_request_u8,
+u16 *v_sample_rate_u16, u16 *v_max_report_latency_u16,
+u16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 3 and parameter request for sensor page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_3, v_parameter_request_u8);
+ /* sample rate information */
+ *v_sample_rate_u16 = (u16)
+ ((read_buffer.parameter_2 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_1));
+ /* max report latency information */
+ *v_max_report_latency_u16 = (u16)
+ ((read_buffer.parameter_4 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_3));
+ /* sensitivity information */
+ *v_change_sensitivity_u16 = (u16)
+ ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_5));
+ /* dynamic range information */
+ *v_dynamic_range_u16 = (u16)
+ ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)
+ | (read_buffer.parameter_7));
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to get the soft pass through
+ * Sensor page-15 parameter 0 to 7
+ *
+ * @param soft_pass_through :
+ * contains the value of soft pass through
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * parameter | value
+ * ------------------------------------|--------------------
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03
+ *
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_get_soft_pass_through(
+struct soft_pass_through_read_t *soft_pass_through,
+u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* input as page 3 and parameter request for sensor page*/
+ com_rslt = bhy_read_parameter_bytes(
+ BHY_PAGE_15, v_parameter_request_u8);
+ /* i2c slave address information */
+ soft_pass_through->i2c_slave_address =
+ (u8)(read_buffer.parameter_1);
+ /* start register information */
+ soft_pass_through->start_register =
+ (u8)(read_buffer.parameter_2);
+ /* read length information */
+ soft_pass_through->read_length =
+ (u8)(read_buffer.parameter_3);
+ /* completion status information */
+ soft_pass_through->completion_status =
+ (u8)(read_buffer.parameter_4);
+ /* return register value 1 information */
+ soft_pass_through->reg_value_byte1 =
+ (u8)(read_buffer.parameter_5);
+ /* return register value 2 information */
+ soft_pass_through->reg_value_byte2 =
+ (u8)(read_buffer.parameter_6);
+ /* return register value 3 information */
+ soft_pass_through->reg_value_byte3 =
+ (u8)(read_buffer.parameter_7);
+ /* return register value 4 information */
+ soft_pass_through->reg_value_byte4 =
+ (u8)(read_buffer.parameter_8);
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the soft pass through
+ * Sensor page-15 parameter 0 to 7
+ *
+ * @param soft_pass_through :
+ * contains the value of soft pass through
+ *
+ * @param v_parameter_request_u8: value of selected parameter request
+ * parameter | value
+ * ------------------------------------|--------------------
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02
+ * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_set_soft_pass_through(
+struct soft_pass_through_write_t *soft_pass_through,
+u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ /* i2c slave address information */
+ write_buffer.write_parameter_byte1 =
+ soft_pass_through->i2c_slave_address;
+ /* start register information */
+ write_buffer.write_parameter_byte2 =
+ soft_pass_through->start_register;
+ /* write length information */
+ write_buffer.write_parameter_byte3 =
+ soft_pass_through->write_length;
+ /* completion status information */
+ write_buffer.write_parameter_byte4 =
+ soft_pass_through->completion_status;
+ /* return register value 1 information */
+ write_buffer.write_parameter_byte5 =
+ soft_pass_through->reg_value_byte1;
+ /* return register value 2 information */
+ write_buffer.write_parameter_byte6 =
+ soft_pass_through->reg_value_byte2;
+ /* return register value 3 information */
+ write_buffer.write_parameter_byte7 =
+ soft_pass_through->reg_value_byte3;
+ /* return register value 4 information */
+ write_buffer.write_parameter_byte8 =
+ soft_pass_through->reg_value_byte4;
+ /* load the parameter of soft
+ pass through sensor configuration*/
+ com_rslt = bhy_write_parameter_bytes(
+ BHY_PAGE_15, v_parameter_request_u8);
+ return com_rslt;
+}
+
+/*!
+ * @brief API used to get the data from the parameter
+ * I2C page register from 0x3B to 0x4A
+ *
+ *
+ * @param v_page_select_u8 : This input value for set the desired page
+ * @param v_parameter_request_u8 :
+ * This input value for set the desired parameter
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_read_parameter_bytes(
+u8 v_page_select_u8, u8 v_parameter_request_u8)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_parameter_ack_u8 = BHY_INIT_VALUE;
+ u8 init_array_data = BHY_INIT_VALUE;
+ u8 a_read_data_u8[BHY_READ_BUFFER_SIZE];
+ u8 v_parameter_ack_check_u8 = BHY_INIT_VALUE;
+
+ for (; init_array_data < BHY_READ_BUFFER_SIZE; init_array_data++)
+ a_read_data_u8[init_array_data] = BHY_INIT_VALUE;
+ /* select the page*/
+ com_rslt = bhy_set_parameter_page_select(v_page_select_u8);
+ /* select the parameter*/
+ com_rslt += bhy_set_parameter_request(v_parameter_request_u8);
+ /* read the values*/
+ for (v_parameter_ack_check_u8 = BHY_INIT_VALUE;
+ v_parameter_ack_check_u8 < BHY_PARAMETER_ACK_LENGTH;
+ v_parameter_ack_check_u8++) {
+ /* read acknowledgement*/
+ com_rslt = bhy_get_parameter_acknowledge(&v_parameter_ack_u8);
+ if (v_parameter_ack_u8 == v_parameter_request_u8) {
+ break;
+ } else if (v_parameter_ack_u8 == BHY_PARAMETER_ACK_CHECK) {
+ p_bhy->delay_msec(BHY_PARAMETER_ACK_DELAY);
+ com_rslt = BHY_ERROR;
+ } else {
+ /* device not ready yet */
+ p_bhy->delay_msec(1);
+ }
+ }
+ com_rslt =
+ p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO,
+ a_read_data_u8, BHY_READ_BUFFER_LENGTH);
+ read_buffer.parameter_1 =
+ a_read_data_u8[BHY_READ_BUFFER_1_REG];
+ read_buffer.parameter_2 =
+ a_read_data_u8[BHY_READ_BUFFER_2_REG];
+ read_buffer.parameter_3 =
+ a_read_data_u8[BHY_READ_BUFFER_3_REG];
+ read_buffer.parameter_4 =
+ a_read_data_u8[BHY_READ_BUFFER_4_REG];
+ read_buffer.parameter_5 =
+ a_read_data_u8[BHY_READ_BUFFER_5_REG];
+ read_buffer.parameter_6 =
+ a_read_data_u8[BHY_READ_BUFFER_6_REG];
+ read_buffer.parameter_7 =
+ a_read_data_u8[BHY_READ_BUFFER_7_REG];
+ read_buffer.parameter_8 =
+ a_read_data_u8[BHY_READ_BUFFER_8_REG];
+ read_buffer.parameter_9 =
+ a_read_data_u8[BHY_READ_BUFFER_9_REG];
+ read_buffer.parameter_10 =
+ a_read_data_u8[BHY_READ_BUFFER_10_REG];
+ read_buffer.parameter_11 =
+ a_read_data_u8[BHY_READ_BUFFER_11_REG];
+ read_buffer.parameter_12 =
+ a_read_data_u8[BHY_READ_BUFFER_12_REG];
+ read_buffer.parameter_13 =
+ a_read_data_u8[BHY_READ_BUFFER_13_REG];
+ read_buffer.parameter_14 =
+ a_read_data_u8[BHY_READ_BUFFER_14_REG];
+ read_buffer.parameter_15 =
+ a_read_data_u8[BHY_READ_BUFFER_15_REG];
+ read_buffer.parameter_16 =
+ a_read_data_u8[BHY_READ_BUFFER_16_REG];
+
+ return com_rslt;
+}
+/*!
+ * @brief API used to set the data from the parameter
+ * I2C page register from 0x5C to 0x63
+ *
+ *
+ * @param v_page_select_u8 : This input value for set the desired page
+ * @param v_parameter_request_u8 :
+ * This input value for set the desired parameter
+ *
+ * @return results of bus communication function
+ * @retval 0 -> Success
+ * @retval -1 -> Error
+ *
+ *
+*/
+BHY_RETURN_FUNCTION_TYPE bhy_write_parameter_bytes(
+u8 v_page_select_u8, u8 v_parameter_request_u8)
+{
+/* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+ u8 v_parameter_ack_u8 = BHY_INIT_VALUE;
+ u8 v_parameter_ack_check_u8 = BHY_INIT_VALUE;
+ u8 v_write_parameter_byte_u8[BHY_WRITE_BUFFER_SIZE];
+ u8 init_array_data = BHY_INIT_VALUE;
+
+ for (; init_array_data < BHY_WRITE_BUFFER_SIZE; init_array_data++)
+ v_write_parameter_byte_u8[init_array_data] = BHY_INIT_VALUE;
+ /* check the p_bhy structure as NULL*/
+ if (p_bhy == BHY_NULL) {
+ return BHY_NULL;
+ } else {
+ /* Assign the load parameters*/
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_1_REG]
+ = write_buffer.write_parameter_byte1;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_2_REG]
+ = write_buffer.write_parameter_byte2;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_3_REG]
+ = write_buffer.write_parameter_byte3;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_4_REG]
+ = write_buffer.write_parameter_byte4;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_5_REG]
+ = write_buffer.write_parameter_byte5;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_6_REG]
+ = write_buffer.write_parameter_byte6;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_7_REG]
+ = write_buffer.write_parameter_byte7;
+ v_write_parameter_byte_u8[BHY_WRITE_BUFFER_8_REG]
+ = write_buffer.write_parameter_byte8;
+ /* write values to the load address*/
+ com_rslt = p_bhy->BHY_BUS_WRITE_FUNC
+ (p_bhy->device_addr,
+ BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO,
+ &v_write_parameter_byte_u8[BHY_WRITE_BUFFER_1_REG],
+ BHY_WRITE_BUFFER_SIZE);
+ /* select the page*/
+ com_rslt += bhy_set_parameter_page_select(v_page_select_u8);
+ /* select the parameter*/
+ com_rslt += bhy_set_parameter_request(v_parameter_request_u8);
+ for (v_parameter_ack_check_u8 = BHY_INIT_VALUE;
+ v_parameter_ack_check_u8 < BHY_PARAMETER_ACK_LENGTH;
+ v_parameter_ack_check_u8++) {
+ /* read the acknowledgement*/
+ com_rslt += bhy_get_parameter_acknowledge(
+ &v_parameter_ack_u8);
+ if (v_parameter_ack_u8 == v_parameter_request_u8) {
+ com_rslt += BHY_SUCCESS;
+ break;
+ } else if (v_parameter_ack_u8
+ == BHY_PARAMETER_ACK_CHECK) {
+ p_bhy->delay_msec(BHY_PARAMETER_ACK_DELAY);
+ com_rslt += BHY_ERROR;
+ } else {
+ /* device not ready yet */
+ p_bhy->delay_msec(1);
+ }
+ }
+
+ }
+ return com_rslt;
+}
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_support.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_support.c
new file mode 100644
index 0000000..924ef1d
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_support.c
@@ -0,0 +1,133 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ *
+ * @file bhy_support.c
+ *
+ * @date 12/19/2016
+ *
+ * @brief driver on MCU for bhy
+ *
+ *
+ */
+
+
+/********************************************************************************/
+/* HEADER FILES */
+/********************************************************************************/
+#include "m2mb_types.h"
+#include "azx_utils.h"
+
+#include "bhy_support.h"
+#include "bhy_uc_driver_config.h"
+
+/********************************************************************************/
+/* STATIC VARIABLES */
+/********************************************************************************/
+static struct bhy_t bhy;
+static uint8_t *version = (uint8_t *) BHY_MCU_REFERENCE_VERSION;
+
+/********************************************************************************/
+/* EXTERN FUNCTION DECLARATIONS */
+/********************************************************************************/
+extern int8_t sensor_i2c_write(uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size);
+extern int8_t sensor_i2c_read(uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size);
+extern void trace_log(const char *fmt, ...);
+
+/********************************************************************************/
+/* FUNCTION DECLARATIONS */
+/********************************************************************************/
+/*!
+* @brief Initializes BHY smart sensor and its required connections
+*
+*/
+int8_t bhy_initialize_support(void)
+{
+ uint8_t tmp_retry = RETRY_NUM;
+
+ bhy.bus_write = &sensor_i2c_write;
+ bhy.bus_read = &sensor_i2c_read;
+ bhy.delay_msec = &bhy_delay_msec;
+ bhy.device_addr = BHY_I2C_SLAVE_ADDRESS;
+
+ bhy_init(&bhy);
+
+ bhy_set_reset_request(BHY_RESET_ENABLE);;
+
+ while(tmp_retry--)
+ {
+ bhy_get_product_id(&bhy.product_id);
+
+ if(PRODUCT_ID_7183 == bhy.product_id)
+ {
+ return BHY_SUCCESS;
+ }
+
+ bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);
+ }
+
+ return BHY_PRODUCT_ID_ERROR;
+}
+/*!
+* @brief Initiates a delay of the length of the argument in milliseconds
+*
+* @param[in] msec Delay length in terms of milliseconds
+*
+*/
+void bhy_delay_msec(uint32_t msec)
+{
+ azx_sleep_ms(msec);
+}
+/*!
+ * @brief provides a print function to the bhy driver on DD2.0 platform
+ */
+void bhy_printf(const u8 * string)
+{
+ trace_log("%s",string);
+}
+/*!
+ * @brief provides the mcu reference code version
+ */
+uint8_t * bhy_get_version(void)
+{
+ return (version);
+}
+/** @}*/
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_uc_driver.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_uc_driver.c
new file mode 100644
index 0000000..e266161
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BHI160/src/bhy_uc_driver.c
@@ -0,0 +1,1646 @@
+/*!
+ * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names of the
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * The information provided is believed to be accurate and reliable.
+ * The copyright holder assumes no responsibility
+ * for the consequences of use
+ * of such information nor for any infringement of patents or
+ * other rights of third parties which may result from its use.
+ * No license is granted by implication or otherwise under any patent or
+ * patent rights of the copyright holder.
+ *
+ *
+ * @file bhy_uc_driver.c
+ *
+ * @date 12/19/2016
+ *
+ * @brief driver on MCU for bhy
+ *
+ *
+ */
+
+/********************************************************************************/
+/* HEADER FILES */
+/********************************************************************************/
+#include "bhy_uc_driver.h"
+
+
+/********************************************************************************/
+/* MACROS */
+/********************************************************************************/
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/* firmware download retry time */
+#define BHY_INIT_RETRY_COUNT 3
+/* these FIFO sizes are dependent on the type enumeration */
+/* do not change the order */
+#define BHY_DATA_SIZE_PADDING 1
+#define BHY_DATA_SIZE_QUATERNION 11
+#define BHY_DATA_SIZE_VECTOR 8
+#define BHY_DATA_SIZE_SCALAR_U8 2
+#define BHY_DATA_SIZE_SCALAR_U16 3
+#define BHY_DATA_SIZE_SCALAR_S16 3
+#define BHY_DATA_SIZE_SCALAR_U24 4
+#define BHY_DATA_SIZE_SENSOR_EVENT 1
+#define BHY_DATA_SIZE_UNCALIB_VECTOR 14
+#define BHY_DATA_SIZE_META_EVENT 4
+#define BHY_DATA_SIZE_BSX 17
+#define BHY_DATA_SIZE_DEBUG 14
+
+/* set default custom sensor packet size to 1, same as padding */
+#define BHY_DATA_SIZE_CUS1 1
+#define BHY_DATA_SIZE_CUS2 1
+#define BHY_DATA_SIZE_CUS3 1
+#define BHY_DATA_SIZE_CUS4 1
+#define BHY_DATA_SIZE_CUS5 1
+
+#define MAX_PAGE_NUM 15
+#define MAX_SENSOR_ID 0x20
+#define MAX_SENSOR_ID_NONWAKEUP 0x3F
+#define MAX_WRITE_BYTES 8
+#define SENSOR_CALLBACK_LIST_NUM 64
+#define TIMESTAMP_CALLBACK_LIST_NUM 2
+#define METAEVENT_CALLBACK_LIST_NUM 32
+#define SENSOR_PARAMETER_WRITE 0xC0
+#define MAX_METAEVENT_ID 17
+
+/********************************************************************************/
+/* GLOBAL VARIABLES */
+/********************************************************************************/
+
+/* these FIFO sizes are dependent on the enumeration above */
+/* do not change the order */
+uint8_t _fifoSizes[] = {
+ BHY_DATA_SIZE_PADDING,
+ BHY_DATA_SIZE_QUATERNION,
+ BHY_DATA_SIZE_VECTOR,
+ BHY_DATA_SIZE_SCALAR_U8,
+ BHY_DATA_SIZE_SCALAR_U16,
+ BHY_DATA_SIZE_SCALAR_S16,
+ BHY_DATA_SIZE_SCALAR_U24,
+ BHY_DATA_SIZE_SENSOR_EVENT,
+ BHY_DATA_SIZE_UNCALIB_VECTOR,
+ BHY_DATA_SIZE_META_EVENT,
+ BHY_DATA_SIZE_BSX,
+ BHY_DATA_SIZE_DEBUG,
+ BHY_DATA_SIZE_CUS1,
+ BHY_DATA_SIZE_CUS2,
+ BHY_DATA_SIZE_CUS3,
+ BHY_DATA_SIZE_CUS4,
+ BHY_DATA_SIZE_CUS5,
+};
+
+#if BHY_CALLBACK_MODE
+/* The callback feature is a type of software interrupt. */
+/* The driver keeps in RAM an array of function pointers */
+/* for every sensor ID, wakeup and non-wakeup, every meta */
+/* event, and both wakeup and non-wakeup timestamps. When */
+/* parsing the fifo within the bhy_parse_next_fifo_packet */
+/* function, it will jump into the callback if the pointer */
+/* is non-null. */
+/* to sort through the array, it use either the sensor_id */
+/* or the event id. */
+
+static void (*sensor_callback_list[SENSOR_CALLBACK_LIST_NUM])(bhy_data_generic_t *, bhy_virtual_sensor_t) = {0};
+static void (*timestamp_callback_list[TIMESTAMP_CALLBACK_LIST_NUM])(bhy_data_scalar_u16_t *) = {0};
+static void (*meta_event_callback_list[METAEVENT_CALLBACK_LIST_NUM])(bhy_data_meta_event_t *, bhy_meta_event_type_t) = {0};
+#endif
+
+//extern void trace_log(const char *fmt, ...);
+
+
+/********************************************************************************/
+/* FUNCTIONS */
+/********************************************************************************/
+
+/*!
+ * @brief This function initializes the driver, the API and loads the ram patch into the sensor
+ *
+ * @param[in] bhy_fw_data pointer to the firmware of bhy
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_driver_init(const uint8_t *bhy_fw_data)
+{
+ uint32_t tmp_fw_len = 0;
+ int8_t init_retry_count = BHY_INIT_RETRY_COUNT;
+ BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;
+
+ /* get fw lenght */
+ tmp_fw_len = 16 + bhy_fw_data[12] + (256 * bhy_fw_data[13]);
+
+ /* retry BHY_INIT_RETRY_COUNT times to avoid firmware download fail*/
+ while (init_retry_count > 0)
+ {
+ bhy_initialize_support();
+
+ /* downloads the ram patch to the BHy */
+ result += bhy_initialize_from_rom(bhy_fw_data, /*bhy_fw_len*/tmp_fw_len);
+
+ if (result == BHY_SUCCESS)
+ {
+ break;
+ }
+
+ init_retry_count--;
+ }
+
+ return result;
+}
+
+/*!
+ * @brief this function configures meta event
+ *
+ * @param[in] meta_event_id ID of meta event
+ * @param[in] fifo_sel to choose the FIFO
+ * @param[in] enable_state enable state of bhy
+ * @param[in] int_enable_state enable state of interrupt
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_meta_event_set_config(bhy_meta_event_type_t meta_event_id,
+ bhy_meta_event_fifo_type_t fifo_sel,
+ uint8_t enable_state, uint8_t int_enable_state)
+{
+ BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;
+
+ result += bhy_set_meta_event(meta_event_id, enable_state, BHY_META_EVENT_ENABLE, fifo_sel);
+ result += bhy_set_meta_event(meta_event_id, int_enable_state, BHY_META_INTR_ENABLE, fifo_sel);
+
+ return result;
+}
+
+/*!
+ * @brief this function gets configuration from specific meta event
+ *
+ * @param[in] meta_event_id ID of meta event
+ * @param[in] fifo_sel to choose the FIFO
+ * @param[in] p_enable_state pointer of enable state of bhy
+ * @param[in] p_int_enable_state pointer of the enable state of interrupt
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_meta_event_get_config(bhy_meta_event_type_t meta_event_id,
+ bhy_meta_event_fifo_type_t fifo_sel,
+ uint8_t *p_enable_state, uint8_t *p_int_enable_state)
+{
+ BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;
+
+ result += bhy_get_meta_event(meta_event_id, BHY_META_EVENT_ENABLE, p_int_enable_state, p_enable_state, fifo_sel);
+ result += bhy_get_meta_event(meta_event_id, BHY_META_INTR_ENABLE, p_int_enable_state, p_enable_state, fifo_sel);
+
+ return result;
+}
+
+/*!
+ * @brief this functions enables the selected virtual sensor
+ *
+ * @param[in] sensor_id sensor ID
+ * @param[in] wakeup_status status after wakeup
+ * @param[in] sample_rate sample rate
+ * @param[in] max_report_latency_ms max report latency,unit is millisecond
+ * @param[in] flush_sensor how to flush the fifo of sensor
+ * @param[in] change_sensitivity whether to change the sensitivity
+ * @param[in] dynamic_range dynamic range
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status,
+ uint16_t sample_rate, uint16_t max_report_latency_ms,
+ uint8_t flush_sensor, uint16_t change_sensitivity,
+ uint16_t dynamic_range)
+{
+ uint16_t int_sensor_id = sensor_id;
+ BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;
+ union
+ {
+ struct sensor_configuration_wakeup_t sensor_configuration_wakeup;
+ struct sensor_configuration_non_wakeup_t sensor_configuration_non_wakeup;
+ } sensor_configuration;
+
+ /* checks if sensor id is in range */
+ if ((uint8_t)sensor_id >= MAX_SENSOR_ID)
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ /*computes the sensor id */
+ int_sensor_id = int_sensor_id + wakeup_status;
+
+ /* flush the fifo if requested */
+ switch (flush_sensor)
+ {
+ case VS_FLUSH_SINGLE:
+ result += bhy_set_fifo_flush(int_sensor_id);
+ break;
+ case VS_FLUSH_ALL:
+ result += bhy_set_fifo_flush(VS_FLUSH_ALL);
+ break;
+ case VS_FLUSH_NONE:
+ break;
+ default:
+ return BHY_OUT_OF_RANGE;
+ }
+
+ /* computes the param page as sensor_id + 0xC0 (sensor parameter write)*/
+ int_sensor_id = int_sensor_id + SENSOR_PARAMETER_WRITE;
+
+ /*calls the right function */
+ switch (wakeup_status)
+ {
+ case VS_NON_WAKEUP:
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_sample_rate = sample_rate;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_max_report_latency = max_report_latency_ms;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_change_sensitivity = change_sensitivity;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_dynamic_range = dynamic_range;
+ result += bhy_set_non_wakeup_sensor_configuration( &sensor_configuration.sensor_configuration_non_wakeup, int_sensor_id);
+ return result;
+ case VS_WAKEUP:
+ sensor_configuration.sensor_configuration_wakeup.wakeup_sample_rate = sample_rate;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_max_report_latency = max_report_latency_ms;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_change_sensitivity = change_sensitivity;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_dynamic_range = dynamic_range;
+ result += bhy_set_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_wakeup, int_sensor_id);
+ return result;
+ default:
+ return BHY_OUT_OF_RANGE;
+ }
+}
+
+/*!
+ * @brief this functions disables the selected virtual sensor
+ *
+ * @param[in] sensor_id sensor ID
+ * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_disable_virtual_sensor(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status)
+{
+ uint16_t int_sensor_id = sensor_id;
+
+ union
+ {
+ struct sensor_configuration_wakeup_t sensor_configuration_wakeup;
+ struct sensor_configuration_non_wakeup_t sensor_configuration_non_wakeup;
+ } sensor_configuration;
+
+ /* checks if sensor id is in range */
+ if (sensor_id >= MAX_SENSOR_ID)
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ /* computes the param page as */
+ /* wakeup_status + sensor_id + 0xC0 (sensor parameter write) */
+ int_sensor_id = int_sensor_id + SENSOR_PARAMETER_WRITE;
+
+ /*calls the right function */
+ switch (wakeup_status)
+ {
+ case VS_NON_WAKEUP:
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_sample_rate = 0;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_max_report_latency = 0;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_change_sensitivity = 0;
+ sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_dynamic_range = 0;
+ return bhy_set_non_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_non_wakeup, int_sensor_id);
+
+ case VS_WAKEUP:
+ sensor_configuration.sensor_configuration_wakeup.wakeup_sample_rate = 0;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_max_report_latency = 0;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_change_sensitivity = 0;
+ sensor_configuration.sensor_configuration_wakeup.wakeup_dynamic_range = 0;
+ return bhy_set_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_wakeup, int_sensor_id);
+
+ default:
+ return BHY_OUT_OF_RANGE;
+ }
+}
+
+/*!
+ * @brief this functions retrieves the fifo data,it needs a buffer of at least (BHY_I2C_REG_BUFFER_LENGTH + 1) bytes to work.
+ * it outputs the data into the variable buffer. the number of bytes read.
+ *
+ * @param[in] buffer pointer of buffer
+ * @param[in] buffer_size size of the buffer in bytes
+ * @param[out] bytes_read the bytes in fifo which have been read
+ * @param[out] bytes_left the bytes left in fifo which have not been read
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_read_fifo(uint8_t *buffer, uint16_t buffer_size, uint16_t *bytes_read, uint16_t *bytes_left)
+{
+ BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;
+ static uint16_t current_index = 0;
+ static uint16_t current_transaction_size = 0;
+
+ if (buffer_size <= BHY_I2C_REG_BUFFER_LENGTH)
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ /* gets the number of bytes left in the fifo either from memory of from */
+ /* the register */
+ if (current_transaction_size == 0)
+ {
+ result = bhy_read_bytes_remaining(¤t_transaction_size);
+ }
+
+ /* if there are bytes in the fifo to read */
+ if (current_transaction_size)
+ {
+ /* calculates the number of bytes to read. either the number of */
+ /* bytes left, or the buffer size, or just enough so the last page */
+ /* does not get turned */
+ if (buffer_size >= current_transaction_size - current_index)
+ {
+ *bytes_read = current_transaction_size - current_index;
+ }
+ else if (current_transaction_size - (current_index+buffer_size) <= BHY_I2C_REG_BUFFER_LENGTH)
+ {
+ *bytes_read = (current_transaction_size - (BHY_I2C_REG_BUFFER_LENGTH + 1)) - current_index;
+ }
+ else
+ {
+ *bytes_read = buffer_size;
+ }
+
+ result += bhy_read_reg(current_index % BHY_I2C_REG_BUFFER_LENGTH, buffer, *bytes_read);
+
+ current_index += *bytes_read;
+
+ (*bytes_left) = current_transaction_size - current_index;
+
+ if ((*bytes_left) == 0)
+ {
+ current_index = 0;
+ current_transaction_size = 0;
+ }
+
+ }
+ else
+ {
+ (*bytes_read) = 0;
+ (*bytes_left) = 0;
+ return result;
+ }
+
+ return result;
+}
+
+/*!
+ * @brief this functions parse the packet in fifo and get the actual fifo data of sensors
+ *
+ *
+ * @param[in] fifo_buffer pointer of fifo
+ * @param[in] fifo_buffer_length size of the fifo
+ * @param[out] fifo_data_output the actual fifo data of sensors
+ * @param[out] fifo_data_type data type of fifo data
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_parse_next_fifo_packet (uint8_t **fifo_buffer, uint16_t *fifo_buffer_length,
+ bhy_data_generic_t * fifo_data_output,
+ bhy_data_type_t * fifo_data_type)
+{
+ uint16_t i = 0;
+
+ if ((*fifo_buffer_length) == 0)
+ {
+ /* there are no more bytes in the fifo buffer to read */
+ return BHY_SUCCESS;
+ }
+
+ /* the first fifo byte should be a known virtual sensor ID */
+ switch (**fifo_buffer)
+ {
+ case VS_ID_PADDING:
+ (*fifo_data_type) = BHY_DATA_TYPE_PADDING;
+ fifo_data_output->data_padding.sensor_id = (**fifo_buffer);
+ break;
+
+ case VS_ID_ROTATION_VECTOR:
+ case VS_ID_ROTATION_VECTOR_WAKEUP:
+ case VS_ID_GAME_ROTATION_VECTOR:
+ case VS_ID_GAME_ROTATION_VECTOR_WAKEUP:
+ case VS_ID_GEOMAGNETIC_ROTATION_VECTOR:
+ case VS_ID_GEOMAGNETIC_ROTATION_VECTOR_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_QUATERNION])
+ return BHY_OUT_OF_RANGE;
+ (*fifo_data_type) = BHY_DATA_TYPE_QUATERNION;
+ fifo_data_output->data_quaternion.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_quaternion.x =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));
+ fifo_data_output->data_quaternion.y =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));
+ fifo_data_output->data_quaternion.z =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));
+ fifo_data_output->data_quaternion.w =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 7)) | ((uint16_t)*((*fifo_buffer) + 8) << 8));
+ fifo_data_output->data_quaternion.estimated_accuracy =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 9)) | ((uint16_t)*((*fifo_buffer) + 10) << 8));
+ break;
+
+ case VS_ID_ACCELEROMETER:
+ case VS_ID_ACCELEROMETER_WAKEUP:
+ case VS_ID_MAGNETOMETER:
+ case VS_ID_MAGNETOMETER_WAKEUP:
+ case VS_ID_ORIENTATION:
+ case VS_ID_ORIENTATION_WAKEUP:
+ case VS_ID_GYROSCOPE:
+ case VS_ID_GYROSCOPE_WAKEUP:
+ case VS_ID_GRAVITY:
+ case VS_ID_GRAVITY_WAKEUP:
+ case VS_ID_LINEAR_ACCELERATION:
+ case VS_ID_LINEAR_ACCELERATION_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_VECTOR])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_VECTOR;
+ fifo_data_output->data_vector.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_vector.x =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));
+ fifo_data_output->data_vector.y =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));
+ fifo_data_output->data_vector.z =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));
+ fifo_data_output->data_vector.status = *((*fifo_buffer) + 7);
+ break;
+
+ case VS_ID_HEART_RATE:
+ case VS_ID_HEART_RATE_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U8])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U8;
+ fifo_data_output->data_scalar_u8.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_scalar_u8.data = *((*fifo_buffer) + 1);
+ break;
+
+ case VS_ID_LIGHT:
+ case VS_ID_LIGHT_WAKEUP:
+ case VS_ID_PROXIMITY:
+ case VS_ID_PROXIMITY_WAKEUP:
+ case VS_ID_HUMIDITY:
+ case VS_ID_HUMIDITY_WAKEUP:
+ case VS_ID_STEP_COUNTER:
+ case VS_ID_STEP_COUNTER_WAKEUP:
+ case VS_ID_ACTIVITY:
+ case VS_ID_ACTIVITY_WAKEUP:
+ case VS_ID_TIMESTAMP_LSW:
+ case VS_ID_TIMESTAMP_LSW_WAKEUP:
+ case VS_ID_TIMESTAMP_MSW:
+ case VS_ID_TIMESTAMP_MSW_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U16])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U16;
+ fifo_data_output->data_scalar_u16.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_scalar_u16.data =
+ (uint16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));
+ break;
+
+ case VS_ID_TEMPERATURE:
+ case VS_ID_TEMPERATURE_WAKEUP:
+ case VS_ID_AMBIENT_TEMPERATURE:
+ case VS_ID_AMBIENT_TEMPERATURE_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_S16])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_S16;
+ fifo_data_output->data_scalar_s16.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_scalar_s16.data =
+ (int16_t)(((uint16_t)*(*fifo_buffer + 1)) | ((uint16_t)*(*fifo_buffer + 2) << 8));
+ break;
+
+ case VS_ID_BAROMETER:
+ case VS_ID_BAROMETER_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U24])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U24;
+ fifo_data_output->data_scalar_u24.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_scalar_u24.data =
+ (uint32_t)(((uint32_t)*((*fifo_buffer) + 1)) | ((uint32_t)*((*fifo_buffer) + 2) << 8) |
+ ((uint32_t)*((*fifo_buffer) + 3) << 16));
+ break;
+
+ case VS_ID_SIGNIFICANT_MOTION:
+ case VS_ID_SIGNIFICANT_MOTION_WAKEUP:
+ case VS_ID_STEP_DETECTOR:
+ case VS_ID_STEP_DETECTOR_WAKEUP:
+ case VS_ID_TILT_DETECTOR:
+ case VS_ID_TILT_DETECTOR_WAKEUP:
+ case VS_ID_WAKE_GESTURE:
+ case VS_ID_WAKE_GESTURE_WAKEUP:
+ case VS_ID_GLANCE_GESTURE:
+ case VS_ID_GLANCE_GESTURE_WAKEUP:
+ case VS_ID_PICKUP_GESTURE:
+ case VS_ID_PICKUP_GESTURE_WAKEUP:
+ (*fifo_data_type) = BHY_DATA_TYPE_SENSOR_EVENT;
+ fifo_data_output->data_sensor_event.sensor_id = (**fifo_buffer);
+ break;
+
+ case VS_ID_UNCALIBRATED_MAGNETOMETER:
+ case VS_ID_UNCALIBRATED_MAGNETOMETER_WAKEUP:
+ case VS_ID_UNCALIBRATED_GYROSCOPE:
+ case VS_ID_UNCALIBRATED_GYROSCOPE_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_UNCALIB_VECTOR])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_UNCALIB_VECTOR;
+ fifo_data_output->data_uncalib_vector.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_uncalib_vector.x =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));
+ fifo_data_output->data_uncalib_vector.y =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));
+ fifo_data_output->data_uncalib_vector.z =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));
+ fifo_data_output->data_uncalib_vector.x_bias =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 7)) | ((uint16_t)*((*fifo_buffer) + 8) << 8));
+ fifo_data_output->data_uncalib_vector.y_bias =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 9)) | ((uint16_t)*((*fifo_buffer) + 10) << 8));
+ fifo_data_output->data_uncalib_vector.z_bias =
+ (int16_t)(((uint16_t)*((*fifo_buffer) + 11)) | ((uint16_t)*((*fifo_buffer) + 12) << 8));
+ fifo_data_output->data_uncalib_vector.status = *((*fifo_buffer)+13);
+ break;
+
+ case VS_ID_META_EVENT:
+ case VS_ID_META_EVENT_WAKEUP:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_META_EVENT])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_META_EVENT;
+ fifo_data_output->data_meta_event.meta_event_id = (**fifo_buffer);
+ fifo_data_output->data_meta_event.event_number = (bhy_meta_event_type_t)(*((*fifo_buffer) + 1));
+ fifo_data_output->data_meta_event.sensor_type = *((*fifo_buffer) + 2);
+ fifo_data_output->data_meta_event.event_specific = *((*fifo_buffer) + 3);
+ break;
+ case VS_ID_DEBUG:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_DEBUG])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_DEBUG;
+ fifo_data_output->data_debug.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_debug.data[0] = *((*fifo_buffer) + 1);
+ fifo_data_output->data_debug.data[1] = *((*fifo_buffer) + 2);
+ fifo_data_output->data_debug.data[2] = *((*fifo_buffer) + 3);
+ fifo_data_output->data_debug.data[3] = *((*fifo_buffer) + 4);
+ fifo_data_output->data_debug.data[4] = *((*fifo_buffer) + 5);
+ fifo_data_output->data_debug.data[5] = *((*fifo_buffer) + 6);
+ fifo_data_output->data_debug.data[6] = *((*fifo_buffer) + 7);
+ fifo_data_output->data_debug.data[7] = *((*fifo_buffer) + 8);
+ fifo_data_output->data_debug.data[8] = *((*fifo_buffer) + 9);
+ fifo_data_output->data_debug.data[9] = *((*fifo_buffer) + 10);
+ fifo_data_output->data_debug.data[10] = *((*fifo_buffer) + 11);
+ fifo_data_output->data_debug.data[11] = *((*fifo_buffer) + 12);
+ fifo_data_output->data_debug.data[12] = *((*fifo_buffer) + 13);
+ break;
+ case VS_ID_BSX_C:
+ case VS_ID_BSX_B:
+ case VS_ID_BSX_A:
+ if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_BSX])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ (*fifo_data_type) = BHY_DATA_TYPE_BSX;
+ fifo_data_output->data_bsx.sensor_id = (**fifo_buffer);
+ fifo_data_output->data_bsx.x =
+ (uint32_t)(((uint32_t)*((*fifo_buffer) + 1)) | ((uint32_t)*((*fifo_buffer) + 2) << 8) |
+ ((uint32_t)*((*fifo_buffer) + 3) << 16) | ((uint32_t)*((*fifo_buffer) + 4) << 24));
+ fifo_data_output->data_bsx.y =
+ (uint32_t)(((uint32_t)*((*fifo_buffer) + 5)) | ((uint32_t)*((*fifo_buffer) + 6) << 8) |
+ ((uint32_t)*((*fifo_buffer) + 7) << 16) | ((uint32_t)*((*fifo_buffer) + 8) << 24));
+ fifo_data_output->data_bsx.z =
+ (uint32_t)(((uint32_t)*((*fifo_buffer) + 9)) | ((uint32_t)*((*fifo_buffer) + 10) << 8) |
+ ((uint32_t)*((*fifo_buffer) + 11) << 16) | ((uint32_t)*((*fifo_buffer) + 12) << 24));
+ fifo_data_output->data_bsx.timestamp =
+ (uint32_t)(((uint32_t)*((*fifo_buffer) + 13)) | ((uint32_t)*((*fifo_buffer) + 14) << 8) |
+ ((uint32_t)*((*fifo_buffer) + 15) << 16) | ((uint32_t)*((*fifo_buffer) + 16) << 24));
+ break;
+
+ case VS_ID_CUS1:
+ case VS_ID_CUS2:
+ case VS_ID_CUS3:
+ case VS_ID_CUS4:
+ case VS_ID_CUS5:
+ (*fifo_data_type) = (bhy_data_type_t)(BHY_DATA_TYPE_CUS1 + **fifo_buffer - VS_ID_CUS1);
+
+ if ((*fifo_buffer_length) < _fifoSizes[*fifo_data_type])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ fifo_data_output->data_custom.sensor_id = (**fifo_buffer);
+
+ for(i = 0; i < _fifoSizes[*fifo_data_type] - 1; i++)
+ fifo_data_output->data_custom.data[i] = *((*fifo_buffer) + i + 1);
+ break;
+
+ case VS_ID_CUS1_WAKEUP:
+ case VS_ID_CUS2_WAKEUP:
+ case VS_ID_CUS3_WAKEUP:
+ case VS_ID_CUS4_WAKEUP:
+ case VS_ID_CUS5_WAKEUP:
+ (*fifo_data_type) = (bhy_data_type_t)(BHY_DATA_TYPE_CUS1+ **fifo_buffer - VS_ID_CUS1_WAKEUP);
+
+ if ((*fifo_buffer_length) < _fifoSizes[*fifo_data_type])
+ {
+ return BHY_OUT_OF_RANGE;
+ }
+
+ fifo_data_output->data_custom.sensor_id = (**fifo_buffer);
+
+ for(i = 0; i < _fifoSizes[*fifo_data_type]-1; i++)
+ {
+ fifo_data_output->data_custom.data[i] = *((*fifo_buffer) + i + 1);
+ }
+ break;
+
+ /* the VS sensor ID is unknown. Either the sync has been lost or the */
+ /* ram patch implements a new sensor ID that this driver doesn't yet */
+ /* support */
+ default:
+ return BHY_OUT_OF_RANGE;
+ }
+
+
+#if defined(BHY_DEBUG)
+ {
+ uint8_t *p_name = "UnDefined";
+ const char *sensors[] = {"PAdding", "Acc", "Mag", "Orient", "Gyro", "Light", "Bar", "Temp"
+ ,"Prox", "Gravity", "Line Acc", "R Vector", "Humidity", "A temp", "un Mag", "GR Vector"
+ ,"Un Gyro","SigMotion","StepDet", "StepCnt", "GeoR Vector", "HeartRate", "TiltDect","WGesture"
+ ,"Glance", "PickUp", "Cus1", "Cus2", "Cus3", "Cus4", "Cus5", "Activity"
+ };
+
+ if((uint8_t)**fifo_buffer <= VS_ID_ACTIVITY)
+ {
+ p_name = sensors[(uint8_t)**fifo_buffer];
+ }
+ else if((uint8_t)**fifo_buffer <= VS_ID_ACTIVITY_WAKEUP)
+ {
+ p_name = sensors[(uint8_t)**fifo_buffer - 32];
+ }
+ else
+ {
+ switch(**fifo_buffer)
+ {
+ case VS_ID_DEBUG:
+ p_name = "DString";
+ break;
+ case VS_ID_TIMESTAMP_LSW_WAKEUP:
+ case VS_ID_TIMESTAMP_LSW:
+ p_name = "LSW";
+ break;
+ case VS_ID_TIMESTAMP_MSW_WAKEUP:
+ case VS_ID_TIMESTAMP_MSW:
+ p_name = "MSW";
+ break;
+ case VS_ID_META_EVENT_WAKEUP:
+ case VS_ID_META_EVENT:
+ p_name = "Meta Evt";
+ break;
+ case VS_ID_BSX_A:
+ p_name = "BSX A";
+ break;
+ case VS_ID_BSX_B:
+ p_name = "BSX B";
+ break;
+ case VS_ID_BSX_C:
+ p_name = "BSX C";
+ break;
+ default:
+ p_name = "UnKnown";
+ break;
+ }
+ }
+
+ trace_log("[Sample](%12s):(%02d)", p_name, _fifoSizes[*fifo_data_type]);
+ for(i = 0; i < _fifoSizes[*fifo_data_type]; i++)
+ trace_log(" %02x", *((*fifo_buffer) + i));
+ trace_log("\n");
+ }
+#endif
+
+
+#if BHY_CALLBACK_MODE
+ if((**fifo_buffer) < 0x40)
+ {
+ if (sensor_callback_list[(**fifo_buffer)] != 0)
+ {
+ sensor_callback_list[(**fifo_buffer)](fifo_data_output, (bhy_virtual_sensor_t)(**fifo_buffer));
+ }
+ }
+ else if ((**fifo_buffer) == VS_ID_TIMESTAMP_LSW ||(**fifo_buffer) == VS_ID_TIMESTAMP_MSW)
+ {
+ if (timestamp_callback_list[0] != 0)
+ {
+ timestamp_callback_list[0](&fifo_data_output->data_scalar_u16);
+ }
+ }
+ else if ((**fifo_buffer) == VS_ID_TIMESTAMP_LSW_WAKEUP ||(**fifo_buffer) == VS_ID_TIMESTAMP_MSW_WAKEUP)
+ {
+ if (timestamp_callback_list[1] != 0)
+ {
+ timestamp_callback_list[1](&fifo_data_output->data_scalar_u16);
+ }
+ }
+ else if ((**fifo_buffer) == VS_ID_META_EVENT ||(**fifo_buffer) == VS_ID_META_EVENT_WAKEUP)
+ {
+ if (meta_event_callback_list[fifo_data_output->data_meta_event.event_number] != 0)
+ {
+ meta_event_callback_list[fifo_data_output->data_meta_event.event_number](&fifo_data_output->data_meta_event,
+ fifo_data_output->data_meta_event.event_number);
+ }
+ }
+#endif
+
+
+ (*fifo_buffer) += _fifoSizes[*fifo_data_type];
+ (*fifo_buffer_length) -= _fifoSizes[*fifo_data_type];
+
+ return BHY_SUCCESS;
+};
+
+/*!
+ * @brief This function will detect the timestamp packet accordingly and update
+ * either the MSW or the LSW of the system timestamp
+ *
+ * system_timestamp is only valid after LSW comes.
+ *
+ * @param[in] timestamp_packet timestamp of packets
+ * @param[in/out] system_timestamp timestamp of system
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_update_system_timestamp(bhy_data_scalar_u16_t *timestamp_packet,
+ uint32_t *system_timestamp)
+{
+ static uint32_t timestamp_wakeup = 0;
+ static uint32_t timestamp_nonwakeup = 0;
+
+ switch (timestamp_packet->sensor_id)
+ {
+ case VS_ID_TIMESTAMP_LSW:
+ timestamp_nonwakeup = (timestamp_nonwakeup & 0xFFFF0000) | (uint32_t)timestamp_packet->data;
+ *system_timestamp = timestamp_nonwakeup;
+ break;
+ case VS_ID_TIMESTAMP_LSW_WAKEUP:
+ timestamp_wakeup = (timestamp_wakeup & 0xFFFF0000) | (uint32_t)timestamp_packet->data;
+ *system_timestamp = timestamp_wakeup;
+ break;;
+
+ case VS_ID_TIMESTAMP_MSW:
+ timestamp_nonwakeup = (timestamp_nonwakeup & 0x0000FFFF) | ((uint32_t)timestamp_packet->data << 16);
+ break;
+ case VS_ID_TIMESTAMP_MSW_WAKEUP:
+ timestamp_wakeup = (timestamp_wakeup & 0x0000FFFF) | ((uint32_t)timestamp_packet->data << 16);
+ break;
+ default:
+ return BHY_OUT_OF_RANGE;
+ }
+ /* FabioPi */
+ return BHY_SUCCESS;
+}
+
+/*!
+ * @brief This function writes arbitrary data to an arbitrary parameter page
+ *
+ * @param[in] page select the page of parameter
+ * @param[in] parameter select the parameter
+ * @param[in] data data to be written to parameter
+ * @param[in] length length of data
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_write_parameter_page(uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length)
+{
+ /* variable used for return the status of communication result */
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+
+ uint8_t v_parameter_ack = BHY_INIT_VALUE;
+ uint8_t v_parameter_ack_check = BHY_INIT_VALUE;
+
+ /* write values to the load address*/
+ if (length > MAX_WRITE_BYTES)
+ {
+ length = MAX_WRITE_BYTES;
+ }
+ else if (length == 0)
+ {
+ return BHY_SUCCESS;
+ }
+
+ com_rslt = bhy_write_reg(BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO, data, length);
+
+ /* select the page*/
+ if (page > MAX_PAGE_NUM)
+ {
+ page = MAX_PAGE_NUM;
+ }
+ else if (page == 0)
+ {
+ return BHY_SUCCESS;
+ }
+
+ page = ((length & 0x07) << 4) | page;
+ com_rslt += bhy_write_reg(BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG, &page, 1);
+
+ /* select the parameter*/
+ parameter |= 0x80;
+ com_rslt += bhy_set_parameter_request(parameter);
+ for (v_parameter_ack_check = BHY_INIT_VALUE;
+ v_parameter_ack_check < BHY_PARAMETER_ACK_LENGTH;
+ v_parameter_ack_check++)
+ {
+ /* read the acknowledgment*/
+ com_rslt += bhy_get_parameter_acknowledge(&v_parameter_ack);
+ if (v_parameter_ack == parameter)
+ {
+ com_rslt += BHY_SUCCESS;
+ break;
+ }
+ else if (v_parameter_ack == BHY_PARAMETER_ACK_CHECK)
+ {
+ bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);
+ com_rslt += BHY_ERROR;
+ }
+ else
+ {
+ /* device not ready yet */
+ bhy_delay_msec(10);
+ }
+ }
+ return com_rslt;
+}
+
+/*!
+ * @brief This function reads arbitrary data from an arbitrary parameter page
+ *
+ * @param[in] page select the page of parameter
+ * @param[in] parameter select the parameter
+ * @param[out] data data to be read from parameter
+ * @param[in] length length of data
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_read_parameter_page(uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length)
+{
+ /* variable used for return the status of communication result*/
+ BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;
+
+ uint8_t v_parameter_ack = BHY_INIT_VALUE;
+ uint8_t v_parameter_ack_check = BHY_INIT_VALUE;
+
+ if (length > 16)
+ {
+ length = 16;
+ }
+ else if (length == 0)
+ {
+ return BHY_SUCCESS;
+ }
+
+ /* select the page*/
+ if (page > 15)
+ {
+ page = 15;
+ }
+ else if (page == 0)
+ {
+ return BHY_SUCCESS;
+ }
+
+ page = ((length & 0x0F) << 4) | page;
+ com_rslt = bhy_write_reg(BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG, &page, 1);
+
+ /* select the parameter*/
+ parameter &= 0x7F;
+ com_rslt += bhy_set_parameter_request(parameter);
+ for (v_parameter_ack_check = BHY_INIT_VALUE;
+ v_parameter_ack_check < BHY_PARAMETER_ACK_LENGTH;
+ v_parameter_ack_check++)
+ {
+ /* read the acknowledgment*/
+ com_rslt += bhy_get_parameter_acknowledge(&v_parameter_ack);
+ if (v_parameter_ack == parameter)
+ {
+ com_rslt += BHY_SUCCESS;
+ break;
+ }
+ else if(v_parameter_ack == BHY_PARAMETER_ACK_CHECK)
+ {
+ bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);
+ com_rslt += BHY_ERROR;
+ }
+ else
+ {
+ /* device not ready yet */
+ bhy_delay_msec(10);
+ }
+ }
+ /* read values to the load address*/
+ com_rslt += bhy_read_reg(BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO, data, length);
+
+ return com_rslt;
+}
+
+/*!
+ * @brief This function set mapping matrix to a corresponding physical sensor.
+ *
+ * @param[in] index physical sensor index
+ * @param[in] mapping_matrix pointer to a int8_t mapping_matrix[9]
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_set(bhy_physical_sensor_index_type_t index ,int8_t *mapping_matrix)
+{
+ uint8_t data[8] = { 0, };
+ int32_t i;
+ int32_t handle;
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+
+ switch (index)
+ {
+ case PHYSICAL_SENSOR_INDEX_ACC:
+ handle = VS_ID_ACCELEROMETER;
+ break;
+ case PHYSICAL_SENSOR_INDEX_MAG:
+ handle = VS_ID_UNCALIBRATED_MAGNETOMETER;
+ break;
+ case PHYSICAL_SENSOR_INDEX_GYRO:
+ handle = VS_ID_UNCALIBRATED_GYROSCOPE;
+ break;
+ default:
+ return BHY_ERROR;
+ }
+
+ for (i = 0; i < 5; ++i)
+ {
+ switch (mapping_matrix[2 * i])
+ {
+ case 0:
+ data[i] = 0;
+ break;
+ case 1:
+ data[i] = 1;
+ break;
+ case -1:
+ data[i] = 0xF;
+ break;
+ default:
+ return BHY_ERROR;
+ }
+
+ if (i == 4)
+ {
+ break;
+ }
+
+ switch (mapping_matrix[2 * i + 1])
+ {
+ case 0:
+ break;
+ case 1:
+ data[i] |= 0x10;
+ break;
+ case -1:
+ data[i] |= 0xF0;
+ break;
+ default:
+ return BHY_ERROR;
+ }
+ }
+
+ /* mutex_lock(&client_data->mutex_bus_op); */
+ ret = bhy_write_parameter_page(BHY_PAGE_SYSTEM, BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 + handle, data, sizeof(data));
+
+ /* mutex_unlock(&client_data->mutex_bus_op); */
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ return 0;
+}
+
+/*!
+ * @brief This function get mapping matrix from a corresponding physical sensor.
+ *
+ * @param[in] index physical sensor index
+ * @param[in] mapping_matrix pointer to a int8_t mapping_matrix[9]
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_get(bhy_physical_sensor_index_type_t index , int8_t* mapping_matrix)
+{
+ int32_t i, j;
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+ uint8_t data[16];
+ uint8_t map[32];
+ uint8_t handle[3] =
+ {
+ VS_ID_ACCELEROMETER,
+ VS_ID_UNCALIBRATED_MAGNETOMETER,
+ VS_ID_UNCALIBRATED_GYROSCOPE,
+ };
+ uint8_t param;
+
+ /* Check sensor existance */
+ ret = bhy_read_parameter_page(BHY_PAGE_SYSTEM, BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_PRESENT,
+ data, sizeof(data));
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 8; ++j)
+ {
+ if (data[i] & (1 << j))
+ {
+ map[i * 8 + j] = 1;
+ }
+ else
+ {
+ map[i * 8 + j] = 0;
+ }
+ }
+ }
+
+ if (!map[handle[index]])
+ {
+ return BHY_ERROR;
+ }
+
+ param = BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 + handle[index];
+ ret = bhy_read_parameter_page(BHY_PAGE_SYSTEM,param, data, sizeof(data));
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ mapping_matrix[0] = ((data[11] & 0x0F) == 0x0F) ? (-1) : (data[11] & 0x0F);
+ mapping_matrix[1] = (((data[11] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[11] >> 4) & 0x0F);
+ mapping_matrix[2] = (data[12] & 0x0F) == 0x0F ? (-1) : (data[12] & 0x0F);
+ mapping_matrix[3] = (((data[12] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[12] >> 4) & 0x0F);
+ mapping_matrix[4] = (data[13] & 0x0F) == 0x0F ? (-1) : (data[13] & 0x0F);
+ mapping_matrix[5] = (((data[13] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[13] >> 4) & 0x0F);
+ mapping_matrix[6] = (data[14] & 0x0F) == 0x0F ? (-1) : (data[14] & 0x0F);
+ mapping_matrix[7] = (((data[14] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[14] >> 4) & 0x0F);
+ mapping_matrix[8] = (data[15] & 0x0F) == 0x0F ? (-1) : (data[15] & 0x0F);
+
+ return ret;
+}
+
+/*!
+ * @brief Soft pass-through parameter write function.
+ *
+ * @param[in] addr physical sensor index
+ * @param[in] reg register address to be written
+ * @param[in] data pointer to data to be written
+ * @param[in] length
+ * @param[in] increment_reg if true, the function will automatically increment the register between successive 4-bytes transfers
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_write(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg)
+{
+ /* follows data structures in page table 26 and 27 of datasheet */
+ uint8_t temp_data[8];
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+
+ while (length)
+ {
+ temp_data[0] = addr;
+ temp_data[1] = reg;
+ temp_data[2] = (length > 4) ? 4 : length;
+ length -= temp_data[2];
+ if (increment_reg)
+ {
+ reg += temp_data[2];
+ }
+ temp_data[3] = 0x00;
+ temp_data[4] = *(data++);
+ temp_data[5] = (temp_data[2] >= 2) ? *(data++) : 0x00;
+ temp_data[6] = (temp_data[2] >= 3) ? *(data++) : 0x00;
+ temp_data[7] = (temp_data[2] >= 4) ? *(data++) : 0x00;
+
+ ret = bhy_write_parameter_page(15, 2, temp_data, 8);
+
+ /* wait until transaction is over */
+ do
+ {
+ ret = bhy_read_parameter_page(15, 2, temp_data, 8);
+ } while (temp_data[3] == 0x00);
+ }
+ return ret;
+}
+
+/*!
+ * @brief Soft pass-through parameter read function.
+ *
+ * @param[in] addr physical sensor index
+ * @param[in] reg register address to be written
+ * @param[out] data pointer to data to be written
+ * @param[in] length
+ * @param[in] increment_reg if true, the function will automatically increment the register between successive 4-bytes transfers
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_read(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg)
+{
+ /* follows data structures in page table 26 and 27 of datasheet */
+ uint8_t temp_data[8];
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+
+ while (length)
+ {
+ temp_data[0] = addr;
+ temp_data[1] = reg;
+ temp_data[2] = (length > 4) ? 4 : length;
+ length -= temp_data[2];
+ if (increment_reg)
+ {
+ reg += temp_data[2];
+ }
+ temp_data[3] = 0x00;
+ temp_data[4] = 0x00;
+ temp_data[5] = 0x00;
+ temp_data[6] = 0x00;
+ temp_data[7] = 0x00;
+
+ ret = bhy_write_parameter_page(15, 1, temp_data, 8);
+
+ /* wait until transaction is over */
+ do
+ {
+ ret = bhy_read_parameter_page(15, 1, temp_data, 8);
+ } while (temp_data[3] == 0x00);
+
+ if (temp_data[3] == 0x01)
+ {
+ *(data++) = temp_data[4];
+ if (temp_data[2] >= 2)
+ {
+ *(data++) = temp_data[5];
+ }
+
+ if (temp_data[2] >= 3)
+ {
+ *(data++) = temp_data[6];
+ }
+
+ if (temp_data[2] >= 4)
+ {
+ *(data++) = temp_data[7];
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*!
+ * @brief Write data to specific GP register.
+ *
+ * @param[in] gp_reg GP register address
+ * @param[in] data data to be written to GP register
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_gp_register_write(bhy_gp_register_type_t gp_reg, uint8_t data)
+{
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+
+ if((gp_reg >= BHY_GP_REG_20) && (gp_reg <= BHY_GP_REG_24))
+ {
+ /* GP register 20~24 are read only */
+ ret = BHY_ERROR;
+ }
+ else
+ {
+ ret += bhy_write_reg(gp_reg, &data, 1);
+ }
+
+ return ret;
+}
+
+/*!
+ * @brief Write data to specific GP register.
+ *
+ * @param[in] gp_reg GP register address
+ * @param[in] data pointer to receive buffer
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_gp_register_read(bhy_gp_register_type_t gp_reg, uint8_t *data)
+{
+ BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;
+
+ ret += bhy_read_reg(gp_reg, data, 1);
+
+ return ret;
+}
+
+/*!
+ * @brief This function reads out the current SIC matrix from BHy
+ *
+ * @param[in] sic_matrix pointer to SIC matrix
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_get_sic_matrix(float * sic_matrix)
+{
+ BHY_RETURN_FUNCTION_TYPE return_val;
+
+ return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_0_1, (uint8_t *)(&sic_matrix[0]), 8);
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_2_3, (uint8_t *)(&sic_matrix[2]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_4_5, (uint8_t *)(&sic_matrix[4]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_6_7, (uint8_t *)(&sic_matrix[6]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_8, (uint8_t *)(&sic_matrix[8]), 4);
+ }
+
+ return return_val;
+}
+
+/*!
+ * @brief This function get all the custom sensor data length according reading information from hub.
+ *
+ * @param[in] none
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_sync_cus_evt_size(void)
+{
+ struct sensor_information_wakeup_t sensor_info_wakeup;
+ uint8_t i = 0;
+
+ for(i = 0; i < 5; i++)
+ {
+ bhy_get_wakeup_sensor_information(VS_ID_CUS1 + i, &sensor_info_wakeup);
+
+ if(sensor_info_wakeup.wakeup_sensor_type == (VS_TYPE_CUS1 + i))
+ {
+ _fifoSizes[BHY_DATA_TYPE_CUS1+i] = sensor_info_wakeup.wakeup_event_size;
+ }
+ }
+
+ return BHY_SUCCESS;
+}
+
+/*!
+ * @brief This function get the specific custom sensor data length according reading information from hub.
+ *
+ * @param[in] sensor_id pointer to sensor_id
+ *
+ * @retval result of data length
+ */
+int8_t bhy_get_cus_evt_size(bhy_virtual_sensor_t sensor_id)
+{
+ if(sensor_id >= VS_TYPE_CUS1 && sensor_id <= VS_TYPE_CUS5)
+ {
+ return _fifoSizes[BHY_DATA_TYPE_CUS1 + sensor_id - VS_TYPE_CUS1];
+ }
+
+ return BHY_ERROR;
+}
+
+/*!
+ * @brief This function write a new SIC matrix to the BHy
+ *
+ * @param[in] sic_matrix pointer to SIC matrix
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_set_sic_matrix(float *sic_matrix)
+{
+ BHY_RETURN_FUNCTION_TYPE return_val;
+
+ return_val = bhy_write_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_0_1, (uint8_t *)(&sic_matrix[0]), 8);
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_2_3, (uint8_t *)(&sic_matrix[2]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_4_5, (uint8_t *)(&sic_matrix[4]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_6_7, (uint8_t *)(&sic_matrix[6]), 8);
+ }
+
+ if (BHY_SUCCESS == return_val)
+ {
+ return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_8, (uint8_t *)(&sic_matrix[8]), 4);
+ }
+
+ return return_val;
+}
+
+/*!
+ * @brief This function outputs the debug data to function pointer
+ * You need to provide a function that takes as argument a zero-terminated string and prints it
+ *
+ * @param[in] packet debug message
+ * @param[in] debug_print_ptr print function
+ *
+ * @retval result of execution
+ */
+void bhy_print_debug_packet(bhy_data_debug_t *packet, void (*debug_print_ptr)(const uint8_t *))
+{
+ uint8_t len;
+ uint8_t tempstr[25];
+ uint8_t i=0;
+
+ len = packet->data[0] & 0x3F;
+ if (packet->data[0] & 0x40)
+ {
+ /* Binary data */
+ while (i < len)
+ {
+ tempstr[i*2] = (packet->data[i+1] & 0xF0) > 0x90 ?
+ ((packet->data[i+1] & 0xF0)>>4) - 0x0A + 'A' :
+ ((packet->data[i+1] & 0xF0)>>4) + '0' ;
+ tempstr[i*2+1] = (packet->data[i+1] & 0x0F) > 0x09 ?
+ (packet->data[i+1] & 0x0F) - 0x0A + 'A' :
+ (packet->data[i+1] & 0x0F) + '0' ;
+ ++i;
+ }
+ tempstr[i*2] = '\0';
+ }
+ else
+ {
+ while (i < len)
+ {
+ tempstr[i] = packet->data[i+1];
+ ++i;
+ }
+ tempstr[i] = '\0';
+ }
+
+ debug_print_ptr(tempstr);
+}
+
+#if BHY_CALLBACK_MODE
+/*!
+ * @brief configure callback function for sensor
+ *
+ * @param[in] sensor_id sensor ID
+ * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP
+ * @param[in] sensor_callback callback function to be configured
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_install_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status,
+ void (*sensor_callback)(bhy_data_generic_t *, bhy_virtual_sensor_t))
+{
+ if ((uint8_t)sensor_id > MAX_SENSOR_ID_NONWAKEUP)
+ {
+ /* Invalid sensor ID */
+ return BHY_OUT_OF_RANGE;
+ }
+
+ if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))
+ {
+ /* Invalid wakeup state */
+ return BHY_OUT_OF_RANGE;
+ }
+
+ sensor_id = (bhy_virtual_sensor_t)((sensor_id & 0x1F) + wakeup_status);
+
+ if (sensor_callback_list[sensor_id] != 0)
+ {
+ /* There is already a callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ sensor_callback_list[sensor_id] = sensor_callback;
+ return BHY_SUCCESS;
+ }
+}
+
+/*!
+ * @brief uninstall callback function for sensor
+ *
+ *
+ * @param[in] sensor_id sensor ID
+ * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_sensor_callback(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status)
+{
+ if ((uint8_t)sensor_id > MAX_SENSOR_ID_NONWAKEUP)
+ {
+ /* Invalid sensor ID */
+ return BHY_OUT_OF_RANGE;
+ }
+
+ if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))
+ {
+ /* Invalid wakeup state */
+ return BHY_OUT_OF_RANGE;
+ }
+
+ sensor_id = (bhy_virtual_sensor_t)((sensor_id & 0x1F) + wakeup_status);
+ if (sensor_callback_list[sensor_id] == 0)
+ {
+ /* There are no callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ sensor_callback_list[sensor_id] = 0;
+ return BHY_SUCCESS;
+ }
+}
+
+/*!
+ * @brief install callback function for timestamp
+ *
+ *
+ * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP
+ * @param[in] sensor_callback callback function to be configured
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_install_timestamp_callback (uint8_t wakeup_status, void (*timestamp_callback)(bhy_data_scalar_u16_t *))
+{
+ if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))
+ {
+ /* Invalid wakeup state */
+ return BHY_OUT_OF_RANGE;
+ }
+ if (timestamp_callback_list[wakeup_status == VS_WAKEUP] != 0)
+ {
+ /* There is already a callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ timestamp_callback_list[wakeup_status == VS_WAKEUP] = timestamp_callback;
+ return BHY_SUCCESS;
+ }
+}
+
+/*!
+ * @brief uninstall callback function for timestamp
+ *
+ * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_timestamp_callback (uint8_t wakeup_status)
+{
+ if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))
+ {
+ /* Invalid wakeup state */
+ return BHY_OUT_OF_RANGE;
+ }
+ if (timestamp_callback_list[wakeup_status == VS_WAKEUP] == 0)
+ {
+ /* There are no callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ timestamp_callback_list[wakeup_status == VS_WAKEUP] = 0;
+ return BHY_SUCCESS;
+ }
+}
+
+/*!
+ * @brief install callback function for meta event
+ *
+ *
+ * @param[in] meta_event_id meta event ID
+ * @param[in] meta_event_callback callback function to be configured
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_install_meta_event_callback (bhy_meta_event_type_t meta_event_id,
+ void (*meta_event_callback)(bhy_data_meta_event_t *,
+ bhy_meta_event_type_t))
+{
+ if (meta_event_id > MAX_METAEVENT_ID)
+ {
+ /* Invalid meta event ID */
+ return BHY_OUT_OF_RANGE;
+ }
+ else if (meta_event_callback_list[meta_event_id] != 0)
+ {
+ /* There is already a callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ meta_event_callback_list[meta_event_id] = meta_event_callback;
+ return BHY_SUCCESS;
+ }
+}
+
+/*!
+ * @brief uninstall callback function for meta event
+ *
+ *
+ * @param[in] meta_event_id meta event ID
+ *
+ * @retval result of execution
+ */
+BHY_RETURN_FUNCTION_TYPE bhy_uninstall_meta_event_callback (bhy_meta_event_type_t meta_event_id)
+{
+ if (meta_event_id > MAX_METAEVENT_ID)
+ {
+ /* Invalid meta event ID */
+ return BHY_OUT_OF_RANGE;
+ }
+ else if (meta_event_callback_list[meta_event_id] == 0)
+ {
+ /* There is no callback installed */
+ return BHY_OUT_OF_RANGE;
+ }
+ else
+ {
+ meta_event_callback_list[meta_event_id] = 0;
+ return BHY_SUCCESS;
+ }
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.c
new file mode 100644
index 0000000..7fafc30
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.c
@@ -0,0 +1,1358 @@
+/**\mainpage
+ * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
+ *
+ * BSD-3-Clause
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File bme680.c
+ * @date 23 Jan 2020
+ * @version 3.5.10
+ *
+ */
+
+/*! @file bme680.c
+ @brief Sensor driver for BME680 sensor */
+#include "bme680.h"
+
+/*!
+ * @brief This internal API is used to read the calibrated data from the sensor.
+ *
+ * This function is used to retrieve the calibration
+ * data from the image registers of the sensor.
+ *
+ * @note Registers 89h to A1h for calibration data 1 to 24
+ * from bit 0 to 7
+ * @note Registers E1h to F0h for calibration data 25 to 40
+ * from bit 0 to 7
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status.
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t get_calib_data(struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to set the gas configuration of the sensor.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status.
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t set_gas_config(struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to get the gas configuration of the sensor.
+ * @note heatr_temp and heatr_dur values are currently register data
+ * and not the actual values set
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status.
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t get_gas_config(struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the Heat duration value.
+ *
+ * @param[in] dur :Value of the duration to be shared.
+ *
+ * @return uint8_t threshold duration after calculation.
+ */
+static uint8_t calc_heater_dur(uint16_t dur);
+
+#ifndef BME680_FLOAT_POINT_COMPENSATION
+
+/*!
+ * @brief This internal API is used to calculate the temperature value.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] temp_adc :Contains the temperature ADC value .
+ *
+ * @return uint32_t calculated temperature.
+ */
+static int16_t calc_temperature(uint32_t temp_adc, struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the pressure value.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] pres_adc :Contains the pressure ADC value .
+ *
+ * @return uint32_t calculated pressure.
+ */
+static uint32_t calc_pressure(uint32_t pres_adc, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the humidity value.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] hum_adc :Contains the humidity ADC value.
+ *
+ * @return uint32_t calculated humidity.
+ */
+static uint32_t calc_humidity(uint16_t hum_adc, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the Gas Resistance value.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] gas_res_adc :Contains the Gas Resistance ADC value.
+ * @param[in] gas_range :Contains the range of gas values.
+ *
+ * @return uint32_t calculated gas resistance.
+ */
+static uint32_t calc_gas_resistance(uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the Heat Resistance value.
+ *
+ * @param[in] dev : Structure instance of bme680_dev
+ * @param[in] temp : Contains the target temperature value.
+ *
+ * @return uint8_t calculated heater resistance.
+ */
+static uint8_t calc_heater_res(uint16_t temp, const struct bme680_dev *dev);
+
+#else
+/*!
+ * @brief This internal API is used to calculate the
+ * temperature value value in float format
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] temp_adc :Contains the temperature ADC value .
+ *
+ * @return Calculated temperature in float
+ */
+static float calc_temperature(uint32_t temp_adc, struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the
+ * pressure value value in float format
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] pres_adc :Contains the pressure ADC value .
+ *
+ * @return Calculated pressure in float.
+ */
+static float calc_pressure(uint32_t pres_adc, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the
+ * humidity value value in float format
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] hum_adc :Contains the humidity ADC value.
+ *
+ * @return Calculated humidity in float.
+ */
+static float calc_humidity(uint16_t hum_adc, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the
+ * gas resistance value value in float format
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] gas_res_adc :Contains the Gas Resistance ADC value.
+ * @param[in] gas_range :Contains the range of gas values.
+ *
+ * @return Calculated gas resistance in float.
+ */
+static float calc_gas_resistance(uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to calculate the
+ * heater resistance value in float format
+ *
+ * @param[in] temp : Contains the target temperature value.
+ * @param[in] dev : Structure instance of bme680_dev.
+ *
+ * @return Calculated heater resistance in float.
+ */
+static float calc_heater_res(uint16_t temp, const struct bme680_dev *dev);
+
+#endif
+
+/*!
+ * @brief This internal API is used to calculate the field data of sensor.
+ *
+ * @param[out] data :Structure instance to hold the data
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return int8_t result of the field data from sensor.
+ */
+static int8_t read_field_data(struct bme680_field_data *data, struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to set the memory page
+ * based on register address.
+ *
+ * The value of memory page
+ * value | Description
+ * --------|--------------
+ * 0 | BME680_PAGE0_SPI
+ * 1 | BME680_PAGE1_SPI
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ * @param[in] reg_addr :Contains the register address array.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t set_mem_page(uint8_t reg_addr, struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to get the memory page based
+ * on register address.
+ *
+ * The value of memory page
+ * value | Description
+ * --------|--------------
+ * 0 | BME680_PAGE0_SPI
+ * 1 | BME680_PAGE1_SPI
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t get_mem_page(struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to validate the device pointer for
+ * null conditions.
+ *
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t null_ptr_check(const struct bme680_dev *dev);
+
+/*!
+ * @brief This internal API is used to check the boundary
+ * conditions.
+ *
+ * @param[in] value :pointer to the value.
+ * @param[in] min :minimum value.
+ * @param[in] max :maximum value.
+ * @param[in] dev :Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+static int8_t boundary_check(uint8_t *value, uint8_t min, uint8_t max, struct bme680_dev *dev);
+
+/****************** Global Function Definitions *******************************/
+/*!
+ *@brief This API is the entry point.
+ *It reads the chip-id and calibration data from the sensor.
+ */
+int8_t bme680_init(struct bme680_dev *dev)
+{
+ int8_t rslt;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ /* Soft reset to restore it to default values*/
+ rslt = bme680_soft_reset(dev);
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(BME680_CHIP_ID_ADDR, &dev->chip_id, 1, dev);
+ if (rslt == BME680_OK) {
+ if (dev->chip_id == BME680_CHIP_ID) {
+ /* Get the Calibration data */
+ rslt = get_calib_data(dev);
+ } else {
+ rslt = BME680_E_DEV_NOT_FOUND;
+ }
+ }
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API reads the data from the given register address of the sensor.
+ */
+int8_t bme680_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, struct bme680_dev *dev)
+{
+ int8_t rslt;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if (dev->intf == BME680_SPI_INTF) {
+ /* Set the memory page */
+ rslt = set_mem_page(reg_addr, dev);
+ if (rslt == BME680_OK)
+ reg_addr = reg_addr | BME680_SPI_RD_MSK;
+ }
+ dev->com_rslt = dev->read(dev->dev_id, reg_addr, reg_data, len);
+ if (dev->com_rslt != 0)
+ rslt = BME680_E_COM_FAIL;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API writes the given data to the register address
+ * of the sensor.
+ */
+int8_t bme680_set_regs(const uint8_t *reg_addr, const uint8_t *reg_data, uint8_t len, struct bme680_dev *dev)
+{
+ int8_t rslt;
+ /* Length of the temporary buffer is 2*(length of register)*/
+ uint8_t tmp_buff[BME680_TMP_BUFFER_LENGTH] = { 0 };
+ uint16_t index;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if ((len > 0) && (len < BME680_TMP_BUFFER_LENGTH / 2)) {
+ /* Interleave the 2 arrays */
+ for (index = 0; index < len; index++) {
+ if (dev->intf == BME680_SPI_INTF) {
+ /* Set the memory page */
+ rslt = set_mem_page(reg_addr[index], dev);
+ tmp_buff[(2 * index)] = reg_addr[index] & BME680_SPI_WR_MSK;
+ } else {
+ tmp_buff[(2 * index)] = reg_addr[index];
+ }
+ tmp_buff[(2 * index) + 1] = reg_data[index];
+ }
+ /* Write the interleaved array */
+ if (rslt == BME680_OK) {
+ dev->com_rslt = dev->write(dev->dev_id, tmp_buff[0], &tmp_buff[1], (2 * len) - 1);
+ if (dev->com_rslt != 0)
+ rslt = BME680_E_COM_FAIL;
+ }
+ } else {
+ rslt = BME680_E_INVALID_LENGTH;
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API performs the soft reset of the sensor.
+ */
+int8_t bme680_soft_reset(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t reg_addr = BME680_SOFT_RESET_ADDR;
+ /* 0xb6 is the soft reset command */
+ uint8_t soft_rst_cmd = BME680_SOFT_RESET_CMD;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if (dev->intf == BME680_SPI_INTF)
+ rslt = get_mem_page(dev);
+
+ /* Reset the device */
+ if (rslt == BME680_OK) {
+ rslt = bme680_set_regs(®_addr, &soft_rst_cmd, 1, dev);
+ /* Wait for 5ms */
+ dev->delay_ms(BME680_RESET_PERIOD);
+
+ if (rslt == BME680_OK) {
+ /* After reset get the memory page */
+ if (dev->intf == BME680_SPI_INTF)
+ rslt = get_mem_page(dev);
+ }
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API is used to set the oversampling, filter and T,P,H, gas selection
+ * settings in the sensor.
+ */
+int8_t bme680_set_sensor_settings(uint16_t desired_settings, struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t reg_addr;
+ uint8_t data = 0;
+ uint8_t count = 0;
+ uint8_t reg_array[BME680_REG_BUFFER_LENGTH] = { 0 };
+ uint8_t data_array[BME680_REG_BUFFER_LENGTH] = { 0 };
+ uint8_t intended_power_mode = dev->power_mode; /* Save intended power mode */
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if (desired_settings & BME680_GAS_MEAS_SEL)
+ rslt = set_gas_config(dev);
+
+ dev->power_mode = BME680_SLEEP_MODE;
+ if (rslt == BME680_OK)
+ rslt = bme680_set_sensor_mode(dev);
+
+ /* Selecting the filter */
+ if (desired_settings & BME680_FILTER_SEL) {
+ rslt = boundary_check(&dev->tph_sett.filter, BME680_FILTER_SIZE_0, BME680_FILTER_SIZE_127, dev);
+ reg_addr = BME680_CONF_ODR_FILT_ADDR;
+
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(reg_addr, &data, 1, dev);
+
+ if (desired_settings & BME680_FILTER_SEL)
+ data = BME680_SET_BITS(data, BME680_FILTER, dev->tph_sett.filter);
+
+ reg_array[count] = reg_addr; /* Append configuration */
+ data_array[count] = data;
+ count++;
+ }
+
+ /* Selecting heater control for the sensor */
+ if (desired_settings & BME680_HCNTRL_SEL) {
+ rslt = boundary_check(&dev->gas_sett.heatr_ctrl, BME680_ENABLE_HEATER,
+ BME680_DISABLE_HEATER, dev);
+ reg_addr = BME680_CONF_HEAT_CTRL_ADDR;
+
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(reg_addr, &data, 1, dev);
+ data = BME680_SET_BITS_POS_0(data, BME680_HCTRL, dev->gas_sett.heatr_ctrl);
+
+ reg_array[count] = reg_addr; /* Append configuration */
+ data_array[count] = data;
+ count++;
+ }
+
+ /* Selecting heater T,P oversampling for the sensor */
+ if (desired_settings & (BME680_OST_SEL | BME680_OSP_SEL)) {
+ rslt = boundary_check(&dev->tph_sett.os_temp, BME680_OS_NONE, BME680_OS_16X, dev);
+ reg_addr = BME680_CONF_T_P_MODE_ADDR;
+
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(reg_addr, &data, 1, dev);
+
+ if (desired_settings & BME680_OST_SEL)
+ data = BME680_SET_BITS(data, BME680_OST, dev->tph_sett.os_temp);
+
+ if (desired_settings & BME680_OSP_SEL)
+ data = BME680_SET_BITS(data, BME680_OSP, dev->tph_sett.os_pres);
+
+ reg_array[count] = reg_addr;
+ data_array[count] = data;
+ count++;
+ }
+
+ /* Selecting humidity oversampling for the sensor */
+ if (desired_settings & BME680_OSH_SEL) {
+ rslt = boundary_check(&dev->tph_sett.os_hum, BME680_OS_NONE, BME680_OS_16X, dev);
+ reg_addr = BME680_CONF_OS_H_ADDR;
+
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(reg_addr, &data, 1, dev);
+ data = BME680_SET_BITS_POS_0(data, BME680_OSH, dev->tph_sett.os_hum);
+
+ reg_array[count] = reg_addr; /* Append configuration */
+ data_array[count] = data;
+ count++;
+ }
+
+ /* Selecting the runGas and NB conversion settings for the sensor */
+ if (desired_settings & (BME680_RUN_GAS_SEL | BME680_NBCONV_SEL)) {
+ rslt = boundary_check(&dev->gas_sett.run_gas, BME680_RUN_GAS_DISABLE,
+ BME680_RUN_GAS_ENABLE, dev);
+ if (rslt == BME680_OK) {
+ /* Validate boundary conditions */
+ rslt = boundary_check(&dev->gas_sett.nb_conv, BME680_NBCONV_MIN,
+ BME680_NBCONV_MAX, dev);
+ }
+
+ reg_addr = BME680_CONF_ODR_RUN_GAS_NBC_ADDR;
+
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(reg_addr, &data, 1, dev);
+
+ if (desired_settings & BME680_RUN_GAS_SEL)
+ data = BME680_SET_BITS(data, BME680_RUN_GAS, dev->gas_sett.run_gas);
+
+ if (desired_settings & BME680_NBCONV_SEL)
+ data = BME680_SET_BITS_POS_0(data, BME680_NBCONV, dev->gas_sett.nb_conv);
+
+ reg_array[count] = reg_addr; /* Append configuration */
+ data_array[count] = data;
+ count++;
+ }
+
+ if (rslt == BME680_OK)
+ rslt = bme680_set_regs(reg_array, data_array, count, dev);
+
+ /* Restore previous intended power mode */
+ dev->power_mode = intended_power_mode;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API is used to get the oversampling, filter and T,P,H, gas selection
+ * settings in the sensor.
+ */
+int8_t bme680_get_sensor_settings(uint16_t desired_settings, struct bme680_dev *dev)
+{
+ int8_t rslt;
+ /* starting address of the register array for burst read*/
+ uint8_t reg_addr = BME680_CONF_HEAT_CTRL_ADDR;
+ uint8_t data_array[BME680_REG_BUFFER_LENGTH] = { 0 };
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(reg_addr, data_array, BME680_REG_BUFFER_LENGTH, dev);
+
+ if (rslt == BME680_OK) {
+ if (desired_settings & BME680_GAS_MEAS_SEL)
+ rslt = get_gas_config(dev);
+
+ /* get the T,P,H ,Filter,ODR settings here */
+ if (desired_settings & BME680_FILTER_SEL)
+ dev->tph_sett.filter = BME680_GET_BITS(data_array[BME680_REG_FILTER_INDEX],
+ BME680_FILTER);
+
+ if (desired_settings & (BME680_OST_SEL | BME680_OSP_SEL)) {
+ dev->tph_sett.os_temp = BME680_GET_BITS(data_array[BME680_REG_TEMP_INDEX], BME680_OST);
+ dev->tph_sett.os_pres = BME680_GET_BITS(data_array[BME680_REG_PRES_INDEX], BME680_OSP);
+ }
+
+ if (desired_settings & BME680_OSH_SEL)
+ dev->tph_sett.os_hum = BME680_GET_BITS_POS_0(data_array[BME680_REG_HUM_INDEX],
+ BME680_OSH);
+
+ /* get the gas related settings */
+ if (desired_settings & BME680_HCNTRL_SEL)
+ dev->gas_sett.heatr_ctrl = BME680_GET_BITS_POS_0(data_array[BME680_REG_HCTRL_INDEX],
+ BME680_HCTRL);
+
+ if (desired_settings & (BME680_RUN_GAS_SEL | BME680_NBCONV_SEL)) {
+ dev->gas_sett.nb_conv = BME680_GET_BITS_POS_0(data_array[BME680_REG_NBCONV_INDEX],
+ BME680_NBCONV);
+ dev->gas_sett.run_gas = BME680_GET_BITS(data_array[BME680_REG_RUN_GAS_INDEX],
+ BME680_RUN_GAS);
+ }
+ }
+ } else {
+ rslt = BME680_E_NULL_PTR;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API is used to set the power mode of the sensor.
+ */
+int8_t bme680_set_sensor_mode(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t tmp_pow_mode;
+ uint8_t pow_mode = 0;
+ uint8_t reg_addr = BME680_CONF_T_P_MODE_ADDR;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ /* Call repeatedly until in sleep */
+ do {
+ rslt = bme680_get_regs(BME680_CONF_T_P_MODE_ADDR, &tmp_pow_mode, 1, dev);
+ if (rslt == BME680_OK) {
+ /* Put to sleep before changing mode */
+ pow_mode = (tmp_pow_mode & BME680_MODE_MSK);
+
+ if (pow_mode != BME680_SLEEP_MODE) {
+ tmp_pow_mode = tmp_pow_mode & (~BME680_MODE_MSK); /* Set to sleep */
+ rslt = bme680_set_regs(®_addr, &tmp_pow_mode, 1, dev);
+ dev->delay_ms(BME680_POLL_PERIOD_MS);
+ }
+ }
+ } while (pow_mode != BME680_SLEEP_MODE);
+
+ /* Already in sleep */
+ if (dev->power_mode != BME680_SLEEP_MODE) {
+ tmp_pow_mode = (tmp_pow_mode & ~BME680_MODE_MSK) | (dev->power_mode & BME680_MODE_MSK);
+ if (rslt == BME680_OK)
+ rslt = bme680_set_regs(®_addr, &tmp_pow_mode, 1, dev);
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API is used to get the power mode of the sensor.
+ */
+int8_t bme680_get_sensor_mode(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t mode = 0;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(BME680_CONF_T_P_MODE_ADDR, &mode, 1, dev);
+ /* Masking the other register bit info*/
+ dev->power_mode = mode & BME680_MODE_MSK;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This API is used to set the profile duration of the sensor.
+ */
+void bme680_set_profile_dur(uint16_t duration, struct bme680_dev *dev)
+{
+ uint32_t tph_dur; /* Calculate in us */
+ uint32_t meas_cycles;
+ uint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16};
+
+ meas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp];
+ meas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres];
+ meas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum];
+
+ /* TPH measurement duration */
+ tph_dur = meas_cycles * UINT32_C(1963);
+ tph_dur += UINT32_C(477 * 4); /* TPH switching duration */
+ tph_dur += UINT32_C(477 * 5); /* Gas measurement duration */
+ tph_dur += UINT32_C(500); /* Get it to the closest whole number.*/
+ tph_dur /= UINT32_C(1000); /* Convert to ms */
+
+ tph_dur += UINT32_C(1); /* Wake up duration of 1ms */
+ /* The remaining time should be used for heating */
+ dev->gas_sett.heatr_dur = duration - (uint16_t) tph_dur;
+}
+
+/*!
+ * @brief This API is used to get the profile duration of the sensor.
+ */
+void bme680_get_profile_dur(uint16_t *duration, const struct bme680_dev *dev)
+{
+ uint32_t tph_dur; /* Calculate in us */
+ uint32_t meas_cycles;
+ uint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16};
+
+ meas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp];
+ meas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres];
+ meas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum];
+
+ /* TPH measurement duration */
+ tph_dur = meas_cycles * UINT32_C(1963);
+ tph_dur += UINT32_C(477 * 4); /* TPH switching duration */
+ tph_dur += UINT32_C(477 * 5); /* Gas measurement duration */
+ tph_dur += UINT32_C(500); /* Get it to the closest whole number.*/
+ tph_dur /= UINT32_C(1000); /* Convert to ms */
+
+ tph_dur += UINT32_C(1); /* Wake up duration of 1ms */
+
+ *duration = (uint16_t) tph_dur;
+
+ /* Get the gas duration only when the run gas is enabled */
+ if (dev->gas_sett.run_gas) {
+ /* The remaining time should be used for heating */
+ *duration += dev->gas_sett.heatr_dur;
+ }
+}
+
+/*!
+ * @brief This API reads the pressure, temperature and humidity and gas data
+ * from the sensor, compensates the data and store it in the bme680_data
+ * structure instance passed by the user.
+ */
+int8_t bme680_get_sensor_data(struct bme680_field_data *data, struct bme680_dev *dev)
+{
+ int8_t rslt;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ /* Reading the sensor data in forced mode only */
+ rslt = read_field_data(data, dev);
+ if (rslt == BME680_OK) {
+ if (data->status & BME680_NEW_DATA_MSK)
+ dev->new_fields = 1;
+ else
+ dev->new_fields = 0;
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to read the calibrated data from the sensor.
+ */
+static int8_t get_calib_data(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t coeff_array[BME680_COEFF_SIZE] = { 0 };
+ uint8_t temp_var = 0; /* Temporary variable */
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(BME680_COEFF_ADDR1, coeff_array, BME680_COEFF_ADDR1_LEN, dev);
+ /* Append the second half in the same array */
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(BME680_COEFF_ADDR2, &coeff_array[BME680_COEFF_ADDR1_LEN]
+ , BME680_COEFF_ADDR2_LEN, dev);
+
+ /* Temperature related coefficients */
+ dev->calib.par_t1 = (uint16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_T1_MSB_REG],
+ coeff_array[BME680_T1_LSB_REG]));
+ dev->calib.par_t2 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_T2_MSB_REG],
+ coeff_array[BME680_T2_LSB_REG]));
+ dev->calib.par_t3 = (int8_t) (coeff_array[BME680_T3_REG]);
+
+ /* Pressure related coefficients */
+ dev->calib.par_p1 = (uint16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P1_MSB_REG],
+ coeff_array[BME680_P1_LSB_REG]));
+ dev->calib.par_p2 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P2_MSB_REG],
+ coeff_array[BME680_P2_LSB_REG]));
+ dev->calib.par_p3 = (int8_t) coeff_array[BME680_P3_REG];
+ dev->calib.par_p4 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P4_MSB_REG],
+ coeff_array[BME680_P4_LSB_REG]));
+ dev->calib.par_p5 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P5_MSB_REG],
+ coeff_array[BME680_P5_LSB_REG]));
+ dev->calib.par_p6 = (int8_t) (coeff_array[BME680_P6_REG]);
+ dev->calib.par_p7 = (int8_t) (coeff_array[BME680_P7_REG]);
+ dev->calib.par_p8 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P8_MSB_REG],
+ coeff_array[BME680_P8_LSB_REG]));
+ dev->calib.par_p9 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_P9_MSB_REG],
+ coeff_array[BME680_P9_LSB_REG]));
+ dev->calib.par_p10 = (uint8_t) (coeff_array[BME680_P10_REG]);
+
+ /* Humidity related coefficients */
+ dev->calib.par_h1 = (uint16_t) (((uint16_t) coeff_array[BME680_H1_MSB_REG] << BME680_HUM_REG_SHIFT_VAL)
+ | (coeff_array[BME680_H1_LSB_REG] & BME680_BIT_H1_DATA_MSK));
+ dev->calib.par_h2 = (uint16_t) (((uint16_t) coeff_array[BME680_H2_MSB_REG] << BME680_HUM_REG_SHIFT_VAL)
+ | ((coeff_array[BME680_H2_LSB_REG]) >> BME680_HUM_REG_SHIFT_VAL));
+ dev->calib.par_h3 = (int8_t) coeff_array[BME680_H3_REG];
+ dev->calib.par_h4 = (int8_t) coeff_array[BME680_H4_REG];
+ dev->calib.par_h5 = (int8_t) coeff_array[BME680_H5_REG];
+ dev->calib.par_h6 = (uint8_t) coeff_array[BME680_H6_REG];
+ dev->calib.par_h7 = (int8_t) coeff_array[BME680_H7_REG];
+
+ /* Gas heater related coefficients */
+ dev->calib.par_gh1 = (int8_t) coeff_array[BME680_GH1_REG];
+ dev->calib.par_gh2 = (int16_t) (BME680_CONCAT_BYTES(coeff_array[BME680_GH2_MSB_REG],
+ coeff_array[BME680_GH2_LSB_REG]));
+ dev->calib.par_gh3 = (int8_t) coeff_array[BME680_GH3_REG];
+
+ /* Other coefficients */
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(BME680_ADDR_RES_HEAT_RANGE_ADDR, &temp_var, 1, dev);
+
+ dev->calib.res_heat_range = ((temp_var & BME680_RHRANGE_MSK) / 16);
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(BME680_ADDR_RES_HEAT_VAL_ADDR, &temp_var, 1, dev);
+
+ dev->calib.res_heat_val = (int8_t) temp_var;
+ if (rslt == BME680_OK)
+ rslt = bme680_get_regs(BME680_ADDR_RANGE_SW_ERR_ADDR, &temp_var, 1, dev);
+ }
+ }
+ dev->calib.range_sw_err = ((int8_t) temp_var & (int8_t) BME680_RSERROR_MSK) / 16;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to set the gas configuration of the sensor.
+ */
+static int8_t set_gas_config(struct bme680_dev *dev)
+{
+ int8_t rslt;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+
+ uint8_t reg_addr[2] = {0};
+ uint8_t reg_data[2] = {0};
+
+ if (dev->power_mode == BME680_FORCED_MODE) {
+ reg_addr[0] = BME680_RES_HEAT0_ADDR;
+ reg_data[0] = calc_heater_res(dev->gas_sett.heatr_temp, dev);
+ reg_addr[1] = BME680_GAS_WAIT0_ADDR;
+ reg_data[1] = calc_heater_dur(dev->gas_sett.heatr_dur);
+ dev->gas_sett.nb_conv = 0;
+ } else {
+ rslt = BME680_W_DEFINE_PWR_MODE;
+ }
+ if (rslt == BME680_OK)
+ rslt = bme680_set_regs(reg_addr, reg_data, 2, dev);
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to get the gas configuration of the sensor.
+ * @note heatr_temp and heatr_dur values are currently register data
+ * and not the actual values set
+ */
+static int8_t get_gas_config(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ /* starting address of the register array for burst read*/
+ uint8_t reg_addr1 = BME680_ADDR_SENS_CONF_START;
+ uint8_t reg_addr2 = BME680_ADDR_GAS_CONF_START;
+ uint8_t reg_data = 0;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if (BME680_SPI_INTF == dev->intf) {
+ /* Memory page switch the SPI address*/
+ rslt = set_mem_page(reg_addr1, dev);
+ }
+
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(reg_addr1, ®_data, 1, dev);
+ if (rslt == BME680_OK) {
+ dev->gas_sett.heatr_temp = reg_data;
+ rslt = bme680_get_regs(reg_addr2, ®_data, 1, dev);
+ if (rslt == BME680_OK) {
+ /* Heating duration register value */
+ dev->gas_sett.heatr_dur = reg_data;
+ }
+ }
+ }
+ }
+
+ return rslt;
+}
+
+#ifndef BME680_FLOAT_POINT_COMPENSATION
+
+/*!
+ * @brief This internal API is used to calculate the temperature value.
+ */
+static int16_t calc_temperature(uint32_t temp_adc, struct bme680_dev *dev)
+{
+ int64_t var1;
+ int64_t var2;
+ int64_t var3;
+ int16_t calc_temp;
+
+ var1 = ((int32_t) temp_adc >> 3) - ((int32_t) dev->calib.par_t1 << 1);
+ var2 = (var1 * (int32_t) dev->calib.par_t2) >> 11;
+ var3 = ((var1 >> 1) * (var1 >> 1)) >> 12;
+ var3 = ((var3) * ((int32_t) dev->calib.par_t3 << 4)) >> 14;
+ dev->calib.t_fine = (int32_t) (var2 + var3);
+ calc_temp = (int16_t) (((dev->calib.t_fine * 5) + 128) >> 8);
+
+ return calc_temp;
+}
+
+/*!
+ * @brief This internal API is used to calculate the pressure value.
+ */
+static uint32_t calc_pressure(uint32_t pres_adc, const struct bme680_dev *dev)
+{
+ int32_t var1;
+ int32_t var2;
+ int32_t var3;
+ int32_t pressure_comp;
+
+ var1 = (((int32_t)dev->calib.t_fine) >> 1) - 64000;
+ var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) *
+ (int32_t)dev->calib.par_p6) >> 2;
+ var2 = var2 + ((var1 * (int32_t)dev->calib.par_p5) << 1);
+ var2 = (var2 >> 2) + ((int32_t)dev->calib.par_p4 << 16);
+ var1 = (((((var1 >> 2) * (var1 >> 2)) >> 13) *
+ ((int32_t)dev->calib.par_p3 << 5)) >> 3) +
+ (((int32_t)dev->calib.par_p2 * var1) >> 1);
+ var1 = var1 >> 18;
+ var1 = ((32768 + var1) * (int32_t)dev->calib.par_p1) >> 15;
+ pressure_comp = 1048576 - pres_adc;
+ pressure_comp = (int32_t)((pressure_comp - (var2 >> 12)) * ((uint32_t)3125));
+ if (pressure_comp >= BME680_MAX_OVERFLOW_VAL)
+ pressure_comp = ((pressure_comp / var1) << 1);
+ else
+ pressure_comp = ((pressure_comp << 1) / var1);
+ var1 = ((int32_t)dev->calib.par_p9 * (int32_t)(((pressure_comp >> 3) *
+ (pressure_comp >> 3)) >> 13)) >> 12;
+ var2 = ((int32_t)(pressure_comp >> 2) *
+ (int32_t)dev->calib.par_p8) >> 13;
+ var3 = ((int32_t)(pressure_comp >> 8) * (int32_t)(pressure_comp >> 8) *
+ (int32_t)(pressure_comp >> 8) *
+ (int32_t)dev->calib.par_p10) >> 17;
+
+ pressure_comp = (int32_t)(pressure_comp) + ((var1 + var2 + var3 +
+ ((int32_t)dev->calib.par_p7 << 7)) >> 4);
+
+ return (uint32_t)pressure_comp;
+
+}
+
+/*!
+ * @brief This internal API is used to calculate the humidity value.
+ */
+static uint32_t calc_humidity(uint16_t hum_adc, const struct bme680_dev *dev)
+{
+ int32_t var1;
+ int32_t var2;
+ int32_t var3;
+ int32_t var4;
+ int32_t var5;
+ int32_t var6;
+ int32_t temp_scaled;
+ int32_t calc_hum;
+
+ temp_scaled = (((int32_t) dev->calib.t_fine * 5) + 128) >> 8;
+ var1 = (int32_t) (hum_adc - ((int32_t) ((int32_t) dev->calib.par_h1 * 16)))
+ - (((temp_scaled * (int32_t) dev->calib.par_h3) / ((int32_t) 100)) >> 1);
+ var2 = ((int32_t) dev->calib.par_h2
+ * (((temp_scaled * (int32_t) dev->calib.par_h4) / ((int32_t) 100))
+ + (((temp_scaled * ((temp_scaled * (int32_t) dev->calib.par_h5) / ((int32_t) 100))) >> 6)
+ / ((int32_t) 100)) + (int32_t) (1 << 14))) >> 10;
+ var3 = var1 * var2;
+ var4 = (int32_t) dev->calib.par_h6 << 7;
+ var4 = ((var4) + ((temp_scaled * (int32_t) dev->calib.par_h7) / ((int32_t) 100))) >> 4;
+ var5 = ((var3 >> 14) * (var3 >> 14)) >> 10;
+ var6 = (var4 * var5) >> 1;
+ calc_hum = (((var3 + var6) >> 10) * ((int32_t) 1000)) >> 12;
+
+ if (calc_hum > 100000) /* Cap at 100%rH */
+ calc_hum = 100000;
+ else if (calc_hum < 0)
+ calc_hum = 0;
+
+ return (uint32_t) calc_hum;
+}
+
+/*!
+ * @brief This internal API is used to calculate the Gas Resistance value.
+ */
+static uint32_t calc_gas_resistance(uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev)
+{
+ int64_t var1;
+ uint64_t var2;
+ int64_t var3;
+ uint32_t calc_gas_res;
+ /**Look up table 1 for the possible gas range values */
+ uint32_t lookupTable1[16] = { UINT32_C(2147483647), UINT32_C(2147483647), UINT32_C(2147483647), UINT32_C(2147483647),
+ UINT32_C(2147483647), UINT32_C(2126008810), UINT32_C(2147483647), UINT32_C(2130303777),
+ UINT32_C(2147483647), UINT32_C(2147483647), UINT32_C(2143188679), UINT32_C(2136746228),
+ UINT32_C(2147483647), UINT32_C(2126008810), UINT32_C(2147483647), UINT32_C(2147483647) };
+ /**Look up table 2 for the possible gas range values */
+ uint32_t lookupTable2[16] = { UINT32_C(4096000000), UINT32_C(2048000000), UINT32_C(1024000000), UINT32_C(512000000),
+ UINT32_C(255744255), UINT32_C(127110228), UINT32_C(64000000), UINT32_C(32258064), UINT32_C(16016016),
+ UINT32_C(8000000), UINT32_C(4000000), UINT32_C(2000000), UINT32_C(1000000), UINT32_C(500000),
+ UINT32_C(250000), UINT32_C(125000) };
+
+ var1 = (int64_t) ((1340 + (5 * (int64_t) dev->calib.range_sw_err)) *
+ ((int64_t) lookupTable1[gas_range])) >> 16;
+ var2 = (((int64_t) ((int64_t) gas_res_adc << 15) - (int64_t) (16777216)) + var1);
+ var3 = (((int64_t) lookupTable2[gas_range] * (int64_t) var1) >> 9);
+ calc_gas_res = (uint32_t) ((var3 + ((int64_t) var2 >> 1)) / (int64_t) var2);
+
+ return calc_gas_res;
+}
+
+/*!
+ * @brief This internal API is used to calculate the Heat Resistance value.
+ */
+static uint8_t calc_heater_res(uint16_t temp, const struct bme680_dev *dev)
+{
+ uint8_t heatr_res;
+ int32_t var1;
+ int32_t var2;
+ int32_t var3;
+ int32_t var4;
+ int32_t var5;
+ int32_t heatr_res_x100;
+
+ if (temp > 400) /* Cap temperature */
+ temp = 400;
+
+ var1 = (((int32_t) dev->amb_temp * dev->calib.par_gh3) / 1000) * 256;
+ var2 = (dev->calib.par_gh1 + 784) * (((((dev->calib.par_gh2 + 154009) * temp * 5) / 100) + 3276800) / 10);
+ var3 = var1 + (var2 / 2);
+ var4 = (var3 / (dev->calib.res_heat_range + 4));
+ var5 = (131 * dev->calib.res_heat_val) + 65536;
+ heatr_res_x100 = (int32_t) (((var4 / var5) - 250) * 34);
+ heatr_res = (uint8_t) ((heatr_res_x100 + 50) / 100);
+
+ return heatr_res;
+}
+
+#else
+
+
+/*!
+ * @brief This internal API is used to calculate the
+ * temperature value in float format
+ */
+static float calc_temperature(uint32_t temp_adc, struct bme680_dev *dev)
+{
+ float var1 = 0;
+ float var2 = 0;
+ float calc_temp = 0;
+
+ /* calculate var1 data */
+ var1 = ((((float)temp_adc / 16384.0f) - ((float)dev->calib.par_t1 / 1024.0f))
+ * ((float)dev->calib.par_t2));
+
+ /* calculate var2 data */
+ var2 = (((((float)temp_adc / 131072.0f) - ((float)dev->calib.par_t1 / 8192.0f)) *
+ (((float)temp_adc / 131072.0f) - ((float)dev->calib.par_t1 / 8192.0f))) *
+ ((float)dev->calib.par_t3 * 16.0f));
+
+ /* t_fine value*/
+ dev->calib.t_fine = (var1 + var2);
+
+ /* compensated temperature data*/
+ calc_temp = ((dev->calib.t_fine) / 5120.0f);
+
+ return calc_temp;
+}
+
+/*!
+ * @brief This internal API is used to calculate the
+ * pressure value in float format
+ */
+static float calc_pressure(uint32_t pres_adc, const struct bme680_dev *dev)
+{
+ float var1 = 0;
+ float var2 = 0;
+ float var3 = 0;
+ float calc_pres = 0;
+
+ var1 = (((float)dev->calib.t_fine / 2.0f) - 64000.0f);
+ var2 = var1 * var1 * (((float)dev->calib.par_p6) / (131072.0f));
+ var2 = var2 + (var1 * ((float)dev->calib.par_p5) * 2.0f);
+ var2 = (var2 / 4.0f) + (((float)dev->calib.par_p4) * 65536.0f);
+ var1 = (((((float)dev->calib.par_p3 * var1 * var1) / 16384.0f)
+ + ((float)dev->calib.par_p2 * var1)) / 524288.0f);
+ var1 = ((1.0f + (var1 / 32768.0f)) * ((float)dev->calib.par_p1));
+ calc_pres = (1048576.0f - ((float)pres_adc));
+
+ /* Avoid exception caused by division by zero */
+ if ((int)var1 != 0) {
+ calc_pres = (((calc_pres - (var2 / 4096.0f)) * 6250.0f) / var1);
+ var1 = (((float)dev->calib.par_p9) * calc_pres * calc_pres) / 2147483648.0f;
+ var2 = calc_pres * (((float)dev->calib.par_p8) / 32768.0f);
+ var3 = ((calc_pres / 256.0f) * (calc_pres / 256.0f) * (calc_pres / 256.0f)
+ * (dev->calib.par_p10 / 131072.0f));
+ calc_pres = (calc_pres + (var1 + var2 + var3 + ((float)dev->calib.par_p7 * 128.0f)) / 16.0f);
+ } else {
+ calc_pres = 0;
+ }
+
+ return calc_pres;
+}
+
+/*!
+ * @brief This internal API is used to calculate the
+ * humidity value in float format
+ */
+static float calc_humidity(uint16_t hum_adc, const struct bme680_dev *dev)
+{
+ float calc_hum = 0;
+ float var1 = 0;
+ float var2 = 0;
+ float var3 = 0;
+ float var4 = 0;
+ float temp_comp;
+
+ /* compensated temperature data*/
+ temp_comp = ((dev->calib.t_fine) / 5120.0f);
+
+ var1 = (float)((float)hum_adc) - (((float)dev->calib.par_h1 * 16.0f) + (((float)dev->calib.par_h3 / 2.0f)
+ * temp_comp));
+
+ var2 = var1 * ((float)(((float) dev->calib.par_h2 / 262144.0f) * (1.0f + (((float)dev->calib.par_h4 / 16384.0f)
+ * temp_comp) + (((float)dev->calib.par_h5 / 1048576.0f) * temp_comp * temp_comp))));
+
+ var3 = (float) dev->calib.par_h6 / 16384.0f;
+
+ var4 = (float) dev->calib.par_h7 / 2097152.0f;
+
+ calc_hum = var2 + ((var3 + (var4 * temp_comp)) * var2 * var2);
+
+ if (calc_hum > 100.0f)
+ calc_hum = 100.0f;
+ else if (calc_hum < 0.0f)
+ calc_hum = 0.0f;
+
+ return calc_hum;
+}
+
+/*!
+ * @brief This internal API is used to calculate the
+ * gas resistance value in float format
+ */
+static float calc_gas_resistance(uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev)
+{
+ float calc_gas_res;
+ float var1 = 0;
+ float var2 = 0;
+ float var3 = 0;
+
+ const float lookup_k1_range[16] = {
+ 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, -0.8,
+ 0.0, 0.0, -0.2, -0.5, 0.0, -1.0, 0.0, 0.0};
+ const float lookup_k2_range[16] = {
+ 0.0, 0.0, 0.0, 0.0, 0.1, 0.7, 0.0, -0.8,
+ -0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+
+ var1 = (1340.0f + (5.0f * dev->calib.range_sw_err));
+ var2 = (var1) * (1.0f + lookup_k1_range[gas_range]/100.0f);
+ var3 = 1.0f + (lookup_k2_range[gas_range]/100.0f);
+
+ calc_gas_res = 1.0f / (float)(var3 * (0.000000125f) * (float)(1 << gas_range) * (((((float)gas_res_adc)
+ - 512.0f)/var2) + 1.0f));
+
+ return calc_gas_res;
+}
+
+/*!
+ * @brief This internal API is used to calculate the
+ * heater resistance value in float format
+ */
+static float calc_heater_res(uint16_t temp, const struct bme680_dev *dev)
+{
+ float var1 = 0;
+ float var2 = 0;
+ float var3 = 0;
+ float var4 = 0;
+ float var5 = 0;
+ float res_heat = 0;
+
+ if (temp > 400) /* Cap temperature */
+ temp = 400;
+
+ var1 = (((float)dev->calib.par_gh1 / (16.0f)) + 49.0f);
+ var2 = ((((float)dev->calib.par_gh2 / (32768.0f)) * (0.0005f)) + 0.00235f);
+ var3 = ((float)dev->calib.par_gh3 / (1024.0f));
+ var4 = (var1 * (1.0f + (var2 * (float)temp)));
+ var5 = (var4 + (var3 * (float)dev->amb_temp));
+ res_heat = (uint8_t)(3.4f * ((var5 * (4 / (4 + (float)dev->calib.res_heat_range)) *
+ (1/(1 + ((float) dev->calib.res_heat_val * 0.002f)))) - 25));
+
+ return res_heat;
+}
+
+#endif
+
+/*!
+ * @brief This internal API is used to calculate the Heat duration value.
+ */
+static uint8_t calc_heater_dur(uint16_t dur)
+{
+ uint8_t factor = 0;
+ uint8_t durval;
+
+ if (dur >= 0xfc0) {
+ durval = 0xff; /* Max duration*/
+ } else {
+ while (dur > 0x3F) {
+ dur = dur / 4;
+ factor += 1;
+ }
+ durval = (uint8_t) (dur + (factor * 64));
+ }
+
+ return durval;
+}
+
+/*!
+ * @brief This internal API is used to calculate the field data of sensor.
+ */
+static int8_t read_field_data(struct bme680_field_data *data, struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t buff[BME680_FIELD_LENGTH] = { 0 };
+ uint8_t gas_range;
+ uint32_t adc_temp;
+ uint32_t adc_pres;
+ uint16_t adc_hum;
+ uint16_t adc_gas_res;
+ uint8_t tries = 10;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ do {
+ if (rslt == BME680_OK) {
+ rslt = bme680_get_regs(((uint8_t) (BME680_FIELD0_ADDR)), buff, (uint16_t) BME680_FIELD_LENGTH,
+ dev);
+
+ data->status = buff[0] & BME680_NEW_DATA_MSK;
+ data->gas_index = buff[0] & BME680_GAS_INDEX_MSK;
+ data->meas_index = buff[1];
+
+ /* read the raw data from the sensor */
+ adc_pres = (uint32_t) (((uint32_t) buff[2] * 4096) | ((uint32_t) buff[3] * 16)
+ | ((uint32_t) buff[4] / 16));
+ adc_temp = (uint32_t) (((uint32_t) buff[5] * 4096) | ((uint32_t) buff[6] * 16)
+ | ((uint32_t) buff[7] / 16));
+ adc_hum = (uint16_t) (((uint32_t) buff[8] * 256) | (uint32_t) buff[9]);
+ adc_gas_res = (uint16_t) ((uint32_t) buff[13] * 4 | (((uint32_t) buff[14]) / 64));
+ gas_range = buff[14] & BME680_GAS_RANGE_MSK;
+
+ data->status |= buff[14] & BME680_GASM_VALID_MSK;
+ data->status |= buff[14] & BME680_HEAT_STAB_MSK;
+
+ if (data->status & BME680_NEW_DATA_MSK) {
+ data->temperature = calc_temperature(adc_temp, dev);
+ data->pressure = calc_pressure(adc_pres, dev);
+ data->humidity = calc_humidity(adc_hum, dev);
+ data->gas_resistance = calc_gas_resistance(adc_gas_res, gas_range, dev);
+ break;
+ }
+ /* Delay to poll the data */
+ dev->delay_ms(BME680_POLL_PERIOD_MS);
+ }
+ tries--;
+ } while (tries);
+
+ if (!tries)
+ rslt = BME680_W_NO_NEW_DATA;
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to set the memory page based on register address.
+ */
+static int8_t set_mem_page(uint8_t reg_addr, struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t reg;
+ uint8_t mem_page;
+
+ /* Check for null pointers in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ if (reg_addr > 0x7f)
+ mem_page = BME680_MEM_PAGE1;
+ else
+ mem_page = BME680_MEM_PAGE0;
+
+ if (mem_page != dev->mem_page) {
+ dev->mem_page = mem_page;
+
+ dev->com_rslt = dev->read(dev->dev_id, BME680_MEM_PAGE_ADDR | BME680_SPI_RD_MSK, ®, 1);
+ if (dev->com_rslt != 0)
+ rslt = BME680_E_COM_FAIL;
+
+ if (rslt == BME680_OK) {
+ reg = reg & (~BME680_MEM_PAGE_MSK);
+ reg = reg | (dev->mem_page & BME680_MEM_PAGE_MSK);
+
+ dev->com_rslt = dev->write(dev->dev_id, BME680_MEM_PAGE_ADDR & BME680_SPI_WR_MSK,
+ ®, 1);
+ if (dev->com_rslt != 0)
+ rslt = BME680_E_COM_FAIL;
+ }
+ }
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to get the memory page based on register address.
+ */
+static int8_t get_mem_page(struct bme680_dev *dev)
+{
+ int8_t rslt;
+ uint8_t reg;
+
+ /* Check for null pointer in the device structure*/
+ rslt = null_ptr_check(dev);
+ if (rslt == BME680_OK) {
+ dev->com_rslt = dev->read(dev->dev_id, BME680_MEM_PAGE_ADDR | BME680_SPI_RD_MSK, ®, 1);
+ if (dev->com_rslt != 0)
+ rslt = BME680_E_COM_FAIL;
+ else
+ dev->mem_page = reg & BME680_MEM_PAGE_MSK;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to validate the boundary
+ * conditions.
+ */
+static int8_t boundary_check(uint8_t *value, uint8_t min, uint8_t max, struct bme680_dev *dev)
+{
+ int8_t rslt = BME680_OK;
+
+ if (value != NULL) {
+ /* Check if value is below minimum value */
+ if (*value < min) {
+ /* Auto correct the invalid value to minimum value */
+ *value = min;
+ dev->info_msg |= BME680_I_MIN_CORRECTION;
+ }
+ /* Check if value is above maximum value */
+ if (*value > max) {
+ /* Auto correct the invalid value to maximum value */
+ *value = max;
+ dev->info_msg |= BME680_I_MAX_CORRECTION;
+ }
+ } else {
+ rslt = BME680_E_NULL_PTR;
+ }
+
+ return rslt;
+}
+
+/*!
+ * @brief This internal API is used to validate the device structure pointer for
+ * null conditions.
+ */
+static int8_t null_ptr_check(const struct bme680_dev *dev)
+{
+ int8_t rslt;
+
+ if ((dev == NULL) || (dev->read == NULL) || (dev->write == NULL) || (dev->delay_ms == NULL)) {
+ /* Device structure pointer is not valid */
+ rslt = BME680_E_NULL_PTR;
+ } else {
+ /* Device structure is fine */
+ rslt = BME680_OK;
+ }
+
+ return rslt;
+}
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.h
new file mode 100644
index 0000000..f436215
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680.h
@@ -0,0 +1,216 @@
+/**
+ * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
+ *
+ * BSD-3-Clause
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @file bme680.h
+ * @date 23 Jan 2020
+ * @version 3.5.10
+ * @brief
+ *
+ */
+/*! @file bme680.h
+ @brief Sensor driver for BME680 sensor */
+/*!
+ * @defgroup BME680 SENSOR API
+ * @{*/
+#ifndef BME680_H_
+#define BME680_H_
+
+/*! CPP guard */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Header includes */
+#include "bme680_defs.h"
+
+/* function prototype declarations */
+/*!
+ * @brief This API is the entry point.
+ * It reads the chip-id and calibration data from the sensor.
+ *
+ * @param[in,out] dev : Structure instance of bme680_dev
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_init(struct bme680_dev *dev);
+
+/*!
+ * @brief This API writes the given data to the register address
+ * of the sensor.
+ *
+ * @param[in] reg_addr : Register address from where the data to be written.
+ * @param[in] reg_data : Pointer to data buffer which is to be written
+ * in the sensor.
+ * @param[in] len : No of bytes of data to write..
+ * @param[in] dev : Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_set_regs(const uint8_t *reg_addr, const uint8_t *reg_data, uint8_t len, struct bme680_dev *dev);
+
+/*!
+ * @brief This API reads the data from the given register address of the sensor.
+ *
+ * @param[in] reg_addr : Register address from where the data to be read
+ * @param[out] reg_data : Pointer to data buffer to store the read data.
+ * @param[in] len : No of bytes of data to be read.
+ * @param[in] dev : Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, struct bme680_dev *dev);
+
+/*!
+ * @brief This API performs the soft reset of the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.
+ */
+int8_t bme680_soft_reset(struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to set the power mode of the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev
+ * @note : Pass the value to bme680_dev.power_mode structure variable.
+ *
+ * value | mode
+ * -------------|------------------
+ * 0x00 | BME680_SLEEP_MODE
+ * 0x01 | BME680_FORCED_MODE
+ *
+ * * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_set_sensor_mode(struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to get the power mode of the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev
+ * @note : bme680_dev.power_mode structure variable hold the power mode.
+ *
+ * value | mode
+ * ---------|------------------
+ * 0x00 | BME680_SLEEP_MODE
+ * 0x01 | BME680_FORCED_MODE
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_get_sensor_mode(struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to set the profile duration of the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev.
+ * @param[in] duration : Duration of the measurement in ms.
+ *
+ * @return Nothing
+ */
+void bme680_set_profile_dur(uint16_t duration, struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to get the profile duration of the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev.
+ * @param[in] duration : Duration of the measurement in ms.
+ *
+ * @return Nothing
+ */
+void bme680_get_profile_dur(uint16_t *duration, const struct bme680_dev *dev);
+
+/*!
+ * @brief This API reads the pressure, temperature and humidity and gas data
+ * from the sensor, compensates the data and store it in the bme680_data
+ * structure instance passed by the user.
+ *
+ * @param[out] data: Structure instance to hold the data.
+ * @param[in] dev : Structure instance of bme680_dev.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
+ */
+int8_t bme680_get_sensor_data(struct bme680_field_data *data, struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to set the oversampling, filter and T,P,H, gas selection
+ * settings in the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev.
+ * @param[in] desired_settings : Variable used to select the settings which
+ * are to be set in the sensor.
+ *
+ * Macros | Functionality
+ *---------------------------------|----------------------------------------------
+ * BME680_OST_SEL | To set temperature oversampling.
+ * BME680_OSP_SEL | To set pressure oversampling.
+ * BME680_OSH_SEL | To set humidity oversampling.
+ * BME680_GAS_MEAS_SEL | To set gas measurement setting.
+ * BME680_FILTER_SEL | To set filter setting.
+ * BME680_HCNTRL_SEL | To set humidity control setting.
+ * BME680_RUN_GAS_SEL | To set run gas setting.
+ * BME680_NBCONV_SEL | To set NB conversion setting.
+ * BME680_GAS_SENSOR_SEL | To set all gas sensor related settings
+ *
+ * @note : Below are the macros to be used by the user for selecting the
+ * desired settings. User can do OR operation of these macros for configuring
+ * multiple settings.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.
+ */
+int8_t bme680_set_sensor_settings(uint16_t desired_settings, struct bme680_dev *dev);
+
+/*!
+ * @brief This API is used to get the oversampling, filter and T,P,H, gas selection
+ * settings in the sensor.
+ *
+ * @param[in] dev : Structure instance of bme680_dev.
+ * @param[in] desired_settings : Variable used to select the settings which
+ * are to be get from the sensor.
+ *
+ * @return Result of API execution status
+ * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.
+ */
+int8_t bme680_get_sensor_settings(uint16_t desired_settings, struct bme680_dev *dev);
+#ifdef __cplusplus
+}
+#endif /* End of CPP guard */
+#endif /* BME680_H_ */
+/** @}*/
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680_defs.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680_defs.h
new file mode 100644
index 0000000..6aa4c18
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bme680_defs.h
@@ -0,0 +1,541 @@
+/**
+ * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
+ *
+ * BSD-3-Clause
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @file bme680_defs.h
+ * @date 23 Jan 2020
+ * @version 3.5.10
+ * @brief
+ *
+ */
+
+/*! @file bme680_defs.h
+ @brief Sensor driver for BME680 sensor */
+/*!
+ * @defgroup BME680 SENSOR API
+ * @brief
+ * @{*/
+#ifndef BME680_DEFS_H_
+#define BME680_DEFS_H_
+#ifdef __cplusplus
+extern "C"{
+#endif
+/********************************************************/
+/* header includes */
+#ifdef __KERNEL__
+#include
+#include
+#else
+#include
+#include
+#endif
+
+/******************************************************************************/
+/*! @name Common macros */
+/******************************************************************************/
+
+#if !defined(UINT8_C) && !defined(INT8_C)
+#define INT8_C(x) S8_C(x)
+#define UINT8_C(x) U8_C(x)
+#endif
+
+#if !defined(UINT16_C) && !defined(INT16_C)
+#define INT16_C(x) S16_C(x)
+#define UINT16_C(x) U16_C(x)
+#endif
+
+#if !defined(INT32_C) && !defined(UINT32_C)
+#define INT32_C(x) S32_C(x)
+#define UINT32_C(x) U32_C(x)
+#endif
+
+#if !defined(INT64_C) && !defined(UINT64_C)
+#define INT64_C(x) S64_C(x)
+#define UINT64_C(x) U64_C(x)
+#endif
+
+/**@}*/
+
+/**\name C standard macros */
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *) 0)
+#endif
+#endif
+
+/** BME680 configuration macros */
+/** Enable or un-comment the macro to provide floating point data output */
+#ifndef BME680_FLOAT_POINT_COMPENSATION
+/* #define BME680_FLOAT_POINT_COMPENSATION */
+#endif
+
+/** BME680 General config */
+#define BME680_POLL_PERIOD_MS UINT8_C(10)
+
+/** BME680 I2C addresses */
+#define BME680_I2C_ADDR_PRIMARY UINT8_C(0x76)
+#define BME680_I2C_ADDR_SECONDARY UINT8_C(0x77)
+
+/** BME680 unique chip identifier */
+#define BME680_CHIP_ID UINT8_C(0x61)
+
+/** BME680 coefficients related defines */
+#define BME680_COEFF_SIZE UINT8_C(41)
+#define BME680_COEFF_ADDR1_LEN UINT8_C(25)
+#define BME680_COEFF_ADDR2_LEN UINT8_C(16)
+
+/** BME680 field_x related defines */
+#define BME680_FIELD_LENGTH UINT8_C(15)
+#define BME680_FIELD_ADDR_OFFSET UINT8_C(17)
+
+/** Soft reset command */
+#define BME680_SOFT_RESET_CMD UINT8_C(0xb6)
+
+/** Error code definitions */
+#define BME680_OK INT8_C(0)
+/* Errors */
+#define BME680_E_NULL_PTR INT8_C(-1)
+#define BME680_E_COM_FAIL INT8_C(-2)
+#define BME680_E_DEV_NOT_FOUND INT8_C(-3)
+#define BME680_E_INVALID_LENGTH INT8_C(-4)
+
+/* Warnings */
+#define BME680_W_DEFINE_PWR_MODE INT8_C(1)
+#define BME680_W_NO_NEW_DATA INT8_C(2)
+
+/* Info's */
+#define BME680_I_MIN_CORRECTION UINT8_C(1)
+#define BME680_I_MAX_CORRECTION UINT8_C(2)
+
+/** Register map */
+/** Other coefficient's address */
+#define BME680_ADDR_RES_HEAT_VAL_ADDR UINT8_C(0x00)
+#define BME680_ADDR_RES_HEAT_RANGE_ADDR UINT8_C(0x02)
+#define BME680_ADDR_RANGE_SW_ERR_ADDR UINT8_C(0x04)
+#define BME680_ADDR_SENS_CONF_START UINT8_C(0x5A)
+#define BME680_ADDR_GAS_CONF_START UINT8_C(0x64)
+
+/** Field settings */
+#define BME680_FIELD0_ADDR UINT8_C(0x1d)
+
+/** Heater settings */
+#define BME680_RES_HEAT0_ADDR UINT8_C(0x5a)
+#define BME680_GAS_WAIT0_ADDR UINT8_C(0x64)
+
+/** Sensor configuration registers */
+#define BME680_CONF_HEAT_CTRL_ADDR UINT8_C(0x70)
+#define BME680_CONF_ODR_RUN_GAS_NBC_ADDR UINT8_C(0x71)
+#define BME680_CONF_OS_H_ADDR UINT8_C(0x72)
+#define BME680_MEM_PAGE_ADDR UINT8_C(0xf3)
+#define BME680_CONF_T_P_MODE_ADDR UINT8_C(0x74)
+#define BME680_CONF_ODR_FILT_ADDR UINT8_C(0x75)
+
+/** Coefficient's address */
+#define BME680_COEFF_ADDR1 UINT8_C(0x89)
+#define BME680_COEFF_ADDR2 UINT8_C(0xe1)
+
+/** Chip identifier */
+#define BME680_CHIP_ID_ADDR UINT8_C(0xd0)
+
+/** Soft reset register */
+#define BME680_SOFT_RESET_ADDR UINT8_C(0xe0)
+
+/** Heater control settings */
+#define BME680_ENABLE_HEATER UINT8_C(0x00)
+#define BME680_DISABLE_HEATER UINT8_C(0x08)
+
+/** Gas measurement settings */
+#define BME680_DISABLE_GAS_MEAS UINT8_C(0x00)
+#define BME680_ENABLE_GAS_MEAS UINT8_C(0x01)
+
+/** Over-sampling settings */
+#define BME680_OS_NONE UINT8_C(0)
+#define BME680_OS_1X UINT8_C(1)
+#define BME680_OS_2X UINT8_C(2)
+#define BME680_OS_4X UINT8_C(3)
+#define BME680_OS_8X UINT8_C(4)
+#define BME680_OS_16X UINT8_C(5)
+
+/** IIR filter settings */
+#define BME680_FILTER_SIZE_0 UINT8_C(0)
+#define BME680_FILTER_SIZE_1 UINT8_C(1)
+#define BME680_FILTER_SIZE_3 UINT8_C(2)
+#define BME680_FILTER_SIZE_7 UINT8_C(3)
+#define BME680_FILTER_SIZE_15 UINT8_C(4)
+#define BME680_FILTER_SIZE_31 UINT8_C(5)
+#define BME680_FILTER_SIZE_63 UINT8_C(6)
+#define BME680_FILTER_SIZE_127 UINT8_C(7)
+
+/** Power mode settings */
+#define BME680_SLEEP_MODE UINT8_C(0)
+#define BME680_FORCED_MODE UINT8_C(1)
+
+/** Delay related macro declaration */
+#define BME680_RESET_PERIOD UINT32_C(10)
+
+/** SPI memory page settings */
+#define BME680_MEM_PAGE0 UINT8_C(0x10)
+#define BME680_MEM_PAGE1 UINT8_C(0x00)
+
+/** Ambient humidity shift value for compensation */
+#define BME680_HUM_REG_SHIFT_VAL UINT8_C(4)
+
+/** Run gas enable and disable settings */
+#define BME680_RUN_GAS_DISABLE UINT8_C(0)
+#define BME680_RUN_GAS_ENABLE UINT8_C(1)
+
+/** Buffer length macro declaration */
+#define BME680_TMP_BUFFER_LENGTH UINT8_C(40)
+#define BME680_REG_BUFFER_LENGTH UINT8_C(6)
+#define BME680_FIELD_DATA_LENGTH UINT8_C(3)
+#define BME680_GAS_REG_BUF_LENGTH UINT8_C(20)
+
+/** Settings selector */
+#define BME680_OST_SEL UINT16_C(1)
+#define BME680_OSP_SEL UINT16_C(2)
+#define BME680_OSH_SEL UINT16_C(4)
+#define BME680_GAS_MEAS_SEL UINT16_C(8)
+#define BME680_FILTER_SEL UINT16_C(16)
+#define BME680_HCNTRL_SEL UINT16_C(32)
+#define BME680_RUN_GAS_SEL UINT16_C(64)
+#define BME680_NBCONV_SEL UINT16_C(128)
+#define BME680_GAS_SENSOR_SEL (BME680_GAS_MEAS_SEL | BME680_RUN_GAS_SEL | BME680_NBCONV_SEL)
+
+/** Number of conversion settings*/
+#define BME680_NBCONV_MIN UINT8_C(0)
+#define BME680_NBCONV_MAX UINT8_C(10)
+
+/** Mask definitions */
+#define BME680_GAS_MEAS_MSK UINT8_C(0x30)
+#define BME680_NBCONV_MSK UINT8_C(0X0F)
+#define BME680_FILTER_MSK UINT8_C(0X1C)
+#define BME680_OST_MSK UINT8_C(0XE0)
+#define BME680_OSP_MSK UINT8_C(0X1C)
+#define BME680_OSH_MSK UINT8_C(0X07)
+#define BME680_HCTRL_MSK UINT8_C(0x08)
+#define BME680_RUN_GAS_MSK UINT8_C(0x10)
+#define BME680_MODE_MSK UINT8_C(0x03)
+#define BME680_RHRANGE_MSK UINT8_C(0x30)
+#define BME680_RSERROR_MSK UINT8_C(0xf0)
+#define BME680_NEW_DATA_MSK UINT8_C(0x80)
+#define BME680_GAS_INDEX_MSK UINT8_C(0x0f)
+#define BME680_GAS_RANGE_MSK UINT8_C(0x0f)
+#define BME680_GASM_VALID_MSK UINT8_C(0x20)
+#define BME680_HEAT_STAB_MSK UINT8_C(0x10)
+#define BME680_MEM_PAGE_MSK UINT8_C(0x10)
+#define BME680_SPI_RD_MSK UINT8_C(0x80)
+#define BME680_SPI_WR_MSK UINT8_C(0x7f)
+#define BME680_BIT_H1_DATA_MSK UINT8_C(0x0F)
+
+/** Bit position definitions for sensor settings */
+#define BME680_GAS_MEAS_POS UINT8_C(4)
+#define BME680_FILTER_POS UINT8_C(2)
+#define BME680_OST_POS UINT8_C(5)
+#define BME680_OSP_POS UINT8_C(2)
+#define BME680_RUN_GAS_POS UINT8_C(4)
+
+/** Array Index to Field data mapping for Calibration Data*/
+#define BME680_T2_LSB_REG (1)
+#define BME680_T2_MSB_REG (2)
+#define BME680_T3_REG (3)
+#define BME680_P1_LSB_REG (5)
+#define BME680_P1_MSB_REG (6)
+#define BME680_P2_LSB_REG (7)
+#define BME680_P2_MSB_REG (8)
+#define BME680_P3_REG (9)
+#define BME680_P4_LSB_REG (11)
+#define BME680_P4_MSB_REG (12)
+#define BME680_P5_LSB_REG (13)
+#define BME680_P5_MSB_REG (14)
+#define BME680_P7_REG (15)
+#define BME680_P6_REG (16)
+#define BME680_P8_LSB_REG (19)
+#define BME680_P8_MSB_REG (20)
+#define BME680_P9_LSB_REG (21)
+#define BME680_P9_MSB_REG (22)
+#define BME680_P10_REG (23)
+#define BME680_H2_MSB_REG (25)
+#define BME680_H2_LSB_REG (26)
+#define BME680_H1_LSB_REG (26)
+#define BME680_H1_MSB_REG (27)
+#define BME680_H3_REG (28)
+#define BME680_H4_REG (29)
+#define BME680_H5_REG (30)
+#define BME680_H6_REG (31)
+#define BME680_H7_REG (32)
+#define BME680_T1_LSB_REG (33)
+#define BME680_T1_MSB_REG (34)
+#define BME680_GH2_LSB_REG (35)
+#define BME680_GH2_MSB_REG (36)
+#define BME680_GH1_REG (37)
+#define BME680_GH3_REG (38)
+
+/** BME680 register buffer index settings*/
+#define BME680_REG_FILTER_INDEX UINT8_C(5)
+#define BME680_REG_TEMP_INDEX UINT8_C(4)
+#define BME680_REG_PRES_INDEX UINT8_C(4)
+#define BME680_REG_HUM_INDEX UINT8_C(2)
+#define BME680_REG_NBCONV_INDEX UINT8_C(1)
+#define BME680_REG_RUN_GAS_INDEX UINT8_C(1)
+#define BME680_REG_HCTRL_INDEX UINT8_C(0)
+
+/** BME680 pressure calculation macros */
+/*! This max value is used to provide precedence to multiplication or division
+ * in pressure compensation equation to achieve least loss of precision and
+ * avoiding overflows.
+ * i.e Comparing value, BME680_MAX_OVERFLOW_VAL = INT32_C(1 << 30)
+ */
+#define BME680_MAX_OVERFLOW_VAL INT32_C(0x40000000)
+
+/** Macro to combine two 8 bit data's to form a 16 bit data */
+#define BME680_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb)
+
+/** Macro to SET and GET BITS of a register */
+#define BME680_SET_BITS(reg_data, bitname, data) \
+ ((reg_data & ~(bitname##_MSK)) | \
+ ((data << bitname##_POS) & bitname##_MSK))
+#define BME680_GET_BITS(reg_data, bitname) ((reg_data & (bitname##_MSK)) >> \
+ (bitname##_POS))
+
+/** Macro variant to handle the bitname position if it is zero */
+#define BME680_SET_BITS_POS_0(reg_data, bitname, data) \
+ ((reg_data & ~(bitname##_MSK)) | \
+ (data & bitname##_MSK))
+#define BME680_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK))
+
+/** Type definitions */
+/*!
+ * Generic communication function pointer
+ * @param[in] dev_id: Place holder to store the id of the device structure
+ * Can be used to store the index of the Chip select or
+ * I2C address of the device.
+ * @param[in] reg_addr: Used to select the register the where data needs to
+ * be read from or written to.
+ * @param[in/out] reg_data: Data array to read/write
+ * @param[in] len: Length of the data array
+ */
+typedef int8_t (*bme680_com_fptr_t)(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len);
+
+/*!
+ * Delay function pointer
+ * @param[in] period: Time period in milliseconds
+ */
+typedef void (*bme680_delay_fptr_t)(uint32_t period);
+
+/*!
+ * @brief Interface selection Enumerations
+ */
+enum bme680_intf {
+ /*! SPI interface */
+ BME680_SPI_INTF,
+ /*! I2C interface */
+ BME680_I2C_INTF
+};
+
+/* structure definitions */
+/*!
+ * @brief Sensor field data structure
+ */
+struct bme680_field_data {
+ /*! Contains new_data, gasm_valid & heat_stab */
+ uint8_t status;
+ /*! The index of the heater profile used */
+ uint8_t gas_index;
+ /*! Measurement index to track order */
+ uint8_t meas_index;
+
+#ifndef BME680_FLOAT_POINT_COMPENSATION
+ /*! Temperature in degree celsius x100 */
+ int16_t temperature;
+ /*! Pressure in Pascal */
+ uint32_t pressure;
+ /*! Humidity in % relative humidity x1000 */
+ uint32_t humidity;
+ /*! Gas resistance in Ohms */
+ uint32_t gas_resistance;
+#else
+ /*! Temperature in degree celsius */
+ float temperature;
+ /*! Pressure in Pascal */
+ float pressure;
+ /*! Humidity in % relative humidity x1000 */
+ float humidity;
+ /*! Gas resistance in Ohms */
+ float gas_resistance;
+
+#endif
+
+};
+
+/*!
+ * @brief Structure to hold the Calibration data
+ */
+struct bme680_calib_data {
+ /*! Variable to store calibrated humidity data */
+ uint16_t par_h1;
+ /*! Variable to store calibrated humidity data */
+ uint16_t par_h2;
+ /*! Variable to store calibrated humidity data */
+ int8_t par_h3;
+ /*! Variable to store calibrated humidity data */
+ int8_t par_h4;
+ /*! Variable to store calibrated humidity data */
+ int8_t par_h5;
+ /*! Variable to store calibrated humidity data */
+ uint8_t par_h6;
+ /*! Variable to store calibrated humidity data */
+ int8_t par_h7;
+ /*! Variable to store calibrated gas data */
+ int8_t par_gh1;
+ /*! Variable to store calibrated gas data */
+ int16_t par_gh2;
+ /*! Variable to store calibrated gas data */
+ int8_t par_gh3;
+ /*! Variable to store calibrated temperature data */
+ uint16_t par_t1;
+ /*! Variable to store calibrated temperature data */
+ int16_t par_t2;
+ /*! Variable to store calibrated temperature data */
+ int8_t par_t3;
+ /*! Variable to store calibrated pressure data */
+ uint16_t par_p1;
+ /*! Variable to store calibrated pressure data */
+ int16_t par_p2;
+ /*! Variable to store calibrated pressure data */
+ int8_t par_p3;
+ /*! Variable to store calibrated pressure data */
+ int16_t par_p4;
+ /*! Variable to store calibrated pressure data */
+ int16_t par_p5;
+ /*! Variable to store calibrated pressure data */
+ int8_t par_p6;
+ /*! Variable to store calibrated pressure data */
+ int8_t par_p7;
+ /*! Variable to store calibrated pressure data */
+ int16_t par_p8;
+ /*! Variable to store calibrated pressure data */
+ int16_t par_p9;
+ /*! Variable to store calibrated pressure data */
+ uint8_t par_p10;
+
+#ifndef BME680_FLOAT_POINT_COMPENSATION
+ /*! Variable to store t_fine size */
+ int32_t t_fine;
+#else
+ /*! Variable to store t_fine size */
+ float t_fine;
+#endif
+ /*! Variable to store heater resistance range */
+ uint8_t res_heat_range;
+ /*! Variable to store heater resistance value */
+ int8_t res_heat_val;
+ /*! Variable to store error range */
+ int8_t range_sw_err;
+};
+
+/*!
+ * @brief BME680 sensor settings structure which comprises of ODR,
+ * over-sampling and filter settings.
+ */
+struct bme680_tph_sett {
+ /*! Humidity oversampling */
+ uint8_t os_hum;
+ /*! Temperature oversampling */
+ uint8_t os_temp;
+ /*! Pressure oversampling */
+ uint8_t os_pres;
+ /*! Filter coefficient */
+ uint8_t filter;
+};
+
+/*!
+ * @brief BME680 gas sensor which comprises of gas settings
+ * and status parameters
+ */
+struct bme680_gas_sett {
+ /*! Variable to store nb conversion */
+ uint8_t nb_conv;
+ /*! Variable to store heater control */
+ uint8_t heatr_ctrl;
+ /*! Run gas enable value */
+ uint8_t run_gas;
+ /*! Heater temperature value */
+ uint16_t heatr_temp;
+ /*! Duration profile value */
+ uint16_t heatr_dur;
+};
+
+/*!
+ * @brief BME680 device structure
+ */
+struct bme680_dev {
+ /*! Chip Id */
+ uint8_t chip_id;
+ /*! Device Id */
+ uint8_t dev_id;
+ /*! SPI/I2C interface */
+ enum bme680_intf intf;
+ /*! Memory page used */
+ uint8_t mem_page;
+ /*! Ambient temperature in Degree C */
+ int8_t amb_temp;
+ /*! Sensor calibration data */
+ struct bme680_calib_data calib;
+ /*! Sensor settings */
+ struct bme680_tph_sett tph_sett;
+ /*! Gas Sensor settings */
+ struct bme680_gas_sett gas_sett;
+ /*! Sensor power modes */
+ uint8_t power_mode;
+ /*! New sensor fields */
+ uint8_t new_fields;
+ /*! Store the info messages */
+ uint8_t info_msg;
+ /*! Bus read function pointer */
+ bme680_com_fptr_t read;
+ /*! Bus write function pointer */
+ bme680_com_fptr_t write;
+ /*! delay function pointer */
+ bme680_delay_fptr_t delay_ms;
+ /*! Communication function result */
+ int8_t com_rslt;
+};
+
+
+#ifdef __cplusplus
+}
+#endif /* End of CPP guard */
+
+#endif /* BME680_DEFS_H_ */
+/** @}*/
+/** @}*/
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.c
new file mode 100644
index 0000000..f045be7
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.c
@@ -0,0 +1,569 @@
+/*
+ * Copyright (C) 2017 Robert Bosch. All Rights Reserved.
+ *
+ * Disclaimer
+ *
+ * Common:
+ * Bosch Sensortec products are developed for the consumer goods industry. They may only be used
+ * within the parameters of the respective valid product data sheet. Bosch Sensortec products are
+ * provided with the express understanding that there is no warranty of fitness for a particular purpose.
+ * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device
+ * that may lead to bodily harm or property damage if the system or device malfunctions. In addition,
+ * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems.
+ * The resale and/or use of products are at the purchasers own risk and his own responsibility. The
+ * examination of fitness for the intended use is the sole responsibility of the Purchaser.
+ *
+ * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for
+ * incidental, or consequential damages, arising from any product use not covered by the parameters of
+ * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch
+ * Sensortec for all costs in connection with such claims.
+ *
+ * The purchaser must monitor the market for the purchased products, particularly with regard to
+ * product safety and inform Bosch Sensortec without delay of all security relevant incidents.
+ *
+ * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid
+ * technical specifications of the product series. They are therefore not intended or fit for resale to third
+ * parties or for use in end products. Their sole purpose is internal client testing. The testing of an
+ * engineering sample may in no way replace the testing of a product series. Bosch Sensortec
+ * assumes no liability for the use of engineering samples. By accepting the engineering samples, the
+ * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering
+ * samples.
+ *
+ * Special:
+ * This software module (hereinafter called "Software") and any information on application-sheets
+ * (hereinafter called "Information") is provided free of charge for the sole purpose to support your
+ * application work. The Software and Information is subject to the following terms and conditions:
+ *
+ * The Software is specifically designed for the exclusive use for Bosch Sensortec products by
+ * personnel who have special experience and training. Do not use this Software if you do not have the
+ * proper experience or training.
+ *
+ * This Software package is provided `` as is `` and without any expressed or implied warranties,
+ * including without limitation, the implied warranties of merchantability and fitness for a particular
+ * purpose.
+ *
+ * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment
+ * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their
+ * representatives and agents shall not be liable for any direct or indirect damages or injury, except as
+ * otherwise stipulated in mandatory applicable law.
+ *
+ * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no
+ * responsibility for the consequences of use of such Information nor for any infringement of patents or
+ * other rights of third parties which may result from its use. No license is granted by implication or
+ * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are
+ * subject to change without notice.
+ *
+ * It is not allowed to deliver the source code of the Software to any third party without permission of
+ * Bosch Sensortec.
+ *
+ */
+
+/*!
+ * @file bsec_integration.c
+ *
+ * @brief
+ * Private part of the example for using of BSEC library.
+ */
+
+/*!
+ * @addtogroup bsec_examples BSEC Examples
+ * @brief BSEC usage examples
+ * @{*/
+
+/**********************************************************************************************************************/
+/* header files */
+/**********************************************************************************************************************/
+
+#include "../BME680/bsec_integration.h"
+
+#include
+#include
+#include
+#include
+
+/**********************************************************************************************************************/
+/* local macro definitions */
+/**********************************************************************************************************************/
+
+#define NUM_USED_OUTPUTS 8
+
+/**********************************************************************************************************************/
+/* global variable declarations */
+/**********************************************************************************************************************/
+
+/* Global sensor APIs data structure */
+static struct bme680_dev bme680_g;
+
+/* Global temperature offset to be subtracted */
+static float bme680_temperature_offset_g = 0.0f;
+
+/**********************************************************************************************************************/
+/* functions */
+/**********************************************************************************************************************/
+
+/*!
+ * @brief Virtual sensor subscription
+ * Please call this function before processing of data using bsec_do_steps function
+ *
+ * @param[in] sample_rate mode to be used (either BSEC_SAMPLE_RATE_ULP or BSEC_SAMPLE_RATE_LP)
+ *
+ * @return subscription result, zero when successful
+ */
+static bsec_library_return_t bme680_bsec_update_subscription(float sample_rate)
+{
+ bsec_sensor_configuration_t requested_virtual_sensors[NUM_USED_OUTPUTS];
+ uint8_t n_requested_virtual_sensors = NUM_USED_OUTPUTS;
+
+ bsec_sensor_configuration_t required_sensor_settings[BSEC_MAX_PHYSICAL_SENSOR];
+ uint8_t n_required_sensor_settings = BSEC_MAX_PHYSICAL_SENSOR;
+
+ bsec_library_return_t status = BSEC_OK;
+
+ /* note: Virtual sensors as desired to be added here */
+ requested_virtual_sensors[0].sensor_id = BSEC_OUTPUT_IAQ;
+ requested_virtual_sensors[0].sample_rate = sample_rate;
+ requested_virtual_sensors[1].sensor_id = BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE;
+ requested_virtual_sensors[1].sample_rate = sample_rate;
+ requested_virtual_sensors[2].sensor_id = BSEC_OUTPUT_RAW_PRESSURE;
+ requested_virtual_sensors[2].sample_rate = sample_rate;
+ requested_virtual_sensors[3].sensor_id = BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY;
+ requested_virtual_sensors[3].sample_rate = sample_rate;
+ requested_virtual_sensors[4].sensor_id = BSEC_OUTPUT_RAW_GAS;
+ requested_virtual_sensors[4].sample_rate = sample_rate;
+ requested_virtual_sensors[5].sensor_id = BSEC_OUTPUT_RAW_TEMPERATURE;
+ requested_virtual_sensors[5].sample_rate = sample_rate;
+ requested_virtual_sensors[6].sensor_id = BSEC_OUTPUT_RAW_HUMIDITY;
+ requested_virtual_sensors[6].sample_rate = sample_rate;
+ requested_virtual_sensors[7].sensor_id = BSEC_OUTPUT_STATIC_IAQ;
+ requested_virtual_sensors[7].sample_rate = sample_rate;
+
+ /* Call bsec_update_subscription() to enable/disable the requested virtual sensors */
+ status = bsec_update_subscription(requested_virtual_sensors, n_requested_virtual_sensors, required_sensor_settings,
+ &n_required_sensor_settings);
+
+ return status;
+}
+
+/*!
+ * @brief Initialize the BME680 sensor and the BSEC library
+ *
+ * @param[in] sample_rate mode to be used (either BSEC_SAMPLE_RATE_ULP or BSEC_SAMPLE_RATE_LP)
+ * @param[in] temperature_offset device-specific temperature offset (due to self-heating)
+ * @param[in] bus_write pointer to the bus writing function
+ * @param[in] bus_read pointer to the bus reading function
+ * @param[in] sleep pointer to the system specific sleep function
+ * @param[in] state_load pointer to the system-specific state load function
+ * @param[in] config_load pointer to the system-specific config load function
+ *
+ * @return zero if successful, negative otherwise
+ */
+return_values_init bsec_iot_init(float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write,
+ bme680_com_fptr_t bus_read, sleep_fct sleep, state_load_fct state_load, config_load_fct config_load)
+{
+ return_values_init ret = {BME680_OK, BSEC_OK};
+ //bsec_library_return_t bsec_status = BSEC_OK;
+
+ uint8_t bsec_state[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0};
+ uint8_t bsec_config[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0};
+ uint8_t work_buffer[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0};
+ int bsec_state_len, bsec_config_len;
+
+ /* Fixed I2C configuration */
+ bme680_g.dev_id = BME680_I2C_ADDR_PRIMARY;
+ bme680_g.intf = BME680_I2C_INTF;
+ /* User configurable I2C configuration */
+ bme680_g.write = bus_write;
+ bme680_g.read = bus_read;
+ bme680_g.delay_ms = sleep;
+
+ /* Initialize BME680 API */
+ ret.bme680_status = bme680_init(&bme680_g);
+ if (ret.bme680_status != BME680_OK)
+ {
+ return ret;
+ }
+
+ /* Initialize BSEC library */
+ ret.bsec_status = bsec_init();
+ if (ret.bsec_status != BSEC_OK)
+ {
+ return ret;
+ }
+
+ /* Load library config, if available */
+ bsec_config_len = config_load(bsec_config, sizeof(bsec_config));
+ if (bsec_config_len != 0)
+ {
+ ret.bsec_status = bsec_set_configuration(bsec_config, bsec_config_len, work_buffer, sizeof(work_buffer));
+ if (ret.bsec_status != BSEC_OK)
+ {
+ return ret;
+ }
+ }
+
+ /* Load previous library state, if available */
+ bsec_state_len = state_load(bsec_state, sizeof(bsec_state));
+ if (bsec_state_len != 0)
+ {
+ ret.bsec_status = bsec_set_state(bsec_state, bsec_state_len, work_buffer, sizeof(work_buffer));
+ if (ret.bsec_status != BSEC_OK)
+ {
+ return ret;
+ }
+ }
+
+ /* Set temperature offset */
+ bme680_temperature_offset_g = temperature_offset;
+
+ /* Call to the function which sets the library with subscription information */
+ ret.bsec_status = bme680_bsec_update_subscription(sample_rate);
+ if (ret.bsec_status != BSEC_OK)
+ {
+ return ret;
+ }
+
+ return ret;
+}
+
+/*!
+ * @brief Trigger the measurement based on sensor settings
+ *
+ * @param[in] sensor_settings settings of the BME680 sensor adopted by sensor control function
+ * @param[in] sleep pointer to the system specific sleep function
+ *
+ * @return none
+ */
+void bme680_bsec_trigger_measurement(bsec_bme_settings_t *sensor_settings, sleep_fct sleep)
+{
+ uint16_t meas_period;
+ uint8_t set_required_settings;
+ int8_t bme680_status = BME680_OK;
+
+ /* Check if a forced-mode measurement should be triggered now */
+ if (sensor_settings->trigger_measurement)
+ {
+ /* Set sensor configuration */
+
+ bme680_g.tph_sett.os_hum = sensor_settings->humidity_oversampling;
+ bme680_g.tph_sett.os_pres = sensor_settings->pressure_oversampling;
+ bme680_g.tph_sett.os_temp = sensor_settings->temperature_oversampling;
+ bme680_g.gas_sett.run_gas = sensor_settings->run_gas;
+ bme680_g.gas_sett.heatr_temp = sensor_settings->heater_temperature; /* degree Celsius */
+ bme680_g.gas_sett.heatr_dur = sensor_settings->heating_duration; /* milliseconds */
+
+ /* Select the power mode */
+ /* Must be set before writing the sensor configuration */
+ bme680_g.power_mode = BME680_FORCED_MODE;
+ /* Set the required sensor settings needed */
+ set_required_settings = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_GAS_SENSOR_SEL;
+
+ /* Set the desired sensor configuration */
+ bme680_status = bme680_set_sensor_settings(set_required_settings, &bme680_g);
+
+ /* Set power mode as forced mode and trigger forced mode measurement */
+ bme680_status = bme680_set_sensor_mode(&bme680_g);
+
+ /* Get the total measurement duration so as to sleep or wait till the measurement is complete */
+ bme680_get_profile_dur(&meas_period, &bme680_g);
+
+ /* Delay till the measurement is ready. Timestamp resolution in ms */
+ sleep((uint32_t)meas_period);
+ }
+
+ /* Call the API to get current operation mode of the sensor */
+ bme680_status = bme680_get_sensor_mode(&bme680_g);
+ /* When the measurement is completed and data is ready for reading, the sensor must be in BME680_SLEEP_MODE.
+ * Read operation mode to check whether measurement is completely done and wait until the sensor is no more
+ * in BME680_FORCED_MODE. */
+ while (bme680_g.power_mode == BME680_FORCED_MODE)
+ {
+ /* sleep for 5 ms */
+ sleep(5);
+ bme680_status = bme680_get_sensor_mode(&bme680_g);
+ }
+ (void) bme680_status;
+}
+
+/*!
+ * @brief Read the data from registers and populate the inputs structure to be passed to do_steps function
+ *
+ * @param[in] time_stamp_trigger settings of the sensor returned from sensor control function
+ * @param[in] inputs input structure containing the information on sensors to be passed to do_steps
+ * @param[in] num_bsec_inputs number of inputs to be passed to do_steps
+ * @param[in] bsec_process_data process data variable returned from sensor_control
+ *
+ * @return none
+ */
+void bme680_bsec_read_data(int64_t time_stamp_trigger, bsec_input_t *inputs, uint8_t *num_bsec_inputs,
+ int32_t bsec_process_data)
+{
+ static struct bme680_field_data data;
+ int8_t bme680_status = BME680_OK;
+
+ /* We only have to read data if the previous call the bsec_sensor_control() actually asked for it */
+ if (bsec_process_data)
+ {
+ bme680_status = bme680_get_sensor_data(&data, &bme680_g);
+
+ if (data.status & BME680_NEW_DATA_MSK)
+ {
+ /* Pressure to be processed by BSEC */
+ if (bsec_process_data & BSEC_PROCESS_PRESSURE)
+ {
+ /* Place presssure sample into input struct */
+ inputs[*num_bsec_inputs].sensor_id = BSEC_INPUT_PRESSURE;
+ inputs[*num_bsec_inputs].signal = data.pressure;
+ inputs[*num_bsec_inputs].time_stamp = time_stamp_trigger;
+ (*num_bsec_inputs)++;
+ }
+ /* Temperature to be processed by BSEC */
+ if (bsec_process_data & BSEC_PROCESS_TEMPERATURE)
+ {
+ /* Place temperature sample into input struct */
+ inputs[*num_bsec_inputs].sensor_id = BSEC_INPUT_TEMPERATURE;
+ #ifdef BME680_FLOAT_POINT_COMPENSATION
+ inputs[*num_bsec_inputs].signal = data.temperature;
+ #else
+ inputs[*num_bsec_inputs].signal = data.temperature / 100.0f;
+ #endif
+ inputs[*num_bsec_inputs].time_stamp = time_stamp_trigger;
+ (*num_bsec_inputs)++;
+
+ /* Also add optional heatsource input which will be subtracted from the temperature reading to
+ * compensate for device-specific self-heating (supported in BSEC IAQ solution)*/
+ inputs[*num_bsec_inputs].sensor_id = BSEC_INPUT_HEATSOURCE;
+ inputs[*num_bsec_inputs].signal = bme680_temperature_offset_g;
+ inputs[*num_bsec_inputs].time_stamp = time_stamp_trigger;
+ (*num_bsec_inputs)++;
+ }
+ /* Humidity to be processed by BSEC */
+ if (bsec_process_data & BSEC_PROCESS_HUMIDITY)
+ {
+ /* Place humidity sample into input struct */
+ inputs[*num_bsec_inputs].sensor_id = BSEC_INPUT_HUMIDITY;
+ #ifdef BME680_FLOAT_POINT_COMPENSATION
+ inputs[*num_bsec_inputs].signal = data.humidity;
+ #else
+ inputs[*num_bsec_inputs].signal = data.humidity / 1000.0f;
+ #endif
+ inputs[*num_bsec_inputs].time_stamp = time_stamp_trigger;
+ (*num_bsec_inputs)++;
+ }
+ /* Gas to be processed by BSEC */
+ if (bsec_process_data & BSEC_PROCESS_GAS)
+ {
+ /* Check whether gas_valid flag is set */
+ if(data.status & BME680_GASM_VALID_MSK)
+ {
+ /* Place sample into input struct */
+ inputs[*num_bsec_inputs].sensor_id = BSEC_INPUT_GASRESISTOR;
+ inputs[*num_bsec_inputs].signal = data.gas_resistance;
+ inputs[*num_bsec_inputs].time_stamp = time_stamp_trigger;
+ (*num_bsec_inputs)++;
+ }
+ }
+ }
+ }
+ (void) bme680_status;
+}
+
+/*!
+ * @brief This function is written to process the sensor data for the requested virtual sensors
+ *
+ * @param[in] bsec_inputs input structure containing the information on sensors to be passed to do_steps
+ * @param[in] num_bsec_inputs number of inputs to be passed to do_steps
+ * @param[in] output_ready pointer to the function processing obtained BSEC outputs
+ *
+ * @return none
+ */
+void bme680_bsec_process_data(bsec_input_t *bsec_inputs, uint8_t num_bsec_inputs, output_ready_fct output_ready)
+{
+ /* Output buffer set to the maximum virtual sensor outputs supported */
+ bsec_output_t bsec_outputs[BSEC_NUMBER_OUTPUTS];
+ uint8_t num_bsec_outputs = 0;
+ uint8_t index = 0;
+
+ bsec_library_return_t bsec_status = BSEC_OK;
+
+ int64_t timestamp = 0;
+ float iaq = 0.0f;
+ uint8_t iaq_accuracy = 0;
+ float temp = 0.0f;
+ float raw_temp = 0.0f;
+ float raw_pressure = 0.0f;
+ float humidity = 0.0f;
+ float raw_humidity = 0.0f;
+ float raw_gas = 0.0f;
+ float static_iaq = 0.0f;
+ uint8_t static_iaq_accuracy = 0;
+ float co2_equivalent = 0.0f;
+ uint8_t co2_accuracy = 0;
+ float breath_voc_equivalent = 0.0f;
+ uint8_t breath_voc_accuracy = 0;
+ float comp_gas_value = 0.0f;
+ uint8_t comp_gas_accuracy = 0;
+ float gas_percentage = 0.0f;
+ uint8_t gas_percentage_acccuracy = 0;
+
+ /* Check if something should be processed by BSEC */
+ if (num_bsec_inputs > 0)
+ {
+ /* Set number of outputs to the size of the allocated buffer */
+ /* BSEC_NUMBER_OUTPUTS to be defined */
+ num_bsec_outputs = BSEC_NUMBER_OUTPUTS;
+
+ /* Perform processing of the data by BSEC
+ Note:
+ * The number of outputs you get depends on what you asked for during bsec_update_subscription(). This is
+ handled under bme680_bsec_update_subscription() function in this example file.
+ * The number of actual outputs that are returned is written to num_bsec_outputs. */
+ bsec_status = bsec_do_steps(bsec_inputs, num_bsec_inputs, bsec_outputs, &num_bsec_outputs);
+
+ /* Iterate through the outputs and extract the relevant ones. */
+ for (index = 0; index < num_bsec_outputs; index++)
+ {
+ switch (bsec_outputs[index].sensor_id)
+ {
+ case BSEC_OUTPUT_IAQ:
+ iaq = bsec_outputs[index].signal;
+ iaq_accuracy = bsec_outputs[index].accuracy;
+ break;
+ case BSEC_OUTPUT_STATIC_IAQ:
+ static_iaq = bsec_outputs[index].signal;
+ static_iaq_accuracy = bsec_outputs[index].accuracy;
+ break;
+ case BSEC_OUTPUT_CO2_EQUIVALENT:
+ co2_equivalent = bsec_outputs[index].signal;
+ co2_accuracy = bsec_outputs[index].accuracy;
+ break;
+ case BSEC_OUTPUT_BREATH_VOC_EQUIVALENT:
+ breath_voc_equivalent = bsec_outputs[index].signal;
+ breath_voc_accuracy = bsec_outputs[index].accuracy;
+ break;
+ case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE:
+ temp = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_RAW_PRESSURE:
+ raw_pressure = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY:
+ humidity = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_RAW_GAS:
+ raw_gas = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_RAW_TEMPERATURE:
+ raw_temp = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_RAW_HUMIDITY:
+ raw_humidity = bsec_outputs[index].signal;
+ break;
+ case BSEC_OUTPUT_COMPENSATED_GAS:
+ comp_gas_value = bsec_outputs[index].signal;
+ comp_gas_accuracy = bsec_outputs[index].accuracy;
+ break;
+ case BSEC_OUTPUT_GAS_PERCENTAGE:
+ gas_percentage = bsec_outputs[index].signal;
+ gas_percentage_acccuracy = bsec_outputs[index].accuracy;
+ break;
+ default:
+ continue;
+ }
+
+ /* Assume that all the returned timestamps are the same */
+ timestamp = bsec_outputs[index].time_stamp;
+ }
+
+ /* Pass the extracted outputs to the user provided output_ready() function. */
+ output_ready(timestamp, iaq, iaq_accuracy, temp, humidity, raw_pressure, raw_temp,
+ raw_humidity, raw_gas, bsec_status, static_iaq, co2_equivalent, breath_voc_equivalent);
+ }
+ (void) static_iaq_accuracy;
+ (void) co2_accuracy;
+ (void) breath_voc_accuracy;
+ (void) comp_gas_value;
+ (void) comp_gas_accuracy;
+ (void) gas_percentage;
+ (void) gas_percentage_acccuracy;
+}
+
+/*!
+ * @brief Runs the main (endless) loop that queries sensor settings, applies them, and processes the measured data
+ *
+ * @param[in] sleep pointer to the system specific sleep function
+ * @param[in] get_timestamp_us pointer to the system specific timestamp derivation function
+ * @param[in] output_ready pointer to the function processing obtained BSEC outputs
+ * @param[in] state_save pointer to the system-specific state save function
+ * @param[in] save_intvl interval at which BSEC state should be saved (in samples)
+ *
+ * @return none
+ */
+void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,
+ state_save_fct state_save, uint32_t save_intvl)
+{
+ /* Timestamp variables */
+ int64_t time_stamp = 0;
+ int64_t time_stamp_interval_ms = 0;
+
+ /* Allocate enough memory for up to BSEC_MAX_PHYSICAL_SENSOR physical inputs*/
+ bsec_input_t bsec_inputs[BSEC_MAX_PHYSICAL_SENSOR];
+
+ /* Number of inputs to BSEC */
+ uint8_t num_bsec_inputs = 0;
+
+ /* BSEC sensor settings struct */
+ bsec_bme_settings_t sensor_settings;
+
+ /* Save state variables */
+ uint8_t bsec_state[BSEC_MAX_STATE_BLOB_SIZE];
+ uint8_t work_buffer[BSEC_MAX_STATE_BLOB_SIZE];
+ uint32_t bsec_state_len = 0;
+ uint32_t n_samples = 0;
+
+ bsec_library_return_t bsec_status = BSEC_OK;
+
+ while (1)
+ {
+ /* get the timestamp in nanoseconds before calling bsec_sensor_control() */
+ time_stamp = get_timestamp_us() * 1000;
+
+ /* Retrieve sensor settings to be used in this time instant by calling bsec_sensor_control */
+ bsec_sensor_control(time_stamp, &sensor_settings);
+
+ /* Trigger a measurement if necessary */
+ bme680_bsec_trigger_measurement(&sensor_settings, sleep);
+
+ /* Read data from last measurement */
+ num_bsec_inputs = 0;
+ bme680_bsec_read_data(time_stamp, bsec_inputs, &num_bsec_inputs, sensor_settings.process_data);
+
+ /* Time to invoke BSEC to perform the actual processing */
+ bme680_bsec_process_data(bsec_inputs, num_bsec_inputs, output_ready);
+
+ /* Increment sample counter */
+ n_samples++;
+
+ /* Retrieve and store state if the passed save_intvl */
+ if (n_samples >= save_intvl)
+ {
+ bsec_status = bsec_get_state(0, bsec_state, sizeof(bsec_state), work_buffer, sizeof(work_buffer), &bsec_state_len);
+ if (bsec_status == BSEC_OK)
+ {
+ state_save(bsec_state, bsec_state_len);
+ }
+ n_samples = 0;
+ }
+
+
+ /* Compute how long we can sleep until we need to call bsec_sensor_control() next */
+ /* Time_stamp is converted from microseconds to nanoseconds first and then the difference to milliseconds */
+ time_stamp_interval_ms = (sensor_settings.next_call - get_timestamp_us() * 1000) / 1000000;
+ if (time_stamp_interval_ms > 0)
+ {
+ sleep((uint32_t)time_stamp_interval_ms);
+ }
+ }
+}
+
+/*! @}*/
+
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.h
new file mode 100644
index 0000000..a15177f
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_integration.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2017 Robert Bosch. All Rights Reserved.
+ *
+ * Disclaimer
+ *
+ * Common:
+ * Bosch Sensortec products are developed for the consumer goods industry. They may only be used
+ * within the parameters of the respective valid product data sheet. Bosch Sensortec products are
+ * provided with the express understanding that there is no warranty of fitness for a particular purpose.
+ * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device
+ * that may lead to bodily harm or property damage if the system or device malfunctions. In addition,
+ * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems.
+ * The resale and/or use of products are at the purchasers own risk and his own responsibility. The
+ * examination of fitness for the intended use is the sole responsibility of the Purchaser.
+ *
+ * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for
+ * incidental, or consequential damages, arising from any product use not covered by the parameters of
+ * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch
+ * Sensortec for all costs in connection with such claims.
+ *
+ * The purchaser must monitor the market for the purchased products, particularly with regard to
+ * product safety and inform Bosch Sensortec without delay of all security relevant incidents.
+ *
+ * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid
+ * technical specifications of the product series. They are therefore not intended or fit for resale to third
+ * parties or for use in end products. Their sole purpose is internal client testing. The testing of an
+ * engineering sample may in no way replace the testing of a product series. Bosch Sensortec
+ * assumes no liability for the use of engineering samples. By accepting the engineering samples, the
+ * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering
+ * samples.
+ *
+ * Special:
+ * This software module (hereinafter called "Software") and any information on application-sheets
+ * (hereinafter called "Information") is provided free of charge for the sole purpose to support your
+ * application work. The Software and Information is subject to the following terms and conditions:
+ *
+ * The Software is specifically designed for the exclusive use for Bosch Sensortec products by
+ * personnel who have special experience and training. Do not use this Software if you do not have the
+ * proper experience or training.
+ *
+ * This Software package is provided `` as is `` and without any expressed or implied warranties,
+ * including without limitation, the implied warranties of merchantability and fitness for a particular
+ * purpose.
+ *
+ * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment
+ * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their
+ * representatives and agents shall not be liable for any direct or indirect damages or injury, except as
+ * otherwise stipulated in mandatory applicable law.
+ *
+ * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no
+ * responsibility for the consequences of use of such Information nor for any infringement of patents or
+ * other rights of third parties which may result from its use. No license is granted by implication or
+ * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are
+ * subject to change without notice.
+ *
+ * It is not allowed to deliver the source code of the Software to any third party without permission of
+ * Bosch Sensortec.
+ *
+ */
+
+/*!
+ * @file bsec_integration.h
+ *
+ * @brief
+ * Contains BSEC integration API
+ */
+
+/*!
+ * @addtogroup bsec_examples BSEC Examples
+ * @brief BSEC usage examples
+ * @{*/
+
+#ifndef __BSEC_INTEGRATION_H__
+#define __BSEC_INTEGRATION_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**********************************************************************************************************************/
+/* header files */
+/**********************************************************************************************************************/
+
+/* Use the following bme680 driver: https://github.com/BoschSensortec/BME680_driver/releases/tag/bme680_v3.5.1 */
+#include "bme680.h"
+/* BSEC header files are available in the inc/ folder of the release package */
+#include "bsec_interface.h"
+#include "bsec_datatypes.h"
+
+
+/**********************************************************************************************************************/
+/* type definitions */
+/**********************************************************************************************************************/
+
+/* function pointer to the system specific sleep function */
+typedef void (*sleep_fct)(uint32_t t_ms);
+
+/* function pointer to the system specific timestamp derivation function */
+typedef int64_t (*get_timestamp_us_fct)();
+
+/* function pointer to the function processing obtained BSEC outputs */
+typedef void (*output_ready_fct)(int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temperature, float humidity,
+ float pressure, float raw_temperature, float raw_humidity, float gas, bsec_library_return_t bsec_status,
+ float static_iaq, float co2_equivalent, float breath_voc_equivalent);
+
+/* function pointer to the function loading a previous BSEC state from NVM */
+typedef uint32_t (*state_load_fct)(uint8_t *state_buffer, uint32_t n_buffer);
+
+/* function pointer to the function saving BSEC state to NVM */
+typedef void (*state_save_fct)(const uint8_t *state_buffer, uint32_t length);
+
+/* function pointer to the function loading the BSEC configuration string from NVM */
+typedef uint32_t (*config_load_fct)(uint8_t *state_buffer, uint32_t n_buffer);
+
+/* structure definitions */
+
+/* Structure with the return value from bsec_iot_init() */
+typedef struct{
+ /*! Result of API execution status */
+ int8_t bme680_status;
+ /*! Result of BSEC library */
+ bsec_library_return_t bsec_status;
+}return_values_init;
+/**********************************************************************************************************************/
+/* function declarations */
+/**********************************************************************************************************************/
+
+/*!
+ * @brief Initialize the BME680 sensor and the BSEC library
+ *
+ * @param[in] sample_rate mode to be used (either BSEC_SAMPLE_RATE_ULP or BSEC_SAMPLE_RATE_LP)
+ * @param[in] temperature_offset device-specific temperature offset (due to self-heating)
+ * @param[in] bus_write pointer to the bus writing function
+ * @param[in] bus_read pointer to the bus reading function
+ * @param[in] sleep pointer to the system-specific sleep function
+ * @param[in] state_load pointer to the system-specific state load function
+ *
+ * @return zero if successful, negative otherwise
+ */
+return_values_init bsec_iot_init(float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write, bme680_com_fptr_t bus_read,
+ sleep_fct sleep, state_load_fct state_load, config_load_fct config_load);
+
+/*!
+ * @brief Runs the main (endless) loop that queries sensor settings, applies them, and processes the measured data
+ *
+ * @param[in] sleep pointer to the system-specific sleep function
+ * @param[in] get_timestamp_us pointer to the system-specific timestamp derivation function
+ * @param[in] output_ready pointer to the function processing obtained BSEC outputs
+ * @param[in] state_save pointer to the system-specific state save function
+ * @param[in] save_intvl interval at which BSEC state should be saved (in samples)
+ *
+ * @return return_values_init struct with the result of the API and the BSEC library
+ */
+void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,
+ state_save_fct state_save, uint32_t save_intvl);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BSEC_INTEGRATION_H__ */
+
+/*! @}*/
+
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.c b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.c
new file mode 100644
index 0000000..62fc60e
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.c
@@ -0,0 +1,5 @@
+#include "bsec_serialized_configurations_iaq.h"
+
+const uint8_t bsec_config_iaq[454] =
+ {4,7,4,1,61,0,0,0,0,0,0,0,174,1,0,0,48,0,1,0,0,192,168,71,64,49,119,76,0,0,225,68,137,65,0,63,205,204,204,62,0,0,64,63,205,204,204,62,0,0,0,0,216,85,0,100,0,0,0,0,0,0,0,0,28,0,2,0,0,244,1,225,0,25,0,0,128,64,0,0,32,65,144,1,0,0,112,65,0,0,0,63,16,0,3,0,10,215,163,60,10,215,35,59,10,215,35,59,9,0,5,0,0,0,0,0,1,88,0,9,0,7,240,150,61,0,0,0,0,0,0,0,0,28,124,225,61,52,128,215,63,0,0,160,64,0,0,0,0,0,0,0,0,205,204,12,62,103,213,39,62,230,63,76,192,0,0,0,0,0,0,0,0,145,237,60,191,251,58,64,63,177,80,131,64,0,0,0,0,0,0,0,0,93,254,227,62,54,60,133,191,0,0,64,64,12,0,10,0,0,0,0,0,0,0,0,0,229,0,254,0,2,1,5,48,117,100,0,44,1,112,23,151,7,132,3,197,0,92,4,144,1,64,1,64,1,144,1,48,117,48,117,48,117,48,117,100,0,100,0,100,0,48,117,48,117,48,117,100,0,100,0,48,117,48,117,100,0,100,0,100,0,100,0,48,117,48,117,48,117,100,0,100,0,100,0,48,117,48,117,100,0,100,0,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,255,255,255,255,255,255,255,255,220,5,220,5,220,5,255,255,255,255,255,255,220,5,220,5,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,44,1,0,0,0,0,52,233,0,0};
+
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.h
new file mode 100644
index 0000000..1986e2b
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BME680/bsec_serialized_configurations_iaq.h
@@ -0,0 +1,4 @@
+#include
+
+extern const uint8_t bsec_config_iaq[454];
+
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/PLACE_libalgobsec_LIB_HERE b/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/PLACE_libalgobsec_LIB_HERE
new file mode 100644
index 0000000..e69de29
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_datatypes.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_datatypes.h
new file mode 100644
index 0000000..7b45f7f
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_datatypes.h
@@ -0,0 +1,488 @@
+/*
+ * Copyright (C) 2015, 2016, 2017 Robert Bosch. All Rights Reserved.
+ *
+ * Disclaimer
+ *
+ * Common:
+ * Bosch Sensortec products are developed for the consumer goods industry. They may only be used
+ * within the parameters of the respective valid product data sheet. Bosch Sensortec products are
+ * provided with the express understanding that there is no warranty of fitness for a particular purpose.
+ * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device
+ * that may lead to bodily harm or property damage if the system or device malfunctions. In addition,
+ * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems.
+ * The resale and/or use of products are at the purchasers own risk and his own responsibility. The
+ * examination of fitness for the intended use is the sole responsibility of the Purchaser.
+ *
+ * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for
+ * incidental, or consequential damages, arising from any product use not covered by the parameters of
+ * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch
+ * Sensortec for all costs in connection with such claims.
+ *
+ * The purchaser must monitor the market for the purchased products, particularly with regard to
+ * product safety and inform Bosch Sensortec without delay of all security relevant incidents.
+ *
+ * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid
+ * technical specifications of the product series. They are therefore not intended or fit for resale to third
+ * parties or for use in end products. Their sole purpose is internal client testing. The testing of an
+ * engineering sample may in no way replace the testing of a product series. Bosch Sensortec
+ * assumes no liability for the use of engineering samples. By accepting the engineering samples, the
+ * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering
+ * samples.
+ *
+ * Special:
+ * This software module (hereinafter called "Software") and any information on application-sheets
+ * (hereinafter called "Information") is provided free of charge for the sole purpose to support your
+ * application work. The Software and Information is subject to the following terms and conditions:
+ *
+ * The Software is specifically designed for the exclusive use for Bosch Sensortec products by
+ * personnel who have special experience and training. Do not use this Software if you do not have the
+ * proper experience or training.
+ *
+ * This Software package is provided `` as is `` and without any expressed or implied warranties,
+ * including without limitation, the implied warranties of merchantability and fitness for a particular
+ * purpose.
+ *
+ * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment
+ * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their
+ * representatives and agents shall not be liable for any direct or indirect damages or injury, except as
+ * otherwise stipulated in mandatory applicable law.
+ *
+ * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no
+ * responsibility for the consequences of use of such Information nor for any infringement of patents or
+ * other rights of third parties which may result from its use. No license is granted by implication or
+ * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are
+ * subject to change without notice.
+ *
+ * It is not allowed to deliver the source code of the Software to any third party without permission of
+ * Bosch Sensortec.
+ *
+ */
+
+ /**
+ * @file bsec_datatypes.h
+ *
+ * @brief
+ * Contains the data types used by BSEC
+ *
+ */
+
+#ifndef __BSEC_DATATYPES_H__
+#define __BSEC_DATATYPES_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*!
+ * @addtogroup bsec_interface BSEC C Interface
+ * @{*/
+
+#ifdef __KERNEL__
+#include
+#endif
+#include
+#include
+
+#define BSEC_MAX_WORKBUFFER_SIZE (2048) /*!< Maximum size (in bytes) of the work buffer */
+#define BSEC_MAX_PHYSICAL_SENSOR (8) /*!< Number of physical sensors that need allocated space before calling bsec_update_subscription() */
+#define BSEC_MAX_PROPERTY_BLOB_SIZE (454) /*!< Maximum size (in bytes) of the data blobs returned by bsec_get_configuration() */
+#define BSEC_MAX_STATE_BLOB_SIZE (139) /*!< Maximum size (in bytes) of the data blobs returned by bsec_get_state()*/
+#define BSEC_SAMPLE_RATE_DISABLED (65535.0f) /*!< Sample rate of a disabled sensor */
+#define BSEC_SAMPLE_RATE_ULP (0.0033333f) /*!< Sample rate in case of Ultra Low Power Mode */
+#define BSEC_SAMPLE_RATE_LP (0.33333f) /*!< Sample rate in case of Low Power Mode */
+#define BSEC_SAMPLE_RATE_ULP_MEASUREMENT_ON_DEMAND (0.0f) /*!< Input value used to trigger an extra measurment (ULP plus) */
+
+#define BSEC_PROCESS_PRESSURE (1 << (BSEC_INPUT_PRESSURE-1)) /*!< process_data bitfield constant for pressure @sa bsec_bme_settings_t */
+#define BSEC_PROCESS_TEMPERATURE (1 << (BSEC_INPUT_TEMPERATURE-1)) /*!< process_data bitfield constant for temperature @sa bsec_bme_settings_t */
+#define BSEC_PROCESS_HUMIDITY (1 << (BSEC_INPUT_HUMIDITY-1)) /*!< process_data bitfield constant for humidity @sa bsec_bme_settings_t */
+#define BSEC_PROCESS_GAS (1 << (BSEC_INPUT_GASRESISTOR-1)) /*!< process_data bitfield constant for gas sensor @sa bsec_bme_settings_t */
+#define BSEC_NUMBER_OUTPUTS (14) /*!< Number of outputs, depending on solution */
+#define BSEC_OUTPUT_INCLUDED (1210863) /*!< bitfield that indicates which outputs are included in the solution */
+
+/*!
+ * @brief Enumeration for input (physical) sensors.
+ *
+ * Used to populate bsec_input_t::sensor_id. It is also used in bsec_sensor_configuration_t::sensor_id structs
+ * returned in the parameter required_sensor_settings of bsec_update_subscription().
+ *
+ * @sa bsec_sensor_configuration_t @sa bsec_input_t
+ */
+typedef enum
+{
+ /**
+ * @brief Pressure sensor output of BMExxx [Pa]
+ */
+ BSEC_INPUT_PRESSURE = 1,
+
+ /**
+ * @brief Humidity sensor output of BMExxx [%]
+ *
+ * @note Relative humidity strongly depends on the temperature (it is measured at). It may require a conversion to
+ * the temperature outside of the device.
+ *
+ * @sa bsec_virtual_sensor_t
+ */
+ BSEC_INPUT_HUMIDITY = 2,
+
+ /**
+ * @brief Temperature sensor output of BMExxx [degrees Celsius]
+ *
+ * @note The BME680 is factory trimmed, thus the temperature sensor of the BME680 is very accurate.
+ * The temperature value is a very local measurement value and can be influenced by external heat sources.
+ *
+ * @sa bsec_virtual_sensor_t
+ */
+ BSEC_INPUT_TEMPERATURE = 3,
+
+ /**
+ * @brief Gas sensor resistance output of BMExxx [Ohm]
+ *
+ * The resistance value changes due to varying VOC concentrations (the higher the concentration of reducing VOCs,
+ * the lower the resistance and vice versa).
+ */
+ BSEC_INPUT_GASRESISTOR = 4, /*!< */
+
+ /**
+ * @brief Additional input for device heat compensation
+ *
+ * IAQ solution: The value is subtracted from ::BSEC_INPUT_TEMPERATURE to compute
+ * ::BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE.
+ *
+ * ALL solution: Generic heat source 1
+ *
+ * @sa bsec_virtual_sensor_t
+ */
+ BSEC_INPUT_HEATSOURCE = 14,
+
+ /**
+ * @brief Additional input for device heat compensation 8
+ *
+ * Generic heat source 8
+ */
+
+
+ /**
+ * @brief Additional input that disables baseline tracker
+ *
+ * 0 - Normal
+ * 1 - Event 1
+ * 2 - Event 2
+ */
+ BSEC_INPUT_DISABLE_BASELINE_TRACKER = 23,
+
+} bsec_physical_sensor_t;
+
+/*!
+ * @brief Enumeration for output (virtual) sensors
+ *
+ * Used to populate bsec_output_t::sensor_id. It is also used in bsec_sensor_configuration_t::sensor_id structs
+ * passed in the parameter requested_virtual_sensors of bsec_update_subscription().
+ *
+ * @sa bsec_sensor_configuration_t @sa bsec_output_t
+ */
+typedef enum
+{
+ /**
+ * @brief Indoor-air-quality estimate [0-500]
+ *
+ * Indoor-air-quality (IAQ) gives an indication of the relative change in ambient TVOCs detected by BME680.
+ *
+ * @note The IAQ scale ranges from 0 (clean air) to 500 (heavily polluted air). During operation, algorithms
+ * automatically calibrate and adapt themselves to the typical environments where the sensor is operated
+ * (e.g., home, workplace, inside a car, etc.).This automatic background calibration ensures that users experience
+ * consistent IAQ performance. The calibration process considers the recent measurement history (typ. up to four
+ * days) to ensure that IAQ=25 corresponds to typical good air and IAQ=250 indicates typical polluted air.
+ */
+ BSEC_OUTPUT_IAQ = 1,
+ BSEC_OUTPUT_STATIC_IAQ = 2, /*!< Unscaled indoor-air-quality estimate */
+ BSEC_OUTPUT_CO2_EQUIVALENT = 3, /*!< co2 equivalent estimate [ppm] */
+ BSEC_OUTPUT_BREATH_VOC_EQUIVALENT = 4, /*!< breath VOC concentration estimate [ppm] */
+
+ /**
+ * @brief Temperature sensor signal [degrees Celsius]
+ *
+ * Temperature directly measured by BME680 in degree Celsius.
+ *
+ * @note This value is cross-influenced by the sensor heating and device specific heating.
+ */
+ BSEC_OUTPUT_RAW_TEMPERATURE = 6,
+
+ /**
+ * @brief Pressure sensor signal [Pa]
+ *
+ * Pressure directly measured by the BME680 in Pa.
+ */
+ BSEC_OUTPUT_RAW_PRESSURE = 7,
+
+ /**
+ * @brief Relative humidity sensor signal [%]
+ *
+ * Relative humidity directly measured by the BME680 in %.
+ *
+ * @note This value is cross-influenced by the sensor heating and device specific heating.
+ */
+ BSEC_OUTPUT_RAW_HUMIDITY = 8,
+
+ /**
+ * @brief Gas sensor signal [Ohm]
+ *
+ * Gas resistance measured directly by the BME680 in Ohm.The resistance value changes due to varying VOC
+ * concentrations (the higher the concentration of reducing VOCs, the lower the resistance and vice versa).
+ */
+ BSEC_OUTPUT_RAW_GAS = 9,
+
+ /**
+ * @brief Gas sensor stabilization status [boolean]
+ *
+ * Indicates initial stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization
+ * is finished (1).
+ */
+ BSEC_OUTPUT_STABILIZATION_STATUS = 12,
+
+ /**
+ * @brief Gas sensor run-in status [boolean]
+ *
+ * Indicates power-on stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization
+ * is finished (1).
+ */
+ BSEC_OUTPUT_RUN_IN_STATUS = 13,
+
+ /**
+ * @brief Sensor heat compensated temperature [degrees Celsius]
+ *
+ * Temperature measured by BME680 which is compensated for the influence of sensor (heater) in degree Celsius.
+ * The self heating introduced by the heater is depending on the sensor operation mode and the sensor supply voltage.
+ *
+ *
+ * @note IAQ solution: In addition, the temperature output can be compensated by an user defined value
+ * (::BSEC_INPUT_HEATSOURCE in degrees Celsius), which represents the device specific self-heating.
+ *
+ * Thus, the value is calculated as follows:
+ * * IAQ solution: ```BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE = ::BSEC_INPUT_TEMPERATURE - function(sensor operation mode, sensor supply voltage) - ::BSEC_INPUT_HEATSOURCE```
+ * * other solutions: ```::BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE = ::BSEC_INPUT_TEMPERATURE - function(sensor operation mode, sensor supply voltage)```
+ *
+ * The self-heating in operation mode BSEC_SAMPLE_RATE_ULP is negligible.
+ * The self-heating in operation mode BSEC_SAMPLE_RATE_LP is supported for 1.8V by default (no config file required). If the BME680 sensor supply voltage is 3.3V, the IoT_LP_3_3V.config shall be used.
+ */
+ BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE = 14,
+
+ /**
+ * @brief Sensor heat compensated humidity [%]
+ *
+ * Relative measured by BME680 which is compensated for the influence of sensor (heater) in %.
+ *
+ * It converts the ::BSEC_INPUT_HUMIDITY from temperature ::BSEC_INPUT_TEMPERATURE to temperature
+ * ::BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE.
+ *
+ * @note IAQ solution: If ::BSEC_INPUT_HEATSOURCE is used for device specific temperature compensation, it will be
+ * effective for ::BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY too.
+ */
+ BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY = 15,
+
+ BSEC_OUTPUT_COMPENSATED_GAS = 18, /*!< Reserved internal debug output */
+ BSEC_OUTPUT_GAS_PERCENTAGE = 21 /*!< percentage of min and max filtered gas value [%] */
+} bsec_virtual_sensor_t;
+
+/*!
+ * @brief Enumeration for function return codes
+ */
+typedef enum
+{
+ BSEC_OK = 0, /*!< Function execution successful */
+ BSEC_E_DOSTEPS_INVALIDINPUT = -1, /*!< Input (physical) sensor id passed to bsec_do_steps() is not in the valid range or not valid for requested virtual sensor */
+ BSEC_E_DOSTEPS_VALUELIMITS = -2, /*!< Value of input (physical) sensor signal passed to bsec_do_steps() is not in the valid range */
+ BSEC_E_DOSTEPS_DUPLICATEINPUT = -6, /*!< Duplicate input (physical) sensor ids passed as input to bsec_do_steps() */
+ BSEC_I_DOSTEPS_NOOUTPUTSRETURNABLE = 2, /*!< No memory allocated to hold return values from bsec_do_steps(), i.e., n_outputs == 0 */
+ BSEC_W_DOSTEPS_EXCESSOUTPUTS = 3, /*!< Not enough memory allocated to hold return values from bsec_do_steps(), i.e., n_outputs < maximum number of requested output (virtual) sensors */
+ BSEC_W_DOSTEPS_TSINTRADIFFOUTOFRANGE = 4, /*!< Duplicate timestamps passed to bsec_do_steps() */
+ BSEC_E_SU_WRONGDATARATE = -10, /*!< The sample_rate of the requested output (virtual) sensor passed to bsec_update_subscription() is zero */
+ BSEC_E_SU_SAMPLERATELIMITS = -12, /*!< The sample_rate of the requested output (virtual) sensor passed to bsec_update_subscription() does not match with the sampling rate allowed for that sensor */
+ BSEC_E_SU_DUPLICATEGATE = -13, /*!< Duplicate output (virtual) sensor ids requested through bsec_update_subscription() */
+ BSEC_E_SU_INVALIDSAMPLERATE = -14, /*!< The sample_rate of the requested output (virtual) sensor passed to bsec_update_subscription() does not fall within the global minimum and maximum sampling rates */
+ BSEC_E_SU_GATECOUNTEXCEEDSARRAY = -15, /*!< Not enough memory allocated to hold returned input (physical) sensor data from bsec_update_subscription(), i.e., n_required_sensor_settings < #BSEC_MAX_PHYSICAL_SENSOR */
+ BSEC_E_SU_SAMPLINTVLINTEGERMULT = -16, /*!< The sample_rate of the requested output (virtual) sensor passed to bsec_update_subscription() is not correct */
+ BSEC_E_SU_MULTGASSAMPLINTVL = -17, /*!< The sample_rate of the requested output (virtual), which requires the gas sensor, is not equal to the sample_rate that the gas sensor is being operated */
+ BSEC_E_SU_HIGHHEATERONDURATION = -18, /*!< The duration of one measurement is longer than the requested sampling interval */
+ BSEC_W_SU_UNKNOWNOUTPUTGATE = 10, /*!< Output (virtual) sensor id passed to bsec_update_subscription() is not in the valid range; e.g., n_requested_virtual_sensors > actual number of output (virtual) sensors requested */
+ BSEC_W_SU_MODINNOULP = 11, /*!< ULP plus can not be requested in non-ulp mode */ /*MOD_ONLY*/
+ BSEC_I_SU_SUBSCRIBEDOUTPUTGATES = 12, /*!< No output (virtual) sensor data were requested via bsec_update_subscription() */
+ BSEC_E_PARSE_SECTIONEXCEEDSWORKBUFFER = -32, /*!< n_work_buffer_size passed to bsec_set_[configuration/state]() not sufficient */
+ BSEC_E_CONFIG_FAIL = -33, /*!< Configuration failed */
+ BSEC_E_CONFIG_VERSIONMISMATCH = -34, /*!< Version encoded in serialized_[settings/state] passed to bsec_set_[configuration/state]() does not match with current version */
+ BSEC_E_CONFIG_FEATUREMISMATCH = -35, /*!< Enabled features encoded in serialized_[settings/state] passed to bsec_set_[configuration/state]() does not match with current library implementation */
+ BSEC_E_CONFIG_CRCMISMATCH = -36, /*!< serialized_[settings/state] passed to bsec_set_[configuration/state]() is corrupted */
+ BSEC_E_CONFIG_EMPTY = -37, /*!< n_serialized_[settings/state] passed to bsec_set_[configuration/state]() is to short to be valid */
+ BSEC_E_CONFIG_INSUFFICIENTWORKBUFFER = -38, /*!< Provided work_buffer is not large enough to hold the desired string */
+ BSEC_E_CONFIG_INVALIDSTRINGSIZE = -40, /*!< String size encoded in configuration/state strings passed to bsec_set_[configuration/state]() does not match with the actual string size n_serialized_[settings/state] passed to these functions */
+ BSEC_E_CONFIG_INSUFFICIENTBUFFER = -41, /*!< String buffer insufficient to hold serialized data from BSEC library */
+ BSEC_E_SET_INVALIDCHANNELIDENTIFIER = -100, /*!< Internal error code, size of work buffer in setConfig must be set to BSEC_MAX_WORKBUFFER_SIZE */
+ BSEC_E_SET_INVALIDLENGTH = -104, /*!< Internal error code */
+ BSEC_W_SC_CALL_TIMING_VIOLATION = 100, /*!< Difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed */
+ BSEC_W_SC_MODEXCEEDULPTIMELIMIT = 101, /*!< ULP plus is not allowed because an ULP measurement just took or will take place */ /*MOD_ONLY*/
+ BSEC_W_SC_MODINSUFFICIENTWAITTIME = 102 /*!< ULP plus is not allowed because not sufficient time passed since last ULP plus */ /*MOD_ONLY*/
+} bsec_library_return_t;
+
+/*!
+ * @brief Structure containing the version information
+ *
+ * Please note that configuration and state strings are coded to a specific version and will not be accepted by other
+ * versions of BSEC.
+ *
+ */
+typedef struct
+{
+ uint8_t major; /**< @brief Major version */
+ uint8_t minor; /**< @brief Minor version */
+ uint8_t major_bugfix; /**< @brief Major bug fix version */
+ uint8_t minor_bugfix; /**< @brief Minor bug fix version */
+} bsec_version_t;
+
+/*!
+ * @brief Structure describing an input sample to the library
+ *
+ * Each input sample is provided to BSEC as an element in a struct array of this type. Timestamps must be provided
+ * in nanosecond resolution. Moreover, duplicate timestamps for subsequent samples are not allowed and will results in
+ * an error code being returned from bsec_do_steps().
+ *
+ * The meaning unit of the signal field are determined by the bsec_input_t::sensor_id field content. Possible
+ * bsec_input_t::sensor_id values and and their meaning are described in ::bsec_physical_sensor_t.
+ *
+ * @sa bsec_physical_sensor_t
+ *
+ */
+typedef struct
+{
+ /**
+ * @brief Time stamp in nanosecond resolution [ns]
+ *
+ * Timestamps must be provided as non-repeating and increasing values. They can have their 0-points at system start or
+ * at a defined wall-clock time (e.g., 01-Jan-1970 00:00:00)
+ */
+ int64_t time_stamp;
+ float signal; /*!< @brief Signal sample in the unit defined for the respective sensor_id @sa bsec_physical_sensor_t */
+ uint8_t signal_dimensions; /*!< @brief Signal dimensions (reserved for future use, shall be set to 1) */
+ uint8_t sensor_id; /*!< @brief Identifier of physical sensor @sa bsec_physical_sensor_t */
+} bsec_input_t;
+
+/*!
+ * @brief Structure describing an output sample of the library
+ *
+ * Each output sample is returned from BSEC by populating the element of a struct array of this type. The contents of
+ * the signal field is defined by the supplied bsec_output_t::sensor_id. Possible output
+ * bsec_output_t::sensor_id values are defined in ::bsec_virtual_sensor_t.
+ *
+ * @sa bsec_virtual_sensor_t
+ */
+typedef struct
+{
+ int64_t time_stamp; /*!< @brief Time stamp in nanosecond resolution as provided as input [ns] */
+ float signal; /*!< @brief Signal sample in the unit defined for the respective bsec_output_t::sensor_id @sa bsec_virtual_sensor_t */
+ uint8_t signal_dimensions; /*!< @brief Signal dimensions (reserved for future use, shall be set to 1) */
+ uint8_t sensor_id; /*!< @brief Identifier of virtual sensor @sa bsec_virtual_sensor_t */
+
+ /**
+ * @brief Accuracy status 0-3
+ *
+ * Some virtual sensors provide a value in the accuracy field. If this is the case, the meaning of the field is as
+ * follows:
+ *
+ * | Name | Value | Accuracy description |
+ * |----------------------------|-------|-------------------------------------------------------------|
+ * | UNRELIABLE | 0 | Sensor data is unreliable, the sensor must be calibrated |
+ * | LOW_ACCURACY | 1 | Low accuracy, sensor should be calibrated |
+ * | MEDIUM_ACCURACY | 2 | Medium accuracy, sensor calibration may improve performance |
+ * | HIGH_ACCURACY | 3 | High accuracy |
+ *
+ * For example:
+ *
+ * - Ambient temperature accuracy is derived from change in the temperature in 1 minute.
+ *
+ * | Virtual sensor | Value | Accuracy description |
+ * |--------------------- |-------|------------------------------------------------------------------------------|
+ * | Ambient temperature | 0 | The difference in ambient temperature is greater than 4 degree in one minute |
+ * | | 1 | The difference in ambient temperature is less than 4 degree in one minute |
+ * | | 2 | The difference in ambient temperature is less than 3 degree in one minute |
+ * | | 3 | The difference in ambient temperature is less than 2 degree in one minute |
+ *
+ * - IAQ accuracy indicator will notify the user when she/he should initiate a calibration process. Calibration is
+ * performed automatically in the background if the sensor is exposed to clean and polluted air for approximately
+ * 30 minutes each.
+ *
+ * | Virtual sensor | Value | Accuracy description |
+ * |----------------------------|-------|-----------------------------------------------------------------|
+ * | IAQ | 0 | The sensor is not yet stabilized or in a run-in status |
+ * | | 1 | Calibration required |
+ * | | 2 | Calibration on-going |
+ * | | 3 | Calibration is done, now IAQ estimate achieves best performance |
+ */
+ uint8_t accuracy;
+} bsec_output_t;
+
+/*!
+ * @brief Structure describing sample rate of physical/virtual sensors
+ *
+ * This structure is used together with bsec_update_subscription() to enable BSEC outputs and to retrieve information
+ * about the sample rates used for BSEC inputs.
+ */
+typedef struct
+{
+ /**
+ * @brief Sample rate of the virtual or physical sensor in Hertz [Hz]
+ *
+ * Only supported sample rates are allowed.
+ */
+ float sample_rate;
+
+ /**
+ * @brief Identifier of the virtual or physical sensor
+ *
+ * The meaning of this field changes depending on whether the structs are as the requested_virtual_sensors argument
+ * to bsec_update_subscription() or as the required_sensor_settings argument.
+ *
+ * | bsec_update_subscription() argument | sensor_id field interpretation |
+ * |-------------------------------------|--------------------------------|
+ * | requested_virtual_sensors | ::bsec_virtual_sensor_t |
+ * | required_sensor_settings | ::bsec_physical_sensor_t |
+ *
+ * @sa bsec_physical_sensor_t
+ * @sa bsec_virtual_sensor_t
+ */
+ uint8_t sensor_id;
+} bsec_sensor_configuration_t;
+
+/*!
+ * @brief Structure returned by bsec_sensor_control() to configure BMExxx sensor
+ *
+ * This structure contains settings that must be used to configure the BMExxx to perform a forced-mode measurement.
+ * A measurement should only be executed if bsec_bme_settings_t::trigger_measurement is 1. If so, the oversampling
+ * settings for temperature, humidity, and pressure should be set to the provided settings provided in
+ * bsec_bme_settings_t::temperature_oversampling, bsec_bme_settings_t::humidity_oversampling, and
+ * bsec_bme_settings_t::pressure_oversampling, respectively.
+ *
+ * In case of bsec_bme_settings_t::run_gas = 1, the gas sensor must be enabled with the provided
+ * bsec_bme_settings_t::heater_temperature and bsec_bme_settings_t::heating_duration settings.
+ */
+typedef struct
+{
+ int64_t next_call; /*!< @brief Time stamp of the next call of the sensor_control*/
+ uint32_t process_data; /*!< @brief Bit field describing which data is to be passed to bsec_do_steps() @sa BSEC_PROCESS_* */
+ uint16_t heater_temperature; /*!< @brief Heating temperature [degrees Celsius] */
+ uint16_t heating_duration; /*!< @brief Heating duration [ms] */
+ uint8_t run_gas; /*!< @brief Enable gas measurements [0/1] */
+ uint8_t pressure_oversampling; /*!< @brief Pressure oversampling settings [0-5] */
+ uint8_t temperature_oversampling; /*!< @brief Temperature oversampling settings [0-5] */
+ uint8_t humidity_oversampling; /*!< @brief Humidity oversampling settings [0-5] */
+ uint8_t trigger_measurement; /*!< @brief Trigger a forced measurement with these settings now [0/1] */
+} bsec_bme_settings_t;
+
+/* internal defines and backward compatibility */
+#define BSEC_STRUCT_NAME Bsec /*!< Internal struct name */
+
+/*@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_interface.h b/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_interface.h
new file mode 100644
index 0000000..d6c09a3
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/BOSCH/BSEC/bsec_interface.h
@@ -0,0 +1,564 @@
+/*
+ * Copyright (C) 2015, 2016, 2017 Robert Bosch. All Rights Reserved.
+ *
+ * Disclaimer
+ *
+ * Common:
+ * Bosch Sensortec products are developed for the consumer goods industry. They may only be used
+ * within the parameters of the respective valid product data sheet. Bosch Sensortec products are
+ * provided with the express understanding that there is no warranty of fitness for a particular purpose.
+ * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device
+ * that may lead to bodily harm or property damage if the system or device malfunctions. In addition,
+ * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems.
+ * The resale and/or use of products are at the purchasers own risk and his own responsibility. The
+ * examination of fitness for the intended use is the sole responsibility of the Purchaser.
+ *
+ * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for
+ * incidental, or consequential damages, arising from any product use not covered by the parameters of
+ * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch
+ * Sensortec for all costs in connection with such claims.
+ *
+ * The purchaser must monitor the market for the purchased products, particularly with regard to
+ * product safety and inform Bosch Sensortec without delay of all security relevant incidents.
+ *
+ * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid
+ * technical specifications of the product series. They are therefore not intended or fit for resale to third
+ * parties or for use in end products. Their sole purpose is internal client testing. The testing of an
+ * engineering sample may in no way replace the testing of a product series. Bosch Sensortec
+ * assumes no liability for the use of engineering samples. By accepting the engineering samples, the
+ * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering
+ * samples.
+ *
+ * Special:
+ * This software module (hereinafter called "Software") and any information on application-sheets
+ * (hereinafter called "Information") is provided free of charge for the sole purpose to support your
+ * application work. The Software and Information is subject to the following terms and conditions:
+ *
+ * The Software is specifically designed for the exclusive use for Bosch Sensortec products by
+ * personnel who have special experience and training. Do not use this Software if you do not have the
+ * proper experience or training.
+ *
+ * This Software package is provided `` as is `` and without any expressed or implied warranties,
+ * including without limitation, the implied warranties of merchantability and fitness for a particular
+ * purpose.
+ *
+ * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment
+ * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their
+ * representatives and agents shall not be liable for any direct or indirect damages or injury, except as
+ * otherwise stipulated in mandatory applicable law.
+ *
+ * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no
+ * responsibility for the consequences of use of such Information nor for any infringement of patents or
+ * other rights of third parties which may result from its use. No license is granted by implication or
+ * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are
+ * subject to change without notice.
+ *
+ * It is not allowed to deliver the source code of the Software to any third party without permission of
+ * Bosch Sensortec.
+ *
+ */
+ /*!
+ *
+ * @file bsec_interface.h
+ *
+ * @brief
+ * Contains the API for BSEC
+ *
+ */
+
+
+#ifndef __BSEC_INTERFACE_H__
+#define __BSEC_INTERFACE_H__
+
+#include "bsec_datatypes.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ /*! @addtogroup bsec_interface BSEC C Interface
+ * @brief Interfaces of BSEC signal processing library
+ *
+ * ### Interface usage
+ *
+ * The following provides a short overview on the typical operation sequence for BSEC.
+ *
+ * - Initialization of the library
+ *
+ * | Steps | Function |
+ * |---------------------------------------------------------------------|--------------------------|
+ * | Initialization of library | bsec_init() |
+ * | Update configuration settings (optional) | bsec_set_configuration() |
+ * | Restore the state of the library (optional) | bsec_set_state() |
+ *
+ *
+ * - The following function is called to enable output signals and define their sampling rate / operation mode.
+ *
+ * | Steps | Function |
+ * |---------------------------------------------|----------------------------|
+ * | Enable library outputs with specified mode | bsec_update_subscription() |
+ *
+ *
+ * - This table describes the main processing loop.
+ *
+ * | Steps | Function |
+ * |-------------------------------------------|----------------------------------|
+ * | Retrieve sensor settings to be used | bsec_sensor_control() |
+ * | Configure sensor and trigger measurement | See BME680 API and example codes |
+ * | Read results from sensor | See BME680 API and example codes |
+ * | Perform signal processing | bsec_do_steps() |
+ *
+ *
+ * - Before shutting down the system, the current state of BSEC can be retrieved and can then be used during
+ * re-initialization to continue processing.
+ *
+ * | Steps | Function |
+ * |----------------------------------------|-------------------|
+ * | To retrieve the current library state | bsec_get_state() |
+ *
+ *
+ *
+ * ### Configuration and state
+ *
+ * Values of variables belonging to a BSEC instance are divided into two groups:
+ * - Values **not updated by processing** of signals belong to the **configuration group**. If available, BSEC can be
+ * configured before use with a customer specific configuration string.
+ * - Values **updated during processing** are member of the **state group**. Saving and restoring of the state of BSEC
+ * is necessary to maintain previously estimated sensor models and baseline information which is important for best
+ * performance of the gas sensor outputs.
+ *
+ * @note BSEC library consists of adaptive algorithms which models the gas sensor which improves its performance over
+ * the time. These will be lost if library is initialized due to system reset. In order to avoid this situation
+ * library state shall be stored in non volatile memory so that it can be loaded after system reset.
+ *
+ *
+ * @{
+ */
+
+
+/*!
+ * @brief Return the version information of BSEC library
+ *
+ * @param [out] bsec_version_p pointer to struct which is to be populated with the version information
+ *
+ * @return Zero if successful, otherwise an error code
+ *
+ * See also: bsec_version_t
+ *
+ \code{.c}
+ // Example //
+ bsec_version_t version;
+ bsec_get_version(&version);
+ printf("BSEC version: %d.%d.%d.%d",version.major, version.minor, version.major_bugfix, version.minor_bugfix);
+
+ \endcode
+*/
+
+bsec_library_return_t bsec_get_version(bsec_version_t * bsec_version_p);
+
+
+/*!
+ * @brief Initialize the library
+ *
+ * Initialization and reset of BSEC is performed by calling bsec_init(). Calling this function sets up the relation
+ * among all internal modules, initializes run-time dependent library states and resets the configuration and state
+ * of all BSEC signal processing modules to defaults.
+ *
+ * Before any further use, the library must be initialized. This ensure that all memory and states are in defined
+ * conditions prior to processing any data.
+ *
+ * @return Zero if successful, otherwise an error code
+ *
+ \code{.c}
+
+ // Initialize BSEC library before further use
+ bsec_init();
+
+ \endcode
+*/
+
+bsec_library_return_t bsec_init(void);
+
+/*!
+ * @brief Subscribe to library virtual sensors outputs
+ *
+ * Use bsec_update_subscription() to instruct BSEC which of the processed output signals are requested at which sample rates.
+ * See ::bsec_virtual_sensor_t for available library outputs.
+ *
+ * Based on the requested virtual sensors outputs, BSEC will provide information about the required physical sensor input signals
+ * (see ::bsec_physical_sensor_t) with corresponding sample rates. This information is purely informational as bsec_sensor_control()
+ * will ensure the sensor is operated in the required manner. To disable a virtual sensor, set the sample rate to BSEC_SAMPLE_RATE_DISABLED.
+ *
+ * The subscription update using bsec_update_subscription() is apart from the signal processing one of the the most
+ * important functions. It allows to enable the desired library outputs. The function determines which physical input
+ * sensor signals are required at which sample rate to produce the virtual output sensor signals requested by the user.
+ * When this function returns with success, the requested outputs are called subscribed. A very important feature is the
+ * retaining of already subscribed outputs. Further outputs can be requested or disabled both individually and
+ * group-wise in addition to already subscribed outputs without changing them unless a change of already subscribed
+ * outputs is requested.
+ *
+ * @note The state of the library concerning the subscribed outputs cannot be retained among reboots.
+ *
+ * The interface of bsec_update_subscription() requires the usage of arrays of sensor configuration structures.
+ * Such a structure has the fields sensor identifier and sample rate. These fields have the properties:
+ * - Output signals of virtual sensors must be requested using unique identifiers (Member of ::bsec_virtual_sensor_t)
+ * - Different sets of identifiers are available for inputs of physical sensors and outputs of virtual sensors
+ * - Identifiers are unique values defined by the library, not from external
+ * - Sample rates must be provided as value of
+ * - An allowed sample rate for continuously sampled signals
+ * - 65535.0f (BSEC_SAMPLE_RATE_DISABLED) to turn off outputs and identify disabled inputs
+ *
+ * @note The same sensor identifiers are also used within the functions bsec_do_steps().
+ *
+ * The usage principles of bsec_update_subscription() are:
+ * - Differential updates (i.e., only asking for outputs that the user would like to change) is supported.
+ * - Invalid requests of outputs are ignored. Also if one of the requested outputs is unavailable, all the requests
+ * are ignored. At the same time, a warning is returned.
+ * - To disable BSEC, all outputs shall be turned off. Only enabled (subscribed) outputs have to be disabled while
+ * already disabled outputs do not have to be disabled explicitly.
+ *
+ * @param[in] requested_virtual_sensors Pointer to array of requested virtual sensor (output) configurations for the library
+ * @param[in] n_requested_virtual_sensors Number of virtual sensor structs pointed by requested_virtual_sensors
+ * @param[out] required_sensor_settings Pointer to array of required physical sensor configurations for the library
+ * @param[in,out] n_required_sensor_settings [in] Size of allocated required_sensor_settings array, [out] number of sensor configurations returned
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ * @sa bsec_sensor_configuration_t
+ * @sa bsec_physical_sensor_t
+ * @sa bsec_virtual_sensor_t
+ *
+ \code{.c}
+ // Example //
+
+ // Change 3 virtual sensors (switch IAQ and raw temperature -> on / pressure -> off)
+ bsec_sensor_configuration_t requested_virtual_sensors[3];
+ uint8_t n_requested_virtual_sensors = 3;
+
+ requested_virtual_sensors[0].sensor_id = BSEC_OUTPUT_IAQ;
+ requested_virtual_sensors[0].sample_rate = BSEC_SAMPLE_RATE_ULP;
+ requested_virtual_sensors[1].sensor_id = BSEC_OUTPUT_RAW_TEMPERATURE;
+ requested_virtual_sensors[1].sample_rate = BSEC_SAMPLE_RATE_ULP;
+ requested_virtual_sensors[2].sensor_id = BSEC_OUTPUT_RAW_PRESSURE;
+ requested_virtual_sensors[2].sample_rate = BSEC_SAMPLE_RATE_DISABLED;
+
+ // Allocate a struct for the returned physical sensor settings
+ bsec_sensor_configuration_t required_sensor_settings[BSEC_MAX_PHYSICAL_SENSOR];
+ uint8_t n_required_sensor_settings = BSEC_MAX_PHYSICAL_SENSOR;
+
+ // Call bsec_update_subscription() to enable/disable the requested virtual sensors
+ bsec_update_subscription(requested_virtual_sensors, n_requested_virtual_sensors, required_sensor_settings, &n_required_sensor_settings);
+ \endcode
+ *
+ */
+bsec_library_return_t bsec_update_subscription(const bsec_sensor_configuration_t * const requested_virtual_sensors,
+ const uint8_t n_requested_virtual_sensors, bsec_sensor_configuration_t * required_sensor_settings,
+ uint8_t * n_required_sensor_settings);
+
+
+/*!
+ * @brief Main signal processing function of BSEC
+ *
+ *
+ * Processing of the input signals and returning of output samples is performed by bsec_do_steps().
+ * - The samples of all library inputs must be passed with unique identifiers representing the input signals from
+ * physical sensors where the order of these inputs can be chosen arbitrary. However, all input have to be provided
+ * within the same time period as they are read. A sequential provision to the library might result in undefined
+ * behavior.
+ * - The samples of all library outputs are returned with unique identifiers corresponding to the output signals of
+ * virtual sensors where the order of the returned outputs may be arbitrary.
+ * - The samples of all input as well as output signals of physical as well as virtual sensors use the same
+ * representation in memory with the following fields:
+ * - Sensor identifier:
+ * - For inputs: required to identify the input signal from a physical sensor
+ * - For output: overwritten by bsec_do_steps() to identify the returned signal from a virtual sensor
+ * - Time stamp of the sample
+ *
+ * Calling bsec_do_steps() requires the samples of the input signals to be provided along with their time stamp when
+ * they are recorded and only when they are acquired. Repetition of samples with the same time stamp are ignored and
+ * result in a warning. Repetition of values of samples which are not acquired anew by a sensor result in deviations
+ * of the computed output signals. Concerning the returned output samples, an important feature is, that a value is
+ * returned for an output only when a new occurrence has been computed. A sample of an output signal is returned only
+ * once.
+ *
+ *
+ * @param[in] inputs Array of input data samples. Each array element represents a sample of a different physical sensor.
+ * @param[in] n_inputs Number of passed input data structs.
+ * @param[out] outputs Array of output data samples. Each array element represents a sample of a different virtual sensor.
+ * @param[in,out] n_outputs [in] Number of allocated output structs, [out] number of outputs returned
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+
+ \code{.c}
+ // Example //
+
+ // Allocate input and output memory
+ bsec_input_t input[3];
+ uint8_t n_input = 3;
+ bsec_output_t output[2];
+ uint8_t n_output=2;
+
+ bsec_library_return_t status;
+
+ // Populate the input structs, assuming the we have timestamp (ts),
+ // gas sensor resistance (R), temperature (T), and humidity (rH) available
+ // as input variables
+ input[0].sensor_id = BSEC_INPUT_GASRESISTOR;
+ input[0].signal = R;
+ input[0].time_stamp= ts;
+ input[1].sensor_id = BSEC_INPUT_TEMPERATURE;
+ input[1].signal = T;
+ input[1].time_stamp= ts;
+ input[2].sensor_id = BSEC_INPUT_HUMIDITY;
+ input[2].signal = rH;
+ input[2].time_stamp= ts;
+
+
+ // Invoke main processing BSEC function
+ status = bsec_do_steps( input, n_input, output, &n_output );
+
+ // Iterate through the BSEC output data, if the call succeeded
+ if(status == BSEC_OK)
+ {
+ for(int i = 0; i < n_output; i++)
+ {
+ switch(output[i].sensor_id)
+ {
+ case BSEC_OUTPUT_IAQ:
+ // Retrieve the IAQ results from output[i].signal
+ // and do something with the data
+ break;
+ case BSEC_OUTPUT_AMBIENT_TEMPERATURE:
+ // Retrieve the ambient temperature results from output[i].signal
+ // and do something with the data
+ break;
+
+ }
+ }
+ }
+
+ \endcode
+ */
+
+bsec_library_return_t bsec_do_steps(const bsec_input_t * const inputs, const uint8_t n_inputs, bsec_output_t * outputs, uint8_t * n_outputs);
+
+
+/*!
+ * @brief Reset a particular virtual sensor output
+ *
+ * This function allows specific virtual sensor outputs to be reset. The meaning of "reset" depends on the specific
+ * output. In case of the IAQ output, reset means zeroing the output to the current ambient conditions.
+ *
+ * @param[in] sensor_id Virtual sensor to be reset
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ *
+ \code{.c}
+ // Example //
+ bsec_reset_output(BSEC_OUTPUT_IAQ);
+
+ \endcode
+ */
+
+bsec_library_return_t bsec_reset_output(uint8_t sensor_id);
+
+
+/*!
+ * @brief Update algorithm configuration parameters
+ *
+ * BSEC uses a default configuration for the modules and common settings. The initial configuration can be customized
+ * by bsec_set_configuration(). This is an optional step.
+ *
+ * @note A work buffer with sufficient size is required and has to be provided by the function caller to decompose
+ * the serialization and apply it to the library and its modules. Please use #BSEC_MAX_PROPERTY_BLOB_SIZE for allotting
+ * the required size.
+ *
+ * @param[in] serialized_settings Settings serialized to a binary blob
+ * @param[in] n_serialized_settings Size of the settings blob
+ * @param[in,out] work_buffer Work buffer used to parse the blob
+ * @param[in] n_work_buffer_size Length of the work buffer available for parsing the blob
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ \code{.c}
+ // Example //
+
+ // Allocate variables
+ uint8_t serialized_settings[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_serialized_settings_max = BSEC_MAX_PROPERTY_BLOB_SIZE;
+ uint8_t work_buffer[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_work_buffer = BSEC_MAX_PROPERTY_BLOB_SIZE;
+
+ // Here we will load a provided config string into serialized_settings
+
+ // Apply the configuration
+ bsec_set_configuration(serialized_settings, n_serialized_settings_max, work_buffer, n_work_buffer);
+
+ \endcode
+ */
+
+bsec_library_return_t bsec_set_configuration(const uint8_t * const serialized_settings,
+ const uint32_t n_serialized_settings, uint8_t * work_buffer,
+ const uint32_t n_work_buffer_size);
+
+
+/*!
+ * @brief Restore the internal state of the library
+ *
+ * BSEC uses a default state for all signal processing modules and the BSEC module. To ensure optimal performance,
+ * especially of the gas sensor functionality, it is recommended to retrieve the state using bsec_get_state()
+ * before unloading the library, storing it in some form of non-volatile memory, and setting it using bsec_set_state()
+ * before resuming further operation of the library.
+ *
+ * @note A work buffer with sufficient size is required and has to be provided by the function caller to decompose the
+ * serialization and apply it to the library and its modules. Please use #BSEC_MAX_PROPERTY_BLOB_SIZE for allotting the
+ * required size.
+ *
+ * @param[in] serialized_state States serialized to a binary blob
+ * @param[in] n_serialized_state Size of the state blob
+ * @param[in,out] work_buffer Work buffer used to parse the blob
+ * @param[in] n_work_buffer_size Length of the work buffer available for parsing the blob
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ \code{.c}
+ // Example //
+
+ // Allocate variables
+ uint8_t serialized_state[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_serialized_state = BSEC_MAX_PROPERTY_BLOB_SIZE;
+ uint8_t work_buffer_state[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_work_buffer_size = BSEC_MAX_PROPERTY_BLOB_SIZE;
+
+ // Here we will load a state string from a previous use of BSEC
+
+ // Apply the previous state to the current BSEC session
+ bsec_set_state(serialized_state, n_serialized_state, work_buffer_state, n_work_buffer_size);
+
+ \endcode
+*/
+
+bsec_library_return_t bsec_set_state(const uint8_t * const serialized_state, const uint32_t n_serialized_state,
+ uint8_t * work_buffer, const uint32_t n_work_buffer_size);
+
+
+/*!
+ * @brief Retrieve the current library configuration
+ *
+ * BSEC allows to retrieve the current configuration using bsec_get_configuration(). Returns a binary blob encoding
+ * the current configuration parameters of the library in a format compatible with bsec_set_configuration().
+ *
+ * @note The function bsec_get_configuration() is required to be used for debugging purposes only.
+ * @note A work buffer with sufficient size is required and has to be provided by the function caller to decompose the
+ * serialization and apply it to the library and its modules. Please use #BSEC_MAX_PROPERTY_BLOB_SIZE for allotting the
+ * required size.
+ *
+ *
+ * @param[in] config_id Identifier for a specific set of configuration settings to be returned;
+ * shall be zero to retrieve all configuration settings.
+ * @param[out] serialized_settings Buffer to hold the serialized config blob
+ * @param[in] n_serialized_settings_max Maximum available size for the serialized settings
+ * @param[in,out] work_buffer Work buffer used to parse the binary blob
+ * @param[in] n_work_buffer Length of the work buffer available for parsing the blob
+ * @param[out] n_serialized_settings Actual size of the returned serialized configuration blob
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ \code{.c}
+ // Example //
+
+ // Allocate variables
+ uint8_t serialized_settings[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_serialized_settings_max = BSEC_MAX_PROPERTY_BLOB_SIZE;
+ uint8_t work_buffer[BSEC_MAX_PROPERTY_BLOB_SIZE];
+ uint32_t n_work_buffer = BSEC_MAX_PROPERTY_BLOB_SIZE;
+ uint32_t n_serialized_settings = 0;
+
+ // Configuration of BSEC algorithm is stored in 'serialized_settings'
+ bsec_get_configuration(0, serialized_settings, n_serialized_settings_max, work_buffer, n_work_buffer, &n_serialized_settings);
+
+ \endcode
+ */
+
+bsec_library_return_t bsec_get_configuration(const uint8_t config_id, uint8_t * serialized_settings, const uint32_t n_serialized_settings_max,
+ uint8_t * work_buffer, const uint32_t n_work_buffer, uint32_t * n_serialized_settings);
+
+
+/*!
+ *@brief Retrieve the current internal library state
+ *
+ * BSEC allows to retrieve the current states of all signal processing modules and the BSEC module using
+ * bsec_get_state(). This allows a restart of the processing after a reboot of the system by calling bsec_set_state().
+ *
+ * @note A work buffer with sufficient size is required and has to be provided by the function caller to decompose the
+ * serialization and apply it to the library and its modules. Please use #BSEC_MAX_STATE_BLOB_SIZE for allotting the
+ * required size.
+ *
+ *
+ * @param[in] state_set_id Identifier for a specific set of states to be returned; shall be
+ * zero to retrieve all states.
+ * @param[out] serialized_state Buffer to hold the serialized config blob
+ * @param[in] n_serialized_state_max Maximum available size for the serialized states
+ * @param[in,out] work_buffer Work buffer used to parse the blob
+ * @param[in] n_work_buffer Length of the work buffer available for parsing the blob
+ * @param[out] n_serialized_state Actual size of the returned serialized blob
+ *
+ * @return Zero when successful, otherwise an error code
+ *
+ \code{.c}
+ // Example //
+
+ // Allocate variables
+ uint8_t serialized_state[BSEC_MAX_STATE_BLOB_SIZE];
+ uint32_t n_serialized_state_max = BSEC_MAX_STATE_BLOB_SIZE;
+ uint32_t n_serialized_state = BSEC_MAX_STATE_BLOB_SIZE;
+ uint8_t work_buffer_state[BSEC_MAX_STATE_BLOB_SIZE];
+ uint32_t n_work_buffer_size = BSEC_MAX_STATE_BLOB_SIZE;
+
+ // Algorithm state is stored in 'serialized_state'
+ bsec_get_state(0, serialized_state, n_serialized_state_max, work_buffer_state, n_work_buffer_size, &n_serialized_state);
+
+ \endcode
+ */
+
+bsec_library_return_t bsec_get_state(const uint8_t state_set_id, uint8_t * serialized_state,
+ const uint32_t n_serialized_state_max, uint8_t * work_buffer, const uint32_t n_work_buffer,
+ uint32_t * n_serialized_state);
+
+/*!
+ * @brief Retrieve BMExxx sensor instructions
+ *
+ * The bsec_sensor_control() interface is a key feature of BSEC, as it allows an easy way for the signal processing
+ * library to control the operation of the BME sensor. This is important since gas sensor behaviour is mainly
+ * determined by how the integrated heater is configured. To ensure an easy integration of BSEC into any system,
+ * bsec_sensor_control() will provide the caller with information about the current sensor configuration that is
+ * necessary to fulfill the input requirements derived from the current outputs requested via
+ * bsec_update_subscription().
+ *
+ * In practice the use of this function shall be as follows:
+ * - Call bsec_sensor_control() which returns a bsec_bme_settings_t struct.
+ * - Based on the information contained in this struct, the sensor is configured and a forced-mode measurement is
+ * triggered if requested by bsec_sensor_control().
+ * - Once this forced-mode measurement is complete, the signals specified in this struct shall be passed to
+ * bsec_do_steps() to perform the signal processing.
+ * - After processing, the process should sleep until the bsec_bme_settings_t::next_call timestamp is reached.
+ *
+ *
+ * @param [in] time_stamp Current timestamp in [ns]
+ * @param[out] sensor_settings Settings to be passed to API to operate sensor at this time instance
+ *
+ * @return Zero when successful, otherwise an error code
+ */
+
+bsec_library_return_t bsec_sensor_control(const int64_t time_stamp, bsec_bme_settings_t *sensor_settings);
+
+/*@}*/ //BSEC Interface
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* __BSEC_INTERFACE_H__ */
diff --git a/Samples/BRAVO_Time_Series_Demo/Makefile.in b/Samples/BRAVO_Time_Series_Demo/Makefile.in
new file mode 100644
index 0000000..9fbd9a8
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/Makefile.in
@@ -0,0 +1,72 @@
+# 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.0.8
+
+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))
+
+#---- SET TO 0 IF BOSCH INCLUDES AND LIBS MUST BE DISABLED
+BOSCH_BSEC = 1
+#----
+
+CPPFLAGS += -I src/demo_utils
+OBJS += $(patsubst %.c,%.o,$(wildcard src/demo_utils/*.c))
+
+ifneq ($(strip $(BOSCH_BSEC)),0)
+
+CPPFLAGS += -DBOSCH_BSEC=1
+
+CPPFLAGS += -I BOSCH/BHI160/firmware -I BOSCH/BHI160/inc
+OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BHI160/src/*.c))
+CPPFLAGS += -I BOSCH/BME680
+OBJS += $(patsubst %.c,%.o,$(wildcard BOSCH/BME680/*.c))
+CPPFLAGS += -I BOSCH/BSEC
+LDDFLAGS += ./BOSCH/BSEC/libalgobsec.ar -lc -lm -lnosys -lgcc --gc-sections --no-keep-memory
+else
+CPPFLAGS += -DBOSCH_BSEC=0
+endif
+
diff --git a/Samples/BRAVO_Time_Series_Demo/README.md b/Samples/BRAVO_Time_Series_Demo/README.md
new file mode 100644
index 0000000..59504a0
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/README.md
@@ -0,0 +1,53 @@
+
+### Bravo LwM2M Time Series demo
+
+
+
+**Features**
+
+---
+
+- Connect to LWM2M Portal
+- Retrieve environment information with BSEC library sensor, Tampering and 3D vector rotation with BHI library sensors
+- Push data to OneEdge portal as time series using Opaque resources with dedicated objects
+
+---
+
+#### Prerequisites on the module
+
+This application requires the files **object_32001.xml** and **object_32002.xml** (provided) to be stored into module's `/XML/` folder, along with the application binary itself.
+
+To load them, use
+
+`AT#M2MWRITE=/XML/object_32001.xml,2272`
+`AT#M2MWRITE=/XML/object_32002.xml,2365`
+
+
+
+And at each prompt, send the file content in raw mode.
+
+#### Prerequisites on the OneEdge Portal
+
+Please refer to the [Time Series App Note](https://github.com/telit/oneedge-projects-resources/blob/main/use-cases/time-series/Docs/80654NT11932A_OneEdge_Use_Case_Time-series_r0.pdf)
+
+
+### Requirements
+
+**External Libraries**
+
+To build the application it is required to put `libalgobsec.ar` file into the project's BOSCH/BSEC folder. The library can be retrieved at the link
+https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.4.7.4 version archive, then extract the library `libalgobsec.a` from the ZIP file and rename as `libalgobsec.ar`. It can be found in the directory
+/BSEC_1.4.7.4_Generic_Release/algo/normal_version/bin/gcc/Cortex_A7/
+
+#### Simulated data
+To run the code on a generic ME910C1 device, it is possible to build the code disabling the Bosch related functionalities. To do so, please refer to [Makefile.in](Makefile.in) file and edit the BOSCH_BSEC variable as below.
+
+```
+BOSCH_BSEC = 0
+```
+This will disable all Bosch dependencies and build the app with a simplified logic, simulating sensors data.
+
+---
+
+
+
diff --git a/Samples/BRAVO_Time_Series_Demo/azx/hdr/azx_log.h b/Samples/BRAVO_Time_Series_Demo/azx/hdr/azx_log.h
new file mode 100644
index 0000000..76d26ee
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/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/Samples/BRAVO_Time_Series_Demo/azx/hdr/azx_utils.h b/Samples/BRAVO_Time_Series_Demo/azx/hdr/azx_utils.h
new file mode 100644
index 0000000..cccb3c5
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/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/Samples/BRAVO_Time_Series_Demo/azx/src/azx_log.c b/Samples/BRAVO_Time_Series_Demo/azx/src/azx_log.c
new file mode 100644
index 0000000..3cb669c
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/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/Samples/BRAVO_Time_Series_Demo/azx/src/azx_tasks.c b/Samples/BRAVO_Time_Series_Demo/azx/src/azx_tasks.c
new file mode 100644
index 0000000..1ce6145
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/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/Samples/BRAVO_Time_Series_Demo/azx/src/azx_utils.c b/Samples/BRAVO_Time_Series_Demo/azx/src/azx_utils.c
new file mode 100644
index 0000000..c9d3928
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/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/Samples/BRAVO_Time_Series_Demo/description.txt b/Samples/BRAVO_Time_Series_Demo/description.txt
new file mode 100644
index 0000000..e39b073
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/description.txt
@@ -0,0 +1 @@
+MultiSensors Demo application. Debug prints on MAIN UART
diff --git a/Samples/BRAVO_Time_Series_Demo/hdr/app_cfg.h b/Samples/BRAVO_Time_Series_Demo/hdr/app_cfg.h
new file mode 100644
index 0000000..fb98a47
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/hdr/app_cfg.h
@@ -0,0 +1,23 @@
+/*Copyright (C) 2021 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 27/05/2021
+ *
+ * @brief Application configuration settings conveniently located here.
+ *
+ */
+
+/** @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_ */
\ No newline at end of file
diff --git a/Samples/BRAVO_Time_Series_Demo/hdr/sensors_demo.h b/Samples/BRAVO_Time_Series_Demo/hdr/sensors_demo.h
new file mode 100644
index 0000000..eeda73e
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/hdr/sensors_demo.h
@@ -0,0 +1,151 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/*!
+ @file
+ sensors_demo.h
+
+ @brief
+
+ @details
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author
+ FabioPi
+ @date
+ 01/12/2020
+ */
+
+/*=================================================================
+#Telit Extensions
+#
+#Copyright (C) 2019, Telit Communications S.p.A.
+#All rights reserved.
+#
+#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+#
+#Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+#
+#Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
+#the documentation and/or other materials provided with the distribution.
+#
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS``AS IS'' AND ANY EXPRESS OR IMPLIED
+#WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+#PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+#DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#POSSIBILITY OF SUCH DAMAGE.
+#
+==============================================================*/
+
+
+#ifndef HDR_SENSORS_DEMO_H_
+#define HDR_SENSORS_DEMO_H_
+
+/* Global declarations ==========================================================================*/
+#define INT_GPIO_PIN_NUM 6
+#define LED_INDEX_NUM 2 /* GPIO 10 */
+
+#define SENSOR_AR_TOUT 100 /* 10 = 1 sec */
+
+#define SENDING_OPTS_XML_NAME "object_32001.xml"
+#define SAMPLING_OPTS_XML_NAME "object_32002.xml"
+
+
+
+#define FIFO_SIZE 300
+#define MAX_PACKET_LENGTH 18
+#define TICKS_IN_ONE_SECOND 32000.0F
+
+#define ROTATION_VECTOR_SAMPLE_RATE 10 /* Hz */
+
+
+/*BME*/
+
+#define BME680_W_SELF_TEST_FAILED 3
+
+#define MIN_TEMPERATURE INT16_C(0) /* 0 degree Celsius */
+#define MAX_TEMPERATURE INT16_C(6000) /* 60 degree Celsius */
+
+#define MIN_PRESSURE UINT32_C(90000) /* 900 hecto Pascals */
+#define MAX_PRESSURE UINT32_C(110000) /* 1100 hecto Pascals */
+
+#define MIN_HUMIDITY UINT32_C(20000) /* 20% relative humidity */
+#define MAX_HUMIDITY UINT32_C(80000) /* 80% relative humidity*/
+
+#define HEATR_DUR 2000
+#define N_MEAS 6
+#define LOW_TEMP 150
+#define HIGH_TEMP 350
+
+
+/* Global typedefs ==============================================================================*/
+typedef enum
+{
+ BSENS_SENSOR_ENVIRONM_ID = 1,
+ BSENS_SENSOR_3D_VECT_ID = 2,
+ BSENS_SENSOR_TAMPER_ID = 3
+} BSENS_SENSOR_ID_E;
+
+
+typedef struct
+{
+ float temperature;
+ float pressure;
+ float humidity;
+ int airQ;
+} BSENS_ENV_T;
+
+
+typedef struct
+{
+ float w;
+ float x;
+ float y;
+ float z;
+ INT16 accuracy;
+} BSENS_3DVECT_T;
+
+
+typedef struct
+{
+ INT16 status;
+ UINT32 timestamp;
+ UINT16 still_ended_count;
+} BSENS_TAMPER_T;
+
+
+
+typedef enum
+{
+ STATUS_INVALID = -1,
+ STILL_ENDED = 0,
+ WALKING_ENDED = 1,
+ RUNNING_ENDED = 2,
+ BYCYCLE_ENDED = 3,
+ VEHICLE_ENDED = 4,
+ TILTING_ENDED = 5,
+ STILL_STARTED = 8,
+ WALKING_STARTED = 9,
+ RUNNING_STARTED = 10,
+ BICYCLE_STARTED = 11,
+ VEHICLE_STARTED = 12,
+ TILTING_STARTED = 13,
+
+} BHI_TAMPER_STATUS_E;
+
+typedef INT32 (*sensors_init_cb)(INT32 res, void *arg);
+
+/* Global functions =============================================================================*/
+/**
+ @brief This function is used to run bhy hub
+*/
+int init_sensors( sensors_init_cb cb );
+int read_sensor(BSENS_SENSOR_ID_E id, void **data);
+
+#endif /* HDR_SENSORS_DEMO_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/object_32001.xml b/Samples/BRAVO_Time_Series_Demo/object_32001.xml
new file mode 100644
index 0000000..522a867
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/object_32001.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/BRAVO_Time_Series_Demo/object_32002.xml b/Samples/BRAVO_Time_Series_Demo/object_32002.xml
new file mode 100644
index 0000000..da426f1
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/object_32002.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/BRAVO_Time_Series_Demo/src/M2MB_main.c b/Samples/BRAVO_Time_Series_Demo/src/M2MB_main.c
new file mode 100644
index 0000000..6e1f152
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/M2MB_main.c
@@ -0,0 +1,795 @@
+/*=========================================================================*/
+/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
+/**
+ @file
+ M2MB_main.c
+
+ @brief
+ The file contains the main user entry point of Appzone
+
+ @details
+
+ @description
+ MultiSensors Demo application. Debug prints on MAIN UART
+ @version
+ 1.0.1
+ @note
+ Start of Appzone: Entry point
+ User code entry is in function M2MB_main()
+
+ @author FabioPi
+
+ @date
+ 2020-02-26
+ */
+
+/* Include files ================================================================================*/
+#include
+#include
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_i2c.h"
+#include "m2mb_gpio.h"
+#include "m2mb_lwm2m.h"
+#include "m2mb_power.h"
+#include "m2mb_socket.h"
+
+#include "m2mb_rtc.h"
+
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+#include "app_cfg.h"
+
+
+
+#include "gpio.h"
+#include "i2c.h"
+#include "lwm2m.h"
+
+
+#include "sensors_demo.h"
+
+/* Local defines ================================================================================*/
+
+#define PDU_SIZE 14
+#define OPAQUE_SIZE 1024
+
+
+#define PRINT_PDU 0
+#define PRINT_PDU_HEX 1
+#define PRINT_OPAQUE_HEX 0
+
+#define ONE_EDGE 1
+
+#define DEFAULT_SAMPLE_PERIOD 60000 //60000
+#define DEFAULT_SENDING_PERIOD 300000 //300000
+
+
+#define EV_B_SENSORS_BIT 0x00000001
+
+
+#ifndef BOSCH_BSEC
+#define BOSCH_BSEC 1
+#endif
+
+
+/* Local typedefs ===============================================================================*/
+
+typedef struct
+{
+ UINT32 timestamp;
+ float temperature;
+ UINT8 humidity;
+ UINT16 pressure;
+ UINT16 engine_rot;
+ UINT8 event_counter;
+} DATA_ENTRY_T;
+
+typedef struct
+{
+ UINT8 buffer[OPAQUE_SIZE];
+ UINT16 p;
+ M2MB_OS_SEM_HANDLE CSSemH;
+} DATA_BUFFER_T;
+
+/* Local statics ================================================================================*/
+static BOOLEAN is_a_bravo = TRUE;
+static M2MB_OS_EV_HANDLE gBoschInitEvH = NULL;
+
+
+static UINT32 gSamplingRate = DEFAULT_SAMPLE_PERIOD;
+static UINT32 gSendingRate = DEFAULT_SENDING_PERIOD;
+
+
+static M2MB_LWM2M_OBJ_URI_T _obj_telit_app_data_uri = { .uriLen = 4,
+ .obj = 33205, .objInst = 0, .resource = 0, .resourceInst = 0 };
+
+static DATA_BUFFER_T opaque = {0};
+/* Local function prototypes ====================================================================*/
+
+static UINT32 get_uptime(void);
+
+/**
+ @brief callback function for main demo task, executed by main function.
+
+ @return 0 in case of success, -1 in case of failure
+ */
+static INT32 demoTaskCb(INT32 type, INT32 param1, INT32 param2);
+
+static INT32 entryToHexBuf(DATA_ENTRY_T *entry, unsigned char *tmp);
+static INT32 dataSendTaskCb(INT32 type, INT32 param1, INT32 param2);
+static INT32 dataReadTaskCb(INT32 type, INT32 param1, INT32 param2);
+static INT32 lwm2m_monDataTaskCb(INT32 type, INT32 param1, INT32 param2);
+static INT32 sensorsInitCB(INT32 res, void *arg);
+/* Static functions =============================================================================*/
+
+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 INT32 entryToHexBuf(DATA_ENTRY_T *entry, unsigned char *tmp)
+{
+ UINT32 word_tmp;
+ UINT16 nibble_tmp;
+
+ union
+ {
+ float f;
+ UINT32 u;
+ } f2u = { .f = entry->temperature };
+
+ word_tmp = m2mb_socket_bsd_htonl(entry->timestamp);
+ memcpy(&tmp[0], &word_tmp, sizeof(word_tmp));
+
+ word_tmp = m2mb_socket_bsd_htonl(f2u.u);
+ memcpy(&tmp[4], &word_tmp, sizeof(word_tmp));
+
+ memcpy(&tmp[8], &entry->humidity, sizeof(entry->humidity));
+
+ nibble_tmp = m2mb_socket_bsd_htons(entry->pressure);
+ memcpy(&tmp[9], &nibble_tmp, sizeof(nibble_tmp));
+
+ nibble_tmp = m2mb_socket_bsd_htons(entry->engine_rot);
+ memcpy(&tmp[11], &nibble_tmp, sizeof(nibble_tmp));
+
+ memcpy(&tmp[13], &entry->event_counter, sizeof(entry->event_counter));
+
+ return 0;
+}
+
+
+static INT32 dataSendTaskCb(INT32 type, INT32 param1, INT32 param2)
+{
+ (void) type;
+ (void) param1;
+ (void) param2;
+
+ UINT32 curEvBits;
+ UINT32 delay = 0;
+
+ AZX_LOG_INFO("Send task. Wait for Bosch sensors check.\r\n");
+ m2mb_os_ev_get(gBoschInitEvH, EV_B_SENSORS_BIT, M2MB_OS_EV_GET_ANY, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+
+ while(1)
+ {
+ UINT32 starting_time = get_uptime();
+
+ AZX_LOG_TRACE("Starting_time: %u\r\n", starting_time);
+
+ UINT32 sleep_time = gSendingRate - delay;
+
+ /* sleep_time could be "negative"*/
+ if( delay > gSendingRate )
+ {
+ sleep_time = DEFAULT_SENDING_PERIOD;
+ }
+ AZX_LOG_TRACE("Waiting for %u ms\r\n", sleep_time);
+
+ azx_sleep_ms(sleep_time);
+
+ m2mb_os_sem_get(opaque.CSSemH, M2MB_OS_WAIT_FOREVER );
+
+ delay = (get_uptime() - starting_time ) - gSendingRate;
+
+ AZX_LOG_INFO("Time to send data!\r\n");
+ /*send opaque with lwm2m and wait ack*/
+ /*todo check result value */
+ set_opaque_resource(getLwM2mHandle(), &_obj_telit_app_data_uri, opaque.buffer, opaque.p);
+
+ /*reset*/
+ memset(opaque.buffer, 0, OPAQUE_SIZE);
+ opaque.p = 0;
+
+ m2mb_os_sem_put(opaque.CSSemH);
+ }
+}
+
+
+static INT32 dataReadTaskCb(INT32 type, INT32 param1, INT32 param2)
+{
+ (void) type;
+ (void) param1;
+ (void) param2;
+
+ DATA_ENTRY_T entry = {0};
+ INT32 rtcfd;
+ unsigned char tmp[PDU_SIZE + 1 ] = {0};
+
+ UINT32 curEvBits;
+ UINT32 delay = 0;
+
+
+ AZX_LOG_INFO("Read task. Waiting for Bosch sensors check.\r\n");
+ m2mb_os_ev_get(gBoschInitEvH, EV_B_SENSORS_BIT, M2MB_OS_EV_GET_ANY, &curEvBits, M2MB_OS_WAIT_FOREVER);
+
+ while (1)
+ {
+
+ UINT32 starting_time = get_uptime();
+ AZX_LOG_TRACE("starting_time: %u\r\n", starting_time);
+
+
+ UINT32 sleep_time = gSamplingRate - delay;
+
+ /* sleep_time could be "negative"*/
+ if( delay > gSamplingRate )
+ {
+ sleep_time = DEFAULT_SAMPLE_PERIOD;
+ }
+
+ AZX_LOG_TRACE("Waiting for %u ms\r\n", sleep_time);
+ azx_sleep_ms(sleep_time);
+
+ if(is_a_bravo)
+ {
+ void * pdata = NULL;
+ BSENS_ENV_T *pENVIRON_data;
+ BSENS_TAMPER_T *pTAMPER_data;
+ BSENS_3DVECT_T *pVECT_data;
+
+ AZX_LOG_INFO("\r\n\r\n==== Reading data from sensors...\r\n\r\n");
+
+ read_sensor(BSENS_SENSOR_ENVIRONM_ID, (void **)&pdata);
+
+ pENVIRON_data = (BSENS_ENV_T *) pdata;
+ entry.temperature = pENVIRON_data->temperature;
+ entry.humidity = (UINT8) pENVIRON_data->humidity;
+ entry.pressure = (UINT16) pENVIRON_data->pressure;
+
+
+ read_sensor(BSENS_SENSOR_TAMPER_ID, (void **)&pdata);
+ pTAMPER_data = (BSENS_TAMPER_T *) pdata;
+ entry.event_counter = pTAMPER_data->still_ended_count;
+
+ read_sensor(BSENS_SENSOR_3D_VECT_ID, (void **)&pdata);
+ pVECT_data = (BSENS_3DVECT_T *) pdata;
+
+ entry.engine_rot = (UINT16) (pVECT_data->w * 1000); /*axis is a float from 0 to 1.*/
+
+ }
+ else
+ {
+ static int sign = 1;
+ static BOOLEAN is_init = FALSE;
+ if (!is_init)
+ {
+ AZX_LOG_INFO("Initialize simulated data...\r\n");
+ entry.timestamp = 0;
+ entry.temperature = 25;
+ entry.humidity = 100;
+ entry.pressure = 1000;
+ entry.engine_rot = 300;
+ entry.event_counter = 125;
+ is_init = TRUE;
+ }
+ else
+ {
+ AZX_LOG_INFO("Simulating data...\r\n");
+ entry.temperature++;
+ if(entry.temperature >= 100.0)
+ {
+ entry.temperature = 25.0;
+ }
+
+ if(entry.humidity >= 2)
+ {
+ entry.humidity -= 2;
+ }
+ if(entry.humidity <= 0)
+ {
+ entry.humidity = 100;
+ }
+
+ entry.pressure += sign;
+ if(entry.pressure > 1100)
+ {
+ sign = -1;
+ }
+ if(entry.pressure < 900)
+ {
+ sign = 1;
+ }
+
+ entry.engine_rot +=25;
+ if(entry.engine_rot > 600)
+ {
+ entry.engine_rot = 300;
+ }
+
+ entry.event_counter += 5;
+ if (entry.event_counter >= 255)
+ {
+ entry.event_counter = 125;
+ }
+ }
+ }
+
+ rtcfd = m2mb_rtc_open( "/dev/rtc0", 0 );
+ if(-1 == rtcfd)
+ {
+ AZX_LOG_CRITICAL("cannot open rtc to get timestamp!!!\r\n");
+ }
+ else
+ {
+ M2MB_RTC_TIMEVAL_T timeval;
+ M2MB_RTC_TIME_T time;
+ m2mb_rtc_ioctl( rtcfd, M2MB_RTC_IOCTL_GET_TIMEVAL, &timeval );
+ m2mb_rtc_ioctl( rtcfd, M2MB_RTC_IOCTL_GET_SYSTEM_TIME, &time );
+ m2mb_rtc_close(rtcfd);
+
+ //AZX_LOG_DEBUG("timezone: %d, dst: %u\r\n", time.tz, time.dlst);
+
+ entry.timestamp = timeval.sec - (time.tz * 15 * 60); /*compensate timezone*/
+ }
+
+ if(PRINT_PDU)
+ {
+ AZX_LOG_INFO("\r\nData entry: \r\n");
+ AZX_LOG_INFO("time : %u\r\n", entry.timestamp);
+ AZX_LOG_INFO("temp : %.2f\r\n", entry.temperature);
+ AZX_LOG_INFO("humi : %u\r\n", entry.humidity);
+ AZX_LOG_INFO("pres : %u\r\n", entry.pressure);
+ AZX_LOG_INFO("engi : %u\r\n", entry.engine_rot);
+ AZX_LOG_INFO("event: %u\r\n", entry.event_counter);
+ AZX_LOG_INFO("\r\n");
+ }
+
+ /* Store data into final buffer */
+
+ entryToHexBuf(&entry, tmp);
+
+ if(PRINT_PDU_HEX){
+ int i;
+ AZX_LOG_INFO("\r\n \r\nData: ");
+ for (i=0; iobj;
+ uri.objInst = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = p_uri->resource;
+
+
+ if(M2MB_RESULT_SUCCESS != read_integer_from_uri(getLwM2mHandle(), &uri, &val))
+ {
+ AZX_LOG_ERROR("cannot read integer from uri %u/%u/%u/%u !\r\n",
+ p_uri->obj, p_uri->objInst, p_uri->resource, p_uri->resourceInst );
+ }
+ else
+ {
+ AZX_LOG_INFO("Received new integer value %d for uri %u/%u/%u/%u\r\n", val,
+ p_uri->obj, p_uri->objInst, p_uri->resource, p_uri->resourceInst);
+
+ switch(p_uri->obj)
+ {
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ switch( p_uri->resource)
+ {
+ case 1:
+ AZX_LOG_INFO("Sampling rate: %d\r\n", val);
+ if(val != 0)
+ {
+ gSamplingRate = val * 1000;
+ }
+ else
+ {
+ /* overwrite the value with the default */
+ write_integer_resource(getLwM2mHandle(), p_uri, DEFAULT_SAMPLE_PERIOD / 1000);
+ gSamplingRate = DEFAULT_SAMPLE_PERIOD;
+ }
+ break;
+ case 2:
+ AZX_LOG_INFO("Sending rate: %d\r\n", val);
+ if(val != 0)
+ {
+ gSendingRate = val * 1000;
+ }
+ else
+ {
+ /* overwrite the value with the default */
+ write_integer_resource(getLwM2mHandle(), p_uri, DEFAULT_SENDING_PERIOD / 1000);
+ gSendingRate = DEFAULT_SENDING_PERIOD;
+ }
+ break;
+ default:
+ break;
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ }
+ }break;
+ }
+
+ return 0;
+
+}
+
+static INT32 sensorsInitCB(INT32 res, void *arg)
+{
+ (void) arg;
+
+ if(0 != res)
+ {
+ AZX_LOG_WARN("Not a Bravo board, sensors data will be simulated\r\n");
+ is_a_bravo = FALSE;
+ }
+ m2mb_os_ev_set(gBoschInitEvH, EV_B_SENSORS_BIT, M2MB_OS_EV_SET);
+ return 0;
+}
+
+
+static INT32 demoTaskCb(INT32 type, INT32 param1, INT32 param2)
+{
+ (void) type;
+ (void) param1;
+ (void) param2;
+ int reboot_needed = 0;
+ INT32 taskId;
+
+ INT16 instances[] = {0};
+
+ LWM2M_OBJ_REG_T objs[] = {
+ {TIME_SERIES_METERING_INFO_OBJ_ID, 1, instances },
+ {TIME_SERIES_METERING_RATES_OBJ_ID, 1, instances }
+ };
+
+ /* Open GPIO */
+ if( open_LED( LED_INDEX_NUM ) != 0 )
+ {
+ AZX_LOG_ERROR( "Cannot open gpio channel.\r\n" );
+ return -1;
+ }
+
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 5000 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+
+ /* Copy xml file if not existing */
+ if( 0 != check_xml_file( SENDING_OPTS_XML_NAME ) )
+ {
+ if( 0 != copy_xml_file( SENDING_OPTS_XML_NAME ) )
+ {
+ AZX_LOG_CRITICAL( "Failed copying file!\r\n" );
+
+ for( int i = 0; i < 10; i++ )
+ {
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 200 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+ azx_sleep_ms( 200 );
+ }
+
+ return -1;
+ }
+ reboot_needed = 1;
+ }
+
+ /* Copy xml file if not existing */
+ if( 0 != check_xml_file( SAMPLING_OPTS_XML_NAME ) )
+ {
+ if( 0 != copy_xml_file( SAMPLING_OPTS_XML_NAME ) )
+ {
+ AZX_LOG_CRITICAL( "Failed copying file!\r\n" );
+
+ for( int i = 0; i < 10; i++ )
+ {
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 200 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+ azx_sleep_ms( 200 );
+ }
+
+ return -1;
+ }
+ reboot_needed = 1;
+ }
+
+
+ if(reboot_needed)
+ {
+ M2MB_POWER_HANDLE handle;
+ AZX_LOG_DEBUG( "Rebooting to apply xml file(s)\r\n" );
+
+ if( M2MB_RESULT_SUCCESS != m2mb_power_init( &handle, NULL, ( void * ) NULL ) )
+ {
+ AZX_LOG_CRITICAL( "cannot init power module!\r\n" );
+ return -1;
+ }
+ else
+ {
+ for( int i = 0; i < 3; i++ )
+ {
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 1000 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+ azx_sleep_ms( 1000 );
+ }
+
+ m2mb_power_reboot( handle );
+ m2mb_power_deinit( handle );
+ return 0;
+ }
+ }
+
+#if BOSCH_BSEC
+
+ /* Open I2C */
+ if( open_I2C() != 0 )
+ {
+ AZX_LOG_ERROR( "cannot open I2C channel.\r\n" );
+ return -1;
+ }
+#endif
+
+ /* Open GPIO */
+ if( open_gpio( INT_GPIO_PIN_NUM ) != 0 )
+ {
+ AZX_LOG_ERROR( "cannot open gpio channel.\r\n" );
+ return -1;
+ }
+#if ONE_EDGE
+
+ /*skip the instances creation*/
+ setAsBootstrapped();
+
+ if(oneedge_init( objs, 2, NULL ) != 0)
+ {
+ AZX_LOG_ERROR("Failed enabling LWM2M!\r\n");
+ return -1;
+ }
+
+ taskId = azx_tasks_createTask((char*) "MON_DATA", AZX_TASKS_STACK_L, 5, AZX_TASKS_MBOX_S, lwm2m_monDataTaskCb);
+ if(taskId > 0)
+ {
+ lwm2m_ReadTaskRegister(taskId);
+ }
+ else
+ {
+ return -1;
+ }
+
+
+ /*read values from time series objects for sampling and sending rates*/
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ INT32 val;
+ uri.obj = TIME_SERIES_METERING_RATES_OBJ_ID;
+ uri.objInst = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ if(M2MB_RESULT_SUCCESS != read_integer_from_uri(getLwM2mHandle(), &uri, &val))
+ {
+ AZX_LOG_ERROR("cannot read integer from uri %u/%u/%u/%u !\r\n", uri.obj, uri.objInst, uri.resource, uri.resourceInst );
+ }
+ else
+ {
+ AZX_LOG_INFO("sampling rate : %d\r\n", val);
+ if(val != 0)
+ {
+ gSamplingRate = val * 1000;
+ }
+ else
+ {
+ /* overwrite the value with the default */
+ write_integer_resource(getLwM2mHandle(), &uri, DEFAULT_SAMPLE_PERIOD / 1000);
+ gSamplingRate = DEFAULT_SAMPLE_PERIOD;
+ }
+
+ }
+
+ azx_sleep_ms(3000);
+
+ uri.resource = 2;
+ if(M2MB_RESULT_SUCCESS != read_integer_from_uri(getLwM2mHandle(), &uri, &val))
+ {
+ AZX_LOG_ERROR("cannot read integer from uri %u/%u/%u/%u !\r\n", uri.obj, uri.objInst, uri.resource, uri.resourceInst );
+ }
+ else
+ {
+ AZX_LOG_INFO("sending rate : %d\r\n", val);
+ if(val != 0)
+ {
+ gSendingRate = val * 1000;
+ }
+ else
+ {
+ /* overwrite the value with the default */
+ write_integer_resource(getLwM2mHandle(), &uri, DEFAULT_SENDING_PERIOD / 1000);
+ gSendingRate = DEFAULT_SENDING_PERIOD;
+ }
+
+ }
+ }
+
+
+#endif
+
+
+
+ {
+ /*Critical Section for opaque buffer*/
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ 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_init( &opaque.CSSemH, &semAttrHandle );
+
+ /*Init opaque*/
+ memset(opaque.buffer, 0, OPAQUE_SIZE);
+ opaque.p = 0;
+ }
+
+ {
+ M2MB_OS_RESULT_E osRes;
+ M2MB_OS_EV_ATTR_HANDLE evAttrHandle;
+ m2mb_os_ev_setAttrItem( &evAttrHandle, CMDS_ARGS(M2MB_OS_EV_SEL_CMD_CREATE_ATTR, NULL));
+ osRes = m2mb_os_ev_init( &gBoschInitEvH, &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;
+ }
+ }
+
+
+ taskId = azx_tasks_createTask((char*) "read" , AZX_TASKS_STACK_L, 2, AZX_TASKS_MBOX_S, dataReadTaskCb);
+ if(taskId > 0)
+ {
+ azx_tasks_sendMessageToTask(taskId, 0, 0, 0);
+ }
+ else
+ {
+ return -1;
+ }
+
+ taskId = azx_tasks_createTask((char*) "read" , AZX_TASKS_STACK_L, 3, AZX_TASKS_MBOX_S, dataSendTaskCb);
+ if(taskId > 0)
+ {
+ azx_tasks_sendMessageToTask(taskId, 0, 0, 0);
+ }
+ else
+ {
+ return -1;
+ }
+
+
+#if BOSCH_BSEC
+ AZX_LOG_DEBUG("Init sensors...\r\n");
+ init_sensors(sensorsInitCB);
+#else
+ /*skip the sensors initialization*/
+ sensorsInitCB(-1, NULL);
+#endif
+ return 0;
+}
+/* Global functions =============================================================================*/
+/*-----------------------------------------------------------------------------------------------*/
+
+
+/***************************************************************************************************
+ \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 taskId;
+ azx_tasks_init();
+
+ /* SET output channel */
+ AZX_LOG_INIT();
+ AZX_LOG_INFO( "Starting Time Series Demo app. This is v%s built on %s %s.\r\n",
+ VERSION, __DATE__, __TIME__ );
+
+
+ taskId = azx_tasks_createTask((char*) "BSENS" , AZX_TASKS_STACK_XL, 1, AZX_TASKS_MBOX_S, demoTaskCb);
+ if(taskId > 0)
+ {
+
+ azx_tasks_sendMessageToTask(taskId, 0, 0, 0);
+ }
+ else
+ {
+ return;
+ }
+}
+
+
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.c b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.c
new file mode 100644
index 0000000..0c7a008
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.c
@@ -0,0 +1,209 @@
+
+/*=========================================================================*/
+/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
+/**
+ @file
+ gpio.c
+
+ @brief
+ The file contains gpio utilities
+
+ @details
+
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+
+/* Include files ================================================================================*/
+#include
+#include
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_i2c.h"
+#include "m2mb_gpio.h"
+#include "m2mb_lwm2m.h"
+#include "m2mb_power.h"
+
+#include "gpio.h"
+
+/* Local defines ================================================================================*/
+
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+static INT8 LED_GPIOS[3] = {RED_LED_GPIO, YELLOW_LED_GPIO, GREEN_LED_GPIO};
+
+/* GPIO files descriptors */
+static INT32 gpio_fd = -1;
+static INT32 led_fd[3] = {-1,-1,-1};
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+
+void gpio_interr_cb( UINT32 fd, void *userdata )
+{
+ ( void )fd;
+ ( void )userdata;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int close_gpio( int *pin )
+{
+ INT32 ret = -1;
+ ret = m2mb_gpio_close(*pin);
+ if(ret != 0)
+ {
+ return -1;
+ }
+
+ *pin = 0;
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int open_gpio( int pin )
+{
+ INT32 ret = -1;
+ char path[32];
+ memset( path, 0, sizeof( path ) );
+ sprintf( path, "/dev/GPIO%d", pin );
+ /* Open file descriptor for GPIO*/
+ gpio_fd = m2mb_gpio_open( path, 0 );
+
+ if( gpio_fd != -1 )
+ {
+ ret = m2mb_gpio_multi_ioctl( gpio_fd,
+ CMDS_ARGS( M2MB_GPIO_IOCTL_SET_DIR, M2MB_GPIO_MODE_INPUT, /*Set gpio in input mode*/
+ M2MB_GPIO_IOCTL_SET_PULL,
+ M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
+ M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE, /*Pull drive set to medium*/
+ M2MB_GPIO_IOCTL_SET_INTR_TYPE,
+ INTR_CB_SET, /*Select interrupt type as callback function*/
+ M2MB_GPIO_IOCTL_SET_INTR_TRIGGER,
+ M2MB_GPIO_INTR_ANYEDGE, /*Select interrupt event on both edges*/
+ M2MB_GPIO_IOCTL_SET_INTR_CB, ( UINT32 )gpio_interr_cb, /*Register interrupt callback*/
+ M2MB_GPIO_IOCTL_SET_INTR_ARG, ( UINT32 )
+ pin, /*Register interrupt callback parameter*/
+ M2MB_GPIO_IOCTL_INIT_INTR, ( UINT32 )NULL ) /*enable interrupts*/
+ );
+
+ if( ret != -1 )
+ {
+ ret = 0;
+ }
+ }
+ else
+ {
+ ret = 1;
+ }
+
+ return ret;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int open_LED( int index )
+{
+ INT32 ret = -1;
+ char path[32];
+ memset( path, 0, sizeof( path ) );
+
+ if (index < 0 || index > 3)
+ {
+ return ret;
+ }
+
+ sprintf( path, "/dev/GPIO%d", LED_GPIOS[index] );
+
+ /* Open file descriptor for GPIO*/
+ led_fd[index] = m2mb_gpio_open( path, 0 );
+
+ if( led_fd[index] != -1 )
+ {
+ ret = m2mb_gpio_multi_ioctl( led_fd[index],
+ CMDS_ARGS( M2MB_GPIO_IOCTL_SET_DIR, M2MB_GPIO_MODE_OUTPUT, /*Set gpio in output mode*/
+ M2MB_GPIO_IOCTL_SET_PULL, M2MB_GPIO_PULL_DOWN, /*Set pull configuration as pull down*/
+ M2MB_GPIO_IOCTL_SET_DRIVE, M2MB_GPIO_MEDIUM_DRIVE ) /*Pull drive set to medium*/
+ );
+ if( ret != -1 )
+ {
+ ret = 0;
+ }
+ }
+ else
+ {
+ ret = 1;
+ }
+
+ return ret;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_GPIO_VALUE_E read_gpio( INT32 fd )
+{
+ M2MB_GPIO_VALUE_E value;
+
+ if( 0 == m2mb_gpio_read( fd, &value ) )
+ {
+ return value;
+ }
+ else
+ {
+ return M2MB_GPIO_LOW_VALUE;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void write_gpio( INT32 fd, M2MB_GPIO_VALUE_E value )
+{
+ m2mb_gpio_write( fd, value );
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+M2MB_GPIO_VALUE_E read_gpio( void )
+{
+ return read_gpio( gpio_fd );
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void write_LED( M2MB_GPIO_VALUE_E value )
+{
+ m2mb_gpio_write( led_fd[0], value );
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void writeLEDbyIndex( INT32 index, M2MB_GPIO_VALUE_E value )
+{
+ m2mb_gpio_write( led_fd[index], value );
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+INT32 getGpioDescriptor(INT32 index)
+{
+ if (index < 0 || index > 2)
+ {
+ return -1;
+ }
+ return led_fd[index];
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+
+INT32 getGpioPinByIndex(INT32 index)
+{
+ if (index < 0 || index > 2)
+ {
+ return -1;
+ }
+ return LED_GPIOS[index];
+}
+
+/*-----------------------------------------------------------------------------------------------*/
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.h b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.h
new file mode 100644
index 0000000..7b0592e
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/gpio.h
@@ -0,0 +1,130 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/**
+ @file
+ gpio.h
+
+ @brief
+ demo gpio utilities
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+
+#ifndef SRC_GPIO_H_
+#define SRC_GPIO_H_
+
+/* Global declarations ==========================================================================*/
+
+#define RED_LED_GPIO 1
+#define YELLOW_LED_GPIO 9
+#define GREEN_LED_GPIO 10
+
+/* Global typedefs ==============================================================================*/
+
+/* Global functions =============================================================================*/
+
+/**
+ @brief Callback for GPIO interrupts
+
+ @param[in] fd File descriptor of GPIO device
+ @param[in] userdata Address of user data buffer
+
+*/
+void gpio_interr_cb( UINT32 fd, void *userdata );
+
+
+
+/**
+ @brief Close GPIO input file/device
+
+ @param[in] *pin GPIO pin number
+ @retval 0 = device close, error other values
+
+*/
+int close_gpio( int *pin );
+
+/**
+ @brief Open GPIO input file/device
+
+ @param[in] pin GPIO pin number
+ @retval 0 = device open, error other values
+
+*/
+int open_gpio( int pin );
+
+/**
+ @brief Open GPIO output file/device for LED
+
+ @param[in] pin GPIO pin number
+ @retval 0 = device open, error other values
+
+*/
+int open_LED( int pin );
+
+/**
+ @brief Read value from GPIO file/device
+
+ @param[in] fd file/device descriptor
+ @retval GPIO status
+
+*/
+M2MB_GPIO_VALUE_E read_gpio( INT32 fd );
+
+M2MB_GPIO_VALUE_E read_gpio( void );
+
+
+/**
+ @brief Write value to GPIO file/device
+
+ @param[in] fd file/device descriptor
+ @param[in] value GPIO status to be written
+
+*/
+void write_gpio( INT32 fd, M2MB_GPIO_VALUE_E value );
+
+/**
+ @brief Write value to LED 1
+
+ @param[in] value GPIO status to be written
+
+*/
+void write_LED( M2MB_GPIO_VALUE_E value );
+
+
+/**
+ @brief Write value to LED by pin
+
+ @param[in] value GPIO status to be written
+
+*/
+void writeLEDbyIndex( INT32 index, M2MB_GPIO_VALUE_E value );
+/**
+ @brief Return the GPIO descriptor
+
+ @param[in] value GPIO index
+ return -1 in case of error
+
+*/
+INT32 getGpioDescriptor(INT32 pin);
+
+/**
+ @brief Return the GPIO pin
+
+ @param[in] value GPIO index
+ return -1 in case of error
+
+*/
+INT32 getGpioPinByIndex(INT32 index);
+
+#endif /* SRC_GPIO_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.c b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.c
new file mode 100644
index 0000000..a5b6d43
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.c
@@ -0,0 +1,239 @@
+
+/*=========================================================================*/
+/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
+/**
+ @file
+ i2c.c
+
+ @brief
+ The file contains i2c utilities
+
+ @details
+
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+/* Include files ================================================================================*/
+#include
+#include
+#include
+#include
+#include
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_i2c.h"
+#include "m2mb_gpio.h"
+#include "m2mb_lwm2m.h"
+#include "m2mb_power.h"
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "app_cfg.h"
+
+#include "i2c.h"
+
+
+/* Local defines ================================================================================*/
+
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+static INT32 i2c_fd = -1;
+
+M2MB_OS_SEM_HANDLE I2C_CSSemHandle = NULL;
+
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+int open_I2C( void )
+{
+ INT32 res;
+ CHAR dev_ID[64];
+ M2MB_I2C_CFG_T config;
+
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == I2C_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_init( &I2C_CSSemHandle, &semAttrHandle );
+ }
+
+
+
+
+ /**************
+ Configuring the IIC device.
+ **************/
+ AZX_LOG_INFO( "\r\nConfiguring the Bosch BHI160 I2C channel...\r\n" );
+ //Create device name using device address in decimal base, left shifted by 1 bit
+ sprintf( dev_ID, "/dev/I2C-%d",
+ ( UINT16 ) BHY_I2C_160B_ADDR1 << 1 ); //I2C API require an already left-shifted device address
+ AZX_LOG_INFO( "Opening channel %s\r\n", dev_ID );
+ i2c_fd = m2mb_i2c_open( dev_ID, 0 );
+
+ if( -1 == i2c_fd )
+ {
+ AZX_LOG_ERROR( "cannot open I2C channel!\r\n" );
+ return 1;
+ }
+
+ config.sclPin = I2C_SCL;
+ config.sdaPin = I2C_SDA;
+ config.registerId = 0x00; //dummy register
+ res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )&config );
+
+ if( res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot configure I2C channel\r\n" );
+ return 1;
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t sensor_i2c_write( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size )
+{
+ ( void )addr;
+ INT32 i2c_res;
+ M2MB_I2C_CFG_T config;
+
+ if( i2c_fd == -1 )
+ {
+ return 1;
+ }
+
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_GET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot get I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ config.registerId = reg;
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot set I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ AZX_LOG_TRACE( "Configuring I2C Registers - Writing %d bytes into 0x%02X register...\r\n", size,
+ reg );
+ m2mb_os_sem_get(I2C_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ i2c_res = m2mb_i2c_write( i2c_fd, p_buf, size );
+ m2mb_os_sem_put(I2C_CSSemHandle);
+ if( i2c_res != size )
+ {
+ AZX_LOG_ERROR( "cannot write data! error: %d\r\n", i2c_res );
+ return 1;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Write: success\r\n" );
+ return 0;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t sensor_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size,
+ M2MB_I2C_CFG_T *pConfig )
+{
+ ( void )addr;
+
+ for( int i = 0; size > 0; i++ )
+ {
+ pConfig->registerId = reg;
+ INT32 i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )pConfig );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "Cannot set I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ uint16_t tmpsize;
+
+ if( size >= 16 )
+ {
+ tmpsize = 16;
+ }
+ else
+ {
+ tmpsize = size;
+ }
+
+ i2c_res = m2mb_i2c_read( i2c_fd, p_buf, tmpsize ); //reading 16 bytes max at a time
+
+ if( i2c_res == tmpsize )
+ {
+ size = size - tmpsize;
+ reg = reg + tmpsize;
+
+ AZX_LOG_TRACE( "Reading Success.\r\n" );
+ AZX_LOG_TRACE( "i2c->" );
+ for( int i = 0; i < i2c_res; i++ )
+ {
+ AZX_LOG_TRACE( " %02x", p_buf[i] );
+ }
+ AZX_LOG_TRACE( "\r\n" );
+
+ p_buf = p_buf + tmpsize;
+ }
+ else
+ {
+ AZX_LOG_ERROR( "Reading FAIL for %d bytes on register 0x%02X! - Exit Value: %d.\r\n", size, reg,
+ i2c_res );
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t sensor_i2c_read( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size )
+{
+ INT32 i2c_res;
+ M2MB_I2C_CFG_T config;
+ AZX_LOG_TRACE( "I2C read register..." );
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_GET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "Cannot get I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ m2mb_os_sem_get(I2C_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ if( reg == 0 ) // if read FIFO double buffer
+ {
+ for( ; size > 50; )
+ {
+ i2c_res = sensor_i2c_read_16( addr, reg, p_buf, 50, &config );
+ size = size - 50;
+ p_buf = p_buf + 50;
+ }
+
+ i2c_res += sensor_i2c_read_16( addr, reg, p_buf, size, &config );
+ }
+ else
+ {
+ i2c_res = sensor_i2c_read_16( addr, reg, p_buf, size, &config );
+ }
+ m2mb_os_sem_put(I2C_CSSemHandle);
+
+ return i2c_res;
+}
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.h b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.h
new file mode 100644
index 0000000..0409bac
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/i2c.h
@@ -0,0 +1,70 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/**
+ @file
+ i2c.h
+
+ @brief
+ demo i2c utilities
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+#ifndef SRC_I2C_H_
+#define SRC_I2C_H_
+
+/* Global declarations ==========================================================================*/
+/* default I2C configuration */
+#define I2C_SDA (UINT8) 2 //GPIO 2
+#define I2C_SCL (UINT8) 3 //GPIO 3
+#define BHY_I2C_160B_ADDR1 (UINT16) 0x28
+
+
+extern M2MB_OS_SEM_HANDLE I2C_CSSemHandle;
+
+/* Global typedefs ==============================================================================*/
+/* Global functions =============================================================================*/
+
+/**
+ @brief Opens I2C device at BHI160B default address
+
+*/
+int open_I2C( void );
+
+
+/**
+ @brief Writes data from buffer using I2C
+
+ @param[in] addr Device address on I2C bus (not used)
+ @param[in] reg Start register address
+ @param[in] p_buf Pointer to buffer with data to be written
+ @param[in] size Size of the data to be written
+ @return 1 on error, 0 if OK
+
+*/
+int8_t sensor_i2c_write( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size );
+
+/**
+ @brief Reads data to buffer using I2C 16 bytes a t a time - internal function
+
+ @param[in] addr Device address on I2C bus (not used)
+ @param[in] reg Start register address
+ @param[in] p_buf Pointer to buffer with data to be read
+ @param[in] size Size of the data to be written
+ @return 1 on error, 0 if OK
+
+*/
+int8_t sensor_i2c_read( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size );
+
+
+#endif /* SRC_I2C_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.c b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.c
new file mode 100644
index 0000000..12199e9
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.c
@@ -0,0 +1,1325 @@
+/*=========================================================================*/
+/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
+/**
+ @file
+ lwm2m.c
+
+ @brief
+ The file contains lwm2m callbacks and utilities
+
+ @details
+
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2021-01-20
+ */
+/* Include files ================================================================================*/
+#include
+#include
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_i2c.h"
+#include "m2mb_gpio.h"
+#include "m2mb_lwm2m.h"
+#include "m2mb_power.h"
+
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "azx_tasks.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "app_cfg.h"
+
+#include "gpio.h"
+#include "lwm2m.h"
+
+/* Local defines ================================================================================*/
+#define GPIO_INDEX_RED 0
+#define GPIO_INDEX_YELLOW 1
+#define GPIO_INDEX_GREEN 2
+
+/* Local typedefs ===============================================================================*/
+
+/* Local statics ================================================================================*/
+static INT32 dataTaskID = -1;
+static LWM2M_OBJ_USERDATA_T *lwm2mUserData = NULL;
+
+static BOOLEAN bootstrapped = FALSE;
+
+/* HANDLER */
+static M2MB_OS_EV_HANDLE eventsHandleLwm2m = NULL;
+static M2MB_OS_SEM_HANDLE lwm2m_CSSemHandle = NULL;
+static M2MB_LWM2M_HANDLE lwm2mHandle = NULL;
+
+/* ONEEDGE */
+static M2MB_LWM2M_OBJ_URI_T _obj_telit_service_uri = { .uriLen = 4,
+ .obj = 33211, .objInst = 0, .resource = 0, .resourceInst = 1 };
+
+static M2MB_LWM2M_OBJ_URI_T _obj_tamper_uri = { 3, TAMPERING_OBJ_ID, 0, 1 };
+
+static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_t = { 3, ENVIRONMENT_OBJ_ID, 0,
+ 1, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_p = { 3, ENVIRONMENT_OBJ_ID, 0,
+ 2, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_h = { 3, ENVIRONMENT_OBJ_ID, 0,
+ 3, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_environment_uri_iaq = { 3, ENVIRONMENT_OBJ_ID,
+ 0, 4, 0 };
+
+static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_w =
+ { 3, ROTATION_OBJ_ID, 0, 1, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_x =
+ { 3, ROTATION_OBJ_ID, 0, 2, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_y =
+ { 3, ROTATION_OBJ_ID, 0, 3, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_z =
+ { 3, ROTATION_OBJ_ID, 0, 4, 0 };
+static M2MB_LWM2M_OBJ_URI_T _obj_rotation_uri_a =
+ { 3, ROTATION_OBJ_ID, 0, 5, 0 };
+
+static LIGHT_CONTROL_OBJ_INSTANCE_S light_control_obj_table[] = {
+ LIGHT_CONTROL_OBJ_INFO("Red", "LD1", GPIO_INDEX_RED, -1, RED_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Yellow", "LD2", GPIO_INDEX_YELLOW, -1, YELLOW_LED_GPIO),
+ LIGHT_CONTROL_OBJ_INFO("Green", "LD3", GPIO_INDEX_GREEN, -1, GREEN_LED_GPIO),
+ { .description = (char*) NULL, .appType = (char*) NULL, -1, -1, -1 }
+};
+
+/* Local function prototypes ====================================================================*/
+static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index);
+static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
+ INT32 taskId);
+
+static INT32 set_string_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, CHAR *data);
+
+/* Static functions =============================================================================*/
+static INT32 writeLightControlAppTypeTask(INT32 event, INT32 index,
+ INT32 taskId) {
+ (void)event;
+
+ AZX_LOG_DEBUG("LWM2M_AT_TASK Task : <%d>\r\n", (INT8 ) taskId);
+
+ UINT32 curEvBits;
+ M2MB_LWM2M_OBJ_URI_T resource_uri;
+
+ /* Fill resource URI with required parameters */
+ resource_uri.obj = LWM2M_LIGHT_CONTROL_OBJ_ID;
+ resource_uri.objInst = index;
+ resource_uri.resourceInst = 0;
+ resource_uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ resource_uri.resource = LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID;
+
+ AZX_LOG_INFO("Instance <%d> with app type <%s>\r\n", index,
+ light_control_obj_table[index].appType);
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &resource_uri,
+ light_control_obj_table[index].appType,
+ strlen(light_control_obj_table[index].appType));
+ //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;
+ }
+
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+
+
+ AZX_LOG_INFO("LWM2M_AT_TASK Task : <%d> destroying...\r\n", taskId);
+ INT32 r = azx_tasks_destroyTask((INT8) taskId);
+ AZX_LOG_ERROR("Error code <%d> destroying LWM2M_AT_TASK Task ID <%d>\r\n", r,
+ taskId);
+
+ return 1;
+}
+
+static M2MB_RESULT_E writeLightControlApplicationType(M2MB_LWM2M_EVENT_E event, INT16 index) {
+ INT8 appTypeTaskID;
+ appTypeTaskID = azx_tasks_createTask((char*) "LWM2M_AT_TASK",
+ AZX_TASKS_STACK_S, 2, AZX_TASKS_MBOX_S,
+ writeLightControlAppTypeTask);
+
+ AZX_LOG_INFO("Task App Type ID: %d.\r\n", appTypeTaskID);
+ if (appTypeTaskID <= 0) {
+ AZX_LOG_ERROR(
+ "Cannot create lwm2m application type managing task!\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ azx_tasks_sendMessageToTask(appTypeTaskID, event, (INT32) index,
+ (INT32) appTypeTaskID);
+
+ return M2MB_RESULT_SUCCESS;
+}
+
+
+
+static INT32 set_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\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);
+ }
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set( 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_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;
+ }
+
+}
+/* Global functions =============================================================================*/
+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;
+
+
+ if(NULL == h)
+ {
+ AZX_LOG_ERROR("oneedge not initialized yet\r\n");
+ return M2MB_RESULT_FAIL;
+ }
+
+ 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;
+}
+
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value)
+{
+ UINT32 curEvBits;
+ INT32 _value = 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);
+ }
+
+
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write( h, pUri, &_value, sizeof( INT32 ));
+
+ //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;
+ }
+
+}
+
+
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen)
+{
+ UINT32 curEvBits;
+ M2MB_RESULT_E retVal;
+ 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
+ );
+ }
+ AZX_LOG_INFO("%u bytes will be set\r\n", datalen);
+
+ retVal = m2mb_lwm2m_set( h, pUri, (void *) data, (UINT16) datalen);
+
+ //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 );
+ 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
+ {
+ /* wait notify*/
+ if (M2MB_OS_SUCCESS != m2mb_os_ev_get( eventsHandleLwm2m,
+ 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");
+ return -3;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+}
+
+
+
+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;
+
+ /* Client generated events */
+ switch (event) {
+
+ 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_TRACE("LWM2M enable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_ENABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ case M2MB_LWM2M_DISABLE_RES: {
+ M2MB_LWM2M_DISABLE_RES_T *resp = (M2MB_LWM2M_DISABLE_RES_T *) resp_struct;
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+
+ AZX_LOG_TRACE("LWM2M disable result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_DISABLE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+
+ AZX_LOG_WARN("Enable result %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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_DEBUG("LWM2M set result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_WARN("set result %d\r\n", resp->result);
+ }
+ 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;
+ AZX_LOG_TRACE("M2MB_LWM2M_READ_RES, result: %d\r\n", resp->result);
+ AZX_LOG_TRACE("Read type: %d; size: %u\r\n", resp->resType, resp->len);
+ if (resp->result == M2MB_LWM2M_RES_SUCCESS) {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_READ_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else {
+ AZX_LOG_ERROR("READ failed with error %d\r\n", resp->result);
+ }
+ break;
+ }
+
+ 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("LWM2M write result OK\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_SET);
+ } else
+ {
+ AZX_LOG_WARN("Enable write %d\r\n", resp->result);
+ }
+ 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 && dataTaskID != -1)
+ {
+ 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);
+ p_uri->uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ azx_tasks_sendMessageToTask( dataTaskID, EV_MON_URC_RECEIVED, (INT32)p_uri, 0);
+ }
+ else
+ {
+ AZX_LOG_ERROR("Cannot allocate uri struct\r\n");
+ }
+
+ break;
+ }
+
+ 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;
+
+ LWM2M_OBJ_USERDATA_T *data = (LWM2M_OBJ_USERDATA_T*) userdata;
+
+ switch( resp->result )
+ {
+ case M2MB_LWM2M_RES_SUCCESS:
+
+ AZX_LOG_TRACE("New Instance created successfully\r\n");
+
+ if (userdata)
+ {
+ INT32 objId = data->objID;
+ INT16 *index = (INT16*) data->data;
+ AZX_LOG_TRACE( "objId: %d, index: %d \r\n", objId, *index);
+
+ switch (objId)
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+
+ azx_sleep_ms(4000);
+
+ // start task to write the resource
+ if (writeLightControlApplicationType(
+ M2MB_LWM2M_NEW_INST_RES, *index) != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("Error writing application Type resource\r\n");
+ }
+
+ /* free the resource allocated in to oneedge_init */
+ m2mb_os_free((INT16*) data->data);
+
+ break;
+
+ default:
+ AZX_LOG_INFO("unexpected object instance. <%d>\r\n", objId);
+ /* resource created and updated, proceed with the next m2mb_lwm2m_newinst */
+ break;
+ }
+ }
+ else /*null userdata*/
+ {
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ }
+ break;
+
+ case M2MB_LWM2M_RES_FAIL_NOT_ALLOWED:
+ AZX_LOG_WARN( "New instance creation not allowed (already present?)\r\n" );
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_NEW_RES_BIT, M2MB_OS_EV_SET);
+ break;
+
+ default:
+ AZX_LOG_DEBUG( "Creating object instance specified: generic result %d\r\n", resp->result );
+ break;
+ }
+
+ break;
+ }
+
+ case M2MB_LWM2M_SRV_INFO_IND: {
+
+ AZX_LOG_TRACE("M2MB_LWM2M_SRV_INFO_IND\r\n");
+ M2MB_LWM2M_SRV_INFO_IND_T *resp =
+ (M2MB_LWM2M_SRV_INFO_IND_T *) resp_struct;
+
+ switch (resp->info) {
+ case M2MB_LWM2M_CL_STATE_DISABLED:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DISABLED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_DISABLED_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_BOOTSTRAPPED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_BOOTSTRAPPED\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERING:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_REGISTERED:
+ AZX_LOG_DEBUG("resp->info == M2MB_LWM2M_CL_STATE_REGISTERED\r\n");
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SRV_REG_BIT,
+ M2MB_OS_EV_SET);
+ break;
+ case M2MB_LWM2M_CL_STATE_DEREGISTERING:
+ AZX_LOG_DEBUG(
+ "resp->info == M2MB_LWM2M_CL_STATE_DEREGISTERING\r\n");
+ break;
+ case M2MB_LWM2M_CL_STATE_SUSPENDED:
+ AZX_LOG_DEBUG("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;
+ }
+
+ 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(eventsHandleLwm2m, 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(eventsHandleLwm2m, 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 ) )
+ {
+ // code
+ AZX_LOG_TRACE( "m2mb_lwm2m_nfy_ack_list %hu elements read\r\n", resp->listElementsNumber );
+ m2mb_os_ev_set(eventsHandleLwm2m, 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;
+
+ // code; i.e.:
+ // uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
+ // the last one in the printf below
+ if( ( pInfo ) /*&& ( pInfo->uri.uriLen == 3 )*/ )
+ {
+ AZX_LOG_DEBUG( "#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(eventsHandleLwm2m, EV_LWM2M_NFYACK_BIT, M2MB_OS_EV_SET);
+ }
+ }
+
+ break;
+ }
+
+
+ case M2MB_LWM2M_SESSION_INFO_IND:
+ {
+ AZX_LOG_TRACE("M2MB_LWM2M_SESSION_INFO_IND\r\n");
+ M2MB_LWM2M_INFO_IND_T *resp = (M2MB_LWM2M_INFO_IND_T *) resp_struct;
+
+ if (resp->info == M2MB_LWM2M_INFO_RESOURCE_EXECUTE)
+ {
+ M2MB_LWM2M_OBJ_URI_T *currData = (M2MB_LWM2M_OBJ_URI_T *) resp->data;
+ AZX_LOG_DEBUG("Info Exec Ind: %d/%d/%d\r\n", currData->obj, currData->objInst, currData->resource);
+ /* example
+ if( currData->obj == 3303 && currData->resource == 5605)
+ {
+ AZX_LOG_DEBUG( "Reset Min/Max Value of temperature\r\n");
+ }
+ else
+ {
+ AZX_LOG_DEBUG("executed another resource");
+ }*/
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_mon() */
+ case M2MB_LWM2M_MON_RES:
+ {
+ AZX_LOG_TRACE( "M2MB_LWM2M_MON_RES\r\n" );
+
+ 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(eventsHandleLwm2m, EV_LWM2M_MON_RES_BIT, M2MB_OS_EV_SET);
+ }
+ else
+ {
+ AZX_LOG_DEBUG("Monitoring result error.\r\n\r\n");
+ }
+
+ break;
+ }
+
+ /* event in response to m2mb_lwm2m_get_stat() */
+ case M2MB_LWM2M_GET_STAT_RES:
+ {
+ AZX_LOG_DEBUG( "M2MB_LWM2M_GET_STAT_RES\r\n" );
+ break;
+ }
+
+ default:
+ AZX_LOG_DEBUG("LWM2M EVENT %d\r\n", event);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsBootstrapped(void)
+{
+ bootstrapped = TRUE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void setAsNotBootstrapped(void)
+{
+ bootstrapped = FALSE;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+uint8_t oneedge_init(LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData) {
+ 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;
+
+ lwm2mUserData = (LWM2M_OBJ_USERDATA_T *) userData;
+
+
+ int i;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == lwm2m_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_init(&lwm2m_CSSemHandle, &semAttrHandle);
+ }
+
+ AZX_LOG_TRACE("Asked to register %d object instances.\r\n", obj_num);
+
+ /* 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");
+ return 1;
+ } else {
+ AZX_LOG_TRACE("m2mb_os_ev_init success\r\n");
+ }
+
+ //get the handle of the lwm2m client on lwm2mHandle
+ retVal = m2mb_lwm2m_init(&lwm2mHandle, lwm2mIndicationCB, (void *) lwm2mUserData);
+
+ 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_agent_config(lwm2mHandle, 0 /*Telit Agent ID*/);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_agent_config request succeeded");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if(!bootstrapped)
+ {
+ 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_os_sem_deinit(lwm2m_CSSemHandle);
+
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ }
+
+
+ m2mb_os_ev_set(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT, M2MB_OS_EV_CLEAR);
+
+ //AT#LWM2MENA=1
+ memset(&pars, 0, sizeof(M2MB_LWM2M_ENABLE_REQ_T));
+
+ 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_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ azx_sleep_ms(1000);
+
+
+ AZX_LOG_DEBUG("Waiting LWM2M Registering (120 seconds)...\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));
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("LWM2M Register timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+
+ AZX_LOG_DEBUG("LWM2M registered\r\n");
+
+ azx_sleep_ms(1000);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ M2MB_LWM2M_OBJ_URI_T uri;
+ M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
+
+ /*new object instance information*/
+ uri.obj = objs[i].obj_id;
+
+ new_inst_params.agent = 0; /*Telit Agent*/
+
+ int j;
+ for (j = 0; j < objs[i].inst_num; j++)
+ {
+
+ if(!bootstrapped)
+ {
+ AZX_LOG_TRACE( "Creating new instance %d for object %d\r\n", j, objs[i].obj_id);
+
+ uri.objInst = objs[i].instances_ids[j];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ /*If OK the instance was not present, and so it was created. If an error
+ is received, it is likely because the instance already exists.*/
+ }
+ INT16 *index = NULL;
+
+ if (lwm2mUserData)
+ {
+
+ switch( lwm2mUserData->objID )
+ {
+ case LWM2M_LIGHT_CONTROL_OBJ_ID:
+ {
+ index = (INT16 *) m2mb_os_malloc(sizeof(INT16));
+ if(!index)
+ {
+ AZX_LOG_ERROR( "Cannot allocate memory\r\n");
+ //TODO check if needed free resources
+ return M2MB_RESULT_FAIL;
+ }
+ *index = objs[i].instances_ids[j];
+ lwm2mUserData->data = (void*) index;
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if(!bootstrapped)
+ {
+ retVal = m2mb_lwm2m_newinst(lwm2mHandle, &uri, &new_inst_params);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_WARN("m2mb_lwm2m_newinst returned error %d\r\n", retVal);
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ return M2MB_RESULT_FAIL;
+ }
+
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ EV_LWM2M_NEW_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR,
+ &curEvBits,
+ M2MB_OS_MS2TICKS(10000) /*wait 10 seconds for the event to occur*/
+ );
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_newinst timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ if (index)
+ {
+ m2mb_os_free(index);
+ }
+ azx_sleep_ms(2000);
+ return M2MB_RESULT_FAIL;
+ }
+
+ AZX_LOG_TRACE("Created NewInst[%d] uri_new_inst->uriLen: %d \r\n", uri.objInst, uri.uriLen);
+ }
+
+ } //for (j = 0; j < objs[i].inst_num; j++)
+
+ switch(uri.obj)
+ {
+ case TIME_SERIES_METERING_INFO_OBJ_ID:
+ {
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ uri.resource = 1;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_serial_number");
+
+ uri.resource = 2;
+ set_string_resource(lwm2mHandle, &uri, (CHAR *)"dummy_meter_fw_version");
+ break;
+ }
+ case TIME_SERIES_METERING_RATES_OBJ_ID:
+ {
+ M2MB_LWM2M_MON_REQ_T mon;
+ uri.objInst = objs[i].instances_ids[0];
+ uri.resource = 0;
+ uri.resourceInst = 0;
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+
+ mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
+ mon.action = M2MB_LWM2M_MON_ENABLE;
+ AZX_LOG_INFO( "Register monitor resources\r\n");
+ registerMonitorResource(uri, mon);
+ }
+ break;
+ default:
+ break;
+ }
+ } //for (i = 0; i < obj_num; i++)
+
+ {
+
+ /*adding an URI to the list */
+ M2MB_LWM2M_OBJ_URI_T uri;
+
+ uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
+ uri.obj = TELIT_APPLICATION_DATA_OBJ_ID;
+ uri.objInst = 0;
+ uri.resource = 0;
+ uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
+
+ AZX_LOG_DEBUG("enable notify ack\r\n");
+ retVal = m2mb_lwm2m_nfy_ack_uri( lwm2mHandle, TRUE, &uri );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_nfy_ack_uri request failed!" );
+ return 1;
+ }
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return 1;
+ }
+ /* 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" );
+ return 1;
+ }
+ if (M2MB_OS_SUCCESS
+ != m2mb_os_ev_get(eventsHandleLwm2m,
+ 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_list timeout!\r\n");
+ m2mb_os_ev_deinit(eventsHandleLwm2m);
+ m2mb_os_sem_deinit(lwm2m_CSSemHandle);
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+
+ return 1;
+ }
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void update_tamper_LWM2MObject(int value)
+{
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_write(lwm2mHandle, &_obj_tamper_uri,
+ &value, sizeof(int));
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_WRITE_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void update_environment_LWM2MObject(float _t, float _p, float _rh, INT16 _iaq) {
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ M2MB_RESULT_E retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_t,
+ &_t, sizeof(float));
+ azx_sleep_ms(10);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_p, &_p,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_h, &_rh,
+ sizeof(float));
+ azx_sleep_ms(10);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_environment_uri_iaq, &_iaq,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+
+ if (retVal != M2MB_RESULT_SUCCESS) {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+void update_rotation_LWM2MObject(float _w, float _x, float _y, float _z,
+ INT16 _acc) {
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ m2mb_os_sem_get(lwm2m_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_w, &_w,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_x, &_x,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_y, &_y,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_z, &_z,
+ sizeof(float));
+ //azx_sleep_ms(100);
+ retVal = m2mb_lwm2m_set(lwm2mHandle, &_obj_rotation_uri_a, &_acc,
+ sizeof(INT16));
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ }
+ osRes = m2mb_os_ev_get(eventsHandleLwm2m, EV_LWM2M_SET_RES_BIT,
+ M2MB_OS_EV_GET_ANY_AND_CLEAR, NULL, M2MB_OS_MS2TICKS(10000));
+ if (osRes != M2MB_OS_SUCCESS) {
+ AZX_LOG_ERROR("LWM2M write failure\r\n");
+
+ }
+
+ m2mb_os_sem_put(lwm2m_CSSemHandle);
+ if (retVal != M2MB_RESULT_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_set returned error %d\r\n", retVal);
+ return;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int check_xml_file(const char *name) {
+ char path[64] = { 0 };
+ struct M2MB_STAT info;
+ sprintf(path, "/XML/%s", name);
+ AZX_LOG_DEBUG("Looking for <%s> file..\r\n", path);
+
+ if (0 == m2mb_fs_stat(path, &info)) {
+ AZX_LOG_DEBUG("File is present, continue...\r\n");
+ return 0;
+ } else {
+ INT32 last_errno = m2mb_fs_get_errno_value();
+
+ if (last_errno == M2MB_FS_ENOENT) {
+ AZX_LOG_WARN("File not found.\r\n");
+ return -1;
+ } else {
+ AZX_LOG_ERROR("Error with m2mb_fs_stat, errno is: %d\r\n",
+ last_errno);
+ return -2;
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int getLightControlObjTable(LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs)
+{
+ if(NULL == lightObjs)
+ {
+ return 0;
+ }
+ else
+ {
+ *lightObjs = light_control_obj_table;
+ return 1;
+ }
+}
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------------------------*/
+int copy_xml_file(const char *name) {
+ char inpath[64] = { 0 };
+ char outpath[64] = { 0 };
+ char data[256];
+ INT32 in_fd, out_fd;
+ sprintf(inpath, "/mod/%s", name);
+ sprintf(outpath, "/XML/%s", name);
+ in_fd = m2mb_fs_open(inpath, M2MB_O_RDONLY);
+
+ if (-1 == in_fd) {
+ AZX_LOG_ERROR("cannot find input file! abort.\r\n");
+ return -1;
+ } else {
+ out_fd = m2mb_fs_open(outpath, M2MB_O_WRONLY | M2MB_O_CREAT);
+
+ if (-1 == out_fd) {
+ AZX_LOG_ERROR("cannot create output file! abort.\r\n");
+ return -2;
+ } else {
+ struct M2MB_STAT stats;
+ UINT32 filesize;
+ UINT32 written = 0;
+ UINT32 chunk = sizeof(data);
+ AZX_LOG_DEBUG("%s output file opened\r\n", outpath);
+
+ if (-1 == m2mb_fs_fstat(in_fd, &stats)) {
+ AZX_LOG_ERROR("cannot stat input file! abort\r\n");
+ return -3;
+ } else {
+ filesize = stats.st_size;
+ AZX_LOG_DEBUG("File size: %u\r\n", filesize);
+
+ if (chunk > filesize) {
+ AZX_LOG_DEBUG(
+ "chunk is %u, bigger than filesize (%u). Decrease it.\r\n",
+ chunk, filesize);
+ chunk = filesize;
+ }
+
+ while (1) {
+ SSIZE_T res = 0;
+ res = m2mb_fs_read(in_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "read is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -4;
+ }
+
+ res = m2mb_fs_write(out_fd, data, chunk);
+
+ if (res != (SSIZE_T) chunk) {
+ AZX_LOG_ERROR(
+ "written is less than expected: %d instead of %d\r\n",
+ res, chunk);
+ return -5;
+ }
+
+ AZX_LOG_DEBUG("%u bytes written into output file.\r\n",
+ chunk);
+ written += chunk;
+
+ if ((filesize - written) < chunk) {
+ chunk = filesize - written;
+ }
+
+ if (written == filesize) {
+ AZX_LOG_DEBUG("file written. \r\n");
+ break;
+ }
+ }
+
+ return 0;
+ }
+ }
+ }
+}
+
+int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon)
+{
+ M2MB_RESULT_E retVal;
+ M2MB_OS_RESULT_E osRes;
+ UINT32 curEvBits;
+
+ if (lwm2mHandle == NULL)
+ {
+ AZX_LOG_ERROR("lwm2mHandle is NULL!\r\n");
+ return -1;
+ }
+ retVal = m2mb_lwm2m_mon(lwm2mHandle, &uri_mon, &mon );
+ if ( retVal != M2MB_RESULT_SUCCESS )
+ {
+ AZX_LOG_ERROR( "m2mb_lwm2m_mon request fails!\r\n" );
+ return -1;
+ }
+ AZX_LOG_TRACE( "m2mb_lwm2m_mon request succeeded!\r\n" );
+ osRes = m2mb_os_ev_get(
+ eventsHandleLwm2m,
+ 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*/
+ );
+
+ if (osRes != M2MB_OS_SUCCESS)
+ {
+ AZX_LOG_ERROR("m2mb_lwm2m_mon timeout!\r\n");
+ m2mb_os_ev_deinit( eventsHandleLwm2m );
+
+ m2mb_lwm2m_disable(lwm2mHandle);
+ azx_sleep_ms(2000);
+ m2mb_lwm2m_deinit(lwm2mHandle);
+ return -1;
+ }
+
+ return 1;
+}
+
+int lwm2m_ReadTaskRegister(INT32 taskID) {
+ if (taskID > 0) {
+ dataTaskID = taskID;
+ return 1;
+ }
+ return -1;
+}
+
+M2MB_LWM2M_HANDLE getLwM2mHandle()
+{
+ return lwm2mHandle;
+}
+
+M2MB_OS_EV_HANDLE getEventHandle()
+{
+ return eventsHandleLwm2m;
+}
+
diff --git a/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.h b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.h
new file mode 100644
index 0000000..b991703
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/demo_utils/lwm2m.h
@@ -0,0 +1,284 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/**
+ @file
+ lwm2m.h
+
+ @brief
+ demo lwm2m utilities
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+ m2mb_lwm2m.h
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+
+
+#ifndef SRC_LWM2M_H_
+#define SRC_LWM2M_H_
+
+/* Global defines ================================================================================*/
+/*OBJECTs and RESOURCEs IDs*/
+#define LWM2M_LIGHT_CONTROL_OBJ_ID 3311
+#define LWM2M_LIGHT_OBJECT_XML_NAME "object_3311.xml"
+
+#define LIGHT_CONTROL_OBJ_ON_OFF_ID 5850
+#define LIGHT_CONTROL_OBJ_DIMMER_ID 5851
+#define LIGHT_CONTROL_OBJ_TIME_ID 5852
+#define LIGHT_CONTROL_OBJ_CUMULATIVE_ACTIVE_POWER_ID 5805
+#define LIGHT_CONTROL_OBJ_POWER_FACTOR_ID 5820
+#define LIGHT_CONTROL_OBJ_COLOR_ID 5806
+#define LIGHT_CONTROL_OBJ_SENSOR_UNITSR_ID 5701
+#define LIGHT_CONTROL_OBJ_APPLICATION_TYPE_ID 5750
+
+
+#define TAMPERING_OBJ_ID 26242
+#define ENVIRONMENT_OBJ_ID 26251
+#define ROTATION_OBJ_ID 26250
+
+#define TIME_SERIES_METERING_INFO_OBJ_ID 32001
+#define TIME_SERIES_METERING_RATES_OBJ_ID 32002
+
+#define TELIT_APPLICATION_DATA_OBJ_ID 33205
+
+
+#define EV_LWM2M_ENABLE_RES_BIT (UINT32)0x00000001
+#define EV_LWM2M_DISABLE_RES_BIT (UINT32)0x00000002
+#define EV_LWM2M_SET_RES_BIT (UINT32)0x00000004
+#define EV_LWM2M_NEW_RES_BIT (UINT32)0x00000008
+#define EV_LWM2M_GET_RES_BIT (UINT32)0x00000010
+#define EV_LWM2M_MON_RES_BIT (UINT32)0x00000020
+#define EV_LWM2M_WRITE_RES_BIT (UINT32)0x00000040
+#define EV_LWM2M_READ_RES_BIT (UINT32)0x00000080
+#define EV_LWM2M_SRV_REG_BIT (UINT32)0x00000100
+#define EV_LWM2M_GET_STAT_RES_BIT (UINT32)0x00000200
+#define EV_LWM2M_GET_LIST_RES_BIT (UINT32)0x00000400
+#define EV_LWM2M_SRV_DISABLED_BIT (UINT32)0x00000800
+#define EV_LWM2M_NFYADD_RES_BIT (UINT32)0x00002000
+#define EV_LWM2M_NFYACK_BIT (UINT32)0x00004000
+#define EV_LWM2M_NFYACK_LIST_RES_BIT (UINT32)0x00008000
+#define EV_LWM2M_NFYSTAT_RES_BIT (UINT32)0x00010000
+
+#define EV_MON_URC_RECEIVED 2
+#define EV_LWM2M_WRITE_APP_TYPE 3
+#define CTX_ID 1 //default cid used by lwm2m
+
+#define LIGHT_CONTROL_OBJ_INFO(desc, ap, i, fdescr, p) \
+ { .description = (char*)(desc), \
+ .appType = (char*)(ap), \
+ .index = (i), \
+ .fd = (fdescr), \
+ .pin = (p), \
+ }
+
+/* Global typedefs ===============================================================================*/
+
+typedef struct LIGHT_CONTROL_OBJ_INSTANCE_TAG
+{
+ char *description;
+ char *appType;
+ int index;
+ int fd;
+ int pin;
+} LIGHT_CONTROL_OBJ_INSTANCE_S;
+
+typedef struct
+{
+ INT32 obj_id;
+ INT16 inst_num;
+ INT16 *instances_ids;
+} LWM2M_OBJ_REG_T;
+
+typedef struct
+{
+ void *data;
+ INT32 objID;
+} LWM2M_OBJ_USERDATA_T;
+
+/* Global statics ================================================================================*/
+
+
+/* Global functions prototype =============================================================================*/
+
+/**
+ @brief Callback function for Client generated LWM2M events
+
+ @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
+
+*/
+void lwm2mIndCB( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
+ void *userdata );
+
+
+/**
+ @brief If called, the oneedge_init will skip the new instances registration for provided objects
+ @return none
+*/
+void setAsBootstrapped(void);
+
+
+/**
+ @brief If called, the oneedge_init will perform the new instances registration for provided objects
+ @return none
+*/
+void setAsNotBootstrapped(void);
+
+/**
+ @brief Initialize OneEdge connection
+ @param[in] obj_id Object ID to be used for initialization
+ @return result of initialization
+
+*/
+uint8_t oneedge_init( LWM2M_OBJ_REG_T *objs, INT16 obj_num, void *userData );
+
+/**
+ @brief Write a value to LWM2M Tamper uri
+
+ @param[in] value Integer value to be written
+
+*/
+void update_tamper_LWM2MObject( int value );
+
+
+
+/**
+ @brief Write a value to LWM2M Environmental uri
+
+ @param[in] _t Temperature to be written
+ @param[in] _p Pressure value to be written
+ @param[in] _rh Humidity value to be written
+ @param[in] _iaq Index Air Quality value to be written
+
+*/
+void update_environment_LWM2MObject( float _t, float _p, float _rh, INT16 _iaq );
+
+
+/**
+ @brief Write a value to LWM2M Rotation uri
+
+ @param[in] _w w parameter
+ @param[in] _x x component
+ @param[in] _y y component
+ @param[in] _z z component
+ @param[in] _acc accuracy
+
+*/
+void update_rotation_LWM2MObject( float _w, float _x, float _y, float _z, INT16 _acc );
+
+
+/**
+ @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
+
+*/
+int check_xml_file( const char *name );
+
+
+/**
+ @brief Copy XML file from /mod to /XML directory
+
+ @param[in] name Name of the file to be checked
+ @retval 0 if OK, other values error
+
+*/
+int copy_xml_file( const char *name );
+
+
+/**
+ @brief Retrun the LIGHT_CONTROL_OBJ_INSTANCE_S table
+
+ @param[in] name Name of the LIGHT_CONTROL_OBJ_INSTANCE_S object
+ @retval 1 if OK, -1 values error
+
+*/
+int getLightControlObjTable( LIGHT_CONTROL_OBJ_INSTANCE_S **lightObjs );
+
+
+/**
+ @brief Register the taskID called in to lwm2m_taskCB function
+
+ @param[in] name Task ID
+ @retval 1 if OK, -1 values error
+
+*/
+int lwm2m_ReadTaskRegister( INT32 taskID);
+
+/**
+ @brief Return the lwm2m handle
+*/
+M2MB_LWM2M_HANDLE getLwM2mHandle();
+
+/**
+ @brief Return the event lwm2m handle
+*/
+M2MB_OS_EV_HANDLE getEventHandle();
+
+
+/**
+ @brief Register a monitor on a resource by creating a URI object and passing it to m2mb_lwm2m_mon
+
+ @param[in] uri
+ @param[in] mon
+
+ @retval 1 if OK, -1 values error
+
+*/
+int registerMonitorResource(M2MB_LWM2M_OBJ_URI_T uri_mon, M2MB_LWM2M_MON_REQ_T mon);
+
+
+/**
+ @brief read an integer value from an uri
+
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[out] result pointer to the allocated variable that will be filled with the integer value
+
+ @retval M2MB_RESULT_E value
+
+*/
+M2MB_RESULT_E read_integer_from_uri(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 *result);
+
+/**
+ @brief save an integer value to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] integer value to be set
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 write_integer_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, INT32 value);
+
+/**
+ @brief set an opaque to an uri
+
+ @param[in] h lwm2m initialized handle ( can be retrieved with getEventHandle() )
+ @param[in] pUri pointer to the URI from which data will be read
+ @param[in] data pointer to opaque buffer
+ @param[in] datalen size of the opaque buffer
+
+ @retval 0 in case of success, a negative value in case o failure
+
+*/
+INT32 set_opaque_resource(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *pUri, UINT8 *data, UINT32 datalen);
+
+#endif /* SRC_LWM2M_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.c b/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.c
new file mode 100644
index 0000000..aac51e0
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.c
@@ -0,0 +1,292 @@
+
+/*=========================================================================*/
+/* Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. */
+/**
+ @file
+ i2c_bme680.c
+
+ @brief
+ The file contains i2c utilities for BME680 device
+
+ @details
+
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+/* Include files ================================================================================*/
+#include
+#include
+
+#include "m2mb_types.h"
+
+#include "m2mb_os_api.h"
+#include "m2mb_i2c.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "app_cfg.h"
+
+#ifndef BOSCH_BSEC
+#define BOSCH_BSEC 1
+#endif
+
+
+#if BOSCH_BSEC
+#include "bhy_uc_driver.h"
+#endif
+
+#include "i2c_bme680.h"
+
+#include "i2c.h"
+
+/* Local defines ================================================================================*/
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+static INT32 i2c_fd = -1;
+/* Local function prototypes ====================================================================*/
+/* Static functions =============================================================================*/
+/* Global functions =============================================================================*/
+
+#ifdef BRAVO_REV_B
+int8_t bme680_i2c_read( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len )
+{
+ AZX_LOG_TRACE( "bme680_i2c_read\r\n" );
+ AZX_LOG_TRACE( "bme680_i2c_read LEN = %d\r\n", len );
+ int8_t rc = bhy_soft_passthru_read( dev_id, reg_addr, data, len, 1 ); // increment reg
+
+ if( rc )
+ {
+ AZX_LOG_ERROR( "bme680_i2c_read ERROR %d\r\n", rc );
+ }
+ return rc;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t bme680_i2c_write( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len )
+{
+ AZX_LOG_TRACE( "bme680_i2c_write\r\n" );
+ AZX_LOG_TRACE( "bme680_i2c_write LEN = %d\r\n", len );
+ int8_t rc = bhy_soft_passthru_write( dev_id, reg_addr, data, len, 1 ); // increment reg
+
+ if( rc )
+ {
+ AZX_LOG_ERROR( "bme680_i2c_read ERROR %d\r\n", rc );
+ }
+
+ return rc;
+}
+#else
+
+int bme680_openI2C( uint8_t dev_id )
+{
+ INT32 res;
+ CHAR dev_ID[64];
+ M2MB_I2C_CFG_T config;
+ M2MB_OS_SEM_ATTR_HANDLE semAttrHandle;
+
+ if (NULL == I2C_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_init( &I2C_CSSemHandle, &semAttrHandle );
+ }
+
+ /**************
+ Configuring the IIC device.
+ **************/
+ AZX_LOG_INFO( "\r\nConfiguring the Bosch BME680 device...\r\n" );
+ //Create device name using device address in decimal base, left shifted by 1 bit
+ sprintf( dev_ID, "/dev/I2C-%d",
+ ( UINT16 ) dev_id << 1 ); //I2C API require an already left-shifted device address
+ AZX_LOG_INFO( "Opening channel %s\r\n", dev_ID );
+ i2c_fd = m2mb_i2c_open( dev_ID, 0 );
+
+ if( -1 == i2c_fd )
+ {
+ AZX_LOG_ERROR( "cannot open I2C channel!\r\n" );
+ return 1;
+ }
+
+ config.sclPin = I2C_SCL;
+ config.sdaPin = I2C_SDA;
+ config.registerId = 0x00; //dummy register
+ res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )&config );
+
+ if( res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot configure I2C channel\r\n" );
+ return 1;
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t bme680_i2c_write( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len )
+{
+ INT32 i2c_res;
+ M2MB_I2C_CFG_T config;
+
+ AZX_LOG_TRACE( "bme680_i2c_write\r\n" );
+ AZX_LOG_TRACE( "bme680_i2c_write LEN = %d\r\n", len );
+
+ if( i2c_fd == -1 )
+ {
+ i2c_res = bme680_openI2C(dev_id);
+ if(i2c_res != 0)
+ {
+ AZX_LOG_ERROR( "bme680_i2c_write ERROR %d\r\n", i2c_res );
+ return 1;
+ }
+ }
+
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_GET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot get I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ config.registerId = reg_addr;
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "cannot set I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ AZX_LOG_TRACE( "Configuring I2C Registers - Writing %d bytes into 0x%02X register...\r\n", len,
+ reg_addr );
+
+ m2mb_os_sem_get(I2C_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ i2c_res = m2mb_i2c_write( i2c_fd, data, len );
+ m2mb_os_sem_put(I2C_CSSemHandle);
+
+ if( i2c_res != len )
+ {
+ AZX_LOG_ERROR( "cannot write data! error: %d\r\n", i2c_res );
+ return 1;
+ }
+ else
+ {
+ AZX_LOG_TRACE( "Write: success\r\n" );
+ return 0;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t bme680_i2c_read_16( uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size,
+ M2MB_I2C_CFG_T *pConfig )
+{
+ ( void )addr;
+
+ for( int i = 0; size > 0; i++ )
+ {
+ pConfig->registerId = reg;
+ INT32 i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_SET_CFG, ( void * )pConfig );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "Cannot set I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ uint16_t tmpsize;
+
+ if( size >= 16 )
+ {
+ tmpsize = 16;
+ }
+ else
+ {
+ tmpsize = size;
+ }
+
+ i2c_res = m2mb_i2c_read( i2c_fd, p_buf, tmpsize ); //reading 16 bytes max at a time
+
+ if( i2c_res == tmpsize )
+ {
+ size = size - tmpsize;
+ reg = reg + tmpsize;
+ p_buf = p_buf + tmpsize;
+ AZX_LOG_TRACE( "Reading Success.\r\n" );
+ AZX_LOG_TRACE( "i2c->" );
+
+ for( int i = 1; i < i2c_res; i++ )
+ {
+ AZX_LOG_TRACE( " %02x", p_buf[i] );
+ }
+
+ AZX_LOG_TRACE( "\r\n" );
+ }
+ else
+ {
+ AZX_LOG_ERROR( "Reading FAIL for %d bytes on register 0x%02X! - Exit Value: %d.\r\n", size, reg,
+ i2c_res );
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+/*-----------------------------------------------------------------------------------------------*/
+int8_t bme680_i2c_read( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len )
+{
+
+ INT32 i2c_res;
+ M2MB_I2C_CFG_T config;
+
+ AZX_LOG_TRACE( "bme680_i2c_read\r\n" );
+ AZX_LOG_TRACE( "bme680_i2c_read LEN = %d\r\n", len );
+
+ if( i2c_fd == -1 )
+ {
+ i2c_res = bme680_openI2C(dev_id);
+ if(i2c_res != 0)
+ {
+ AZX_LOG_ERROR( "bme680_i2c_read ERROR %d\r\n", i2c_res );
+ return 1;
+ }
+ }
+
+
+ AZX_LOG_TRACE( "I2C read register..." );
+ i2c_res = m2mb_i2c_ioctl( i2c_fd, M2MB_I2C_IOCTL_GET_CFG, ( void * )&config );
+
+ if( i2c_res != 0 )
+ {
+ AZX_LOG_ERROR( "Cannot get I2C channel configuration\r\n" );
+ return 1;
+ }
+
+ m2mb_os_sem_get(I2C_CSSemHandle, M2MB_OS_WAIT_FOREVER);
+ if( reg_addr == 0 ) // if read FIFO double buffer
+ {
+ for( ; len > 50; )
+ {
+ i2c_res = bme680_i2c_read_16( dev_id, reg_addr, data, 50, &config );
+ len = len - 50;
+ data = data + 50;
+ }
+
+ i2c_res += bme680_i2c_read_16( dev_id, reg_addr, data, len, &config );
+ }
+ else
+ {
+ i2c_res = bme680_i2c_read_16( dev_id, reg_addr, data, len, &config );
+ }
+ m2mb_os_sem_put(I2C_CSSemHandle);
+ return i2c_res;
+}
+
+#endif
diff --git a/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.h b/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.h
new file mode 100644
index 0000000..5bac549
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/i2c_bme680.h
@@ -0,0 +1,57 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/**
+ @file
+ i2c_bme680.h
+
+ @brief
+ demo i2c utilities for BME680 device
+
+ @details
+
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author WhiteBeard
+ @author FabioPi
+
+ @date
+ 2020-02-15
+*/
+
+#ifndef SRC_I2C_BME680_H_
+#define SRC_I2C_BME680_H_
+
+
+/* Global declarations ==========================================================================*/
+/* Global typedefs ==============================================================================*/
+/* Global functions =============================================================================*/
+
+/**
+ @brief Read data from buffer using I2C
+
+ @param[in] dev_id Device address on I2C bus
+ @param[in] reg_addr Start register address
+ @param[in] data Pointer to buffer where data will be stored
+ @param[in] len Size of the data to be read
+ @return 1 on error, 0 if OK
+
+*/
+int8_t bme680_i2c_read( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len );
+
+/**
+ @brief Write data to buffer using I2C
+
+ @param[in] dev_id Device address on I2C bus
+ @param[in] reg_addr Start register address
+ @param[in] data Pointer to buffer with data to be read
+ @param[in] len Size of the data to be written
+ @return 1 on error, 0 if OK
+
+*/
+int8_t bme680_i2c_write( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len );
+
+
+#endif /* SRC_I2C_BME680_H_ */
diff --git a/Samples/BRAVO_Time_Series_Demo/src/sensors_demo.c b/Samples/BRAVO_Time_Series_Demo/src/sensors_demo.c
new file mode 100644
index 0000000..8aca1bd
--- /dev/null
+++ b/Samples/BRAVO_Time_Series_Demo/src/sensors_demo.c
@@ -0,0 +1,774 @@
+/*===============================================================================================*/
+/* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
+/*!
+ @file
+ sensors_demo.c
+
+ @brief
+
+ @details
+
+ @note
+ Dependencies:
+ m2mb_types.h
+
+ @author
+ FabioPi
+ @date
+ 01/12/2020
+ */
+
+/*=================================================================
+#Telit Extensions
+#
+#Copyright (C) 2019, Telit Communications S.p.A.
+#All rights reserved.
+#
+#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+#
+#Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+#
+#Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
+#the documentation and/or other materials provided with the distribution.
+#
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS``AS IS'' AND ANY EXPRESS OR IMPLIED
+#WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+#PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+#DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#POSSIBILITY OF SUCH DAMAGE.
+#
+==============================================================*/
+
+
+/* Include files ================================================================================*/
+
+#include
+#include
+#include
+#include
+#include
+
+#include "m2mb_types.h"
+#include "m2mb_os_api.h"
+#include "m2mb_fs_stdio.h"
+#include "m2mb_i2c.h"
+#include "m2mb_gpio.h"
+#include "m2mb_lwm2m.h"
+#include "m2mb_power.h"
+
+#include "m2mb_fs_posix.h"
+#include "m2mb_fs_errno.h"
+
+#include "azx_log.h"
+#include "azx_utils.h"
+#include "azx_tasks.h"
+
+#include "app_cfg.h"
+
+#ifndef BOSCH_BSEC
+#define BOSCH_BSEC 1
+#endif
+
+
+#if BOSCH_BSEC
+ #include "bsec_integration.h"
+ #include "bsec_serialized_configurations_iaq.h"
+
+ #include "bhy_support.h"
+ #include "bhy_uc_driver.h"
+ #include "bosch_pcb_7183_di03_bmi160_bmm150-7183_di03-2-1-11696_20180502.h"
+ #include "bme680.h"
+#endif
+
+#include "gpio.h"
+#include "i2c.h"
+#include "i2c_bme680.h"
+
+#include "lwm2m.h"
+
+
+#include "sensors_demo.h"
+
+
+/* Local defines ================================================================================*/
+/*
+ Bosch device
+ */
+
+
+/* Local typedefs ===============================================================================*/
+/* Local statics ================================================================================*/
+
+#if BOSCH_BSEC
+static uint32_t bhy_system_timestamp = 0;
+static uint8_t fifo[FIFO_SIZE];
+#endif
+
+static BSENS_ENV_T gENVIRON_data;
+static BSENS_TAMPER_T gTAMPER_data;
+static BSENS_3DVECT_T g3DVECT_data;
+
+
+/* Local function prototypes ====================================================================*/
+
+/*-----------------------------------------------------------------------------------------------*/
+
+#if BOSCH_BSEC
+/**
+ @brief This is the callback function used to acquire sensor data
+
+ @param[in] sensor_data
+ @param[in] sensor_id
+
+ */
+static void sensors_tamper_callback( bhy_data_generic_t *sensor_data, bhy_virtual_sensor_t sensor_id );
+
+static void sensors_callback_rotation_vector( bhy_data_generic_t *sensor_data,
+ bhy_virtual_sensor_t sensor_id );
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function is time stamp callback function that process data in fifo.
+
+ @param[in] new_timestamp
+ */
+static void timestamp_callback( bhy_data_scalar_u16_t *new_timestamp );
+/*-----------------------------------------------------------------------------------------------*/
+
+/**
+ @brief Capture the system time in microseconds
+
+ @return system_current_time current system timestamp in microseconds
+ */
+static int64_t get_timestamp_us( void );
+
+/**
+ @brief Handling of the ready outputs
+
+ @param[in] timestamp time in nanoseconds
+ @param[in] iaq IAQ signal
+ @param[in] iaq_accuracy accuracy of IAQ signal
+ @param[in] temperature temperature signal
+ @param[in] humidity humidity signal
+ @param[in] pressure pressure signal
+ @param[in] raw_temperature raw temperature signal
+ @param[in] raw_humidity raw humidity signal
+ @param[in] gas raw gas sensor signal
+ @param[in] bsec_status value returned by the bsec_do_steps() call
+
+ @return none
+ */
+static void bsec_output_ready( int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temperature,
+ float humidity,
+ float pressure, float raw_temperature, float raw_humidity, float gas,
+ bsec_library_return_t bsec_status,
+ float static_iaq, float co2_equivalent, float breath_voc_equivalent );
+
+
+/**
+ @brief Load previous library state from non-volatile memory
+
+ @param[in,out] state_buffer buffer to hold the loaded state string
+ @param[in] n_buffer size of the allocated state buffer
+
+ @return number of bytes copied to state_buffer
+ */
+static uint32_t state_load( uint8_t *state_buffer, uint32_t n_buffer );
+
+
+/**
+ @brief Save library state to non-volatile memory
+
+ @param[in] state_buffer buffer holding the state to be stored
+ @param[in] length length of the state string to be stored
+
+ @return none
+ */
+static void state_save( const uint8_t *state_buffer, uint32_t length );
+
+
+/**
+ @brief Load library config from non-volatile memory
+
+ @param[in,out] config_buffer buffer to hold the loaded state string
+ @param[in] n_buffer size of the allocated state buffer
+
+ @return number of bytes copied to config_buffer
+ */
+static uint32_t config_load( uint8_t *config_buffer, uint32_t n_buffer );
+
+
+static INT32 bsec_loop_taskCB(INT32 type, INT32 param1, INT32 param2);
+/*-----------------------------------------------------------------------------------------------*/
+
+
+/* Static functions =============================================================================*/
+
+static void sensors_tamper_callback( bhy_data_generic_t *sensor_data, bhy_virtual_sensor_t sensor_id )
+{
+ int16_t activity = sensor_data->data_scalar_s16.data;
+ float time_stamp = ( float )( bhy_system_timestamp ) / TICKS_IN_ONE_SECOND;
+
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ BHI_TAMPER_STATUS_E status = STATUS_INVALID;
+ switch( ( INT32 )sensor_id )
+ {
+ case VS_ID_ACTIVITY:
+ case VS_ID_ACTIVITY_WAKEUP:
+ AZX_LOG_INFO( "activity recognized %.2f\r\n", time_stamp );
+
+ if( activity & 0x1 ) // bit 0
+ {
+ AZX_LOG_INFO( "Still activity ended\r\n" );
+ status = STILL_ENDED;
+ gTAMPER_data.still_ended_count++;
+ }
+
+ if( activity & 0x2 ) // bit 1
+ {
+ AZX_LOG_INFO( "Walking activity ended\r\n" );
+ status = WALKING_ENDED;
+ }
+
+ if( activity & 0x4 ) // bit 2
+ {
+ AZX_LOG_INFO( "Running activity ended\r\n" );
+ status = RUNNING_ENDED;
+ }
+
+ if( activity & 0x8 ) // bit 3
+ {
+ AZX_LOG_INFO( "On Bicycle activity ended\r\n" );
+ status = BYCYCLE_ENDED;
+ }
+
+ if( activity & 0x10 ) // bit 4
+ {
+ AZX_LOG_INFO( "In Vehicle activity ended\r\n" );
+ status = VEHICLE_ENDED;
+ }
+
+ if( activity & 0x20 ) // bit 5
+ {
+ AZX_LOG_INFO( "Tilting activity ended\r\n" );
+ status = TILTING_ENDED;
+ }
+
+ if( activity & 0x100 ) // bit 8
+ {
+ AZX_LOG_INFO( "Still activity started\r\n" );
+ status = STILL_STARTED;
+ }
+
+ if( activity & 0x200 ) // bit 9
+ {
+ AZX_LOG_INFO( "Walking activity started\r\n" );
+ status = WALKING_STARTED;
+ }
+
+ if( activity & 0x400 ) // bit 10
+ {
+ AZX_LOG_INFO( "Running activity started\r\n" );
+ status = RUNNING_STARTED;
+ }
+
+ if( activity & 0x800 ) // bit 11
+ {
+ AZX_LOG_INFO( "On Bicycle activity started\r\n" );
+ status = BICYCLE_STARTED;
+ }
+
+ if( activity & 0x1000 ) // bit 12
+ {
+ AZX_LOG_INFO( "In Vehicle activity started\r\n" );
+ status = VEHICLE_STARTED;
+ }
+
+ if( activity & 0x2000 ) // bit 13
+ {
+ AZX_LOG_INFO( "Tilting activity started\r\n" );
+ status = TILTING_STARTED;
+ }
+ break;
+
+ default:
+ AZX_LOG_INFO( "unknown id = %d\r\n", sensor_id );
+ status = STATUS_INVALID;
+ break;
+ }
+
+ if(status != STATUS_INVALID)
+ {
+ gTAMPER_data.status = status;
+ gTAMPER_data.timestamp = time_stamp;
+
+ }
+
+ /* activity recognition is not time critical, so let's wait a little bit */
+ // int tamper_data = 1;
+ // updateLWM2MObject(_obj_tamper_uri, &tamper_data, sizeof(int));
+ // sensor_ar_timer = SENSOR_AR_TOUT;
+ azx_sleep_ms( 200 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+}
+
+
+static void sensors_callback_rotation_vector( bhy_data_generic_t *sensor_data,
+ bhy_virtual_sensor_t sensor_id )
+{
+ (void)sensor_id;
+ static int16_t old_w = 0;
+ static int16_t old_x = 0;
+ static int16_t old_y = 0;
+ static int16_t old_z = 0;
+
+ static int i = 0;
+ uint8_t is_new_value = 0;
+ is_new_value |= ( old_w != sensor_data->data_quaternion.w );
+ is_new_value |= ( old_x != sensor_data->data_quaternion.x );
+ is_new_value |= ( old_y != sensor_data->data_quaternion.y );
+ is_new_value |= ( old_z != sensor_data->data_quaternion.z );
+
+ /* change the data unit by dividing by 16384 */
+ float w = ( float )sensor_data->data_quaternion.w / 16384.0f;
+ float x = ( float )sensor_data->data_quaternion.x / 16384.0f;
+ float y = ( float )sensor_data->data_quaternion.y / 16384.0f;
+ float z = ( float )sensor_data->data_quaternion.z / 16384.0f;
+
+ /* emit message only if value is different from previous one and it is new */
+
+
+ if( ( i++ >= 50 ) && is_new_value )
+ {
+ i = 0;
+ AZX_LOG_INFO( "-------> w=%f, x=%f, y=%f, z=%f; acc=%d\r\n",
+ w, x, y, z, sensor_data->data_quaternion.estimated_accuracy );
+ g3DVECT_data.w = w;
+ g3DVECT_data.x = x;
+ g3DVECT_data.y = y;
+ g3DVECT_data.z = z;
+ g3DVECT_data.accuracy = sensor_data->data_quaternion.estimated_accuracy;
+
+ }
+
+ old_w = sensor_data->data_quaternion.w;
+ old_x = sensor_data->data_quaternion.x;
+ old_y = sensor_data->data_quaternion.y;
+ old_z = sensor_data->data_quaternion.z;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+static void timestamp_callback( bhy_data_scalar_u16_t *new_timestamp )
+{
+ //AZX_LOG_DEBUG("new timestamp for id %u: 0x%08X\r\n", new_timestamp->sensor_id, new_timestamp->data);
+ /* updates the system timestamp */
+ bhy_update_system_timestamp( new_timestamp, &bhy_system_timestamp );
+ //AZX_LOG_DEBUG("updated timestamp: %u\r\n", bhy_system_timestamp);
+}
+
+
+
+
+static int64_t get_timestamp_us( void )
+{
+ int64_t system_current_time = ( int64_t )m2mb_os_getSysTicks() * 10000L;
+ return system_current_time;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+static void bsec_output_ready( int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temperature,
+ float humidity,
+ float pressure, float raw_temperature, float raw_humidity, float gas,
+ bsec_library_return_t bsec_status,
+ float static_iaq, float co2_equivalent, float breath_voc_equivalent )
+{
+ ( void ) timestamp;
+ ( void ) iaq_accuracy;
+ ( void ) raw_temperature;
+ ( void ) raw_humidity;
+ ( void ) gas;
+ ( void ) bsec_status;
+ ( void ) static_iaq;
+ ( void ) co2_equivalent;
+ ( void ) breath_voc_equivalent;
+ /* =============
+ Please insert system specific code to further process or display the BSEC outputs
+ ================*/
+ static int demult = 0;
+
+ gENVIRON_data.temperature = temperature;
+ gENVIRON_data.humidity = humidity;
+ gENVIRON_data.pressure = pressure / 100;
+ gENVIRON_data.airQ = iaq;
+
+ // if( demult++ > 2 )
+ // {
+ // update_environment_LWM2MObject( temperature, pressure / 100., humidity, ( INT16 )iaq );
+ // demult = 0;
+ // AZX_LOG_INFO( "------>" );
+ // }
+
+ demult++;
+ if(demult >= 4)
+ {
+ AZX_LOG_INFO( "T %f H %f P %f IAQ %f\r\n", temperature, humidity, pressure / 100., iaq );
+ demult = 0;
+ }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+static uint32_t state_load( uint8_t *state_buffer, uint32_t n_buffer )
+{
+ ( void ) state_buffer;
+ ( void ) n_buffer;
+ // ...
+ // Load a previous library state from non-volatile memory, if available.
+ //
+ // Return zero if loading was unsuccessful or no state was available,
+ // otherwise return length of loaded state string.
+ // ...
+ return 0;
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+static void state_save( const uint8_t *state_buffer, uint32_t length )
+{
+ ( void ) state_buffer;
+ ( void ) length;
+ // ...
+ // Save the string some form of non-volatile memory, if possible.
+ // ...
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+static uint32_t config_load( uint8_t *config_buffer, uint32_t n_buffer )
+{
+ uint32_t ret = 0;
+ // ...
+ // Load a library config from non-volatile memory, if available.
+ //
+ // Return zero if loading was unsuccessful or no config was available,
+ // otherwise return length of loaded config string.
+ // ...
+ if( n_buffer < sizeof( bsec_config_iaq ) )
+ {
+ memcpy( config_buffer, bsec_config_iaq, n_buffer );
+ ret = n_buffer;
+ }
+ else
+ {
+ memcpy( config_buffer, bsec_config_iaq, sizeof( bsec_config_iaq ) );
+ ret = sizeof( bsec_config_iaq );
+ }
+
+ return ret;
+}
+
+
+
+static INT32 bsec_loop_taskCB(INT32 type, INT32 param1, INT32 param2)
+{
+ (void) type;
+ (void) param1;
+ (void) param2;
+ AZX_LOG_DEBUG("BSEC task started\r\n");
+ /* Call to endless loop function which reads and processes data based on sensor settings */
+ /* State is saved every 10.000 samples, which means every 10.000 * 3 secs = 500 minutes */
+ bsec_iot_loop( azx_sleep_ms, get_timestamp_us, bsec_output_ready, state_save, 10000 );
+ return 0;
+}
+
+
+
+#endif /*#if BOSCH_BSEC*/
+
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+
+int init_sensors( sensors_init_cb cb )
+{
+#if BOSCH_BSEC
+ /* BHY Variable*/
+ uint8_t *fifoptr = NULL;
+ uint8_t bytes_left_in_fifo = 0;
+ uint16_t bytes_remaining = 0;
+ uint16_t bytes_read = 0;
+
+ bhy_data_generic_t fifo_packet;
+ bhy_data_type_t packet_type;
+ BHY_RETURN_FUNCTION_TYPE result;
+
+
+ return_values_init ret;
+ INT32 bsecTaskId;
+
+ /* the remapping matrix for BHA or BHI here should be configured according to its placement on customer's PCB. */
+ /* for details, please check 'Application Notes Axes remapping of BHA250(B)/BHI160(B)' document. */
+ int8_t bhy_mapping_matrix_config[3 * 3] = {0, 1, 0, -1, 0, 0, 0, 0, 1};
+ /* the remapping matrix for Magnetometer should be configured according to its placement on customer's PCB. */
+ /* for details, please check 'Application Notes Axes remapping of BHA250(B)/BHI160(B)' document. */
+ int8_t mag_mapping_matrix_config[3 * 3] = {0, 1, 0, 1, 0, 0, 0, 0, -1};
+ /* the sic matrix should be calculated for customer platform by logging uncalibrated magnetometer data. */
+ /* the sic matrix here is only an example array (identity matrix). Customer should generate their own matrix. */
+ /* This affects magnetometer fusion performance. */
+ float sic_array[9] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
+ /* To get the customized version number in firmware, it is necessary to read Parameter Page 2, index 125 */
+ /* to get this information. This feature is only supported for customized firmware. To get this customized */
+ /* firmware, you need to contact your local FAE of Bosch Sensortec. */
+
+ //struct cus_version_t bhy_cus_version;
+
+ /* init the bhy chip */
+ if( bhy_driver_init( bhy_firmware_image ) )
+ {
+ AZX_LOG_CRITICAL( "Fail to init bhy\r\n" );
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR;
+ }
+
+ /* wait for the bhy trigger the interrupt pin go down and up again */
+ while( read_gpio() )
+ {
+ azx_sleep_ms( 10 );
+ }
+
+ while( !read_gpio() )
+ {
+ azx_sleep_ms( 10 );
+ }
+
+ /* To get the customized version number in firmware, it is necessary to read Parameter Page 2, index 125 */
+ /* to get this information. This feature is only supported for customized firmware. To get this customized */
+ /* firmware, you need to contact your local FAE of Bosch Sensortec. */
+ //bhy_read_parameter_page(BHY_PAGE_2, PAGE2_CUS_FIRMWARE_VERSION, (uint8_t*)&bhy_cus_version, sizeof(struct cus_version_t));
+ //DEBUG("cus version base:%d major:%d minor:%d\n", bhy_cus_version.base, bhy_cus_version.major, bhy_cus_version.minor);
+
+ /* enables the activity recognition and assigns the callback */
+ bhy_enable_virtual_sensor( VS_TYPE_ACTIVITY_RECOGNITION, VS_NON_WAKEUP, 1, 0, VS_FLUSH_NONE, 0, 0 );
+ bhy_install_sensor_callback( VS_TYPE_ACTIVITY_RECOGNITION, VS_NON_WAKEUP, sensors_tamper_callback );
+ bhy_install_timestamp_callback( VS_NON_WAKEUP, timestamp_callback );
+
+
+
+ /* The remapping matrix for BHI and Magmetometer should be configured here to make sure rotation vector is */
+ /* calculated in a correct coordinates system. */
+ bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_ACC, bhy_mapping_matrix_config );
+ bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_MAG, mag_mapping_matrix_config );
+ bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_GYRO, bhy_mapping_matrix_config );
+ /* This sic matrix setting affects magnetometer fusion performance. */
+ bhy_set_sic_matrix( sic_array );
+
+ /* install the callback function for parse fifo data */
+ if( bhy_install_sensor_callback( VS_TYPE_ROTATION_VECTOR, VS_NON_WAKEUP,
+ sensors_callback_rotation_vector ) )
+ {
+ AZX_LOG_ERROR( "Fail to install rotation sensor callback\r\n" );
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR;
+ }
+
+ /* enables the virtual sensor */
+ if( bhy_enable_virtual_sensor( VS_TYPE_ROTATION_VECTOR, VS_NON_WAKEUP, ROTATION_VECTOR_SAMPLE_RATE, 0,
+ VS_FLUSH_NONE, 0, 0 ) )
+ {
+ AZX_LOG_ERROR( "Fail to enable rotation sensor id=%d\r\n", VS_TYPE_ROTATION_VECTOR );
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR;
+ }
+
+
+ /*INIT BSEC for environmental*/
+ ret = bsec_iot_init( BSEC_SAMPLE_RATE_LP, 0.0f, bme680_i2c_write, bme680_i2c_read, azx_sleep_ms,
+ state_load, config_load );
+
+ if( ret.bme680_status )
+ {
+ /* Could not intialize BME680 */
+ AZX_LOG_CRITICAL( "Could not intialize BME680: %d\r\n", ret.bme680_status );
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR; // (int)ret.bme680_status;
+ }
+ else
+ {
+ if( ret.bsec_status )
+ {
+ /* Could not intialize BSEC library */
+ AZX_LOG_ERROR( "Could not intialize BSEC library\r\n" );
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR; // (int)ret.bsec_status;
+ }
+ }
+
+ bsecTaskId = azx_tasks_createTask((char *)"BSEC_LOOP", AZX_TASKS_STACK_XL, 5, AZX_TASKS_MBOX_S, bsec_loop_taskCB);
+ if(bsecTaskId <= 0)
+ {
+ AZX_LOG_CRITICAL("cannot create BSEC task!\r\n");
+ if(cb)
+ {
+ cb(BHY_ERROR, NULL);
+ }
+ return BHY_ERROR;
+ }
+
+
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 100 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+ azx_sleep_ms( 100 );
+ write_LED( M2MB_GPIO_HIGH_VALUE );
+ azx_sleep_ms( 100 );
+ write_LED( M2MB_GPIO_LOW_VALUE );
+ azx_sleep_ms( 100 );
+
+ AZX_LOG_INFO( "System is now monitoring activity for tampering and rotation changes, move the board to update data.\r\n" );
+
+ //START BSEC task
+ azx_tasks_sendMessageToTask(bsecTaskId, 0, 0, 0);
+
+ /*signal caller that init has been done*/
+
+ if(cb)
+ {
+ cb(BHY_SUCCESS, NULL);
+ }
+
+ /* continuously read and parse the fifo after the push of the button*/
+ while(1)
+ {
+ /* wait until the interrupt fires */
+ /* unless we already know there are bytes remaining in the fifo */
+
+ while( !read_gpio() && !bytes_remaining )
+ {
+ azx_sleep_ms( 10 );
+ }
+
+ bhy_read_fifo( fifo + bytes_left_in_fifo, FIFO_SIZE - bytes_left_in_fifo, &bytes_read,
+ &bytes_remaining );
+ bytes_read += bytes_left_in_fifo;
+ fifoptr = fifo;
+ packet_type = BHY_DATA_TYPE_PADDING;
+
+
+ do
+ {
+ /* this function will call callbacks that are registered */
+ result = bhy_parse_next_fifo_packet( &fifoptr, &bytes_read, &fifo_packet, &packet_type );
+
+ /* prints all the debug packets */
+ if( packet_type == BHY_DATA_TYPE_DEBUG )
+ {
+ bhy_print_debug_packet( &fifo_packet.data_debug, bhy_printf );
+ }
+
+ /* the logic here is that if doing a partial parsing of the fifo, then we should not parse */
+ /* the last 18 bytes (max length of a packet) so that we don't try to parse an incomplete */
+ /* packet */
+ }
+ while( ( result == BHY_SUCCESS ) && ( bytes_read > ( bytes_remaining ? MAX_PACKET_LENGTH : 0 ) ) );
+
+ bytes_left_in_fifo = 0;
+
+ if( bytes_remaining )
+ {
+ /* shifts the remaining bytes to the beginning of the buffer */
+ while( bytes_left_in_fifo < bytes_read )
+ {
+ fifo[bytes_left_in_fifo++] = *( fifoptr++ );
+ }
+ }
+
+
+ }
+
+ return BHY_SUCCESS;
+#else
+ (void) cb;
+ return 0;
+
+#endif /*#if BOSCH_BSEC*/
+}
+
+
+int read_sensor(BSENS_SENSOR_ID_E id, void **data)
+{
+
+ switch(id)
+ {
+ case BSENS_SENSOR_ENVIRONM_ID:
+ AZX_LOG_TRACE("asked to read Environment data.\r\n");
+ *data = &gENVIRON_data;
+ AZX_LOG_TRACE( "LAST DATA: t: %f, hum: %f, p: %f, airq: %d\r\n",
+ gENVIRON_data.temperature,
+ gENVIRON_data.humidity,
+ gENVIRON_data.pressure,
+ gENVIRON_data.airQ
+ );
+ break;
+ case BSENS_SENSOR_3D_VECT_ID:
+ AZX_LOG_TRACE("asked to read 3DVECT data.\r\n");
+
+ AZX_LOG_TRACE( "LAST DATA: x=%f, y=%f, z=%f, w=%f; acc=%d\r\n",
+ g3DVECT_data.x, g3DVECT_data.y, g3DVECT_data.z, g3DVECT_data.w,
+ g3DVECT_data.accuracy );
+ *data = &g3DVECT_data;
+ break;
+ case BSENS_SENSOR_TAMPER_ID:
+ AZX_LOG_TRACE("asked to read Tampering status data.\r\n");
+ AZX_LOG_TRACE( "LAST DATA: %d at %u\r\n",
+ gTAMPER_data.status, gTAMPER_data.timestamp );
+ *data = &gTAMPER_data;
+
+
+ break;
+ default:
+ break;
+ }
+#if BOSCH_BSEC
+ return BHY_SUCCESS;
+#else
+ return 0;
+
+#endif /*#if BOSCH_BSEC*/
+}
+
+
+/**
+ @brief This is the log function that bhy uses as extern.
+
+ @param[in] fmt string format
+ @param[in]
+
+ */
+void trace_log( const char *fmt, ... )
+{
+ char log_buffer[256];
+ va_list arg;
+ va_start( arg, fmt );
+ vsnprintf( log_buffer, sizeof( log_buffer ), fmt, arg );
+ va_end( arg );
+ AZX_LOG_INFO( "%s", log_buffer );
+}
+
+/* Global functions =============================================================================*/
+
diff --git a/Samples/README.md b/Samples/README.md
index dd55f0c..209f70c 100644
--- a/Samples/README.md
+++ b/Samples/README.md
@@ -4,7 +4,7 @@
-Package Version: **1.0.7**
+Package Version: **1.0.8**
Firmware Version: **30.10.XX9**
@@ -74,10 +74,10 @@ The applications code follow the structure below:
* `Makefile.in`: customization of the Make process
-##Applications
+## Applications
-### Bravo Environment demo
+### Bravo Multi Sensors demo
@@ -86,28 +86,30 @@ The applications code follow the structure below:
---
- Connect to LWM2M Portal
-- Retrieve environment information with BSEC library sensor
+- Retrieve environment information with BSEC library sensor, Tampering and 3D vector rotation with BHI library sensors
---
#### Prerequisites on the module
-This application requires the file **object_26251.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
+This application requires the files **object_26242.xml**, **object_26250.xml** and **object_26251.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
To load it, use
+`AT#M2MWRITE=/mod/object_26242.xml,1358`
+`AT#M2MWRITE=/mod/object_26250.xml,2249`
`AT#M2MWRITE=/mod/object_26251.xml,1971`
-And at prompt, send the file content in raw mode.
+And at each prompt, send the file content in raw mode.
#### Prerequisites on the OneEdge Portal
-This application requires the **object_26251.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
+This application requires the **object_26242.xml**, **object_26250.xml** and **object_26251.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
where could be for example `portal-dev.telit.com`. open the xml file in a notepad tool, select all the content and copy it. Then, in the object registry webpage, press "New Object" button on the right and paste the content of the xml file, then press Add button.
-Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_EnvironmentalDemo_thing_def.json` from the project root, then press `Import`.
+Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_MultiSensorsDemo_thing_def.json` from the project root, then press `Import`.
-Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_EnvironmentalDemo_device_profile.json`, then press `Import`.
+Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_MultiSensors_device_profile.json`, then press `Import`.
** External Libraries **
@@ -121,12 +123,69 @@ https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.
-Environment Demo application. Debug prints on **MAIN UART**
+MultiSensors Demo application. Debug prints on **MAIN UART**
+
+### Bravo LwM2M Time Series demo
+
+
+
+**Features**
+
+---
+
+- Connect to LWM2M Portal
+- Retrieve environment information with BSEC library sensor, Tampering and 3D vector rotation with BHI library sensors
+- Push data to OneEdge portal as time series using Opaque resources with dedicated objects
+
+---
+
+#### Prerequisites on the module
+
+This application requires the files **object_32001.xml** and **object_32002.xml** (provided) to be stored into module's `/XML/` folder, along with the application binary itself.
+
+To load them, use
+
+`AT#M2MWRITE=/XML/object_32001.xml,2272`
+`AT#M2MWRITE=/XML/object_32002.xml,2365`
+
+
+
+And at each prompt, send the file content in raw mode.
+
+#### Prerequisites on the OneEdge Portal
+
+Please refer to the [Time Series App Note](https://github.com/telit/oneedge-projects-resources/blob/main/use-cases/time-series/Docs/80654NT11932A_OneEdge_Use_Case_Time-series_r0.pdf)
+
+
+### Requirements
+
+**External Libraries**
+
+To build the application it is required to put `libalgobsec.ar` file into the project's BOSCH/BSEC folder. The library can be retrieved at the link
+https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.4.7.4 version archive, then extract the library `libalgobsec.a` from the ZIP file and rename as `libalgobsec.ar`. It can be found in the directory
+/BSEC_1.4.7.4_Generic_Release/algo/normal_version/bin/gcc/Cortex_A7/
+
+#### Simulated data
+To run the code on a generic ME910C1 device, it is possible to build the code disabling the Bosch related functionalities. To do so, please refer to [Makefile.in](Makefile.in) file and edit the BOSCH_BSEC variable as below.
+
+```
+BOSCH_BSEC = 0
+```
+This will disable all Bosch dependencies and build the app with a simplified logic, simulating sensors data.
+
+---
+
+
+
+MultiSensors Demo application. Debug prints on **MAIN UART**
-### Bravo LED demo
+
+
+
+### Bravo Tampering demo
@@ -135,36 +194,41 @@ Environment Demo application. Debug prints on **MAIN UART**
---
- Connect to LWM2M Portal
-- Register the instances for LEDs
-- React to value modification of object 3311 resource 5850 (On/Off) value from the OneEdge portal
-- Restore LEDs status at startup according to the LWM2M values
+- Retrieve movement information from BMI160 sensor
+- Update portal about current status (IDLE, TAMPER, WALKING... )
---
#### Prerequisites
-This application requires the file **object_3311.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
+This application requires the file **object_26242.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
To load it, use
-`AT#M2MWRITE=/mod/object_3311.xml,3734`
+`AT#M2MWRITE=/mod/object_26242.xml,1358`
And at prompt, send the file content in raw mode.
#### Prerequisites on the OneEdge Portal
-This application requires the **object_3311.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
+This application requires the **object_26242.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
where could be for example `portal-dev.telit.com`. open the xml file in a notepad tool, select all the content and copy it. Then, in the object registry webpage, press "New Object" button on the right and paste the content of the xml file, then press Add button.
+Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_TamperDemo_thing_def.json` from the project root, then press `Import`.
+
+Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_TamperDemo_device_profile.json`, then press `Import`.
+
+Lastly, from the Developer webpage, select **Triggers**, `Actions` menu on the right, `Import` , `Attach File` and provide `json/bravo_TamperDemo_triggers.json`, then press `Import`. Now open the trigger **bravo_TamperDemo_state_trigger** by pressing the View button (the eye icon on the left) and be sure to press the `play` button, and that the trigger status is 'started'.
+
---
-LED management through IPSO object 3311 Demo application. Debug prints on **MAIN UART**
+Tampering Demo application. Debug prints on **MAIN UART**
-### Bravo Multi Sensors demo
+### Bravo LED demo
@@ -173,49 +237,36 @@ LED management through IPSO object 3311 Demo application. Debug prints on **MAIN
---
- Connect to LWM2M Portal
-- Retrieve environment information with BSEC library sensor, Tampering and 3D vector rotation with BHI library sensors
+- Register the instances for LEDs
+- React to value modification of object 3311 resource 5850 (On/Off) value from the OneEdge portal
+- Restore LEDs status at startup according to the LWM2M values
---
-#### Prerequisites on the module
+#### Prerequisites
-This application requires the files **object_26242.xml**, **object_26250.xml** and **object_26251.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
+This application requires the file **object_3311.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
To load it, use
-`AT#M2MWRITE=/mod/object_26242.xml,1358`
-`AT#M2MWRITE=/mod/object_26250.xml,2249`
-`AT#M2MWRITE=/mod/object_26251.xml,1971`
+`AT#M2MWRITE=/mod/object_3311.xml,3734`
-And at each prompt, send the file content in raw mode.
+And at prompt, send the file content in raw mode.
#### Prerequisites on the OneEdge Portal
-This application requires the **object_26242.xml**, **object_26250.xml** and **object_26251.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
+This application requires the **object_3311.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
where could be for example `portal-dev.telit.com`. open the xml file in a notepad tool, select all the content and copy it. Then, in the object registry webpage, press "New Object" button on the right and paste the content of the xml file, then press Add button.
-Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_MultiSensorsDemo_thing_def.json` from the project root, then press `Import`.
-
-Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_MultiSensors_device_profile.json`, then press `Import`.
-
-
-** External Libraries **
-
-To build the application it is required to put `libalgobsec.ar` file into the project's BOSCH/BSEC folder. The library can be retrieved at the link
-https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.4.7.4 version archive, then extract the library `libalgobsec.a` from the ZIP file and rename as `libalgobsec.ar`. It can be found in the directory
-/BSEC_1.4.7.4_Generic_Release/algo/normal_version/bin/gcc/Cortex_A7/
-
-
---
-
-MultiSensors Demo application. Debug prints on **MAIN UART**
+LED management through IPSO object 3311 Demo application. Debug prints on **MAIN UART**
-### Bravo Rotation demo
+### Bravo Environment demo
@@ -224,40 +275,47 @@ MultiSensors Demo application. Debug prints on **MAIN UART**
---
- Connect to LWM2M Portal
-- Retrieve rotation information from BMI160 sensor
-- Update portal about current status (X,Y,Z,W and accuracy values)
+- Retrieve environment information with BSEC library sensor
---
-#### Prerequisites
+#### Prerequisites on the module
-This application requires the file **object_26250.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
+This application requires the file **object_26251.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
To load it, use
-`AT#M2MWRITE=/mod/object_26250.xml,2249`
+`AT#M2MWRITE=/mod/object_26251.xml,1971`
And at prompt, send the file content in raw mode.
#### Prerequisites on the OneEdge Portal
-This application requires the **object_26250.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
+This application requires the **object_26251.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
where could be for example `portal-dev.telit.com`. open the xml file in a notepad tool, select all the content and copy it. Then, in the object registry webpage, press "New Object" button on the right and paste the content of the xml file, then press Add button.
-Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_3D-RotationDemo_thing_def.json` from the project root, then press `Import`.
+Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_EnvironmentalDemo_thing_def.json` from the project root, then press `Import`.
-Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_3D-RotationDemo_device_profile.json`, then press `Import`.
+Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_EnvironmentalDemo_device_profile.json`, then press `Import`.
+
+
+**External Libraries**
+
+To build the application it is required to put `libalgobsec.ar` file into the project's BOSCH/BSEC folder. The library can be retrieved at the link
+https://www.bosch-sensortec.com/software-tools/software/bsec/ . Download BSEC 1.4.7.4 version archive, then extract the library `libalgobsec.a` from the ZIP file and rename as `libalgobsec.ar`. It can be found in the directory
+/BSEC_1.4.7.4_Generic_Release/algo/normal_version/bin/gcc/Cortex_A7/
---
-Rotation Demo application. Debug prints on **MAIN UART**
+Environment Demo application. Debug prints on **MAIN UART**
-### Bravo Tampering demo
+
+### Bravo Rotation demo
@@ -266,35 +324,34 @@ Rotation Demo application. Debug prints on **MAIN UART**
---
- Connect to LWM2M Portal
-- Retrieve movement information from BMI160 sensor
-- Update portal about current status (IDLE, TAMPER, WALKING... )
+- Retrieve rotation information from BMI160 sensor
+- Update portal about current status (X,Y,Z,W and accuracy values)
---
#### Prerequisites
-This application requires the file **object_26242.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
+This application requires the file **object_26250.xml** (provided) to be stored into module's `/mod/` folder, along with the application binary itself.
To load it, use
-`AT#M2MWRITE=/mod/object_26242.xml,1358`
+`AT#M2MWRITE=/mod/object_26250.xml,2249`
And at prompt, send the file content in raw mode.
#### Prerequisites on the OneEdge Portal
-This application requires the **object_26242.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
+This application requires the **object_26250.xml** content to be stored in your OneEdge organization object registry. The latter can be accessed from the link https:///lwm2m/object_registry
where could be for example `portal-dev.telit.com`. open the xml file in a notepad tool, select all the content and copy it. Then, in the object registry webpage, press "New Object" button on the right and paste the content of the xml file, then press Add button.
-Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_TamperDemo_thing_def.json` from the project root, then press `Import`.
+Now from Developer webpage, go in **Thing Definitions** page from the list on the left and press `Import` button on the right. Press `Attach File` and provide `json/bravo_3D-RotationDemo_thing_def.json` from the project root, then press `Import`.
-Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_TamperDemo_device_profile.json`, then press `Import`.
+Again from the Developer webpage, select **Device Profiles**, `Import` button, `Attach File` and provide `json/bravo_3D-RotationDemo_device_profile.json`, then press `Import`.
-Lastly, from the Developer webpage, select **Triggers**, `Actions` menu on the right, `Import` , `Attach File` and provide `json/bravo_TamperDemo_triggers.json`, then press `Import`. Now open the trigger **bravo_TamperDemo_state_trigger** by pressing the View button (the eye icon on the left) and be sure to press the `play` button, and that the trigger status is 'started'.
---
-Tampering Demo application. Debug prints on **MAIN UART**
+Rotation Demo application. Debug prints on **MAIN UART**