Esempio n. 1
0
def get_current_data_for_pid(pid):
    # 01 xx = Show current data
    isotp_send(panda, "\x01" + chr(pid), 0x7e0)
    return isotp_recv(panda, 0x7e8)
Esempio n. 2
0
 def isotp_send(self, addr, dat, bus, recvaddr=None, subaddr=None):
     return isotp_send(self, dat, addr, bus, recvaddr, subaddr)
Esempio n. 3
0
            if supported & 0x80000000:
                ret.append(i)
            supported <<= 1
        pid += 0x20
        if pid not in ret:
            break
    return ret


if __name__ == "__main__":
    panda = Panda()
    panda.set_safety_mode(Panda.SAFETY_ELM327)
    panda.can_clear(0)

    # 09 02 = Get VIN
    isotp_send(panda, "\x09\x02", 0x7e0)
    ret = isotp_recv(panda, 0x7e8)
    hexdump(ret)
    print "VIN: %s" % ret[2:]

    # 03 = get DTCS
    isotp_send(panda, "\x03", 0x7e0)
    dtcs = isotp_recv(panda, 0x7e8)
    print "DTCs:", dtcs[2:].encode("hex")

    supported_pids = get_supported_pids()
    print "Supported PIDs:", supported_pids

    while 1:
        speed = struct.unpack(">B", get_current_data_for_pid(13)[2:])[0]  # kph
        rpm = struct.unpack(">H",