mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-03 00:18:24 +02:00
parent
0ff4368d8c
commit
e1c713fb00
3 changed files with 5 additions and 6 deletions
|
@ -163,7 +163,7 @@ void app::setup(uint32_t timeout) {
|
||||||
mqttPort = 1883;
|
mqttPort = 1883;
|
||||||
|
|
||||||
mMqtt.setup(mqttAddr, mqttTopic, mqttUser, mqttPwd, mqttDevName, mqttPort);
|
mMqtt.setup(mqttAddr, mqttTopic, mqttUser, mqttPwd, mqttDevName, mqttPort);
|
||||||
mMqtt.mClient->setCallback(std::bind(&app::cbMqtt, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
mMqtt.setCallback(std::bind(&app::cbMqtt, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
mMqttTicker = 0;
|
mMqttTicker = 0;
|
||||||
|
|
||||||
#ifdef __MQTT_TEST__
|
#ifdef __MQTT_TEST__
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 5
|
||||||
#define VERSION_PATCH 9
|
#define VERSION_PATCH 10
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
class mqtt {
|
class mqtt {
|
||||||
public:
|
public:
|
||||||
PubSubClient *mClient;
|
|
||||||
|
|
||||||
mqtt() {
|
mqtt() {
|
||||||
mClient = new PubSubClient(mEspClient);
|
mClient = new PubSubClient(mEspClient);
|
||||||
mAddressSet = false;
|
mAddressSet = false;
|
||||||
|
@ -42,8 +40,8 @@ class mqtt {
|
||||||
mClient->setBufferSize(MQTT_MAX_PACKET_SIZE);
|
mClient->setBufferSize(MQTT_MAX_PACKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCallback(void (*func)(const char* topic, byte* payload, unsigned int length)){
|
void setCallback(MQTT_CALLBACK_SIGNATURE){
|
||||||
mClient->setCallback(func);
|
mClient->setCallback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendMsg(const char *topic, const char *msg) {
|
void sendMsg(const char *topic, const char *msg) {
|
||||||
|
@ -131,6 +129,7 @@ class mqtt {
|
||||||
}
|
}
|
||||||
|
|
||||||
WiFiClient mEspClient;
|
WiFiClient mEspClient;
|
||||||
|
PubSubClient *mClient;
|
||||||
|
|
||||||
bool mAddressSet;
|
bool mAddressSet;
|
||||||
uint16_t mPort;
|
uint16_t mPort;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue