blob: 13e076d8a2a9156d26c46684c8c477eb03987bf9 [file] [log] [blame]
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkovdaf43862011-10-27 11:37:28 +02002// 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/cellular_capability.h"
6
Eric Shienbrood9a245532012-03-07 14:20:39 -05007#include <base/bind.h>
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05008#include <chromeos/dbus/service_constants.h>
9
Darin Petkovdaf43862011-10-27 11:37:28 +020010#include "shill/cellular.h"
Darin Petkovb05315f2011-11-07 10:14:25 +010011#include "shill/error.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070012#include "shill/logging.h"
Darin Petkov9c1dcef2012-02-07 15:58:26 +010013#include "shill/property_accessor.h"
Darin Petkovb05315f2011-11-07 10:14:25 +010014
Eric Shienbrood3e20a232012-02-16 11:35:56 -050015using base::Closure;
Darin Petkovb05315f2011-11-07 10:14:25 +010016using std::string;
Darin Petkovdaf43862011-10-27 11:37:28 +020017
18namespace shill {
19
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040020const char CellularCapability::kModemPropertyIMSI[] = "imsi";
21const char CellularCapability::kModemPropertyState[] = "State";
Eric Shienbrood9a245532012-03-07 14:20:39 -050022// All timeout values are in milliseconds
23const int CellularCapability::kTimeoutActivate = 120000;
24const int CellularCapability::kTimeoutConnect = 45000;
25const int CellularCapability::kTimeoutDefault = 5000;
Thieu Le049adb52012-11-12 17:14:51 -080026const int CellularCapability::kTimeoutDisconnect = 45000;
Eric Shienbrood9a245532012-03-07 14:20:39 -050027const int CellularCapability::kTimeoutEnable = 15000;
28const int CellularCapability::kTimeoutRegister = 90000;
29const int CellularCapability::kTimeoutScan = 120000;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050030
31CellularCapability::CellularCapability(Cellular *cellular,
32 ProxyFactory *proxy_factory)
Jason Glasgow82f9ab32012-04-04 14:27:19 -040033 : cellular_(cellular),
Jason Glasgow7b461df2012-05-01 16:38:45 -040034 proxy_factory_(proxy_factory) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050035}
Darin Petkovdaf43862011-10-27 11:37:28 +020036
37CellularCapability::~CellularCapability() {}
38
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050039void CellularCapability::OnUnsupportedOperation(
40 const char *operation,
Eric Shienbrood9a245532012-03-07 14:20:39 -050041 Error *error) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050042 string message("The ");
43 message.append(operation).append(" operation is not supported.");
Eric Shienbrood9a245532012-03-07 14:20:39 -050044 Error::PopulateAndLog(error, Error::kNotSupported, message);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050045}
46
Ben Chan15786032012-11-04 21:28:02 -080047bool CellularCapability::IsServiceActivationRequired() const {
48 return false;
49}
50
Darin Petkov184c54e2011-11-15 12:44:39 +010051void CellularCapability::RegisterOnNetwork(
Eric Shienbrood9a245532012-03-07 14:20:39 -050052 const string &/*network_id*/,
53 Error *error, const ResultCallback &/*callback*/) {
54 OnUnsupportedOperation(__func__, error);
Darin Petkov184c54e2011-11-15 12:44:39 +010055}
56
Eric Shienbrood9a245532012-03-07 14:20:39 -050057void CellularCapability::RequirePIN(const std::string &/*pin*/,
58 bool /*require*/,
59 Error *error,
60 const ResultCallback &/*callback*/) {
61 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010062}
63
Darin Petkove5bc2cb2011-12-07 14:47:32 +010064void CellularCapability::EnterPIN(const string &/*pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050065 Error *error,
66 const ResultCallback &/*callback*/) {
67 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010068}
69
70void CellularCapability::UnblockPIN(const string &/*unblock_code*/,
71 const string &/*pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050072 Error *error,
73 const ResultCallback &/*callback*/) {
74 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010075}
76
77void CellularCapability::ChangePIN(const string &/*old_pin*/,
78 const string &/*new_pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050079 Error *error,
80 const ResultCallback &/*callback*/) {
81 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010082}
83
Eric Shienbrood9a245532012-03-07 14:20:39 -050084void CellularCapability::Scan(Error *error,
85 const ResultCallback &callback) {
86 OnUnsupportedOperation(__func__, error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050087}
88
Darin Petkovc37a9c42012-09-06 15:28:22 +020089void CellularCapability::SetCarrier(const std::string &/*carrier*/,
90 Error *error,
91 const ResultCallback &/*callback*/) {
92 OnUnsupportedOperation(__func__, error);
93}
94
Darin Petkovdaf43862011-10-27 11:37:28 +020095} // namespace shill