network_properties.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef COMPONENTS_WIFI_NETWORK_PROPERTIES_H_
  5. #define COMPONENTS_WIFI_NETWORK_PROPERTIES_H_
  6. #include <stdint.h>
  7. #include <list>
  8. #include <memory>
  9. #include <set>
  10. #include <string>
  11. #include "base/values.h"
  12. #include "components/wifi/wifi_export.h"
  13. namespace wifi {
  14. typedef int32_t Frequency;
  15. enum FrequencyEnum {
  16. kFrequencyAny = 0,
  17. kFrequencyUnknown = 0,
  18. kFrequency2400 = 2400,
  19. kFrequency5000 = 5000
  20. };
  21. typedef std::set<Frequency> FrequencySet;
  22. // Network Properties, can be used to parse the result of |GetProperties| and
  23. // |GetVisibleNetworks|.
  24. struct WIFI_EXPORT NetworkProperties {
  25. NetworkProperties();
  26. NetworkProperties(const NetworkProperties& other);
  27. ~NetworkProperties();
  28. std::string connection_state;
  29. std::string guid;
  30. std::string name;
  31. std::string ssid;
  32. std::string bssid;
  33. std::string type;
  34. std::string security;
  35. // |password| field is used to pass wifi password for network creation via
  36. // |CreateNetwork| or connection via |StartConnect|. It does not persist
  37. // once operation is completed.
  38. std::string password;
  39. // WiFi Signal Strength. 0..100
  40. uint32_t signal_strength;
  41. bool auto_connect;
  42. Frequency frequency;
  43. FrequencySet frequency_set;
  44. base::Value::Dict ToValue(bool network_list) const;
  45. // Updates only properties set in |value|.
  46. bool UpdateFromValue(const base::Value::Dict& value);
  47. static std::string MacAddressAsString(const uint8_t mac_as_int[6]);
  48. static bool OrderByType(const NetworkProperties& l,
  49. const NetworkProperties& r);
  50. };
  51. typedef std::list<NetworkProperties> NetworkList;
  52. } // namespace wifi
  53. #endif // COMPONENTS_WIFI_NETWORK_PROPERTIES_H_