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 4:fcbd652bbb7a, committed 2017-01-25
- Comitter:
- AmbientData
- Date:
- Wed Jan 25 12:28:14 2017 +0000
- Parent:
- 3:a724fe60de46
- Commit message:
- send()?????
Changed in this revision
Ambient.cpp | Show annotated file Show diff for this revision Revisions of this file |
Ambient.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Ambient.cpp Mon Jun 13 12:03:41 2016 +0000 +++ b/Ambient.cpp Wed Jan 25 12:28:14 2017 +0000 @@ -1,7 +1,7 @@ #include "Ambient.h" #define AMBIENT_DEBUG 0 -#define SimpleIoTBoard 1 +#define SimpleIoTBoard 0 #if AMBIENT_DEBUG #if SimpleIoTBoard @@ -73,6 +73,20 @@ } bool +Ambient::set(int field, int data) { + char buf[12]; + snprintf(buf, sizeof(buf), "%d", data); + return (set(field, buf)); +} + +bool +Ambient::set(int field, double data) { + char buf[12]; + snprintf(buf, sizeof(buf), "%f", data); + return (set(field, buf)); +} + +bool Ambient::clear(int field) { --field; if (field < 0 || field >= AMBIENT_NUM_PARAMS) {
--- a/Ambient.h Mon Jun 13 12:03:41 2016 +0000 +++ b/Ambient.h Wed Jan 25 12:28:14 2017 +0000 @@ -75,6 +75,7 @@ * false on failure */ bool init(unsigned int channelId, const char * writeKey, TCPSocketConnection * s, int dev = 0); + /** Set data on field-th field of payload. * @param field index of payload (1 to 8) * @param data data @@ -83,6 +84,25 @@ * false on failure */ bool set(int field, char * data); + + /** Set data on field-th field of payload. + * @param field index of payload (1 to 8) + * @param data data + * @returns + * true on success, + * false on failure + */ + bool set(int field, int data); + + /** Set data on field-th field of payload. + * @param field index of payload (1 to 8) + * @param data data + * @returns + * true on success, + * false on failure + */ + bool set(int field, double data); + /** Clear data on field-th field of payload. * @param field index of payload (1 to 8) * @returns