blob: 59c3a158e6b2295970ccd90ad88cb475ca743d83 [file] [log] [blame]
Peter Qiu37328b82015-09-18 09:28:18 -07001//
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
Peter Qiu58083962015-11-05 14:29:50 -080017#ifndef APMANAGER_DBUS_SHILL_DBUS_PROXY_H_
18#define APMANAGER_DBUS_SHILL_DBUS_PROXY_H_
Peter Qiu37328b82015-09-18 09:28:18 -070019
20#include <string>
21
22#include <base/macros.h>
23#include <shill/dbus-proxies.h>
24
25#include "apmanager/shill_proxy_interface.h"
26
27namespace apmanager {
28
29class EventDispatcher;
30
31class ShillDBusProxy : public ShillProxyInterface {
32 public:
33 ShillDBusProxy(const scoped_refptr<dbus::Bus>& bus,
34 const base::Closure& service_appeared_callback,
35 const base::Closure& service_vanished_callback);
36 ~ShillDBusProxy() override;
37
38 // Implementation of ShillProxyInterface.
39 bool ClaimInterface(const std::string& interface_name) override;
40 bool ReleaseInterface(const std::string& interface_name) override;
Peter Qiuc7717b62015-10-22 15:21:27 -070041#if defined(__BRILLO__)
42 bool SetupApModeInterface(std::string* interface_name) override;
43 bool SetupStationModeInterface(std::string* interface_name) override;
44#endif // __BRILLO__
Peter Qiu37328b82015-09-18 09:28:18 -070045
46 private:
47 void OnServiceAvailable(bool service_available);
48 void OnServiceOwnerChanged(const std::string& old_owner,
49 const std::string& new_owner);
50
51 // DBus proxy for shill's manager interface.
52 std::unique_ptr<org::chromium::flimflam::ManagerProxy> manager_proxy_;
53 EventDispatcher* dispatcher_;
54 base::Closure service_appeared_callback_;
55 base::Closure service_vanished_callback_;
56 bool service_available_;
57
58 base::WeakPtrFactory<ShillDBusProxy> weak_factory_{this};
59 DISALLOW_COPY_AND_ASSIGN(ShillDBusProxy);
60};
61
62} // namespace apmanager
63
Peter Qiu58083962015-11-05 14:29:50 -080064#endif // APMANAGER_DBUS_SHILL_DBUS_PROXY_H_