getReadResultNetworkDict now returns abortcode. Now, abort message should be sent correctly from client.
authoretisserant
Tue, 22 Jul 2008 23:48:48 +0200
changeset 499 061f12bd838b
parent 498 aae8531341df
child 500 13fcb9328a02
getReadResultNetworkDict now returns abortcode. Now, abort message should be sent correctly from client.
include/sdo.h
src/sdo.c
--- a/include/sdo.h	Tue Jul 22 23:47:05 2008 +0200
+++ b/include/sdo.h	Tue Jul 22 23:48:48 2008 +0200
@@ -188,7 +188,7 @@
  * Write a read only object
  * whoami takes 2 values : SDO_CLIENT or SDO_SERVER
  */
-UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode);
+UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 abortCode);
 
 /** Treat a SDO frame reception
  * bus_id is hardware dependant
--- a/src/sdo.c	Tue Jul 22 23:47:05 2008 +0200
+++ b/src/sdo.c	Tue Jul 22 23:48:48 2008 +0200
@@ -136,7 +136,7 @@
     /*Set aborted state*/
     d->transfers[id].state = SDO_ABORTED_INTERNAL;
     /* Sending a SDO abort */
-    sendSDOabort(d, d->transfers[id].whoami, 
+    sendSDOabort(d, d->transfers[id].whoami, d->transfers[id].nodeId,
 		 d->transfers[id].index, d->transfers[id].subIndex, SDOABT_TIMED_OUT);
     d->transfers[id].abortCode = SDOABT_TIMED_OUT;
     /* Call the user function to inform of the problem.*/
@@ -312,7 +312,7 @@
     d->transfers[line].state = SDO_ABORTED_INTERNAL;
   }
   MSG_WAR(0x3A22, "Sending SDO abort ", 0);
-  err = sendSDOabort(d, whoami, index, subIndex, abortCode);
+  err = sendSDOabort(d, whoami, nodeId, index, subIndex, abortCode);
   if (err) {
     MSG_WAR(0x3A23, "Unable to send the SDO abort", 0);
     return 0xFF;
@@ -566,12 +566,23 @@
 **                                                                                                 
 ** @return                                                                                         
 **/   
-UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode)
+UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 nodeID, UNS16 index, UNS8 subIndex, UNS32 abortCode)
 {
   s_SDO sdo;
   UNS8 ret;
+  UNS8* pNodeIdServer;
+  UNS8 nodeIdServer;
+  UNS16 offset;
+  
   MSG_WAR(0x2A50,"Sending SDO abort ", abortCode);
-  sdo.nodeId = *d->bDeviceNodeId;
+  if(whoami == SDO_SERVER)
+  {
+	sdo.nodeId = *d->bDeviceNodeId;
+  }
+  else
+  {
+    sdo.nodeId = nodeID;
+  }
   sdo.body.data[0] = 0x80;
   /* Index */
   sdo.body.data[1] = index & 0xFF; /* LSB */
@@ -1526,6 +1537,7 @@
   UNS8 err;
   UNS8 line;
   * size = 0;
+  * abortCode = 0;
 
   /* Looking for the line tranfert. */
   err = getSDOlineOnUse(d, nodeId, SDO_CLIENT, &line);
@@ -1550,6 +1562,7 @@
     ( (char *) data)[i] = d->transfers[line].data[i];
 # endif
   } 
+  * abortCode = d->transfers[line].abortCode;
   return SDO_FINISHED;
 }