blob: b2495a021b9688945989a8e3f83b2e5aea205b3a [file] [log] [blame]
Darin Petkovb72b62e2012-05-15 16:55:36 +02001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/wimax_provider.h"
6
7#include <base/bind.h>
Ben Chanb879d142012-05-15 11:10:32 -07008#include <chromeos/dbus/service_constants.h>
Darin Petkovb72b62e2012-05-15 16:55:36 +02009
10#include "shill/dbus_properties_proxy_interface.h"
11#include "shill/error.h"
12#include "shill/proxy_factory.h"
13#include "shill/scope_logger.h"
14#include "shill/wimax_manager_proxy_interface.h"
15
16using base::Bind;
17using base::Unretained;
18using std::string;
19using std::vector;
20
21namespace shill {
22
Darin Petkovb72b62e2012-05-15 16:55:36 +020023WiMaxProvider::WiMaxProvider(ControlInterface *control,
24 EventDispatcher *dispatcher,
25 Metrics *metrics,
26 Manager *manager)
27 : control_(control),
28 dispatcher_(dispatcher),
29 metrics_(metrics),
30 manager_(manager),
31 proxy_factory_(ProxyFactory::GetInstance()) {}
32
33WiMaxProvider::~WiMaxProvider() {
34 Stop();
35}
36
37void WiMaxProvider::Start() {
38 SLOG(WiMax, 2) << __func__;
39 if (manager_proxy_.get()) {
40 return;
41 }
42 properties_proxy_.reset(
43 proxy_factory_->CreateDBusPropertiesProxy(
Ben Chanb879d142012-05-15 11:10:32 -070044 wimax_manager::kWiMaxManagerServicePath,
45 wimax_manager::kWiMaxManagerServiceName));
Darin Petkovb72b62e2012-05-15 16:55:36 +020046 properties_proxy_->set_properties_changed_callback(
47 Bind(&WiMaxProvider::OnPropertiesChanged, Unretained(this)));
48 manager_proxy_.reset(proxy_factory_->CreateWiMaxManagerProxy());
49 Error error;
50 UpdateDevices(manager_proxy_->Devices(&error));
51}
52
53void WiMaxProvider::Stop() {
54 SLOG(WiMax, 2) << __func__;
55 properties_proxy_.reset();
56 manager_proxy_.reset();
57}
58
59void WiMaxProvider::UpdateDevices(const vector<RpcIdentifier> &/*devices*/) {
60 SLOG(WiMax, 2) << __func__;
61 // TODO(petkov): Create/register and destroy/unregister WiMax devices as
62 // necessary.
63 NOTIMPLEMENTED();
64}
65
66void WiMaxProvider::OnPropertiesChanged(
67 const string &/*interface*/,
68 const DBusPropertiesMap &/*changed_properties*/,
69 const vector<string> &/*invalidated_properties*/) {
70 SLOG(WiMax, 2) << __func__;
71 // TODO(petkov): Parse the "Devices" property and invoke UpdateDevices.
72 NOTIMPLEMENTED();
73}
74
75} // namespace shill