Added missing #ifs
This commit is contained in:
parent
3e4ed82cbe
commit
1076f7673d
@ -24,6 +24,7 @@ void UdpArduino::Setup(int localPort, const char *remoteIpAddress,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UdpArduino::GetBroadcastAddress() {
|
void UdpArduino::GetBroadcastAddress() {
|
||||||
|
#if ARDUINO
|
||||||
IPAddress broadcastAddress = WiFi.localIP();
|
IPAddress broadcastAddress = WiFi.localIP();
|
||||||
broadcastAddress[3] = 255;
|
broadcastAddress[3] = 255;
|
||||||
String broadcastIpString = broadcastAddress.toString();
|
String broadcastIpString = broadcastAddress.toString();
|
||||||
@ -31,9 +32,11 @@ void UdpArduino::GetBroadcastAddress() {
|
|||||||
broadcastIpString.toCharArray(this->broadcastIpAddress,
|
broadcastIpString.toCharArray(this->broadcastIpAddress,
|
||||||
broadcastIpString.length() + 1);
|
broadcastIpString.length() + 1);
|
||||||
std::cout << "Broadcast address: " << broadcastIpAddress << "\n";
|
std::cout << "Broadcast address: " << broadcastIpAddress << "\n";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void UdpArduino::Receive() {
|
void UdpArduino::Receive() {
|
||||||
|
#if ARDUINO
|
||||||
int packetSize = udp.parsePacket();
|
int packetSize = udp.parsePacket();
|
||||||
while (packetSize > 0) {
|
while (packetSize > 0) {
|
||||||
udp.read(buffer, packetSize);
|
udp.read(buffer, packetSize);
|
||||||
@ -57,9 +60,11 @@ void UdpArduino::Receive() {
|
|||||||
ReceiveData(packetSize, remoteParticipant);
|
ReceiveData(packetSize, remoteParticipant);
|
||||||
packetSize = udp.parsePacket();
|
packetSize = udp.parsePacket();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UdpArduino::Send(IMessage *msg) {
|
bool UdpArduino::Send(IMessage *msg) {
|
||||||
|
#if ARDUINO
|
||||||
int bufferSize = msg->Serialize(this->buffer);
|
int bufferSize = msg->Serialize(this->buffer);
|
||||||
if (bufferSize <= 0)
|
if (bufferSize <= 0)
|
||||||
return true;
|
return true;
|
||||||
@ -70,10 +75,12 @@ bool UdpArduino::Send(IMessage *msg) {
|
|||||||
|
|
||||||
// std::cout << "Sent to " << this->remoteIpAddress << ":"
|
// std::cout << "Sent to " << this->remoteIpAddress << ":"
|
||||||
// << this->remotePort << "\n";
|
// << this->remotePort << "\n";
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UdpArduino::Publish(IMessage *msg) {
|
bool UdpArduino::Publish(IMessage *msg) {
|
||||||
|
#ifdef ARDUINO
|
||||||
int bufferSize = msg->Serialize(this->buffer);
|
int bufferSize = msg->Serialize(this->buffer);
|
||||||
if (bufferSize <= 0)
|
if (bufferSize <= 0)
|
||||||
return true;
|
return true;
|
||||||
@ -84,6 +91,7 @@ bool UdpArduino::Publish(IMessage *msg) {
|
|||||||
|
|
||||||
// std::cout << "Publish to " << this->broadcastIpAddress << ":"
|
// std::cout << "Publish to " << this->broadcastIpAddress << ":"
|
||||||
// << this->remotePort << "\n";
|
// << this->remotePort << "\n";
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user