blob: 2e5631ba45f8efb3e45efc837ccac968f07d2aeb [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
Arman Uguray0a3e2792013-01-17 16:31:50 -080023const int CellularCapability::kTimeoutActivate = 300000;
Eric Shienbrood9a245532012-03-07 14:20:39 -050024const int CellularCapability::kTimeoutConnect = 45000;
25const int CellularCapability::kTimeoutDefault = 5000;
Thieu Le049adb52012-11-12 17:14:51 -080026const int CellularCapability::kTimeoutDisconnect = 45000;
Thieu Leae41caf2012-11-28 11:25:50 -080027const int CellularCapability::kTimeoutEnable = 45000;
Eric Shienbrood9a245532012-03-07 14:20:39 -050028const int CellularCapability::kTimeoutRegister = 90000;
Ben Chan5d0d32c2013-01-08 02:05:29 -080029const int CellularCapability::kTimeoutReset = 90000;
Eric Shienbrood9a245532012-03-07 14:20:39 -050030const int CellularCapability::kTimeoutScan = 120000;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050031
32CellularCapability::CellularCapability(Cellular *cellular,
Thieu Lece4483e2013-01-23 15:12:03 -080033 ProxyFactory *proxy_factory,
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070034 ModemInfo *modem_info)
Jason Glasgow82f9ab32012-04-04 14:27:19 -040035 : cellular_(cellular),
Thieu Lece4483e2013-01-23 15:12:03 -080036 proxy_factory_(proxy_factory),
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070037 modem_info_(modem_info){
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050038}
Darin Petkovdaf43862011-10-27 11:37:28 +020039
40CellularCapability::~CellularCapability() {}
41
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050042void CellularCapability::OnUnsupportedOperation(
43 const char *operation,
Eric Shienbrood9a245532012-03-07 14:20:39 -050044 Error *error) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050045 string message("The ");
46 message.append(operation).append(" operation is not supported.");
Eric Shienbrood9a245532012-03-07 14:20:39 -050047 Error::PopulateAndLog(error, Error::kNotSupported, message);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050048}
49
Arman Ugurayc7b15602013-02-16 00:56:18 -080050void CellularCapability::CompleteActivation(Error *error) {
51 OnUnsupportedOperation(__func__, error);
52}
53
Ben Chan15786032012-11-04 21:28:02 -080054bool CellularCapability::IsServiceActivationRequired() const {
55 return false;
56}
57
Darin Petkov184c54e2011-11-15 12:44:39 +010058void CellularCapability::RegisterOnNetwork(
Eric Shienbrood9a245532012-03-07 14:20:39 -050059 const string &/*network_id*/,
60 Error *error, const ResultCallback &/*callback*/) {
61 OnUnsupportedOperation(__func__, error);
Darin Petkov184c54e2011-11-15 12:44:39 +010062}
63
Eric Shienbrood9a245532012-03-07 14:20:39 -050064void CellularCapability::RequirePIN(const std::string &/*pin*/,
65 bool /*require*/,
66 Error *error,
67 const ResultCallback &/*callback*/) {
68 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010069}
70
Darin Petkove5bc2cb2011-12-07 14:47:32 +010071void CellularCapability::EnterPIN(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::UnblockPIN(const string &/*unblock_code*/,
78 const string &/*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
84void CellularCapability::ChangePIN(const string &/*old_pin*/,
85 const string &/*new_pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050086 Error *error,
87 const ResultCallback &/*callback*/) {
88 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010089}
90
Eric Shienbrood9a245532012-03-07 14:20:39 -050091void CellularCapability::Scan(Error *error,
92 const ResultCallback &callback) {
93 OnUnsupportedOperation(__func__, error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050094}
95
Ben Chan5d0d32c2013-01-08 02:05:29 -080096void CellularCapability::Reset(Error *error,
97 const ResultCallback &/*callback*/) {
98 OnUnsupportedOperation(__func__, error);
99}
100
Darin Petkovc37a9c42012-09-06 15:28:22 +0200101void CellularCapability::SetCarrier(const std::string &/*carrier*/,
102 Error *error,
103 const ResultCallback &/*callback*/) {
104 OnUnsupportedOperation(__func__, error);
105}
106
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800107bool CellularCapability::IsActivating() const {
108 return false;
109}
110
Arman Ugurayf84a4242013-04-09 20:01:07 -0700111bool CellularCapability::ShouldDetectOutOfCredit() const {
Arman Ugurayd42d8ec2013-04-08 19:28:21 -0700112 return false;
113}
114
Darin Petkovdaf43862011-10-27 11:37:28 +0200115} // namespace shill