41#include "OPCprotocolManager.h"
42#include "OPCprotocolManager_Cfg.h"
43#include "EoDiagnostics.h"
75static void enaDisaDiagnostic(uint8_t *payload_ptr, uint32_t payload_size, ACE_INET_Addr *addr);
87 printf(
"\nq: quit\n");
88 printf(
"0: ena/disa diagnostics on a ems\n");
89 printf(
"1: ena/disa diagnostics on a group of ems (exteranl fault is NOT checked)\n");
90 printf(
"2: ena/disa diagnostics on a group of ems and exteranl fault is checked \n");
91 printf(
"3: advanced configuration....\n");
92 printf(
"4: ena/disa rx setpoint che for red ball demo.\n");
93 printf(
"5: ........\n");
101 uint32_t ip1,ip2,ip3,ip4, address=0;
103 printf(
"Insert destination host: x.x.x.x ");
104 ret = scanf(
"%s", &addrstr[0]);
105 ret = sscanf(addrstr,
"%d.%d.%d.%d",&ip1,&ip2,&ip3,&ip4);
106 address = (ip1<<24)|(ip2<<16)|(ip3<<8)|ip4 ;
112int32_t
callback_button_x(uint8_t *payload_ptr, uint32_t payload_size, ACE_INET_Addr *addr, int16_t
id)
114 printf(
"button %d\n",
id);
118 opcprotman_res_t res;
120 addr->set(4444, dest_addr);
124 printf(
"opcMan_ptr is NULL\n");
128 res = opcprotman_Form(
opcMan_ptr, opcprotman_opc_ask,
id, NULL , (opcprotman_message_t*)payload_ptr, &size);
129 if(opcprotman_OK != res)
132 printf(
"erron in former\n");
135 printf(
"in button %d : size=%d \n",
id, size);
146 uint32_t extFaultEna=0;
147 uint32_t canStatistics=0;
148 uint32_t ethCounters=0;
149 opcprotman_res_t res;
154 printf(
"opcMan_ptr is NULL\n");
159 printf(
"enable/disable diagnostics. Press 1 to enable 0 otherwise\n");
160 ret = scanf(
"%d", &cmdena);
162 printf(
"enable/disable Check external fault. Press 1 to enable 0 otherwise\n");
163 ret = scanf(
"%d", &extFaultEna);
165 printf(
"enable/disable can statistics. Press 1 to enable 0 otherwise\n");
166 ret = scanf(
"%d", &canStatistics);
168 printf(
"enable/disable Check eth counters. Press 0 to disable or 1 for crcError, 2 for num of rxUnicat, 4 for txtUnicast\n");
169 ret = scanf(
"%d", ðCounters);
172 printf(
"address is 0x %x \n", dest_addr);
193 addr->set(4444, dest_addr);
195 res = opcprotman_Form(
opcMan_ptr, opcprotman_opc_set, eodgn_nvidbdoor_cmds, &
dgnCommands, (opcprotman_message_t*)payload_ptr, &size);
196 if(opcprotman_OK != res)
199 printf(
"erron in former\n");
216 printf(
"opcMan_ptr is NULL\n");
220 printf(
"enable/disable diagnostics for a set of board. Press 1 to enable 0 otherwise\n");
221 ret = scanf(
"%d", &cmdena);
241 printf(
"opcMan_ptr is NULL\n");
245 printf(
"enable/disable diagnostics for a set of board. Press 1 to enable 0 otherwise\n");
246 ret = scanf(
"%d", &cmdena);
261 uint32_t extFaultEna=0;
262 uint32_t canStatistics=0;
263 uint32_t ethCounters=0;
268 printf(
"opcMan_ptr is NULL\n");
272 printf(
"enable/disable diagnostics for a set of board. Press 1 to enable 0 otherwise\n");
273 ret = scanf(
"%d", &cmdena);
278 printf(
"enable/disable Check external fault. Press 1 to enable 0 otherwise\n");
279 ret = scanf(
"%d", &extFaultEna);
281 printf(
"enable/disable can statistics. Press 1 to enable 0 otherwise\n");
282 ret = scanf(
"%d", &canStatistics);
284 printf(
"enable/disable Check eth counters. Press 0 to disable or 1 for crcError, 2 for num of rxUnicat, 4 for txtUnicast\n");
285 ret = scanf(
"%d", ðCounters);
308 uint32_t min, max, j;
309 opcprotman_res_t res;
314 printf(
"enable/disable diagnostics about rx setpoint (red ball demo). Press 1 to enable 0 otherwise\n");
356 uint32_t min, max, j;
357 opcprotman_res_t res;
361 printf(
"insert renge of board[1,11]: min max\n");
362 ret = scanf(
"%d %d", &min, &max);
365 printf(
"error: min > max!\n");
369 if((min == 0) && (max ==0))
372 address = (10<<24)|(0<<16)|(1<<8)|99 ;
373 addr->set(4444, address);
374 res = opcprotman_Form(
opcMan_ptr, opcprotman_opc_set, eodgn_nvidbdoor_cmds, &
dgnCommands, (opcprotman_message_t*)payload_ptr, &size);
375 if(opcprotman_OK != res)
378 printf(
"erron in former\n");
381 ssize_t sentBytes =
ACE_socket->send(payload_ptr, size, *addr, 0);
382 ACE_TCHAR address[64];
383 addr->addr_to_string(address, 64);
384 printf(
"payload of size %d is sent to %s!! (sentbytes=%ld)\n", size, address, sentBytes);
397 for(j=min; j<=max; j++)
399 address = (10<<24)|(0<<16)|(1<<8)|j ;
400 addr->set(4444, address);
401 res = opcprotman_Form(
opcMan_ptr, opcprotman_opc_set, eodgn_nvidbdoor_cmds, &
dgnCommands, (opcprotman_message_t*)payload_ptr, &size);
402 if(opcprotman_OK != res)
405 printf(
"erron in former\n");
408 ssize_t sentBytes =
ACE_socket->send(payload_ptr, size, *addr, 0);
409 ACE_TCHAR address[64];
410 addr->addr_to_string(address, 64);
411 printf(
"payload of size %d is sent to %s!! (sentbytes=%ld)\n", size, address, sentBytes);