From 2c1afc394913da7cb4823d72f3a11fbc43c9595e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 15 Oct 2018 15:34:49 +0200 Subject: prototest wip --- src/app/prototest/Makefile.inc | 2 +- src/app/prototest/main.cc | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/app/prototest') 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 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; -- cgit v1.2.3