blob: 17bf60b5f1cdfa4fec19c8a1de4de2923d62b216 [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_ENDPOINT_
6#define SHILL_WIFI_ENDPOINT_
7
8#include <map>
9#include <string>
10#include <vector>
11
12#include <base/memory/ref_counted.h>
13#include <dbus-c++/dbus.h>
14
15#include "shill/endpoint.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070016#include "shill/shill_event.h"
17
18namespace shill {
19
20class WiFiEndpoint : public Endpoint {
21 public:
22 WiFiEndpoint(const std::map<std::string, ::DBus::Variant> &properties);
23 virtual ~WiFiEndpoint();
Chris Masone092df3e2011-08-22 09:41:39 -070024
25 // Maps mode strings from flimflam's nomenclature, as defined
26 // in chromeos/dbus/service_constants.h, to uints used by supplicant
27 static uint32_t ModeStringToUint(const std::string &mode_string);
28
mukesh agrawalb54601c2011-06-07 17:39:22 -070029 const std::vector<uint8_t> &ssid() const;
30 const std::string &ssid_string() const;
31 const std::string &ssid_hex() const;
32 const std::string &bssid_string() const;
33 const std::string &bssid_hex() const;
34 int16_t signal_strength() const;
Chris Masone092df3e2011-08-22 09:41:39 -070035 const std::string &network_mode() const;
mukesh agrawalb54601c2011-06-07 17:39:22 -070036
37 private:
38 static const uint32_t kSupplicantNetworkModeInfrastructureInt;
39 static const uint32_t kSupplicantNetworkModeAdHocInt;
40 static const uint32_t kSupplicantNetworkModeAccessPointInt;
41
42 static const char kSupplicantPropertySSID[];
43 static const char kSupplicantPropertyBSSID[];
44 static const char kSupplicantPropertySignal[];
45 static const char kSupplicantPropertyMode[];
46 static const char kSupplicantNetworkModeInfrastructure[];
47 static const char kSupplicantNetworkModeAdHoc[];
48 static const char kSupplicantNetworkModeAccessPoint[];
49
Chris Masone092df3e2011-08-22 09:41:39 -070050 // Maps mode strings from supplicant into flimflam's nomenclature, as defined
51 // in chromeos/dbus/service_constants.h
52 static const char *ParseMode(const std::string &mode_string);
mukesh agrawalb54601c2011-06-07 17:39:22 -070053
54 std::vector<uint8_t> ssid_;
55 std::vector<uint8_t> bssid_;
56 std::string ssid_string_;
57 std::string ssid_hex_;
58 std::string bssid_string_;
59 std::string bssid_hex_;
60 int16_t signal_strength_;
Chris Masone092df3e2011-08-22 09:41:39 -070061 std::string network_mode_;
mukesh agrawalb54601c2011-06-07 17:39:22 -070062
63 DISALLOW_COPY_AND_ASSIGN(WiFiEndpoint);
64};
65
66} // namespace shill
67
68#endif // SHILL_WIFI_ENDPOINT_