Matteo Terruzzi / RefRX
Revision:
0:ac535bde6cd9
Child:
1:03883ad3f749
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RefRX.h	Fri Jul 19 03:26:27 2013 +0000
@@ -0,0 +1,45 @@
+#ifndef _REFRX_H_
+#define _REFRX_H_
+
+#include "mbed.h"
+#include "rtos.h"
+#include "EthernetInterface.h"
+ 
+#include "NetworkAPI/buffer.hpp"
+#include "NetworkAPI/ip/address.hpp"
+#include "NetworkAPI/udp/socket.hpp"
+
+#include "SharedObject.h"
+
+/** RefRX class used to receive pilot references with ethernet transmissions.
+ *  Receive on internally managed UDP socket and controls the transmission
+ *  with a TCP socket.
+ */
+class RefRX{
+
+    static SharedObject<uint32_t>* _ref1_ptr;
+    static SharedObject<uint32_t>* _ref2_ptr;
+    static SharedObject<uint32_t>* _ref3_ptr;
+    static SharedObject<uint32_t>* _ref4_ptr;
+    
+    static unsigned short port;
+    
+    static Thread _RX_thread;
+    static void _RX_thread_cycle (void const *args);
+    
+  public:
+  
+    /** Initialization procedure.
+     *  @param listen_port
+     *  @param destination_control_port remote port for the transmission control.
+     *  @param ref1 pilot references to be overwritten.
+     */
+    static void init (const unsigned short listen_port,
+            const unsigned short destination_control_port,
+            SharedObject<uint32_t>* ref1,
+            SharedObject<uint32_t>* ref2,
+            SharedObject<uint32_t>* ref3,
+            SharedObject<uint32_t>* ref4 );
+};
+
+#endif
\ No newline at end of file