fibocom: Implement power down/off

Also bump the timeout for the +CFUN operations as they may take up to
10s according to the AT command manual (e.g. MA510).

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
This commit is contained in:
Sven Schwermer
2022-10-17 09:35:30 +00:00
committed by Aleksander Morgado
parent e5bb33a463
commit 855977c4c7
+35 -5
View File
@@ -164,12 +164,12 @@ modem_create_bearer (MMIfaceModem *_self,
}
/*****************************************************************************/
/* Reset (Modem interface) */
/* Reset / Power (Modem interface) */
static gboolean
modem_reset_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error)
modem_common_power_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error)
{
return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
}
@@ -181,6 +181,32 @@ modem_reset (MMIfaceModem *self,
{
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CFUN=15",
15,
FALSE,
callback,
user_data);
}
static void
modem_power_down (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CFUN=4",
15,
FALSE,
callback,
user_data);
}
static void
modem_power_off (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CPWROFF",
3,
FALSE,
callback,
@@ -261,7 +287,11 @@ iface_modem_init (MMIfaceModem *iface)
iface->create_bearer = modem_create_bearer;
iface->create_bearer_finish = modem_create_bearer_finish;
iface->reset = modem_reset;
iface->reset_finish = modem_reset_finish;
iface->reset_finish = modem_common_power_finish;
iface->modem_power_down = modem_power_down;
iface->modem_power_down_finish = modem_common_power_finish;
iface->modem_power_off = modem_power_off;
iface->modem_power_off_finish = modem_common_power_finish;
}
static void