1 // Copyright 2015 The Weave 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 LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_ 6 #define LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_ 7 8 #include <string> 9 10 #include <base/callback.h> 11 12 namespace weave { 13 namespace privet { 14 15 class CloudDelegate; 16 class WifiDelegate; 17 18 class WifiSsidGenerator final { 19 public: 20 WifiSsidGenerator(const CloudDelegate* gcd, const WifiDelegate* wifi); 21 ~WifiSsidGenerator() = default; 22 23 std::string GenerateFlags() const; 24 25 // Can return empty string if CloudDelegate is not ready. 26 std::string GenerateSsid() const; 27 28 private: 29 friend class WifiSsidGeneratorTest; 30 31 // Sets object to use |n| instead of random number for SSID generation. 32 void SetRandomForTests(int n); 33 std::string GenerateFlagsInternal() const; 34 35 const CloudDelegate* gcd_{nullptr}; 36 const WifiDelegate* wifi_{nullptr}; 37 38 base::Callback<int(void)> get_random_; 39 40 DISALLOW_COPY_AND_ASSIGN(WifiSsidGenerator); 41 }; 42 43 } // namespace privet 44 } // namespace weave 45 46 #endif // LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_ 47