The KPN SenML library helps you create and parse senml documents in both json and cbor format. The library can be used for sending sensor data and receiving actuator commands.

Fork of kpn_senml by KPN IoT

Revision:
0:a9259748d982
diff -r 000000000000 -r a9259748d982 senml_JsonListener.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/senml_JsonListener.h	Sat May 19 17:35:20 2018 +0000
@@ -0,0 +1,72 @@
+/**The MIT License (MIT)
+
+Copyright (c) 2015 by Daniel Eichhorn
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+See more at http://blog.squix.ch and https://github.com/squix78/json-streaming-parser
+*/
+
+#ifndef SENMLJSONLISTENER
+#define SENMLJSONLISTENER
+
+#ifdef __MBED__
+    #include "mbed.h"
+    #include <string> 
+    using namespace std;
+    #define String string
+#else
+    #include <Arduino.h>
+#endif
+
+/**
+ * Internal helper class for parsing json data.
+ */
+class JsonListener {
+  private:
+
+  public:
+      
+    //virtual void startDocument() = 0;
+
+    virtual void key(String key) = 0;
+
+    virtual void value(String value) = 0;
+
+    //virtual void endArray() = 0;
+
+    //virtual void endObject() = 0;
+
+    //virtual void endDocument() = 0;
+
+    //virtual void startArray() = 0;
+
+    //virtual void startObject() = 0;
+ 
+};
+
+#endif
+
+
+
+
+
+
+
+