@@ -438,6 +438,50 @@ arv_gvcp_packet_new_packet_resend_cmd (guint64 frame_id,
438438 return packet ;
439439}
440440
441+ /**
442+ * arv_gvcp_packet_new_action_cmd: (skip)
443+ * @device_key: device key
444+ * @group_key: group key
445+ * @group_mask: group mask
446+ * @timestamp: optional timestamp (<=0 if not used)
447+ *
448+ * Create a gvcp packet for an action command.
449+ *
450+ * Return value: (transfer full): a new #ArvGvcpPacket
451+ */
452+
453+ ArvGvcpPacket *
454+ arv_gvcp_packet_new_action_cmd (guint16 packet_id ,
455+ guint32 device_key , guint32 group_key ,
456+ guint32 group_mask , gint64 timestamp ,
457+ size_t * packet_size )
458+ {
459+ ArvGvcpPacket * packet ;
460+ guint32 * data ;
461+
462+ * packet_size = sizeof (ArvGvcpHeader ) + 3 * sizeof (guint32 );
463+ if (timestamp <= 0 )
464+ * packet_size += sizeof (gint64 );
465+
466+ packet = g_malloc (* packet_size );
467+
468+ packet -> header .packet_type = ARV_GVCP_PACKET_TYPE_CMD ;
469+ packet -> header .packet_flags = 0 ;
470+ packet -> header .command = g_htons (ARV_GVCP_COMMAND_ACTION_CMD );
471+ packet -> header .size = g_htons (* packet_size - sizeof (ArvGvcpHeader ));
472+ packet -> header .id = g_htons (packet_id );
473+
474+ data = (guint32 * ) & packet -> data ;
475+
476+ data [0 ] = g_htonl (device_key );
477+ data [1 ] = g_htonl (group_key );
478+ data [2 ] = g_htonl (group_mask );
479+ if (timestamp <=0 )
480+ * ((gint64 * )& data [3 ]) = GINT64_TO_BE (timestamp );
481+
482+ return packet ;
483+ }
484+
441485static const char *
442486arv_enum_to_string (GType type ,
443487 guint enum_value )
0 commit comments