Decoder class, needs an external buffer to collect the incoming data.
More...
#include <EmBencode.h>
|
| enum | {
T_STRING = 0,
T_NUMBER = 251,
T_DICT,
T_LIST,
T_POP,
T_END
} |
| | Types of tokens, as returned by nextToken().
|
| |
|
| | EmBdecode (char *buf, uint8_t len) |
| | Initialize a decoder instance with the specified buffer space. More...
|
| |
|
uint8_t | reset () |
| | Reset the decoder - can be called to prepare for a new round of decoding.
|
| |
| uint8_t | process (char ch) |
| | Process a single incoming caharacter. More...
|
| |
| uint8_t | nextToken () |
| | Call this after process() is done, to extract each of the data tokens. More...
|
| |
| const char * | asString (uint8_t *plen=0) |
| | Extract the last token as string (works for T_STRING and T_NUMBER). More...
|
| |
| long | asNumber () |
| | Extract the last token as number (also works for strings if numeric). More...
|
| |
|
|
char | level |
| |
|
char * | bufPtr |
| |
|
uint8_t | bufLen |
| |
|
uint8_t | count |
| |
|
uint8_t | next |
| |
|
uint8_t | last |
| |
|
uint8_t | state |
| |
Decoder class, needs an external buffer to collect the incoming data.
| EmBdecode::EmBdecode |
( |
char * |
buf, |
|
|
uint8_t |
len |
|
) |
| |
|
inline |
Initialize a decoder instance with the specified buffer space.
- Parameters
-
| buf | Pointer to the buffer which will be used by the decoder. |
| len | Size of the buffer, must be in the range 50 to 255. |
| long EmBdecode::asNumber |
( |
| ) |
|
Extract the last token as number (also works for strings if numeric).
- Returns
- Returns the decoded integer, max 32-bit signed in this version.
| const char * EmBdecode::asString |
( |
uint8_t * |
plen = 0 | ) |
|
Extract the last token as string (works for T_STRING and T_NUMBER).
- Parameters
-
| plen | This variable will receive the size, if present. |
- Returns
- Returns pointer to a zero-terminated string in the decode buffer.
| uint8_t EmBdecode::nextToken |
( |
| ) |
|
Call this after process() is done, to extract each of the data tokens.
- Returns
- Returns one of the T_STRING .. T_END enumeration codes.
| uint8_t EmBdecode::process |
( |
char |
ch | ) |
|
Process a single incoming caharacter.
- Returns
- Returns a count > 0 when the buffer contains a complete packet.
The documentation for this class was generated from the following files: