mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 07:26:52 +01:00
Update: change xbee class method name to same as class udp
Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
@@ -14,15 +14,17 @@
|
||||
* Tomoaki Yamaguchi - initial API and implementation
|
||||
**************************************************************************************/
|
||||
|
||||
#include "SensorNetwork.h"
|
||||
#include "MQTTSNGWProcess.h"
|
||||
#include "Threading.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SensorNetwork.h"
|
||||
#include "MQTTSNGWProcess.h"
|
||||
#include "Threading.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace MQTTSNGW;
|
||||
@@ -32,8 +34,8 @@ using namespace MQTTSNGW;
|
||||
============================================*/
|
||||
SensorNetAddress::SensorNetAddress()
|
||||
{
|
||||
memset(_address64, 0, sizeof(_address64));
|
||||
memset(_address16, 0, sizeof(_address16));
|
||||
memset(_address64, 0, 8);
|
||||
memset(_address16, 0, 2);
|
||||
}
|
||||
|
||||
SensorNetAddress::~SensorNetAddress()
|
||||
@@ -110,19 +112,24 @@ int SensorNetwork::initialize(void)
|
||||
char param[MQTTSNGW_PARAM_MAX];
|
||||
uint16_t baudrate = 9600;
|
||||
|
||||
if (theProcess->getParam("Baudrate", param) == 0)
|
||||
if (theProcess->getParam("XBee Baudrate", param) == 0)
|
||||
{
|
||||
baudrate = (uint16_t)atoi(param);
|
||||
}
|
||||
_description = "Baudrate ";
|
||||
sprintf(param ,"%d", baudrate);
|
||||
_description += param;
|
||||
|
||||
theProcess->getParam("SerialDevice", param);
|
||||
_description = "SerialDevice ";
|
||||
_description += param;
|
||||
|
||||
return XBee::open(param, baudrate);
|
||||
}
|
||||
|
||||
const char* SensorNetwork::getType(void)
|
||||
const char* SensorNetwork::getDescription(void)
|
||||
{
|
||||
return "XBee";
|
||||
return _description.c_str();
|
||||
}
|
||||
|
||||
/*===========================================
|
||||
|
||||
@@ -124,8 +124,7 @@ public:
|
||||
int broadcast(const uint8_t* payload, uint16_t payloadLength);
|
||||
int read(uint8_t* buf, uint16_t bufLen);
|
||||
int initialize(void);
|
||||
const char* getType(void);
|
||||
|
||||
const char* getDescription(void);
|
||||
SensorNetAddress* getSenderAddress(void)
|
||||
{
|
||||
return &_clientAddr;
|
||||
@@ -134,6 +133,7 @@ public:
|
||||
|
||||
private:
|
||||
SensorNetAddress _clientAddr; // Sender's address. not gateway's one.
|
||||
string _description;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user