base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents are assumed heap allocated. The only real purpose of this type is to allow defining static constant MMBaseModemAtCommand variables without warnings when using -Wdiscarded-qualifiers.
This commit is contained in:
@@ -883,9 +883,9 @@ response_processor_no_result_stop_on_error (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_events_enable_sequence[] = {
|
||||
{ (gchar *) "%STATCM=1", 10, FALSE, response_processor_no_result_stop_on_error },
|
||||
{ (gchar *) "%NOTIFYEV=\"SIMREFRESH\",1", 10, FALSE, NULL },
|
||||
{ (gchar *) "%PCOINFO=1", 10, FALSE, NULL },
|
||||
{ "%STATCM=1", 10, FALSE, response_processor_no_result_stop_on_error },
|
||||
{ "%NOTIFYEV=\"SIMREFRESH\",1", 10, FALSE, NULL },
|
||||
{ "%PCOINFO=1", 10, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -955,9 +955,9 @@ modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
/* Disabling unsolicited events (3GPP interface) */
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_events_disable_sequence[] = {
|
||||
{ (gchar *) "%STATCM=0", 10, FALSE, NULL },
|
||||
{ (gchar *) "%NOTIFYEV=\"SIMREFRESH\",0", 10, FALSE, NULL },
|
||||
{ (gchar *) "%PCOINFO=0", 10, FALSE, NULL },
|
||||
{ "%STATCM=0", 10, FALSE, NULL },
|
||||
{ "%NOTIFYEV=\"SIMREFRESH\",0", 10, FALSE, NULL },
|
||||
{ "%PCOINFO=0", 10, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -2013,8 +2013,8 @@ own_enable_unsolicited_events_ready (MMBaseModem *self,
|
||||
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
||||
/* With ^PORTSEL we specify whether we want the PCUI port (0) or the
|
||||
* modem port (1) to receive the unsolicited messages */
|
||||
{ (gchar *) "^PORTSEL=0", 5, FALSE, NULL },
|
||||
{ (gchar *) "^CURC=1", 3, FALSE, NULL },
|
||||
{ "^PORTSEL=0", 5, FALSE, NULL },
|
||||
{ "^CURC=1", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -3363,7 +3363,7 @@ own_voice_enable_unsolicited_events_ready (MMBaseModem *self,
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_voice_enable_sequence[] = {
|
||||
/* With ^DDTMFCFG we active the DTMF Decoder */
|
||||
{ (gchar *) "^DDTMFCFG=0,1", 3, FALSE, NULL },
|
||||
{ "^DDTMFCFG=0,1", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -3436,7 +3436,7 @@ own_voice_disable_unsolicited_events_ready (MMBaseModem *self,
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_voice_disable_sequence[] = {
|
||||
/* With ^DDTMFCFG we deactivate the DTMF Decoder */
|
||||
{ (gchar *) "^DDTMFCFG=1,0", 3, FALSE, NULL },
|
||||
{ "^DDTMFCFG=1,0", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -4187,8 +4187,8 @@ modem_check_time_reply (MMBaseModem *_self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand time_cmd_sequence[] = {
|
||||
{ (gchar *) "^NTCT?", 3, FALSE, modem_check_time_reply }, /* 3GPP/LTE */
|
||||
{ (gchar *) "^TIME", 3, FALSE, modem_check_time_reply }, /* CDMA */
|
||||
{ "^NTCT?", 3, FALSE, modem_check_time_reply }, /* 3GPP/LTE */
|
||||
{ "^TIME", 3, FALSE, modem_check_time_reply }, /* CDMA */
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -1161,7 +1161,7 @@ parse_bands (const gchar *response, guint32 *out_len)
|
||||
/* Load supported bands (Modem interface) */
|
||||
|
||||
typedef struct {
|
||||
MMBaseModemAtCommand *cmds;
|
||||
MMBaseModemAtCommandAlloc *cmds;
|
||||
GSList *check_bands;
|
||||
GSList *enabled_bands;
|
||||
guint32 idx;
|
||||
@@ -1173,7 +1173,7 @@ supported_bands_context_free (SupportedBandsContext *ctx)
|
||||
guint i;
|
||||
|
||||
for (i = 0; ctx->cmds[i].command; i++)
|
||||
g_free (ctx->cmds[i].command);
|
||||
mm_base_modem_at_command_alloc_clear (&ctx->cmds[i]);
|
||||
g_free (ctx->cmds);
|
||||
g_slist_free_full (ctx->check_bands, (GDestroyNotify) band_free);
|
||||
g_slist_free_full (ctx->enabled_bands, (GDestroyNotify) band_free);
|
||||
@@ -1272,7 +1272,7 @@ load_supported_bands_get_current_bands_ready (MMIfaceModem *self,
|
||||
* to its current enabled/disabled state.
|
||||
*/
|
||||
iter = ctx->check_bands = parse_bands (response, &len);
|
||||
ctx->cmds = g_new0 (MMBaseModemAtCommand, len + 1);
|
||||
ctx->cmds = g_new0 (MMBaseModemAtCommandAlloc, len + 1);
|
||||
|
||||
while (iter) {
|
||||
Band *b = iter->data;
|
||||
@@ -1296,7 +1296,7 @@ load_supported_bands_get_current_bands_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
mm_base_modem_at_sequence (MM_BASE_MODEM (self),
|
||||
ctx->cmds,
|
||||
(const MMBaseModemAtCommand *)ctx->cmds,
|
||||
ctx,
|
||||
(GDestroyNotify) supported_bands_context_free,
|
||||
(GAsyncReadyCallback) load_supported_bands_ready,
|
||||
|
||||
@@ -406,9 +406,9 @@ enabling_init_sequence_ready (MMBaseModem *self,
|
||||
|
||||
static const MMBaseModemAtCommand enabling_modem_init_sequence[] = {
|
||||
/* Init command */
|
||||
{ (gchar *) "&F", 3, FALSE, NULL },
|
||||
{ "&F", 3, FALSE, NULL },
|
||||
/* Ensure disconnected */
|
||||
{ (gchar *) "*ENAP=0", 3, FALSE, NULL },
|
||||
{ "*ENAP=0", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -614,18 +614,18 @@ factory_reset_finish (MMIfaceModem *self,
|
||||
|
||||
static const MMBaseModemAtCommand factory_reset_sequence[] = {
|
||||
/* Init command */
|
||||
{ (gchar *) "&F +CMEE=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+COPS=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CR=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CRC=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CREG=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CMER=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "*EPEE=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CNMI=2, 0, 0, 0, 0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CGREG=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "*EIAD=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CGSMS=3", 3, FALSE, NULL },
|
||||
{ (gchar *) "+CSCA=\"\",129", 3, FALSE, NULL },
|
||||
{ "&F +CMEE=0", 3, FALSE, NULL },
|
||||
{ "+COPS=0", 3, FALSE, NULL },
|
||||
{ "+CR=0", 3, FALSE, NULL },
|
||||
{ "+CRC=0", 3, FALSE, NULL },
|
||||
{ "+CREG=0", 3, FALSE, NULL },
|
||||
{ "+CMER=0", 3, FALSE, NULL },
|
||||
{ "*EPEE=0", 3, FALSE, NULL },
|
||||
{ "+CNMI=2, 0, 0, 0, 0", 3, FALSE, NULL },
|
||||
{ "+CGREG=0", 3, FALSE, NULL },
|
||||
{ "*EIAD=0", 3, FALSE, NULL },
|
||||
{ "+CGSMS=3", 3, FALSE, NULL },
|
||||
{ "+CSCA=\"\",129", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -943,8 +943,8 @@ own_enable_unsolicited_events_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
||||
{ (gchar *) "*ERINFO=1", 5, FALSE, NULL },
|
||||
{ (gchar *) "*E2NAP=1", 5, FALSE, NULL },
|
||||
{ "*ERINFO=1", 5, FALSE, NULL },
|
||||
{ "*E2NAP=1", 5, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -1033,8 +1033,8 @@ own_disable_unsolicited_events_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_disable_sequence[] = {
|
||||
{ (gchar *) "*ERINFO=0", 5, FALSE, NULL },
|
||||
{ (gchar *) "*E2NAP=0", 5, FALSE, NULL },
|
||||
{ "*ERINFO=0", 5, FALSE, NULL },
|
||||
{ "*E2NAP=0", 5, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -724,13 +724,13 @@ modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
||||
/* enable signal URC */
|
||||
{ (gchar *) "+ECSQ=2", 5, FALSE, NULL },
|
||||
{ "+ECSQ=2", 5, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_disable_sequence[] = {
|
||||
/* disable signal URC */
|
||||
{ (gchar *) "+ECSQ=0" , 5, FALSE, NULL },
|
||||
{ "+ECSQ=0" , 5, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -246,8 +246,8 @@ response_processor_nwmdn_ignore_at_errors (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand own_numbers_commands[] = {
|
||||
{ (gchar *) "+CNUM", 3, TRUE, response_processor_cnum_ignore_at_errors },
|
||||
{ (gchar *) "$NWMDN", 3, TRUE, response_processor_nwmdn_ignore_at_errors },
|
||||
{ "+CNUM", 3, TRUE, response_processor_cnum_ignore_at_errors },
|
||||
{ "$NWMDN", 3, TRUE, response_processor_nwmdn_ignore_at_errors },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -975,10 +975,10 @@ own_enable_unsolicited_events_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
||||
{ (gchar *) "_OSSYS=1", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OCTI=1", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OUWCTI=1", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OSQI=1", 3, FALSE, NULL },
|
||||
{ "_OSSYS=1", 3, FALSE, NULL },
|
||||
{ "_OCTI=1", 3, FALSE, NULL },
|
||||
{ "_OUWCTI=1", 3, FALSE, NULL },
|
||||
{ "_OSQI=1", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -1030,10 +1030,10 @@ modem_3gpp_disable_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand unsolicited_disable_sequence[] = {
|
||||
{ (gchar *) "_OSSYS=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OCTI=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OUWCTI=0", 3, FALSE, NULL },
|
||||
{ (gchar *) "_OSQI=0", 3, FALSE, NULL },
|
||||
{ "_OSSYS=0", 3, FALSE, NULL },
|
||||
{ "_OCTI=0", 3, FALSE, NULL },
|
||||
{ "_OUWCTI=0", 3, FALSE, NULL },
|
||||
{ "_OSQI=0", 3, FALSE, NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -1805,8 +1805,8 @@ parse_time_reply (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand time_check_sequence[] = {
|
||||
{ (gchar *) "!TIME?", 3, FALSE, parse_time_reply }, /* 3GPP */
|
||||
{ (gchar *) "!SYSTIME?", 3, FALSE, parse_time_reply }, /* CDMA */
|
||||
{ "!TIME?", 3, FALSE, parse_time_reply }, /* 3GPP */
|
||||
{ "!SYSTIME?", 3, FALSE, parse_time_reply }, /* CDMA */
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -1184,8 +1184,8 @@ response_processor_service_ignore_at_errors (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static const MMBaseModemAtCommand access_tech_commands[] = {
|
||||
{ (gchar *) "#PSNT?", 3, FALSE, response_processor_psnt_ignore_at_errors },
|
||||
{ (gchar *) "+SERVICE?", 3, FALSE, response_processor_service_ignore_at_errors },
|
||||
{ "#PSNT?", 3, FALSE, response_processor_psnt_ignore_at_errors },
|
||||
{ "+SERVICE?", 3, FALSE, response_processor_service_ignore_at_errors },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user