Skip to content

Commit 24a8035

Browse files
n115EmmanuelP
authored andcommitted
camera: add action API
Without implementation for now.
1 parent f3d3fb5 commit 24a8035

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

src/arvcamera.c

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,6 +2739,114 @@ arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera, ArvGvPacketSizeAdju
27392739
arv_gv_device_set_packet_size_adjustment (ARV_GV_DEVICE (priv->device), adjustment);
27402740
}
27412741

2742+
/**
2743+
* arv_camera_gv_configure_action_command:
2744+
* @camera: a #ArvCamera
2745+
* @command_name: the action command that will be configured (1-based)
2746+
* @device_key: a user defined 'password' that will be used to authorize action commands
2747+
* @group_key: a user defined group that will have to match for an action command
2748+
* @group_mask: a bit field that gets matched to a mask in the action command
2749+
* @error: a #GError placeholder, %NULL to ignore
2750+
*
2751+
* Configure a camera to accept action commands
2752+
*
2753+
* Since: 0.8.7
2754+
*/
2755+
2756+
void
2757+
arv_camera_gv_configure_action_command (ArvCamera *camera, const char *command_name,
2758+
guint32 device_key, guint32 group_key, guint32 group_mask, GError **error)
2759+
{
2760+
GError *local_error = NULL;
2761+
2762+
g_return_if_fail (arv_camera_is_gv_device (camera));
2763+
2764+
if (error == NULL)
2765+
arv_camera_set_string (camera, "ActionSelector", command_name, &local_error);
2766+
if (error == NULL)
2767+
arv_camera_set_integer (camera, "ActionDeviceKey", device_key, &local_error);
2768+
if (error == NULL)
2769+
arv_camera_set_integer (camera, "ActionGroupKey", group_key, &local_error);
2770+
if (error == NULL)
2771+
arv_camera_set_integer (camera, "ActionGroupMask", group_key, &local_error);
2772+
2773+
if (local_error != NULL)
2774+
g_propagate_error (error, local_error);
2775+
}
2776+
2777+
/**
2778+
* arv_camera_gv_get_available_action_commands:
2779+
* @camera: a #ArvCamera
2780+
* @n_commands: (out): number of action commands
2781+
* @error: a #GError placeholder, %NULL to ignore
2782+
*
2783+
* Returns: (array length=n_commands) (transfer container): a newly allocated array of strings, which must be freed
2784+
* using g_free().
2785+
*
2786+
* Since: 0.8.7
2787+
*/
2788+
2789+
const char **
2790+
arv_camera_gv_get_available_action_commands (ArvCamera *camera, guint *n_commands, GError **error)
2791+
{
2792+
return arv_camera_dup_available_enumerations_as_strings (camera, "ActionSelector", n_commands, error);
2793+
}
2794+
2795+
/**
2796+
* arv_camera_gv_issue_action_command:
2797+
* @device_key: a user defined 'password' that will be used to authorize action commands
2798+
* @group_key: a user defined group that will have to match for an action command
2799+
* @group_mask: a bit field that gets matched to a mask in the action command
2800+
* @broadcast_address: the address the action command is sent to
2801+
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses
2802+
* @n_acknowledges: (out): a placeholder for the number of ackowledges
2803+
* @error: a GError placeholder, %NULL to ignore
2804+
*
2805+
* Issue action command
2806+
*
2807+
* Returns: %TRUE if successfull
2808+
*
2809+
* Since: 0.8.7
2810+
*/
2811+
2812+
gboolean
2813+
arv_camera_gv_issue_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
2814+
GInetAddress *broadcast_address,
2815+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error)
2816+
{
2817+
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask,
2818+
0, broadcast_address,
2819+
inet_addresses, n_acknowledges, error);
2820+
}
2821+
2822+
/**
2823+
* arv_camera_gv_issue_scheduled_action_command:
2824+
* @device_key: a user defined 'password' that will be used to authorize action commands
2825+
* @group_key: a user defined group that will have to match for an action command
2826+
* @group_mask: a bit field that gets matched to a mask in the action command
2827+
* @timestamp_ns: action time, in nanosecond
2828+
* @broadcast_address: the address the action command is sent to
2829+
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses
2830+
* @n_acknowledges: (out): a placeholder for the number of ackowledges
2831+
* @error: a GError placeholder, %NULL to ignore
2832+
*
2833+
* Issue action command
2834+
*
2835+
* Returns: %TRUE if successfull
2836+
*
2837+
* Since: 0.8.7
2838+
*/
2839+
2840+
gboolean
2841+
arv_camera_gv_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
2842+
guint64 timestamp_ns, GInetAddress *broadcast_address,
2843+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error)
2844+
{
2845+
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask,
2846+
timestamp_ns, broadcast_address,
2847+
inet_addresses, n_acknowledges, error);
2848+
}
2849+
27422850
/**
27432851
* arv_camera_is_uv_device:
27442852
* @camera: a #ArvCamera

src/arvcamera.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <arvstream.h>
3232
#include <arvgvstream.h>
3333
#include <arvgvdevice.h>
34+
#include <gio/gio.h>
3435

3536
G_BEGIN_DECLS
3637

@@ -191,6 +192,18 @@ void arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera,
191192

192193
void arv_camera_gv_set_stream_options (ArvCamera *camera, ArvGvStreamOption options);
193194

195+
void arv_camera_gv_configure_action_command (ArvCamera *camera, const char *command_name,
196+
guint32 device_key, guint32 group_key, guint32 group_mask,
197+
GError **error);
198+
const char ** arv_camera_gv_get_available_action_commands (ArvCamera *camera, guint *n_commands, GError **error);
199+
gboolean arv_camera_gv_issue_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
200+
GInetAddress *broadcast_address,
201+
GInetAddress **inet_addresses, guint *n_acknowledges,
202+
GError **error);
203+
gboolean arv_camera_gv_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
204+
guint64 timestamp_ns, GInetAddress *broadcast_address,
205+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error);
206+
194207
/* USB3Vision specific API */
195208

196209
gboolean arv_camera_is_uv_device (ArvCamera *camera);

src/arvgvdevice.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,15 @@ arv_gv_device_heartbeat_thread (void *data)
427427

428428
/* ArvGvDevice implemenation */
429429

430+
gboolean
431+
arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
432+
guint64 timestamp_ns, GInetAddress *broadcast_address,
433+
GInetAddress **inet_addresses, guint *n_acknowledges,
434+
GError **error)
435+
{
436+
return FALSE;
437+
}
438+
430439
/**
431440
* arv_gv_device_take_control:
432441
* @gv_device: a #ArvGvDevice

src/arvgvdevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ void arv_gv_device_set_stream_options (ArvGvDevice *gv_device, ArvGvStreamO
8080

8181
gboolean arv_gv_device_is_controller (ArvGvDevice *gv_device);
8282

83+
gboolean arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
84+
guint64 timestamp_ns, GInetAddress *broadcast_address,
85+
GInetAddress **inet_addresses, guint *n_acknowledges,
86+
GError **error);
87+
8388
G_END_DECLS
8489

8590
#endif

0 commit comments

Comments
 (0)