The settings of a plugin are divided into device and per channel settings. All settings are stored in an internal format very similar to the windows registry.
The plugin has to define its default settings that are later modified by the user (GSCSetup). Here is an example (in pseudo code) of defining default device settings:
CComPtr<IPluginSettingsDefaultParameters> GetDefaultSettings(IGSCMediaPlugin* pluginHandler)
{
PluginDefaultSettings settings(pluginHandler);
// Write default settings for plugin device
ReadWritePluginSettings deviceSettings(settings.DefaultParametersForDevice());
// web cam in Berlin
deviceSettings.WriteString("Snapshot URL",
"http://www.dhm.de/webcams/pics/cam4_huge.jpg");
return settings.GetDefaultParameters();
}
Default channel settings are defined by this:
// Write default settings for the channels of the plugin device
ReadWritePluginSettings channelSettings(settings.DefaultParametersForChannels());
channelSettings.WriteInt("foo", 1);
The plugin notifies the default settings to the server during device registration:
// register the device
SetSimpleDevice(pluginHandler, MediaDataLoop, localDeviceProperties, i, GetDefaultSettings(pluginHandler));
If the user changes the system settings (GSCSetup) the server fires the event “peNewSettings”.
Please not, that this event is also fired, if the settings of the device are not affected. So it would be a good idea for the plugin to check if one of its settings has changed or not.
The following example (in pseudo code) demonstrates reading the plugin settings:
SettingsReader reader(simpleDevice);
...
const ReadWritePluginSettings& deviceSettings = reader.DeviceSettings();
string NewSnapshotURL = deviceSettings.ReadString("Snapshot URL");