VZTECH / Mbed 2 deprecated main_src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Files at this revision

API Documentation at this revision

Comitter:
Cola
Date:
Sat Sep 20 13:34:52 2014 +0000
Parent:
19:ab2088e0dec6
Child:
21:0bd688722e81
Commit message:
20-09-14;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
prompt.cpp Show annotated file Show diff for this revision Revisions of this file
sip.h Show annotated file Show diff for this revision Revisions of this file
utils.cpp Show annotated file Show diff for this revision Revisions of this file
vz_protocol.cpp Show annotated file Show diff for this revision Revisions of this file
vz_protocol.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Sep 20 11:27:47 2014 +0000
+++ b/main.cpp	Sat Sep 20 13:34:52 2014 +0000
@@ -33,6 +33,7 @@
     
     int eth_status = __init_eth__( &eth );
     
+    
     if( eth_status ){
         debug_msg("Sem conexao eth");    
     }
--- a/prompt.cpp	Sat Sep 20 11:27:47 2014 +0000
+++ b/prompt.cpp	Sat Sep 20 13:34:52 2014 +0000
@@ -5,7 +5,6 @@
 #include "parallelcpld.h"
 //#include "debug.h"
 
-
 uint8_t debug_alive = 1;
 
 #define PVERSION 1          // Sempre atualizar a versao do prompt
@@ -294,8 +293,8 @@
                 value = 0x00;
                 pc.printf("\n\rPkgs enviados\n\r");
             }
-            //__send_to_cb__( __build_cb_package__( 5002, 5002, __TEST__, data, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
-            //__send_to_cb__( __build_cb_package__( 5003, 5003, __TEST__, data, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
+            __send_to_cb__( __build_cb_package__( 5002, 5002, __TEST__, data, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
+            __send_to_cb__( __build_cb_package__( 5003, 5003, __TEST__, data, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
         }
           
           
--- a/sip.h	Sat Sep 20 11:27:47 2014 +0000
+++ b/sip.h	Sat Sep 20 13:34:52 2014 +0000
@@ -30,8 +30,13 @@
 
 
 //#ifdef debug_colinas
-#define __SEVER_IP__ "192.168.30.25"
-#define __SERVER_PORT__ 5060
+//#define __SEVER_IP__ "192.168.30.25"      // Colinas
+#define __SEVER_IP__ "192.168.120.120"
+
+
+//#define __SERVER_PORT__ 5060              // Colinas
+#define __SERVER_PORT__ 5075
+
 //#endif
 //#ifndef debug_colinas
 //#define __SEVER_IP__ "192.168.120.120"
--- a/utils.cpp	Sat Sep 20 11:27:47 2014 +0000
+++ b/utils.cpp	Sat Sep 20 13:34:52 2014 +0000
@@ -42,8 +42,8 @@
 }
 
 int __init_eth__( EthernetInterface * eth ){
-    //eth->init( __MY_IP__, "255.255.255.0", "192.168.120.1" );
-    eth->init( "192.168.2.200", "255.255.255.0", "192.168.2.254" );
+    eth->init( __MY_IP__, "255.255.255.0", "192.168.120.1" );     //Default
+    //eth->init( "192.168.2.200", "255.255.255.0", "192.168.2.254" );     //Colinas 1
     
 /*
 #ifdef debug_colinas
--- a/vz_protocol.cpp	Sat Sep 20 11:27:47 2014 +0000
+++ b/vz_protocol.cpp	Sat Sep 20 13:34:52 2014 +0000
@@ -2,6 +2,9 @@
     
 extern DigitalOut led2;
 extern DigitalOut led3;
+
+uint16_t pkg_ckserr = 0;
+uint16_t pkg_cksok = 0;
     
 uint8_t * __parse_cb_buffer__( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ){
     /**
@@ -38,9 +41,19 @@
     debug.sendTo( debug_server, debug_msg, strlen( debug_msg ) );
     debug.sendTo( debug_server, debug_msg, strlen( debug_msg ) );
     */
+    
+    pc.printf("\n\r PKG_CSK OK: %d", pkg_cksok);
+    pc.printf("\n\r PKG_CSK ERR: %d\n\r", pkg_ckserr); 
+    
     if( cc != __checksum__( cb_buffer, __CB_BUFFER_SIZE__ ) ){
+            /*pc.printf("\n\r CKS ERROR:  ");
+            for (int i=0; i< 300; i++ ){ pc.printf("%x ", cb_buffer[i]); }
+            pc.printf("\n\r");*/
+            pkg_ckserr++;
             return( NULL );
+
     }else{
+        pkg_cksok++;
         e_msb = cb_buffer[ 0 ];
         e_lsb = cb_buffer[ 1 ];
         *ext = e_msb << 8  | e_lsb;
@@ -53,6 +66,7 @@
 
         return( cb_buffer + __VZ_HEADER_OFFSET__ );    
     }
+
 }
 uint8_t * __build_cb_package__( int ext, int port, uint8_t type, char * cb_buffer, uint8_t seq_num, int length,  uint8_t * pkg ){
     debug_msg("");
--- a/vz_protocol.h	Sat Sep 20 11:27:47 2014 +0000
+++ b/vz_protocol.h	Sat Sep 20 13:34:52 2014 +0000
@@ -31,13 +31,16 @@
 #define __AUDIO__ 0x08
 #define __TELEMETRY__ 0x10
 #define __CB_BYE__ 0x20
-#define __SOMETHING_2__ 0x40
+#define __TEST__ 0x40
 #define __SOMETHING_3__ 0x80
 
 #define __DO_NOTHING__ 0x99
 
-//#define __MY_IP__ "192.168.120.169"
-#define __MY_IP__ "192.168.2.200"
+#define __MY_IP__ "192.168.120.169"
+//#define __MY_IP__ "192.168.2.200"
+
+extern uint16_t pkg_ckserr;
+extern uint16_t pkg_cksok;
 
 uint16_t __checksum__( uint8_t * buffer, size_t length );