Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 1 | // 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 Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 8 | #include <set> |
| 9 | |
Darin Petkov | 8ea0eaf | 2012-05-29 11:21:33 +0200 | [diff] [blame] | 10 | #include <chromeos/dbus/service_constants.h> |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 11 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 12 | |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 13 | #include "shill/device.h" |
| 14 | |
| 15 | namespace shill { |
| 16 | |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 17 | class ProxyFactory; |
| 18 | class WiMaxDeviceProxyInterface; |
| 19 | |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 20 | class 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 Chan | 4e64d2d | 2012-05-16 00:02:25 -0700 | [diff] [blame] | 27 | const std::string &address, |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 28 | int interface_index, |
| 29 | const RpcIdentifier &path); |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 30 | |
| 31 | virtual ~WiMax(); |
| 32 | |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 33 | // Inherited from Device. |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 34 | virtual void Start(Error *error, const EnabledStateChangedCallback &callback); |
| 35 | virtual void Stop(Error *error, const EnabledStateChangedCallback &callback); |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 36 | virtual bool TechnologyIs(const Technology::Identifier type) const; |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 37 | virtual void Scan(Error *error); |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 38 | |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 39 | virtual void ConnectTo(const WiMaxServiceRefPtr &service, Error *error); |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 40 | virtual void DisconnectFrom(const ServiceRefPtr &service, Error *error); |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 41 | |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 42 | // Signaled by |service| when stopped. |
| 43 | virtual void OnServiceStopped(const WiMaxServiceRefPtr &service); |
Darin Petkov | d1cd797 | 2012-05-22 15:26:15 +0200 | [diff] [blame] | 44 | |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 45 | const RpcIdentifier &path() const { return path_; } |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 46 | bool scanning() const { return scanning_; } |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 47 | const std::set<RpcIdentifier> &networks() const { return networks_; } |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 48 | |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 49 | private: |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 50 | friend class WiMaxTest; |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 51 | FRIEND_TEST(WiMaxProviderTest, OnNetworksChanged); |
Darin Petkov | 8ea0eaf | 2012-05-29 11:21:33 +0200 | [diff] [blame] | 52 | FRIEND_TEST(WiMaxTest, OnConnectComplete); |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 53 | FRIEND_TEST(WiMaxTest, OnNetworksChanged); |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 54 | FRIEND_TEST(WiMaxTest, OnServiceStopped); |
Darin Petkov | a3f9f77 | 2012-05-31 12:11:28 +0200 | [diff] [blame^] | 55 | FRIEND_TEST(WiMaxTest, OnStatusChanged); |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 56 | FRIEND_TEST(WiMaxTest, StartStop); |
| 57 | |
Darin Petkov | 912f0de | 2012-05-16 14:12:14 +0200 | [diff] [blame] | 58 | static const int kTimeoutDefault; |
| 59 | |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 60 | void OnScanNetworksComplete(const Error &error); |
Darin Petkov | 912f0de | 2012-05-16 14:12:14 +0200 | [diff] [blame] | 61 | void OnConnectComplete(const Error &error); |
| 62 | void OnDisconnectComplete(const Error &error); |
| 63 | void OnEnableComplete(const EnabledStateChangedCallback &callback, |
| 64 | const Error &error); |
| 65 | void OnDisableComplete(const EnabledStateChangedCallback &callback, |
| 66 | const Error &error); |
| 67 | |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 68 | void OnNetworksChanged(const RpcIdentifiers &networks); |
Darin Petkov | 8ea0eaf | 2012-05-29 11:21:33 +0200 | [diff] [blame] | 69 | void OnStatusChanged(wimax_manager::DeviceStatus status); |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 70 | |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 71 | void DropConnection(); |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 72 | |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 73 | const RpcIdentifier path_; |
| 74 | |
| 75 | scoped_ptr<WiMaxDeviceProxyInterface> proxy_; |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 76 | bool scanning_; |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 77 | WiMaxServiceRefPtr pending_service_; |
Darin Petkov | c63dcf0 | 2012-05-24 11:51:43 +0200 | [diff] [blame] | 78 | std::set<RpcIdentifier> networks_; |
Darin Petkov | b72b62e | 2012-05-15 16:55:36 +0200 | [diff] [blame] | 79 | |
| 80 | ProxyFactory *proxy_factory_; |
| 81 | |
Ben Chan | 99c8a4d | 2012-05-01 08:11:53 -0700 | [diff] [blame] | 82 | DISALLOW_COPY_AND_ASSIGN(WiMax); |
| 83 | }; |
| 84 | |
| 85 | } // namespace shill |
| 86 | |
| 87 | #endif // SHILL_WIMAX_H_ |