ok-dmrlib


Nameok-dmrlib JSON
Version 0.8.0 PyPI version JSON
download
home_page
SummaryDMR PDUs, elements, FEC and CRC library, including proprietary DMR protocols of Hytera and Motorola
upload_time2023-04-23 08:44:34
maintainer
docs_urlNone
author
requires_python>=3.8
licenseAGPL-3.0
keywords dmr etsi ham homebrew hytera mmdvm motorola radio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OK-DMR Lib

[![.github/workflows/sanity.yml](https://img.shields.io/github/actions/workflow/status/OK-DMR/ok-dmrlib/sanity.yml?style=flat-square&branch=master)](https://github.com/OK-DMR/ok-dmrlib/actions)
[![Code Style: Python Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
[![License](https://img.shields.io/github/license/OK-DMR/ok-dmrlib?style=flat-square)](https://github.com/OK-DMR/ok-dmrlib/blob/master/LICENSE)
[![Last released version](https://img.shields.io/pypi/v/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/)
[![PyPI downloads](https://img.shields.io/pypi/dd/ok-dmrlib?style=flat-square)](https://libraries.io/pypi/ok-dmrlib)
[![Python versions](https://img.shields.io/pypi/pyversions/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/)
[![Wheel](https://img.shields.io/pypi/wheel/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/#files)
[![Codecov](https://img.shields.io/codecov/c/github/ok-dmr/ok-dmrlib?style=flat-square)](https://app.codecov.io/gh/OK-DMR/ok-dmrlib)

This package provides way to parse and assemble various DMR ETSI protocols and functions, in pure Python implementation

## Supported features

### FEC (Forward Error Correction)

| Algorithm                                           | Encoding | Decoding / Verification |
|-----------------------------------------------------|:--------:|:-----------------------:|
| Hamming (7,4,3)                                     |    ✅     |            ✅            |
| Hamming (13,9,3)                                    |    ✅     |            ✅            |
| Hamming (15,11,3)                                   |    ✅     |            ✅            |
| Hamming (16,11,3)                                   |    ✅     |            ✅            |
| Hamming (17,12,3)                                   |    ✅     |            ✅            |
| Golay (20,8,7)                                      |    ✅     |            ✅            |
| Quadratic Residue (16,7,6)                          |    ✅     |            ✅            |
| Reed-Solomon (12,9,4)                               |    ✅     |            ✅            |
| Rate 3/4 Trellis                                    |    ✅     |            ✅            |
| Block Product Turbo Code (196,96)                   |    ✅     |            ✅            |
| Variable length BPTC (BPTC 128,72)                  |    ✅     |            ✅            |
| Variable length BPTC (BPTC 68,28) for CACH/Short LC |    ✅     |            ✅            |
| Variable length BTPC (BPTC 32,11) for Single-Burst  |    ✅     |            ✅            |

### CRC (Cyclic Redundancy Check) and Checksums

| Name                  | Generate | Verify |
|-----------------------|:--------:|:------:|
| 5-bit checksum        |    ✅     |   ✅    |
| CRC-8 (8-bit CRC)     |    ✅     |   ✅    |
| CRC-9                 |    ✅     |   ✅    |
| CRC-CCIT (CRC16-CCIT) |    ✅     |   ✅    |
| CRC-32 (32-bit CRC)   |    ✅     |   ✅    |

### ETSI PDUs (Protocol Data Units)

| Name                    | Encoding / Decoding | Description                                                                                                                | 
|-------------------------|:-------------------:|----------------------------------------------------------------------------------------------------------------------------|
| CSBK                    |          ✅          | Control Signalling Block, namely: BS Outbound Activation, Unit-Unit Request/Answer, Negative ACK, Preamble, Channel Timing |
| EMB                     |          ✅          | Embedded Signalling                                                                                                        |
| FULL LC            |          ✅          | Full Link Control, namely: Group Voice, Unit-Unit, Talker Alias (header + blocks1,2,3), GPSInfo, Terminator with LC        |
| SHORT LC           |          ✅          | Short Link Control, namely: Activity, Null                                                                                 |
| SLOT                    |          ✅          | Slot Type                                                                                                                  |
| SYNC                    |          ✅          | Synchronization patterns                                                                                                   |
| Data Header        |          ✅          | Confirmed/Unconfirmed, Response, Defined Short Data                                                                        |
| PI Header          |          ✅          | Privacy (PI) Header, without further understanding of transported data                                                     |
| Rate 1 Data   |          ✅          | Rate 1 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                    |
| Rate 1/2 Data |          ✅          | Rate 1/2 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                  |
| Rate 3/4 Data |          ✅          | Rate 3/4 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                  |
| Full/Short Link Control |          ✅          | FLC/SLC PDUs                                                                                                               |
| UDP/IPv4                |          ✅          | UDP/IPv4 compressed header/packet                                                                                          |

### ETSI Information Elements

All listed elements are supported as standalone enum/class representation, which allows for decoding/encoding and
describing data (discovery):

Access Types (AT), CRC Mask, CSBKO (CSBK Opcode), DPF (Data Packet Format), DT (Data Type), FID (Feature Set ID), FLCO (
Full LC Opcode), LCSS (LC Start/Stop), PI (Pre-emption and power control indicator), SLCO (Short LC Opcode), SYNC (
Synchronization pattern), Activity ID, Additional Information Field, Answer/Response, CTO (Channel Timing Opcode), DI (
Dynamic Identifier), Position Error, Reason Code, Service Options, Talker Alias Data Format, Defined Data Format (DD),
Selective Automatic Repeat reQuest (SARQ),
Re-Synchronize Flag (S), Send sequence number (N(S)), SAP identifier (SAP), Supplementary Flag (SF), Unified Data
Transport Format (UDT Format), UDP Port Identifier (SPID/DPID), IP Address Identifier (SAID/DAID)

### Hytera

| Protocol Name                                        | Encoding / Decoding | 
|------------------------------------------------------|:-------------------:|
| Hytera Simple Transport Reliability Protocol (HSTRP) |          ✅          |
| Hytera Radio Network Protocol (HRNP)                 |          ✅          |
| Hytera DMR Application Protocol (HDAP)               |          ✅          |
| Radio Registration Service (RRS)                     |          ✅          |
| Location Protocol (LP)                               |          ✅          |
| Radio Control Protocol (RCP)                         |          ✅          |
| Text Message Protocol (TMP)                          |          ✅          |

- Not all opcodes in all protocols are implemented, however it will fail with descriptive message, which opcode is
  missing in particular operation (decoding, description, encoding)

### Motorola

| Protocol Name                             | Encoding / Decoding | 
|-------------------------------------------|:-------------------:|
| Location Request Response Protocol (LRRP) |          ✅          |
| Automatic Registration Service (ARS)      |          ✅          |
| Text Messaging Service (TMS)              |          ✅          |

- Motorola has MBXML (Motorola Binary XML) which is used to represent LRRP/ARRP documents, ok-dmrlib contains abstract
  MBXML implementation with various tools, LRRP implementation tested with both examples and real-world data
- LRRP is supported as `[bytes] <-> [mbxml document(s)] -> [xml representation]`, currently serialization of xml
  document to bytes is not supported
- There are some catches, when you want to serialize MBXML token with common name, look through the test_mbxml and
  test_lrrp modules, to see how to select specific (correct) token programatically

### Available CLI tools

- dmrlib-pcap-tool - PCAP/PCAPNG traffic description and data extraction
- dmrlib-dmr-burst - Describe full Tier-II burst (33 bytes)
- dmrlib-dmr-header - Describe DMR Data Header
- dmrlib-dmr-ipudp - Describe DMR UDP/IPv4 Compressed data (header + user payload)
- dmrlib-hytera-hstrp - Hytera Simple Transport Protocol
- dmrlib-hytera-hdap - Hytera DMR Application Protocol
- dmrlib-hytera-hrnp - Hytera Radio Network Protocol
- dmrlib-hytera-lp - Hytera Location Protocol
- dmrlib-hytera-rcp - Hytera Radio Control Protocol
- dmrlib-hytera-rrs - Hytera Radio Registration Service
- dmrlib-hytera-tmp - Hytera Text Message Protocol

### Additional notes

- Almost every class/enum supports BitsInterface (de-serialization from on-air bits, serialization to transmission bits)
  , or for byte-aligned protocols (Hytera, Motorola) BytesInterface (with explicit endianness support)
- Every FEC/CRC implemented supports both calculation, verification and (if possible) also self-correction
- Working with Vocoder and Data/Control Bursts is supported, along with handling rates 1, 1/2 and 3/4
- CRCs interface classes may require appropriate CRC Mask to be provided when generating or verifying
- Through [dmr-kaitai](https://github.com/ok-dmr/dmr-kaitai) handling of ETSI, Hytera and MMDVM/Homebrew UDP data is
  supported
- To inspect on-wire traffic PcapTool (provided in cli as `dmrlib-pcap-tool` script) supports PCAP/PCAPNG files with
  various functions on describing bursts, port/data filtering, data extraction, ...
- Everything is tested, specifically now we have 95% pytest coverage for whole ok-dmrlib codebase
- Not everything is probably documented as it should be, but the usage should always be very clear, when you look at
  tests of particular component

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ok-dmrlib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "dmr,etsi,ham,homebrew,hytera,mmdvm,motorola,radio",
    "author": "",
    "author_email": "Marek Sebera <marek.sebera@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cc/c4/bc4e10c6607d5c8423ae3c7b63c328fd9f42f6968359e1e088f8f8f063db/ok_dmrlib-0.8.0.tar.gz",
    "platform": null,
    "description": "# OK-DMR Lib\n\n[![.github/workflows/sanity.yml](https://img.shields.io/github/actions/workflow/status/OK-DMR/ok-dmrlib/sanity.yml?style=flat-square&branch=master)](https://github.com/OK-DMR/ok-dmrlib/actions)\n[![Code Style: Python Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n[![License](https://img.shields.io/github/license/OK-DMR/ok-dmrlib?style=flat-square)](https://github.com/OK-DMR/ok-dmrlib/blob/master/LICENSE)\n[![Last released version](https://img.shields.io/pypi/v/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/)\n[![PyPI downloads](https://img.shields.io/pypi/dd/ok-dmrlib?style=flat-square)](https://libraries.io/pypi/ok-dmrlib)\n[![Python versions](https://img.shields.io/pypi/pyversions/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/)\n[![Wheel](https://img.shields.io/pypi/wheel/ok-dmrlib?style=flat-square)](https://pypi.org/project/ok-dmrlib/#files)\n[![Codecov](https://img.shields.io/codecov/c/github/ok-dmr/ok-dmrlib?style=flat-square)](https://app.codecov.io/gh/OK-DMR/ok-dmrlib)\n\nThis package provides way to parse and assemble various DMR ETSI protocols and functions, in pure Python implementation\n\n## Supported features\n\n### FEC (Forward Error Correction)\n\n| Algorithm                                           | Encoding | Decoding / Verification |\n|-----------------------------------------------------|:--------:|:-----------------------:|\n| Hamming (7,4,3)                                     |    \u2705     |            \u2705            |\n| Hamming (13,9,3)                                    |    \u2705     |            \u2705            |\n| Hamming (15,11,3)                                   |    \u2705     |            \u2705            |\n| Hamming (16,11,3)                                   |    \u2705     |            \u2705            |\n| Hamming (17,12,3)                                   |    \u2705     |            \u2705            |\n| Golay (20,8,7)                                      |    \u2705     |            \u2705            |\n| Quadratic Residue (16,7,6)                          |    \u2705     |            \u2705            |\n| Reed-Solomon (12,9,4)                               |    \u2705     |            \u2705            |\n| Rate 3/4 Trellis                                    |    \u2705     |            \u2705            |\n| Block Product Turbo Code (196,96)                   |    \u2705     |            \u2705            |\n| Variable length BPTC (BPTC 128,72)                  |    \u2705     |            \u2705            |\n| Variable length BPTC (BPTC 68,28) for CACH/Short LC |    \u2705     |            \u2705            |\n| Variable length BTPC (BPTC 32,11) for Single-Burst  |    \u2705     |            \u2705            |\n\n### CRC (Cyclic Redundancy Check) and Checksums\n\n| Name                  | Generate | Verify |\n|-----------------------|:--------:|:------:|\n| 5-bit checksum        |    \u2705     |   \u2705    |\n| CRC-8 (8-bit CRC)     |    \u2705     |   \u2705    |\n| CRC-9                 |    \u2705     |   \u2705    |\n| CRC-CCIT (CRC16-CCIT) |    \u2705     |   \u2705    |\n| CRC-32 (32-bit CRC)   |    \u2705     |   \u2705    |\n\n### ETSI PDUs (Protocol Data Units)\n\n| Name                    | Encoding / Decoding | Description                                                                                                                | \n|-------------------------|:-------------------:|----------------------------------------------------------------------------------------------------------------------------|\n| CSBK                    |          \u2705          | Control Signalling Block, namely: BS Outbound Activation, Unit-Unit Request/Answer, Negative ACK, Preamble, Channel Timing |\n| EMB                     |          \u2705          | Embedded Signalling                                                                                                        |\n| FULL&nbsp;LC            |          \u2705          | Full Link Control, namely: Group Voice, Unit-Unit, Talker Alias (header + blocks1,2,3), GPSInfo, Terminator with LC        |\n| SHORT&nbsp;LC           |          \u2705          | Short Link Control, namely: Activity, Null                                                                                 |\n| SLOT                    |          \u2705          | Slot Type                                                                                                                  |\n| SYNC                    |          \u2705          | Synchronization patterns                                                                                                   |\n| Data&nbsp;Header        |          \u2705          | Confirmed/Unconfirmed, Response, Defined Short Data                                                                        |\n| PI&nbsp;Header          |          \u2705          | Privacy (PI) Header, without further understanding of transported data                                                     |\n| Rate&nbsp;1&nbsp;Data   |          \u2705          | Rate 1 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                    |\n| Rate&nbsp;1/2&nbsp;Data |          \u2705          | Rate 1/2 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                  |\n| Rate&nbsp;3/4&nbsp;Data |          \u2705          | Rate 3/4 data (confirmed and unconfirmed) and last block data (confirmed and unconfirmed)                                  |\n| Full/Short Link Control |          \u2705          | FLC/SLC PDUs                                                                                                               |\n| UDP/IPv4                |          \u2705          | UDP/IPv4 compressed header/packet                                                                                          |\n\n### ETSI Information Elements\n\nAll listed elements are supported as standalone enum/class representation, which allows for decoding/encoding and\ndescribing data (discovery):\n\nAccess Types (AT), CRC Mask, CSBKO (CSBK Opcode), DPF (Data Packet Format), DT (Data Type), FID (Feature Set ID), FLCO (\nFull LC Opcode), LCSS (LC Start/Stop), PI (Pre-emption and power control indicator), SLCO (Short LC Opcode), SYNC (\nSynchronization pattern), Activity ID, Additional Information Field, Answer/Response, CTO (Channel Timing Opcode), DI (\nDynamic Identifier), Position Error, Reason Code, Service Options, Talker Alias Data Format, Defined Data Format (DD),\nSelective Automatic Repeat reQuest (SARQ),\nRe-Synchronize Flag (S), Send sequence number (N(S)), SAP identifier (SAP), Supplementary Flag (SF), Unified Data\nTransport Format (UDT Format), UDP Port Identifier (SPID/DPID), IP Address Identifier (SAID/DAID)\n\n### Hytera\n\n| Protocol Name                                        | Encoding / Decoding | \n|------------------------------------------------------|:-------------------:|\n| Hytera Simple Transport Reliability Protocol (HSTRP) |          \u2705          |\n| Hytera Radio Network Protocol (HRNP)                 |          \u2705          |\n| Hytera DMR Application Protocol (HDAP)               |          \u2705          |\n| Radio Registration Service (RRS)                     |          \u2705          |\n| Location Protocol (LP)                               |          \u2705          |\n| Radio Control Protocol (RCP)                         |          \u2705          |\n| Text Message Protocol (TMP)                          |          \u2705          |\n\n- Not all opcodes in all protocols are implemented, however it will fail with descriptive message, which opcode is\n  missing in particular operation (decoding, description, encoding)\n\n### Motorola\n\n| Protocol Name                             | Encoding / Decoding | \n|-------------------------------------------|:-------------------:|\n| Location Request Response Protocol (LRRP) |          \u2705          |\n| Automatic Registration Service (ARS)      |          \u2705          |\n| Text Messaging Service (TMS)              |          \u2705          |\n\n- Motorola has MBXML (Motorola Binary XML) which is used to represent LRRP/ARRP documents, ok-dmrlib contains abstract\n  MBXML implementation with various tools, LRRP implementation tested with both examples and real-world data\n- LRRP is supported as `[bytes] <-> [mbxml document(s)] -> [xml representation]`, currently serialization of xml\n  document to bytes is not supported\n- There are some catches, when you want to serialize MBXML token with common name, look through the test_mbxml and\n  test_lrrp modules, to see how to select specific (correct) token programatically\n\n### Available CLI tools\n\n- dmrlib-pcap-tool - PCAP/PCAPNG traffic description and data extraction\n- dmrlib-dmr-burst - Describe full Tier-II burst (33 bytes)\n- dmrlib-dmr-header - Describe DMR Data Header\n- dmrlib-dmr-ipudp - Describe DMR UDP/IPv4 Compressed data (header + user payload)\n- dmrlib-hytera-hstrp - Hytera Simple Transport Protocol\n- dmrlib-hytera-hdap - Hytera DMR Application Protocol\n- dmrlib-hytera-hrnp - Hytera Radio Network Protocol\n- dmrlib-hytera-lp - Hytera Location Protocol\n- dmrlib-hytera-rcp - Hytera Radio Control Protocol\n- dmrlib-hytera-rrs - Hytera Radio Registration Service\n- dmrlib-hytera-tmp - Hytera Text Message Protocol\n\n### Additional notes\n\n- Almost every class/enum supports BitsInterface (de-serialization from on-air bits, serialization to transmission bits)\n  , or for byte-aligned protocols (Hytera, Motorola) BytesInterface (with explicit endianness support)\n- Every FEC/CRC implemented supports both calculation, verification and (if possible) also self-correction\n- Working with Vocoder and Data/Control Bursts is supported, along with handling rates 1, 1/2 and 3/4\n- CRCs interface classes may require appropriate CRC Mask to be provided when generating or verifying\n- Through [dmr-kaitai](https://github.com/ok-dmr/dmr-kaitai) handling of ETSI, Hytera and MMDVM/Homebrew UDP data is\n  supported\n- To inspect on-wire traffic PcapTool (provided in cli as `dmrlib-pcap-tool` script) supports PCAP/PCAPNG files with\n  various functions on describing bursts, port/data filtering, data extraction, ...\n- Everything is tested, specifically now we have 95% pytest coverage for whole ok-dmrlib codebase\n- Not everything is probably documented as it should be, but the usage should always be very clear, when you look at\n  tests of particular component\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0",
    "summary": "DMR PDUs, elements, FEC and CRC library, including proprietary DMR protocols of Hytera and Motorola",
    "version": "0.8.0",
    "split_keywords": [
        "dmr",
        "etsi",
        "ham",
        "homebrew",
        "hytera",
        "mmdvm",
        "motorola",
        "radio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c8c632c68306eefff69093d1e55f1180d8bc22a5f2acd6641e7b037cdfac2c5",
                "md5": "d252033575817a9c47b2319c5966e567",
                "sha256": "2cc08ca46b3badca5f98edcfdc78ebb7bad9583d14d4c654252776a29e7221c1"
            },
            "downloads": -1,
            "filename": "ok_dmrlib-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d252033575817a9c47b2319c5966e567",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 235992,
            "upload_time": "2023-04-23T08:44:31",
            "upload_time_iso_8601": "2023-04-23T08:44:31.666016Z",
            "url": "https://files.pythonhosted.org/packages/3c/8c/632c68306eefff69093d1e55f1180d8bc22a5f2acd6641e7b037cdfac2c5/ok_dmrlib-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccc4bc4e10c6607d5c8423ae3c7b63c328fd9f42f6968359e1e088f8f8f063db",
                "md5": "e5428293f474f2f2a352891b4a78f4b2",
                "sha256": "3138becf1450a4c117445b45f2d2544793429ef836769db63687d356c7b8ee72"
            },
            "downloads": -1,
            "filename": "ok_dmrlib-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e5428293f474f2f2a352891b4a78f4b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 107925,
            "upload_time": "2023-04-23T08:44:34",
            "upload_time_iso_8601": "2023-04-23T08:44:34.019644Z",
            "url": "https://files.pythonhosted.org/packages/cc/c4/bc4e10c6607d5c8423ae3c7b63c328fd9f42f6968359e1e088f8f8f063db/ok_dmrlib-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-23 08:44:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ok-dmrlib"
}
        
Elapsed time: 0.05891s