src/sdo.c
changeset 481 9dd36e4453ae
parent 447 c9d01296d6d9
child 495 b2d6307a89fa
equal deleted inserted replaced
480:d0d76932ad74 481:9dd36e4453ae
   501     MSG_WAR(0x2A39, "unable to send the SDO (not in op or pre-op mode", d->nodeState);
   501     MSG_WAR(0x2A39, "unable to send the SDO (not in op or pre-op mode", d->nodeState);
   502     return 0xFF;
   502     return 0xFF;
   503   }  				
   503   }  				
   504 
   504 
   505   /*get the server->client cobid*/
   505   /*get the server->client cobid*/
   506   if ( whoami == SDO_SERVER )	{/*case server. Easy because today only one server SDO is authorized in CanFestival*/
   506   if ( whoami == SDO_SERVER )	{/*case server. only one SDO server*/
   507     offset = d->firstIndex->SDO_SVR;
   507     offset = d->firstIndex->SDO_SVR;
   508     if (offset == 0) {
   508     if (offset == 0) {
   509       MSG_ERR(0x1A42, "SendSDO : No SDO server found", 0); 
   509       MSG_ERR(0x1A42, "SendSDO : No SDO server found", 0); 
   510       return 0xFF;
   510       return 0xFF;
   511     }
   511     }
   519     lastIndex = d->lastIndex->SDO_CLT;
   519     lastIndex = d->lastIndex->SDO_CLT;
   520     if (offset == 0) {
   520     if (offset == 0) {
   521       MSG_ERR(0x1A42, "SendSDO : No SDO client index found", 0); 
   521       MSG_ERR(0x1A42, "SendSDO : No SDO client index found", 0); 
   522       return 0xFF;
   522       return 0xFF;
   523     }
   523     }
   524     /* First, have to find at the index where is defined the communication with the server node */
   524     /* find index for communication server node */
   525     while (offset <= lastIndex){
   525     while (offset <= lastIndex){
   526       MSG_WAR(0x3A43,"Reading index : ", 0x1280 + sdoNum);
   526       MSG_WAR(0x3A43,"Reading index : ", 0x1280 + sdoNum);
   527       if (d->objdict[offset].bSubCount <= 3) {
   527       if (d->objdict[offset].bSubCount <= 3) {
   528 	MSG_ERR(0x1A28, "Subindex 3  not found at index ", 0x1280 + sdoNum);
   528 	MSG_ERR(0x1A28, "Subindex 3  not found at index ", 0x1280 + sdoNum);
   529 	return 0xFF;
   529 	return 0xFF;
   539     }
   539     }
   540     if (! found){
   540     if (! found){
   541       MSG_WAR (0x2A45, "No SDO client corresponds to the mesage to send to node ", sdo.nodeId);
   541       MSG_WAR (0x2A45, "No SDO client corresponds to the mesage to send to node ", sdo.nodeId);
   542       return 0xFF;
   542       return 0xFF;
   543     }
   543     }
   544     /* Second, read the cobid client->server */
   544     /* read the client->server cobid */
   545     pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
   545     pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
   546   }
   546   }
   547   /* message copy for sending */
   547   /* message copy for sending */
   548   m.cob_id = UNS16_LE(*pwCobId);
   548   m.cob_id = UNS16_LE(*pwCobId);
   549   m.rtr = NOT_A_REQUEST; 
   549   m.rtr = NOT_A_REQUEST;