summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gatchat/gathdlc.c16
-rw-r--r--gatchat/gathdlc.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index 7989bd7c..d04ba384 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -622,3 +622,19 @@ void g_at_hdlc_suspend(GAtHDLC *hdlc)
g_at_io_set_write_handler(hdlc->io, NULL, NULL);
g_at_io_set_read_handler(hdlc->io, NULL, NULL);
}
+
+static void hdlc_wakeup_writer(GAtHDLC *hdlc)
+{
+ g_at_io_set_write_handler(hdlc->io, can_write_data, hdlc);
+}
+
+void g_at_hdlc_resume(GAtHDLC *hdlc)
+{
+ if (hdlc == NULL)
+ return;
+
+ g_at_io_set_read_handler(hdlc->io, new_bytes, hdlc);
+
+ if (g_queue_get_length(hdlc->write_queue) > 0)
+ hdlc_wakeup_writer(hdlc);
+}
diff --git a/gatchat/gathdlc.h b/gatchat/gathdlc.h
index 556e3838..e82b33e2 100644
--- a/gatchat/gathdlc.h
+++ b/gatchat/gathdlc.h
@@ -61,6 +61,7 @@ void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,
gpointer user_data);
void g_at_hdlc_suspend(GAtHDLC *hdlc);
+void g_at_hdlc_resume(GAtHDLC *hdlc);
#ifdef __cplusplus
}