Esempio n. 1
0
aut     : authentication
loc     : location
com     : commonly
get     : get
info    : information
attr    : attribute
"""
# 协议定义的数据id代表的消息类型
MSG_ID_ORIGINAL = pattern(
    ('0x01', 'load_car'),
    ('0x02', 'actual_msg_report'),
    ('0x03', 'reissue_msg_report'),
    ('0x04', 'logout_car'),
    ('0x07', 'heartbeat'),
    ('0x08', 'ter_cor_time'),
    ('0x09', 'err_return'),
    ('0xDB', 'ter_register'),
)
"""
change the MSG_ID_ORIGINAL Dicts key
example1: 0x0100 --> (1,0)
example2: 0100 --> (1,2)
"""
MSG_ID = dns_key(MSG_ID_ORIGINAL)
SYS_ID = dns_k2v(MSG_ID)

if __name__ == '__main__':
    print 'MSG_ID       :', MSG_ID
    print 'SYSTEM_CMD   :', SYSTEM_CMD
    print 'SYS_ID       :', SYS_ID
Esempio n. 2
0
loc     : location
com     : commonly
get     : get
info    : information
attr    : attribute
"""
MSG_ID_ORIGINAL = pattern(
        ('0x0100', 'ter_reg_req'),
        ('0x8100', 'ser_reg_rsp'),
        ('0x0102', 'ter_aut_req'),
        ('0x8001', 'ser_com_rsp'),
        ('0x0200', 'position'),
        ('0x8104', 'get_ter_info'),
        ('0x0104', 'get_ter_info_rsp'),
        ('0x8107', 'get_ter_attr'),
        ('0x0107', 'get_ter_attr_rsp')
)

"""
change the MSG_ID_ORIGINAL Dicts key
example1: 0x0100 --> (1,0)
example2: 0100 --> (1,2)
"""
MSG_ID = dns_key(MSG_ID_ORIGINAL)
SYS_ID = dns_k2v(MSG_ID)

if __name__ == '__main__':
    print 'MSG_ID       :', MSG_ID
    print 'SYSTEM_CMD   :', SYSTEM_CMD
    print 'SYS_ID       :', SYS_ID