BVMS Server- and Client-SDK
BVMS Server- and Client-SDK
BVMS Server- and Client-SDK
Bosch.Vms.SDK
IStorageManager Interface
IStorageManager Methods

# 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#
Copy

    public interface IStorageManager : IDeviceManager

The IStorageManager type exposes the following members.

Methods

| Name | Description
--- | --- | ---
| GetConnectionState | Gets the ConnectionState of a device. (Inherited from IDeviceManager)
| GetDeviceById | Retrieves device handle by ID. (Inherited from IDeviceManager)
| GetDeviceByName | Retrieves device handle by name. (Inherited from IDeviceManager)
| GetDeviceInfoList | Gets information about all devices. (Inherited from IDeviceManager)
| GetInitialStates | Triggers submission of current device state events to registered event receivers. (Inherited from IDeviceManager)
| GetName | Retrieves device name. (Inherited from IDeviceManager)
| GetStorageById | Retrieves storage handle by id.
| GetStorageByName | Retrieves storage handle by name.
| GetStorageInfoList | 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#
Copy

    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#
Copy

    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#
Copy

    remoteServerApi.EventManager.Unregister(eventReceiver);

See Also

#### Reference

Bosch.Vms.SDK Namespace

Copyright © Bosch Sicherheitssysteme GmbH