p1

Revision:
7:6a700c98b9b5
Parent:
5:ecaf089d1c8a
--- a/main.cpp	Mon Feb 24 17:14:44 2020 +0000
+++ b/main.cpp	Thu Jun 18 15:23:05 2020 +0000
@@ -48,6 +48,7 @@
     SocketAddress *sa;
     char *tx_msg;
     void (*fun_rec)(char*);
+    int response;
 };
 
 char crm_req[]= {'{','1','|','1','}'}; //"{1|1}";
@@ -83,10 +84,12 @@
 
 int main(void)
 {
-
+printf("\n\r----------------Pocetak------------ \n\r"); fflush(stdout);
 
     init_disp( );
-
+    thread_sleep_for(2000);
+   
+   putOnDisp("elcom", 3);
 
     if( (err = eth.set_network(IP_ADDR,NET_MASK,GATW_ADDR))!= NSAPI_ERROR_OK )  {
         printf(" greska setovanja mreze %d \n\r", err);
@@ -107,8 +110,8 @@
 
     SocketAddress sa("192.168.2.254", 12197);
 
-    struct s_rm s_crm = { &eth, &sa, crm_req, crm_fun };
-    struct s_rm s_srm = { &eth, &sa, srm_req, srm_fun };
+    struct s_rm s_crm = { &eth, &sa, crm_req, crm_fun, 0 };
+    struct s_rm s_srm = { &eth, &sa, srm_req, srm_fun, 0 };
 
 
     putOnDisp("flash", 2);
@@ -123,9 +126,10 @@
         thread_sleep_for(5000);
 
         Thread SRMThread;
+        s_srm.response = 0;
         SRMThread.start( callback( requestMessageThread, &s_srm ));
         SRMThread.join();
-        printf("main %d\n\r",i++);
+        printf("status response %d\n\r",s_srm.response);
     }
 //   printf("\n\rmain: Kraj, error=%d\n\r",err);    fflush(stdout);
 }
@@ -169,6 +173,8 @@
 
                     printf("requestMessage - prim tel %d: %s\n\r", err, rxbuf) ;
                     s->fun_rec( rxbuf );
+                    s->response = dispGetResponce(  );
+
                 }
             }
         }