equal
deleted
inserted
replaced
62 |
62 |
63 def GetCurrentLocation(self): |
63 def GetCurrentLocation(self): |
64 """ |
64 """ |
65 @return: Tupple containing plugin IEC location of current plugin : %I0.0.4.5 => (0,0,4,5) |
65 @return: Tupple containing plugin IEC location of current plugin : %I0.0.4.5 => (0,0,4,5) |
66 """ |
66 """ |
67 return self.PlugParent.GetCurrentLocation() + (self.BaseParams.getIEC_Channel(), 0) |
67 return self.PlugParent.GetCurrentLocation() + self.GetSlavePos() |
|
68 |
|
69 def GetSlavePos(self): |
|
70 return self.BaseParams.getIEC_Channel(), 0 |
68 |
71 |
69 def GetSlaveTypeInfos(self): |
72 def GetSlaveTypeInfos(self): |
70 slave_type = self.EtherlabDS402Slave.getNode_Type() |
73 slave_type = self.EtherlabDS402Slave.getNode_Type() |
71 |
74 |
72 for module_type, vendor_id, product_code, revision_number in self.PlugParent.GetModulesByProfile(402): |
75 for module_type, vendor_id, product_code, revision_number in self.PlugParent.GetModulesByProfile(402): |
310 return None |
313 return None |
311 |
314 |
312 def AddSlave(self): |
315 def AddSlave(self): |
313 slaves = self.GetSlaves() |
316 slaves = self.GetSlaves() |
314 for PlugInstance in self.IterChilds(): |
317 for PlugInstance in self.IterChilds(): |
315 slaves.append((PlugInstance.BaseParams.getIEC_Channel(), 0)) |
318 slaves.append(PlugInstance.GetSlavePos()) |
316 slaves.sort() |
319 slaves.sort() |
317 if len(slaves) > 0: |
320 if len(slaves) > 0: |
318 new_pos = (slaves[-1][0] + 1, 0) |
321 new_pos = (slaves[-1][0] + 1, 0) |
319 else: |
322 else: |
320 new_pos = (0, 0) |
323 new_pos = (0, 0) |
420 |
423 |
421 vars.append({"name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]), |
424 vars.append({"name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]), |
422 "type": var_class, |
425 "type": var_class, |
423 "size": var_size, |
426 "size": var_size, |
424 "IEC_type": entry["Type"], |
427 "IEC_type": entry["Type"], |
425 "var_name": "%s_%4.4x_%2.2x" % (type_infos["device_type"], index, subindex), |
428 "var_name": "%s_%4.4x_%2.2x" % ("_".join(type_infos["device_type"].split()), index, subindex), |
426 "location": "%s%s%s"%(var_dir, var_size, ".".join(map(str, current_location + |
429 "location": "%s%s%s"%(var_dir, var_size, ".".join(map(str, current_location + |
427 (index, subindex)))), |
430 (index, subindex)))), |
428 "description": "", |
431 "description": "", |
429 "children": []}) |
432 "children": []}) |
430 |
433 |