libsdr
0.1.0
A simple SDR library
|
A pocsag message. More...
#include <pocsag.hh>
Public Member Functions | |
Message () | |
Empty constructor. More... | |
Message (uint32_t addr, uint8_t func) | |
Constructor from address and function. More... | |
Message (const Message &other) | |
Copy constructor. More... | |
Message & | operator= (const Message &other) |
Assignment operator. More... | |
bool | isEmpty () const |
Retruns true if the message is empty (has no address). More... | |
uint32_t | address () const |
Returns the address of the message. More... | |
uint8_t | function () const |
Returns the function of the message. More... | |
uint32_t | bits () const |
Returns the number of data bits. More... | |
void | addPayload (uint32_t word) |
Adds some payload from the given POGSAC word. More... | |
int | estimateText () const |
Retruns the "likelihood" that the message is a text message (actually a log-likelihood). More... | |
int | estimateNumeric () const |
Retruns the "likelihood" that the message is a numeric message (actually a log-likelihood). More... | |
std::string | asText () const |
Decodes the message as a text message. More... | |
std::string | asNumeric () const |
Decodes the message as a numeric message. More... | |
std::string | asHex () const |
Dumps the payload. More... | |
Protected Attributes | |
uint32_t | _address |
The address of the message. More... | |
uint8_t | _function |
The function of the message. More... | |
bool | _empty |
If true the message is empty. More... | |
uint32_t | _bits |
The number of payload bits in the message. More... | |
std::vector< uint8_t > | _payload |
The actual payload. More... | |
A pocsag message.
A pocsag message can be either a numeric message (i.e. phone numbers) or a text message. The transmitter knows which type a certain receiver expects, hence there is no information embedded into the actual message that determines the type. Hence a heuristic needs to be used in order to select the message type by the contents of the message. This is done using the estimateText
and estimateNumeric
functions. They return a weight in favor of one of the types. I.e. if estimateText() > estimateNumeric(), the message is likely to be a text message. Like any heuristic, this approach may fail. The message text is returned by asText()
and the numeric data is returned by asNumeric()
. Both methods return a std::string
as the numeric message may also contain a very limited set of non-number symbols.
POCSAG::Message::Message | ( | ) |
Empty constructor.
POCSAG::Message::Message | ( | uint32_t | addr, |
uint8_t | func | ||
) |
Constructor from address and function.
POCSAG::Message::Message | ( | const Message & | other | ) |
Copy constructor.
void POCSAG::Message::addPayload | ( | uint32_t | word | ) |
Adds some payload from the given POGSAC word.
|
inline |
Returns the address of the message.
std::string POCSAG::Message::asHex | ( | ) | const |
Dumps the payload.
std::string POCSAG::Message::asNumeric | ( | ) | const |
Decodes the message as a numeric message.
std::string POCSAG::Message::asText | ( | ) | const |
Decodes the message as a text message.
|
inline |
Returns the number of data bits.
int POCSAG::Message::estimateNumeric | ( | ) | const |
Retruns the "likelihood" that the message is a numeric message (actually a log-likelihood).
int POCSAG::Message::estimateText | ( | ) | const |
Retruns the "likelihood" that the message is a text message (actually a log-likelihood).
|
inline |
Returns the function of the message.
|
inline |
Retruns true
if the message is empty (has no address).
POCSAG::Message & POCSAG::Message::operator= | ( | const Message & | other | ) |
Assignment operator.
|
protected |
The address of the message.
|
protected |
The number of payload bits in the message.
|
protected |
If true
the message is empty.
|
protected |
The function of the message.
|
protected |
The actual payload.