SignedStr on decoder
parent
e1c8bf73f8
commit
434391fef3
|
@ -1 +1 @@
|
|||
Subproject commit 3bfe8ae61d4b4763bf515413bcaff635df3e1850
|
||||
Subproject commit 32b63ff74eb554392e85c5caf700d400006a616d
|
|
@ -336,12 +336,13 @@ blocks:
|
|||
debug_data: 'True'
|
||||
maxoutbuf: '0'
|
||||
minoutbuf: '0'
|
||||
signed_str: 'False'
|
||||
threshold: '2.0'
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [784, 152.0]
|
||||
coordinate: [784, 144.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: note_0_2
|
||||
|
|
|
@ -42,7 +42,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [192, 12.0]
|
||||
coordinate: [8, 128.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: blocks_file_sink_0
|
||||
|
@ -60,7 +60,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [600, 104.0]
|
||||
coordinate: [592, 56.0]
|
||||
rotation: 0
|
||||
state: disabled
|
||||
- name: blocks_file_source_0
|
||||
|
@ -84,7 +84,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [192, 88.0]
|
||||
coordinate: [176, 40.0]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
- name: blocks_null_sink_0
|
||||
|
@ -101,7 +101,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [616, 64.0]
|
||||
coordinate: [616, 8.0]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
- name: m17_m17_decoder_0
|
||||
|
@ -109,6 +109,7 @@ blocks:
|
|||
parameters:
|
||||
affinity: ''
|
||||
alias: ''
|
||||
callsign: 'False'
|
||||
comment: ''
|
||||
debug_ctrl: 'True'
|
||||
debug_data: 'False'
|
||||
|
@ -119,7 +120,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [408, 104.0]
|
||||
coordinate: [392, 48.0]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [776, 168.0]
|
||||
coordinate: [776, 184.0]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
- name: blocks_throttle2_0
|
||||
|
@ -147,7 +147,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [560, 176.0]
|
||||
coordinate: [560, 192.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: blocks_vector_source_x_0_2
|
||||
|
@ -168,7 +168,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [8, 168.0]
|
||||
coordinate: [8, 184.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: m17_m17_coder_0
|
||||
|
@ -182,10 +182,12 @@ blocks:
|
|||
dst_id: dst_str
|
||||
encr_subtype: '0'
|
||||
encr_type: '0'
|
||||
key: ''
|
||||
maxoutbuf: '0'
|
||||
meta: meta_str
|
||||
minoutbuf: '0'
|
||||
mode: '1'
|
||||
signed_str: 'False'
|
||||
src_id: src_str
|
||||
type: type_val
|
||||
states:
|
||||
|
|
|
@ -18,6 +18,11 @@ parameters:
|
|||
dtype: bool
|
||||
default: 'False'
|
||||
options: ['True', 'False']
|
||||
- id: signed_str
|
||||
label: SignedStr
|
||||
dtype: bool
|
||||
default: 'False'
|
||||
options: ['True', 'False']
|
||||
- id: threshold
|
||||
label: Threshold
|
||||
dtype: float
|
||||
|
@ -25,12 +30,13 @@ parameters:
|
|||
|
||||
templates:
|
||||
imports: from gnuradio import m17
|
||||
make: m17.m17_decoder(${debug_data},${debug_ctrl},${threshold},${callsign})
|
||||
make: m17.m17_decoder(${debug_data},${debug_ctrl},${threshold},${callsign},${signed_str})
|
||||
callbacks:
|
||||
- set_debug_data(${debug_data})
|
||||
- set_debug_ctrl(${debug_ctrl})
|
||||
- set_threshold(${threshold})
|
||||
- set_callsign(${callsign})
|
||||
- set_signed(${signed_str})
|
||||
|
||||
# Make one 'inputs' list entry per input and one 'outputs' list entry per output.
|
||||
# Keys include:
|
||||
|
|
|
@ -32,11 +32,12 @@ public:
|
|||
* class. m17::m17_decoder::make is the public interface for
|
||||
* creating new instances.
|
||||
*/
|
||||
static sptr make(bool debug_data,bool debug_ctrl,float threshold,bool callsign);
|
||||
static sptr make(bool debug_data,bool debug_ctrl,float threshold,bool callsign, bool signed_str);
|
||||
virtual void set_debug_data(bool debug)=0;
|
||||
virtual void set_debug_ctrl(bool debug)=0;
|
||||
virtual void set_callsign(bool callsign)=0;
|
||||
virtual void set_threshold(float threshold)=0;
|
||||
virtual void set_signed(bool signed_str)=0;
|
||||
};
|
||||
|
||||
} // namespace m17
|
||||
|
|
|
@ -40,25 +40,26 @@ namespace gr {
|
|||
namespace m17 {
|
||||
|
||||
m17_decoder::sptr
|
||||
m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold,bool callsign)
|
||||
m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str)
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new m17_decoder_impl(debug_data,debug_ctrl,threshold,callsign));
|
||||
(new m17_decoder_impl(debug_data,debug_ctrl,threshold,callsign,signed_str));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign)
|
||||
m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str)
|
||||
: gr::block("m17_decoder",
|
||||
gr::io_signature::make(1, 1, sizeof(float)),
|
||||
gr::io_signature::make(1, 1, sizeof(char))),
|
||||
_debug_data(debug_data), _debug_ctrl(debug_ctrl), _threshold(threshold), _callsign(callsign)
|
||||
_debug_data(debug_data), _debug_ctrl(debug_ctrl), _threshold(threshold), _callsign(callsign), _signed_str(signed_str)
|
||||
{set_debug_data(debug_data);
|
||||
set_debug_ctrl(debug_ctrl);
|
||||
set_threshold(threshold);
|
||||
set_callsign(callsign);
|
||||
set_signed(signed_str);
|
||||
_expected_next_fn=0;
|
||||
}
|
||||
|
||||
|
@ -88,6 +89,11 @@ namespace gr {
|
|||
{_callsign=callsign;
|
||||
if (_callsign==true) printf("Display callsign\n"); else printf("Do not display callsign\n");
|
||||
}
|
||||
|
||||
void m17_decoder_impl::set_signed(bool signed_str)
|
||||
{_signed_str=signed_str;
|
||||
if (_callsign==true) printf("Signed\n"); else printf("Unsigned\n");
|
||||
}
|
||||
|
||||
void
|
||||
m17_decoder_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||
|
@ -192,7 +198,22 @@ namespace gr {
|
|||
printf(" e=%1.1f\n", (float)e/0xFFFF);
|
||||
}
|
||||
//send codec2 stream to stdout
|
||||
//write(STDOUT_FILENO, &frame_data[3], 16);
|
||||
//fwrite(&frame_data[3], 16, 1, stdout);
|
||||
|
||||
//if the stream is signed
|
||||
if(_signed_str && fn<0x7FFC)
|
||||
{
|
||||
//if thats the first frame (fn=0)
|
||||
if(fn==0)
|
||||
memcpy(digest, &frame_data[3], sizeof(digest));
|
||||
|
||||
for(uint8_t i=0; i<sizeof(digest); i++)
|
||||
digest[i]^=frame_data[3+i];
|
||||
uint8_t tmp=digest[0];
|
||||
for(uint8_t i=0; i<sizeof(digest)-1; i++)
|
||||
digest[i]=digest[i+1];
|
||||
digest[sizeof(digest)-1]=tmp;
|
||||
}
|
||||
|
||||
//extract LICH
|
||||
for(uint16_t i=0; i<96; i++)
|
||||
|
|
|
@ -21,6 +21,7 @@ private:
|
|||
bool _debug_ctrl=false;
|
||||
float _threshold=0.9;
|
||||
bool _callsign=false;
|
||||
bool _signed_str=false;
|
||||
|
||||
float last[8] = {0}; //look-back buffer for finding syncwords
|
||||
float pld[SYM_PER_PLD]; //raw frame symbols
|
||||
|
@ -36,6 +37,7 @@ private:
|
|||
|
||||
uint16_t enc_data[272]; //raw frame data soft bits
|
||||
uint8_t frame_data[19]; //decoded frame data, 144 bits (16+128), plus 4 flushing bits
|
||||
uint8_t digest[16]={0};
|
||||
|
||||
uint8_t syncd=0; //syncword found?
|
||||
uint8_t fl=0; //Frame=0 of LSF=1
|
||||
|
@ -44,12 +46,13 @@ private:
|
|||
uint8_t d_dst[12], d_src[12]; //decoded strings
|
||||
|
||||
public:
|
||||
m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign);
|
||||
m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign, bool signed_str);
|
||||
~m17_decoder_impl();
|
||||
void set_debug_data(bool debug);
|
||||
void set_debug_ctrl(bool debug);
|
||||
void set_callsign(bool callsign);
|
||||
void set_threshold(float threshold);
|
||||
void set_signed(bool signed_str);
|
||||
|
||||
// Where all the action really happens
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
|
|
@ -29,3 +29,5 @@ static const char *__doc_gr_m17_m17_decoder_set_debug_ctrl = R"doc()doc";
|
|||
static const char *__doc_gr_m17_m17_decoder_set_callsign = R"doc()doc";
|
||||
|
||||
static const char *__doc_gr_m17_m17_decoder_set_threshold = R"doc()doc";
|
||||
|
||||
static const char *__doc_gr_m17_m17_decoder_set_signed = R"doc()doc";
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/* BINDTOOL_GEN_AUTOMATIC(0) */
|
||||
/* BINDTOOL_USE_PYGCCXML(0) */
|
||||
/* BINDTOOL_HEADER_FILE(m17_decoder.h) */
|
||||
/* BINDTOOL_HEADER_FILE_HASH(265f7a49ed1b66cdd021af3149d8dc4b) */
|
||||
/* BINDTOOL_HEADER_FILE_HASH(8c8f29d39b36fa54324e1ba986ae6adc) */
|
||||
/***********************************************************************************/
|
||||
|
||||
#include <pybind11/complex.h>
|
||||
|
@ -38,7 +38,7 @@ void bind_m17_decoder(py::module &m) {
|
|||
|
||||
.def(py::init(&m17_decoder::make), py::arg("debug_data"),
|
||||
py::arg("debug_ctrl"), py::arg("threshold"), py::arg("callsign"),
|
||||
D(m17_decoder, make))
|
||||
py::arg("signed_str"), D(m17_decoder, make))
|
||||
|
||||
.def("set_debug_data", &m17_decoder::set_debug_data, py::arg("debug"),
|
||||
D(m17_decoder, set_debug_data))
|
||||
|
@ -52,5 +52,8 @@ void bind_m17_decoder(py::module &m) {
|
|||
.def("set_threshold", &m17_decoder::set_threshold, py::arg("threshold"),
|
||||
D(m17_decoder, set_threshold))
|
||||
|
||||
.def("set_signed", &m17_decoder::set_signed, py::arg("signed_str"),
|
||||
D(m17_decoder, set_signed))
|
||||
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue