From 917a7f7754e47567bf9102b6c26b6649ae6b28dd Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Fri, 10 Feb 2017 06:33:38 -0500 Subject: add initial ootx decoder --- tools/ootx_decode/ootx_decode.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tools/ootx_decode/ootx_decode.c (limited to 'tools/ootx_decode/ootx_decode.c') diff --git a/tools/ootx_decode/ootx_decode.c b/tools/ootx_decode/ootx_decode.c new file mode 100644 index 0000000..803b39e --- /dev/null +++ b/tools/ootx_decode/ootx_decode.c @@ -0,0 +1,50 @@ +// (C) 2016 Joshua Allen, MIT/x11 License. +// +//All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses. + +/* ootx data decoder test*/ + +#include +#include +#include +#include +#include + +#include "ootx_decoder.h" + +//char* fmt_str = "L Y HMD %d 5 1 206230 %d\n"; +//extern std::istream cin; + +void my_test(ootx_packet* packet) { + packet->data[packet->length] = 0; + printf("%d %s 0x%X\n", packet->length, packet->data, packet->crc32); +} + +int main(int argc, char* argv[]) +{ + ootx_init_buffer(); + ootx_packet_clbk = my_test; + + char* line = NULL; + size_t line_len = 0; + char trash[100] = ""; + uint32_t ticks = 0x00; + + while (getline(&line,&line_len,stdin)>0) { +// printf("%s\n", line); + sscanf(line,"%s %s %s %s %s %s %s %d", + trash, + trash, + trash, + trash, + trash, + trash, + trash, + &ticks); +// printf("%d\n", ticks); + + ootx_process_bit(ticks); + } + + return 0; +} \ No newline at end of file -- cgit v1.2.3