1 //
2 // Copyright (C) 2012 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_WIMAX_WIMAX_DEVICE_PROXY_INTERFACE_H_
18 #define SHILL_WIMAX_WIMAX_DEVICE_PROXY_INTERFACE_H_
19 
20 #include <string>
21 
22 #if defined(__ANDROID__)
23 #include <dbus/service_constants.h>
24 #else
25 #include <chromeos/dbus/service_constants.h>
26 #endif  // __ANDROID__
27 
28 #include "shill/callbacks.h"
29 
30 namespace shill {
31 
32 class Error;
33 class KeyValueStore;
34 
35 // These are the methods that a WiMaxManager.Device proxy must support. The
36 // interface is provided so that it can be mocked in tests.
37 class WiMaxDeviceProxyInterface {
38  public:
39   typedef base::Callback<void(const RpcIdentifiers&)> NetworksChangedCallback;
40   typedef base::Callback<void(
41       wimax_manager::DeviceStatus)> StatusChangedCallback;
42 
~WiMaxDeviceProxyInterface()43   virtual ~WiMaxDeviceProxyInterface() {}
44 
45   virtual void Enable(Error* error,
46                       const ResultCallback& callback,
47                       int timeout) = 0;
48   virtual void Disable(Error* error,
49                        const ResultCallback& callback,
50                        int timeout) = 0;
51   virtual void ScanNetworks(Error* error,
52                             const ResultCallback& callback,
53                             int timeout) = 0;
54   virtual void Connect(const RpcIdentifier& network,
55                        const KeyValueStore& parameters,
56                        Error* error,
57                        const ResultCallback& callback,
58                        int timeout) = 0;
59   virtual void Disconnect(Error* error,
60                           const ResultCallback& callback,
61                           int timeout) = 0;
62 
63   virtual void set_networks_changed_callback(
64       const NetworksChangedCallback& callback) = 0;
65   virtual void set_status_changed_callback(
66       const StatusChangedCallback& callback) = 0;
67 
68   // Properties.
69   virtual uint8_t Index(Error* error) = 0;
70   virtual std::string Name(Error* error) = 0;
71   virtual RpcIdentifiers Networks(Error* error) = 0;
72 };
73 
74 }  // namespace shill
75 
76 #endif  // SHILL_WIMAX_WIMAX_DEVICE_PROXY_INTERFACE_H_
77