Skip to content

Commit 7df8471

Browse files
n115EmmanuelP
authored andcommitted
camera: add action API
Without implementation for now.
1 parent 24f90c4 commit 7df8471

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
@@ -2581,6 +2581,114 @@ arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera, ArvGvPacketSizeAdju
25812581
arv_gv_device_set_packet_size_adjustment (ARV_GV_DEVICE (priv->device), adjustment);
25822582
}
25832583

2584+
/**
2585+
* arv_camera_gv_configure_action_command:
2586+
* @camera: a #ArvCamera
2587+
* @command_name: the action command that will be configured (1-based)
2588+
* @device_key: a user defined 'password' that will be used to authorize action commands
2589+
* @group_key: a user defined group that will have to match for an action command
2590+
* @group_mask: a bit field that gets matched to a mask in the action command
2591+
* @error: a #GError placeholder, %NULL to ignore
2592+
*
2593+
* Configure a camera to accept action commands
2594+
*
2595+
* Since: 0.8.7
2596+
*/
2597+
2598+
void
2599+
arv_camera_gv_configure_action_command (ArvCamera *camera, const char *command_name,
2600+
guint32 device_key, guint32 group_key, guint32 group_mask, GError **error)
2601+
{
2602+
GError *local_error = NULL;
2603+
2604+
g_return_if_fail (arv_camera_is_gv_device (camera));
2605+
2606+
if (error == NULL)
2607+
arv_camera_set_string (camera, "ActionSelector", command_name, &local_error);
2608+
if (error == NULL)
2609+
arv_camera_set_integer (camera, "ActionDeviceKey", device_key, &local_error);
2610+
if (error == NULL)
2611+
arv_camera_set_integer (camera, "ActionGroupKey", group_key, &local_error);
2612+
if (error == NULL)
2613+
arv_camera_set_integer (camera, "ActionGroupMask", group_key, &local_error);
2614+
2615+
if (local_error != NULL)
2616+
g_propagate_error (error, local_error);
2617+
}
2618+
2619+
/**
2620+
* arv_camera_gv_get_available_action_commands:
2621+
* @camera: a #ArvCamera
2622+
* @n_commands: (out): number of action commands
2623+
* @error: a #GError placeholder, %NULL to ignore
2624+
*
2625+
* Returns: (array length=n_commands) (transfer container): a newly allocated array of strings, which must be freed
2626+
* using g_free().
2627+
*
2628+
* Since: 0.8.7
2629+
*/
2630+
2631+
const char **
2632+
arv_camera_gv_get_available_action_commands (ArvCamera *camera, guint *n_commands, GError **error)
2633+
{
2634+
return arv_camera_dup_available_enumerations_as_strings (camera, "ActionSelector", n_commands, error);
2635+
}
2636+
2637+
/**
2638+
* arv_camera_gv_issue_action_command:
2639+
* @device_key: a user defined 'password' that will be used to authorize action commands
2640+
* @group_key: a user defined group that will have to match for an action command
2641+
* @group_mask: a bit field that gets matched to a mask in the action command
2642+
* @broadcast_address: the address the action command is sent to
2643+
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses
2644+
* @n_acknowledges: (out): a placeholder for the number of ackowledges
2645+
* @error: a GError placeholder, %NULL to ignore
2646+
*
2647+
* Issue action command
2648+
*
2649+
* Returns: %TRUE if successfull
2650+
*
2651+
* Since: 0.8.7
2652+
*/
2653+
2654+
gboolean
2655+
arv_camera_gv_issue_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
2656+
GInetAddress *broadcast_address,
2657+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error)
2658+
{
2659+
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask,
2660+
0, broadcast_address,
2661+
inet_addresses, n_acknowledges, error);
2662+
}
2663+
2664+
/**
2665+
* arv_camera_gv_issue_scheduled_action_command:
2666+
* @device_key: a user defined 'password' that will be used to authorize action commands
2667+
* @group_key: a user defined group that will have to match for an action command
2668+
* @group_mask: a bit field that gets matched to a mask in the action command
2669+
* @timestamp_ns: action time, in nanosecond
2670+
* @broadcast_address: the address the action command is sent to
2671+
* @inet_addresses: (out): a placeholder for an array of acknowledge IP adresses
2672+
* @n_acknowledges: (out): a placeholder for the number of ackowledges
2673+
* @error: a GError placeholder, %NULL to ignore
2674+
*
2675+
* Issue action command
2676+
*
2677+
* Returns: %TRUE if successfull
2678+
*
2679+
* Since: 0.8.7
2680+
*/
2681+
2682+
gboolean
2683+
arv_camera_gv_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
2684+
guint64 timestamp_ns, GInetAddress *broadcast_address,
2685+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error)
2686+
{
2687+
return arv_gv_device_issue_scheduled_action_command (device_key, group_key, group_mask,
2688+
timestamp_ns, broadcast_address,
2689+
inet_addresses, n_acknowledges, error);
2690+
}
2691+
25842692
/**
25852693
* arv_camera_is_uv_device:
25862694
* @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

@@ -182,6 +183,18 @@ void arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera,
182183

183184
void arv_camera_gv_set_stream_options (ArvCamera *camera, ArvGvStreamOption options);
184185

186+
void arv_camera_gv_configure_action_command (ArvCamera *camera, const char *command_name,
187+
guint32 device_key, guint32 group_key, guint32 group_mask,
188+
GError **error);
189+
const char ** arv_camera_gv_get_available_action_commands (ArvCamera *camera, guint *n_commands, GError **error);
190+
gboolean arv_camera_gv_issue_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
191+
GInetAddress *broadcast_address,
192+
GInetAddress **inet_addresses, guint *n_acknowledges,
193+
GError **error);
194+
gboolean arv_camera_gv_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
195+
guint64 timestamp_ns, GInetAddress *broadcast_address,
196+
GInetAddress **inet_addresses, guint *n_acknowledges, GError **error);
197+
185198
/* USB3Vision specific API */
186199

187200
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
@@ -413,6 +413,15 @@ arv_gv_device_heartbeat_thread (void *data)
413413

414414
/* ArvGvDevice implemenation */
415415

416+
gboolean
417+
arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
418+
guint64 timestamp_ns, GInetAddress *broadcast_address,
419+
GInetAddress **inet_addresses, guint *n_acknowledges,
420+
GError **error)
421+
{
422+
return FALSE;
423+
}
424+
416425
/**
417426
* arv_gv_device_take_control:
418427
* @gv_device: a #ArvGvDevice

src/arvgvdevice.h

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

7979
gboolean arv_gv_device_is_controller (ArvGvDevice *gv_device);
8080

81+
gboolean arv_gv_device_issue_scheduled_action_command (guint32 device_key, guint32 group_key, guint32 group_mask,
82+
guint64 timestamp_ns, GInetAddress *broadcast_address,
83+
GInetAddress **inet_addresses, guint *n_acknowledges,
84+
GError **error);
85+
8186
G_END_DECLS
8287

8388
#endif

0 commit comments

Comments
 (0)