GNU Radio 3.6.5 C++ API

digital_packet_sink Class Reference

process received bits looking for packet sync, header, and process bits into packet More...

#include <digital_packet_sink.h>

Inheritance diagram for digital_packet_sink:
gr_sync_block gr_block gr_basic_block gr_msg_accepter gruel::msg_accepter

List of all members.

Public Member Functions

 ~digital_packet_sink ()
int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
 just like gr_block::general_work, only this arranges to call consume_each for you
bool carrier_sensed () const
 return true if we detect carrier

Protected Member Functions

 digital_packet_sink (const std::vector< unsigned char > &sync_vector, gr_msg_queue_sptr target_queue, int threshold)
void enter_search ()
void enter_have_sync ()
void enter_have_header (int payload_len)
int slice (float x)
bool header_ok ()
int header_payload_len ()

Friends

DIGITAL_API
digital_packet_sink_sptr 
digital_make_packet_sink (const std::vector< unsigned char > &sync_vector, gr_msg_queue_sptr target_queue, int threshold)

Detailed Description

process received bits looking for packet sync, header, and process bits into packet

input: stream of symbols to be sliced.

output: none. Pushes assembled packet into target queue

The packet sink takes in a stream of binary symbols that are sliced around 0. The bits are then checked for the sync_vector to determine find and decode the packet. It then expects a fixed length header of 2 16-bit shorts containing the payload length, followed by the payload. If the 2 16-bit shorts are not identical, this packet is ignored. Better algs are welcome.

This block is not very useful anymore as it only works with 2-level modulations such as BPSK or GMSK. The block can generally be replaced with a correlate access code and frame sink blocks.


Constructor & Destructor Documentation

digital_packet_sink::digital_packet_sink ( const std::vector< unsigned char > &  sync_vector,
gr_msg_queue_sptr  target_queue,
int  threshold 
) [protected]

Build a packet sink block.

Parameters:
sync_vectorThe synchronization vector as a vector of 1's and 0's.
target_queueThe message queue that packets are sent to.
thresholdNumber of bits that can be incorrect in the sync_vector.
digital_packet_sink::~digital_packet_sink ( )

Member Function Documentation

bool digital_packet_sink::carrier_sensed ( ) const [inline]

return true if we detect carrier

void digital_packet_sink::enter_have_header ( int  payload_len) [protected]
void digital_packet_sink::enter_have_sync ( ) [protected]
void digital_packet_sink::enter_search ( ) [protected]
bool digital_packet_sink::header_ok ( ) [inline, protected]
int digital_packet_sink::header_payload_len ( ) [inline, protected]
int digital_packet_sink::slice ( float  x) [inline, protected]
int digital_packet_sink::work ( int  noutput_items,
gr_vector_const_void_star input_items,
gr_vector_void_star output_items 
) [virtual]

just like gr_block::general_work, only this arranges to call consume_each for you

The user must override work to define the signal processing code

Implements gr_sync_block.


Friends And Related Function Documentation

DIGITAL_API digital_packet_sink_sptr digital_make_packet_sink ( const std::vector< unsigned char > &  sync_vector,
gr_msg_queue_sptr  target_queue,
int  threshold 
) [friend]

The documentation for this class was generated from the following file: