Add "TARGET_RZ_A1H"as target of using Ethernet IF.
Fork of Milkcocoa_EthernetIF by
Diff: Milkcocoa.h
- Revision:
- 1:4a634c06c5dc
- Parent:
- 0:23e533c4b1ec
--- a/Milkcocoa.h Tue Dec 15 09:56:32 2015 +0000 +++ b/Milkcocoa.h Fri Dec 18 04:30:59 2015 +0000 @@ -2,10 +2,12 @@ #define _MILKCOCOA_H_ #include "mbed.h" -#include "MQTTESP8266.h" +#include "MQTTmbed.h" #include "MQTTClient.h" +#include "MClient.h" #define RECV_TIMEOUT 500 +#define MILKCOCOA_SUBSCRIBERS 8 class DataElement { public: @@ -25,12 +27,20 @@ typedef void (*GeneralFunction) (MQTT::MessageData& elem); +class MilkcocoaSubscriber { + public: + GeneralFunction cb; + char topic[100]; + MilkcocoaSubscriber(GeneralFunction _cb); +}; + class Milkcocoa { public: - Milkcocoa(MQTTESP8266 *ipstack, const char *host, uint16_t port, const char *_app_id, const char *client_id); - Milkcocoa(MQTTESP8266 *ipstack, const char *host, uint16_t port, const char *_app_id, const char *client_id, char *_session); - static Milkcocoa* createWithApiKey(MQTTESP8266 *ipstack, const char *host, uint16_t port, const char *_app_id, const char *client_id, char *key, char *secret); +// Milkcocoa(const char *host, uint16_t port, const char *_app_id, const char *client_id); + Milkcocoa(MClient *_client, const char *host, uint16_t port, const char *_app_id, const char *client_id); + Milkcocoa(MClient *_client, const char *host, uint16_t port, const char *_app_id, const char *client_id, char *_session); + static Milkcocoa* createWithApiKey(MClient *_client, const char *host, uint16_t port, const char *_app_id, const char *client_id, char *key, char *secret); void connect(); void loop(); bool push(const char *path, DataElement dataelement); @@ -45,9 +55,9 @@ char password[32]; const char *app_id; - MQTTESP8266 *_ipstack; - MQTT::Client<MQTTESP8266, Countdown> client; + MClient *client; GeneralFunction _cb; + MilkcocoaSubscriber *milkcocoaSubscribers[MILKCOCOA_SUBSCRIBERS]; };