dmr_utils/README.rst
2016-12-03 18:28:06 -06:00

67 lines
3.8 KiB
ReStructuredText

dmr_utils
_________
Utilities for working with Digital Moble Radio (DMR) in python. Includes routines for assembling and disasembling packets and encoding/removing FEC/ECC routines. The utilities are intended primarily for processing on the "network" side of DMR, not the air interface -- such as for building network linking tools, and as such, routines mostly remove FEC/ECC rather than appy repeairs, which should be done at the air interface first.
**Files in this repository and what they do**
const.py
A number of constant values that are handy for working with DMR. Just look through the file. Some are hex strings, some are bitarrays. Some are straight objects, and in cases where there are related data sets you'll find dictionaries.
utils.py
There are currently two parts of utils.py. One part is about converting integer an hex values (usually radio and group IDs, etc.) back and forth. Radio IDs, etc. are always transmitted and recieved as hex strings, but that makes them hard to work with in other ways. The other part is about creating dictionaries that can be used to lookup subscriber, peer, and talkgroup IDs and turn them into friendly names.
- **hex_str_2(_int_id):** Returns a 2-byte (with leading zeros) hex string representation of a 2-byte *_int_id*.
- **hex_str_3(_int_id):** Returns a 3-byte (with leading zeros) hex string representation of a 3-byte *_int_id*.
- **hex_str_4(_int_id):** Returns a 4-byte (with leading zeros) hex string representation of a 4-byte *_int_id*.
- **int_id(_hex_string):** Returns an integer version of a supplied *_hex_string*.
- **try_download(_path, _file, _url, _stale):** Download a new *_file* from *_url* and save it at the right *_path* if the existing file isn't there or is older than *_stale* in seconds. It is expected that this is a .csv file downloaded from DMR-MARC.
- **mk_id_dict(_path, _file:** Make an ID dictionary from the *_file* located on the *_path*. Returns a dictionary.
- **get_info(_id, _dict):** Get the *_id* from the *_dict*, where *_id* is expected to be an integer. Returns an integer.
- **get_alias(_id, _dict):** Get the *_id* from the *_dict*, where *_id* is a hex string. Returns an integer.
encode.py
There is nothing in this file yet.
decode.py
some stuff
btpc.py
Contains block product turbo code generators, extractors and related routines
- **decode_full_lc(_data):** Extracts the useful FULL LC data without checking for errors. Accepts one argument of type bitarray and returns one item of type bitarray.
- **interleave_19696(_data):** Accepts one argument of type bitarray and returns a bitarray interlieaved.
- **encode_19696(_data):** Accepts an LC as a 12-byte string (LC and RS1293 FEC) encodes it into a 196bit bitarray and builds the proper row and column structure with hamming codes and returns a type bitarray
- **encode_header_lc(_lc):** Accpets LC data as a bitarray, applies the header mask and appends RS1293 FEC, encodes BPTC19696, interleaves for transmition. Returns a type bitarray that is the full DMR LC header packet.
- **encode_terminator_ls(_lc):** Accepts LC data as a bitarray, applies the terminator mask and appends RS1293 FEC, encodes BPTC19696, interleaves for transmition. Returns a type bitarray that is the full DMR LC terminator packet.
- **decode_emblc(_elc):** Extracts the useful EMBEDDED LC data without checking for errors. Accepts a type bitarray and returns type string.
- **encode_emblc(_lc):** Accepts 12 byte LC as a string, adds 5-byte checksum, adds row hamming bits, column partiy bits and arranges the matrix for transmission. Returns a type dict with 4 key/value pairs. Keys 1-4 are DMR bursts b-e respectively, such that burst "B" is key 1's associated value and so on.
crc.py
some stuff
rs129.py
some stuff
golay.py
some stuff
hamming.py
some stuff
qr.py
some stuff