320 |
320 |
321 """ |
321 """ |
322 Build the C definition of Object Dictionary for current node |
322 Build the C definition of Object Dictionary for current node |
323 """ |
323 """ |
324 def ExportCurrentToCFile(self, filepath): |
324 def ExportCurrentToCFile(self, filepath): |
325 return gen_cfile.GenerateFile(filepath, self) |
325 if self.CurrentNode: |
|
326 return gen_cfile.GenerateFile(filepath, self.CurrentNode) |
326 |
327 |
327 #------------------------------------------------------------------------------- |
328 #------------------------------------------------------------------------------- |
328 # Add Entries to Current Functions |
329 # Add Entries to Current Functions |
329 #------------------------------------------------------------------------------- |
330 #------------------------------------------------------------------------------- |
330 |
331 |
350 # First case entry is record |
351 # First case entry is record |
351 if infos["struct"] & OD_IdenticalSubindexes: |
352 if infos["struct"] & OD_IdenticalSubindexes: |
352 for i in xrange(1, min(number,subentry_infos["nbmax"]-length) + 1): |
353 for i in xrange(1, min(number,subentry_infos["nbmax"]-length) + 1): |
353 node.AddEntry(index, length + i, default) |
354 node.AddEntry(index, length + i, default) |
354 if not disable_buffer: |
355 if not disable_buffer: |
355 self.BufferCurrentNode() |
356 self.BufferCurrentNode() |
356 return None |
357 return None |
357 # Second case entry is array, only possible for manufacturer specific |
358 # Second case entry is array, only possible for manufacturer specific |
358 elif infos["struct"] & OD_MultipleSubindexes and 0x2000 <= index <= 0x5FFF: |
359 elif infos["struct"] & OD_MultipleSubindexes and 0x2000 <= index <= 0x5FFF: |
359 values = {"name" : "Undefined", "type" : 5, "access" : "rw", "pdo" : True} |
360 values = {"name" : "Undefined", "type" : 5, "access" : "rw", "pdo" : True} |
360 for i in xrange(1, min(number,0xFE-length) + 1): |
361 for i in xrange(1, min(number,0xFE-length) + 1): |
361 node.AddMappingEntry(index, length + i, values = values.copy()) |
362 node.AddMappingEntry(index, length + i, values = values.copy()) |
362 node.AddEntry(index, length + i, 0) |
363 node.AddEntry(index, length + i, 0) |
363 if not disable_buffer: |
364 if not disable_buffer: |
364 self.BufferCurrentNode() |
365 self.BufferCurrentNode() |
365 return None |
366 return None |
366 |
367 |
367 |
368 |
368 """ |
369 """ |
369 Remove the specified number of subentry for the given entry. Verify that total |
370 Remove the specified number of subentry for the given entry. Verify that total |
938 if min <= index <= max and not self.CurrentNode.IsEntry(index) and index not in exclusionlist: |
939 if min <= index <= max and not self.CurrentNode.IsEntry(index) and index not in exclusionlist: |
939 validchoices.append((self.GetEntryName(index), index)) |
940 validchoices.append((self.GetEntryName(index), index)) |
940 return validchoices |
941 return validchoices |
941 |
942 |
942 def HasCurrentEntryCallbacks(self, index): |
943 def HasCurrentEntryCallbacks(self, index): |
943 if self.CurrentNode and self.CurrentNode.IsEntry(index): |
944 if self.CurrentNode: |
944 entry_infos = self.GetEntryInfos(index) |
|
945 if "callback" in entry_infos: |
|
946 return entry_infos["callback"] |
|
947 return self.CurrentNode.HasEntryCallbacks(index) |
945 return self.CurrentNode.HasEntryCallbacks(index) |
948 return False |
946 return False |
949 |
947 |
950 def GetCurrentEntryValues(self, index): |
948 def GetCurrentEntryValues(self, index): |
951 if self.CurrentNode: |
949 if self.CurrentNode: |