C++ Samples
Demonstrates how to create a C++ application using the VideoXpert SDK
CppSamples::Schedules::AddSchedule Class Reference

This plugin sample adds a schedule to the current system. More...

#include <AddSchedule.h>

Public Member Functions

 AddSchedule (const std::string description)
 
 ~AddSchedule ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Adds a schedule to the current system. More...
 
- Public Member Functions inherited from CppSamples::Common::Plugin
 Plugin (const std::string description)
 
virtual ~Plugin ()
 
std::string GetDescription () const
 Gets the description of this plugin. More...
 
PluginGetParent () const
 Gets the reference to the parent of this plugin. More...
 
void SetParent (Plugin *parent)
 Sets the reference to the parent of this plugin. More...
 

Detailed Description

This plugin sample adds a schedule to the current system.

Definition at line 12 of file AddSchedule.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Schedules::AddSchedule::AddSchedule ( const std::string  description)
inline

Definition at line 14 of file AddSchedule.h.

14 : CppSamples::Common::Plugin(description) { }
Plugin is the abstract class which can be a menu item and/or a sample. Every sample and menu item mus...
Definition: Plugin.h:33
CppSamples::Schedules::AddSchedule::~AddSchedule ( )
inline

Definition at line 15 of file AddSchedule.h.

15 {}

Member Function Documentation

Plugin * CppSamples::Schedules::AddSchedule::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Adds a schedule to the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 15 of file AddSchedule.cpp.

15  {
16 
17  // Create a schedule object and populate its fields using newSchedule
18  VxNewSchedule vxSchedule;
19  string newGuid = Utility::GetNewGuid();
20  Utilities::StrCopySafe(vxSchedule.id, newGuid.c_str());
21 
22  // Read name from input
23  cout << "\n\n" << "Enter schedule name: ";
24  string name = Utility::ReadString();
25  Utilities::StrCopySafe(vxSchedule.name, name.c_str());
26 
27  // Create instance of OptionSelector and add options to it
29  optionSelector.AddItem("Unknown", VxScheduleAction::kUnknown);
30  optionSelector.AddItem("Event Source Record", VxScheduleAction::kEventSourceRecord);
31  optionSelector.AddItem("Record", VxScheduleAction::kRecord);
32  if (!optionSelector.SelectOption(&vxSchedule.action))
33  vxSchedule.action = VxScheduleAction::kUnknown;
34 
35  vxSchedule.useAllDataSources = true;
36 
37  // Make the call to add the schedule into VideoXpert
38  VxResult::Value result = dataModel->VxSystem->AddSchedule(vxSchedule);
39  // Display result
40  if (result == VxResult::kOK)
41  cout << "\n" << "Schedule added succesfully.\n";
42  else
43  cout << "\n" << "Failed to add schedule.\n";
44 
45  // Wait for user response before going back to parent menu.
46  Utility::Pause();
47 
48  // Return reference of parent plugin to move back to parent menu.
49  return GetParent();
50 }
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
VxScheduleAction::Value action
Plugin * GetParent() const
Gets the reference to the parent of this plugin.
Definition: Plugin.h:46
virtual VxResult::Value AddSchedule(VxNewSchedule &newSchedule) const =0
void AddItem(std::string name, T item)
The given name and item will be added to the collection.
This helper class prints a collection of options and chose a user defined option. ...

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