mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-16 08:56:51 +01:00
@@ -687,7 +687,7 @@ void LGwProxy::setAutoConnectMode(bool valid)
|
||||
_isAutoConnectMode = valid;
|
||||
}
|
||||
|
||||
void LGwProxy::setCleanSession(bool valid)
|
||||
void LGwProxy::setSessionMode(bool valid)
|
||||
{
|
||||
_cleanSession = valid;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void setQoSMinus1Mode(bool valid);
|
||||
void setPingReqMode(bool valid);
|
||||
void setAutoConnectMode(bool valid);
|
||||
void setCleanSession(bool valid);
|
||||
void setSessionMode(bool valid);
|
||||
void reconnect(void);
|
||||
int writeMsg(const uint8_t* msg);
|
||||
void setPingReqTimer(void);
|
||||
|
||||
@@ -185,9 +185,10 @@ void LMqttsnClient::subscribe(const char* topicName, TopicCallback onPublish, ui
|
||||
_subMgr.subscribe(topicName, onPublish, qos);
|
||||
}
|
||||
|
||||
void LMqttsnClient::subscribe(uint16_t topicId, TopicCallback onPublish, uint8_t qos)
|
||||
void LMqttsnClient::subscribePredefinedId(uint16_t topicId, TopicCallback onPublish,
|
||||
uint8_t qos)
|
||||
{
|
||||
_subMgr.subscribe(topicId, onPublish, qos);
|
||||
_subMgr.subscribePredefinedId(topicId, onPublish, qos);
|
||||
}
|
||||
|
||||
void LMqttsnClient::unsubscribe(const char* topicName)
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void publish(uint16_t topicId, Payload* payload, uint8_t qos, bool retain = false);
|
||||
void publish(uint16_t topicId, uint8_t* payload, uint16_t len, uint8_t qos, bool retain = false);
|
||||
void subscribe(const char* topicName, TopicCallback onPublish, uint8_t qos);
|
||||
void subscribe(uint16_t topicId, TopicCallback onPublish, uint8_t qos);
|
||||
void subscribePredefinedId(uint16_t topicId, TopicCallback onPublish, uint8_t qos);
|
||||
void unsubscribe(const char* topicName);
|
||||
void unsubscribe(const uint16_t topicId);
|
||||
void disconnect(uint16_t sleepInSecs);
|
||||
|
||||
@@ -90,6 +90,7 @@ typedef enum
|
||||
#define CONNECT(...) theClient->getGwProxy()->connect(__VA_ARGS__)
|
||||
#define PUBLISH(...) theClient->publish(__VA_ARGS__)
|
||||
#define SUBSCRIBE(...) theClient->subscribe(__VA_ARGS__)
|
||||
#define SUBSCRIBE_PREDEF(...) theClient->subscribePredefinedId(__VA_ARGS__)
|
||||
#define UNSUBSCRIBE(...) theClient->unsubscribe(__VA_ARGS__)
|
||||
#define DISCONNECT(...) theClient->disconnect(__VA_ARGS__)
|
||||
#define ONCONNECT() theClient->getSubscribeManager()->onConnect()
|
||||
@@ -110,7 +111,7 @@ typedef enum
|
||||
#define SetQoSMinus1Mode(...) theClient->getGwProxy()->setQoSMinus1Mode(__VA_ARGS__)
|
||||
#define SetAutoConnectMode(...) theClient->setAutoConnectMode(__VA_ARGS__)
|
||||
#define SetAutoPingReqMode(...) theClient->getGwProxy()->setPingReqMode(__VA_ARGS__)
|
||||
#define SetCleanSessionMode(...) theClient->getGwProxy()->setCleanSession(__VA_ARGS__)
|
||||
#define SetCleanSession(...) theClient->getGwProxy()->setSessionMode(__VA_ARGS__)
|
||||
#ifdef CLIENT_MODE
|
||||
#define DISPLAY(...)
|
||||
#define PROMPT(...)
|
||||
|
||||
@@ -67,7 +67,9 @@ void LSubscribeManager::onConnect(void)
|
||||
{
|
||||
if ( theOnPublishList[i].type == MQTTSN_TOPIC_TYPE_PREDEFINED)
|
||||
{
|
||||
subscribe(theOnPublishList[i].id, theOnPublishList[i].pubCallback, theOnPublishList[i].qos);
|
||||
subscribePredefinedId(theOnPublishList[i].id,
|
||||
theOnPublishList[i].pubCallback,
|
||||
theOnPublishList[i].qos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,7 +172,7 @@ void LSubscribeManager::subscribe(const char* topicName, TopicCallback onPublish
|
||||
send(elm);
|
||||
}
|
||||
|
||||
void LSubscribeManager::subscribe(uint16_t topicId, TopicCallback onPublish, uint8_t qos)
|
||||
void LSubscribeManager::subscribePredefinedId(uint16_t topicId, TopicCallback onPublish, uint8_t qos)
|
||||
{
|
||||
SubElement* elm = add(MQTTSN_TYPE_SUBSCRIBE, 0, MQTTSN_TOPIC_TYPE_PREDEFINED, topicId, qos, onPublish);
|
||||
send(elm);
|
||||
@@ -263,7 +265,9 @@ void LSubscribeManager::responce(const uint8_t* msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPLAY("\033[0m\033[0;31m UNSUBACK Invalid messageId. \033[0m\033[0;37m\n\n");
|
||||
DISPLAY(
|
||||
"\033[0m\033[0;31m UNSUBACK Invalid messageId=%04x. \033[0m\033[0;37m\n\n",
|
||||
msgId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
~LSubscribeManager();
|
||||
void onConnect(void);
|
||||
void subscribe(const char* topicName, TopicCallback onPublish, uint8_t qos);
|
||||
void subscribe(uint16_t topicId, TopicCallback onPublish, uint8_t qos);
|
||||
void subscribePredefinedId(uint16_t topicId, TopicCallback onPublish, uint8_t qos);
|
||||
void unsubscribe(const char* topicName);
|
||||
void unsubscribe(uint16_t topicId);
|
||||
void responce(const uint8_t* msg);
|
||||
|
||||
Reference in New Issue
Block a user