This plugin sample shows how to subscribe for a notification, monitor for a call back and unsubscribe that.
More...
#include <MonitorEvents.h>
This plugin sample shows how to subscribe for a notification, monitor for a call back and unsubscribe that.
Definition at line 12 of file MonitorEvents.h.
Inherits CppSamples::Common::Plugin.
CppSamples::Events::MonitorEvents::MonitorEvents |
( |
const std::string |
description | ) |
|
|
inline |
Definition at line 14 of file MonitorEvents.h.
Plugin is the abstract class which can be a menu item and/or a sample. Every sample and menu item mus...
CppSamples::Events::MonitorEvents::~MonitorEvents |
( |
| ) |
|
|
inline |
void CppSamples::Events::MonitorEvents::EventsCallBack |
( |
VxSdk::IVxEvent * |
vxEvent | ) |
|
|
staticprivate |
Callback method to handle events received from VxSDK
- Parameters
-
vxEvent | Pointer to the event containing newly received event details. |
- Parameters
-
vxEvent | IVxEvent pointer containing newly received event details |
Definition at line 73 of file MonitorEvents.cpp.
75 if (vxEvent->
ackState != VxAckState::kAutoAcked)
VxAckState::Value ackState
static void PrintEventRow(VxSdk::IVxEvent *vxEvent)
Print the details of the given event in a line.
void CppSamples::Events::MonitorEvents::PrintEventHeadings |
( |
| ) |
|
|
private |
Print the headings for a table of events.
Display the headings for a table of events
Definition at line 59 of file MonitorEvents.cpp.
60 const int eventTimeWidth = 20;
61 const int eventStringWidth = 32;
62 cout <<
"\n--------------------------------------------------\n";
63 cout << left << setw(eventTimeWidth) << setfill(
' ') <<
"Time(UTC)";
64 cout << left << setw(eventStringWidth) << setfill(
' ') <<
"Situation Type";
65 cout << left << setw(eventStringWidth) << setfill(
' ') <<
"Source Device";
66 cout <<
"\n--------------------------------------------------\n";
void CppSamples::Events::MonitorEvents::PrintEventRow |
( |
VxSdk::IVxEvent * |
vxEvent | ) |
|
|
staticprivate |
Print the details of the given event in a line.
Display a row of event details
- Parameters
-
vxEvent | Pointer to the event to display |
- Parameters
-
vxEvent | CPPConsole::Event pointer containing the event to display |
Definition at line 47 of file MonitorEvents.cpp.
48 const int eventTimeWidth = 20;
49 const int eventStringWidth = 32;
50 cout << left << setw(eventTimeWidth) << setfill(
' ') << Utility::ConvertUTCTimeFormatToString(vxEvent->
time);
51 cout << left << setw(eventStringWidth) << setfill(
' ') << vxEvent->
situationType;
52 cout << left << setw(eventStringWidth) << setfill(
' ') << vxEvent->
sourceDeviceId;
Subscribe for a notification, monitor for a call back and unsubscribe that.
- Parameters
-
dataModel | Instance of data model. |
Implements CppSamples::Common::Plugin.
Definition at line 10 of file MonitorEvents.cpp.
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
void StartMonitorEvents(VxSdk::IVxSystem *vxSystem)
Subscribe for a notification, monitor for a call back and unsubscribe that.
Plugin * GetParent() const
Gets the reference to the parent of this plugin.
void CppSamples::Events::MonitorEvents::StartMonitorEvents |
( |
VxSdk::IVxSystem * |
vxSystem | ) |
|
|
private |
Subscribe for a notification, monitor for a call back and unsubscribe that.
- Parameters
-
vxSystem | Pointer to the VideoExpert system. |
Definition at line 18 of file MonitorEvents.cpp.
20 cout <<
"\n\n" <<
"Subscribing to events";
22 cout <<
"Error subscribing to events! \n";
30 cout <<
"Monitoring events. Press any key to stop . . .\n\n";
32 cin.ignore(256,
'\n');
34 cout <<
"Unsubscribing to events";
36 cout <<
"Error unsubscribing to events!\n";
void PrintEventHeadings()
Print the headings for a table of events.
bool SubscribeEvents(VxSdk::IVxSystem *vxSystem)
Subscribe to event notifications
bool UnSubscribeEvents(VxSdk::IVxSystem *vxSystem)
Unsubscribe to event notifications
bool CppSamples::Events::MonitorEvents::SubscribeEvents |
( |
VxSdk::IVxSystem * |
vxSystem | ) |
|
|
private |
Subscribe to event notifications
- Parameters
-
vxSystem | Pointer to the VideoExpert system. |
- Parameters
-
Definition at line 83 of file MonitorEvents.cpp.
86 if (result == VxResult::kOK) {
87 cout <<
"\n" <<
"Events subscription successful.\n";
91 cout <<
"\n" <<
"Failed to subscribe events!!\n";
virtual VxResult::Value StartNotifications(VxEventCallback callback) const =0
static void EventsCallBack(VxSdk::IVxEvent *vxEvent)
Callback method to handle events received from VxSDK
bool CppSamples::Events::MonitorEvents::UnSubscribeEvents |
( |
VxSdk::IVxSystem * |
vxSystem | ) |
|
|
private |
Unsubscribe to event notifications
- Parameters
-
vxSystem | Pointer to the VideoExpert system. |
- Parameters
-
Definition at line 100 of file MonitorEvents.cpp.
103 if (result == VxResult::kOK) {
104 cout <<
"\n" <<
"Events unsubscription successful.\n";
108 cout <<
"\n" <<
"Failed to unsubscribe events!!\n";
virtual VxResult::Value StopNotifications() const =0
The documentation for this class was generated from the following files: