1 //
2 // Copyright (C) 2015 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License") override;
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 PROXY_DBUS_SHILL_WIFI_CLIENT_H
18 #define PROXY_DBUS_SHILL_WIFI_CLIENT_H
19 
20 #include "proxy_dbus_client.h"
21 #include "proxy_shill_wifi_client.h"
22 
23 // This is the class implementing the ShillWifiClient abstract interface for a Dbus
24 // Client.
25 class ProxyDbusShillWifiClient : public ProxyShillWifiClient {
26  public:
27   ProxyDbusShillWifiClient(scoped_refptr<dbus::Bus> dbus_bus);
28   ~ProxyDbusShillWifiClient() override = default;
29   bool SetLogging() override;
30   bool RemoveAllWifiEntries() override;
31   bool ConfigureServiceByGuid(const std::string& guid,
32                               AutoConnectType autoconnect,
33                               const std::string& passphrase) override;
34   bool ConfigureWifiService(const std::string& ssid,
35                             const std::string& security,
36                             const brillo::VariantDictionary& security_params,
37                             bool save_credentials,
38                             StationType station_type,
39                             bool hidden_network,
40                             const std::string& guid,
41                             AutoConnectType autoconnect) override;
42   bool ConnectToWifiNetwork(const std::string& ssid,
43                             const std::string& security,
44                             const brillo::VariantDictionary& security_params,
45                             bool save_credentials,
46                             StationType station_type,
47                             bool hidden_network,
48                             const std::string& guid,
49                             AutoConnectType autoconnect,
50                             long discovery_timeout_milliseconds,
51                             long association_timeout_milliseconds,
52                             long configuration_timeout_milliseconds,
53                             long* discovery_time_milliseconds,
54                             long* association_time_milliseconds,
55                             long* configuration_time_milliseconds,
56                             std::string* failure_reason) override;
57   bool DisconnectFromWifiNetwork(const std::string& ssid,
58                                  long disconnect_timeout_milliseconds,
59                                  long* disconnect_time_milliseconds,
60                                  std::string* failure_reason) override;
61   bool ConfigureBgScan(const std::string& interface_name,
62                        const std::string& method_name,
63                        uint16_t short_interval,
64                        uint16_t long_interval,
65                        int signal_threshold) override;
66   bool GetActiveWifiSsids(std::vector<std::string>* ssids) override;
67   bool WaitForServiceStates(const std::string& ssid,
68                             const std::vector<std::string>& expected_states,
69                             long wait_timeout_milliseconds,
70                             std::string* final_state,
71                             long* wait_time_milliseconds) override;
72   bool CreateProfile(const std::string& profile_name) override;
73   bool PushProfile(const std::string& profile_name) override;
74   bool PopProfile(const std::string& profile_name) override;
75   bool RemoveProfile(const std::string& profile_name) override;
76   bool CleanProfiles() override;
77   bool DeleteEntriesForSsid(const std::string& ssid) override;
78   bool ListControlledWifiInterfaces(std::vector<std::string>* interface_names) override;
79   bool Disconnect(const std::string& ssid) override;
80   bool GetServiceOrder(std::string* service_order) override;
81   bool SetServiceOrder(const std::string& service_order) override;
82   bool GetServiceProperties(const std::string& ssid,
83                             brillo::VariantDictionary* properties) override;
84   bool SetSchedScan(bool enable) override;
85   bool GetPropertyOnDevice(const std::string& interface_name,
86                            const std::string& property_name,
87                            brillo::Any* property_value) override;
88   bool SetPropertyOnDevice(const std::string& interface_name,
89                            const std::string& property_name,
90                            const brillo::Any& property_value) override;
91   bool RequestRoam(const std::string& interface_name, const std::string& bssid) override;
92   bool SetDeviceEnabled(const std::string& interface_name, bool enable) override;
93   bool DiscoverTdlsLink(const std::string& interface_name,
94                         const std::string& peer_mac_address) override;
95   bool EstablishTdlsLink(const std::string& interface_name,
96                          const std::string& peer_mac_address) override;
97   bool QueryTdlsLink(const std::string& interface_name,
98                      const std::string& peer_mac_address,
99                      std::string* status) override;
100   bool AddWakePacketSource(const std::string& interface_name,
101                            const std::string& source_ip_address) override;
102   bool RemoveWakePacketSource(const std::string& interface_name,
103                               const std::string& source_ip_address) override;
104   bool RemoveAllWakePacketSources(const std::string& interface_name) override;
105 
106  private:
107   void SetAutoConnectInServiceParams(AutoConnectType autoconnect,
108                                      brillo::VariantDictionary* service_params);
109   bool PerformTdlsOperation(const std::string& interface_name,
110                             const std::string& operation,
111                             const std::string& peer_mac_address,
112                             std::string* out_params);
113   std::unique_ptr<ProxyDbusClient> dbus_client_;
114 };
115 
116 #endif // PROXY_DBUS_SHILL_WIFI_CLIENT_H
117