AXptz
ax_ptz_movement_handler.h File Reference

The movement handler and its functions. More...

Go to the source code of this file.

Data Structures

struct  AXPTZMonotonicTimestamp
 A structure for keeping time stamp information. More...
 
struct  AXPTZStatus
 A structure with the current pan, tilt and zoom coordinates and move statuses. The coordinates are given in the requested pan, tilt and zoom spaces. More...
 
struct  AXPTZLimits
 A structure with the lower and upper limits for the pan, tilt and zoom coordinates. The limits are given in the requested pan, tilt and zoom spaces. Unsupported coordinates are set to zero. More...
 

Enumerations

enum  AXPTZMovementPanTiltSpace { AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_DEGREE, AX_PTZ_MOVEMENT_PAN_TILT_UNKNOWN }
 
enum  AXPTZMovementPanTiltSpeedSpace { AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNKNOWN }
 
enum  AXPTZMovementZoomSpace { AX_PTZ_MOVEMENT_ZOOM_UNITLESS, AX_PTZ_MOVEMENT_ZOOM_MAGNIFICATION, AX_PTZ_MOVEMENT_ZOOM_UNKNOWN }
 
enum  AXPTZMoveStatus { AX_PTZ_MOVE_STATUS_IDLE, AX_PTZ_MOVE_STATUS_MOVING, AX_PTZ_MOVE_STATUS_UNKNOWN }
 

Functions

gboolean ax_ptz_movement_handler_set_absolute_spaces (AXPTZMovementPanTiltSpace pan_tilt_space, AXPTZMovementPanTiltSpeedSpace pan_tilt_speed_space, AXPTZMovementZoomSpace zoom_space, GError **error)
 Sets the spaces for the absolute movements. More...
 
gboolean ax_ptz_movement_handler_absolute_move (const AXPTZControlQueueGroup *group, gint video_channel, const AXPTZAbsoluteMovement *movement, AXPTZInvoke invoke, void *callback_func, void *user_data, GError **error)
 Performs an absolute movement. More...
 
gboolean ax_ptz_movement_handler_set_relative_spaces (AXPTZMovementPanTiltSpace pan_tilt_space, AXPTZMovementPanTiltSpeedSpace pan_tilt_speed_space, AXPTZMovementZoomSpace zoom_space, GError **error)
 Sets the spaces for the relative movements. More...
 
gboolean ax_ptz_movement_handler_relative_move (const AXPTZControlQueueGroup *group, gint video_channel, const AXPTZRelativeMovement *movement, AXPTZInvoke invoke, void *callback_func, void *user_data, GError **error)
 Performs a relative movement. More...
 
gboolean ax_ptz_movement_handler_set_continuous_spaces (AXPTZMovementPanTiltSpeedSpace pan_tilt_speed_space, GError **error)
 Sets the spaces for the continuous movements. More...
 
gboolean ax_ptz_movement_handler_continuous_start (const AXPTZControlQueueGroup *group, gint video_channel, const AXPTZContinuousMovement *movement, AXPTZInvoke invoke, void *callback_func, void *user_data, GError **error)
 Starts a continuous movement. More...
 
gboolean ax_ptz_movement_handler_continuous_stop (const AXPTZControlQueueGroup *group, gint video_channel, gboolean stop_pan_tilt, gboolean stop_zoom, AXPTZInvoke invoke, void *callback_func, void *user_data, GError **error)
 Stops a continuous movement. More...
 
gboolean ax_ptz_movement_handler_get_ptz_status (gint video_channel, AXPTZMovementPanTiltSpace pan_tilt_space, AXPTZMovementZoomSpace zoom_space, AXPTZStatus **status, GError **error)
 Gets the current pan, tilt and zoom coordinates and movement statuses. More...
 
gboolean ax_ptz_movement_handler_get_ptz_limits (gint video_channel, AXPTZMovementPanTiltSpace pan_tilt_space, AXPTZMovementZoomSpace zoom_space, AXPTZLimits **limits, GError **error)
 Gets the pan, tilt and zoom limits. More...
 
gboolean ax_ptz_movement_handler_get_fov (gint video_channel, fixed_t *h_fov, fixed_t *v_fov, GError **error)
 Gets the horizontal and vertical field of view in degrees. More...
 
gboolean ax_ptz_movement_handler_is_ptz_moving (gint video_channel, gboolean *is_moving, GError **error)
 Checks if the camera is panning, tilting, zooming, focusing, adjusting brightness or adjusting iris. More...
 
GList * ax_ptz_movement_handler_get_move_capabilities (gint video_channel, GError **error)
 Gets the supported PTZ move capabilities. More...
 

Detailed Description

The movement handler and its functions.

Movement handler

AXPTZMovmentHandler handles absolute, relative and continuous PTZ movements (AXPTZAbsoluteMovement, AXPTZRelativeMovement, AXPTZContinuousMovement). For each type of PTZ movement, spaces for the pan/tilt coordinates, the pan/tilt speed and the zoom coordinate can be defined. In addition, status of the current PTZ coordinates, coordinate limits, supported move capabilities and “is PTZ moving” can be requested.

The spaces can be set to different values for absolute, relative and continuous PTZ movements. Available space types and spaces are:

  • AXPTZMovementPanTiltSpace for the pan and tilt coordinates.
    • AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS In this space, unitless pan and tilt coordinates is used.
    • AX_PTZ_MOVEMENT_PAN_TILT_DEGREE In this space, the unit for the pan and tilt coordinates is degrees.
  • AXPTZMovementPanTiltSpeedSpace for the pan and tilt speed.
    • AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS In this space, unitless pan and tilt speed are used.
  • AXPTZMovementZoomSpace for the zoom coordinate.
    • AX_PTZ_MOVEMENT_ZOOM_UNITLESS In this space, unitless zoom is used.
    • AX_PTZ_MOVEMENT_ZOOM_MAGNIFICATION In this space, the unit for the zoom coordinate is magnification ratio.

Here, unitless means a normalized range from 0 to 1, from -­1 to 1 or from -­0.5 to 0.5. The following table shows the ranges for the different movement types and spaces:

Unitless spaceDegree spaceMagnification space
Absolute pan/tilt coordinates-0.5 ... 0.5-­180.0 ... 180.0N/A
Absolute pan/tilt speed0.0 ... 1.0N/AN/A
Absolute zoom coordinate0.0 ... 1.0N/ACamera unique.
Relative pan/tilt coordinates-1.0 ... 1.0-­360.0 ... 360.0 N/A
Relative pan/tilt speed0.0 ... 1.0N/AN/A
Relative zoom coordinate0.0 ... 1.0N/ACamera unique.
Continuous pan/tilt speed-­1.0 ... 1.0N/AN/A

Enumeration Type Documentation

◆ AXPTZMovementPanTiltSpace

Available spaces for the pan and tilt coordinates.

Enumerator
AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS 

Use unitless pan and tilt coordinates.

AX_PTZ_MOVEMENT_PAN_TILT_DEGREE 

Use degrees as unit for the pan and tilt coordinates.

AX_PTZ_MOVEMENT_PAN_TILT_UNKNOWN 

Unknown unit for the pan and tilt coordinates.

◆ AXPTZMovementPanTiltSpeedSpace

Available spaces for the pan and tilt speed.

Enumerator
AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS 

Use unitless pan and tilt speed.

AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNKNOWN 

Unknown unit for the pan and tilt speed.

◆ AXPTZMovementZoomSpace

Available spaces for the zoom coordinate.

Enumerator
AX_PTZ_MOVEMENT_ZOOM_UNITLESS 

Use unitless zoom.

AX_PTZ_MOVEMENT_ZOOM_MAGNIFICATION 

Use magnification ratio as unit for zoom.

AX_PTZ_MOVEMENT_ZOOM_UNKNOWN 

Unknown unit for the zoom coordinate.

◆ AXPTZMoveStatus

The camera's move status.

Enumerator
AX_PTZ_MOVE_STATUS_IDLE 

The camera is not panning, tilting or zooming.

AX_PTZ_MOVE_STATUS_MOVING 

The camera is panning, tilting or zooming.

AX_PTZ_MOVE_STATUS_UNKNOWN 

Unknown move status

Function Documentation

◆ ax_ptz_movement_handler_set_absolute_spaces()

gboolean ax_ptz_movement_handler_set_absolute_spaces ( AXPTZMovementPanTiltSpace  pan_tilt_space,
AXPTZMovementPanTiltSpeedSpace  pan_tilt_speed_space,
AXPTZMovementZoomSpace  zoom_space,
GError **  error 
)

Sets the spaces for the absolute movements.

Parameters
pan_tilt_spaceThe space for the pan and tilt coordinates. Supported: AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_DEGREE Default: AX_PTZ_MOVEMENT_PAN_TILT_DEGREE
pan_tilt_speed_spaceThe space for the pan and tilt speed. Supported: AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS
zoom_spaceThe space for the zoom coordinate. Supported: AX_PTZ_MOVEMENT_ZOOM_UNITLESS
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.

Critical section Important!!! See ax_ptz.c for the thread safety rules in this library.

Examples:
axptzexample.c.

References AX_PTZ_MOVEMENT_PAN_TILT_UNKNOWN.

◆ ax_ptz_movement_handler_absolute_move()

gboolean ax_ptz_movement_handler_absolute_move ( const AXPTZControlQueueGroup group,
gint  video_channel,
const AXPTZAbsoluteMovement movement,
AXPTZInvoke  invoke,
void *  callback_func,
void *  user_data,
GError **  error 
)

Performs an absolute movement.

Parameters
groupA group in the PTZ control queue.
video_channelA video channel. Starts from video channel 1.
movementAn absolute movement.
invokeThe invoke type. Supported: ACAP_PTZ_INVOKE_ASYNC.
callback_funcFuture use. Must be set to NULL.
user_dataFuture use. Must be set to NULL.
errorReturn location for a GError or NULL.
Returns
TRUE if the movement command was successfully sent to the underlying PTZ framework, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_set_relative_spaces()

gboolean ax_ptz_movement_handler_set_relative_spaces ( AXPTZMovementPanTiltSpace  pan_tilt_space,
AXPTZMovementPanTiltSpeedSpace  pan_tilt_speed_space,
AXPTZMovementZoomSpace  zoom_space,
GError **  error 
)

Sets the spaces for the relative movements.

Parameters
pan_tilt_spaceThe space for the pan and tilt coordinates. Supported: AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_DEGREE Default: AX_PTZ_MOVEMENT_PAN_TILT_DEGREE
pan_tilt_speed_spaceThe space for the pan and tilt speed. Supported: AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS
zoom_spaceThe space for the zoom coordinate. Supported: AX_PTZ_MOVEMENT_ZOOM_UNITLESS
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.

Critical section Important!!! See ax_ptz.c for the thread safety rules in this library.

Examples:
axptzexample.c.

References AX_PTZ_MOVEMENT_PAN_TILT_UNKNOWN.

◆ ax_ptz_movement_handler_relative_move()

gboolean ax_ptz_movement_handler_relative_move ( const AXPTZControlQueueGroup group,
gint  video_channel,
const AXPTZRelativeMovement movement,
AXPTZInvoke  invoke,
void *  callback_func,
void *  user_data,
GError **  error 
)

Performs a relative movement.

Parameters
groupA group in the PTZ control queue.
video_channelA video channel. Starts from video channel 1.
movementA relative movement.
invokeThe invoke type. Supported: ACAP_PTZ_INVOKE_ASYNC.
callback_funcFuture use. Must be set to NULL.
user_dataFuture use. Must be set to NULL.
errorReturn location for a GError or NULL.
Returns
TRUE if the movement command was successfully sent to the underlying PTZ framework, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_set_continuous_spaces()

gboolean ax_ptz_movement_handler_set_continuous_spaces ( AXPTZMovementPanTiltSpeedSpace  pan_tilt_speed_space,
GError **  error 
)

Sets the spaces for the continuous movements.

Parameters
pan_tilt_speed_spaceThe space for the pan and tilt speed. Supported: AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNITLESS
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.

Critical section Important!!! See ax_ptz.c for the thread safety rules in this library.

Examples:
axptzexample.c.

References AX_PTZ_MOVEMENT_PAN_TILT_SPEED_UNKNOWN.

◆ ax_ptz_movement_handler_continuous_start()

gboolean ax_ptz_movement_handler_continuous_start ( const AXPTZControlQueueGroup group,
gint  video_channel,
const AXPTZContinuousMovement movement,
AXPTZInvoke  invoke,
void *  callback_func,
void *  user_data,
GError **  error 
)

Starts a continuous movement.

Parameters
groupA group in the PTZ control queue.
video_channelA video channel. Starts from video channel 1.
movementA continuous movement.
invokeThe invoke type. Supported: ACAP_PTZ_INVOKE_ASYNC.
callback_funcFuture use. Must be set to NULL.
user_dataFuture use. Must be set to NULL.
errorReturn location for a GError or NULL.
Returns
TRUE if the movement command was successfully sent to the underlying PTZ framework, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_continuous_stop()

gboolean ax_ptz_movement_handler_continuous_stop ( const AXPTZControlQueueGroup group,
gint  video_channel,
gboolean  stop_pan_tilt,
gboolean  stop_zoom,
AXPTZInvoke  invoke,
void *  callback_func,
void *  user_data,
GError **  error 
)

Stops a continuous movement.

Parameters
groupA group in the PTZ control queue.
video_channelA video channel. Starts from video channel 1.
stop_pan_tiltStop pan and tilt.
stop_zoomStop zoom.
invokeThe invoke type. Supported: ACAP_PTZ_INVOKE_ASYNC.
callback_funcFuture use. Must be set to NULL.
user_dataFuture use. Must be set to NULL.
errorReturn location for a GError or NULL.
Returns
TRUE if the movement command was successfully sent to the underlying PTZ framework, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_get_ptz_status()

gboolean ax_ptz_movement_handler_get_ptz_status ( gint  video_channel,
AXPTZMovementPanTiltSpace  pan_tilt_space,
AXPTZMovementZoomSpace  zoom_space,
AXPTZStatus **  status,
GError **  error 
)

Gets the current pan, tilt and zoom coordinates and movement statuses.

Parameters
video_channelA video channel. Starts from video channel 1.
pan_tilt_spaceThe space for the pan and tilt coordinates. Supported: AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_DEGREE.
zoom_spaceThe space for the zoom coordinate. Supported: AX_PTZ_MOVEMENT_ZOOM_UNITLESS, AX_PTZ_MOVEMENT_ZOOM_MAGNIFICATION
statusReturns a struct with pan, tilt and zoom coordinates and statuses.
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_get_ptz_limits()

gboolean ax_ptz_movement_handler_get_ptz_limits ( gint  video_channel,
AXPTZMovementPanTiltSpace  pan_tilt_space,
AXPTZMovementZoomSpace  zoom_space,
AXPTZLimits **  limits,
GError **  error 
)

Gets the pan, tilt and zoom limits.

Parameters
video_channelA video channel. Starts from video channel 1.
pan_tilt_spaceThe space for the pan and tilt coordinates. Supported: AX_PTZ_MOVEMENT_PAN_TILT_UNITLESS, AX_PTZ_MOVEMENT_PAN_TILT_DEGREE.
zoom_spaceThe space for the zoom coordinate. Supported: AX_PTZ_MOVEMENT_ZOOM_UNITLESS
limitsReturns a struct with the PTZ limits.
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_get_fov()

gboolean ax_ptz_movement_handler_get_fov ( gint  video_channel,
fixed_t *  h_fov,
fixed_t *  v_fov,
GError **  error 
)

Gets the horizontal and vertical field of view in degrees.

Parameters
video_channelA video channel. Starts from video channel 1.
h_fovReturns the horizontal field of view in degrees.
v_fovReturns the vertical field of view in degrees.
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.

◆ ax_ptz_movement_handler_is_ptz_moving()

gboolean ax_ptz_movement_handler_is_ptz_moving ( gint  video_channel,
gboolean *  is_moving,
GError **  error 
)

Checks if the camera is panning, tilting, zooming, focusing, adjusting brightness or adjusting iris.

Parameters
video_channelA video channel. Starts from video channel 1.
is_movingReturns TRUE if the camera is panning, tilting, zooming, focusing, adjusting brightness or adjusting iris, otherwise FALSE.
errorReturn location for a GError or NULL.
Returns
TRUE on success, FALSE on failure.
Examples:
axptzexample.c.

◆ ax_ptz_movement_handler_get_move_capabilities()

GList* ax_ptz_movement_handler_get_move_capabilities ( gint  video_channel,
GError **  error 
)

Gets the supported PTZ move capabilities.

Possible capabilities: AX_PTZ_MOVE_ABS_PAN Absolute pan. AX_PTZ_MOVE_REL_PAN Relative pan. AX_PTZ_MOVE_CONT_PAN Continuous pan. AX_PTZ_MOVE_ABS_TILT Absolute tilt. AX_PTZ_MOVE_REL_TILT Relative tilt. AX_PTZ_MOVE_CONT_TILT Continuous tilt. AX_PTZ_MOVE_ABS_ZOOM Absolute zoom. AX_PTZ_MOVE_REL_ZOOM Relative zoom. AX_PTZ_MOVE_CONT_ZOOM Continuous zoom.

Parameters
video_channelA video channel. Starts from video channel 1.
errorReturn location for a GError or NULL.
Returns
A GList of allocated strings with the move capabilities on success, NULL on failure. Destroy it by using g_free on the elements and g_list_free on the list.
Examples:
axptzexample.c.