blob: e3ab494efa9987dec9356e7e0c60a0a0348e6e73 [file] [log] [blame]
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkova1e0a1c2011-08-25 15:08:33 -07002// 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_MODEM_GSM_NETWORK_PROXY_INTERFACE_
6#define SHILL_MODEM_GSM_NETWORK_PROXY_INTERFACE_
7
Darin Petkovc0865312011-09-16 15:31:20 -07008#include <map>
Darin Petkova1e0a1c2011-08-25 15:08:33 -07009#include <string>
Darin Petkovc0865312011-09-16 15:31:20 -070010#include <vector>
Darin Petkova1e0a1c2011-08-25 15:08:33 -070011
12#include <base/basictypes.h>
Darin Petkov9bac6fe2011-08-26 12:49:05 -070013#include <dbus-c++/types.h>
Darin Petkova1e0a1c2011-08-25 15:08:33 -070014
15namespace shill {
16
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050017class AsyncCallHandler;
18class Error;
19
20typedef DBus::Struct<unsigned int, std::string, std::string>
21 GSMRegistrationInfo;
22typedef std::map<std::string, std::string> GSMScanResult;
23typedef std::vector<GSMScanResult> GSMScanResults;
24
Darin Petkova1e0a1c2011-08-25 15:08:33 -070025// These are the methods that a ModemManager.Modem.Gsm.Network proxy must
26// support. The interface is provided so that it can be mocked in tests.
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050027// All calls are made asynchronously. Call completion is signalled through
28// the corresponding 'OnXXXCallback' method in the ProxyDelegate interface.
Darin Petkova1e0a1c2011-08-25 15:08:33 -070029class ModemGSMNetworkProxyInterface {
30 public:
31 virtual ~ModemGSMNetworkProxyInterface() {}
32
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050033 virtual void GetRegistrationInfo(AsyncCallHandler *call_handler,
34 int timeout) = 0;
Darin Petkov22b72bf2011-08-29 14:01:20 -070035 virtual uint32 GetSignalQuality() = 0;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050036 virtual void Register(const std::string &network_id,
37 AsyncCallHandler *call_handler, int timeout) = 0;
38 virtual void Scan(AsyncCallHandler *call_handler, int timeout) = 0;
Darin Petkov9bac6fe2011-08-26 12:49:05 -070039
40 // Properties.
41 virtual uint32 AccessTechnology() = 0;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070042};
43
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050044// ModemManager.Modem.Gsm.Network method reply callback and signal
45// delegate to be associated with the proxy.
Darin Petkov580c7af2011-10-24 12:32:50 +020046class ModemGSMNetworkProxyDelegate {
Darin Petkova1e0a1c2011-08-25 15:08:33 -070047 public:
Darin Petkov580c7af2011-10-24 12:32:50 +020048 virtual ~ModemGSMNetworkProxyDelegate() {}
Darin Petkova1e0a1c2011-08-25 15:08:33 -070049
50 virtual void OnGSMNetworkModeChanged(uint32 mode) = 0;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050051 // The following callback handler is used for both the
52 // RegistrationInfo signal and the GetRegistrationInfo
53 // method reply. For the signal case, the |call_handler|
54 // is NULL.
Darin Petkova1e0a1c2011-08-25 15:08:33 -070055 virtual void OnGSMRegistrationInfoChanged(
56 uint32 status,
57 const std::string &operator_code,
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050058 const std::string &operator_name,
59 const Error &error,
60 AsyncCallHandler *call_handler) = 0;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070061 virtual void OnGSMSignalQualityChanged(uint32 quality) = 0;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050062 virtual void OnScanCallback(const GSMScanResults &results,
63 const Error &error,
64 AsyncCallHandler *call_handler) = 0;
65 virtual void OnRegisterCallback(const Error &error,
66 AsyncCallHandler *call_handler) = 0;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070067};
68
69} // namespace shill
70
71#endif // SHILL_MODEM_GSM_NETWORK_PROXY_INTERFACE_