blob: 3638c279a84f8207c0d824fc5420fa639fc7bfb4 [file] [log] [blame]
Darin Petkovdaf43862011-10-27 11:37:28 +02001// 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#ifndef SHILL_CELLULAR_CAPABILITY_
6#define SHILL_CELLULAR_CAPABILITY_
7
Darin Petkovb05315f2011-11-07 10:14:25 +01008#include <string>
9
Darin Petkovdaf43862011-10-27 11:37:28 +020010#include <base/basictypes.h>
11
Darin Petkovae0c64e2011-11-15 15:50:27 +010012#include "shill/dbus_properties.h"
13
Darin Petkovdaf43862011-10-27 11:37:28 +020014namespace shill {
15
16class Cellular;
Darin Petkovb05315f2011-11-07 10:14:25 +010017class Error;
18class EventDispatcher;
Darin Petkovdaf43862011-10-27 11:37:28 +020019class ProxyFactory;
20
21// Cellular devices instantiate subclasses of CellularCapability that handle the
22// specific modem technologies and capabilities.
23class CellularCapability {
24 public:
25 // |cellular| is the parent Cellular device.
26 CellularCapability(Cellular *cellular);
27 virtual ~CellularCapability();
28
29 Cellular *cellular() const { return cellular_; }
30 ProxyFactory *proxy_factory() const { return proxy_factory_; }
Darin Petkovb05315f2011-11-07 10:14:25 +010031 EventDispatcher *dispatcher() const;
Darin Petkovdaf43862011-10-27 11:37:28 +020032
Darin Petkov721ac932011-11-16 15:43:09 +010033 // Invoked on starting and stopping the cellular device.
34 virtual void OnStart() = 0;
35 virtual void OnStop() = 0;
Darin Petkovdaf43862011-10-27 11:37:28 +020036
Darin Petkovae0c64e2011-11-15 15:50:27 +010037 virtual void UpdateStatus(const DBusPropertiesMap &properties) = 0;
38
39 virtual void SetupConnectProperties(DBusPropertiesMap *properties) = 0;
40
Darin Petkova3d3be52011-11-14 21:34:16 +010041 // Activates the modem. Populates |error| on failure, leaves it unchanged
42 // otherwise. The default implementation fails by populating |error|.
43 virtual void Activate(const std::string &carrier, Error *error);
44
Darin Petkov184c54e2011-11-15 12:44:39 +010045 // Network registration.
46 virtual void Register();
47 virtual void RegisterOnNetwork(const std::string &network_id, Error *error);
48
Darin Petkovcb547732011-11-09 13:55:26 +010049 // Retrieves identifiers associated with the modem and the capability.
50 virtual void GetIdentifiers() = 0;
51
Darin Petkov184c54e2011-11-15 12:44:39 +010052 virtual void GetProperties() = 0;
53
Darin Petkov3e509242011-11-10 14:46:44 +010054 // Retrieves the current cellular signal strength.
55 virtual void GetSignalQuality() = 0;
56
Darin Petkov184c54e2011-11-15 12:44:39 +010057 virtual void GetRegistrationState() = 0;
58
Darin Petkovb05315f2011-11-07 10:14:25 +010059 // PIN management. The default implementation fails by populating |error|.
60 virtual void RequirePIN(const std::string &pin, bool require, Error *error);
61 virtual void EnterPIN(const std::string &pin, Error *error);
62 virtual void UnblockPIN(const std::string &unblock_code,
63 const std::string &pin,
64 Error *error);
65 virtual void ChangePIN(const std::string &old_pin,
66 const std::string &new_pin,
67 Error *error);
68
Darin Petkov1272a432011-11-10 15:53:37 +010069 // Network scanning. The default implementation fails by populating |error|.
70 virtual void Scan(Error *error);
71
Darin Petkov20c13ec2011-11-09 15:07:15 +010072 // Returns an empty string if the network technology is unknown.
73 virtual std::string GetNetworkTechnologyString() const = 0;
74
75 virtual std::string GetRoamingStateString() const = 0;
76
Darin Petkovae0c64e2011-11-15 15:50:27 +010077 virtual void OnModemManagerPropertiesChanged(
78 const DBusPropertiesMap &properties) = 0;
79
80 // Invoked by the parent Cellular device when a new service is created.
81 virtual void OnServiceCreated() = 0;
82
Darin Petkovdaf43862011-10-27 11:37:28 +020083 private:
Darin Petkov721ac932011-11-16 15:43:09 +010084 friend class CellularTest;
85
Darin Petkovdaf43862011-10-27 11:37:28 +020086 Cellular *cellular_;
87 ProxyFactory *proxy_factory_;
88
89 DISALLOW_COPY_AND_ASSIGN(CellularCapability);
90};
91
92} // namespace shill
93
94#endif // SHILL_CELLULAR_CAPABILITY_