src/sdo.c
changeset 87 074126d73842
parent 86 683702a46416
child 145 e747d2e26af0
equal deleted inserted replaced
86:683702a46416 87:074126d73842
   350   UNS16 lastIndex;
   350   UNS16 lastIndex;
   351   UNS8 found = 0;
   351   UNS8 found = 0;
   352   Message m;
   352   Message m;
   353   UNS8 i;
   353   UNS8 i;
   354   UNS32 * pwCobId = NULL;
   354   UNS32 * pwCobId = NULL;
   355   UNS8 * pwNodeId = NULL;
   355   UNS32 * pwNodeId = NULL;
   356 
   356 
   357   MSG_WAR(0x3A38, "sendSDO",0);
   357   MSG_WAR(0x3A38, "sendSDO",0);
   358   if( !((d->nodeState == Operational) ||  (d->nodeState == Pre_operational ))) {
   358   if( !((d->nodeState == Operational) ||  (d->nodeState == Pre_operational ))) {
   359     MSG_WAR(0x2A39, "unable to send the SDO (not in op or pre-op mode", d->nodeState);
   359     MSG_WAR(0x2A39, "unable to send the SDO (not in op or pre-op mode", d->nodeState);
   360     return 0xFF;
   360     return 0xFF;
   441 {
   441 {
   442   UNS8 err;
   442   UNS8 err;
   443   UNS8 line;
   443   UNS8 line;
   444   UNS8 nbBytes; /* received or to be transmited. */
   444   UNS8 nbBytes; /* received or to be transmited. */
   445   UNS8 nodeId = 0;  /* The node from which the SDO is received */
   445   UNS8 nodeId = 0;  /* The node from which the SDO is received */
   446   UNS8 *pNodeId = NULL;
   446   UNS32 nodeId_32; /* node id in 32 bits, for temporary use */
       
   447   UNS32 *pNodeId = NULL;
   447   UNS8 whoami = SDO_UNKNOWN;  /* SDO_SERVER or SDO_CLIENT.*/
   448   UNS8 whoami = SDO_UNKNOWN;  /* SDO_SERVER or SDO_CLIENT.*/
   448   UNS32 errorCode; /* while reading or writing in the local object dictionary.*/
   449   UNS32 errorCode; /* while reading or writing in the local object dictionary.*/
   449   s_SDO sdo;    /* SDO to transmit */
   450   s_SDO sdo;    /* SDO to transmit */
   450   UNS16 index;
   451   UNS16 index;
   451   UNS8 subIndex;
   452   UNS8 subIndex;
   493        pCobId = d->objdict[offset].pSubindex[2].pObject;
   494        pCobId = d->objdict[offset].pSubindex[2].pObject;
   494        if (*pCobId == (*m).cob_id.w ) {
   495        if (*pCobId == (*m).cob_id.w ) {
   495 	 /* b) cobid found, so reading the node id of the server. */
   496 	 /* b) cobid found, so reading the node id of the server. */
   496 	 pNodeId = d->objdict[offset].pSubindex[3].pObject;
   497 	 pNodeId = d->objdict[offset].pSubindex[3].pObject;
   497 	 whoami = SDO_CLIENT;
   498 	 whoami = SDO_CLIENT;
   498 	 nodeId = *pNodeId;
   499 	 nodeId_32 = *pNodeId;
       
   500 	 nodeId = (UNS8)nodeId_32;
   499 	 MSG_WAR(0x3A64, "proceedSDO. I am server. index : ", 0x1280 + j);
   501 	 MSG_WAR(0x3A64, "proceedSDO. I am server. index : ", 0x1280 + j);
   500 	 MSG_WAR(0x3A65, "                 Server nodeId : ", nodeId);
   502 	 MSG_WAR(0x3A65, "                 Server nodeId : ", nodeId);
   501 	 break;
   503 	 break;
   502 	}
   504 	}
   503        j++;
   505        j++;