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:
26
src/mm-serial-parsers.h
Normal file
26
src/mm-serial-parsers.h
Normal 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 */
|
Reference in New Issue
Block a user