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

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

#include <AddSituation.h>

Public Member Functions

 AddSituation (const std::string description)
 
 ~AddSituation ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Adds a situation 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...
 

Private Member Functions

void AddNewSituation (VxSdk::IVxSystem *vxSystem)
 Add a new situation to server. More...
 

Detailed Description

This plugin sample adds a situation to the current system.

Definition at line 12 of file AddSituation.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Events::AddSituation::AddSituation ( const std::string  description)
inline

Definition at line 14 of file AddSituation.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::Events::AddSituation::~AddSituation ( )
inline

Definition at line 15 of file AddSituation.h.

15 {}

Member Function Documentation

void CppSamples::Events::AddSituation::AddNewSituation ( VxSdk::IVxSystem vxSystem)
private

Add a new situation to server.

Parameters
vxSystemPointer to the VideoExpert system.

Definition at line 26 of file AddSituation.cpp.

26  {
27 
28  cout << "\n\n" << "Enter name for situation: ";
29  string sitName = Utility::ReadString();
30 
31  cout << "\n" << "Enter type for situation (in format: 'external/{company_name}/{situation_type}'): ";
32  string sitType = Utility::ReadString();
33 
34  VxNewSituation situation;
35  situation.Default();
36 #ifndef WIN32
37  strncpy(situation.name, sitName.c_str(), sizeof situation.name);
38  strncpy(situation.type, sitType.c_str(), sizeof situation.type);
39 #else
40  strncpy_s(situation.name, sitName.c_str(), sizeof situation.name);
41  strncpy_s(situation.type, sitType.c_str(), sizeof situation.type);
42 #endif
43 
44  VxResult::Value result = vxSystem->AddSituation(situation);
45  if (result == VxResult::kOK)
46  cout << "\n" << "Situation added succesfully.\n";
47  else
48  cout << "\n" << "Failed to add situation.\n";
49 
50  // Remove the memory allocated to the collection.
51  delete[] situation.snoozeIntervals;
52 
53  // Wait for user response before going back to parent menu.
54  Utility::Pause();
55 }
#define strncpy_s(dest, destsz, source, count)
virtual VxResult::Value AddSituation(VxNewSituation &newSituation) const =0
Plugin * CppSamples::Events::AddSituation::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Adds a situation to the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 14 of file AddSituation.cpp.

14  {
15 
16  AddNewSituation(dataModel->VxSystem);
17 
18  // Return reference of parent plugin to move back to parent menu.
19  return GetParent();
20 }
void AddNewSituation(VxSdk::IVxSystem *vxSystem)
Add a new situation to server.
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
Plugin * GetParent() const
Gets the reference to the parent of this plugin.
Definition: Plugin.h:46

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