serial-parsers: port to use object logging
This commit is contained in:
@@ -148,7 +148,7 @@ parse_response (MMPortSerial *port,
|
|||||||
|
|
||||||
/* Parse it; returns FALSE if there is nothing we can do with this
|
/* Parse it; returns FALSE if there is nothing we can do with this
|
||||||
* response yet. */
|
* response yet. */
|
||||||
if (!self->priv->response_parser_fn (self->priv->response_parser_user_data, string, &inner_error)) {
|
if (!self->priv->response_parser_fn (self->priv->response_parser_user_data, string, self, &inner_error)) {
|
||||||
/* Copy what we got back in the response buffer. */
|
/* Copy what we got back in the response buffer. */
|
||||||
g_byte_array_append (response, (const guint8 *) string->str, string->len);
|
g_byte_array_append (response, (const guint8 *) string->str, string->len);
|
||||||
g_string_free (string, TRUE);
|
g_string_free (string, TRUE);
|
||||||
|
@@ -53,9 +53,10 @@ typedef enum { /*< underscore_name=mm_port_serial_at_flag >*/
|
|||||||
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL = 1 << 3,
|
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL = 1 << 3,
|
||||||
} MMPortSerialAtFlag;
|
} MMPortSerialAtFlag;
|
||||||
|
|
||||||
typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data,
|
typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data,
|
||||||
GString *response,
|
GString *response,
|
||||||
GError **error);
|
gpointer log_object,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
typedef void (*MMPortSerialAtUnsolicitedMsgFn) (MMPortSerialAt *port,
|
typedef void (*MMPortSerialAtUnsolicitedMsgFn) (MMPortSerialAt *port,
|
||||||
GMatchInfo *match_info,
|
GMatchInfo *match_info,
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "mm-error-helpers.h"
|
#include "mm-error-helpers.h"
|
||||||
#include "mm-serial-parsers.h"
|
#include "mm-serial-parsers.h"
|
||||||
#include "mm-log.h"
|
#include "mm-log-object.h"
|
||||||
|
|
||||||
/* Clean up the response by removing control characters like <CR><LF> etc */
|
/* Clean up the response by removing control characters like <CR><LF> etc */
|
||||||
static void
|
static void
|
||||||
@@ -161,9 +161,10 @@ mm_serial_parser_v1_add_filter (gpointer data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mm_serial_parser_v1_parse (gpointer data,
|
mm_serial_parser_v1_parse (gpointer data,
|
||||||
GString *response,
|
GString *response,
|
||||||
GError **error)
|
gpointer log_object,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
MMSerialParserV1 *parser = (MMSerialParserV1 *) data;
|
MMSerialParserV1 *parser = (MMSerialParserV1 *) data;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
@@ -188,7 +189,7 @@ mm_serial_parser_v1_parse (gpointer data,
|
|||||||
response,
|
response,
|
||||||
&local_error)) {
|
&local_error)) {
|
||||||
g_assert (local_error != NULL);
|
g_assert (local_error != NULL);
|
||||||
mm_dbg ("Got response filtered in serial port: %s", local_error->message);
|
mm_obj_dbg (log_object, "response filtered in serial port: %s", local_error->message);
|
||||||
g_propagate_error (error, local_error);
|
g_propagate_error (error, local_error);
|
||||||
response_clean (response);
|
response_clean (response);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -361,7 +362,7 @@ done:
|
|||||||
response_clean (response);
|
response_clean (response);
|
||||||
|
|
||||||
if (local_error) {
|
if (local_error) {
|
||||||
mm_dbg ("Got failure code %d: %s", local_error->code, local_error->message);
|
mm_obj_dbg (log_object, "operation failure: %d (%s)", local_error->code, local_error->message);
|
||||||
g_propagate_error (error, local_error);
|
g_propagate_error (error, local_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ void mm_serial_parser_v1_set_custom_regex (gpointer data,
|
|||||||
GRegex *error);
|
GRegex *error);
|
||||||
gboolean mm_serial_parser_v1_parse (gpointer parser,
|
gboolean mm_serial_parser_v1_parse (gpointer parser,
|
||||||
GString *response,
|
GString *response,
|
||||||
|
gpointer log_object,
|
||||||
GError **error);
|
GError **error);
|
||||||
void mm_serial_parser_v1_destroy (gpointer parser);
|
void mm_serial_parser_v1_destroy (gpointer parser);
|
||||||
gboolean mm_serial_parser_v1_is_known_error (const GError *error);
|
gboolean mm_serial_parser_v1_is_known_error (const GError *error);
|
||||||
|
Reference in New Issue
Block a user