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

The PtzController class can be created for a device that has pan, tilt, and/or zoom functionality. More...

#include <PtzController.h>

Public Types

enum  IrisDirections {
  IrisDirections::Stop,
  IrisDirections::Close,
  IrisDirections::Open
}
 Values that represent iris directions. More...
 
enum  FocusDirections {
  FocusDirections::Stop,
  FocusDirections::Far,
  FocusDirections::Near
}
 Values that represent focus directions. More...
 
enum  ZoomDirections {
  ZoomDirections::None,
  ZoomDirections::Stop,
  ZoomDirections::In,
  ZoomDirections::Out
}
 Values that represent zoom directions. More...
 

Public Member Functions

 PtzController (VxSdk::IVxPtzController *ptzController)
 Constructor. More...
 
virtual ~PtzController ()
 Destructor. More...
 
 !PtzController ()
 Finaliser. More...
 
Results::Value AbsoluteMove (int positionX, int positionY)
 Move to the absolute position of the given coordinates. More...
 
Results::Value AbsoluteMove (int positionX, int positionY, int positionZ)
 Move to the absolute position of the given coordinates. More...
 
Results::Value AbsolutePan (int positionX)
 Pan to the absolute position of the given coordinate. More...
 
Results::Value AbsoluteTilt (int positionY)
 Tilt to the absolute position of the given coordinate. More...
 
Results::Value AbsoluteZoom (int positionZ)
 Zoom to the absolute position of the given coordinates. More...
 
Results::Value AddPreset (int index)
 Creates a new preset using the current PTZ spatial coordinates. More...
 
Results::Value ContinuousFocus (FocusDirections nearFar)
 Focus near or far until the user wants to stop. More...
 
Results::Value ContinuousIris (IrisDirections openClose)
 Open or close the iris until the user wants to stop. More...
 
Results::Value ContinuousMove (int speedX, int speedY, ZoomDirections inOut)
 Continuously move the field of view at the given speed until stopped. More...
 
CPPCli::Results::Value DeletePreset (Preset^ preset)
 Deletes a preset from the system. More...
 
System::Collections::Generic::List< Pattern^ >^ GetPatterns ()
 Get the available patterns. More...
 
System::Collections::Generic::List< Preset^ >^ GetPresets ()
 Get the available presets. More...
 
Results::Value Refresh ()
 Update this instances properties. More...
 
Results::Value RelativeMove (int deltaX, int deltaY, int deltaZ)
 Moves the camera position relative to the current position. More...
 
Results::Value RelativePercentageMove (int percentageX, int percentageY)
 Moves the camera position within a percentage relative to the device’s current field of view. More...
 
Results::Value RepositionPreset (Preset^ preset)
 Repositions a preset to the current PTZ spatial coordinates. More...
 
Results::Value Stop ()
 Stops all PTZ actions. More...
 
Results::Value TriggerPattern (Pattern^ pattern)
 Trigger a pattern. More...
 
Results::Value TriggerPreset (int index)
 Triggers a preset by index. More...
 
Results::Value TriggerPreset (Preset^ preset)
 Trigger a preset. More...
 
Results::Value TriggerRefresh ()
 Triggers a refresh of this PtzController on the VideoXpert system; updating its patterns and presets based on the current camera configuration. More...
 

Package Functions

PtzLimits_GetPtzLimits ()
 
PtzLock_GetPtzLock ()
 

Package Attributes

VxSdk::IVxPtzController_ptzController
 

Properties

bool IsLocked [get]
 Gets a value indicating whether the PTZ control is locked. More...
 
int LockExpireTime [get]
 Gets the time remaining (in seconds) until the PTZ lock expires. More...
 
PtzLimits^  PTZLimits [get]
 Gets the PtzLimits for this ptz controller. More...
 
PtzLock^  PTZLock [get]
 Gets the PtzLock associated with this ptz controller. More...
 
int X [get]
 Gets the X coordinate absolute position (pan). More...
 
int Y [get]
 Gets the Y coordinate absolute position (tilt). More...
 
int Z [get]
 Gets the Z coordinate absolute position (zoom). More...
 

Detailed Description

The PtzController class can be created for a device that has pan, tilt, and/or zoom functionality.

Definition at line 15 of file PtzController.h.

Member Enumeration Documentation

Values that represent focus directions.

Enumerator
Stop 

Stop focus movement.

Far 

Focus far.

Near 

Focus near.

Definition at line 36 of file PtzController.h.

37  {
39  Stop,
40 
42  Far,
43 
45  Near
46  };
Results::Value Stop()
Stops all PTZ actions.

Values that represent iris directions.

Enumerator
Stop 

Stop iris movement.

Close 

Close the iris.

Open 

Open the iris.

Definition at line 21 of file PtzController.h.

22  {
24  Stop,
25 
27  Close,
28 
30  Open
31  };
Results::Value Stop()
Stops all PTZ actions.

Values that represent zoom directions.

Enumerator
None 

Do not perform a zoom action.

Stop 

Stop zoom movement.

In 

Zoom in.

Out 

Zoom out.

Definition at line 51 of file PtzController.h.

52  {
54  None,
55 
57  Stop,
58 
60  In,
61 
63  Out
64  };
Results::Value Stop()
Stops all PTZ actions.

Constructor & Destructor Documentation

CPPCli::PtzController::PtzController ( VxSdk::IVxPtzController ptzController)

Constructor.

Parameters
ptzControllerThe ptz controller.

Definition at line 8 of file PtzController.cpp.

8  {
9  _ptzController = ptzController;
10 }
VxSdk::IVxPtzController * _ptzController
virtual CPPCli::PtzController::~PtzController ( )
inlinevirtual

Destructor.

Definition at line 75 of file PtzController.h.

75  {
76  this->!PtzController();
77  }
PtzController(VxSdk::IVxPtzController *ptzController)
Constructor.
CPPCli::PtzController::!PtzController ( )

Finaliser.

Definition at line 12 of file PtzController.cpp.

12  {
14  _ptzController = nullptr;
15 }
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value Delete() const =0

Member Function Documentation

CPPCli::PtzLimits CPPCli::PtzController::_GetPtzLimits ( )
package

Definition at line 177 of file PtzController.cpp.

177  {
178  // Get the ptz limit values from the ptz controller
179  VxSdk::VxPtzLimits* ptzLimits = nullptr;
181 
182  // Return the ptz limits if GetPtzLimits was successful
183  if (result == VxSdk::VxResult::kOK)
184  return gcnew PtzLimits(ptzLimits);
185 
186  return nullptr;
187 }
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value GetPtzLimits(VxPtzLimits *&ptzLimits) const =0
CPPCli::PtzLock CPPCli::PtzController::_GetPtzLock ( )
package

Definition at line 189 of file PtzController.cpp.

189  {
190  // Get the ptz lock which allows the client to make lock the ptz controller
191  VxSdk::IVxPtzLock* ptzLock = nullptr;
193 
194  // Return the ptz lock if GetPtzLock was successful
195  if (result == VxSdk::VxResult::kOK)
196  return gcnew PtzLock(ptzLock);
197 
198  return nullptr;
199 }
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value GetPtzLock(IVxPtzLock *&ptzLock) const =0
CPPCli::Results::Value CPPCli::PtzController::AbsoluteMove ( int  positionX,
int  positionY 
)

Move to the absolute position of the given coordinates.

Parameters
positionXThe X coordinate absolute position (pan).
positionYThe Y coordinate absolute position (tilt).
Returns
The Result of the absolute move.

Definition at line 17 of file PtzController.cpp.

17  {
18  // Call AbsoluteMove and return the result
19  VxSdk::VxResult::Value result = _ptzController->AbsoluteMove(positionX, positionY);
20  return CPPCli::Results::Value(result);
21 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value AbsoluteMove(int positionX, int positionY) const =0
CPPCli::Results::Value CPPCli::PtzController::AbsoluteMove ( int  positionX,
int  positionY,
int  positionZ 
)

Move to the absolute position of the given coordinates.

Parameters
positionXThe X coordinate absolute position (pan).
positionYThe Y coordinate absolute position (tilt).
positionZThe Z coordinate absolute position (zoom).
Returns
The Result of the absolute move.

Definition at line 23 of file PtzController.cpp.

23  {
24  // Call AbsoluteMove and return the result
25  VxSdk::VxResult::Value result = _ptzController->AbsoluteMove(positionX, positionY, positionZ);
26  return CPPCli::Results::Value(result);
27 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value AbsoluteMove(int positionX, int positionY) const =0
CPPCli::Results::Value CPPCli::PtzController::AbsolutePan ( int  positionX)

Pan to the absolute position of the given coordinate.

Parameters
positionXThe X coordinate absolute position (pan).
Returns
The Result of the absolute pan.

Definition at line 29 of file PtzController.cpp.

29  {
30  // Call AbsolutePan and return the result
32  return CPPCli::Results::Value(result);
33 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value AbsolutePan(int positionX) const =0
CPPCli::Results::Value CPPCli::PtzController::AbsoluteTilt ( int  positionY)

Tilt to the absolute position of the given coordinate.

Parameters
positionYThe Y coordinate absolute position (tilt).
Returns
The Result of the absolute tilt.

Definition at line 35 of file PtzController.cpp.

35  {
36  // Call AbsoluteTilt and return the result
38  return CPPCli::Results::Value(result);
39 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value AbsoluteTilt(int positionY) const =0
CPPCli::Results::Value CPPCli::PtzController::AbsoluteZoom ( int  positionZ)

Zoom to the absolute position of the given coordinates.

Parameters
positionZThe Z coordinate absolute position (zoom).
Returns
The Result of the absolute zoom.

Definition at line 41 of file PtzController.cpp.

41  {
42  // Call AbsoluteZoom and return the result
44  return CPPCli::Results::Value(result);
45 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value AbsoluteZoom(int positionZ) const =0
CPPCli::Results::Value CPPCli::PtzController::AddPreset ( int  index)

Creates a new preset using the current PTZ spatial coordinates.

Parameters
indexThe unique index value for the new preset.
Returns
The Result of the adding the preset.

Definition at line 47 of file PtzController.cpp.

47  {
48  // Call AddPreset and return the result
50  return CPPCli::Results::Value(result);
51 }
virtual VxResult::Value AddPreset(int index) const =0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
CPPCli::Results::Value CPPCli::PtzController::ContinuousFocus ( FocusDirections  nearFar)

Focus near or far until the user wants to stop.

Parameters
nearFarThe direction to focus.
Returns
The Result of the focus call.

Definition at line 53 of file PtzController.cpp.

53  {
54  // Call ContinuousFocus and return the result
56  return CPPCli::Results::Value(result);
57 }
virtual VxResult::Value ContinuousFocus(VxFocusDirection::Value nearFar) const =0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
CPPCli::Results::Value CPPCli::PtzController::ContinuousIris ( IrisDirections  openClose)

Open or close the iris until the user wants to stop.

Parameters
openCloseThe direction to change the iris.
Returns
The Result of the iris call.

Definition at line 59 of file PtzController.cpp.

59  {
60  // Call ContinuousIris and return the result
62  return CPPCli::Results::Value(result);
63 }
virtual VxResult::Value ContinuousIris(VxIrisDirection::Value openClose) const =0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
CPPCli::Results::Value CPPCli::PtzController::ContinuousMove ( int  speedX,
int  speedY,
ZoomDirections  inOut 
)

Continuously move the field of view at the given speed until stopped.

Parameters
speedXPan speed. Negative values pan left, positive values pan right.
speedYTilt speed. Negative values tilt downward, positive values tilt upward.
inOutThe direction to zoom.
Returns
The Result of the continuous move.

Definition at line 65 of file PtzController.cpp.

65  {
66  // Call ContinuousMove and return the result
68  return CPPCli::Results::Value(result);
69 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value ContinuousMove(int speedX, int speedY, VxZoomDirection::Value inOut) const =0
CPPCli::Results::Value CPPCli::PtzController::DeletePreset ( Preset preset)

Deletes a preset from the system.

Parameters
presetThe Preset to delete.
Returns
The Result of deleting the preset.

Definition at line 71 of file PtzController.cpp.

71  {
72  // Call DeletePreset and return the result
73  VxSdk::VxResult::Value result = _ptzController->DeletePreset(*preset->_preset);
74  return CPPCli::Results::Value(result);
75 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value DeletePreset(IVxPreset &preset) const =0
List< CPPCli::Pattern^ > CPPCli::PtzController::GetPatterns ( )

Get the available patterns.

Returns
A List of patterns.

Definition at line 77 of file PtzController.cpp.

77  {
78  // Create a list of managed pattern objects
79  List<Pattern^>^ mlist = gcnew List<Pattern^>();
80  // Create a collection of unmanaged pattern objects
82 
83  // Make the GetPatterns call, which will return with the total pattern count, this allows the client to allocate memory.
85  // As long as the datasource has at least one pattern the GetPatterns call should return VxSdk::VxResult::kInsufficientSize
86  if (result == VxSdk::VxResult::kInsufficientSize) {
87  // Fill the array of pointers to the proper size as determined by the previous GetPatterns call
88  patterns.collection = new VxSdk::IVxPattern*[patterns.collectionSize];
89  result = _ptzController->GetPatterns(patterns);
90  // The result should now be kOK since we have allocated enough space
91  if (result == VxSdk::VxResult::kOK) {
92  for (int i = 0; i < patterns.collectionSize; i++)
93  mlist->Add(gcnew CPPCli::Pattern(patterns.collection[i]));
94  }
95  // Delete the memory allocated earlier
96  delete[] patterns.collection;
97  }
98  return mlist;
99 }
VxSdk::IVxPtzController * _ptzController
The Pattern class represents a predefined sequence of movement that a PTZ device can perform when tri...
Definition: Pattern.h:13
virtual VxResult::Value GetPatterns(VxCollection< IVxPattern ** > &patternCollection) const =0
List< CPPCli::Preset^ > CPPCli::PtzController::GetPresets ( )

Get the available presets.

Returns
A List of presets.

Definition at line 101 of file PtzController.cpp.

101  {
102  // Create a list of managed preset objects
103  List<Preset^>^ mlist = gcnew List<Preset^>();
104  // Create a collection of unmanaged preset objects
106 
107  // Make the GetPresets call, which will return with the total preset count, this allows the client to allocate memory.
109  // As long as the datasource has at least one preset the GetPresets call should return VxSdk::VxResult::kInsufficientSize
110  if (result == VxSdk::VxResult::kInsufficientSize) {
111  // Fill the array of pointers to the proper size as determined by the previous GetPresets call
112  presets.collection = new VxSdk::IVxPreset*[presets.collectionSize];
113  result = _ptzController->GetPresets(presets);
114  // The result should now be kOK since we have allocated enough space
115  if (result == VxSdk::VxResult::kOK) {
116  for (int i = 0; i < presets.collectionSize; i++)
117  mlist->Add(gcnew CPPCli::Preset(presets.collection[i]));
118  }
119  // Delete the memory allocated earlier
120  delete[] presets.collection;
121  }
122  return mlist;
123 }
virtual VxResult::Value GetPresets(VxCollection< IVxPreset ** > &presetCollection) const =0
VxSdk::IVxPtzController * _ptzController
The Preset class represents a predefined point that a PTZ device can PTZ to when triggered.
Definition: Preset.h:12
CPPCli::Results::Value CPPCli::PtzController::Refresh ( )

Update this instances properties.

Returns
The Result of updating the properties.

Definition at line 125 of file PtzController.cpp.

125  {
127 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value Refresh()=0
CPPCli::Results::Value CPPCli::PtzController::RelativeMove ( int  deltaX,
int  deltaY,
int  deltaZ 
)

Moves the camera position relative to the current position.

Parameters
deltaXThe degree to pan relative to the current X position. Negative values pan left, positive values pan right.
deltaYThe degree to tilt relative to the current Y position. Negative values pan left, positive values pan right.
deltaZThe magnification level relative to the current Z position. Negative values pan left, positive values pan right.
Returns
The Result of the relative move.

Definition at line 129 of file PtzController.cpp.

129  {
130  // Call RelativeMove and return the result
131  VxSdk::VxResult::Value result = _ptzController->RelativeMove(deltaX, deltaY, deltaZ);
132  return CPPCli::Results::Value(result);
133 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value RelativeMove(int deltaX, int deltaY, int deltaZ) const =0
CPPCli::Results::Value CPPCli::PtzController::RelativePercentageMove ( int  percentageX,
int  percentageY 
)

Moves the camera position within a percentage relative to the device’s current field of view.

The rotational x and y parameters are used to move within a percentage of the current field of view of the camera. For instance, if the x parameter were 50 and the y parameter were -50, the pan/tilt would move halfway to the edge of the field of view along the x axis and halfway to the field of view along the negative y axis from its present position.

Parameters
percentageXPercentage of the current field of view of the camera (X axis). Positive values are to the right, negative values are to the left. Range: -100 to 100.
percentageYPercentage of the current field of view of the camera (Y axis). Positive values are up, negative values are down. Range: -100 to 100.
Returns
The Result of the relative percentage move.

Definition at line 135 of file PtzController.cpp.

135  {
136  // Call RelativePercentageMove and return the result
137  VxSdk::VxResult::Value result = _ptzController->RelativePercentageMove(percentageX, percentageY);
138  return CPPCli::Results::Value(result);
139 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value RelativePercentageMove(int percentageX, int percentageY) const =0
CPPCli::Results::Value CPPCli::PtzController::RepositionPreset ( Preset preset)

Repositions a preset to the current PTZ spatial coordinates.

Parameters
presetThe Preset to reposition.
Returns
The Result of repositioning the preset.

Definition at line 141 of file PtzController.cpp.

141  {
142  // Call RepositionPreset and return the result
143  VxSdk::VxResult::Value result = _ptzController->RepositionPreset(*preset->_preset);
144  return CPPCli::Results::Value(result);
145 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value RepositionPreset(IVxPreset &preset) const =0
CPPCli::Results::Value CPPCli::PtzController::Stop ( )

Stops all PTZ actions.

Returns
The Result of the stop call.

Definition at line 147 of file PtzController.cpp.

147  {
148  // Call PtzStop and return the result
150  return CPPCli::Results::Value(result);
151 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value PtzStop() const =0
CPPCli::Results::Value CPPCli::PtzController::TriggerPattern ( Pattern pattern)

Trigger a pattern.

Parameters
patternThe Pattern to trigger.
Returns
The Result of triggering the pattern.

Definition at line 153 of file PtzController.cpp.

153  {
154  // Call TriggerPattern and return the result
155  VxSdk::VxResult::Value result = _ptzController->TriggerPattern(*pattern->_pattern);
156  return CPPCli::Results::Value(result);
157 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value TriggerPattern(IVxPattern &pattern) const =0
CPPCli::Results::Value CPPCli::PtzController::TriggerPreset ( int  index)

Triggers a preset by index.

Parameters
indexThe index of the preset to trigger.
Returns
The Result of triggering the preset.

Definition at line 159 of file PtzController.cpp.

159  {
160  // Call TriggerPreset and return the result
162  return CPPCli::Results::Value(result);
163 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value TriggerPreset(int index) const =0
CPPCli::Results::Value CPPCli::PtzController::TriggerPreset ( Preset preset)

Trigger a preset.

Parameters
presetThe Preset to trigger.
Returns
The Result of triggering the preset.

Definition at line 165 of file PtzController.cpp.

165  {
166  // Call TriggerPreset and return the result
167  VxSdk::VxResult::Value result = _ptzController->TriggerPreset(*preset->_preset);
168  return CPPCli::Results::Value(result);
169 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value TriggerPreset(int index) const =0
CPPCli::Results::Value CPPCli::PtzController::TriggerRefresh ( )

Triggers a refresh of this PtzController on the VideoXpert system; updating its patterns and presets based on the current camera configuration.

Returns
The Result of refreshing the PtzController.

Definition at line 171 of file PtzController.cpp.

171  {
172  // Call TriggerRefresh and return the result
174  return CPPCli::Results::Value(result);
175 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxPtzController * _ptzController
virtual VxResult::Value TriggerRefresh()=0

Member Data Documentation

VxSdk::IVxPtzController* CPPCli::PtzController::_ptzController
package

Definition at line 321 of file PtzController.h.

Property Documentation

bool CPPCli::PtzController::IsLocked
get

Gets a value indicating whether the PTZ control is locked.

true if locked, false if not.

Definition at line 249 of file PtzController.h.

int CPPCli::PtzController::LockExpireTime
get

Gets the time remaining (in seconds) until the PTZ lock expires.

The expire time in seconds.

Definition at line 258 of file PtzController.h.

PtzLimits^ CPPCli::PtzController::PTZLimits
get

Gets the PtzLimits for this ptz controller.

nullptr if no ptz limits are available, else the PtzLimits.

Definition at line 267 of file PtzController.h.

PtzLock^ CPPCli::PtzController::PTZLock
get

Gets the PtzLock associated with this ptz controller.

nullptr if no ptz lock is available, else the PtzLock.

Definition at line 276 of file PtzController.h.

int CPPCli::PtzController::X
get

Gets the X coordinate absolute position (pan).

The current X coordinate.

Definition at line 285 of file PtzController.h.

int CPPCli::PtzController::Y
get

Gets the Y coordinate absolute position (tilt).

The current Y coordinate.

Definition at line 298 of file PtzController.h.

int CPPCli::PtzController::Z
get

Gets the Z coordinate absolute position (zoom).

The current Z coordinate.

Definition at line 311 of file PtzController.h.


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