add encoder_type to decoder block

pull/15/head
Jean-Michel Friedt 2024-12-22 19:56:26 +01:00
parent 1bbd406e28
commit 914f32789b
4 changed files with 21 additions and 7 deletions

View File

@ -27,6 +27,12 @@ parameters:
dtype: bool
default: 'False'
options: ['True', 'False']
- id: encr_type
label: Encr. type
dtype: int
default: 0
options: [0, 1, 2, 3]
option_labels: ['None', 'Scrambler', 'AES', 'Other/Reserved']
- id: threshold
label: Threshold
dtype: float
@ -37,7 +43,7 @@ asserts:
templates:
imports: from gnuradio import m17
make: m17.m17_decoder(${debug_data},${debug_ctrl},${threshold},${callsign},${signed_str},${key})
make: m17.m17_decoder(${debug_data},${debug_ctrl},${threshold},${callsign},${signed_str},${key},${encr_type})
callbacks:
- set_debug_data(${debug_data})
- set_debug_ctrl(${debug_ctrl})
@ -45,6 +51,7 @@ templates:
- set_key(${key})
- set_callsign(${callsign})
- set_signed(${signed_str})
- set_encr_type(${encr_type})
# Make one 'inputs' list entry per input and one 'outputs' list entry per output.
# Keys include:

View File

@ -39,7 +39,7 @@ 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, bool signed_str, std::string key);
static sptr make(bool debug_data,bool debug_ctrl,float threshold,bool callsign, bool signed_str,encr_t encr_type, std::string key);
virtual void set_debug_data(bool debug)=0;
virtual void set_debug_ctrl(bool debug)=0;
virtual void set_callsign(bool callsign)=0;

View File

@ -40,17 +40,17 @@ namespace gr {
namespace m17 {
m17_decoder::sptr
m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str, std::string key)
m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str, encr_t encr_type,std::string key)
{
return gnuradio::get_initial_sptr
(new m17_decoder_impl(debug_data,debug_ctrl,threshold,callsign,signed_str,key));
(new m17_decoder_impl(debug_data,debug_ctrl,threshold,callsign,signed_str,encr_type,key));
}
/*
* The private constructor
*/
m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str,std::string key)
m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign,bool signed_str,encr_t encr_type,std::string key)
: gr::block("m17_decoder",
gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(char))),
@ -61,6 +61,7 @@ namespace gr {
set_callsign(callsign);
set_signed(signed_str);
set_key(key);
set_encr_type(encr_type);
_expected_next_fn=0;
}
@ -85,7 +86,12 @@ namespace gr {
{_debug_ctrl=debug;
if (_debug_ctrl==true) printf("Debug control: true\n"); else printf("Debug control: false\n");
}
void m17_decoder_impl::set_encr_type(encr_t encr_type)
{_encr_type=encr_type;
printf("new encr type: %x -> ",_encr_type);
}
void m17_decoder_impl::set_callsign(bool callsign)
{_callsign=callsign;
if (_callsign==true) printf("Display callsign\n"); else printf("Do not display callsign\n");

View File

@ -80,7 +80,7 @@ int8_t scrambler_subtype = -1;
const struct uECC_Curve_t* _curve = uECC_secp256r1();
public:
m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign, bool signed_str, std::string key);
m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold,bool callsign, bool signed_str, encr_t encr_type,std::string key);
~m17_decoder_impl();
void set_debug_data(bool debug);
void set_key(std::string arg);
@ -89,6 +89,7 @@ public:
void set_callsign(bool callsign);
void set_threshold(float threshold);
void set_signed(bool signed_str);
void set_encr_type(encr_t encr_type);
void parse_raw_key_string(uint8_t* dest, const char* inp);
void scrambler_sequence_generator();
uint32_t scrambler_seed_calculation(int8_t subtype, uint32_t key, int fn);