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

The Situation class represents a particular situation configuration that specifies how corresponding events shall be generated and handled when the situation is detected. More...

#include <Situation.h>

Public Member Functions

 Situation (VxSdk::IVxSituation *vxSituation)
 Constructor. More...
 
virtual ~Situation ()
 Destructor. More...
 
 !Situation ()
 Finaliser. More...
 
Results::Value AddNotification (Notification^ notification)
 Adds a notification to the list of notifications that this situation serves. More...
 
Results::Value Link (DataSource^ dataSource)
 Associate a data source with this situation. More...
 
Results::Value Link (Device^ device)
 Associate a device with this situation. More...
 
Results::Value Refresh ()
 Update this instances properties. More...
 
Results::Value RemoveNotification (Notification^ notification)
 Removes a notification from the list of notifications that this situation serves. More...
 
Results::Value UnLink (Device^ device)
 Remove device association from this situation. More...
 
Results::Value UnLink (DataSource^ dataSource)
 Remove data source association from this situation. More...
 

Package Functions

System::Collections::Generic::List< DataSource^ >^ _GetLinkedDataSources ()
 
System::Collections::Generic::List< Device^ >^ _GetLinkedDevices ()
 
System::Collections::Generic::List< Notification^ >^ _GetNotifications ()
 
System::Collections::Generic::List< int >^ _GetSnoozeIntervals ()
 

Package Attributes

VxSdk::IVxSituation_situation
 

Properties

int AudibleLoopDelay [get, set]
 Gets or sets the seconds to wait between audible notifications. More...
 
int AudiblePlayCount [get, set]
 Gets or sets the amount of times to play audible notifications. More...
 
int AutoAcknowledge [get, set]
 Gets or sets the number of seconds after which a generated event state will be set to AutoAcked. More...
 
bool IsAckNeeded [get, set]
 Gets or sets whether the generated events shall have an initial state of AckNeeded or NoAckNeeded. More...
 
System::Collections::Generic::List< DataSource^ >^ LinkedDataSources [get]
 Gets the data sources associated with this situation. More...
 
System::Collections::Generic::List< Device^ >^ LinkedDevices [get]
 Gets the devices associated with this situation. More...
 
System::String^  Name [get, set]
 Gets or sets the situation friendly name. More...
 
System::Collections::Generic::List< Notification^ >^ Notifications [get]
 Gets the notifications configured for this situation. More...
 
System::String^  ServicePropertyId [get]
 Gets the name of the key in the properties map corresponding to the service identifier for the source of this situation, if any. More...
 
System::String^  ServiceType [get]
 Gets the resource type of the service corresponding to the source of this situation, if any. More...
 
int Severity [get, set]
 Gets or sets the severity of the generated event, from 1 (highest) to 10 (lowest). More...
 
bool ShouldExpandBanner [get, set]
 Gets or sets whether the notification banner on clients should be expanded by default. More...
 
bool ShouldLog [get, set]
 Gets or sets whether events generated from this situation shall be persisted or immediately be discarded. More...
 
bool ShouldNotify [get, set]
 Gets or sets whether an event generated from the situation shall generate notifications. More...
 
System::Collections::Generic::List< int >^ SnoozeIntervals [get, set]
 Gets or sets the default snooze intervals, in seconds, for a generated event. More...
 
System::String^  SourceDeviceId [get]
 Gets the unique source identifier. More...
 
System::String^  Type [get]
 Gets the situation type. More...
 
bool UseAudibleNotification [get, set]
 Gets or sets whether a notification sound should play on supporting clients when an event is received. More...
 

Detailed Description

The Situation class represents a particular situation configuration that specifies how corresponding events shall be generated and handled when the situation is detected.

Definition at line 15 of file Situation.h.

Constructor & Destructor Documentation

CPPCli::Situation::Situation ( VxSdk::IVxSituation vxSituation)

Constructor.

Parameters
vxSituationThe situation.

Definition at line 9 of file Situation.cpp.

9  {
10  _situation = vxSituation;
11 }
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
virtual CPPCli::Situation::~Situation ( )
inlinevirtual

Destructor.

Definition at line 27 of file Situation.h.

27  {
28  this->!Situation();
29  }
Situation(VxSdk::IVxSituation *vxSituation)
Constructor.
Definition: Situation.cpp:9
CPPCli::Situation::!Situation ( )

Finaliser.

Definition at line 13 of file Situation.cpp.

13  {
14  _situation->Delete();
15  _situation = nullptr;
16 }
virtual VxResult::Value Delete() const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269

Member Function Documentation

System::Collections::Generic::List< CPPCli::DataSource^ > CPPCli::Situation::_GetLinkedDataSources ( )
package

Definition at line 64 of file Situation.cpp.

64  {
65  // Create a list of managed data sources
66  List<CPPCli::DataSource^>^ mlist = gcnew List<CPPCli::DataSource^>();
67  // Create a collection of unmanaged data sources
69 
70  // Make the GetLinks call, which will return with the total data source count, this
71  // allows the client to allocate memory.
72  VxSdk::VxResult::Value result = _situation->GetLinks(dataSources);
73  // As long as there are data sources linked the result should be VxSdk::VxResult::kInsufficientSize
74  if (result == VxSdk::VxResult::kInsufficientSize) {
75  // Allocate enough space for the IVxDataSource collection
76  dataSources.collection = new VxSdk::IVxDataSource*[dataSources.collectionSize];
77  result = _situation->GetLinks(dataSources);
78  // The result should now be kOK since we have allocated enough space
79  if (result == VxSdk::VxResult::kOK) {
80  for (int i = 0; i < dataSources.collectionSize; i++)
81  mlist->Add(gcnew CPPCli::DataSource(dataSources.collection[i]));
82  }
83  // Remove the memory we previously allocated to the collection
84  delete[] dataSources.collection;
85  }
86  return mlist;
87 }
virtual VxResult::Value GetLinks(VxCollection< IVxDataSource ** > &dataSourceCollection) const =0
The DataSource class represents a data producer in the system hosted by a device. Each DataSource pro...
Definition: DataSource.h:20
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
System::Collections::Generic::List< CPPCli::Device^ > CPPCli::Situation::_GetLinkedDevices ( )
package

Definition at line 89 of file Situation.cpp.

89  {
90  // Create a list of managed devices
91  List<CPPCli::Device^>^ mlist = gcnew List<CPPCli::Device^>();
92  // Create a collection of unmanaged devices
94 
95  // Make the GetLinks call, which will return with the total device count, this allows the
96  // client to allocate memory.
97  VxSdk::VxResult::Value result = _situation->GetLinks(devices);
98  // As long as there are devices linked the result should be VxSdk::VxResult::kInsufficientSize
99  if (result == VxSdk::VxResult::kInsufficientSize) {
100  // Allocate enough space for the IVxDevice collection
101  devices.collection = new VxSdk::IVxDevice*[devices.collectionSize];
102  result = _situation->GetLinks(devices);
103  // The result should now be kOK since we have allocated enough space
104  if (result == VxSdk::VxResult::kOK) {
105  for (int i = 0; i < devices.collectionSize; i++)
106  mlist->Add(gcnew CPPCli::Device(devices.collection[i]));
107  }
108  // Remove the memory we previously allocated to the collection
109  delete[] devices.collection;
110  }
111  return mlist;
112 }
virtual VxResult::Value GetLinks(VxCollection< IVxDataSource ** > &dataSourceCollection) const =0
The Device class represents a particular physical device in the system.
Definition: Device.h:15
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
List< CPPCli::Notification^ > CPPCli::Situation::_GetNotifications ( )
package

Definition at line 114 of file Situation.cpp.

114  {
115  // Create a list of managed notification objects
116  List<CPPCli::Notification^>^ mlist = gcnew List<CPPCli::Notification^>();
117  // Create a collection of unmanaged notification objects
119 
120  // Make the GetNotifications call, which will return with the total notification count, this allows the client to allocate memory
121  VxSdk::VxResult::Value result = _situation->GetNotifications(notifications);
122  // The result should be kInsufficientSize if the number of notifications assigned to the situation are greater than 0
123  if (result == VxSdk::VxResult::kInsufficientSize) {
124  // Allocate enough space for the IVxNotification collection
125  notifications.collection = new VxSdk::IVxNotification*[notifications.collectionSize];
126  result = _situation->GetNotifications(notifications);
127  // The result should now be kOK since we have allocated enough space
128  if (result == VxSdk::VxResult::kOK) {
129  for (int i = 0; i < notifications.collectionSize; i++) {
130  mlist->Add(gcnew CPPCli::Notification(notifications.collection[i]));
131  }
132  }
133  // Remove the memory we previously allocated to the collection
134  delete[] notifications.collection;
135  }
136  return mlist;
137 }
virtual VxResult::Value GetNotifications(VxCollection< IVxNotification ** > &notificationCollection) const =0
The Notification class represents a particular notification configuration for a situation.
Definition: Notification.h:14
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
List< int > CPPCli::Situation::_GetSnoozeIntervals ( )
package

Definition at line 139 of file Situation.cpp.

139  {
140  // Create a managed list of integers
141  List<int>^ mlist = gcnew List<int>();
142  // Add each snooze interval to the list
143  for (int i = 0; i < _situation->snoozeIntervalSize; i++)
144  mlist->Add(_situation->snoozeIntervals[i]);
145 
146  return mlist;
147 }
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::AddNotification ( CPPCli::Notification notification)

Adds a notification to the list of notifications that this situation serves.

Parameters
notificationThe notification to be added.
Returns
The Result of adding the notification.

Definition at line 18 of file Situation.cpp.

18  {
19  // Add the notification to the situation
20  VxSdk::VxResult::Value result = _situation->AddNotification(*notification->_notification);
21  // Unless there was an issue adding the notification the result should be VxSdk::VxResult::kOK
22  return CPPCli::Results::Value(result);
23 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value AddNotification(IVxNotification &notification) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::Link ( CPPCli::DataSource dataSource)

Associate a data source with this situation.

Parameters
dataSourceThe data source to associate the situation with.
Returns
The Result of linking the data source.

Definition at line 25 of file Situation.cpp.

25  {
26  // Link a data source to a situation
27  VxSdk::VxResult::Value result = _situation->Link(*dataSource->_dataSource);
28  // Unless there was an issue linking the data source the result should be VxSdk::VxResult::kOK
29  return CPPCli::Results::Value(result);
30 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value Link(IVxDataSource &dataSource) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::Link ( CPPCli::Device device)

Associate a device with this situation.

Parameters
deviceThe device to associate the situation with.
Returns
The Result of linking the device.

Definition at line 32 of file Situation.cpp.

32  {
33  // Link a device to a situation
34  VxSdk::VxResult::Value result = _situation->Link(*device->_device);
35  // Unless there was an issue linking the device the result should be VxSdk::VxResult::kOK
36  return CPPCli::Results::Value(result);
37 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value Link(IVxDataSource &dataSource) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::Refresh ( )

Update this instances properties.

Returns
The Result of updating the properties.

Definition at line 39 of file Situation.cpp.

39  {
41 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value Refresh()=0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::RemoveNotification ( CPPCli::Notification notification)

Removes a notification from the list of notifications that this situation serves.

Parameters
notificationThe notification to be removed.
Returns
The Result of removing the notification.

Definition at line 43 of file Situation.cpp.

43  {
44  // Remove the notification to the situation
45  VxSdk::VxResult::Value result = _situation->RemoveNotification(*notification->_notification);
46  // Unless there was an issue removing the notification the result should be VxSdk::VxResult::kOK
47  return CPPCli::Results::Value(result);
48 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value RemoveNotification(IVxNotification &notification) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::UnLink ( CPPCli::Device device)

Remove device association from this situation.

Parameters
deviceThe device to remove association with.
Returns
The Result of unlinking the device.

Definition at line 57 of file Situation.cpp.

57  {
58  // Unlink a device from a situation
59  VxSdk::VxResult::Value result = _situation->UnLink(*device->_device);
60  // Unless there was an issue unlinking the device the result should be VxSdk::VxResult::kOK
61  return CPPCli::Results::Value(result);
62 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value UnLink(IVxDataSource &dataSource) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269
CPPCli::Results::Value CPPCli::Situation::UnLink ( CPPCli::DataSource dataSource)

Remove data source association from this situation.

Parameters
dataSourceThe data source to remove association with.
Returns
The Result of unlinking the data source.

Definition at line 50 of file Situation.cpp.

50  {
51  // Unlink a data source from a situation
52  VxSdk::VxResult::Value result = _situation->UnLink(*dataSource->_dataSource);
53  // Unless there was an issue unlinking the data source the result should be VxSdk::VxResult::kOK
54  return CPPCli::Results::Value(result);
55 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value UnLink(IVxDataSource &dataSource) const =0
VxSdk::IVxSituation * _situation
Definition: Situation.h:269

Member Data Documentation

VxSdk::IVxSituation* CPPCli::Situation::_situation
package

Definition at line 269 of file Situation.h.

Property Documentation

int CPPCli::Situation::AudibleLoopDelay
getset

Gets or sets the seconds to wait between audible notifications.

The seconds between audible notifications.

Definition at line 88 of file Situation.h.

int CPPCli::Situation::AudiblePlayCount
getset

Gets or sets the amount of times to play audible notifications.

The amount of times to play audible notifications.

Definition at line 98 of file Situation.h.

int CPPCli::Situation::AutoAcknowledge
getset

Gets or sets the number of seconds after which a generated event state will be set to AutoAcked.

The number of seconds before auto-acknowledgement.

Definition at line 108 of file Situation.h.

bool CPPCli::Situation::IsAckNeeded
getset

Gets or sets whether the generated events shall have an initial state of AckNeeded or NoAckNeeded.

true if events will require acknowledgement, false if not.

Definition at line 118 of file Situation.h.

System:: Collections:: Generic:: List< DataSource^>^ CPPCli::Situation::LinkedDataSources
get

Gets the data sources associated with this situation.

A list of data sources.

Definition at line 128 of file Situation.h.

System:: Collections:: Generic:: List< Device^>^ CPPCli::Situation::LinkedDevices
get

Gets the devices associated with this situation.

A list of devices.

Definition at line 137 of file Situation.h.

System:: String^ CPPCli::Situation::Name
getset

Gets or sets the situation friendly name.

The friendly name.

Definition at line 146 of file Situation.h.

System:: Collections:: Generic:: List< Notification^>^ CPPCli::Situation::Notifications
get

Gets the notifications configured for this situation.

A list of notifications.

Definition at line 160 of file Situation.h.

System:: String^ CPPCli::Situation::ServicePropertyId
get

Gets the name of the key in the properties map corresponding to the service identifier for the source of this situation, if any.

The service property identifier for the source of this situation.

Definition at line 169 of file Situation.h.

System:: String^ CPPCli::Situation::ServiceType
get

Gets the resource type of the service corresponding to the source of this situation, if any.

The service type for the source of this situation.

Definition at line 178 of file Situation.h.

int CPPCli::Situation::Severity
getset

Gets or sets the severity of the generated event, from 1 (highest) to 10 (lowest).

The event severity.

Definition at line 187 of file Situation.h.

bool CPPCli::Situation::ShouldExpandBanner
getset

Gets or sets whether the notification banner on clients should be expanded by default.

true if the banner should be expanded, false if not.

Definition at line 197 of file Situation.h.

bool CPPCli::Situation::ShouldLog
getset

Gets or sets whether events generated from this situation shall be persisted or immediately be discarded.

true if events will be logged, false if not.

Definition at line 207 of file Situation.h.

bool CPPCli::Situation::ShouldNotify
getset

Gets or sets whether an event generated from the situation shall generate notifications.

true if notifications will be sent, false if not.

Definition at line 217 of file Situation.h.

System:: Collections:: Generic:: List< int>^ CPPCli::Situation::SnoozeIntervals
getset

Gets or sets the default snooze intervals, in seconds, for a generated event.

A list of snooze intervals in seconds.

Definition at line 227 of file Situation.h.

System:: String^ CPPCli::Situation::SourceDeviceId
get

Gets the unique source identifier.

The unique source identifier.

Definition at line 244 of file Situation.h.

System:: String^ CPPCli::Situation::Type
get

Gets the situation type.

The situation type.

Definition at line 253 of file Situation.h.

bool CPPCli::Situation::UseAudibleNotification
getset

Gets or sets whether a notification sound should play on supporting clients when an event is received.

true if audio should play on event notification, false if not.

Definition at line 262 of file Situation.h.


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