blob: 7aab6b14f417ea956af72fb0369478d31fd98cc3 [file] [log] [blame]
Ben Chan99c8a4d2012-05-01 08:11:53 -07001// 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#ifndef SHILL_WIMAX_H_
6#define SHILL_WIMAX_H_
7
Darin Petkovc63dcf02012-05-24 11:51:43 +02008#include <set>
9
Darin Petkov8ea0eaf2012-05-29 11:21:33 +020010#include <chromeos/dbus/service_constants.h>
Darin Petkovb72b62e2012-05-15 16:55:36 +020011#include <gtest/gtest_prod.h> // for FRIEND_TEST
12
Ben Chan99c8a4d2012-05-01 08:11:53 -070013#include "shill/device.h"
14
15namespace shill {
16
Darin Petkovb72b62e2012-05-15 16:55:36 +020017class ProxyFactory;
18class WiMaxDeviceProxyInterface;
19
Ben Chan99c8a4d2012-05-01 08:11:53 -070020class WiMax : public Device {
21 public:
22 WiMax(ControlInterface *control,
23 EventDispatcher *dispatcher,
24 Metrics *metrics,
25 Manager *manager,
26 const std::string &link_name,
Ben Chan4e64d2d2012-05-16 00:02:25 -070027 const std::string &address,
Darin Petkovb72b62e2012-05-15 16:55:36 +020028 int interface_index,
29 const RpcIdentifier &path);
Ben Chan99c8a4d2012-05-01 08:11:53 -070030
31 virtual ~WiMax();
32
Darin Petkov9893d9c2012-05-17 15:27:31 -070033 // Inherited from Device.
Ben Chan99c8a4d2012-05-01 08:11:53 -070034 virtual void Start(Error *error, const EnabledStateChangedCallback &callback);
35 virtual void Stop(Error *error, const EnabledStateChangedCallback &callback);
Ben Chan99c8a4d2012-05-01 08:11:53 -070036 virtual bool TechnologyIs(const Technology::Identifier type) const;
Darin Petkov9893d9c2012-05-17 15:27:31 -070037 virtual void Scan(Error *error);
Ben Chan99c8a4d2012-05-01 08:11:53 -070038
Darin Petkov9893d9c2012-05-17 15:27:31 -070039 virtual void ConnectTo(const WiMaxServiceRefPtr &service, Error *error);
Darin Petkovc63dcf02012-05-24 11:51:43 +020040 virtual void DisconnectFrom(const ServiceRefPtr &service, Error *error);
Ben Chan99c8a4d2012-05-01 08:11:53 -070041
Darin Petkovc63dcf02012-05-24 11:51:43 +020042 // Signaled by |service| when stopped.
43 virtual void OnServiceStopped(const WiMaxServiceRefPtr &service);
Darin Petkovd1cd7972012-05-22 15:26:15 +020044
Darin Petkovb72b62e2012-05-15 16:55:36 +020045 const RpcIdentifier &path() const { return path_; }
Darin Petkov9893d9c2012-05-17 15:27:31 -070046 bool scanning() const { return scanning_; }
Darin Petkovc63dcf02012-05-24 11:51:43 +020047 const std::set<RpcIdentifier> &networks() const { return networks_; }
Darin Petkovb72b62e2012-05-15 16:55:36 +020048
Ben Chan99c8a4d2012-05-01 08:11:53 -070049 private:
Darin Petkovb72b62e2012-05-15 16:55:36 +020050 friend class WiMaxTest;
Darin Petkovc63dcf02012-05-24 11:51:43 +020051 FRIEND_TEST(WiMaxProviderTest, OnNetworksChanged);
Darin Petkov8ea0eaf2012-05-29 11:21:33 +020052 FRIEND_TEST(WiMaxTest, OnConnectComplete);
Darin Petkov9893d9c2012-05-17 15:27:31 -070053 FRIEND_TEST(WiMaxTest, OnNetworksChanged);
Darin Petkovc63dcf02012-05-24 11:51:43 +020054 FRIEND_TEST(WiMaxTest, OnServiceStopped);
Darin Petkovb72b62e2012-05-15 16:55:36 +020055 FRIEND_TEST(WiMaxTest, StartStop);
56
Darin Petkov912f0de2012-05-16 14:12:14 +020057 static const int kTimeoutDefault;
58
Darin Petkov9893d9c2012-05-17 15:27:31 -070059 void OnScanNetworksComplete(const Error &error);
Darin Petkov912f0de2012-05-16 14:12:14 +020060 void OnConnectComplete(const Error &error);
61 void OnDisconnectComplete(const Error &error);
62 void OnEnableComplete(const EnabledStateChangedCallback &callback,
63 const Error &error);
64 void OnDisableComplete(const EnabledStateChangedCallback &callback,
65 const Error &error);
66
Darin Petkov9893d9c2012-05-17 15:27:31 -070067 void OnNetworksChanged(const RpcIdentifiers &networks);
Darin Petkov8ea0eaf2012-05-29 11:21:33 +020068 void OnStatusChanged(wimax_manager::DeviceStatus status);
Darin Petkov9893d9c2012-05-17 15:27:31 -070069
Darin Petkovc63dcf02012-05-24 11:51:43 +020070 void DropConnection();
Darin Petkov9893d9c2012-05-17 15:27:31 -070071
Darin Petkovb72b62e2012-05-15 16:55:36 +020072 const RpcIdentifier path_;
73
74 scoped_ptr<WiMaxDeviceProxyInterface> proxy_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070075 bool scanning_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070076 WiMaxServiceRefPtr pending_service_;
Darin Petkovc63dcf02012-05-24 11:51:43 +020077 std::set<RpcIdentifier> networks_;
Darin Petkovb72b62e2012-05-15 16:55:36 +020078
79 ProxyFactory *proxy_factory_;
80
Ben Chan99c8a4d2012-05-01 08:11:53 -070081 DISALLOW_COPY_AND_ASSIGN(WiMax);
82};
83
84} // namespace shill
85
86#endif // SHILL_WIMAX_H_