Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI tools for parsing data #2

Closed
2 tasks done
smarek opened this issue Nov 24, 2021 · 3 comments
Closed
2 tasks done

Add CLI tools for parsing data #2

smarek opened this issue Nov 24, 2021 · 3 comments

Comments

@smarek
Copy link
Member

smarek commented Nov 24, 2021

  • Add CLI access tools for each protocol implemented
  • Export scripts in setup.py

Eg. what can be now done like this (running from root of Hytera_Homebrew_Bridge)

$ python3 -m hytera_homebrew_bridge.tests.hdap_single_packet 0980a10022000000010a01b2070a03640e4f004c004900560045005200200054004500530054007a03
{'checksum': 122,
 'data': {'_m_option_sum_len': 0,
          'ack_flag': <AckFlags.ack_not_required: 1>,
          'destination_ip': {'radio_id_1': 1,
                             'radio_id_2': 178,
                             'radio_id_3': 7,
                             'subnet': 10},
          'message_length': 34,
          'option_flag': <OptionFlags.option_len_and_field_disabled: 0>,
          'request_id': 1,
          'reserved': 0,
          'service_type': <ServiceTypes.send_private_message: 161>,
          'source_ip': {'radio_id_1': 3,
                        'radio_id_2': 100,
                        'radio_id_3': 14,
                        'subnet': 10},
          'tmdata': 'OLIVER TEST'},
 'message_footer': b'\x03',
 'message_header': <MessageHeaderTypes.text_message_protocol: 9>}

Should be doable like this, for example

  • dmr-kaitai-hdap 0980a10022000000010a01b2070a03640e4f004c004900560045005200200054004500530054007a03
  • or like this
  • dmr-kaitai --hdap 0980a10022000000010a01b2070a03640e4f004c004900560045005200200054004500530054007a03
@smarek smarek closed this as completed in 88f4ae0 Jun 28, 2022
@smarek
Copy link
Member Author

smarek commented Jun 28, 2022

Final commands are documented in the README, per example in previous post looks currently (with v1.0) like this:

> debug-hytera-hdap 0980a10022000000010a01b2070a03640e4f004c004900560045005200200054004500530054007a03
{'checksum': 122,
 'data': {'_m_option_sum_len': 0,
          'ack_flag': <AckFlags.ack_not_required: 1>,
          'destination_ip': {'radio_id_1': 1,
                             'radio_id_2': 178,
                             'radio_id_3': 7,
                             'subnet': 10},
          'message_length': 34,
          'option_flag': <OptionFlags.option_len_and_field_disabled: 0>,
          'request_id': 1,
          'reserved': 0,
          'service_type': <ServiceTypes.send_private_message: 161>,
          'source_ip': {'radio_id_1': 3,
                        'radio_id_2': 100,
                        'radio_id_3': 14,
                        'subnet': 10},
          'tmdata': 'OLIVER TEST'},
 'is_reliable_message': False,
 'message_footer': b'\x03',
 'message_header': <MessageHeaderTypes.text_message_protocol: 9>}

@kevsgithub
Copy link

kevsgithub commented Jul 4, 2022 via email

@smarek
Copy link
Member Author

smarek commented Jul 5, 2022

see https://github.com/OK-DMR/ok-dmrlib/blob/master/okdmr/dmrlib/hytera/pdu/hdap.py#L46

dmr-kaitai is only dissector/disassembler, it does verify only the basics (pdu structure, fields order and length, ...)
ok-dmrlib is where protocol assembling, checksums and others are done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants