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

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

#include <AddUser.h>

Public Member Functions

 AddUser (const std::string description)
 
 ~AddUser ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Adds a user 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 user to the current system.

Definition at line 12 of file AddUser.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Users::AddUser::AddUser ( const std::string  description)
inline

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

Definition at line 15 of file AddUser.h.

15 {}

Member Function Documentation

Plugin * CppSamples::Users::AddUser::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Adds a user to the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 14 of file AddUser.cpp.

14  {
15  // Read domain from input
16  cout << "\n\n" << "Enter user domain : ";
17  string domain = Utility::ReadString();
18 
19  // Read name from input
20  cout << "Enter user name : ";
21  string name = Utility::ReadString();
22 
23  // Read password from input
24  cout << "Enter user password : ";
25  string password = Utility::ReadString();
26 
27  // Add User
28  VxNewUser vxNewUser;
29  Utilities::StrCopySafe(vxNewUser.domain, domain.c_str());
30  Utilities::StrCopySafe(vxNewUser.name, name.c_str());
31  Utilities::StrCopySafe(vxNewUser.password, password.c_str());
32  vxNewUser.mustChangePassword = false;
33 
34  // Make the call to add the user into VideoXpert
35  VxResult::Value result = dataModel->VxSystem->AddUser(vxNewUser);
36  if (result == VxResult::kOK)
37  cout << "\n" << "User added succesfully.\n";
38  else
39  cout << "\n" << "Failed to add user.\n";
40 
41  // Wait for user response before going back to parent menu.
42  Utility::Pause();
43 
44  // Return reference of parent plugin to move back to parent menu.
45  return GetParent();
46 }
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
virtual VxResult::Value AddUser(VxNewUser &newUser) const =0
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: