Rewrite serial device communications.

Instead of vague "send something, wait something" the responses are now
analyzed by (overridable) parsers. Makes all the modem implementations much
easier since each caller knows without any code whether the call succeeded
or failed.

Another thing that makes modem code simpler (and the whole thing more robust),
is the queueing of sent commands. Each queued command has a command and a
callback which is quaranteed to get called, even if sending failed.

Define and implement error reporting.
This commit is contained in:
Tambet Ingo
2008-09-11 08:35:32 +03:00
parent bb874acea0
commit ac4409e7ce
23 changed files with 1463 additions and 1497 deletions

26
src/mm-serial-parsers.h Normal file
View File

@@ -0,0 +1,26 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef MM_SERIAL_PARSERS_H
#define MM_SERIAL_PARSERS_H
#include <glib.h>
/* FIXME: V0 parser is not finished */
#if 0
gpointer mm_serial_parser_v0_new (void);
gboolean mm_serial_parser_v0_parse (gpointer parser,
GString *response,
GError **error);
void mm_serial_parser_v0_destroy (gpointer parser);
#endif
gpointer mm_serial_parser_v1_new (void);
gboolean mm_serial_parser_v1_parse (gpointer parser,
GString *response,
GError **error);
void mm_serial_parser_v1_destroy (gpointer parser);
#endif /* MM_SERIAL_PARSERS_H */