Skip to content

Commit 3b331cf

Browse files
n115EmmanuelP
authored andcommitted
camera: add action API
Without implementation for now.
1 parent 6d75923 commit 3b331cf

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
@@ -2577,6 +2577,114 @@ arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera, ArvGvPacketSizeAdju
25772577
arv_gv_device_set_packet_size_adjustment (ARV_GV_DEVICE (priv->device), adjustment);
25782578
}
25792579

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