summaryrefslogtreecommitdiff
path: root/src/app/prototest
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/prototest')
-rw-r--r--src/app/prototest/Makefile.inc2
-rw-r--r--src/app/prototest/main.cc30
2 files changed, 31 insertions, 1 deletions
diff --git a/src/app/prototest/Makefile.inc b/src/app/prototest/Makefile.inc
index d3dad26..36cfb49 100644
--- a/src/app/prototest/Makefile.inc
+++ b/src/app/prototest/Makefile.inc
@@ -23,7 +23,7 @@ endif
ifeq (${prototest_ubjson}, 1)
COMMON_FLAGS += -DPROTOTEST_UBJSON
- CXX_TARGETS += src/lib/ubjson/ubjr.cc src/lib/ubjson/ubjw.cc
+ C_TARGETS += src/lib/ubjson/ubjr.c src/lib/ubjson/ubjw.c
INCLUDES += -Iinclude/lib/ubjson
endif
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
*/