blob: 42df40106a8497858491277dc6b87f59f4457cfa [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_GSM_
6#define SHILL_CELLULAR_CAPABILITY_GSM_
7
Darin Petkovcb547732011-11-09 13:55:26 +01008#include <base/memory/scoped_ptr.h>
Darin Petkovb05315f2011-11-07 10:14:25 +01009#include <base/task.h>
Darin Petkov1272a432011-11-10 15:53:37 +010010#include <gtest/gtest_prod.h> // for FRIEND_TEST
Darin Petkovb05315f2011-11-07 10:14:25 +010011
Darin Petkov1272a432011-11-10 15:53:37 +010012#include "shill/accessor_interface.h"
Darin Petkovdaf43862011-10-27 11:37:28 +020013#include "shill/cellular_capability.h"
Darin Petkovcb547732011-11-09 13:55:26 +010014#include "shill/modem_gsm_card_proxy_interface.h"
Darin Petkov1272a432011-11-10 15:53:37 +010015#include "shill/modem_gsm_network_proxy_interface.h"
Darin Petkovdaf43862011-10-27 11:37:28 +020016
17namespace shill {
18
Darin Petkovcb547732011-11-09 13:55:26 +010019class CellularCapabilityGSM : public CellularCapability,
20 public ModemGSMCardProxyDelegate {
Darin Petkovdaf43862011-10-27 11:37:28 +020021 public:
22 CellularCapabilityGSM(Cellular *cellular);
23
Darin Petkovb05315f2011-11-07 10:14:25 +010024 // Inherited from CellularCapability.
Darin Petkovdaf43862011-10-27 11:37:28 +020025 virtual void InitProxies();
Darin Petkov3e509242011-11-10 14:46:44 +010026 virtual void GetSignalQuality();
Darin Petkovb05315f2011-11-07 10:14:25 +010027 virtual void RequirePIN(const std::string &pin, bool require, Error *error);
28 virtual void EnterPIN(const std::string &pin, Error *error);
29 virtual void UnblockPIN(const std::string &unblock_code,
30 const std::string &pin,
31 Error *error);
32 virtual void ChangePIN(const std::string &old_pin,
33 const std::string &new_pin,
34 Error *error);
Darin Petkov1272a432011-11-10 15:53:37 +010035 virtual void Scan(Error *error);
Darin Petkov20c13ec2011-11-09 15:07:15 +010036 virtual std::string GetNetworkTechnologyString() const;
37 virtual std::string GetRoamingStateString() const;
Darin Petkovdaf43862011-10-27 11:37:28 +020038
Darin Petkovcb547732011-11-09 13:55:26 +010039 // Obtains the IMEI, IMSI, SPN and MSISDN.
40 virtual void GetIdentifiers();
41
Darin Petkovdaf43862011-10-27 11:37:28 +020042 private:
Darin Petkovcb547732011-11-09 13:55:26 +010043 friend class CellularCapabilityGSMTest;
Darin Petkov1272a432011-11-10 15:53:37 +010044 FRIEND_TEST(CellularCapabilityGSMTest, ParseScanResult);
45 FRIEND_TEST(CellularCapabilityGSMTest, ParseScanResultProviderLookup);
46 FRIEND_TEST(CellularCapabilityGSMTest, Scan);
47
48 static const char kNetworkPropertyAccessTechnology[];
49 static const char kNetworkPropertyID[];
50 static const char kNetworkPropertyLongName[];
51 static const char kNetworkPropertyShortName[];
52 static const char kNetworkPropertyStatus[];
Darin Petkovcb547732011-11-09 13:55:26 +010053
Darin Petkovb05315f2011-11-07 10:14:25 +010054 void RequirePINTask(const std::string &pin, bool require);
55 void EnterPINTask(const std::string &pin);
56 void UnblockPINTask(const std::string &unblock_code, const std::string &pin);
57 void ChangePINTask(const std::string &old_pin, const std::string &new_pin);
Darin Petkov1272a432011-11-10 15:53:37 +010058 void ScanTask();
59
60 Stringmap ParseScanResult(
61 const ModemGSMNetworkProxyInterface::ScanResult &result);
Darin Petkovb05315f2011-11-07 10:14:25 +010062
Darin Petkovcb547732011-11-09 13:55:26 +010063 scoped_ptr<ModemGSMCardProxyInterface> card_proxy_;
64
Darin Petkovb05315f2011-11-07 10:14:25 +010065 ScopedRunnableMethodFactory<CellularCapabilityGSM> task_factory_;
66
Darin Petkov1272a432011-11-10 15:53:37 +010067 // Properties.
68 Stringmaps found_networks_;
69 bool scanning_;
70 uint16 scan_interval_;
71
Darin Petkovdaf43862011-10-27 11:37:28 +020072 DISALLOW_COPY_AND_ASSIGN(CellularCapabilityGSM);
73};
74
75} // namespace shill
76
77#endif // SHILL_CELLULAR_CAPABILITY_GSM_