From 7f61c6440c9b05802f3add9cb4007e12aac7122f Mon Sep 17 00:00:00 2001 From: ptrkrysik Date: Thu, 30 Oct 2014 08:57:27 +0100 Subject: Changes in control channels decoder to output messages in PDU format - when connected to Socket PDU the messages can be dissected with Wireshark now. The information in the header might be not complete/fully correct at this moment (no SNR, power measurements, channel type statically set to BCCH). --- lib/decoding/control_channels_decoder_impl.cc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'lib/decoding/control_channels_decoder_impl.cc') diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc index e9d1146..de1dc02 100644 --- a/lib/decoding/control_channels_decoder_impl.cc +++ b/lib/decoding/control_channels_decoder_impl.cc @@ -37,7 +37,7 @@ namespace gr { } /* - * The private constructor + * Constructor */ control_channels_decoder_impl::control_channels_decoder_impl() : gr::block("control_channels_decoder", @@ -53,16 +53,16 @@ namespace gr { j = 2 * ((49 * k) % 57) + ((k % 8) / 4); interleave_trans[k] = B * 114 + j; //114=57 + 57 } - + + //initialize decoder FC_init(&fc_ctx, 40, 184); + + //setup input/output ports message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&control_channels_decoder_impl::decode, this, _1)); message_port_register_out(pmt::mp("msgs")); } - /* - * Our virtual destructor. - */ control_channels_decoder_impl::~control_channels_decoder_impl() { } @@ -131,8 +131,18 @@ namespace gr { //send message with header of the first burst pmt::pmt_t header_blob = pmt::car(d_bursts[0]); - pmt::pmt_t msg_binary_blob = pmt::make_blob(outmsg,23); - pmt::pmt_t msg_out = pmt::cons(header_blob, msg_binary_blob); + gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_blob); + header->type = GSMTAP_TYPE_UM; + header->sub_type = GSMTAP_CHANNEL_BCCH; + int8_t * header_content = (int8_t *)pmt::blob_data(header_blob); + + int8_t header_plus_data[16+23]; + memcpy(header_plus_data, header_content, 16); + memcpy(header_plus_data+16, outmsg, 23); + + pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,23+16); + pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); + message_port_pub(pmt::mp("msgs"), msg_out); } return; -- cgit v1.2.3