• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2015 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_DBUS_CHROMEOS_SUPPLICANT_BSS_PROXY_H_
18 #define SHILL_DBUS_CHROMEOS_SUPPLICANT_BSS_PROXY_H_
19 
20 #include <string>
21 
22 #include <base/macros.h>
23 
24 #include "shill/refptr_types.h"
25 #include "shill/supplicant/supplicant_bss_proxy_interface.h"
26 #include "supplicant/dbus-proxies.h"
27 
28 namespace shill {
29 
30 class WiFiEndpoint;
31 
32 class ChromeosSupplicantBSSProxy
33     : public SupplicantBSSProxyInterface {
34  public:
35   ChromeosSupplicantBSSProxy(const scoped_refptr<dbus::Bus>& bus,
36                              const std::string& object_path,
37                              WiFiEndpoint* wifi_endpoint);
38   ~ChromeosSupplicantBSSProxy() override;
39 
40  private:
41   // Signal handlers.
42   void PropertiesChanged(const brillo::VariantDictionary& properties);
43 
44   // Called when signal is connected to the ObjectProxy.
45   void OnSignalConnected(const std::string& interface_name,
46                          const std::string& signal_name,
47                          bool success);
48 
49   std::unique_ptr<fi::w1::wpa_supplicant1::BSSProxy> bss_proxy_;
50   // We use a bare pointer, because each ChromeosSupplcantBSSProxy is
51   // owned (using a unique_ptr) by a WiFiEndpoint. This means that if
52   // |wifi_endpoint_| is invalid, then so is |this|.
53   WiFiEndpoint* wifi_endpoint_;
54 
55   base::WeakPtrFactory<ChromeosSupplicantBSSProxy> weak_factory_{this};
56   DISALLOW_COPY_AND_ASSIGN(ChromeosSupplicantBSSProxy);
57 };
58 
59 }  // namespace shill
60 
61 #endif  // SHILL_DBUS_CHROMEOS_SUPPLICANT_BSS_PROXY_H_
62