23 #ifndef INCLUDED_GR_PACKET_SINK_H
24 #define INCLUDED_GR_PACKET_SINK_H
50 enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
52 static const int MAX_PKT_LEN = 4096;
53 static const int HEADERBITLEN = 32;
56 unsigned long long d_sync_vector;
57 unsigned int d_threshold;
61 unsigned long long d_shift_reg;
63 unsigned int d_header;
64 int d_headerbitlen_cnt;
66 unsigned char d_packet[MAX_PKT_LEN];
67 unsigned char d_packet_byte;
68 int d_packet_byte_index;
78 void enter_have_sync();
79 void enter_have_header(
int payload_len);
81 int slice(
float x) {
return x > 0 ? 1 : 0; }
86 return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
92 int t = (d_header >> 16) & 0xffff;
99 int work(
int noutput_items,
100 gr_vector_const_void_star &input_items,
101 gr_vector_void_star &output_items);
107 return d_state != STATE_SYNC_SEARCH;
GR_CORE_API gr_packet_sink_sptr gr_make_packet_sink(const std::vector< unsigned char > &sync_vector, gr_msg_queue_sptr target_queue, int threshold=-1)
Definition: gr_sync_block.h:27
int slice(float x)
Definition: gr_packet_sink.h:81
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
#define GR_CORE_API
Definition: gr_core_api.h:30
process received bits looking for packet sync, header, and process bits into packet ...
Definition: gr_packet_sink.h:42
bool header_ok()
Definition: gr_packet_sink.h:83
virtual 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 ...
int header_payload_len()
Definition: gr_packet_sink.h:89
bool carrier_sensed() const
return true if we detect carrier
Definition: gr_packet_sink.h:105