nova verzija tcp+udp->serial com

Revision:
15:4535e7ed4585
Parent:
14:ff1df10bcd65
diff -r ff1df10bcd65 -r 4535e7ed4585 Udp.cpp
--- a/Udp.cpp	Sun May 03 01:09:59 2020 +0200
+++ b/Udp.cpp	Sun May 03 01:35:52 2020 +0200
@@ -23,16 +23,23 @@
 extern C_HTMLparse * gpc_html;
 
 static UDPSocket *gp_udpSocket[NO_UDP] = {NULL};
+static int myUdpPort = 11000;
 static Thread *gp_udpRxThread[NO_UDP] = {NULL};
 
 /************* inicijalizacija parametara  **********************/
 
 void init_udp_param( void )
 {
+    
+    if( test_num(gpc_html->get_myUdpPort( )))  myUdpPort = atoi( gpc_html->get_myUdpPort( ));
+    printf( " myUdpPort = %d\n\r", myUdpPort);
+
     for( int i=1; i<= NO_UDP; i++)
     {
       const char *sp, *sip=gpc_html->get_UdpIP(i);
       
+
+      // ovo je fake, zbog testiranja, i treba da bude izbaceno na kraju
       if( i < 5 ) sp = gpc_html->get_UdpPort(i);
       else 
       {     
@@ -40,10 +47,7 @@
             sip=gpc_html->get_UdpIP(4);
       }
       
-       printf( " i = %d, port = %s, ip = %s\n\r", i, sp, sip );
-       fflush(stdout); 
-       
-        
+               
        
        ps_ear[i-1] = &(s_EthAddRemote[i-1]);
         
@@ -176,7 +180,7 @@
                
              if( (err = gp_udpSocket[i]->open( gp_eth ))  != NSAPI_ERROR_OK )  
                 { printf(" greska otvaranja UDP soketa %d  err=%d \n\r", i, err);  }
-             gp_udpSocket[i]->bind(ps_ear[0]->port);
+             gp_udpSocket[i]->bind(/* ps_ear[0]->port*/ myUdpPort);
              gp_udpSocket[i]->set_timeout(1000);
 
                  gp_udpRxThread[i] = new Thread( &i, udpRx_fun );