UDP comms to ROV
Diff: RovComms.h
- Revision:
- 1:f51739cada16
- Parent:
- 0:4a75d653c18c
--- a/RovComms.h Fri Jan 13 20:24:19 2012 +0000 +++ b/RovComms.h Mon Jan 16 17:17:58 2012 +0000 @@ -2,11 +2,12 @@ */ #ifndef ROVCOMMS_H #define ROVCOMMS_H -#include "EthernetNetIf.h" -#include <TCPSocket.h> #include "mbed.h" #include "msg.h" +#include "EthernetNetIf.h" +#include "UDPSocket.h" + #define STATIC_IP_ADDR #define MAX_BUFFER_SIZE 10 // max chars in the data stream @@ -29,16 +30,13 @@ { public: RovComms(int addr); - void InitRx(int addr); - void InitTx(int addr); + void InitUDP(int addr); - void CloseSocket(TCPSocket *s, int *state); + void CloseSocket(UDPSocket *s, int *state); void CallbackFn( void (*function)(void) ) { _callback.attach(function); } - void onTxTCPSocketEvent(TCPSocketEvent e); - void onRxTCPSocketEvent(TCPSocketEvent e); - void onConnectedTCPSocketEvent(TCPSocketEvent e); + void onUDPSocketEvent(UDPSocketEvent e); void Transmit(int pktType); char *Receive(void); @@ -62,8 +60,7 @@ private: EthernetNetIf *eth; - TCPSocket *RxSock; - TCPSocket *TxSock; + UDPSocket *UdpSkt; IpAddr rovAddr; Host server;