Skip to content

Commit

Permalink
It builds
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed May 5, 2023
1 parent d62f678 commit 49d06ba
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 57 deletions.
2 changes: 1 addition & 1 deletion lib/op25_repeater/include/op25_repeater/frame_assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace gr {
* class. op25_repeater::frame_assembler::make is the public interface for
* creating new instances.
*/
static sptr make(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue);
static sptr make(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue);
virtual void set_xormask(const char*p) {}
virtual void set_nac(int nac) {}
virtual void set_slotid(int slotid) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace gr {
* class. op25_repeater::p25_frame_assembler::make is the public interface for
* creating new instances.
*/
static sptr make(int sys_num, int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt);
static sptr make(int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt);
virtual void set_xormask(const char*p) {}
virtual void set_nac(int nac) {}
virtual void set_slotid(int slotid) {}
Expand Down
8 changes: 4 additions & 4 deletions lib/op25_repeater/lib/frame_assembler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ namespace gr {
}

frame_assembler::sptr
frame_assembler::make(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue)
frame_assembler::make(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue)
{
return gnuradio::get_initial_sptr
(new frame_assembler_impl(sys_num, options, debug, msgq_id, queue));
(new frame_assembler_impl(options, debug, msgq_id, queue));
}

/*
Expand All @@ -92,7 +92,7 @@ namespace gr {
/*
* The private constructor
*/
frame_assembler_impl::frame_assembler_impl(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue)
frame_assembler_impl::frame_assembler_impl(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue)
: gr::block("frame_assembler",
gr::io_signature::make (MIN_IN, MAX_IN, sizeof (char)),
gr::io_signature::make ( 2, 2, sizeof(int16_t))),
Expand All @@ -107,7 +107,7 @@ namespace gr {
else if (strcasecmp(options, "subchannel") == 0)
d_sync = new rx_subchannel(options, debug, msgq_id, queue);
else
d_sync = new rx_sync(sys_num, options, debug, msgq_id, queue, output_queue);
d_sync = new rx_sync(options, debug, msgq_id, queue, output_queue);
}

int
Expand Down
2 changes: 1 addition & 1 deletion lib/op25_repeater/lib/frame_assembler_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace gr {
public:

public:
frame_assembler_impl(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue);
frame_assembler_impl(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue);
~frame_assembler_impl();

// Where all the action really happens
Expand Down
10 changes: 5 additions & 5 deletions lib/op25_repeater/lib/p25_frame_assembler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace gr {
return;
if (d_msg_queue->full_p())
return;
gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, d_sys_num, 0);
gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, 0);
d_msg_queue->insert_tail(msg);
}

Expand Down Expand Up @@ -75,8 +75,8 @@ namespace gr {
}

p25_frame_assembler::sptr
p25_frame_assembler::make(int sys_num, int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) {
return gnuradio::get_initial_sptr(new p25_frame_assembler_impl(sys_num, silence_frames, udp_host, port, debug, do_imbe, do_output, do_msgq, queue, do_audio_output, do_phase2_tdma, do_nocrypt));
p25_frame_assembler::make(int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) {
return gnuradio::get_initial_sptr(new p25_frame_assembler_impl(silence_frames, udp_host, port, debug, do_imbe, do_output, do_msgq, queue, do_audio_output, do_phase2_tdma, do_nocrypt));
}

/*
Expand All @@ -96,13 +96,13 @@ static const int MAX_IN = 1; // maximum number of input streams
/*
* The private constructor
*/
p25_frame_assembler_impl::p25_frame_assembler_impl(int sys_num, int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt)
p25_frame_assembler_impl::p25_frame_assembler_impl(int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt)
: gr::block("p25_frame_assembler",
gr::io_signature::make (MIN_IN, MAX_IN, sizeof (char)),
gr::io_signature::make ((do_output) ? 1 : 0, (do_output) ? 1 : 0, (do_audio_output && do_output) ? sizeof(int16_t) : ((do_output) ? sizeof(char) : 0 ))),
d_do_imbe(do_imbe),
d_do_output(do_output),
p1fdma(sys_num, op25audio, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output, do_nocrypt),
p1fdma(op25audio, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output, do_nocrypt),
d_do_audio_output(do_audio_output),
d_do_phase2_tdma(do_phase2_tdma),
d_do_nocrypt(do_nocrypt),
Expand Down
3 changes: 1 addition & 2 deletions lib/op25_repeater/lib/p25_frame_assembler_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ namespace gr {
gr::msg_queue::sptr d_msg_queue;

int d_input_rate;
int d_sys_num;
int d_silence_frames;
int silence_frame_count;
long total_produced;
Expand All @@ -76,7 +75,7 @@ namespace gr {
void set_phase2_tdma(bool p);

public:
p25_frame_assembler_impl(int sys_num, int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt);
p25_frame_assembler_impl(int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt);
~p25_frame_assembler_impl();

op25_audio op25audio;
Expand Down
6 changes: 2 additions & 4 deletions lib/op25_repeater/lib/p25p1_fdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace gr {
fprintf(stderr, "%s p25p1_fdma::set_nac: 0x%03x\n", logts.get(d_msgq_id), d_nac);
}

p25p1_fdma::p25p1_fdma(int sys_num,const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque<int16_t> &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id) :
p25p1_fdma::p25p1_fdma(const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque<int16_t> &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id) :
write_bufp(0),
d_debug(debug),
d_do_imbe(do_imbe),
Expand All @@ -216,7 +216,6 @@ namespace gr {
ess_algid(0x80),
vf_tgid(0),
terminate_call(false),
d_sys_num(sys_num),
p1voice_decode((debug > 0), udp, output_queue)
{
rx_status.error_count = 0;
Expand Down Expand Up @@ -753,8 +752,7 @@ namespace gr {
if (!d_do_msgq || d_msg_queue->full_p())
return;

gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type, d_sys_num, 0);
//gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0);
gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type, 0);
d_msg_queue->insert_tail(msg);
}

Expand Down
3 changes: 1 addition & 2 deletions lib/op25_repeater/lib/p25p1_fdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ namespace gr {
long curr_grp_id;
bool terminate_call;
const char *d_udp_host;
int d_sys_num;
int d_port;

ezpwd::RS<63,55> rs8; // Reed-Solomon decoders for 8, 12 and 16 bit parity
Expand All @@ -117,7 +116,7 @@ namespace gr {
void set_nac(int nac);
void reset_timer();
void rx_sym (const uint8_t *syms, int nsyms);
p25p1_fdma(int sys_num, const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque<int16_t> &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id = 0);
p25p1_fdma(const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque<int16_t> &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id = 0);
~p25p1_fdma();
uint32_t load_nid(const uint8_t *syms, int nsyms, const uint64_t fs);
bool load_body(const uint8_t * syms, int nsyms);
Expand Down
8 changes: 3 additions & 5 deletions lib/op25_repeater/lib/rx_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void rx_sync::ysf_sync(const uint8_t dibitbuf[], bool& ysf_fullrate, bool& unmut
fprintf(stderr, "%s ysf_sync: muting audio: dt: %d, rc: %d\n", logts.get(d_msgq_id), d_shift_reg, rc);
}

rx_sync::rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array<std::deque<int16_t>, 2> &output_queue) : // constructor
rx_sync::rx_sync(const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array<std::deque<int16_t>, 2> &output_queue) : // constructor
sync_timer(op25_timer(1000000)),
d_symbol_count(0),
d_sync_reg(0),
Expand All @@ -216,16 +216,14 @@ rx_sync::rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr::
d_slot_mask(3),
d_slot_key(0),
output_queue(output_queue),
p25fdma(sys_num, d_audio, debug, true, false, true, queue, d_output_queue[0], true, true, msgq_id),
p25fdma( d_audio, debug, true, false, true, queue, d_output_queue[0], true, true, msgq_id),
p25tdma( d_audio, 0, debug, true, queue, d_output_queue[0], true, true, msgq_id),
dmr(debug, msgq_id, queue),
d_msgq_id(msgq_id),
d_msg_queue(queue),

d_stereo(true),
d_debug(debug),
d_audio(options, debug),
d_sys_num(sys_num)
d_audio(options, debug)
{
if (msgq_id >= 0)
d_stereo = false; // single channel audio for trunking
Expand Down
3 changes: 1 addition & 2 deletions lib/op25_repeater/lib/rx_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class rx_sync : public rx_base {
void set_debug(int debug);
int get_src_id(int slot);
bool get_terminated(int slot);
rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array<std::deque<int16_t>, 2> &output_queue);
rx_sync(const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array<std::deque<int16_t>, 2> &output_queue);
~rx_sync();

private:
Expand Down Expand Up @@ -171,7 +171,6 @@ class rx_sync : public rx_base {
log_ts logts;
std::array<std::deque<int16_t>, 2> &output_queue;
//std::deque<int16_t> &output_queue[];
int d_sys_num;
};

} // end namespace op25_repeater
Expand Down
8 changes: 4 additions & 4 deletions trunk-recorder/gr_blocks/decoder_wrapper_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ namespace gr {
namespace blocks {

decoder_wrapper_impl::sptr
decoder_wrapper_impl::make(unsigned int sample_rate, int src_num, decoder_callback callback) {
return gnuradio::get_initial_sptr(new decoder_wrapper_impl(sample_rate, src_num, callback));
decoder_wrapper_impl::make(unsigned int sample_rate, decoder_callback callback) {
return gnuradio::get_initial_sptr(new decoder_wrapper_impl(sample_rate, callback));
}

decoder_wrapper_impl::decoder_wrapper_impl(unsigned int sample_rate, int src_num, decoder_callback callback)
decoder_wrapper_impl::decoder_wrapper_impl(unsigned int sample_rate, decoder_callback callback)
: hier_block2("decoder_wrapper_impl",
io_signature::make(1, 1, sizeof(float)),
io_signature::make(0, 0, 0)),
d_callback(callback) {
d_signal_decoder_sink = gr::blocks::signal_decoder_sink_impl::make(sample_rate, callback);
d_tps_decoder_sink = gr::blocks::tps_decoder_sink_impl::make(sample_rate, src_num, callback);
d_tps_decoder_sink = gr::blocks::tps_decoder_sink_impl::make(sample_rate, callback);

connect(self(), 0, d_signal_decoder_sink, 0);
connect(self(), 0, d_tps_decoder_sink, 0);
Expand Down
4 changes: 2 additions & 2 deletions trunk-recorder/gr_blocks/decoder_wrapper_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class decoder_wrapper_impl : public decoder_wrapper {
* \param sample_rate Sample rate [S/s]
* \param bits_per_sample 16 or 8 bit, default is 16
*/
static sptr make(unsigned int sample_rate, int src_num, decoder_callback callback);
static sptr make(unsigned int sample_rate, decoder_callback callback);

decoder_wrapper_impl(unsigned int sample_rate, int src_num, decoder_callback callback);
decoder_wrapper_impl(unsigned int sample_rate, decoder_callback callback);
~decoder_wrapper_impl();

void set_mdc_enabled(bool b);
Expand Down
26 changes: 12 additions & 14 deletions trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ namespace gr {
namespace blocks {

tps_decoder_sink_impl::sptr
tps_decoder_sink_impl::make(unsigned int sample_rate, int src_num, decoder_callback callback) {
return gnuradio::get_initial_sptr(new tps_decoder_sink_impl(sample_rate, src_num, callback));
tps_decoder_sink_impl::make(unsigned int sample_rate, decoder_callback callback) {
return gnuradio::get_initial_sptr(new tps_decoder_sink_impl(sample_rate, callback));
}

tps_decoder_sink_impl::tps_decoder_sink_impl(unsigned int sample_rate, int src_num, decoder_callback callback)
tps_decoder_sink_impl::tps_decoder_sink_impl(unsigned int sample_rate, decoder_callback callback)
: hier_block2("tps_decoder_sink_impl",
io_signature::make(1, 1, sizeof(float)),
io_signature::make(0, 0, 0)),
d_src_num(src_num),
d_callback(callback) {
rx_queue = gr::msg_queue::make(100);

Expand All @@ -80,7 +79,7 @@ std::string tps_decoder_sink_impl::to_hex(const std::string &s, bool upper, bool
return result.str();
}

void tps_decoder_sink_impl::parse_p25_json(int src_num, std::string json) {
void tps_decoder_sink_impl::parse_p25_json(std::string json) {
try {

if (json.empty() || json.length() < 3)
Expand All @@ -97,7 +96,7 @@ void tps_decoder_sink_impl::parse_p25_json(int src_num, std::string json) {
log_decoder_msg(srcaddr, "TPS", SignalType::Normal);
}
} catch (std::exception const &e) {
BOOST_LOG_TRIVIAL(error) << "[" << std::dec << src_num << "] TPS: ERROR PROCESSING JSON: " << e.what();
BOOST_LOG_TRIVIAL(error) << "TPS: ERROR PROCESSING JSON: " << e.what();
}
}

Expand All @@ -106,12 +105,11 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) {
return;

long type = msg->type();
int src_num = msg->arg1();

BOOST_LOG_TRIVIAL(trace) << "[" << std::dec << src_num << "] TPS MESSAGE " << std::dec << type << ": " << to_hex(msg->to_string());
BOOST_LOG_TRIVIAL(trace) << "TPS MESSAGE " << std::dec << type << ": " << to_hex(msg->to_string());

if (type == M_P25_JSON_DATA) {
parse_p25_json(src_num, msg->to_string());
parse_p25_json(msg->to_string());
return;
}

Expand Down Expand Up @@ -151,7 +149,7 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) {
}
b <<= 16; // for missing crc

decode_tsbk(b, nac, src_num);
decode_tsbk(b, nac);
} else if (type == 12) { // # trunk: MBT
std::string s1 = s.substr(0, 10);
std::string s2 = s.substr(10);
Expand Down Expand Up @@ -189,7 +187,7 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) {
mbt_data <<= 32; // for missing crc
unsigned long opcode = bitset_shift_mask(header, 32, 0x3f);
unsigned long link_id = bitset_shift_mask(header, 48, 0xffffff);
decode_mbt_data(opcode, header, mbt_data, link_id, nac, src_num);
decode_mbt_data(opcode, header, mbt_data, link_id, nac);
} else {
// Not supported yet...
}
Expand Down Expand Up @@ -226,7 +224,7 @@ void tps_decoder_sink_impl::initialize_p25() {
bool do_audio_output = 0;
bool do_tdma = 0;
bool do_crypt = 0;
op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(d_src_num, silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_crypt);
op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_crypt);

connect(self(), 0, valve, 0);
connect(valve, 0, slicer, 0);
Expand All @@ -243,7 +241,7 @@ unsigned long tps_decoder_sink_impl::bitset_shift_mask(boost::dynamic_bitset<> &
return result;
}

void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long sa, unsigned long nac, int sys_num) {
void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long sa, unsigned long nac) {
long unit_id = 0;
bool emergency = false;

Expand All @@ -262,7 +260,7 @@ void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic
}
}

void tps_decoder_sink_impl::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac, int sys_num) {
void tps_decoder_sink_impl::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac) {
long unit_id = 0;
bool emergency = false;

Expand Down
11 changes: 5 additions & 6 deletions trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ namespace blocks {

class tps_decoder_sink_impl : public tps_decoder_sink {
private:
int d_src_num;
decoder_callback d_callback;

gr::op25_repeater::fsk4_demod_ff::sptr fsk4_demod;
Expand All @@ -50,9 +49,9 @@ class tps_decoder_sink_impl : public tps_decoder_sink {

void initialize_p25(void);
void process_message(gr::message::sptr msg);
void parse_p25_json(int src_num, std::string json);
void decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long link_id, unsigned long nac, int sys_num);
void decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac, int sys_num);
void parse_p25_json(std::string json);
void decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long link_id, unsigned long nac);
void decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac);

unsigned long bitset_shift_mask(boost::dynamic_bitset<> &tsbk, int shift, unsigned long long mask);

Expand All @@ -67,9 +66,9 @@ class tps_decoder_sink_impl : public tps_decoder_sink {

gr::msg_queue::sptr rx_queue;

static sptr make(unsigned int sample_rate, int src_num, decoder_callback callback);
static sptr make(unsigned int sample_rate, decoder_callback callback);

tps_decoder_sink_impl(unsigned int sample_rate, int src_num, decoder_callback callback);
tps_decoder_sink_impl(unsigned int sample_rate, decoder_callback callback);

void set_enabled(bool b);

Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/recorders/analog_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type)
}

BOOST_LOG_TRIVIAL(info) << "\t Creating decoder sink..." << std::endl;
decoder_sink = gr::blocks::decoder_wrapper_impl::make(wav_sample_rate, src->get_num(), std::bind(&analog_recorder::decoder_callback_handler, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
decoder_sink = gr::blocks::decoder_wrapper_impl::make(wav_sample_rate, std::bind(&analog_recorder::decoder_callback_handler, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
BOOST_LOG_TRIVIAL(info) << "\t Decoder sink created!" << std::endl;

// Analog audio band pass from 300 to 3000 Hz
Expand Down
Loading

0 comments on commit 49d06ba

Please sign in to comment.