Make snapshot msgq an optional attribute.
git-svn-id: http://op25.osmocom.org/svn/trunk@242 65a5c917-d112-43f1-993d-58c26a4786be
This commit is contained in:
parent
e2ef492e1b
commit
3fd247b26b
|
@ -21,9 +21,9 @@
|
|||
GR_SWIG_BLOCK_MAGIC(op25, decoder_ff);
|
||||
|
||||
/*
|
||||
* Publicly-accesible constuctor function for op25_decoder_ff.
|
||||
* Publicly-accesible default constuctor function for op25_decoder_ff.
|
||||
*/
|
||||
op25_decoder_ff_sptr op25_make_decoder_ff(gr_msg_queue_sptr msgq);
|
||||
op25_decoder_ff_sptr op25_make_decoder_ff();
|
||||
|
||||
/*
|
||||
* The op25_decoder block.
|
||||
|
@ -31,7 +31,9 @@ op25_decoder_ff_sptr op25_make_decoder_ff(gr_msg_queue_sptr msgq);
|
|||
class op25_decoder_ff : public gr_block
|
||||
{
|
||||
private:
|
||||
op25_decoder_ff(gr_msg_queue_sptr msgq);
|
||||
op25_decoder_ff();
|
||||
public:
|
||||
const char *device_name() const;
|
||||
gr_msg_queue_sptr get_msgq() const;
|
||||
void set_msgq(gr_msg_queue_sptr msgq);
|
||||
};
|
||||
|
|
|
@ -33,21 +33,34 @@
|
|||
#include <offline_imbe_decoder.h>
|
||||
#include <op25_decoder_ff.h>
|
||||
#include <snapshot_du_handler.h>
|
||||
#include <sniffer_du_handler.h>
|
||||
#include <voice_du_handler.h>
|
||||
#include <op25_yank.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
op25_decoder_ff_sptr
|
||||
op25_make_decoder_ff(gr_msg_queue_sptr msgq)
|
||||
op25_make_decoder_ff()
|
||||
{
|
||||
return op25_decoder_ff_sptr(new op25_decoder_ff(msgq));
|
||||
return op25_decoder_ff_sptr(new op25_decoder_ff);
|
||||
}
|
||||
|
||||
op25_decoder_ff::~op25_decoder_ff()
|
||||
{
|
||||
}
|
||||
|
||||
gr_msg_queue_sptr
|
||||
op25_decoder_ff::get_msgq() const
|
||||
{
|
||||
return d_snapshot_du_handler->get_msgq();
|
||||
}
|
||||
|
||||
void
|
||||
op25_decoder_ff::set_msgq(gr_msg_queue_sptr msgq)
|
||||
{
|
||||
d_snapshot_du_handler->set_msgq(msgq);
|
||||
}
|
||||
|
||||
void
|
||||
op25_decoder_ff::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
|
||||
{
|
||||
|
@ -109,7 +122,7 @@ op25_decoder_ff::device_name() const
|
|||
return d_sniffer_du_handler->device_name();
|
||||
}
|
||||
|
||||
op25_decoder_ff::op25_decoder_ff(gr_msg_queue_sptr msgq) :
|
||||
op25_decoder_ff::op25_decoder_ff() :
|
||||
gr_block("decoder_ff", gr_make_io_signature(1, 1, sizeof(float)), gr_make_io_signature(0, 1, sizeof(float))),
|
||||
d_data_unit(),
|
||||
d_data_unit_handler(),
|
||||
|
@ -120,7 +133,8 @@ op25_decoder_ff::op25_decoder_ff(gr_msg_queue_sptr msgq) :
|
|||
{
|
||||
d_sniffer_du_handler = new sniffer_du_handler(d_data_unit_handler);
|
||||
d_data_unit_handler = data_unit_handler_sptr(d_sniffer_du_handler);
|
||||
d_data_unit_handler = data_unit_handler_sptr(new snapshot_du_handler(d_data_unit_handler, msgq));
|
||||
d_snapshot_du_handler = new snapshot_du_handler(d_data_unit_handler);
|
||||
d_data_unit_handler = data_unit_handler_sptr(d_snapshot_du_handler);
|
||||
d_data_unit_handler = data_unit_handler_sptr(new voice_du_handler(d_data_unit_handler, d_imbe));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,10 @@
|
|||
#include <gr_block.h>
|
||||
#include <gr_msg_queue.h>
|
||||
#include <imbe_decoder.h>
|
||||
#include <sniffer_du_handler.h>
|
||||
|
||||
typedef boost::shared_ptr<class op25_decoder_ff> op25_decoder_ff_sptr;
|
||||
|
||||
op25_decoder_ff_sptr op25_make_decoder_ff(gr_msg_queue_sptr msgq);
|
||||
op25_decoder_ff_sptr op25_make_decoder_ff();
|
||||
|
||||
/**
|
||||
* op25_decoder_ff is a GNU Radio block for decoding APCO P25
|
||||
|
@ -69,6 +68,22 @@ public:
|
|||
*/
|
||||
const char *device_name() const;
|
||||
|
||||
/**
|
||||
* Accessor for the msgq attribute. Returns a pointer to the msgq
|
||||
* if it exists.
|
||||
*
|
||||
* \return A (possibly NULL) gr_msg_queue_sptr pointing to the message queue.
|
||||
*/
|
||||
gr_msg_queue_sptr get_msgq() const;
|
||||
|
||||
/**
|
||||
* Accessor for the msgq attribute. Sets the msgq to point to the
|
||||
* provided message queue object.
|
||||
*
|
||||
* \return A (possibly NULL) gr_msg_queue_sptr pointing to the message queue.
|
||||
*/
|
||||
void set_msgq(gr_msg_queue_sptr msgq);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -76,12 +91,12 @@ private:
|
|||
* op25_decoder_ff and wrap it in a shared_ptr. This is effectively
|
||||
* the public constructor.
|
||||
*/
|
||||
friend op25_decoder_ff_sptr op25_make_decoder_ff(gr_msg_queue_sptr msgq);
|
||||
friend op25_decoder_ff_sptr op25_make_decoder_ff();
|
||||
|
||||
/**
|
||||
* op25_decoder_ff protected constructor.
|
||||
*/
|
||||
op25_decoder_ff(gr_msg_queue_sptr msgq);
|
||||
op25_decoder_ff();
|
||||
|
||||
/**
|
||||
* Tests whether d_frame_header correlates with the APCO P25 frame
|
||||
|
@ -134,11 +149,6 @@ private:
|
|||
*/
|
||||
imbe_decoder_sptr d_imbe;
|
||||
|
||||
/**
|
||||
* The message queue used to send snapshots to the UI.
|
||||
*/
|
||||
gr_msg_queue_sptr d_msgq;
|
||||
|
||||
/**
|
||||
* Valid states for the decoder state model.
|
||||
*/
|
||||
|
@ -147,7 +157,12 @@ private:
|
|||
/**
|
||||
* The sniffer (TUN/TAP) data unit handler.
|
||||
*/
|
||||
sniffer_du_handler *d_sniffer_du_handler;
|
||||
class sniffer_du_handler *d_sniffer_du_handler;
|
||||
|
||||
/**
|
||||
* The snapshot data unit handler.
|
||||
*/
|
||||
class snapshot_du_handler *d_snapshot_du_handler;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -27,10 +27,9 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
snapshot_du_handler::snapshot_du_handler(data_unit_handler_sptr next, gr_msg_queue_sptr msgq) :
|
||||
snapshot_du_handler::snapshot_du_handler(data_unit_handler_sptr next) :
|
||||
data_unit_handler(next),
|
||||
d_data_units(0),
|
||||
d_msgq(msgq)
|
||||
d_data_units(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -53,3 +52,15 @@ snapshot_du_handler::handle(data_unit_sptr du)
|
|||
}
|
||||
data_unit_handler::handle(du);
|
||||
}
|
||||
|
||||
gr_msg_queue_sptr
|
||||
snapshot_du_handler::get_msgq() const
|
||||
{
|
||||
return d_msgq;
|
||||
}
|
||||
|
||||
void
|
||||
snapshot_du_handler::set_msgq(gr_msg_queue_sptr msgq)
|
||||
{
|
||||
d_msgq = msgq;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
* \param next The next data_unit_handler in the chain.
|
||||
* \param msgq A non-null msg_queue_sptr to the msg_queue to use.
|
||||
*/
|
||||
snapshot_du_handler(data_unit_handler_sptr next, gr_msg_queue_sptr msgq);
|
||||
snapshot_du_handler(data_unit_handler_sptr next);
|
||||
|
||||
/**
|
||||
* snapshot_du_handler virtual destructor.
|
||||
|
@ -59,6 +59,22 @@ public:
|
|||
*/
|
||||
virtual void handle(data_unit_sptr du);
|
||||
|
||||
/**
|
||||
* Accessor for the msgq attribute. Returns a pointer to the msgq
|
||||
* if it exists.
|
||||
*
|
||||
* \return A (possibly NULL) gr_msg_queue_sptr pointing to the message queue.
|
||||
*/
|
||||
gr_msg_queue_sptr get_msgq() const;
|
||||
|
||||
/**
|
||||
* Accessor for the msgq attribute. Sets the msgq to point to the
|
||||
* provided message queue object.
|
||||
*
|
||||
* \return A (possibly NULL) gr_msg_queue_sptr pointing to the message queue.
|
||||
*/
|
||||
void set_msgq(gr_msg_queue_sptr msgq);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -73,4 +89,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDED_SNAPSHOT_DU_HANDLER_H */
|
||||
|
|
|
@ -55,11 +55,11 @@ public:
|
|||
virtual void handle(data_unit_sptr du);
|
||||
|
||||
/**
|
||||
* Return a pointer to a string naming the TUN/TAP device.
|
||||
* Returns the name of the sniffer TUN/TAP device.
|
||||
*
|
||||
* \return A pointer to a NUL-terminated character string.
|
||||
* \return A pointer to a NUL-terminated string.
|
||||
*/
|
||||
const char *device_name() const;
|
||||
virtual const char *device_name() const;
|
||||
|
||||
private:
|
||||
|
||||
|
|
Reference in New Issue