pocsag message struct
This commit is contained in:
parent
76937429de
commit
5e700978ba
2 changed files with 55 additions and 0 deletions
|
@ -65,6 +65,22 @@ int16_t PagerClient::transmit(const char* str, uint32_t addr, uint8_t encoding,
|
|||
}
|
||||
|
||||
int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t encoding, uint8_t function) {
|
||||
PagerMessage_t message;
|
||||
message.addr = addr;
|
||||
message.func = function;
|
||||
message.data = data;
|
||||
message.data_len = len;
|
||||
message.encoding = encoding;
|
||||
return(PagerClient::transmit(message));
|
||||
}
|
||||
|
||||
int16_t PagerClient::transmit(PagerMessage_t &message) {
|
||||
uint32_t addr = message.addr;
|
||||
uint8_t function = message.func;
|
||||
uint8_t* data = message.data;
|
||||
size_t len = message.data_len;
|
||||
uint8_t encoding = message.encoding;
|
||||
|
||||
if(addr > RADIOLIB_PAGER_ADDRESS_MAX) {
|
||||
return(RADIOLIB_ERR_INVALID_ADDRESS_WIDTH);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,38 @@
|
|||
// the maximum allowed address (2^22 - 1)
|
||||
#define RADIOLIB_PAGER_ADDRESS_MAX (2097151)
|
||||
|
||||
/*!
|
||||
\struct PagerMessage_t
|
||||
\brief Structure to save one message.
|
||||
*/
|
||||
struct PagerMessage_t {
|
||||
|
||||
/*!
|
||||
\brief Address of the destination pager. Allowed values are 0 to 2097151 - values above 2000000 are reserved.
|
||||
*/
|
||||
uint32_t addr;
|
||||
|
||||
/*!
|
||||
\brief function bits (NUMERIC, TONE, ACTIVATION, ALPHANUMERIC). Allowed values 0 to 3. Defaults to auto select by specified encoding
|
||||
*/
|
||||
uint8_t func;
|
||||
|
||||
/*!
|
||||
\brief Binary data that will be transmitted.
|
||||
*/
|
||||
uint8_t* data;
|
||||
|
||||
/*!
|
||||
\brief Length of binary data to transmit (in bytes).
|
||||
*/
|
||||
size_t data_len;
|
||||
|
||||
/*!
|
||||
\brief Encoding to be used (BCD or ASCII). Defaults to RADIOLIB_PAGER_BCD.
|
||||
*/
|
||||
uint8_t encoding;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class PagerClient
|
||||
\brief Client for Pager communication.
|
||||
|
@ -119,6 +151,13 @@ class PagerClient {
|
|||
*/
|
||||
int16_t transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t encoding = RADIOLIB_PAGER_BCD, uint8_t function = RADIOLIB_PAGER_FUNC_AUTO);
|
||||
|
||||
/*!
|
||||
\brief Message transmit method.
|
||||
\param message Message object that will be transmitted.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t transmit(PagerMessage_t &message);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
/*!
|
||||
\brief Start reception of POCSAG packets.
|
||||
|
|
Loading…
Add table
Reference in a new issue