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