Click or drag to resize

IStorageManager Interface

Allows to get Storages from BVMS configuration.

Namespace: Bosch.Vms.SDK
Assembly: Bosch.Vms.SDK (in Bosch.Vms.SDK.dll) Version: 1.9.0.0
Syntax
C#
public interface IStorageManager : IDeviceManager

The IStorageManager type exposes the following members.

Methods
 NameDescription
Public methodGetConnectionState Gets the ConnectionState of a device.
(Inherited from IDeviceManager)
Public methodGetDeviceById Retrieves device handle by ID.
(Inherited from IDeviceManager)
Public methodGetDeviceByName Retrieves device handle by name.
(Inherited from IDeviceManager)
Public methodGetDeviceInfoList Gets information about all devices.
(Inherited from IDeviceManager)
Public methodGetInitialStates Triggers submission of current device state events to registered event receivers.
(Inherited from IDeviceManager)
Public methodGetName Retrieves device name.
(Inherited from IDeviceManager)
Public methodGetStorageById Retrieves storage handle by id.
Public methodGetStorageByName Retrieves storage handle by name.
Public methodGetStorageInfoList Gets information about all storages.
Top
Example
This sample shows how to register for Storage events. First, derive a class from EventReceiver and overwrite the event callback method OnEvent(EventData).
C#
internal class TestEventReceiver : EventReceiver
{
    public override void OnEvent(EventData eventData)
    {
        if (eventData.State.IsValid && eventData.Type.Equals("ConnectionState"))
        { 
            if (eventData.State.New.Equals("Connected"))
            {
                Console.WriteLine("Storage is connected");
            }
            if (eventData.State.New.Equals("Disconnected"))
            {
                Console.WriteLine("Storage is disconnected"); 
            }
            if (eventData.State.New.Equals("NotAuthorized"))
            {
                Console.WriteLine("Storage authorization failed."); 
            }
            if (eventData.State.New.Equals("Unknown"))
            {
                Console.WriteLine("Storage state is unknown."); 
            }
        }
    }
}

Get Storage (e.g. using GetStorageByName(String)) and register the event receiver for device (using Register(EventReceiver, Device)). Event receiver will receive events only for selected Storage.

C#
Storage storage = remoteServerApi.StorageManager.GetStorageByName("Storage 1");
TestEventReceiver eventReceiver = new TestEventReceiver();
remoteServerApi.EventManager.Register(eventReceiver, storage);
...
Do not forget to unregister the event receiver.
C#
remoteServerApi.EventManager.Unregister(eventReceiver);

See Also