blob: 712e1bf788c8d61af811fc4b60c71ee3dc042f13 [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.
Darin Petkov5f316f62011-11-18 12:10:26 +010034 virtual void OnDeviceStarted() = 0;
35 virtual void OnDeviceStopped() = 0;
36
37 // Invoked by the parent Cellular device when a new service is created.
38 virtual void OnServiceCreated() = 0;
Darin Petkovdaf43862011-10-27 11:37:28 +020039
Darin Petkovae0c64e2011-11-15 15:50:27 +010040 virtual void UpdateStatus(const DBusPropertiesMap &properties) = 0;
41
42 virtual void SetupConnectProperties(DBusPropertiesMap *properties) = 0;
43
Darin Petkova3d3be52011-11-14 21:34:16 +010044 // Activates the modem. Populates |error| on failure, leaves it unchanged
45 // otherwise. The default implementation fails by populating |error|.
46 virtual void Activate(const std::string &carrier, Error *error);
47
Darin Petkov184c54e2011-11-15 12:44:39 +010048 // Network registration.
49 virtual void Register();
50 virtual void RegisterOnNetwork(const std::string &network_id, Error *error);
51
Darin Petkovcb547732011-11-09 13:55:26 +010052 // Retrieves identifiers associated with the modem and the capability.
53 virtual void GetIdentifiers() = 0;
54
Darin Petkov184c54e2011-11-15 12:44:39 +010055 virtual void GetProperties() = 0;
56
Darin Petkov3e509242011-11-10 14:46:44 +010057 // Retrieves the current cellular signal strength.
58 virtual void GetSignalQuality() = 0;
59
Darin Petkov184c54e2011-11-15 12:44:39 +010060 virtual void GetRegistrationState() = 0;
61
Darin Petkovb05315f2011-11-07 10:14:25 +010062 // PIN management. The default implementation fails by populating |error|.
63 virtual void RequirePIN(const std::string &pin, bool require, Error *error);
64 virtual void EnterPIN(const std::string &pin, Error *error);
65 virtual void UnblockPIN(const std::string &unblock_code,
66 const std::string &pin,
67 Error *error);
68 virtual void ChangePIN(const std::string &old_pin,
69 const std::string &new_pin,
70 Error *error);
71
Darin Petkov1272a432011-11-10 15:53:37 +010072 // Network scanning. The default implementation fails by populating |error|.
73 virtual void Scan(Error *error);
74
Darin Petkov20c13ec2011-11-09 15:07:15 +010075 // Returns an empty string if the network technology is unknown.
76 virtual std::string GetNetworkTechnologyString() const = 0;
77
78 virtual std::string GetRoamingStateString() const = 0;
79
Darin Petkovae0c64e2011-11-15 15:50:27 +010080 virtual void OnModemManagerPropertiesChanged(
81 const DBusPropertiesMap &properties) = 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_