Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/modem_cdma_proxy.h" |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | |
| 9 | using std::string; |
| 10 | |
| 11 | namespace shill { |
| 12 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 13 | ModemCDMAProxy::ModemCDMAProxy(ModemCDMAProxyListener *listener, |
| 14 | DBus::Connection *connection, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 15 | const string &path, |
| 16 | const string &service) |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 17 | : proxy_(listener, connection, path, service) {} |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 18 | |
| 19 | ModemCDMAProxy::~ModemCDMAProxy() {} |
| 20 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 21 | uint32 ModemCDMAProxy::Activate(const string &carrier) { |
| 22 | return proxy_.Activate(carrier); |
| 23 | } |
| 24 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 25 | void ModemCDMAProxy::GetRegistrationState(uint32 *cdma_1x_state, |
| 26 | uint32 *evdo_state) { |
| 27 | proxy_.GetRegistrationState(*cdma_1x_state, *evdo_state); |
| 28 | } |
| 29 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 30 | uint32 ModemCDMAProxy::GetSignalQuality() { |
| 31 | return proxy_.GetSignalQuality(); |
| 32 | } |
| 33 | |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 34 | const string ModemCDMAProxy::MEID() { |
| 35 | return proxy_.Meid(); |
| 36 | } |
| 37 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 38 | ModemCDMAProxy::Proxy::Proxy(ModemCDMAProxyListener *listener, |
| 39 | DBus::Connection *connection, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 40 | const string &path, |
| 41 | const string &service) |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 42 | : DBus::ObjectProxy(*connection, path, service.c_str()), |
| 43 | listener_(listener) {} |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 44 | |
| 45 | ModemCDMAProxy::Proxy::~Proxy() {} |
| 46 | |
| 47 | void ModemCDMAProxy::Proxy::ActivationStateChanged( |
| 48 | const uint32 &activation_state, |
| 49 | const uint32 &activation_error, |
| 50 | const DBusPropertiesMap &status_changes) { |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 51 | VLOG(2) << __func__ << "(" << activation_state << ", " << activation_error |
| 52 | << ")"; |
| 53 | listener_->OnCDMAActivationStateChanged( |
| 54 | activation_state, activation_error, status_changes); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | void ModemCDMAProxy::Proxy::SignalQuality(const uint32 &quality) { |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 58 | VLOG(2) << __func__ << "(" << quality << ")"; |
| 59 | listener_->OnCDMASignalQualityChanged(quality); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | void ModemCDMAProxy::Proxy::RegistrationStateChanged( |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 63 | const uint32 &cdma_1x_state, |
| 64 | const uint32 &evdo_state) { |
| 65 | VLOG(2) << __func__ << "(" << cdma_1x_state << ", " << evdo_state << ")"; |
| 66 | listener_->OnCDMARegistrationStateChanged(cdma_1x_state, evdo_state); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | } // namespace shill |