Skip to content

Commit

Permalink
add comments and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tapparelj committed Aug 14, 2023
1 parent 0d4f547 commit 9f5c8b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
3 changes: 3 additions & 0 deletions grc/lora_sdr_whitening.block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ documentation: |-
Whiten the payload data with a pseudo random sequence
Parameters:
Source type: choose the input mode: message or file
Use length tag: separate frame content based on a length tag or a separator character
Separator: the separator used to separate frame contents
Length tag key: the key of the length tag
is_hex: If True, the input file contains hex values as sequence of digits, with frames separated with the separator. e.g(6669727374207061636b6574,7365636f6e64207061636b6574,). Else the file contains sequence of chars with frames separated by the separator. e.g(first packet,second packet).
Input:
msg: the payload as a PMT message string
Expand Down
42 changes: 21 additions & 21 deletions lib/whitening_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
#ifndef INCLUDED_LORA_WHITENING_IMPL_H
#define INCLUDED_LORA_WHITENING_IMPL_H


#include <gnuradio/lora_sdr/whitening.h>
#include <gnuradio/lora_sdr/utilities.h>
namespace gr {
namespace lora_sdr {
namespace gr
{
namespace lora_sdr
{

class whitening_impl : public whitening
{
private:
bool m_is_hex; ///< indicate that the payload is given by a string of hex values
char m_separator; ///< the separator for file inputs
std::vector<uint8_t> m_payload; ///< store the payload bytes
std::vector<std::string> payload_str;
bool m_file_source; ///< indicate that the payload are provided by a file through an input stream
void msg_handler(pmt::pmt_t message);
bool m_use_length_tag;
std::string m_length_tag_name;
int m_input_byte_cnt;
uint64_t m_tag_offset;

public:
private:
bool m_is_hex; ///< indicate that the payload is given by a string of hex values
char m_separator; ///< the separator for file inputs
std::vector<uint8_t> m_payload; ///< store the payload bytes
std::vector<std::string> payload_str; ///< payload as a string
bool m_file_source; ///< indicate that the payload are provided by a file through an input stream
bool m_use_length_tag; ///< wheter to use the length tag to separate frames or the separator character
std::string m_length_tag_name; ///< name/key of the length tag
int m_input_byte_cnt; ///< number of bytes from the input already processed
uint64_t m_tag_offset; ///< offset of the length tag

void msg_handler(pmt::pmt_t message);

public:
whitening_impl(bool is_hex, bool use_length_tag, char separator, std::string length_tag_name);
~whitening_impl();

// Where all the action really happens
int work(
int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
);
int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace lora
} // namespace gr
Expand Down

0 comments on commit 9f5c8b8

Please sign in to comment.