annotate include/UdpClient.h @ 125:850a4a9bd832 scope-refactoring

Added ifdefs and unified the code with udpioplugin ... the latter has not been tested (or committed). TODO: still it hangs after ctrl-c BeagleRT (auxiliary tasks do not terminate). TODO: sometimes you can hear dropouts in the transmission. Maybe it is due to pointer drifting. Rebooting BBB fixes/affects this issue.
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 22 Aug 2015 02:53:36 +0100
parents 3068421c0737
children da1c61aa97ea
rev   line source
andrewm@70 1 /*
andrewm@70 2 * udpClient.h
andrewm@70 3 *
andrewm@70 4 * Created on: 19 May 2015
andrewm@70 5 * Author: giulio moro
andrewm@70 6 */
andrewm@70 7
andrewm@70 8 #ifndef UDPCLIENT_H_
andrewm@70 9 #define UDPCLIENT_H_
andrewm@70 10
andrewm@70 11 #include <sys/types.h>
andrewm@70 12 #include <sys/socket.h>
andrewm@70 13 #include <netinet/in.h>
andrewm@70 14 #include <arpa/inet.h>
andrewm@70 15 #include <netdb.h>
andrewm@70 16 #include <stdio.h>
andrewm@70 17 #include <stdlib.h>
andrewm@70 18 #include <unistd.h>
andrewm@70 19 #include <string.h>
andrewm@70 20
andrewm@70 21 class UdpClient{
andrewm@70 22 private:
andrewm@70 23 int port;
andrewm@70 24 int enabled;
andrewm@70 25 int outSocket;
andrewm@70 26 bool isSetPort;
andrewm@70 27 bool isSetServer;
andrewm@70 28 struct sockaddr_in destinationServer;
andrewm@70 29 public:
andrewm@70 30 UdpClient();
andrewm@70 31 UdpClient(int aPort, const char* aServerName);
andrewm@70 32 ~UdpClient();
andrewm@70 33 void setPort(int aPort);
andrewm@70 34 void setServer(const char* aServerName);
andrewm@70 35 int send(void* message, int size);
andrewm@70 36 };
andrewm@70 37
andrewm@70 38
andrewm@70 39
andrewm@70 40 #endif /* UDPCLIENT_H_ */