- removed the encoder's "Mode" selector (drop-down list)
- updated libm17
- added codec2-mod submodule
pull/29/head
Wojciech Kaczmarski 2026-01-24 17:31:34 +01:00
parent dc372e0dbc
commit 028970512a
10 changed files with 33 additions and 24 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "tinier-aes"]
path = tinier-aes
url = https://github.com/lwvmobile/tinier-aes
[submodule "codec2-mod"]
path = codec2-mod
url = https://github.com/M17-Project/Codec2-mod

1
codec2-mod 160000

@ -0,0 +1 @@
Subproject commit 680a0b192ca114770cfe3af65226aaace2b3aacb

View File

@ -10,13 +10,7 @@ parameters:
- id: dst_id
label: Destination callsign
dtype: string
default: 'ALL'
- id: mode
label: Mode
dtype: int
default: 1
options: [1, 0]
option_labels: ['Stream', 'Packet']
default: '@ALL'
- id: type
label: Type
dtype: int
@ -84,12 +78,11 @@ asserts:
- ${ len(src_id) < 10 }
templates:
imports: from gnuradio import m17
make: m17.m17_coder(${src_id},${dst_id},${mode},${type},${encr_type},${encr_subtype},${aes_subtype},${can},${meta},${key},${priv_key},${debug},${signed_str},${seed},${eot_cnt})
make: m17.m17_coder(${src_id},${dst_id},${type},${encr_type},${encr_subtype},${aes_subtype},${can},${meta},${key},${priv_key},${debug},${signed_str},${seed},${eot_cnt})
callbacks:
- set_meta(${meta})
- set_src_id(${src_id})
- set_dst_id(${dst_id})
- set_mode(${mode})
- set_type(${type})
- set_encr_type(${encr_type})
- set_encr_subtype(${encr_subtype})

View File

@ -41,7 +41,7 @@ namespace gr
* class. m17::m17_coder::make is the public interface for
* creating new instances.
*/
static sptr make (std::string src_id, std::string dst_id, int mode,
static sptr make (std::string src_id, std::string dst_id,
int data, int encr_type, int encr_subtype, int aes_subtype, int can,
std::string meta, std::string key,
std::string priv_key, bool debug, bool signed_str, std::string seed, int eot_cnt);

View File

@ -32,6 +32,17 @@ list(APPEND m17_sources
../libm17/phy/slice.c
../micro-ecc/uECC.c
../tinier-aes/aes.c
../codec2-mod/src/analysis.c
../codec2-mod/src/codec2_mod.c
../codec2-mod/src/delta_lsp_cb.c
../codec2-mod/src/interp.c
../codec2-mod/src/kiss_fft.c
../codec2-mod/src/kiss_fftr.c
../codec2-mod/src/lpc.c
../codec2-mod/src/nlp.c
../codec2-mod/src/quantise.c
../codec2-mod/src/synthesis.c
../codec2-mod/src/util.c
)
set(m17_sources "${m17_sources}" PARENT_SCOPE)
@ -47,6 +58,7 @@ target_include_directories(gnuradio-m17
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../libm17/>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../micro-ecc/>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../tinier-aes/>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../codec2-mod/inc/>
PUBLIC $<INSTALL_INTERFACE:include>
)
set_target_properties(gnuradio-m17 PROPERTIES DEFINE_SYMBOL "gnuradio_m17_EXPORTS")

View File

@ -36,12 +36,12 @@ namespace gr
{
m17_coder::sptr
m17_coder::make(std::string src_id, std::string dst_id, int mode,
m17_coder::make(std::string src_id, std::string dst_id,
int data, int encr_type, int encr_subtype, int aes_subtype, int can,
std::string meta, std::string key,
std::string priv_key, bool debug, bool signed_str, std::string seed, int eot_cnt)
{
return gnuradio::get_initial_sptr(new m17_coder_impl(src_id, dst_id, mode, data, encr_type, encr_subtype,
return gnuradio::get_initial_sptr(new m17_coder_impl(src_id, dst_id, data, encr_type, encr_subtype,
aes_subtype, can, meta, key, priv_key, debug, signed_str, seed, eot_cnt));
}
@ -49,18 +49,18 @@ namespace gr
* The private constructor
*/
m17_coder_impl::m17_coder_impl(std::string src_id, std::string dst_id,
int mode, int data, int encr_type,
int data, int encr_type,
int encr_subtype, int aes_subtype, int can,
std::string meta, std::string key,
std::string priv_key, bool debug,
bool signed_str, std::string seed,
int eot_cnt) : gr::block("m17_coder", gr::io_signature::make(1, 1, sizeof(char)),
gr::io_signature::make(1, 1, sizeof(float))),
_mode(mode), _data(data), _encr_subtype(encr_subtype), _aes_subtype(aes_subtype), _can(can), _meta(meta), _debug(debug),
_data(data), _encr_subtype(encr_subtype), _aes_subtype(aes_subtype), _can(can), _meta(meta), _debug(debug),
_signed_str(signed_str), _eot_cnt(eot_cnt)
{
set_encr_type(encr_type); // overwritten by set_seed()
set_type(mode, data, _encr_type, encr_subtype, can);
set_type(M17_TYPE_STREAM, data, _encr_type, encr_subtype, can); // default mode: STREAM
set_aes_subtype(aes_subtype, encr_type);
set_meta(meta); // depends on ^^^ encr_subtype
set_seed(seed); // depends on ^^^ encr_subtype
@ -94,10 +94,10 @@ namespace gr
if (_debug == true && _got_lsf != 0)
{
// destination set to "@ALL"
encode_callsign_bytes(_lsf.dst, (const unsigned char *)"@ALL");
encode_callsign_bytes(_lsf.dst, "@ALL");
// source set to "N0CALL"
encode_callsign_bytes(_lsf.src, (const unsigned char *)"N0CALL");
encode_callsign_bytes(_lsf.src, "N0CALL");
// no enc or subtype field, normal 3200 voice
_type = M17_TYPE_STREAM | M17_TYPE_VOICE | M17_TYPE_CAN(0);
@ -518,7 +518,7 @@ namespace gr
_lsf.crc[1] = ccrc & 0xFF;
}
void m17_coder_impl::set_mode(int mode) // TODO: the packet/stream selector is not needed
void m17_coder_impl::set_mode(int mode)
{
_mode = mode;
fprintf(stderr, "Mode: %s\n", _mode==M17_TYPE_STREAM ? "stream" : "packet");

View File

@ -26,7 +26,7 @@ namespace gr
// M17
static constexpr int PAYLOAD_BYTES = 16;
unsigned char _src_id[10], _dst_id[10]; // 9 character callsign
char _src_id[10], _dst_id[10]; // 9 character callsign
int _mode, _data;
uint16_t _type;
uint16_t _send_preamble;
@ -101,7 +101,7 @@ namespace gr
void switch_state(const pmt::pmt_t &msg);
void init_state(void);
m17_coder_impl(std::string src_id, std::string dst_id, int mode,
m17_coder_impl(std::string src_id, std::string dst_id,
int data, int encr_type, int encr_subtype, int aes_subtype, int can,
std::string meta, std::string key, std::string priv_key,
bool debug, bool signed_str, std::string seed, int eot_cnt);

View File

@ -70,7 +70,7 @@ namespace gr
uint8_t flp = 0; // stream rame=0, LSF=1, packet frame=2
uint8_t pushed; // counter for pushed symbols
uint8_t d_dst[12], d_src[12]; // decoded strings
char d_dst[12], d_src[12]; // decoded strings
// Scrambler
uint8_t _seed[3]; // 24-bit is the largest seed value

2
libm17

@ -1 +1 @@
Subproject commit 30adfc26d5234de6336c88171cba5f12fee38d74
Subproject commit 0f84226f5a284610d565d52447867f26c6ca4da7

View File

@ -16,7 +16,7 @@
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(m17_coder.h) */
/* BINDTOOL_HEADER_FILE_HASH(2690c4b264dc459afcdb3426e88ece4d) */
/* BINDTOOL_HEADER_FILE_HASH(43530644f92aa11caba04852f7d00a76) */
/***********************************************************************************/
#include <pybind11/complex.h>
@ -37,7 +37,7 @@ void bind_m17_coder(py::module &m) {
m, "m17_coder", D(m17_coder))
.def(py::init(&m17_coder::make), py::arg("src_id"), py::arg("dst_id"),
py::arg("mode"), py::arg("data"), py::arg("encr_type"),
py::arg("data"), py::arg("encr_type"),
py::arg("encr_subtype"), py::arg("aes_subtype"), py::arg("can"),
py::arg("meta"), py::arg("key"), py::arg("priv_key"),
py::arg("debug"), py::arg("signed_str"), py::arg("seed"),