On the client side messages are handled by the channel itself, there is
no client here.
---
 src/channel-power.c | 20 ++++++++++++++++++++
 src/channel-power.h |  3 +++
 src/map-file-glib   |  1 +
 3 files changed, 24 insertions(+)

diff --git a/src/channel-power.c b/src/channel-power.c
index ad678f8..6b2d50f 100644
--- a/src/channel-power.c
+++ b/src/channel-power.c
@@ -71,6 +71,26 @@ static void 
spice_power_channel_class_init(SpicePowerChannelClass *klass)
     gobject_class->get_property = spice_power_get_property;
     channel_class->channel_up   = spice_power_channel_up;
     channel_class->channel_reset = spice_power_channel_reset;
+
+    // no server-to-client messages
+    spice_channel_set_handlers(SPICE_CHANNEL_CLASS(klass), NULL, 0);
+}
+
+/**
+ * spice_power_channel_send_reset:
+ * @self: a #SpicePowerChannel
+ *
+ * Send an reset action to the server.
+ **/
+void spice_power_channel_send_reset(SpicePowerChannel *self)
+{
+    CHANNEL_DEBUG(self, "spice_power_channel_send_reset() called");
+    SpiceMsgOut *msg;
+
+    g_return_if_fail(SPICE_IS_POWER_CHANNEL(self));
+
+    msg = spice_msg_out_new(SPICE_CHANNEL(self), SPICE_MSGC_POWER_RESET);
+    spice_msg_out_send(msg);
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/channel-power.h b/src/channel-power.h
index 36a84c5..c1c453f 100644
--- a/src/channel-power.h
+++ b/src/channel-power.h
@@ -63,6 +63,9 @@ struct _SpicePowerChannelClass {
 SPICE_GTK_AVAILABLE_IN_ALL
 GType spice_power_channel_get_type(void);
 
+SPICE_GTK_AVAILABLE_IN_ALL
+void spice_power_channel_send_reset(SpicePowerChannel *port);
+
 G_END_DECLS
 
 #endif /* __SPICE_CLIENT_POWER_CHANNEL_H__ */
diff --git a/src/map-file-glib b/src/map-file-glib
index a4fd22f..7689320 100644
--- a/src/map-file-glib
+++ b/src/map-file-glib
@@ -107,6 +107,7 @@ spice_port_event;
 spice_port_write_async;
 spice_port_write_finish;
 spice_power_channel_get_type;
+spice_power_channel_send_reset;
 spice_qmp_port_get;
 spice_qmp_port_get_type;
 spice_qmp_port_query_status_async;
-- 
2.52.0

Reply via email to