gobi-cromo-plugin: Send property changed signal for Enabled property.
BUG=chromium-os:30714
TEST=Run network_3GModemControl on device
Change-Id: Ic83e888f19a4928ef57fc4ea1f523b5b6cb44d40
diff --git a/gobi_modem.cc b/gobi_modem.cc
index 0515cb5..afb630e 100644
--- a/gobi_modem.cc
+++ b/gobi_modem.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1158,7 +1158,7 @@
}
void GobiModem::ResetModem(DBus::Error& error) {
- Enabled = false;
+ SetEnabled(false);
SetMmState(MM_MODEM_STATE_DISABLED, MM_MODEM_STATE_CHANGED_REASON_UNKNOWN);
LOG(INFO) << "Offline";
@@ -1271,11 +1271,11 @@
else {
LOG(INFO) << "Initial power mode: " << power_mode;
if (power_mode == gobi::kOnline) {
- Enabled = true;
+ SetEnabled(true);
State = mm_state_ = MM_MODEM_STATE_ENABLED;
RegistrationStateHandler();
} else {
- Enabled = false;
+ SetEnabled(false);
State = mm_state_ = MM_MODEM_STATE_DISABLED;
}
}
@@ -1437,14 +1437,14 @@
} else {
LOG(INFO) << "PowerModeHandler: " << power_mode;
if (power_mode == gobi::kOnline) {
- Enabled = true;
+ SetEnabled(true);
SetMmState(MM_MODEM_STATE_ENABLED, MM_MODEM_STATE_CHANGED_REASON_UNKNOWN);
registration_time_.Start(); // Stopped in
// GobiCdmaModem::RegistrationStateHandler,
// if appropriate
} else {
ApiDisconnect();
- Enabled = false;
+ SetEnabled(false);
SetMmState(MM_MODEM_STATE_DISABLED,
MM_MODEM_STATE_CHANGED_REASON_UNKNOWN);
}
@@ -1741,3 +1741,13 @@
ExitAndResetDevice(0);
}
+
+void GobiModem::SetEnabled(bool enabled) {
+ Enabled = enabled;
+ LOG(INFO) << "MM sending Enabled property changed signal: " << enabled;
+ utilities::DBusPropertyMap props;
+ props["Enabled"].writer().append_bool(enabled);
+ MmPropertiesChanged(
+ org::freedesktop::ModemManager::Modem_adaptor::introspect()->name,
+ props);
+}
diff --git a/gobi_modem.h b/gobi_modem.h
index 4505730..5b11a61 100644
--- a/gobi_modem.h
+++ b/gobi_modem.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -477,6 +477,9 @@
void RequestEvent(const std::string req, DBus::Error& error);
bool event_enabled[GOBI_EVENT_MAX];
+ // Sets the Enabled property and emits a property changed signal.
+ void SetEnabled(bool enabled);
+
FRIEND_TEST(GobiModemTest, GetSignalStrengthDbmDisconnected);
FRIEND_TEST(GobiModemTest, GetSignalStrengthDbmConnected);