mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 15:36:51 +01:00
@@ -735,6 +735,7 @@ uint16_t Topic::getTopicId(void)
|
|||||||
bool Topic::isMatch(string* topicName)
|
bool Topic::isMatch(string* topicName)
|
||||||
{
|
{
|
||||||
string::size_type tlen = _topicName->size();
|
string::size_type tlen = _topicName->size();
|
||||||
|
|
||||||
if (topicName->size() < tlen - 2)
|
if (topicName->size() < tlen - 2)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,6 +17,6 @@
|
|||||||
#ifndef MQTTSNGWVERSION_H_IN_
|
#ifndef MQTTSNGWVERSION_H_IN_
|
||||||
#define MQTTSNGWVERSION_H_IN_
|
#define MQTTSNGWVERSION_H_IN_
|
||||||
|
|
||||||
#define PAHO_GATEWAY_VERSION "1.0.0"
|
#define PAHO_GATEWAY_VERSION "1.0.1"
|
||||||
|
|
||||||
#endif /* MQTTSNGWVERSION_H_IN_ */
|
#endif /* MQTTSNGWVERSION_H_IN_ */
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include "SensorNetwork.h"
|
#include "SensorNetwork.h"
|
||||||
#include "MQTTSNGWProcess.h"
|
#include "MQTTSNGWProcess.h"
|
||||||
|
|
||||||
@@ -238,6 +241,10 @@ int XBee::recv(uint8_t* buf, uint16_t bufLen, SensorNetAddress* clientAddr)
|
|||||||
_sem.post();
|
_sem.post();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,15 +458,21 @@ bool SerialPort::send(unsigned char b)
|
|||||||
|
|
||||||
bool SerialPort::recv(unsigned char* buf)
|
bool SerialPort::recv(unsigned char* buf)
|
||||||
{
|
{
|
||||||
if (read(_fd, buf, 1) == 0)
|
struct timeval timeout;
|
||||||
{
|
fd_set rfds;
|
||||||
return false;
|
FD_ZERO(&rfds);
|
||||||
}
|
FD_SET(_fd, &rfds);
|
||||||
else
|
timeout.tv_sec = 0;
|
||||||
{
|
timeout.tv_usec = 500000; // 500ms
|
||||||
D_NWSTACK( " %02x",buf[0] );
|
if ( select(1, &rfds, 0, 0, &timeout) > 0 )
|
||||||
return true;
|
{
|
||||||
}
|
if (read(_fd, buf, 1) > 0)
|
||||||
|
{
|
||||||
|
D_NWSTACK( " %02x",buf[0] );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::flush(void)
|
void SerialPort::flush(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user