_value_type = CountValue def __init__(self, message_data, offset, pid): untested("Diesel IPT response") Service09Response.__init__(self, message_data, offset, pid) if len(self.items) != 16: raise J1699Failure("IPT NODI != 16", raw=self) return def _decode_item(self, item): return self.decode_integer(item) ################################### # Registration register_response_class(sid=0x09, pid=0x00, cls=PIDSupportResponse) register_response_class(sid=0x09, pid=0x01, cls=_mc_response(0x01, "MC_VIN")) register_response_class(sid=0x09, pid=0x02, cls=VINResponse) register_response_class(sid=0x09, pid=0x03, cls=_mc_response(0x03, "MC_CALID")) register_response_class(sid=0x09, pid=0x04, cls=CalibrationIDResponse) register_response_class(sid=0x09, pid=0x05, cls=_mc_response(0x05, "MC_CVN")) register_response_class(sid=0x09, pid=0x06, cls=CVNResponse) register_response_class(sid=0x09, pid=0x07, cls=_mc_response(0x07, "MC_IPT")) register_response_class(sid=0x09, pid=0x08, cls=IPTResponse) register_response_class(sid=0x09, pid=0x09, cls=_mc_response(0x09, "MC_ECUNM")) register_response_class(sid=0x09, pid=0x0A, cls=ECUNameResponse) register_response_class(sid=0x09, pid=0x0B, cls=DieselIPTResponse) # vim: softtabstop=4 shiftwidth=4 expandtab
class DTCResponse(VariableLengthResponse): """Encapsulates the response to a DTC request dtc -- a list of the DTCs, each DTC represented by a list of of two bytes """ item_length = 2 def __init__(self, message_data, offset, pid): VariableLengthResponse.__init__(self, message_data, offset, pid) self.items = self._get_item_bytes() dtcs = [self._decode_item(i) for i in self.items] self.dtcs = [d for d in dtcs if d.value] return def __str__(self): return "DTC=%s" % str([str(d) for d in self.dtcs]) def _decode_item(self, item): return DTC(self.decode_integer(item)) ################################### # Registration register_response_class(sid=0x03, pid=None, cls=DTCResponse) # vim: softtabstop=4 shiftwidth=4 expandtab
0x45: RelativeThrottleResponse, 0x46: AmbientAirTempResponse, 0x55: _fuel_trim_response(0x55, ["STSO2FT1", "STSO2FT3"]), 0x56: _fuel_trim_response(0x56, ["LGSO2FT1", "LGSO2FT3"]), 0x57: _fuel_trim_response(0x57, ["STSO2FT2", "STSO2FT4"]), 0x58: _fuel_trim_response(0x58, ["LGSO2FT2", "LGSO2FT4"]), 0x59: _fuel_rail_pressure_response(0x59, 10.0), 0x60: PIDSupportResponse, 0x80: PIDSupportResponse, 0xA0: PIDSupportResponse, 0xC0: PIDSupportResponse, 0xE0: PIDSupportResponse, } for _pid, class_ in _pid_classes.items(): register_response_class(sid=0x01, pid=_pid, cls=class_) """ lengths = { 0x01: { # SID $01 0x02: 2, 0x03: 2, 0x04: 1, 0x05: 1, # 6-9 are 1-or-2 0x0A: 1, 0x0B: 1, 0x0C: 2, 0x0D: 1, 0x0E: 1, 0x0F: 1,
0x45: RelativeThrottleResponse, 0x46: AmbientAirTempResponse, 0x55: _fuel_trim_response(0x55, ["STSO2FT1", "STSO2FT3"]), 0x56: _fuel_trim_response(0x56, ["LGSO2FT1", "LGSO2FT3"]), 0x57: _fuel_trim_response(0x57, ["STSO2FT2", "STSO2FT4"]), 0x58: _fuel_trim_response(0x58, ["LGSO2FT2", "LGSO2FT4"]), 0x59: _fuel_rail_pressure_response(0x59, 10.0), 0x60: PIDSupportResponse, 0x80: PIDSupportResponse, 0xA0: PIDSupportResponse, 0xC0: PIDSupportResponse, 0xE0: PIDSupportResponse, } for _pid, class_ in _pid_classes.items(): register_response_class(sid=0x01, pid=_pid, cls=class_) """ lengths = { 0x01: { # SID $01 0x02: 2, 0x03: 2, 0x04: 1, 0x05: 1, # 6-9 are 1-or-2 0x0A: 1, 0x0B: 1, 0x0C: 2, 0x0D: 1, 0x0E: 1, 0x0F: 1, 0x10: 2,