Obsolete example fixed
authorlaurent
Wed, 16 Jun 2010 21:29:02 +0200
changeset 623 36b62c854ee2
parent 622 f0935accb93b
child 624 48bff18fc546
Obsolete example fixed
objdictgen/examples/example_objdict.c
objdictgen/examples/example_objdict.h
objdictgen/examples/example_objdict.od
--- a/objdictgen/examples/example_objdict.c	Wed Jun 16 21:28:34 2010 +0200
+++ b/objdictgen/examples/example_objdict.c	Wed Jun 16 21:29:02 2010 +0200
@@ -4,7 +4,7 @@
 #include "example_objdict.h"
 
 /**************************************************************************/
-/* Declaration of the mapped variables                                    */
+/* Declaration of mapped variables                                        */
 /**************************************************************************/
 UNS8 Time_seconds = 0x0;		/* Mapped at index 0x2000, subindex 0x01 */
 UNS8 Time_minutes = 0x0;		/* Mapped at index 0x2000, subindex 0x02 */
@@ -12,15 +12,19 @@
 UNS8 Time_days = 0x0;		/* Mapped at index 0x2000, subindex 0x04 */
 UNS32 canopenErrNB = 0x0;		/* Mapped at index 0x2001, subindex 0x00 */
 UNS32 canopenErrVal = 0x0;		/* Mapped at index 0x2002, subindex 0x00 */
-UNS8 strTest[10] = "";		/* Mapped at index 0x2003, subindex 0x00 */
-
-/**************************************************************************/
-/* Declaration of the value range types                                   */
-/**************************************************************************/
-
+INTEGER8 strTest[10] = "";		/* Mapped at index 0x2003, subindex 0x00 */
+
+/**************************************************************************/
+/* Declaration of value range types                                       */
+/**************************************************************************/
+
+#define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */
 UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, void * value)
 {
   switch (typeValue) {
+    case valueRange_EMC:
+      if (*(UNS8*)value != (UNS8)0) return OD_VALUE_RANGE_EXCEEDED;
+      break;
   }
   return 0;
 }
@@ -36,7 +40,7 @@
 
 const UNS8 Linux_slave_iam_a_slave = 1;
 
-TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE,};
+TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE};
 
 /*
 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
@@ -60,6 +64,23 @@
                        { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1001 }
                      };
 
+/* index 0x1003 :   Pre-defined Error Field */
+                    UNS8 Linux_slave_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/
+                    UNS32 Linux_slave_obj1003[] = 
+                    {
+                      0x0	/* 0 */
+                    };
+                    ODCallback_t Linux_slave_Index1003_callbacks[] = 
+                     {
+                       NULL,
+                       NULL,
+                     };
+                    subindex Linux_slave_Index1003[] = 
+                     {
+                       { RW, valueRange_EMC, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1003 },
+                       { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1003[0] }
+                     };
+
 /* index 0x1005 :   SYNC COB ID */
                     UNS32 Linux_slave_obj1005 = 0x0;   /* 0 */
 
@@ -67,12 +88,15 @@
                     UNS32 Linux_slave_obj1006 = 0x0;   /* 0 */
 
 /* index 0x1008 :   Manufacturer Device Name. */
-                    UNS8 Linux_slave_obj1008[10] = "Appli_Slave_HC12";
+                    INTEGER8 Linux_slave_obj1008[16] = "Appli_Slave_HC12";
                     subindex Linux_slave_Index1008[] = 
                      {
                        { RO, visible_string, 16, (void*)&Linux_slave_obj1008 }
                      };
 
+/* index 0x1014 :   Emergency COB ID */
+                    UNS32 Linux_slave_obj1014 = 0x80 + 0x00;   /* 128 + NodeID */
+
 /* index 0x1016 :   Consumer Heartbeat Time. */
                     UNS8 Linux_slave_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/
                     UNS32 Linux_slave_obj1016[] = 
@@ -334,8 +358,12 @@
 /* index 0x2003 :   Mapped variable strTest */
                     subindex Linux_slave_Index2003[] = 
                      {
-                       { RW, visible_string, 0, (void*)&strTest }
-                     };
+                       { RW, visible_string, 10, (void*)&strTest }
+                     };
+
+/**************************************************************************/
+/* Declaration of pointed variables                                       */
+/**************************************************************************/
 
 const indextable Linux_slave_objdict[] = 
 {
@@ -405,7 +433,7 @@
  */
 s_PDO_status Linux_slave_PDO_status[2] = {s_PDO_status_Initializer,s_PDO_status_Initializer};
 
-quick_index Linux_slave_firstIndex = {
+const quick_index Linux_slave_firstIndex = {
   0, /* SDO_SVR */
   5, /* SDO_CLT */
   6, /* PDO_RCV */
@@ -414,7 +442,7 @@
   16 /* PDO_TRS_MAP */
 };
 
-quick_index Linux_slave_lastIndex = {
+const quick_index Linux_slave_lastIndex = {
   0, /* SDO_SVR */
   5, /* SDO_CLT */
   9, /* PDO_RCV */
@@ -423,7 +451,7 @@
   17 /* PDO_TRS_MAP */
 };
 
-UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); 
+const UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); 
 
 CO_Data Linux_slave_Data = CANOPEN_NODE_DATA_INITIALIZER(Linux_slave);
 
--- a/objdictgen/examples/example_objdict.h	Wed Jun 16 21:28:34 2010 +0200
+++ b/objdictgen/examples/example_objdict.h	Wed Jun 16 21:29:02 2010 +0200
@@ -12,14 +12,12 @@
 
 /* Master node data struct */
 extern CO_Data Linux_slave_Data;
-extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[];		/* Callbacks of index0x1800 */
-extern ODCallback_t Transmit_PDO_2_Parameter_callbacks[];		/* Callbacks of index0x1801 */
 extern UNS8 Time_seconds;		/* Mapped at index 0x2000, subindex 0x01 */
 extern UNS8 Time_minutes;		/* Mapped at index 0x2000, subindex 0x02 */
 extern UNS8 Time_hours;		/* Mapped at index 0x2000, subindex 0x03 */
 extern UNS8 Time_days;		/* Mapped at index 0x2000, subindex 0x04 */
 extern UNS32 canopenErrNB;		/* Mapped at index 0x2001, subindex 0x00*/
 extern UNS32 canopenErrVal;		/* Mapped at index 0x2002, subindex 0x00*/
-extern UNS8 strTest[10];		/* Mapped at index 0x2003, subindex 0x00*/
+extern INTEGER8 strTest[10];		/* Mapped at index 0x2003, subindex 0x00*/
 
 #endif // EXAMPLE_OBJDICT_H
--- a/objdictgen/examples/example_objdict.od	Wed Jun 16 21:28:34 2010 +0200
+++ b/objdictgen/examples/example_objdict.od	Wed Jun 16 21:29:02 2010 +0200
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 <!DOCTYPE PyObject SYSTEM "PyObjects.dtd">
-<PyObject module="node" class="Node" id="22859576">
-<attr name="Profile" type="dict" id="25609216" >
+<PyObject module="node" class="Node" id="171685708">
+<attr name="Profile" type="dict" id="172255268" >
 </attr>
 <attr name="Description" type="string" value="" />
-<attr name="Dictionary" type="dict" id="23555456" >
+<attr name="Dictionary" type="dict" id="172255132" >
   <entry>
     <key type="numeric" value="4096" />
     <val type="numeric" value="0" />
@@ -15,8 +15,8 @@
   </entry>
   <entry>
     <key type="numeric" value="5122" />
-    <val type="list" id="22783112" >
-      <item type="string" value="{True:self.ID+(base+2)*0x100,False:0}[base&lt;4]" />
+    <val type="list" id="171642508" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X00&quot;%(base+2),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -25,8 +25,8 @@
   </entry>
   <entry>
     <key type="numeric" value="5123" />
-    <val type="list" id="22856696" >
-      <item type="string" value="{True:self.ID+(base+2)*0x100,False:0}[base&lt;4]" />
+    <val type="list" id="171703948" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X00&quot;%(base+2),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -35,7 +35,7 @@
   </entry>
   <entry>
     <key type="numeric" value="8192" />
-    <val type="list" id="22809776" >
+    <val type="list" id="171641164" >
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -52,13 +52,13 @@
   </entry>
   <entry>
     <key type="numeric" value="5634" />
-    <val type="list" id="22856336" >
+    <val type="list" id="171640012" >
       <item type="numeric" value="0" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="5635" />
-    <val type="list" id="24657792" >
+    <val type="list" id="171642604" >
       <item type="numeric" value="0" />
     </val>
   </entry>
@@ -68,13 +68,13 @@
   </entry>
   <entry>
     <key type="numeric" value="4118" />
-    <val type="list" id="22856048" >
+    <val type="list" id="171641900" >
       <item type="numeric" value="0" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="4120" />
-    <val type="list" id="24658144" >
+    <val type="list" id="171641516" >
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -83,7 +83,7 @@
   </entry>
   <entry>
     <key type="numeric" value="4736" />
-    <val type="list" id="24658792" >
+    <val type="list" id="171642380" >
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -91,15 +91,15 @@
   </entry>
   <entry>
     <key type="numeric" value="160" />
-    <val type="list" id="24658864" >
+    <val type="list" id="171640588" >
       <item type="numeric" value="9" />
       <item type="numeric" value="10" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="5120" />
-    <val type="list" id="24658936" >
-      <item type="string" value="{True:self.ID+(base+2)*0x100,False:0}[base&lt;4]" />
+    <val type="list" id="171642732" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X00&quot;%(base+2),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -108,7 +108,7 @@
   </entry>
   <entry>
     <key type="numeric" value="5632" />
-    <val type="list" id="24657864" >
+    <val type="list" id="171639756" >
       <item type="numeric" value="0" />
     </val>
   </entry>
@@ -118,8 +118,8 @@
   </entry>
   <entry>
     <key type="numeric" value="5121" />
-    <val type="list" id="24659080" >
-      <item type="string" value="{True:self.ID+(base+2)*0x100,False:0}[base&lt;4]" />
+    <val type="list" id="171641580" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X00&quot;%(base+2),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -128,8 +128,8 @@
   </entry>
   <entry>
     <key type="numeric" value="6144" />
-    <val type="list" id="24659008" >
-      <item type="string" value="{True:self.ID+(base+1)*0x100+0x80,False:0}[base&lt;4]" />
+    <val type="list" id="171640172" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X80&quot;%(base+1),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -138,20 +138,20 @@
   </entry>
   <entry>
     <key type="numeric" value="5633" />
-    <val type="list" id="24659224" >
+    <val type="list" id="171640364" >
       <item type="numeric" value="0" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="6656" />
-    <val type="list" id="24659296" >
+    <val type="list" id="171640108" >
       <item type="numeric" value="0" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="6145" />
-    <val type="list" id="22807184" >
-      <item type="string" value="{True:self.ID+(base+1)*0x100+0x80,False:0}[base&lt;4]" />
+    <val type="list" id="172282252" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X80&quot;%(base+1),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -160,27 +160,27 @@
   </entry>
   <entry>
     <key type="numeric" value="6657" />
-    <val type="list" id="24659368" >
-      <item type="numeric" value="0" />
-    </val>
-  </entry>
-</attr>
-<attr name="SpecificMenu" type="list" id="22782248" >
-</attr>
-<attr name="ParamsDictionary" type="dict" id="25949808" >
-</attr>
-<attr name="UserMapping" type="dict" id="23548624" >
+    <val type="list" id="172282188" >
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+</attr>
+<attr name="SpecificMenu" type="list" id="172281996" >
+</attr>
+<attr name="ParamsDictionary" type="dict" id="171657524" >
+</attr>
+<attr name="UserMapping" type="dict" id="172254724" >
   <entry>
     <key type="numeric" value="8192" />
-    <val type="dict" id="25609504" >
+    <val type="dict" id="172255676" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="22856264" >
-          <item type="dict" id="17454272" >
+        <val type="list" id="171703276" >
+          <item type="dict" id="172254996" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -198,7 +198,7 @@
               <val type="string" value="Number of Entries" />
             </entry>
           </item>
-          <item type="dict" id="23156448" >
+          <item type="dict" id="172256084" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -216,7 +216,7 @@
               <val type="string" value="seconds" />
             </entry>
           </item>
-          <item type="dict" id="25602912" >
+          <item type="dict" id="172255948" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -234,7 +234,7 @@
               <val type="string" value="minutes" />
             </entry>
           </item>
-          <item type="dict" id="23156736" >
+          <item type="dict" id="172254588" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -252,7 +252,7 @@
               <val type="string" value="hours" />
             </entry>
           </item>
-          <item type="dict" id="23604592" >
+          <item type="dict" id="172255540" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -284,15 +284,15 @@
   </entry>
   <entry>
     <key type="numeric" value="8193" />
-    <val type="dict" id="23586928" >
+    <val type="dict" id="172256492" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="24659152" >
-          <item type="dict" id="23588256" >
+        <val type="list" id="172281932" >
+          <item type="dict" id="172255812" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -324,15 +324,15 @@
   </entry>
   <entry>
     <key type="numeric" value="8194" />
-    <val type="dict" id="23583408" >
+    <val type="dict" id="172256900" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="24659872" >
-          <item type="dict" id="23585552" >
+        <val type="list" id="171703532" >
+          <item type="dict" id="172256764" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -364,15 +364,15 @@
   </entry>
   <entry>
     <key type="numeric" value="8195" />
-    <val type="dict" id="23610640" >
+    <val type="dict" id="172255404" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="24659800" >
-          <item type="dict" id="23583696" >
+        <val type="list" id="172271660" >
+          <item type="dict" id="172256356" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -404,7 +404,7 @@
   </entry>
   <entry>
     <key type="numeric" value="160" />
-    <val type="dict" id="25574192" >
+    <val type="dict" id="172265652" >
       <entry>
         <key type="string" value="name" />
         <val type="string" value="VISIBLE_STRING10" />
@@ -419,8 +419,8 @@
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="24659728" >
-          <item type="dict" id="25661040" >
+        <val type="list" id="172273100" >
+          <item type="dict" id="172256628" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -438,7 +438,7 @@
               <val type="string" value="Number of Entries" />
             </entry>
           </item>
-          <item type="dict" id="25573904" >
+          <item type="dict" id="172266060" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -456,7 +456,7 @@
               <val type="string" value="Type" />
             </entry>
           </item>
-          <item type="dict" id="25662784" >
+          <item type="dict" id="172265924" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -487,7 +487,7 @@
     </val>
   </entry>
 </attr>
-<attr name="DS302" type="dict" id="23562624" >
+<attr name="DS302" type="dict" id="172256220" >
 </attr>
 <attr name="ProfileName" type="string" value="None" />
 <attr name="Type" type="string">slave</attr>