• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium 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 COMPONENTS_WIFI_NETWORK_PROPERTIES_H_
6 #define COMPONENTS_WIFI_NETWORK_PROPERTIES_H_
7 
8 #include <list>
9 #include <set>
10 
11 #include "base/values.h"
12 #include "components/wifi/wifi_export.h"
13 
14 namespace wifi {
15 
16 typedef int32 Frequency;
17 
18 enum FrequencyEnum {
19   kFrequencyAny = 0,
20   kFrequencyUnknown = 0,
21   kFrequency2400 = 2400,
22   kFrequency5000 = 5000
23 };
24 
25 typedef std::set<Frequency> FrequencySet;
26 
27 // Network Properties, can be used to parse the result of |GetProperties| and
28 // |GetVisibleNetworks|.
29 struct WIFI_EXPORT NetworkProperties {
30   NetworkProperties();
31   ~NetworkProperties();
32 
33   std::string connection_state;
34   std::string guid;
35   std::string name;
36   std::string ssid;
37   std::string bssid;
38   std::string type;
39   std::string security;
40   // |password| field is used to pass wifi password for network creation via
41   // |CreateNetwork| or connection via |StartConnect|. It does not persist
42   // once operation is completed.
43   std::string password;
44   // WiFi Signal Strength. 0..100
45   uint32 signal_strength;
46   bool auto_connect;
47   Frequency frequency;
48   FrequencySet frequency_set;
49 
50   std::string json_extra;  // Extra JSON properties for unit tests
51 
52   scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const;
53   // Updates only properties set in |value|.
54   bool UpdateFromValue(const base::DictionaryValue& value);
55   static std::string MacAddressAsString(const uint8 mac_as_int[6]);
56   static bool OrderByType(const NetworkProperties& l,
57                           const NetworkProperties& r);
58 };
59 
60 typedef std::list<NetworkProperties> NetworkList;
61 
62 }  // namespace wifi
63 
64 #endif  // COMPONENTS_WIFI_NETWORK_PROPERTIES_H_
65