diff mbox series

[05/25] efw-downloader: efw-proto: add class virtual method to handle responded signal

Message ID 20200821073111.134857-6-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show
Series alsa-tools: efw-downloader: add initial version of firmwre downloader for Echo Audio Fireworks devices | expand

Commit Message

Takashi Sakamoto Aug. 21, 2020, 7:30 a.m. UTC
GObject allows applications to override class virtual method with own
method implementation in inheritance.

This commit adds the class virtual method to handle 'responded' signal
added in the former commit.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 efw-downloader/src/efw-proto.c |  2 +-
 efw-downloader/src/efw-proto.h | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/efw-downloader/src/efw-proto.c b/efw-downloader/src/efw-proto.c
index 6502957..72b7655 100644
--- a/efw-downloader/src/efw-proto.c
+++ b/efw-downloader/src/efw-proto.c
@@ -60,7 +60,7 @@  static void efw_proto_class_init(EfwProtoClass *klass)
         g_signal_new("responded",
             G_OBJECT_CLASS_TYPE(klass),
             G_SIGNAL_RUN_LAST,
-            0,
+            G_STRUCT_OFFSET(EfwProtoClass, responded),
             NULL, NULL,
             efw_proto_sigs_marshal_VOID__ENUM_UINT_UINT_UINT_POINTER_UINT,
             G_TYPE_NONE,
diff --git a/efw-downloader/src/efw-proto.h b/efw-downloader/src/efw-proto.h
index fbd4366..fdbcbc8 100644
--- a/efw-downloader/src/efw-proto.h
+++ b/efw-downloader/src/efw-proto.h
@@ -34,6 +34,24 @@  struct _EfwProto {
 
 struct _EfwProtoClass {
     HinawaFwRespClass parent_class;
+
+    /**
+     * EfwProtoClass::responded:
+     * @self: A #EfwProto.
+     * @status: One of #HinawaSndEfwStatus.
+     * @seqnum: The sequence number of response.
+     * @category: The value of category field in the response.
+     * @command: The value of command field in the response.
+     * @frame: (array length=frame_size)(element-type guint32): The array with elements for
+     *         quadlet data of response for Echo Fireworks protocol.
+     * @frame_size: The number of elements of the array.
+     *
+     * When the unit transfers asynchronous packet as response for Fireworks protocol, and the
+     * process successfully reads the content of response from ALSA Fireworks driver, the
+     * #EfwProto::responded signal handler is called with parameters of the response.
+     */
+    void (*responded)(EfwProto *self, HinawaSndEfwStatus status, guint seqnum,
+                      guint category, guint command, const guint32 *frame, guint frame_size);
 };
 
 EfwProto *efw_proto_new();