blob: a68d3b75669e56a4e1b35c66848299a2d2230a2e [file] [log] [blame]
mukesh agrawalb54601c2011-06-07 17:39:22 -07001// Copyright (c) 2011 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_WIFI_SERVICE_
6#define SHILL_WIFI_SERVICE_
7
8#include <string>
9#include <vector>
10
Darin Petkov4a09b6b2011-07-19 12:52:06 -070011#include "shill/dbus_bindings/supplicant-interface.h"
Chris Masone2b105542011-06-22 10:58:09 -070012#include "shill/refptr_types.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070013#include "shill/service.h"
Chris Masone2b105542011-06-22 10:58:09 -070014#include "shill/shill_event.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070015
16namespace shill {
17
Chris Masone6791a432011-07-12 13:23:19 -070018class ControlInterface;
19class EventDispatcher;
20class Manager;
21
mukesh agrawalb54601c2011-06-07 17:39:22 -070022class WiFiService : public Service {
23 public:
24 WiFiService(ControlInterface *control_interface,
25 EventDispatcher *dispatcher,
Chris Masone6791a432011-07-12 13:23:19 -070026 Manager *manager,
Chris Masone2b105542011-06-22 10:58:09 -070027 const WiFiRefPtr &device,
mukesh agrawalb54601c2011-06-07 17:39:22 -070028 const std::vector<uint8_t> ssid,
Chris Masone092df3e2011-08-22 09:41:39 -070029 const std::string &mode,
mukesh agrawal6e277772011-09-29 15:04:23 -070030 const std::string &security);
mukesh agrawalb54601c2011-06-07 17:39:22 -070031 ~WiFiService();
Darin Petkov4d6d9412011-08-24 13:19:54 -070032
33 // Inherited from Service.
34 virtual void Connect(Error *error);
35 virtual void Disconnect();
Chris Masone34af2182011-08-22 11:59:36 -070036
Paul Stewart22aa71b2011-09-16 12:15:11 -070037 virtual bool TechnologyIs(const Technology::Identifier type) const;
38
Chris Masone34af2182011-08-22 11:59:36 -070039 // wifi_<MAC>_<BSSID>_<mode_string>_<security_string>
Chris Masone9d779932011-08-25 16:33:41 -070040 std::string GetStorageIdentifier();
Chris Masone34af2182011-08-22 11:59:36 -070041
Chris Masone092df3e2011-08-22 09:41:39 -070042 const std::string &mode() const;
mukesh agrawal445e72c2011-06-22 11:13:50 -070043 const std::string &key_management() const;
44 const std::vector<uint8_t> &ssid() const;
mukesh agrawalb54601c2011-06-07 17:39:22 -070045
46 private:
mukesh agrawalf2fd7452011-10-03 16:38:47 -070047 FRIEND_TEST(WiFiServiceTest, ConnectTaskRSN);
48 FRIEND_TEST(WiFiServiceTest, ConnectTaskWPA);
mukesh agrawal6e277772011-09-29 15:04:23 -070049
mukesh agrawaldc42bb32011-07-28 10:40:26 -070050 void ConnectTask();
mukesh agrawalb54601c2011-06-07 17:39:22 -070051
Chris Masone95207da2011-06-29 16:50:49 -070052 std::string GetDeviceRpcId();
53
Chris Masone3bd3c8c2011-06-13 08:20:26 -070054 // Properties
55 std::string passphrase_;
56 bool need_passphrase_;
57 std::string security_;
58 uint8 strength_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070059 // TODO(cmasone): see if the below can be pulled from the endpoint associated
60 // with this service instead.
Chris Masone092df3e2011-08-22 09:41:39 -070061 const std::string mode_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070062 std::string auth_mode_;
63 bool hidden_ssid_;
64 uint16 frequency_;
65 uint16 physical_mode_;
mukesh agrawal32399322011-09-01 10:53:43 -070066 std::string hex_ssid_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070067
mukesh agrawalb54601c2011-06-07 17:39:22 -070068 ScopedRunnableMethodFactory<WiFiService> task_factory_;
Chris Masone2b105542011-06-22 10:58:09 -070069 WiFiRefPtr wifi_;
mukesh agrawalb54601c2011-06-07 17:39:22 -070070 const std::vector<uint8_t> ssid_;
mukesh agrawalb54601c2011-06-07 17:39:22 -070071 DISALLOW_COPY_AND_ASSIGN(WiFiService);
72};
73
74} // namespace shill
75
76#endif // SHILL_WIFI_SERVICE_