core: add 'hotplugged' flag to indicate if modem is newly plugged in

This patch adds a 'hotplugged' flag to MMBaseModem to indicate if a
modem is newly plugged in. A plugin can use this information to
determine if, for example, the modem needs to be soft reset using the
ATZ command.

Dan Williams <dcbw@redhat.com> contributed the idea of implementation.
This commit is contained in:
Ben Chan
2013-01-17 23:11:09 -08:00
committed by Aleksander Morgado
parent 2550cb20a9
commit e75dba639f
6 changed files with 52 additions and 12 deletions

View File

@@ -67,6 +67,7 @@ struct _MMBaseModemPrivate {
guint vendor_id;
guint product_id;
gboolean hotplugged;
gboolean valid;
guint max_timeouts;
@@ -410,6 +411,23 @@ mm_base_modem_initialize (MMBaseModem *self,
user_data);
}
void
mm_base_modem_set_hotplugged (MMBaseModem *self,
gboolean hotplugged)
{
g_return_if_fail (MM_IS_BASE_MODEM (self));
self->priv->hotplugged = hotplugged;
}
gboolean
mm_base_modem_get_hotplugged (MMBaseModem *self)
{
g_return_val_if_fail (MM_IS_BASE_MODEM (self), FALSE);
return self->priv->hotplugged;
}
void
mm_base_modem_set_valid (MMBaseModem *self,
gboolean new_valid)