2015-05-08 23:40:36 +02:00
|
|
|
/*
|
|
|
|
* MqttClient.h
|
|
|
|
*
|
|
|
|
* Created on: 08.05.2015
|
|
|
|
* Author: wn
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MQTTCLIENT_H_
|
|
|
|
#define MQTTCLIENT_H_
|
|
|
|
|
|
|
|
#include <Ethernet.h>
|
|
|
|
#include <PubSubClient.h>
|
|
|
|
#include "mBusDialog.h"
|
2015-05-09 16:31:49 +02:00
|
|
|
#include <Metro.h>
|
2015-05-08 23:40:36 +02:00
|
|
|
|
|
|
|
|
2015-05-09 16:31:49 +02:00
|
|
|
#define NUM_OF_DEVICES 10
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t address;
|
|
|
|
uint16_t queryPeriod;
|
|
|
|
uint16_t timer;
|
|
|
|
} mbusDevTuple_t;
|
2015-05-08 23:40:36 +02:00
|
|
|
|
|
|
|
class MqttClient : public ResponseCallback {
|
|
|
|
public:
|
|
|
|
MqttClient(RequestSender *meterBusMaster);
|
|
|
|
void begin();
|
|
|
|
void exec();
|
|
|
|
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength);
|
|
|
|
virtual void sendError(uint8_t code);
|
|
|
|
private:
|
|
|
|
EthernetClient m_client;
|
|
|
|
RequestSender *m_meterBusMaster;
|
2015-05-09 00:08:54 +02:00
|
|
|
PubSubClient m_mqttClient;
|
2015-05-08 23:40:36 +02:00
|
|
|
uint8_t m_disconnectState;
|
|
|
|
uint32_t m_disconnectTime;
|
2015-05-09 16:31:49 +02:00
|
|
|
mbusDevTuple_t m_mbusDevTuple[NUM_OF_DEVICES];
|
2015-05-08 23:40:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* MQTTCLIENT_H_ */
|