wimax_service.h revision 8021e7f581b1d040fa8ff0a09ee9444bdb58bc86
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_SERVICE_H_
6#define SHILL_WIMAX_SERVICE_H_
7
8#include <gtest/gtest_prod.h>  // for FRIEND_TEST
9
10#include "shill/refptr_types.h"
11#include "shill/service.h"
12
13namespace shill {
14
15class KeyValueStore;
16class WiMaxNetworkProxyInterface;
17
18class 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
27  // Returns the parameters to be passed to WiMaxManager.Device.Connect() when
28  // connecting to the network associated with this service.
29  void GetConnectParameters(KeyValueStore *parameters) const;
30
31  // 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;
34
35  // 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
42  // Inherited from Service.
43  virtual bool TechnologyIs(const Technology::Identifier type) const;
44  virtual void Connect(Error *error);
45  virtual void Disconnect(Error *error);
46  virtual std::string GetStorageIdentifier() const;
47  virtual bool Is8021x() const;
48  virtual void set_eap(const EapCredentials &eap);
49
50 private:
51  FRIEND_TEST(WiMaxServiceTest, GetDeviceRpcId);
52  FRIEND_TEST(WiMaxServiceTest, OnSignalStrengthChanged);
53  FRIEND_TEST(WiMaxServiceTest, SetEAP);
54
55  virtual std::string GetDeviceRpcId(Error *error);
56
57  void OnSignalStrengthChanged(int strength);
58
59  void UpdateConnectable();
60
61  WiMaxRefPtr wimax_;
62  scoped_ptr<WiMaxNetworkProxyInterface> proxy_;
63  std::string storage_id_;
64
65  uint32 network_identifier_;
66  std::string network_name_;
67  bool need_passphrase_;
68
69  DISALLOW_COPY_AND_ASSIGN(WiMaxService);
70};
71
72}  // namespace shill
73
74#endif  // SHILL_WIMAX_SERVICE_H_
75