Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
101:162c28286c29
Parent:
100:09a23fcd3bdf
Child:
102:98c7155e8bea
--- a/vz_protocol.h	Thu Feb 12 16:42:35 2015 +0000
+++ b/vz_protocol.h	Fri Feb 13 18:44:45 2015 +0000
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
+#include <time.h>
 #include "shared_variables.h" // for __RTP_HEADER_SIZE__ 
 #include "utils.h" // for xmemcpy
 #include "bits.h"
@@ -21,6 +22,12 @@
 
 #define MAX_EXT 5999
 extern int end;
+extern time_t current_time;
+extern UDPSocket clock_sock;
+extern Endpoint clock_server;
+extern Timer external_time;
+
+#define EXTERNAL_TIME_REQUEST_WAIT_SECONDS 300
 
 #define __START_PKG_COUNT__ 100 
 ///< Estabelece o inicio dos pacotes RTP, não utilizado atualmente
@@ -265,8 +272,22 @@
  *
  * 20141105101235
  */
-void __print_clock__( uint8_t * buffer );
+void print_clock( uint8_t * buffer );
 
 void init_ranges( void );
 
+#define init_clock() _init_clock()
+#define _init_clock(){ \
+  clock_server.set_address( "192.168.120.175" , 5678 ); \
+  clock_sock.set_blocking( false, 0 ); \
+  clock_sock.bind( 8975 ); \
+  external_time.start(); \
+}
+
+int request_clock_to_server( void );
+
+int check_clock( void );
+
+int update_clock( void );
+
 #endif
\ No newline at end of file