blob: 92d84c011dae2e6323ce5dd06c539d998ce87fdd [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
33 // Initialize RPC proxies.
34 virtual void InitProxies() = 0;
35
Darin Petkovae0c64e2011-11-15 15:50:27 +010036 virtual void UpdateStatus(const DBusPropertiesMap &properties) = 0;
37
38 virtual void SetupConnectProperties(DBusPropertiesMap *properties) = 0;
39
Darin Petkova3d3be52011-11-14 21:34:16 +010040 // Activates the modem. Populates |error| on failure, leaves it unchanged
41 // otherwise. The default implementation fails by populating |error|.
42 virtual void Activate(const std::string &carrier, Error *error);
43
Darin Petkov184c54e2011-11-15 12:44:39 +010044 // Network registration.
45 virtual void Register();
46 virtual void RegisterOnNetwork(const std::string &network_id, Error *error);
47
Darin Petkovcb547732011-11-09 13:55:26 +010048 // Retrieves identifiers associated with the modem and the capability.
49 virtual void GetIdentifiers() = 0;
50
Darin Petkov184c54e2011-11-15 12:44:39 +010051 virtual void GetProperties() = 0;
52
Darin Petkov3e509242011-11-10 14:46:44 +010053 // Retrieves the current cellular signal strength.
54 virtual void GetSignalQuality() = 0;
55
Darin Petkov184c54e2011-11-15 12:44:39 +010056 virtual void GetRegistrationState() = 0;
57
Darin Petkovb05315f2011-11-07 10:14:25 +010058 // PIN management. The default implementation fails by populating |error|.
59 virtual void RequirePIN(const std::string &pin, bool require, Error *error);
60 virtual void EnterPIN(const std::string &pin, Error *error);
61 virtual void UnblockPIN(const std::string &unblock_code,
62 const std::string &pin,
63 Error *error);
64 virtual void ChangePIN(const std::string &old_pin,
65 const std::string &new_pin,
66 Error *error);
67
Darin Petkov1272a432011-11-10 15:53:37 +010068 // Network scanning. The default implementation fails by populating |error|.
69 virtual void Scan(Error *error);
70
Darin Petkov20c13ec2011-11-09 15:07:15 +010071 // Returns an empty string if the network technology is unknown.
72 virtual std::string GetNetworkTechnologyString() const = 0;
73
74 virtual std::string GetRoamingStateString() const = 0;
75
Darin Petkovae0c64e2011-11-15 15:50:27 +010076 virtual void OnModemManagerPropertiesChanged(
77 const DBusPropertiesMap &properties) = 0;
78
79 // Invoked by the parent Cellular device when a new service is created.
80 virtual void OnServiceCreated() = 0;
81
Darin Petkovdaf43862011-10-27 11:37:28 +020082 private:
83 Cellular *cellular_;
84 ProxyFactory *proxy_factory_;
85
86 DISALLOW_COPY_AND_ASSIGN(CellularCapability);
87};
88
89} // namespace shill
90
91#endif // SHILL_CELLULAR_CAPABILITY_