Ambient library. It provides "set" function to set data to a packet and "send" function to send the packet to the Ambient server. It also provides "bulk_send" function to send multiple data. (Japanese: IoT用のクラウドサービス「Ambient」のデーター送信ライブラリーです。Ambientはマイコンから送られたセンサーデーターを受信し、蓄積し、可視化(グラフ化)します。http://ambidata.io)

Dependents:   AmbientExampleSITB AmbientHeartRateMonitor AmbientHeartBeat AmbientExampleSITB_ws ... more

Revision:
3:a724fe60de46
Parent:
1:dcc2714b5bcb
Child:
4:fcbd652bbb7a
--- a/Ambient.h	Tue Jun 07 07:47:53 2016 +0000
+++ b/Ambient.h	Mon Jun 13 12:03:41 2016 +0000
@@ -8,6 +8,7 @@
 #define AMBIENT_MAX_RETRY 5
 #define AMBIENT_DATA_SIZE 24
 #define AMBIENT_NUM_PARAMS 11
+#define AMBIENT_TIMEOUT 3000 // milliseconds
 
 /** Ambient class
  * to send data to Ambient service.
@@ -71,7 +72,7 @@
      * @param s and pointer to socket
      * @returns
      *    true on success,
-     *    false on error
+     *    false on failure
      */
     bool init(unsigned int channelId, const char * writeKey, TCPSocketConnection * s, int dev = 0);
     /** Set data on field-th field of payload.
@@ -79,21 +80,40 @@
      * @param data data
      * @returns
      *    true on success,
-     *    false on error
+     *    false on failure
      */
     bool set(int field, char * data);
     /** Clear data on field-th field of payload.
      * @param field index of payload (1 to 8)
      * @returns
      *    true on success,
-     *    false on error
+     *    false on failure
      */
     bool clear(int field);
 
     /** Send data to Ambient
+     * @returns
+     *    true on success,
+     *    false on failure
      */
     bool send(void);
 
+    /** Send bulk data to Ambient
+     * @param buf pointer to the data buffer
+     * @returns
+     *    the number of written bytes on success (>=0)
+     *    -1 on failure
+     */
+    int bulk_send(char * buf);
+
+    /* Delete data stored in this channel
+     * @param userKey userKey
+     * @returns
+     *    true on success,
+     *    false on failure
+     */
+    bool delete_data(const char * userKey);
+
 private:
 
     TCPSocketConnection * s;
@@ -109,4 +129,4 @@
     } data[AMBIENT_NUM_PARAMS];
 };
 
-#endif // Ambient_h
\ No newline at end of file
+#endif // Ambient_h