Plugin configuration Change

Hi,

is there a way to notify plugin configuration change to smart client running the plugin, if we change setting in management plugin can we notify config change and be able to retreive new config without relogin smartclient

if you set the EnableConfigurationChangedService property of the EnvironmentManager to true in e.g. the plugin definition Init() method like this:

if (EnvironmentManager.Instance.EnvironmentType == EnvironmentType.SmartClient)

{

EnvironmentManager.Instance.EnableConfigurationChangedService = true;

}

You can then subscribe to MessageId.Server.ConfigurationChangedIndication wherever you need to be notified:

EnvironmentManager.Instance.RegisterReceiver(myHandler, new MessageIdFilter(MessageId.Server.ConfigurationChangedIndication));

In the handler you can then check on the message.RelatedFQID.Kind to see if it matches the kind of the items you define in your plugin.

Please be aware that there is a delay of up to 60 seconds between the change and the notification in the Smart Client.

Ok This we have done.

Can we retrieve the updated plugin configuration in smart client upon ConfigurationChangedIndication message

Yes. Configuration.Instance.GetItemConfigurations with your plugin id, null as parent and your kind, will return the updated configuration.

Ok will we get new configuration even without re-login

Yes

Thanks,

when a camera is deleted from server and in plugin can we know its deleted by using Configuration.Instance.GetItem(camera.FQID) with relogin

GetItem will return null if the camera no longer exists on the system.

will we get null in GetItem in plugin when camera is deleted in maganement but smart client is not relogined

If you listen to the System.SystemConfigurationChangedIndication you will be notified when a camera is deleted, but the configuration in the Smart Client is not reloaded so you cannot detect what has changed. Either the user will have to do a relogin or you can send the message SmartClient.ReloadConfigurationCommand to force the Smart Client to reload. But please be very careful about using the latter - it takes time and will cause the entire session to be reloaded so if the operator is in the midst of something it will be lost.