base-modem-at: indicate sequence status to response parsers
Let parsers know if this command is the last in a sequence since they may want to handle errors differently if that's the case.
This commit is contained in:

committed by
Aleksander Morgado

parent
4e06e0e67d
commit
cb2d6d6105
@@ -140,12 +140,15 @@ at_sequence_parse_response (MMAtSerialPort *port,
|
|||||||
/* No need to process response, go on to next command */
|
/* No need to process response, go on to next command */
|
||||||
continue_sequence = TRUE;
|
continue_sequence = TRUE;
|
||||||
else {
|
else {
|
||||||
|
const MMBaseModemAtCommand *next = ctx->current + 1;
|
||||||
|
|
||||||
/* Response processor will tell us if we need to keep on the sequence */
|
/* Response processor will tell us if we need to keep on the sequence */
|
||||||
continue_sequence = !ctx->current->response_processor (
|
continue_sequence = !ctx->current->response_processor (
|
||||||
ctx->self,
|
ctx->self,
|
||||||
ctx->response_processor_context,
|
ctx->response_processor_context,
|
||||||
ctx->current->command,
|
ctx->current->command,
|
||||||
response->str,
|
response->str,
|
||||||
|
next->command ? FALSE : TRUE, /* Last command in sequence? */
|
||||||
error,
|
error,
|
||||||
&result,
|
&result,
|
||||||
&result_error);
|
&result_error);
|
||||||
@@ -300,6 +303,7 @@ mm_base_modem_response_processor_string (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
@@ -318,6 +322,7 @@ mm_base_modem_response_processor_no_result (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
@@ -336,6 +341,7 @@ mm_base_modem_response_processor_no_result_continue (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
|
@@ -46,6 +46,7 @@ typedef gboolean (* MMBaseModemAtResponseProcessor) (MMBaseModem *self,
|
|||||||
gpointer response_processor_context,
|
gpointer response_processor_context,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error);
|
GError **result_error);
|
||||||
@@ -95,6 +96,7 @@ gboolean mm_base_modem_response_processor_string (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error);
|
GError **result_error);
|
||||||
@@ -103,6 +105,7 @@ gboolean mm_base_modem_response_processor_no_result (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error);
|
GError **result_error);
|
||||||
@@ -111,11 +114,11 @@ gboolean mm_base_modem_response_processor_no_result_continue (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error);
|
GError **result_error);
|
||||||
|
|
||||||
|
|
||||||
/* Single AT command, returning the whole response string */
|
/* Single AT command, returning the whole response string */
|
||||||
void mm_base_modem_at_command (MMBaseModem *self,
|
void mm_base_modem_at_command (MMBaseModem *self,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
|
@@ -331,6 +331,7 @@ parse_caps_gcap (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **variant,
|
GVariant **variant,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
@@ -363,6 +364,7 @@ parse_caps_cpin (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
@@ -395,10 +397,12 @@ parse_caps_cgmm (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
{
|
{
|
||||||
|
/* This check detects some really old Motorola GPRS dongles and phones */
|
||||||
if (strstr (response, "GSM900") ||
|
if (strstr (response, "GSM900") ||
|
||||||
strstr (response, "GSM1800") ||
|
strstr (response, "GSM1800") ||
|
||||||
strstr (response, "GSM1900") ||
|
strstr (response, "GSM1900") ||
|
||||||
@@ -2612,6 +2616,7 @@ parse_reg_setup_reply (MMBaseModem *self,
|
|||||||
gpointer none,
|
gpointer none,
|
||||||
const gchar *command,
|
const gchar *command,
|
||||||
const gchar *response,
|
const gchar *response,
|
||||||
|
gboolean last_command,
|
||||||
const GError *error,
|
const GError *error,
|
||||||
GVariant **result,
|
GVariant **result,
|
||||||
GError **result_error)
|
GError **result_error)
|
||||||
|
Reference in New Issue
Block a user