No Description

data2obj.py 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #! /usr/bin/env python
  2. import sys
  3. msg_id=int(str(sys.argv[1]),0) & 0x1FFFFFFF
  4. msg_prio=msg_id>>26
  5. msg_type=(msg_id>>24) & 0x03
  6. msg_dst=(msg_id>>16) & 0xFF
  7. msg_src=(msg_id>>8) & 0xFF
  8. msg_cmd=msg_id & 0xFF
  9. #print('id: {0:b}'.format(msg_id))
  10. print('id: {0:#010x} {0:#031b}'.format(msg_id ,msg_id))
  11. #print("id:", hex(msg_id), format(40,str(bin(msg_id))))
  12. print('prio: {0:#03x} {0:#04b}'.format(msg_prio))
  13. print('type: {0:#03x} {0:#04b}'.format(msg_type))
  14. print('dst: {0:#04x} {0:#010b}'.format(msg_dst))
  15. print('src: {0:#04x} {0:#010b}'.format(msg_src))
  16. print('cmd: {0:#04x} {0:#010b}'.format(msg_cmd))
  17. nmsg_prio=msg_id>>26
  18. nmsg_type=(msg_id>>24) & 0x03
  19. nmsg_src=(msg_id>>18) & 0x3F
  20. nmsg_dst=(msg_id>>12) & 0x3F
  21. nmsg_targ=(msg_id>>6) & 0x3F
  22. nmsg_cmd=msg_id & 0x1F
  23. print('New schema')
  24. #print('id: {0:b}'.format(msg_id))
  25. print('id: {0:#010x} {0:#031b}'.format(msg_id))
  26. #print("id:", hex(msg_id), format(40,str(bin(msg_id))))
  27. print('prio: {0:#04x} {0:#04b}'.format(nmsg_prio))
  28. print('type: {0:#04x} {0:#04b}'.format(nmsg_type))
  29. print('src: {0:#04x} {0:#08b}'.format(nmsg_src))
  30. print('dst: {0:#04x} {0:#08b}'.format(nmsg_dst))
  31. print('target: {0:#04x} {0:#08b}'.format(nmsg_targ))
  32. print('cmd: {0:#04x} {0:#07b}'.format(nmsg_cmd))