2015-06-01 00:38:33 +02:00
|
|
|
#ifndef _ADAFRUIT_MQTT_CC3000_H_
|
|
|
|
#define _ADAFRUIT_MQTT_CC3000_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include "Adafruit_MQTT.h"
|
|
|
|
#include "Adafruit_MQTT_CC3000.h"
|
|
|
|
#include <Adafruit_CC3000.h>
|
|
|
|
|
2015-06-03 00:33:03 +02:00
|
|
|
// delay in ms between calls of available()
|
|
|
|
#define MQTT_CC3000_INTERAVAILDELAY 10
|
|
|
|
|
|
|
|
|
2015-06-01 00:38:33 +02:00
|
|
|
class Adafruit_MQTT_CC3000 : public Adafruit_MQTT {
|
|
|
|
public:
|
2015-06-02 21:23:42 +02:00
|
|
|
Adafruit_MQTT_CC3000(Adafruit_CC3000 *cc3k, const char *server, uint16_t port, const char *cid, const char *user, const char *pass);
|
2015-06-01 00:38:33 +02:00
|
|
|
int8_t connect(void);
|
2015-06-03 00:33:03 +02:00
|
|
|
uint16_t readPacket(uint8_t *buffer, uint8_t maxlen, int16_t timeout, boolean checkForValidPubPacket = false);
|
2015-06-01 01:02:42 +02:00
|
|
|
int32_t close(void);
|
2015-06-01 00:38:33 +02:00
|
|
|
|
2015-06-02 21:23:42 +02:00
|
|
|
boolean publish(const char *topic, char *payload, uint8_t qos);
|
|
|
|
boolean ping(uint8_t time);
|
2015-06-01 05:19:13 +02:00
|
|
|
|
2015-06-03 00:33:03 +02:00
|
|
|
boolean subscribe(Adafruit_MQTT_Subscribe *sub);
|
|
|
|
|
|
|
|
Adafruit_MQTT_Subscribe *readSubscription(int16_t timeout=0);
|
|
|
|
|
2015-06-01 00:38:33 +02:00
|
|
|
private:
|
|
|
|
Adafruit_CC3000 *cc3000;
|
|
|
|
Adafruit_CC3000_Client mqttclient;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|