First attempt at some form of autodiscovery of an mbed based device by periodically broadcasting our IP in a UDP packet.
Diff: BroadcastMessage.h
- Revision:
- 0:c1be031ca851
diff -r 000000000000 -r c1be031ca851 BroadcastMessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BroadcastMessage.h Fri Jun 18 09:09:57 2010 +0000 @@ -0,0 +1,31 @@ +#ifndef BROADCAST_MESSAGE_H +#define BROADCAST_MESSAGE_H + +#include "mbed.h" +#include "UDPSocket.h" + +/* + Class: AutoDiscoveryBroadcaster + Periodically sends out hostname + and IP address on UDP port 2010 +*/ +class BroadcastMessage { +public: + // Constructor: AutoDiscoveryBroadcaster + // Creates the UDP sockets + BroadcastMessage(); + // Destructor: ~AutoDiscoveryBroadcaster + // Deletes the UDP socket + ~BroadcastMessage(); + void init(); + // Function: getBytes + // Returns the message to transmit + char* getBytes(); + int getLength(); +private: + char buff[1024]; + int len; +}; + +#endif + \ No newline at end of file