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

The Schedule class represents a recording schedule. A schedule is a group of 0 or more resources associated with a set of time and/or event based schedule triggers that, when any are active, cause the scheduled action to be performed. More...

#include <Schedule.h>

Public Types

enum  Actions {
  Actions::Unknown,
  Actions::EventSourceRecord,
  Actions::Record
}
 Values that represent schedule recording actions. More...
 

Public Member Functions

 Schedule (VxSdk::IVxSchedule *vxSchedule)
 Constructor. More...
 
virtual ~Schedule ()
 Destructor. More...
 
 !Schedule ()
 Finaliser. More...
 
CPPCli::Results::Value AddScheduleTrigger (CPPCli::NewScheduleTrigger^ newScheduleTrigger)
 Add a new schedule trigger to the schedule. More...
 
CPPCli::Results::Value DeleteScheduleTrigger (CPPCli::ScheduleTrigger^ scheduleTrigger)
 Delete a schedule trigger from the schedule. This will delete the schedule trigger from any other schedules as well. More...
 
System::Collections::Generic::List< DataSource^ >^ GetLinks ()
 Get the data sources linked to the schedule. More...
 
Results::Value Link (System::Collections::Generic::List< DataSource^ >^dataSources)
 Add data sources to the schedule. More...
 
Results::Value Refresh ()
 Update this instances properties. More...
 
Results::Value Unlink (System::Collections::Generic::List< DataSource^ >^dataSources)
 Delete existing data sources from the schedule. More...
 

Package Functions

System::Collections::Generic::List< ScheduleTrigger^ >^ _GetScheduleTriggers ()
 

Package Attributes

VxSdk::IVxSchedule_schedule
 

Properties

System::Collections::Generic::List< ScheduleTrigger^ >^ ScheduleTriggers [get]
 Gets the schedule triggers associated with this schedule. More...
 
Actions Action [get, set]
 Gets or sets the action performed when the schedule is active. More...
 
System::String^  Id [get]
 Gets the unique identifier of the schedule. More...
 
System::String^  Name [get, set]
 Gets or sets the friendly name of the schedule. More...
 
bool UseAllDataSources [get, set]
 Gets or sets a value indicating whether the schedule applies to all data sources. More...
 

Detailed Description

The Schedule class represents a recording schedule. A schedule is a group of 0 or more resources associated with a set of time and/or event based schedule triggers that, when any are active, cause the scheduled action to be performed.

Definition at line 17 of file Schedule.h.

Member Enumeration Documentation

Values that represent schedule recording actions.

Enumerator
Unknown 

An error or unknown value was returned.

EventSourceRecord 

Record only the resource (associated with the Schedule) that was the source of the event causing the schedule trigger to activate.

Record 

Record all resources associated with the schedule.

Definition at line 23 of file Schedule.h.

23  {
25  Unknown,
26 
29  EventSourceRecord,
30 
32  Record
33  };

Constructor & Destructor Documentation

CPPCli::Schedule::Schedule ( VxSdk::IVxSchedule vxSchedule)

Constructor.

Parameters
vxScheduleThe vx schedule.

Definition at line 8 of file Schedule.cpp.

8  {
9  _schedule = vxSchedule;
10 }
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
virtual CPPCli::Schedule::~Schedule ( )
inlinevirtual

Destructor.

Definition at line 44 of file Schedule.h.

44  {
45  this->!Schedule();
46  }
Schedule(VxSdk::IVxSchedule *vxSchedule)
Constructor.
Definition: Schedule.cpp:8
CPPCli::Schedule::!Schedule ( )

Finaliser.

Definition at line 12 of file Schedule.cpp.

12  {
13  _schedule->Delete();
14  _schedule = nullptr;
15 }
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
virtual VxResult::Value Delete() const =0

Member Function Documentation

List< CPPCli::ScheduleTrigger^ > CPPCli::Schedule::_GetScheduleTriggers ( )
package

Definition at line 140 of file Schedule.cpp.

140  {
141  // Create a list of managed trigger objects
142  List<CPPCli::ScheduleTrigger^>^ mlist = gcnew List<CPPCli::ScheduleTrigger^>();
143  // Create a collection of unmanaged trigger objects
145 
146  // Make the GetScheduleTriggers call, which will return with the total trigger count,
147  // this allows the client to allocate memory
148  VxSdk::VxResult::Value result = _schedule->GetScheduleTriggers(scheduleTriggers);
149  // Unless there are no triggers associated with the schedule, this should return VxSdk::VxResult::kInsufficientSize
150  if (result == VxSdk::VxResult::kInsufficientSize) {
151  // Allocate enough space for the IVxScheduleTrigger collection
152  scheduleTriggers.collection = new VxSdk::IVxScheduleTrigger*[scheduleTriggers.collectionSize];
153  result = _schedule->GetScheduleTriggers(scheduleTriggers);
154  // The result should now be kOK since we have allocated enough space
155  if (result == VxSdk::VxResult::kOK) {
156  for (int i = 0; i < scheduleTriggers.collectionSize; i++)
157  mlist->Add(gcnew CPPCli::ScheduleTrigger(scheduleTriggers.collection[i]));
158  }
159  // Remove the memory we previously allocated to the collection
160  delete[] scheduleTriggers.collection;
161  }
162  return mlist;
163 }
virtual VxResult::Value GetScheduleTriggers(VxCollection< IVxScheduleTrigger ** > &triggerCollection) const =0
The Situation class represents a schedule trigger. A schedule trigger is a time range and an optional...
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
CPPCli::Results::Value CPPCli::Schedule::AddScheduleTrigger ( CPPCli::NewScheduleTrigger newScheduleTrigger)

Add a new schedule trigger to the schedule.

Parameters
newScheduleTriggerThe new schedule trigger to add.
Returns
The Result of adding the schedule trigger.

Definition at line 17 of file Schedule.cpp.

17  {
18  // Create a new schedule trigger object
19  VxSdk::VxNewScheduleTrigger newTrigger;
20  VxSdk::Utilities::StrCopySafe(newTrigger.dailyEndTime, Utils::ConvertDateTimeToTimeChar(newScheduleTrigger->DailyEndTime));
21  VxSdk::Utilities::StrCopySafe(newTrigger.dailyStartTime, Utils::ConvertDateTimeToTimeChar(newScheduleTrigger->DailyStartTime));
22  VxSdk::Utilities::StrCopySafe(newTrigger.endDate, Utils::ConvertDateTimeToChar(newScheduleTrigger->EndDate));
23  VxSdk::Utilities::StrCopySafe(newTrigger.startDate, Utils::ConvertDateTimeToChar(newScheduleTrigger->StartDate));
24  VxSdk::Utilities::StrCopySafe(newTrigger.id, Utils::ConvertSysString(newScheduleTrigger->Id));
25  VxSdk::Utilities::StrCopySafe(newTrigger.eventSourceDevice, Utils::ConvertSysString(newScheduleTrigger->EventSource));
26  newTrigger.postTrigger = newScheduleTrigger->PostTrigger;
27  newTrigger.preTrigger = newScheduleTrigger->PreTrigger;
28  newTrigger.timeout = newScheduleTrigger->Timeout;
29  newTrigger.event = VxSdk::VxSituationType::Value(newScheduleTrigger->Event);
30  newTrigger.recurrence = VxSdk::VxRecurrenceType::Value(newScheduleTrigger->RecurrenceType);
31  newTrigger.framerate = VxSdk::VxRecordingFramerate::Value(newScheduleTrigger->Framerate);
32 
33  // Get the weekly interval values
34  int weeklySize = newScheduleTrigger->RecurWeekly->Count;
35  int *weekIntervals = new int[weeklySize];
36  for (int iW = 0; iW < weeklySize; iW++) {
37  weekIntervals[iW] = newScheduleTrigger->RecurWeekly[iW];
38  }
39  // Add any weekly interval values to the new schedule trigger
40  newTrigger.recurWeekly = weekIntervals;
41  newTrigger.recurWeeklySize = weeklySize;
42 
43  // Get the monthly interval values
44  int monthlySize = newScheduleTrigger->RecurMonthly->Count;
45  int *monthIntervals = new int[monthlySize];
46  for (int iM = 0; iM < monthlySize; iM++) {
47  monthIntervals[iM] = newScheduleTrigger->RecurMonthly[iM];
48  }
49  // Add any monthly interval values to the new schedule trigger
50  newTrigger.recurMonthly = monthIntervals;
51  newTrigger.recurMonthlySize = monthlySize;
52 
53  // Get the yearly interval values
54  int yearlySize = newScheduleTrigger->RecurYearly->Count;
55  int *yearIntervals = new int[yearlySize];
56  for (int iY = 0; iY < yearlySize; iY++) {
57  yearIntervals[iY] = newScheduleTrigger->RecurYearly[iY];
58  }
59  // Add any yearly interval values to the new schedule trigger
60  newTrigger.recurYearly = yearIntervals;
61  newTrigger.recurYearlySize = yearlySize;
62 
63  // Add any event properties to the new schedule trigger
64  int size = newScheduleTrigger->EventProperties->Count;
65  VxSdk::VxKvObject *kvObj = new VxSdk::VxKvObject[size];
66  newTrigger.eventPropertySize = size;
67  newTrigger.eventProperties = kvObj;
68  for (int ii = 0; ii < size; ii++) {
70  Utils::ConvertSysString(newScheduleTrigger->EventProperties[ii].Key));
72  Utils::ConvertSysString(newScheduleTrigger->EventProperties[ii].Value));
73  }
74 
75  // Add the schedule trigger to the schedule
77 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
static const char * ConvertDateTimeToTimeChar(System::DateTime dateTime)
Convert a DateTime to a char in TimeOfDay format.
Definition: Utils.h:304
virtual VxResult::Value AddScheduleTrigger(VxNewScheduleTrigger &newTrigger) const =0
static void StrCopySafe(char(&dst)[dstSize], const char *src)
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
VxSituationType::Value event
VxRecurrenceType::Value recurrence
VxRecordingFramerate::Value framerate
static const char * ConvertDateTimeToChar(System::DateTime dateTime)
Convert a DateTime to a char.
Definition: Utils.h:280
static const char * ConvertSysString(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:233
char value[2048]
CPPCli::Results::Value CPPCli::Schedule::DeleteScheduleTrigger ( CPPCli::ScheduleTrigger scheduleTrigger)

Delete a schedule trigger from the schedule. This will delete the schedule trigger from any other schedules as well.

Parameters
scheduleTriggerThe schedule trigger to delete.
Returns
The Result of deleting the schedule trigger.

Definition at line 79 of file Schedule.cpp.

79  {
80  // Delete the schedule trigger
81  return CPPCli::Results::Value(scheduleTrigger->_scheduleTrigger->DeleteScheduleTrigger());
82 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
List< CPPCli::DataSource^ > CPPCli::Schedule::GetLinks ( )

Get the data sources linked to the schedule.

Returns
A List containing the data sources linked to the schedule.

Definition at line 84 of file Schedule.cpp.

84  {
85  // Create a list of managed data source objects
86  List<CPPCli::DataSource^>^ mlist = gcnew List<CPPCli::DataSource^>();
87  // Create a collection of unmanaged data source objects
89 
90  // Make the GetLinks call, which will return with the total data source count, this allows the client to allocate memory
91  VxSdk::VxResult::Value result = _schedule->GetLinks(dataSources);
92  // The result should be kInsufficientSize if the number of data sources on the system are greater than 0
93  if (result == VxSdk::VxResult::kInsufficientSize) {
94  // Allocate enough space for the IVxDataSource collection
95  dataSources.collection = new VxSdk::IVxDataSource*[dataSources.collectionSize];
96  result = _schedule->GetLinks(dataSources);
97  // The result should now be kOK since we have allocated enough space
98  if (result == VxSdk::VxResult::kOK) {
99  for (int i = 0; i < dataSources.collectionSize; i++) {
100  mlist->Add(gcnew CPPCli::DataSource(dataSources.collection[i]));
101  }
102  }
103  // Remove the memory we previously allocated to the collection
104  delete[] dataSources.collection;
105  }
106  return mlist;
107 }
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
The DataSource class represents a data producer in the system hosted by a device. Each DataSource pro...
Definition: DataSource.h:20
virtual VxResult::Value GetLinks(VxCollection< IVxDataSource ** > &dataSourceCollection) const =0
CPPCli::Results::Value CPPCli::Schedule::Link ( System::Collections::Generic::List< DataSource^ >^  dataSources)

Add data sources to the schedule.

Parameters
dataSourcesA List containing the data sources to be added.
Returns
The Result of adding the data sources.

Definition at line 109 of file Schedule.cpp.

109  {
111 
112  // Iterate the managed list of data sources
113  for (int i = 0; i < dataSources->Count; i++) {
114  // Link the data sources to the schedule
115  result = _schedule->Link(*dataSources[i]->_dataSource);
116  }
117 
118  // Unless there was an issue linking the data sources the result should be VxSdk::VxResult::kOK
119  return CPPCli::Results::Value(result);
120 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
virtual VxResult::Value Link(IVxDataSource &dataSource) const =0
CPPCli::Results::Value CPPCli::Schedule::Refresh ( )

Update this instances properties.

Returns
The Result of updating the properties.

Definition at line 123 of file Schedule.cpp.

123  {
125 }
virtual VxResult::Value Refresh()=0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
CPPCli::Results::Value CPPCli::Schedule::Unlink ( System::Collections::Generic::List< DataSource^ >^  dataSources)

Delete existing data sources from the schedule.

Parameters
dataSourcesA List containing the data sources to be deleted.
Returns
The Result of deleting the data sources.

Definition at line 127 of file Schedule.cpp.

127  {
129 
130  // Iterate the managed list of data sources
131  for (int i = 0; i < dataSources->Count; i++) {
132  // UnLink the data sources to the schedule
133  result = _schedule->UnLink(*dataSources[i]->_dataSource);
134  }
135 
136  // Unless there was an issue unlinking the data sources the result should be VxSdk::VxResult::kOK
137  return CPPCli::Results::Value(result);
138 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxSchedule * _schedule
Definition: Schedule.h:146
virtual VxResult::Value UnLink(IVxDataSource &dataSource) const =0

Member Data Documentation

VxSdk::IVxSchedule* CPPCli::Schedule::_schedule
package

Definition at line 146 of file Schedule.h.

Property Documentation

Actions CPPCli::Schedule::Action
getset

Gets or sets the action performed when the schedule is active.

The Action.

Definition at line 106 of file Schedule.h.

System:: String^ CPPCli::Schedule::Id
get

Gets the unique identifier of the schedule.

The unique identifier.

Definition at line 116 of file Schedule.h.

System:: String^ CPPCli::Schedule::Name
getset

Gets or sets the friendly name of the schedule.

The friendly name.

Definition at line 125 of file Schedule.h.

System:: Collections:: Generic:: List< ScheduleTrigger^>^ CPPCli::Schedule::ScheduleTriggers
get

Gets the schedule triggers associated with this schedule.

The List of schedule triggers associated with this schedule.

Definition at line 97 of file Schedule.h.

bool CPPCli::Schedule::UseAllDataSources
getset

Gets or sets a value indicating whether the schedule applies to all data sources.

true if this schedule applies to all data sources, false if not.

Definition at line 139 of file Schedule.h.


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