summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-15 15:34:49 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-15 15:34:49 +0200
commit2c1afc394913da7cb4823d72f3a11fbc43c9595e (patch)
tree20ec59ddb5e9cad0163e5a6312f88d527c391846
parent8402005b21f0b2debc4afd0eb1bcc2b7118948de (diff)
prototest wip
-rw-r--r--src/app/prototest/Makefile.inc2
-rw-r--r--src/app/prototest/main.cc16
2 files changed, 16 insertions, 2 deletions
diff --git a/src/app/prototest/Makefile.inc b/src/app/prototest/Makefile.inc
index 56410e0..ae7794e 100644
--- a/src/app/prototest/Makefile.inc
+++ b/src/app/prototest/Makefile.inc
@@ -1,2 +1,2 @@
loop ?= 1
-TARGETS += src/os/object/xdrstream.cc
+TARGETS += src/os/object/xdrstream.cc src/os/object/xdrinput.cc
diff --git a/src/app/prototest/main.cc b/src/app/prototest/main.cc
index c17b69d..05c3469 100644
--- a/src/app/prototest/main.cc
+++ b/src/app/prototest/main.cc
@@ -5,6 +5,7 @@
#include "lib/modernjson/json.h"
#include "object/stdbuf.h"
#include "object/xdrstream.h"
+#include "object/xdrinput.h"
char buf[256];
@@ -29,10 +30,11 @@ void loop(void)
kout << ",\"data\":[" << 48.756080 << "," << 2.302038 << "]}" << endl;
BufferOutput<XDRStream> foostream(buf);
+ XDRInput input(buf);
char test[] = "Obai World!";
- foostream << 123 << 0 << 12345678;
+ foostream << 123 << -2 << 123456 << 0 << 4294967296 << 0;
foostream.setNextArrayLen(3);
foostream << fixed << "Hai";
foostream.setNextArrayLen(sizeof(test));
@@ -45,6 +47,18 @@ void loop(void)
}
kout << endl;
+ kout << dec;
+ kout << "foostream = " << input.get_uint32() << " = " << 123;
+ kout << ", " << input.get_int32() << " = " << -2;
+ kout << ", " << input.get_uint32() << " = " << 123456;
+ kout << ", " << input.get_uint32();
+ kout << ", " << input.get_uint64();
+ kout << ", " << input.get_uint32();
+ kout << ", " << input.get_opaque(3);
+ uint32_t len = input.get_opaque_length();
+ kout << ", " << input.get_opaque(len);
+ kout << endl;
+
gpio.led_toggle(1);
#ifdef TIMER_S
kout << dec << uptime.get_s() << endl;