decoder: added message output

src, dst, type, meta
pull/25/head
Wojciech Kaczmarski 2025-08-18 14:20:03 +02:00
parent 7742664cc0
commit a10640c60c
4 changed files with 46 additions and 7 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.pyo
build*/
examples/*.py
.vscode/*

View File

@ -178,9 +178,24 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [960, 228.0]
coordinate: [960, 212.0]
rotation: 0
state: disabled
- name: blocks_message_debug_0
id: blocks_message_debug
parameters:
affinity: ''
alias: ''
comment: ''
en_uvec: 'True'
log_level: info
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [960, 304.0]
rotation: 0
state: enabled
- name: blocks_null_sink_0
id: blocks_null_sink
parameters:
@ -195,7 +210,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [960, 192.0]
coordinate: [960, 168.0]
rotation: 0
state: enabled
- name: blocks_throttle2_0
@ -294,8 +309,8 @@ blocks:
alias: ''
callsign: 'True'
comment: ''
debug_ctrl: 'True'
debug_data: 'True'
debug_ctrl: 'False'
debug_data: 'False'
encr_type: '0'
key: ''
maxoutbuf: '0'
@ -417,6 +432,7 @@ connections:
- [m17_m17_coder_0, '0', blocks_add_xx_0, '0']
- [m17_m17_decoder_0, '0', blocks_file_sink_0, '0']
- [m17_m17_decoder_0, '0', blocks_null_sink_0, '0']
- [m17_m17_decoder_0, fields, blocks_message_debug_0, print]
metadata:
file_format: 1

View File

@ -79,6 +79,11 @@ outputs:
dtype: byte
vlen: 1
optional: 0
- label: fields
domain: message
id: fields
type: message
optional: true
documentation: |-
The decoder block accepts two boolean debugging flags defining which messages are displayed in the console when messages are received, and a threshold parameter. The threshold defines a value below which the incoming message is detected. It is based on the Euclidean distance (L^2 norm) between the received symbol stream and protocol-defined syncronization patterns. Ideally, the distance would reach 0.0 for an ideal match. A default threshold value of 2.0 is selected.

View File

@ -67,6 +67,8 @@ namespace gr
set_key(key);
set_encr_type(encr_type);
_expected_next_fn = 0;
message_port_register_out(pmt::mp("fields"));
}
/*
@ -216,7 +218,7 @@ namespace gr
m17_decoder_impl::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
ninput_items_required[0] = 1; // noutput_items;
ninput_items_required[0] = 1; // do work only if there is at least one symbol available
}
// this is generating a correct seed value based on the fn value,
@ -541,10 +543,25 @@ namespace gr
// debug - dump LICH
if (lich_chunks_rcvd == 0x3F) // all 6 chunks received?
{
// handle message output
pmt::pmt_t msg;
decode_callsign_bytes(d_dst, _lsf.dst);
decode_callsign_bytes(d_src, _lsf.src);
pmt::pmt_t dict = pmt::make_dict();
dict = pmt::dict_add(dict, pmt::mp("src"), pmt::intern((char *)d_src));
dict = pmt::dict_add(dict, pmt::mp("dst"), pmt::intern((char *)d_dst));
msg = pmt::init_u8vector(2, _lsf.type);
dict = pmt::dict_add(dict, pmt::mp("type"), msg);
msg = pmt::init_u8vector(14, _lsf.meta);
dict = pmt::dict_add(dict, pmt::mp("meta"), msg);
message_port_pub(pmt::mp("fields"), dict);
// debug data display
if (_callsign == true)
{
decode_callsign_bytes(d_dst, _lsf.dst);
decode_callsign_bytes(d_src, _lsf.src);
if (_debug_ctrl == true)
{
printf("DST: %-9s ", d_dst); // DST