#include <iostream>
#include "IoTDeviceAddress.h"
-#include "application.h"
using namespace std;
private:
//UDPSocket *socket;
UDP socket;
- uint8_t* strHostAddress;
+ IPAddress strHostAddress;
int iSrcPort;
int iDstPort;
bool didClose;
iDstPort = iotDevAdd->getDestinationPortNumber();
timeOut = 0;
- //socket = new UDPSocket(iSrcPort);
socket.begin(iSrcPort);
didClose = false;
}
}
- uint8_t* getHostAddress() {
+ IPAddress getHostAddress() {
return strHostAddress;
}
// Send data packet
void sendData(const char* buffer, int bufferLen) {
- //void sendData(const void* buffer, int bufferLen) {
+
unsigned short destinationPort = (unsigned short) iDstPort;
- IPAddress ipFromBytes = strHostAddress;
- socket.sendPacket(buffer, bufferLen, ipFromBytes, destinationPort);
- //socket->sendTo(buffer, bufferLen, strHostAddress, destinationPort);
+ IPAddress ipFromBytes(strHostAddress);
+ socket.sendPacket(buffer, bufferLen, strHostAddress, destinationPort);
}
// Receive data packet
int receiveData(char* buffer, int iMaxDataLength) {
- //int receiveData(void* buffer, int iMaxDataLength) {
- //unsigned short destinationPort = (unsigned short) iDstPort;
+
return socket.receivePacket(buffer, iMaxDataLength);
- //return socket->recvFrom(buffer, iMaxDataLength, strHostAddress, destinationPort);
}
};
#endif