【mbed OS5対応バージョン】データの保存、更新、取得ができるWebサービス「milkcocoa」に接続し、データのプッシュ、送信、取得ができるライブラリです。 https://mlkcca.com/
Dependents: mbed-os-example-wifi-milkcocoa MilkcocoaOsSample_Eth MilkcocoaOsSample_ESP8266 MilkcocoaOsSample_Eth_DigitalIn
Diff: Milkcocoa.h
- Revision:
- 6:1b5ec3a15d67
- Parent:
- 4:9cfd43d8de16
- Child:
- 8:e2f15b1b4f70
--- a/Milkcocoa.h Fri May 19 01:33:48 2017 +0000 +++ b/Milkcocoa.h Thu Jun 01 00:23:41 2017 +0000 @@ -7,6 +7,8 @@ #include "MClient.h" #include "rtos.h" +//#define __MILKCOCOA_THREAD + #define RECV_TIMEOUT 500 #define MILKCOCOA_SUBSCRIBERS 8 #define START_THREAD 1 @@ -49,9 +51,10 @@ bool send(const char *path, DataElement dataelement); bool send(const char *path, char *data); bool on(const char *path, const char *event, GeneralFunction cb); +#ifdef __MILKCOCOA_THREAD void setLoopCycle(int cycle); void start(); - +#endif private: char servername[64]; int16_t portnum; @@ -59,25 +62,28 @@ char username[32]; char password[32]; char app_id[32]; + char _message[256]; int16_t loop_cycle; MQTTInterface* ipstack; MClient *client; GeneralFunction _cb; MilkcocoaSubscriber *milkcocoaSubscribers[MILKCOCOA_SUBSCRIBERS]; + +#ifdef __MILKCOCOA_THREAD Thread cycleThread1; Thread cycleThread2; void cycle_Thread1(void); void cycle_Thread2(void); static void threadStarter1(void const *p); static void threadStarter2(void const *p); - +#endif typedef struct { char message[256]; char topic[80]; } milkcocoa_message_t; Mail<milkcocoa_message_t, 16> message_box; + }; - #endif