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.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/app/prototest/main.cc b/src/app/prototest/main.cc
index aebfaea..c1d8359 100644
--- a/src/app/prototest/main.cc
+++ b/src/app/prototest/main.cc
@@ -17,6 +17,9 @@
#include <pb_encode.h>
#include <pb_decode.h>
#endif
+#ifdef PROTOTEST_UBJSON
+#include "ubj.h"
+#endif
#ifdef PROTOTEST_XDR
#include "object/stdbuf.h"
#include "object/xdrstream.h"
@@ -149,6 +152,33 @@ void loop(void)
#endif
/*
+ * UBJSON
+ */
+
+#ifdef PROTOTEST_UBJSON
+
+ uint8_t buf[128];
+ for (unsigned int i = 0; i < 128; i++) {
+ buf[i] = 0;
+ }
+
+ ubjw_context_t* ctx = ubjw_open_memory(buf, buf + sizeof(buf));
+ ubjw_begin_array(ctx, UBJ_MIXED, 0);
+ ubjw_write_int16(ctx, ts);
+ ubjw_write_string(ctx, "Noot Noot");
+ ubjw_end(ctx);
+
+ kout << "ubjr_close_context: " << ubjw_close_context(ctx) << endl;
+
+ kout << "ubjr is " << hex;
+ for (unsigned int i = 0; i < 128; i++) {
+ kout << (uint8_t)buf[i];
+ }
+ kout << endl;
+
+#endif
+
+ /*
* Common
*/