blob: fbd3e298a522e3a93d65fba722413fa39ebe9684 [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 Petkov25665aa2012-05-21 14:08:12 +020015class KeyValueStore;
Darin Petkov9893d9c2012-05-17 15:27:31 -070016class WiMaxNetworkProxyInterface;
17
Ben Chan99c8a4d2012-05-01 08:11:53 -070018class WiMaxService : public Service {
19 public:
20 WiMaxService(ControlInterface *control,
21 EventDispatcher *dispatcher,
22 Metrics *metrics,
23 Manager *manager,
24 const WiMaxRefPtr &wimax);
25 virtual ~WiMaxService();
26
Ben Chan4e5c1312012-05-18 18:45:38 -070027 // Returns the parameters to be passed to WiMaxManager.Device.Connect() when
28 // connecting to the network associated with this service.
Darin Petkov25665aa2012-05-21 14:08:12 +020029 void GetConnectParameters(KeyValueStore *parameters) const;
Ben Chan4e5c1312012-05-18 18:45:38 -070030
Darin Petkov1e52a1b2012-05-21 10:35:56 +020031 // Returns the RPC object path for the WiMaxManager.Network object associated
32 // with this service. Must only be called after |proxy_| is set by Start().
33 RpcIdentifier GetNetworkObjectPath() const;
Ben Chan4e5c1312012-05-18 18:45:38 -070034
Darin Petkov9893d9c2012-05-17 15:27:31 -070035 // Returns true on success, false otherwise. Takes ownership of proxy,
36 // regardless of the result of the operation.
37 bool Start(WiMaxNetworkProxyInterface *proxy);
38
39 const std::string &network_name() const { return network_name_; }
40 uint32 network_identifier() const { return network_identifier_; }
41
Ben Chan99c8a4d2012-05-01 08:11:53 -070042 // Inherited from Service.
43 virtual bool TechnologyIs(const Technology::Identifier type) const;
44 virtual void Connect(Error *error);
45 virtual void Disconnect(Error *error);
Ben Chanc07362b2012-05-12 10:54:11 -070046 virtual std::string GetStorageIdentifier() const;
Ben Chan99c8a4d2012-05-01 08:11:53 -070047
48 private:
Darin Petkove4b27022012-05-16 13:28:50 +020049 FRIEND_TEST(WiMaxServiceTest, GetDeviceRpcId);
Darin Petkov1e52a1b2012-05-21 10:35:56 +020050 FRIEND_TEST(WiMaxServiceTest, OnSignalStrengthChanged);
Darin Petkove4b27022012-05-16 13:28:50 +020051
Ben Chanc07362b2012-05-12 10:54:11 -070052 virtual std::string GetDeviceRpcId(Error *error);
53
Darin Petkov1e52a1b2012-05-21 10:35:56 +020054 void OnSignalStrengthChanged(int strength);
55
Ben Chan99c8a4d2012-05-01 08:11:53 -070056 WiMaxRefPtr wimax_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070057 scoped_ptr<WiMaxNetworkProxyInterface> proxy_;
Darin Petkove4b27022012-05-16 13:28:50 +020058 std::string storage_id_;
Ben Chan99c8a4d2012-05-01 08:11:53 -070059
Darin Petkov9893d9c2012-05-17 15:27:31 -070060 uint32 network_identifier_;
61 std::string network_name_;
Ben Chan4e5c1312012-05-18 18:45:38 -070062 bool need_passphrase_;
Darin Petkov9893d9c2012-05-17 15:27:31 -070063
Ben Chan99c8a4d2012-05-01 08:11:53 -070064 DISALLOW_COPY_AND_ASSIGN(WiMaxService);
65};
66
67} // namespace shill
68
69#endif // SHILL_WIMAX_SERVICE_H_