pfodParser 3.61.0 The pfodParser library is handles commands sent from the Android pfodApp, pfodApp supports WiFi, BLE, Bluetooth and SMS connections

Public Member Functions | Static Public Member Functions | List of all members
pfodSecurity Class Reference

`#include <pfodSecurity.h>`

Inherits pfodParser.

## Public Member Functions
| pfodSecurity ()
| pfodSecurity (const char *_version)
size_t | write (uint8_t)
size_t | write (const uint8_t *buffer, size_t size)
void | flush ()
int | read ()
int | peek ()
int | available ()
byte * | getRawCmd ()
void | setIdleTimeout (unsigned long timeout_in_seconds)
| Set the idle Timeout in sec i.e. More...
unsigned long | getIdleTimeout ()
bool | isIdleTimeout ()
void | setDebugStream (Print *debugOut)
void | connect (Stream *io_arg)
| initialize the Security parser args io_arg the Stream pointer to read and write to for pfod messages More...
void | connect (Stream *io_arg, const __FlashStringHelper *hexKeyPgr, int eepromAddress=0)
void | connect (pfod_Base *_pfodBase)
void | connect (pfod_Base *_pfodBase, const __FlashStringHelper *hexKeyPgr, int eepromAddress=0)
Stream * | getPfodAppStream ()
void | closeConnection ()
byte | parse ()
void | addDwg (pfodDrawing *dwgPtr)
void | init ()
Public Member Functions inherited from pfodParser
| pfodParser ()
| pfodParser (const char *version)
virtual bool | isRefresh ()
virtual const char * | getVersionRequested ()
virtual const char * | getVersion ()
virtual void | setVersion (const char *version)
virtual void | sendVersion ()
virtual void | sendRefreshAndVersion (unsigned long refresh_mS)
virtual byte * | getCmd ()
virtual byte * | getFirstArg ()
virtual byte * | getNextArg (byte *start)
virtual byte | getArgsCount ()
virtual byte * | parseLong (byte *idxPtr, long *result)
virtual bool | cmdEquals (const char *cmdStr)
virtual bool | cmdEquals (const char cmdChar)
virtual bool | cmdEquals (pfodAutoCmd &a_Cmd)
virtual byte | getParserState ()
| pfodWaitingForStart if outside msg pfodMsgStarted if just seen opening { pfodInMsg in msg after { pfodMsgEnd if just seen closing } More...
virtual void | setCmd (byte cmd)
virtual void | setDebugOut (Print *out)
virtual void | setDebug (Print *out)
void | init ()
virtual byte | parse (byte in)
virtual void | ignoreSeqNum ()
virtual byte | parseDwgCmd ()
virtual const byte * | getDwgCmd ()
virtual bool | dwgCmdEquals (const char *dwgCmdStr)
virtual bool | dwgCmdEquals (pfodAutoCmd &a_Cmd)
virtual bool | dwgCmdEquals (const char dwgCmd)
virtual bool | isTouch ()
virtual bool | isClick ()
virtual bool | isDown ()
virtual bool | isDrag ()
virtual bool | isUp ()
virtual bool | isPress ()
virtual const byte * | getEditedText ()
virtual uint8_t | getTouchType ()
virtual int | getTouchedCol ()
virtual int | getTouchedRow ()
virtual int | getTouchedY ()
virtual int | getTouchedX ()

## Static Public Member Functions
static int | getBytesFromPassword (char *hexKey, int hexKeyLen, byte *keyBytes, int keyMaxLen)
static uint32_t | decodePasswordBytes (byte *bytes, int idx, int bytesLen)
static uint8_t | byte64ToByte (uint8_t b)

## Additional Inherited Members
Static Public Attributes inherited from pfodParser
static const byte | pfodMaxMsgLen = 0xff
static const byte | pfodWaitingForStart = 0xff
static const byte | pfodMsgStarted = '{'
static const byte | pfodRefresh = ':'
static const byte | pfodInMsg = 0
static const byte | pfodMsgEnd = '}'
static const int | TOUCH = 0
static const int | DOWN = 1
static const int | DRAG = 2
static const int | UP = 4
static const int | CLICK = 8
static const int | PRESS = 16
static const int | DOWN_UP = 256
static const int | TOUCH_DISABLED = 512

## Detailed Description

Definition at line 63 of file pfodSecurity.h.

## Constructor & Destructor Documentation

## ◆ pfodSecurity() [1/2]

pfodSecurity::pfodSecurity | ( |  | ) |

## ◆ pfodSecurity() [2/2]

pfodSecurity::pfodSecurity | ( | const char * | _version | ) |

## Member Function Documentation

## ◆ addDwg()

void pfodSecurity::addDwg | ( | pfodDrawing * | dwgPtr | ) |
| virtual

Reimplemented from pfodParser.

## ◆ available()

int pfodSecurity::available | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ byte64ToByte()

static uint8_t pfodSecurity::byte64ToByte | ( | uint8_t | b | ) |
| static

## ◆ closeConnection()

void pfodSecurity::closeConnection | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ connect() [1/4]

void pfodSecurity::connect | ( | pfod_Base * | _pfodBase | ) |

## ◆ connect() [2/4]

void pfodSecurity::connect | ( | pfod_Base * | _pfodBase,
|  | const __FlashStringHelper * | hexKeyPgr,
|  | int | eepromAddress = `0`
| ) |  |

## ◆ connect() [3/4]

void pfodSecurity::connect | ( | Stream * | io_arg | ) |
| virtual

initialize the Security parser args io_arg the Stream pointer to read and write to for pfod messages

eepromAddress the starting address in eeprom to save the key and power cycles amount of eeprom used is (2 bytes power cycles + 1 byte key length + key bytes) ==> 3 + (input hexKey length)/2, use -1 to disable use of EEPROM, pfod_EEPROM.h will also disable EEPROM use for those boards that do not have EEPROm

hexKey pointer to program memory F("hexString") holding the key if this key is different from the current one in eeprom the eeprom is updated and the power cycles are reset to 0xffff if changing the key suggest you add 2 to your eepromAddress to move on from the previous one. The power cycle EEPROM addresses are are written to on each power up if hexKey is omitted or empty or blank then there is no sercurity used and EEPROM is not used.

Reimplemented from pfodParser.

## ◆ connect() [4/4]

void pfodSecurity::connect | ( | Stream * | io_arg,
|  | const __FlashStringHelper * | hexKeyPgr,
|  | int | eepromAddress = `0`
| ) |  |

## ◆ decodePasswordBytes()

static uint32_t pfodSecurity::decodePasswordBytes | ( | byte * | bytes,
|  | int | idx,
|  | int | bytesLen
| ) |  |
| static

## ◆ flush()

void pfodSecurity::flush | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ getBytesFromPassword()

static int pfodSecurity::getBytesFromPassword | ( | char * | hexKey,
|  | int | hexKeyLen,
|  | byte * | keyBytes,
|  | int | keyMaxLen
| ) |  |
| static

## ◆ getIdleTimeout()

unsigned long pfodSecurity::getIdleTimeout | ( |  | ) |

## ◆ getPfodAppStream()

Stream* pfodSecurity::getPfodAppStream | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ getRawCmd()

byte* pfodSecurity::getRawCmd | ( |  | ) |

## ◆ init()

void pfodSecurity::init | ( |  | ) |

## ◆ isIdleTimeout()

bool pfodSecurity::isIdleTimeout | ( |  | ) |

## ◆ parse()

byte pfodSecurity::parse | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ peek()

int pfodSecurity::peek | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ read()

int pfodSecurity::read | ( |  | ) |
| virtual

Reimplemented from pfodParser.

## ◆ setDebugStream()

void pfodSecurity::setDebugStream | ( | Print * | debugOut | ) |
| virtual

Reimplemented from pfodParser.

## ◆ setIdleTimeout()

void pfodSecurity::setIdleTimeout | ( | unsigned long | timeout_in_seconds | ) |
| virtual

Set the idle Timeout in sec i.e.

15 ==> 15sec, 0 means never timeout Default is 15 (sec) When set to >0 then if no incoming msg received for this time (in Sec), then the parser will return DisconnectNow to disconnect the link

Setting this to non-zero value protects against a hacker taking over your connection and just hanging on to it not sending any msgs but not releasing it, so preventing you from re-connecting. when setting to non-zero you can use the pfod re-request time to ask the pfodApp to re-request a menu every so often to prevent the connection timing out while the pfodApp is running. See the pfod Specification for details.

Set to >0 to enable the timeout (recommended)

Reimplemented from pfodParser.

## ◆ write() [1/2]

size_t pfodSecurity::write | ( | const uint8_t * | buffer,
|  | size_t | size
| ) |  |
| virtual

Reimplemented from pfodParser.

## ◆ write() [2/2]

size_t pfodSecurity::write | ( | uint8_t |  | ) |
| virtual

Reimplemented from pfodParser.