libPocuter  1.0
Support library for programming the Pocuter
PocuterConfig Class Reference

save configuration on the SD Card or get app specific configuration data More...

#include <PocuterConfig.h>

Public Member Functions

 PocuterConfig (const uint8_t *configName, uint64_t *appID=NULL)
 constructor for a new config instance More...
 
 PocuterConfig (uint64_t appID)
 constructor for a new config instance for retrieving the app metadata More...
 
bool get (const uint8_t *section, const uint8_t *name, uint8_t *result, size_t maxLength, bool decrypt=false)
 get string data More...
 
bool set (const uint8_t *section, const uint8_t *name, const uint8_t *value, bool encrypt=false)
 set string data More...
 
bool del (const uint8_t *section, const uint8_t *name)
 delete a value More...
 
uint32_t get (const uint8_t *section, const uint8_t *name)
 get a 32bit unsigned number value More...
 
bool set (const uint8_t *section, const uint8_t *name, uint32_t value)
 set a 32bit unsigned number value More...
 
bool getBinary (const uint8_t *section, const uint8_t *name, void *result, size_t maxLength, bool decrypt=false)
 get a binary data blob More...
 
bool setBinary (const uint8_t *section, const uint8_t *name, const void *value, size_t valueLength, bool encrypt=false)
 set a binary data blob More...
 
virtual ~PocuterConfig ()
 

Detailed Description

save configuration on the SD Card or get app specific configuration data

Constructor & Destructor Documentation

◆ PocuterConfig() [1/2]

PocuterConfig::PocuterConfig ( const uint8_t *  configName,
uint64_t *  appID = NULL 
)

constructor for a new config instance

Note
the appIF is optional. If you do not give an appID the ID of the currently running app will be used.
Parameters
configNamea name for this configuration
appID(optional)the appID

◆ PocuterConfig() [2/2]

PocuterConfig::PocuterConfig ( uint64_t  appID)

constructor for a new config instance for retrieving the app metadata

Note
the app meta data is readonly. Meta data could be the name or the creator for example.
Parameters
appIDthe appID

◆ ~PocuterConfig()

virtual PocuterConfig::~PocuterConfig ( )
virtual

Member Function Documentation

◆ del()

bool PocuterConfig::del ( const uint8_t *  section,
const uint8_t *  name 
)

delete a value

Parameters
sectionthe section designation
namethe name
Returns
bool - true if it was successfully deleted

◆ get() [1/2]

uint32_t PocuterConfig::get ( const uint8_t *  section,
const uint8_t *  name 
)

get a 32bit unsigned number value

Note
if you need to know, if this value exists please save the value as a string or binary instead
Parameters
sectionthe section designation
namethe name
Returns
the value. It will returns a 0, if the value does not exist.

◆ get() [2/2]

bool PocuterConfig::get ( const uint8_t *  section,
const uint8_t *  name,
uint8_t *  result,
size_t  maxLength,
bool  decrypt = false 
)

get string data

Note
If the data is encrypted, only the pocuter where the data was stored can decrypt it.
Parameters
sectionthe section designation
namethe name
resultthe resulting string. The memory has to be allocated before calling this function.
maxLengththe size of the buffer
decrypt(optional) decrypt - set it to true if the data is encrypted
Returns
bool - true if it was successfully read

◆ getBinary()

bool PocuterConfig::getBinary ( const uint8_t *  section,
const uint8_t *  name,
void *  result,
size_t  maxLength,
bool  decrypt = false 
)

get a binary data blob

Note
If the data is encrypted, only the pocuter where the data was stored can decrypt it.
Parameters
sectionthe section designation
namethe name
resultthe resulting data blob. The memory has to be allocated before calling this function.
maxLengthsize of the buffer
decrypt(optional)does it need to be decrypted?
Returns
bool - true if it was successfully loaded

◆ set() [1/2]

bool PocuterConfig::set ( const uint8_t *  section,
const uint8_t *  name,
const uint8_t *  value,
bool  encrypt = false 
)

set string data

Note
If the data is encrypted, only the pocuter where the data was stored can decrypt it. If the section and the name exists already it will be overwritten
Parameters
sectionthe section designation
namethe name
valuethe zero terminated string value
encrypt(optional) decrypt - set it to true if the data is encrypted
Returns
bool - true if it was successfully set

◆ set() [2/2]

bool PocuterConfig::set ( const uint8_t *  section,
const uint8_t *  name,
uint32_t  value 
)

set a 32bit unsigned number value

Parameters
sectionthe section designation
namethe name
valuethe the uin32_t value
Returns
bool - true if it was successfully deleted

◆ setBinary()

bool PocuterConfig::setBinary ( const uint8_t *  section,
const uint8_t *  name,
const void *  value,
size_t  valueLength,
bool  encrypt = false 
)

set a binary data blob

Note
If the data is encrypted, only the pocuter where the data was stored can decrypt it.
Parameters
sectionthe section designation
namethe name
valuethe data blob
valueLengththe size of the data blob
encrypt(optional)should it be encrypted?
Returns
bool - true if it was successfully saved

The documentation for this class was generated from the following file: