aboutsummaryrefslogtreecommitdiff
path: root/src/mm-serial.h
diff options
context:
space:
mode:
authorTambet Ingo <tambet@gmail.com>2008-07-31 09:43:00 +0300
committerTambet Ingo <tambet@gmail.com>2008-07-31 09:43:00 +0300
commitcc31458b18e8c274641cf124f5bf7ec6fe506dfb (patch)
treee4ec49a3e26cfd0f002faa76e0a6c0d180204177 /src/mm-serial.h
Initial commit.
Diffstat (limited to 'src/mm-serial.h')
-rw-r--r--src/mm-serial.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/mm-serial.h b/src/mm-serial.h
new file mode 100644
index 00000000..bd138516
--- /dev/null
+++ b/src/mm-serial.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+#ifndef MM_SERIAL_H
+#define MM_SERIAL_H
+
+#include <glib/gtypes.h>
+#include <glib-object.h>
+
+#define MM_TYPE_SERIAL (mm_serial_get_type ())
+#define MM_SERIAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SERIAL, MMSerial))
+#define MM_SERIAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SERIAL, MMSerialClass))
+#define MM_IS_SERIAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SERIAL))
+#define MM_IS_SERIAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SERIAL))
+#define MM_SERIAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SERIAL, MMSerialClass))
+
+#define MM_SERIAL_DEVICE "device"
+#define MM_SERIAL_BAUD "baud"
+#define MM_SERIAL_BITS "bits"
+#define MM_SERIAL_PARITY "parity"
+#define MM_SERIAL_STOPBITS "stopbits"
+#define MM_SERIAL_SEND_DELAY "send-delay"
+
+typedef struct {
+ GObject parent;
+} MMSerial;
+
+typedef struct {
+ GObjectClass parent;
+} MMSerialClass;
+
+GType mm_serial_get_type (void);
+
+typedef void (*MMSerialGetReplyFn) (MMSerial *serial,
+ const char *reply,
+ gpointer user_data);
+
+typedef void (*MMSerialWaitForReplyFn) (MMSerial *serial,
+ int reply_index,
+ gpointer user_data);
+
+typedef void (*MMSerialWaitQuietFn) (MMSerial *serial,
+ gboolean timed_out,
+ gpointer user_data);
+
+typedef void (*MMSerialFlashFn) (MMSerial *serial,
+ gpointer user_data);
+
+const char *mm_serial_get_device (MMSerial *serial);
+
+gboolean mm_serial_open (MMSerial *self);
+
+void mm_serial_close (MMSerial *self);
+gboolean mm_serial_send_command (MMSerial *self,
+ GByteArray *command);
+
+gboolean mm_serial_send_command_string (MMSerial *self,
+ const char *str);
+
+guint mm_serial_get_reply (MMSerial *self,
+ guint timeout,
+ const char *terminators,
+ MMSerialGetReplyFn callback,
+ gpointer user_data);
+
+guint mm_serial_wait_for_reply (MMSerial *self,
+ guint timeout,
+ char **responses,
+ char **terminators,
+ MMSerialWaitForReplyFn callback,
+ gpointer user_data);
+
+void mm_serial_wait_quiet (MMSerial *self,
+ guint timeout,
+ guint quiet_time,
+ MMSerialWaitQuietFn callback,
+ gpointer user_data);
+
+guint mm_serial_flash (MMSerial *self,
+ guint32 flash_time,
+ MMSerialFlashFn callback,
+ gpointer user_data);
+
+GIOChannel *mm_serial_get_io_channel (MMSerial *self);
+
+#endif /* MM_SERIAL_H */