blob: 9479a45e88ecfd1d829209ce151dfc63572f01c5 [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 Petkovb72b62e2012-05-15 16:55:36 +02008#include <gtest/gtest_prod.h> // for FRIEND_TEST
9
Ben Chan99c8a4d2012-05-01 08:11:53 -070010#include "shill/device.h"
11
12namespace shill {
13
Darin Petkovb72b62e2012-05-15 16:55:36 +020014class ProxyFactory;
15class WiMaxDeviceProxyInterface;
16
Ben Chan99c8a4d2012-05-01 08:11:53 -070017class WiMax : public Device {
18 public:
19 WiMax(ControlInterface *control,
20 EventDispatcher *dispatcher,
21 Metrics *metrics,
22 Manager *manager,
23 const std::string &link_name,
Ben Chan4e64d2d2012-05-16 00:02:25 -070024 const std::string &address,
Darin Petkovb72b62e2012-05-15 16:55:36 +020025 int interface_index,
26 const RpcIdentifier &path);
Ben Chan99c8a4d2012-05-01 08:11:53 -070027
28 virtual ~WiMax();
29
Darin Petkov9893d9c2012-05-17 15:27:31 -070030 // Inherited from Device.
Ben Chan99c8a4d2012-05-01 08:11:53 -070031 virtual void Start(Error *error, const EnabledStateChangedCallback &callback);
32 virtual void Stop(Error *error, const EnabledStateChangedCallback &callback);
Ben Chan99c8a4d2012-05-01 08:11:53 -070033 virtual bool TechnologyIs(const Technology::Identifier type) const;
Darin Petkov9893d9c2012-05-17 15:27:31 -070034 virtual void Scan(Error *error);
Ben Chan99c8a4d2012-05-01 08:11:53 -070035
Darin Petkov9893d9c2012-05-17 15:27:31 -070036 virtual void ConnectTo(const WiMaxServiceRefPtr &service, Error *error);
37 virtual void DisconnectFrom(const WiMaxServiceRefPtr &service, Error *error);
Ben Chan99c8a4d2012-05-01 08:11:53 -070038
Darin Petkovb72b62e2012-05-15 16:55:36 +020039 const RpcIdentifier &path() const { return path_; }
Darin Petkov9893d9c2012-05-17 15:27:31 -070040 bool scanning() const { return scanning_; }
Darin Petkovb72b62e2012-05-15 16:55:36 +020041
Ben Chan99c8a4d2012-05-01 08:11:53 -070042 private:
Darin Petkovb72b62e2012-05-15 16:55:36 +020043 friend class WiMaxTest;
Darin Petkov9893d9c2012-05-17 15:27:31 -070044 FRIEND_TEST(WiMaxTest, CreateService);
45 FRIEND_TEST(WiMaxTest, DestroyDeadServices);
46 FRIEND_TEST(WiMaxTest, OnNetworksChanged);
Darin Petkovb72b62e2012-05-15 16:55:36 +020047 FRIEND_TEST(WiMaxTest, StartStop);
48
Darin Petkov912f0de2012-05-16 14:12:14 +020049 static const int kTimeoutDefault;
50
Darin Petkov9893d9c2012-05-17 15:27:31 -070051 void OnScanNetworksComplete(const Error &error);
Darin Petkov912f0de2012-05-16 14:12:14 +020052 void OnConnectComplete(const Error &error);
53 void OnDisconnectComplete(const Error &error);
54 void OnEnableComplete(const EnabledStateChangedCallback &callback,
55 const Error &error);
56 void OnDisableComplete(const EnabledStateChangedCallback &callback,
57 const Error &error);
58
Darin Petkov9893d9c2012-05-17 15:27:31 -070059 void OnNetworksChanged(const RpcIdentifiers &networks);
60
61 void CreateService(const RpcIdentifier &network);
62 void DestroyDeadServices(const RpcIdentifiers &live_networks);
63
Darin Petkovb72b62e2012-05-15 16:55:36 +020064 const RpcIdentifier path_;
65
66 scoped_ptr<WiMaxDeviceProxyInterface> proxy_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070067 bool scanning_;
68 std::map<RpcIdentifier, WiMaxServiceRefPtr> services_;
69 WiMaxServiceRefPtr pending_service_;
Darin Petkovb72b62e2012-05-15 16:55:36 +020070
71 ProxyFactory *proxy_factory_;
72
Ben Chan99c8a4d2012-05-01 08:11:53 -070073 DISALLOW_COPY_AND_ASSIGN(WiMax);
74};
75
76} // namespace shill
77
78#endif // SHILL_WIMAX_H_