C++/CLI Sample
Demonstrates how to create a C++/CLI library using the VideoXpert SDK
CPPCli::DataStorage Class Reference

The DataStorage class represents a data storage provider in the system (e.g. an NSM5200 storage pool or a VxRecorder) hosted by a system device. The DataStorage can be directed to store media produced by a device by assigning the device to it. More...

#include <DataStorage.h>

Public Types

enum  DataStorageTypes {
  DataStorageTypes::Unknown,
  DataStorageTypes::DigitalSentry,
  DataStorageTypes::NSM,
  DataStorageTypes::VideoXpertStorage,
  DataStorageTypes::Edge
}
 Values that represent data storage hardware types. More...
 

Public Member Functions

 DataStorage (VxSdk::IVxDataStorage *vxDataStorage)
 Constructor. More...
 
virtual ~DataStorage ()
 Destructor. More...
 
 !DataStorage ()
 Finaliser. More...
 
Results::Value AssignDevice (NewDeviceAssignment^ newDeviceAssignment)
 Assign a device to this data storage to be managed and recorded based on its configuration. More...
 
Results::Value Refresh ()
 Refreshes this instances properties. More...
 
Results::Value UnassignDevice (Device^ device)
 Unassign a device from this data storage. More...
 

Package Functions

System::Collections::Generic::List< CPPCli::DataSource^ >^ _GetDataSources ()
 
System::Collections::Generic::List< CPPCli::DeviceAssignment^ >^ _GetDeviceAssignments ()
 
System::Collections::Generic::List< CPPCli::Driver^ >^ _GetDrivers ()
 
CPPCli::Device_GetHostDevice ()
 
CPPCli::Configuration::Storage_GetStorageConfig ()
 

Package Attributes

VxSdk::IVxDataStorage_dataStorage
 

Properties

CPPCli::Configuration::Storage^  Configuration [get]
 Gets the device assignments for this data storage. More...
 
System::Collections::Generic::List< CPPCli::DataSource^ >^ DataSources [get]
 Gets the data sources assigned to this data storage. More...
 
System::Collections::Generic::List< CPPCli::DeviceAssignment^ >^ DeviceAssignments [get]
 Gets the device assignments for this data storage. More...
 
System::Collections::Generic::List< CPPCli::Driver^ >^ Drivers [get]
 Gets the drivers provided by this data storage. More...
 
CPPCli::Device^  HostDevice [get]
 Gets the device that hosts this data storage. More...
 
System::String^  Id [get]
 Gets the unique identifier of the data storage. More...
 
bool IsFailover [get]
 Gets a value indicating whether the data storage is configured as a failover unit. More...
 
System::String^  Name [get, set]
 Gets or sets the friendly name of the data storage. More...
 
DataStorageTypes Type [get]
 Gets the type of data storage. More...
 

Detailed Description

The DataStorage class represents a data storage provider in the system (e.g. an NSM5200 storage pool or a VxRecorder) hosted by a system device. The DataStorage can be directed to store media produced by a device by assigning the device to it.

Definition at line 18 of file DataStorage.h.

Member Enumeration Documentation

Values that represent data storage hardware types.

Enumerator
Unknown 

An error or unknown value was returned.

DigitalSentry 

A Digital Sentry device.

NSM 

An NSM network video recorder device.

VideoXpertStorage 

A VideoXpert storage device.

Edge 

An edge storage device.

Definition at line 24 of file DataStorage.h.

24  {
26  Unknown,
27 
29  DigitalSentry,
30 
32  NSM,
33 
35  VideoXpertStorage,
36 
38  Edge
39  };

Constructor & Destructor Documentation

CPPCli::DataStorage::DataStorage ( VxSdk::IVxDataStorage vxDataStorage)

Constructor.

Parameters
vxDataStorageThe vx data storage.

Definition at line 8 of file DataStorage.cpp.

8  {
9  _dataStorage = vxDataStorage;
10 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
virtual CPPCli::DataStorage::~DataStorage ( )
inlinevirtual

Destructor.

Definition at line 50 of file DataStorage.h.

50  {
51  this->!DataStorage();
52  }
DataStorage(VxSdk::IVxDataStorage *vxDataStorage)
Constructor.
Definition: DataStorage.cpp:8
CPPCli::DataStorage::!DataStorage ( )

Finaliser.

Definition at line 12 of file DataStorage.cpp.

12  {
14  _dataStorage = nullptr;
15 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
virtual VxResult::Value Delete() const =0

Member Function Documentation

List< CPPCli::DataSource^ > CPPCli::DataStorage::_GetDataSources ( )
package

Definition at line 56 of file DataStorage.cpp.

56  {
57  // Create a list of managed data source objects
58  List<DataSource^>^ mlist = gcnew List<DataSource^>();
59  // Create a collection of unmanaged data source objects
61 
62  // Make the GetDataSources call, which will return with the total count of data sources, this allows the client to allocate memory.
63  VxSdk::VxResult::Value result = _dataStorage->GetDataSources(dataSources);
64  // Unless there are no data sources on the system, this should return VxSdk::VxResult::kInsufficientSize
65  if (result == VxSdk::VxResult::kInsufficientSize) {
66  // An array of pointers is allocated using the size returned by the previous GetDataSources call
67  dataSources.collection = new VxSdk::IVxDataSource*[dataSources.collectionSize];
68  result = _dataStorage->GetDataSources(dataSources);
69  // The result should now be kOK since we have allocated enough space
70  if (result == VxSdk::VxResult::kOK) {
71  for (int i = 0; i < dataSources.collectionSize; i++)
72  mlist->Add(gcnew CPPCli::DataSource(dataSources.collection[i]));
73  }
74  // Remove the memory we previously allocated to the collection
75  delete[] dataSources.collection;
76  }
77  return mlist;
78 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
The DataSource class represents a data producer in the system hosted by a device. Each DataSource pro...
Definition: DataSource.h:20
virtual VxResult::Value GetDataSources(VxCollection< IVxDataSource ** > &dataSourceCollection) const =0
List< CPPCli::DeviceAssignment^ > CPPCli::DataStorage::_GetDeviceAssignments ( )
package

Definition at line 80 of file DataStorage.cpp.

80  {
81  // Create a list of managed device assignment objects
82  List<DeviceAssignment^>^ mlist = gcnew List<DeviceAssignment^>();
83  // Create a collection of unmanaged device assignment objects
85 
86  // Make the GetDeviceAssignments call, which will return with the total count of device assignments, this allows the client to allocate memory.
87  VxSdk::VxResult::Value result = _dataStorage->GetDeviceAssignments(deviceAssignments);
88  // Unless there are no device assignments on the system, this should return VxSdk::VxResult::kInsufficientSize
89  if (result == VxSdk::VxResult::kInsufficientSize) {
90  // An array of pointers is allocated using the size returned by the previous GetDeviceAssignments call
91  deviceAssignments.collection = new VxSdk::IVxDeviceAssignment*[deviceAssignments.collectionSize];
92  result = _dataStorage->GetDeviceAssignments(deviceAssignments);
93  // The result should now be kOK since we have allocated enough space
94  if (result == VxSdk::VxResult::kOK) {
95  for (int i = 0; i < deviceAssignments.collectionSize; i++)
96  mlist->Add(gcnew CPPCli::DeviceAssignment(deviceAssignments.collection[i]));
97  }
98  // Remove the memory we previously allocated to the collection
99  delete[] deviceAssignments.collection;
100  }
101  return mlist;
102 }
virtual VxResult::Value GetDeviceAssignments(VxCollection< IVxDeviceAssignment ** > &deviceAssignmentCollection) const =0
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
The DeviceAssignment class represents a device assignment.
List< CPPCli::Driver^ > CPPCli::DataStorage::_GetDrivers ( )
package

Definition at line 104 of file DataStorage.cpp.

104  {
105  // Create a list of managed driver objects
106  List<Driver^>^ mlist = gcnew List<Driver^>();
107  // Create a collection of unmanaged driver objects
109 
110  // Make the GetDrivers call, which will return with the total count of drivers, this allows the client to allocate memory.
112  // Unless there are no drivers on the system, this should return VxSdk::VxResult::kInsufficientSize
113  if (result == VxSdk::VxResult::kInsufficientSize) {
114  // An array of pointers is allocated using the size returned by the previous GetDrivers call
115  drivers.collection = new VxSdk::IVxDriver*[drivers.collectionSize];
116  result = _dataStorage->GetDrivers(drivers);
117  // The result should now be kOK since we have allocated enough space
118  if (result == VxSdk::VxResult::kOK) {
119  for (int i = 0; i < drivers.collectionSize; i++)
120  mlist->Add(gcnew CPPCli::Driver(drivers.collection[i]));
121  }
122  // Remove the memory we previously allocated to the collection
123  delete[] drivers.collection;
124  }
125  return mlist;
126 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
virtual VxResult::Value GetDrivers(VxCollection< IVxDriver ** > &driverCollection) const =0
The Driver class represents a device communication driver.
Definition: Driver.h:14
CPPCli::Device CPPCli::DataStorage::_GetHostDevice ( )
package

Definition at line 128 of file DataStorage.cpp.

128  {
129  // Get the device which hosts this data storage
130  VxSdk::IVxDevice* device = nullptr;
132 
133  // Return the device if GetHostDevice was successful
134  if (result == VxSdk::VxResult::kOK)
135  return gcnew Device(device);
136 
137  return nullptr;
138 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
virtual VxResult::Value GetHostDevice(IVxDevice *&hostDevice) const =0
CPPCli::Configuration::Storage CPPCli::DataStorage::_GetStorageConfig ( )
package

Definition at line 140 of file DataStorage.cpp.

140  {
141  // Get the storage config
142  VxSdk::IVxConfiguration::Storage* storageConfig = nullptr;
144 
145  // Return the storage config if GetStorageConfiguration was successful
146  if (result == VxSdk::VxResult::kOK)
147  return gcnew CPPCli::Configuration::Storage(storageConfig);
148 
149  return nullptr;
150 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
The Configuration class represents a VxStorage-specific configuration.
virtual VxResult::Value GetStorageConfiguration(IVxConfiguration::Storage *&storageConfig) const =0
CPPCli::Results::Value CPPCli::DataStorage::AssignDevice ( CPPCli::NewDeviceAssignment newDeviceAssignment)

Assign a device to this data storage to be managed and recorded based on its configuration.

Parameters
newDeviceAssignmentThe new device assignment to be added to the data storage.
Returns
The Result of assigning the device.

Definition at line 17 of file DataStorage.cpp.

17  {
18  // Create a new device assignment object and populate its fields using newDeviceAssignment
19  VxSdk::VxNewDeviceAssignment vxNewDeviceAssignment;
20  VxSdk::Utilities::StrCopySafe(vxNewDeviceAssignment.deviceId, Utils::ConvertSysString(newDeviceAssignment->DeviceId));
21  VxSdk::Utilities::StrCopySafe(vxNewDeviceAssignment.driverType, Utils::ConvertSysString(newDeviceAssignment->DriverType));
22  int size = newDeviceAssignment->DataSourceIds->Count;
23 
24  vxNewDeviceAssignment.dataSourceIdSize = size;
25  vxNewDeviceAssignment.dataSourceIds = new char*[size];
26  for (int i = 0; i < size; i++) {
27  int idLength = newDeviceAssignment->DataSourceIds[i]->Length + 1;
28  vxNewDeviceAssignment.dataSourceIds[i] = new char[idLength];
29  VxSdk::Utilities::StrCopySafe(vxNewDeviceAssignment.dataSourceIds[i], Utils::ConvertSysString(newDeviceAssignment->DataSourceIds[i]), idLength);
30  }
31 
32  // Make the call to add the situation into VideoXpert
33  VxSdk::VxResult::Value result = _dataStorage->AssignDevice(vxNewDeviceAssignment);
34  // Unless there was an issue adding the situation the result should be VxSdk::VxResult::kOK
35  if (result == VxSdk::VxResult::kOK) {
36  // Remove the memory we previously allocated
37  delete[] vxNewDeviceAssignment.dataSourceIds;
38  }
39  return CPPCli::Results::Value(result);
40 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
static void StrCopySafe(char(&dst)[dstSize], const char *src)
virtual VxResult::Value AssignDevice(VxNewDeviceAssignment &newDeviceAssignment) const =0
static const char * ConvertSysString(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:233
CPPCli::Results::Value CPPCli::DataStorage::Refresh ( )

Refreshes this instances properties.

Returns
The Result of updating the properties.

Definition at line 42 of file DataStorage.cpp.

42  {
44 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value Refresh()=0
CPPCli::Results::Value CPPCli::DataStorage::UnassignDevice ( CPPCli::Device device)

Unassign a device from this data storage.

Parameters
deviceThe device to be unassigned from the data storage.
Returns
The Result of unassigning the device.

Definition at line 46 of file DataStorage.cpp.

46  {
47  // Create an IVxDevice object using the device
48  VxSdk::IVxDevice* delDevice = device->_device;
49 
50  // Call UnassignDevice using the IVxDevice object
52  // Unless there was an issue unassigning the device the result should be VxSdk::VxResult::kOK
53  return CPPCli::Results::Value(result);
54 }
VxSdk::IVxDataStorage * _dataStorage
Definition: DataStorage.h:166
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value UnassignDevice(IVxDevice &device) const =0

Member Data Documentation

VxSdk::IVxDataStorage* CPPCli::DataStorage::_dataStorage
package

Definition at line 166 of file DataStorage.h.

Property Documentation

CPPCli:: Configuration:: Storage^ CPPCli::DataStorage::Configuration
get

Gets the device assignments for this data storage.

A List of device assignments.

Definition at line 83 of file DataStorage.h.

System:: Collections:: Generic:: List< CPPCli:: DataSource^>^ CPPCli::DataStorage::DataSources
get

Gets the data sources assigned to this data storage.

A List of data sources.

Definition at line 92 of file DataStorage.h.

System:: Collections:: Generic:: List< CPPCli:: DeviceAssignment^>^ CPPCli::DataStorage::DeviceAssignments
get

Gets the device assignments for this data storage.

A List of device assignments.

Definition at line 101 of file DataStorage.h.

System:: Collections:: Generic:: List< CPPCli:: Driver^>^ CPPCli::DataStorage::Drivers
get

Gets the drivers provided by this data storage.

A List of drivers.

Definition at line 110 of file DataStorage.h.

CPPCli:: Device^ CPPCli::DataStorage::HostDevice
get

Gets the device that hosts this data storage.

The host device.

Definition at line 119 of file DataStorage.h.

System:: String^ CPPCli::DataStorage::Id
get

Gets the unique identifier of the data storage.

The unique identifier.

Definition at line 128 of file DataStorage.h.

bool CPPCli::DataStorage::IsFailover
get

Gets a value indicating whether the data storage is configured as a failover unit.

true if the data storage is a failover unit, false if not.

Definition at line 137 of file DataStorage.h.

System:: String^ CPPCli::DataStorage::Name
getset

Gets or sets the friendly name of the data storage.

The friendly name.

Definition at line 146 of file DataStorage.h.

DataStorageTypes CPPCli::DataStorage::Type
get

Gets the type of data storage.

The data storage type.

Definition at line 160 of file DataStorage.h.


The documentation for this class was generated from the following files: