blob: 6654ff70990a0baa259d5977d2ac66a4b26a7e8f [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"
Darin Petkov9c1dcef2012-02-07 15:58:26 +010012#include "shill/property_accessor.h"
Ben Chanfad4a0b2012-04-18 15:49:59 -070013#include "shill/scope_logger.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;
26const int CellularCapability::kTimeoutEnable = 15000;
27const int CellularCapability::kTimeoutRegister = 90000;
28const int CellularCapability::kTimeoutScan = 120000;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050029
30CellularCapability::CellularCapability(Cellular *cellular,
31 ProxyFactory *proxy_factory)
Jason Glasgow82f9ab32012-04-04 14:27:19 -040032 : cellular_(cellular),
Jason Glasgow7b461df2012-05-01 16:38:45 -040033 proxy_factory_(proxy_factory) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050034}
Darin Petkovdaf43862011-10-27 11:37:28 +020035
36CellularCapability::~CellularCapability() {}
37
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050038void CellularCapability::OnUnsupportedOperation(
39 const char *operation,
Eric Shienbrood9a245532012-03-07 14:20:39 -050040 Error *error) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050041 string message("The ");
42 message.append(operation).append(" operation is not supported.");
Eric Shienbrood9a245532012-03-07 14:20:39 -050043 Error::PopulateAndLog(error, Error::kNotSupported, message);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050044}
45
Darin Petkov184c54e2011-11-15 12:44:39 +010046void CellularCapability::RegisterOnNetwork(
Eric Shienbrood9a245532012-03-07 14:20:39 -050047 const string &/*network_id*/,
48 Error *error, const ResultCallback &/*callback*/) {
49 OnUnsupportedOperation(__func__, error);
Darin Petkov184c54e2011-11-15 12:44:39 +010050}
51
Eric Shienbrood9a245532012-03-07 14:20:39 -050052void CellularCapability::RequirePIN(const std::string &/*pin*/,
53 bool /*require*/,
54 Error *error,
55 const ResultCallback &/*callback*/) {
56 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010057}
58
Darin Petkove5bc2cb2011-12-07 14:47:32 +010059void CellularCapability::EnterPIN(const string &/*pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050060 Error *error,
61 const ResultCallback &/*callback*/) {
62 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010063}
64
65void CellularCapability::UnblockPIN(const string &/*unblock_code*/,
66 const string &/*pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050067 Error *error,
68 const ResultCallback &/*callback*/) {
69 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010070}
71
72void CellularCapability::ChangePIN(const string &/*old_pin*/,
73 const string &/*new_pin*/,
Eric Shienbrood9a245532012-03-07 14:20:39 -050074 Error *error,
75 const ResultCallback &/*callback*/) {
76 OnUnsupportedOperation(__func__, error);
Darin Petkovb05315f2011-11-07 10:14:25 +010077}
78
Eric Shienbrood9a245532012-03-07 14:20:39 -050079void CellularCapability::Scan(Error *error,
80 const ResultCallback &callback) {
81 OnUnsupportedOperation(__func__, error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050082}
83
Darin Petkovdaf43862011-10-27 11:37:28 +020084} // namespace shill