Esempio n. 1
0
def switch_to_protocol(protocol):
    global __dcm__

    if (protocol == 'DOIP'):
        if (os.getenv('DOIP_IP')):
            ip = os.getenv('DOIP_IP')
        else:
            ip = '172.18.0.200'
        __dcm__ = dcm(ip, 8989)
        print("switch to UDS on DoIP mode on %s:8989" % (ip))
    elif (protocol == 'J1939TP'):
        config = {
            'busid': 0,
            'TxFcNPdu': 0x751,
            'TXDtNPdu': 0x752,
            'TXCmNPdu': 0x753,
            'TXDirectNPdu': 0x754,
            'RXCmNPdu': 0x761,
            'RXDtNPdu': 0x762,
            'RXFcNPdu': 0x763,
            'RXDirectNPdu': 0x764,
            'STmin': 10,  # 10ms delay
        }
        __dcm__ = dcm(config)
        print("switch to UDS on J1939TP mode")
    elif (protocol == 'CANFD'):
        __dcm__ = dcm(DFTBUS, 0x732, 0x731)
        __dcm__.set_ll_dl(64)
        print("switch to UDS on CANFD mode")
    else:
        __dcm__ = dcm(DFTBUS, 0x732, 0x731)
        print("switch to UDS on CAN mode")
Esempio n. 2
0
File: asdcm.py Progetto: wzugang/as
def switch_to_doip(state):
    global __dcm__

    if (state):
        __dcm__ = dcm('172.18.0.200', 8989)
        print("switch to UDS on DoIP mode")
    else:
        __dcm__ = dcm(0, 0x732, 0x731)
        print("switch to UDS on CAN mode")
Esempio n. 3
0
        return v

    def toarray(self):
        return self.bits.tobytes()


def str2int(sstr):
    if (sstr[:2].lower() == '0x'):
        return int(sstr, 16)
    elif (sstr[:2].lower() == '0b'):
        return int(sstr, 2)
    else:
        return int(sstr, 10)


__dcm__ = dcm(DFTBUS, 0x732, 0x731)


def switch_to_protocol(protocol):
    global __dcm__

    if (protocol == 'DOIP'):
        if (os.getenv('DOIP_IP')):
            ip = os.getenv('DOIP_IP')
        else:
            ip = '172.18.0.200'
        __dcm__ = dcm(ip, 8989)
        print("switch to UDS on DoIP mode on %s:8989" % (ip))
    elif (protocol == 'J1939TP'):
        config = {
            'busid': 0,
Esempio n. 4
0
File: asdcm.py Progetto: wzugang/as
        return v

    def toarray(self):
        return self.bits.tobytes()


def str2int(sstr):
    if (sstr[:2].lower() == '0x'):
        return int(sstr, 16)
    elif (sstr[:2].lower() == '0b'):
        return int(sstr, 2)
    else:
        return int(sstr, 10)


__dcm__ = dcm(0, 0x732, 0x731)


def switch_to_doip(state):
    global __dcm__

    if (state):
        __dcm__ = dcm('172.18.0.200', 8989)
        print("switch to UDS on DoIP mode")
    else:
        __dcm__ = dcm(0, 0x732, 0x731)
        print("switch to UDS on CAN mode")


def Dcm_TransmitMessage(req):
    ercd, res = __dcm__.transmit(req)
Esempio n. 5
0
        return v

    def toarray(self):
        return self.bits.tobytes()


def str2int(sstr):
    if (sstr[:2].lower() == '0x'):
        return int(sstr, 16)
    elif (sstr[:2].lower() == '0b'):
        return int(sstr, 2)
    else:
        return int(sstr, 10)


__dcm__ = dcm(protocal='CAN', busid=DFTBUS, rxid=0x732, txid=0x731)


def switch_to_protocol(protocol):
    global __dcm__

    if (protocol == 'DOIP'):
        if (os.getenv('DOIP_IP')):
            ip = os.getenv('DOIP_IP')
        else:
            ip = '172.18.0.200'
        __dcm__ = dcm(protocal='DOIP', ip=ip, port=8989)
        print("switch to UDS on DoIP mode on %s:8989" % (ip))
    elif (protocol == 'J1939TP'):
        config = {
            'busid': 0,