blob: fe301dccc9c5b3a17f59bc0df4b1e8644a950822 [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 agrawal51a7e932011-07-27 16:18:26 -070030 const std::string &key_management);
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
37 // wifi_<MAC>_<BSSID>_<mode_string>_<security_string>
38 std::string GetStorageIdentifier(const std::string &mac);
39
Chris Masone092df3e2011-08-22 09:41:39 -070040 const std::string &mode() const;
mukesh agrawal445e72c2011-06-22 11:13:50 -070041 const std::string &key_management() const;
42 const std::vector<uint8_t> &ssid() const;
mukesh agrawalb54601c2011-06-07 17:39:22 -070043
Chris Masone3bd3c8c2011-06-13 08:20:26 -070044 protected:
45 virtual std::string CalculateState() { return "idle"; }
46
mukesh agrawalb54601c2011-06-07 17:39:22 -070047 private:
Chris Masone34af2182011-08-22 11:59:36 -070048 static const char kServiceType[];
49
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_;
59 const std::string type_;
60 // TODO(cmasone): see if the below can be pulled from the endpoint associated
61 // with this service instead.
Chris Masone092df3e2011-08-22 09:41:39 -070062 const std::string mode_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070063 std::string auth_mode_;
64 bool hidden_ssid_;
65 uint16 frequency_;
66 uint16 physical_mode_;
67 uint16 hex_ssid_;
68
mukesh agrawalb54601c2011-06-07 17:39:22 -070069 ScopedRunnableMethodFactory<WiFiService> task_factory_;
Chris Masone2b105542011-06-22 10:58:09 -070070 WiFiRefPtr wifi_;
mukesh agrawalb54601c2011-06-07 17:39:22 -070071 const std::vector<uint8_t> ssid_;
mukesh agrawalb54601c2011-06-07 17:39:22 -070072 DISALLOW_COPY_AND_ASSIGN(WiFiService);
73};
74
75} // namespace shill
76
77#endif // SHILL_WIFI_SERVICE_