t
Dependencies: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos
Fork of DMSupport by
Diff: Registry.h
- Revision:
- 34:fc366bab393f
- Parent:
- 20:9df19da50290
--- a/Registry.h Thu Feb 19 14:41:14 2015 +0100 +++ b/Registry.h Mon Mar 09 11:15:56 2015 +0100 @@ -70,10 +70,56 @@ */ RegistryError load(); + /** Sets (or replaces if existing) the value for the key + * + * The key/value parameters are copied so it is ok to free them + * after calling this function. + * + * @param key the key to create or update + * @param val the value to store for the key + * + * @returns + * Ok on success + * An error code on failure + */ RegistryError setValue(const char* key, const char* val); + + /** Gets (if any) the the value for the key + * + * If Ok is returned then pVal will point to allocated memory + * that must be deallocated with free() by the caller. + * + * @param key the key to look for + * @param pVal will hold the value if successful + * + * @returns + * Ok on success + * NoSuchKeyError if there is no value for the key + * An error code on failure + */ RegistryError getValue(const char* key, char** pVal); + + /** Retrieves the key-value pair at the specified index + * + * If Ok is returned then pKey and pVal will point to allocated + * memory that must be deallocated with free() by the caller. + * + * @param pos the index to look for + * @param pKey will hold the key if successful + * @param pVal will hold the value if successful + * + * @returns + * Ok on success + * An error code on failure + */ RegistryError entryAt(int pos, char** pKey, char** pVal); + + /** Returns the number of key-value pairs in the registry + * + * @returns the number of key-value pairs + */ int numEntries() { return _numEntries; } + RegistryError registerListener(); /** Stores the registry in the internal EEPROM