summaryrefslogtreecommitdiff
path: root/src/app/prototest/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/prototest/main.cc')
-rw-r--r--src/app/prototest/main.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/app/prototest/main.cc b/src/app/prototest/main.cc
index c1d8359..2384930 100644
--- a/src/app/prototest/main.cc
+++ b/src/app/prototest/main.cc
@@ -28,6 +28,10 @@
#include <stdint.h>
+#ifdef PROTOTEST_INCLUDE_GLOBAL
+#include "prototest_global.cc.inc"
+#endif
+
#ifdef PROTOTEST_XDR
char buf[256];
#endif
@@ -50,6 +54,10 @@ void loop(void)
{
static uint16_t ts = 0;
+#ifdef PROTOTEST_INCLUDE_LOCAL
+#include "prototest_local.cc.inc"
+#endif
+
/*
* XDR
*/
@@ -99,6 +107,32 @@ void loop(void)
#endif
/*
+ * ModernJSON
+ */
+
+#ifdef PROTOTEST_MODERNJSON
+ nlohmann::json js1;
+ js1["sensor"] = "gps";
+ js1["time"] = ts;
+ js1["data"] = {48.756080, 2.302038};
+ kout << js1.dump() << endl;
+
+ nlohmann::json js2 = {
+ {"sensor", "gps"},
+ {"time", ts},
+ {"data", {48.756080, 2.302038} }
+ };
+ kout << js2.dump() << endl;
+
+ std::vector<std::uint8_t> v_cbor = nlohmann::json::to_cbor(js2);
+ kout << "CBOR vector is " << hex;
+ for (unsigned int i = 0; i < v_cbor.size(); i++) {
+ kout << v_cbor[i] << " ";
+ }
+ kout << endl;
+#endif
+
+ /*
* NanoPB
*/