-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
camera: action API support #468
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2739,6 +2739,114 @@ arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera, ArvGvPacketSizeAdju | |
arv_gv_device_set_packet_size_adjustment (ARV_GV_DEVICE (priv->device), adjustment); | ||
} | ||
|
||
/** | ||
* arv_camera_gv_configure_action_command: | ||
* @camera: a #ArvCamera | ||
* @command_name: the action command that will be configured (1-based) | ||
* @device_key: a user defined 'password' that will be used to authorize action commands | ||
* @group_key: a user defined group that will have to match for an action command | ||
* @group_mask: a bit field that gets matched to a mask in the action command | ||
* @error: a #GError placeholder, %NULL to ignore | ||
* | ||
* Configure a camera to accept action commands | ||
* | ||
* Since: 0.8.7 | ||
*/ | ||
|
||
void | ||
arv_camera_gv_configure_action_command (ArvCamera *camera, const char *command_name, | ||
guint32 device_key, guint32 group_key, guint32 group_mask, GError **error) | ||
{ | ||
GError *local_error = NULL; | ||
|
||
g_return_if_fail (arv_camera_is_gv_device (camera)); | ||
|
||
if (error == NULL) | ||
arv_camera_set_string (camera, "ActionSelector", command_name, &local_error); | ||
if (error == NULL) | ||
arv_camera_set_integer (camera, "ActionDeviceKey", device_key, &local_error); | ||
if (error == NULL) | ||
arv_camera_set_integer (camera, "ActionGroupKey", group_key, &local_error); | ||
if (error == NULL) | ||
arv_camera_set_integer (camera, "ActionGroupMask", group_key, &local_error); | ||
|
||
if (local_error != NULL) | ||
g_propagate_error (error, local_error); | ||
} | ||
|
||
/** | ||
* arv_camera_gv_get_available_action_commands: | ||
* @camera: a #ArvCamera | ||
* @n_commands: (out): number of action commands | ||
* @error: a #GError placeholder, %NULL to ignore | ||
* | ||
* Returns: (array length=n_commands) (transfer container): a newly allocated array of strings, which must be freed | ||
* using g_free(). | ||
* | ||
* Since: 0.8.7 | ||
*/ | ||
|
||
const char ** | ||
arv_camera_gv_get_available_action_commands (ArvCamera *camera, guint *n_commands, GError **error) | ||
{ | ||
return arv_camera_dup_available_enumerations_as_strings (camera, "ActionSelector", n_commands, error); | ||
} | ||
|
||
/** | ||
* arv_camera_gv_issue_action_command: | ||
* @device_key: a user defined 'password' that will be used to authorize action commands | ||
* @group_key: a user defined group that will have to match for an action command | ||
* @group_mask: a bit field that gets matched to a mask in the action command | ||
* @broadcast_address: the address the action command is sent to | ||
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses | ||
* @n_acknowledges: (out): a placeholder for the number of ackowledges | ||
Comment on lines
+2801
to
+2802
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API: we should handle devices by using #ArvDevice instances here, not by their IP addresses. |
||
* @error: a GError placeholder, %NULL to ignore | ||
* | ||
* Issue action command | ||
* | ||
* Returns: %TRUE if successfull | ||
* | ||
* Since: 0.8.7 | ||
*/ | ||
|
||
gboolean | ||
arv_camera_gv_issue_action_command (guint32 device_key, guint32 group_key, guint32 group_mask, | ||
GInetAddress *broadcast_address, | ||
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error) | ||
{ | ||
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask, | ||
0, broadcast_address, | ||
inet_addresses, n_acknowledges, error); | ||
} | ||
|
||
/** | ||
* arv_camera_gv_issue_scheduled_action_command: | ||
* @device_key: a user defined 'password' that will be used to authorize action commands | ||
* @group_key: a user defined group that will have to match for an action command | ||
* @group_mask: a bit field that gets matched to a mask in the action command | ||
* @timestamp_ns: action time, in nanosecond | ||
* @broadcast_address: the address the action command is sent to | ||
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses | ||
* @n_acknowledges: (out): a placeholder for the number of ackowledges | ||
* @error: a GError placeholder, %NULL to ignore | ||
* | ||
* Issue action command | ||
* | ||
* Returns: %TRUE if successfull | ||
* | ||
* Since: 0.8.7 | ||
*/ | ||
|
||
gboolean | ||
arv_camera_gv_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask, | ||
guint64 timestamp_ns, GInetAddress *broadcast_address, | ||
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error) | ||
{ | ||
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask, | ||
timestamp_ns, broadcast_address, | ||
inet_addresses, n_acknowledges, error); | ||
} | ||
|
||
/** | ||
* arv_camera_is_uv_device: | ||
* @camera: a #ArvCamera | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,6 +427,15 @@ arv_gv_device_heartbeat_thread (void *data) | |
|
||
/* ArvGvDevice implemenation */ | ||
|
||
gboolean | ||
arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask, | ||
guint64 timestamp_ns, GInetAddress *broadcast_address, | ||
GInetAddress **inet_addresses, guint *n_acknowledges, | ||
GError **error) | ||
{ | ||
return FALSE; | ||
} | ||
|
||
Comment on lines
+431
to
+438
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: actual implementation |
||
/** | ||
* arv_gv_device_take_control: | ||
* @gv_device: a #ArvGvDevice | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,11 @@ void arv_gv_device_set_stream_options (ArvGvDevice *gv_device, ArvGvStreamO | |
|
||
gboolean arv_gv_device_is_controller (ArvGvDevice *gv_device); | ||
|
||
gboolean arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask, | ||
guint64 timestamp_ns, GInetAddress *broadcast_address, | ||
GInetAddress **inet_addresses, guint *n_acknowledges, | ||
GError **error); | ||
|
||
Comment on lines
+83
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: actual implementation |
||
G_END_DECLS | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should test local_error, not error