PDU class, provides methods to decode a PDU message or encode a new one.
More...
#include <pdulib.h>
|
int | encodePDU (const char *recipient, const char *message) |
| Encode a PDU block for sending to an GSM modem. More...
|
|
const char * | getSMS () |
| Get the address of the PDU message created by encodePDU More...
|
|
void | setSCAnumber (const char *number) |
| Before encoding a PDU, you must supply the SCA phone number. Typically this can be retrieved from a GSM modem with the AT+CSCA? command. More...
|
|
bool | decodePDU (const char *pdu) |
| Decode a PDU, typically received from a GSM modem when in PDU mode. After a successful decoding you can retrieve the components parts, desctibed below. More...
|
|
char * | getSCAnumber () |
| Get the SCA number from a decoded PDU. More...
|
|
const char * | getSender () |
| Get the senders phone number from a decoded PDU. More...
|
|
const char * | getTimeStamp () |
| Get the Timestamp from a decoded PDU. More...
|
|
const unsigned char * | getText () |
| Get the text froma a decoded PDU. More...
|
|
PDU class, provides methods to decode a PDU message or encode a new one.
- Parameters
-
None | There are no parameters for the constructor |
◆ decodePDU()
bool PDU::decodePDU |
( |
const char * |
pdu | ) |
|
Decode a PDU, typically received from a GSM modem when in PDU mode. After a successful decoding you can retrieve the components parts, desctibed below.
- Parameters
-
- Returns
- true If the decoding succeeded.
-
false If the decoding did not succeed.
◆ encodePDU()
int PDU::encodePDU |
( |
const char * |
recipient, |
|
|
const char * |
message |
|
) |
| |
Encode a PDU block for sending to an GSM modem.
- Parameters
-
recipient | Phone number, must be numeric, no whitespace. International numbers prefixed by '+' |
message | The message in UTF-8 format |
- Returns
- int The length of the message, need for the GSM command AT+CSMG=nn
◆ getSCAnumber()
char * PDU::getSCAnumber |
( |
| ) |
|
Get the SCA number from a decoded PDU.
- Returns
- char* Pointer to the number
◆ getSender()
const char * PDU::getSender |
( |
| ) |
|
Get the senders phone number from a decoded PDU.
- Returns
- const char* Pointer to the number
◆ getSMS()
const char * PDU::getSMS |
( |
| ) |
|
Get the address of the PDU message created by encodePDU
- Returns
- const char* The pointer to the message. It already contained the CTRL/Z delimiter byte.
◆ getText()
const unsigned char * PDU::getText |
( |
| ) |
|
Get the text froma a decoded PDU.
- Returns
- const unsigned char* The message in UTF-8 format.
◆ getTimeStamp()
const char * PDU::getTimeStamp |
( |
| ) |
|
Get the Timestamp from a decoded PDU.
- Returns
- const char* The tomestamp formatted as YYYMMDDHHMMSS
◆ setSCAnumber()
void PDU::setSCAnumber |
( |
const char * |
number | ) |
|
Before encoding a PDU, you must supply the SCA phone number. Typically this can be retrieved from a GSM modem with the AT+CSCA? command.
- Parameters
-
number | The number as retrieved from the AT+CSCA? command |
The documentation for this class was generated from the following files:
- /home/henryd/Documents/PlatformIO/Projects/pdulib/src/pdulib.h
- /home/henryd/Documents/PlatformIO/Projects/pdulib/src/pdulib.cpp