blob: aaf0119010b0b134e6d36dd977be37acd328097b [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_SERVICE_H_
6#define SHILL_WIMAX_SERVICE_H_
7
Darin Petkove4b27022012-05-16 13:28:50 +02008#include <gtest/gtest_prod.h> // for FRIEND_TEST
9
Ben Chan99c8a4d2012-05-01 08:11:53 -070010#include "shill/refptr_types.h"
11#include "shill/service.h"
12
13namespace shill {
14
Darin Petkov9893d9c2012-05-17 15:27:31 -070015class WiMaxNetworkProxyInterface;
16
Ben Chan99c8a4d2012-05-01 08:11:53 -070017class WiMaxService : public Service {
18 public:
19 WiMaxService(ControlInterface *control,
20 EventDispatcher *dispatcher,
21 Metrics *metrics,
22 Manager *manager,
23 const WiMaxRefPtr &wimax);
24 virtual ~WiMaxService();
25
Ben Chan4e5c1312012-05-18 18:45:38 -070026 // Returns the parameters to be passed to WiMaxManager.Device.Connect() when
27 // connecting to the network associated with this service.
28 void GetConnectParameters(DBusPropertiesMap *parameters) const;
29
Darin Petkov1e52a1b2012-05-21 10:35:56 +020030 // Returns the RPC object path for the WiMaxManager.Network object associated
31 // with this service. Must only be called after |proxy_| is set by Start().
32 RpcIdentifier GetNetworkObjectPath() const;
Ben Chan4e5c1312012-05-18 18:45:38 -070033
Darin Petkov9893d9c2012-05-17 15:27:31 -070034 // Returns true on success, false otherwise. Takes ownership of proxy,
35 // regardless of the result of the operation.
36 bool Start(WiMaxNetworkProxyInterface *proxy);
37
38 const std::string &network_name() const { return network_name_; }
39 uint32 network_identifier() const { return network_identifier_; }
40
Ben Chan99c8a4d2012-05-01 08:11:53 -070041 // Inherited from Service.
42 virtual bool TechnologyIs(const Technology::Identifier type) const;
43 virtual void Connect(Error *error);
44 virtual void Disconnect(Error *error);
Ben Chanc07362b2012-05-12 10:54:11 -070045 virtual std::string GetStorageIdentifier() const;
Ben Chan99c8a4d2012-05-01 08:11:53 -070046
47 private:
Darin Petkove4b27022012-05-16 13:28:50 +020048 FRIEND_TEST(WiMaxServiceTest, GetDeviceRpcId);
Darin Petkov1e52a1b2012-05-21 10:35:56 +020049 FRIEND_TEST(WiMaxServiceTest, OnSignalStrengthChanged);
Darin Petkove4b27022012-05-16 13:28:50 +020050
Ben Chanc07362b2012-05-12 10:54:11 -070051 virtual std::string GetDeviceRpcId(Error *error);
52
Darin Petkov1e52a1b2012-05-21 10:35:56 +020053 void OnSignalStrengthChanged(int strength);
54
Ben Chan99c8a4d2012-05-01 08:11:53 -070055 WiMaxRefPtr wimax_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070056 scoped_ptr<WiMaxNetworkProxyInterface> proxy_;
Darin Petkove4b27022012-05-16 13:28:50 +020057 std::string storage_id_;
Ben Chan99c8a4d2012-05-01 08:11:53 -070058
Darin Petkov9893d9c2012-05-17 15:27:31 -070059 uint32 network_identifier_;
60 std::string network_name_;
Ben Chan4e5c1312012-05-18 18:45:38 -070061 bool need_passphrase_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070062
Ben Chan99c8a4d2012-05-01 08:11:53 -070063 DISALLOW_COPY_AND_ASSIGN(WiMaxService);
64};
65
66} // namespace shill
67
68#endif // SHILL_WIMAX_SERVICE_H_