def __init__(self, message_data, offset, pid): """Initialize the object from the raw response from the vehicle""" Response.__init__(self, message_data, offset, pid) self.values = [] for factory in self._value_factories: try: value = factory.extract_value(self) self.values.append(value) except IndexError: # Skip any values that weren't contained # in the message pass return
def __init__(self, message_data, offset, pid): assert (pid & 0x1F) == 0 Response.__init__(self, message_data, offset, pid) self.pid_supported = {} self.supported_pids = [] bits = self.decode_integer(self.data_bytes) for pid_bit in range(1, 33): # test each bit in the integer corresponding to each PID pid_supported = (bits & (1 << (32 - pid_bit))) != 0 pid = self.pid + pid_bit self.pid_supported[pid] = pid_supported if pid_supported: self.supported_pids.append(pid) return