Merge pull request #130 from eclipse/develop

Install the gateway into any directories. #124
This commit is contained in:
Tomoaki Yamaguchi
2018-08-18 12:23:19 +09:00
committed by GitHub
11 changed files with 37 additions and 16 deletions

View File

@@ -116,6 +116,7 @@ typedef struct
unsigned char version; /**< MQTT version number */
} Connect;
#define MQTTPacket_Connect_Initializer {{0}, 0, nullptr, nullptr, nullptr, nullptr, 0, 0}
#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 }
#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \
MQTTPacket_willOptions_initializer, {NULL, {0, NULL}}, {NULL, {0, NULL}} }
@@ -173,6 +174,7 @@ typedef struct
int payloadlen; /**< payload length */
} Publish;
#define MQTTPacket_Publish_Initializer {{0}, nullptr, 0, 0, nullptr, 0}
/**
* Data for one of the ack packets.

View File

@@ -104,7 +104,7 @@ void BrokerRecvTask::run(void)
{
client = _gateway->getClientList()->getClient(0);
while (client > 0)
while ( client )
{
_light->blueLight(false);
if (client->getNetwork()->isValid())

View File

@@ -44,7 +44,7 @@ Client::Client(bool secure)
_clientId = nullptr;
_willTopic = nullptr;
_willMsg = nullptr;
_connectData = {0, 0, 0, 0, 0, 0, 0};
_connectData = MQTTPacket_Connect_Initializer;
_network = new Network(secure);
_secureNetwork = secure;
_sensorNetype = true;

View File

@@ -39,7 +39,6 @@ public:
private:
void sendStoredPublish(Client* client);
char _pbuf[MQTTSNGW_MAX_PACKET_SIZE * 3];
Gateway* _gateway;
};

View File

@@ -44,7 +44,7 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, MQTTSNPacket*
uint8_t* payload;
MQTTSN_topicid topicid;
int payloadlen;
Publish pub = {0, 0, 0, 0, 0, 0};
Publish pub = MQTTPacket_Publish_Initializer;
char shortTopic[2];

View File

@@ -443,7 +443,7 @@ TopicIdMapElement* TopicIdMap::add(uint16_t msgId, uint16_t topicId, MQTTSN_topi
{
return 0;
}
if ( getElement(msgId) > 0 )
if ( getElement(msgId) )
{
erase(msgId);
}

View File

@@ -191,11 +191,6 @@ void Gateway::initialize(int argc, char** argv)
_params.keepAlive = atoi(param);
}
if (_params.keepAlive > 65536)
{
throw Exception("Gateway::initialize: KeepAliveTime is grater than 65536 Secs");
}
if (getParam("LoginID", param) == 0)
{
_params.loginId = strdup(param);