Device Settings (USB 3.0 Only)
The Device Settings API provides programmer access to persistent and non-persistent key / value pairs managed by the device firmware. Available Device Settings are device-specific and supported settings are listed in the corresponding device User’s Manual.
Important portions of the API are shown in the following snippet.
Code language: PHP (php)
// Retrieve the Device Settings module for the device. ErrorCode okCFrontPanel::GetDeviceSettings(okCDeviceSettings& settings); // Get a list of setting keys. int okCDeviceSettings::List(std::vector<str::string>& keys); // Get / Set an integer setting. okCDeviceSetting::GetInt(const std::string& key, UINT32 *value); okCDeviceSetting::SetInt(const std::string& key, UINT32 value); // Get / Set an string setting. okCDeviceSetting::GetString(const std::string& key, std::string *value); okCDeviceSetting::SetString(const std::string& key, std::string value); // Delete a setting okCDeviceSetting::Delete(const std::string& key); // Save settings to persistent storage. okCDeviceSetting::Save();
Persistent settings are stored in non-volatile memory (NVM) on the device. These settings are used to control startup behavior as well as runtime operation. Because they are stored in NVM, the setting persists when the device is powered off.
There is a separate API (okCDeviceSetting::Save) which must be called to commit settings to NVM. Settings are only changed in volatile memory until this method is called.
Non-persistent settings are runtime settings that are not necessarily stored in NVM. These settings usually control or monitor runtime operation. For example, controlling an on-device fan would be a runtime setting and changes to that setting affect device behavior immediately.
Note that a particular setting may be both Persistent and Non-Persistent. The determination is device-specific and the implication of a setting that is both Persistent and Non-Persistent is that changing the setting affects device behavior immediately and is also used during device startup to affect behavior at that time. For example, a fan setting that is both persistent and non-persistent will modify the fan operation immediately and, if written to NVM, the device will restore that operation on boot.
The setting store is a block of NVM in System Flash that has been set aside for persistent setting storage. This block is read at device startup and is written upon calling the API method okCDeviceSetting::Save.