200 {"name" : "Node ID of the SDO Client", "type" : 0x05, "access" : 'ro', "pdo" : False}]}, |
200 {"name" : "Node ID of the SDO Client", "type" : 0x05, "access" : 'ro', "pdo" : False}]}, |
201 0x1280 : {"name" : "Client SDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x100, "need" : False, "values" : |
201 0x1280 : {"name" : "Client SDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x100, "need" : False, "values" : |
202 [{"name" : "Number of Entries", "type" : 0x05, "access" : 'ro', "pdo" : False}, |
202 [{"name" : "Number of Entries", "type" : 0x05, "access" : 'ro', "pdo" : False}, |
203 {"name" : "COB ID Client to Server (Transmit SDO)", "type" : 0x07, "access" : 'rw', "pdo" : False}, |
203 {"name" : "COB ID Client to Server (Transmit SDO)", "type" : 0x07, "access" : 'rw', "pdo" : False}, |
204 {"name" : "COB ID Server to Client (Receive SDO)", "type" : 0x07, "access" : 'rw', "pdo" : False}, |
204 {"name" : "COB ID Server to Client (Receive SDO)", "type" : 0x07, "access" : 'rw', "pdo" : False}, |
205 {"name" : "Node ID of the SDO Server", "type" : 0x04, "access" : 'rw', "pdo" : False}]}, |
205 {"name" : "Node ID of the SDO Server", "type" : 0x05, "access" : 'rw', "pdo" : False}]}, |
206 0x1400 : {"name" : "Receive PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" : |
206 0x1400 : {"name" : "Receive PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" : |
207 [{"name" : "Highest SubIndex Supported", "type" : 0x05, "access" : 'ro', "pdo" : False}, |
207 [{"name" : "Highest SubIndex Supported", "type" : 0x05, "access" : 'ro', "pdo" : False}, |
208 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False, "default" : "{True:self.ID+(base+2)*0x100,False:0}[base<4]"}, |
208 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False, "default" : "{True:self.ID+(base+2)*0x100,False:0}[base<4]"}, |
209 {"name" : "Transmission Type", "type" : 0x05, "access" : 'rw', "pdo" : False}, |
209 {"name" : "Transmission Type", "type" : 0x05, "access" : 'rw', "pdo" : False}, |
210 {"name" : "Inhibit Time", "type" : 0x06, "access" : 'rw', "pdo" : False}, |
210 {"name" : "Inhibit Time", "type" : 0x06, "access" : 'rw', "pdo" : False}, |
813 |
813 |
814 """ |
814 """ |
815 Print the Dictionary values |
815 Print the Dictionary values |
816 """ |
816 """ |
817 def Print(self): |
817 def Print(self): |
|
818 print self.PrintString() |
|
819 |
|
820 def PrintString(self): |
|
821 result = "" |
818 listindex = self.Dictionary.keys() |
822 listindex = self.Dictionary.keys() |
819 listindex.sort() |
823 listindex.sort() |
820 for index in listindex: |
824 for index in listindex: |
|
825 name = self.GetEntryName(index) |
821 values = self.Dictionary[index] |
826 values = self.Dictionary[index] |
822 if index != 0x1F22 and type(values) != IntType: |
827 if isinstance(values, ListType): |
823 values = [i for i in values] |
828 result += "%04X (%s):\n"%(index, name) |
824 for i, value in enumerate(values): |
829 for subidx, value in enumerate(values): |
825 if type(value) == IntType: |
830 subentry_infos = self.GetSubentryInfos(index, subidx + 1) |
826 values[i] = "%X"%value |
831 if index == 0x1F22 and value: |
827 values = "[" + ",".join(values) + "]" |
832 nb_params = BE_to_LE(value[:4]) |
828 print "%04X : %s"%(index, values) |
833 data = value[4:] |
829 |
834 value = str(nb_params) |
|
835 i = 0 |
|
836 while i < len(data): |
|
837 value += "\n\t" |
|
838 value += "%4.4X"%BE_to_LE(data[i:i+2]) |
|
839 value += " %2.2X"%BE_to_LE(data[i+2:i+3]) |
|
840 size = BE_to_LE(data[i+3:i+7]) |
|
841 value += " %8.8X"%size |
|
842 value += (" %"+"%d"%(size * 2)+"."+"%d"%(size * 2)+"X")%BE_to_LE(data[i+7:i+7+size]) |
|
843 i += 7 + size |
|
844 elif isinstance(value, IntType): |
|
845 value = "%X"%value |
|
846 result += " %3.3d (%s): %s\n"%(subidx+1, subentry_infos["name"], value) |
|
847 else: |
|
848 result += "%04X (%s): %s\n"%(index, name, values) |
|
849 return result |
|
850 |
830 def CompileValue(self, value, index): |
851 def CompileValue(self, value, index): |
831 if type(value) == StringType and value.find("self.ID") != -1: |
852 if type(value) == StringType and value.find("self.ID") != -1: |
832 base = self.GetBaseIndex(index) |
853 base = self.GetBaseIndex(index) |
833 try: |
854 try: |
834 return eval(value) |
855 return eval(value) |
994 Return the list of variables that can be mapped for the current node |
1015 Return the list of variables that can be mapped for the current node |
995 """ |
1016 """ |
996 def GetMapList(self): |
1017 def GetMapList(self): |
997 list = ["None"] + [name for index, subIndex, size, name in self.GetMapVariableList()] |
1018 list = ["None"] + [name for index, subIndex, size, name in self.GetMapVariableList()] |
998 return ",".join(list) |
1019 return ",".join(list) |
|
1020 |
|
1021 def BE_to_LE(value): |
|
1022 """ |
|
1023 Convert Big Endian to Little Endian |
|
1024 @param value: value expressed in Big Endian |
|
1025 @param size: number of bytes generated |
|
1026 @return: a string containing the value converted |
|
1027 """ |
|
1028 |
|
1029 data = [char for char in value] |
|
1030 data.reverse() |
|
1031 return int("".join(["%2.2X"%ord(char) for char in data]), 16) |
|
1032 |