def __init__(self, class_name, msg, component_id=0): if isinstance(class_name, int): # class_name is an integer, find the name # TODO handle None case self._class_id = class_name self._class_name = messages_xml_map.get_class_name(self._class_id) else: self._class_name = class_name self._class_id = messages_xml_map.get_class_id(class_name) self._component_id = component_id if isinstance(msg, int): self._id = msg self._name = messages_xml_map.get_msg_name(self._class_name, msg) else: self._name = msg self._id = messages_xml_map.get_msg_id(self._class_name, msg) self._fieldnames = messages_xml_map.get_msg_fields(self._class_name, self._name) self._fieldtypes = messages_xml_map.get_msg_fieldtypes(self._class_name, self._id) self._fieldcoefs = messages_xml_map.get_msg_fieldcoefs(self._class_name, self._id) self._fieldvalues = [] # set empty values according to type for t in self._fieldtypes: if t == "char[]": self._fieldvalues.append('') elif '[' in t: self._fieldvalues.append([0]) else: self._fieldvalues.append(0) if messages_xml_map.message_dictionary_broadcast[self._name]=='forwarded': self.broadcasted = False else: self.broadcasted = True
def __init__(self, class_name, name): self._class_name = class_name self._name = name self._id = messages_xml_map.get_msg_id(class_name, name) self._fieldnames = messages_xml_map.get_msg_fields(class_name, name) self._fieldtypes = messages_xml_map.get_msg_fieldtypes(class_name, self._id) self._fieldvalues = [] # set empty values according to type for t in self._fieldtypes: if t == "char[]": self._fieldvalues.append('') elif '[' in t: self._fieldvalues.append([0]) else: self._fieldvalues.append(0)
def __init__(self, class_name, name): self._class_name = class_name self._name = name self._id = messages_xml_map.get_msg_id(class_name, name) self._fieldnames = messages_xml_map.get_msg_fields(class_name, name) self._fieldtypes = messages_xml_map.get_msg_fieldtypes( class_name, self._id) self._fieldvalues = [] # set empty values according to type for t in self._fieldtypes: if t == "char[]": self._fieldvalues.append('') elif '[' in t: self._fieldvalues.append([0]) else: self._fieldvalues.append(0)
def __init__(self, class_name, name): self._class_name = class_name self._name = name self._id = messages_xml_map.get_msg_id(class_name, name) self._fieldnames = messages_xml_map.get_msg_fields(class_name, name) self._fieldvalues = []