blob: d720fb53d2e8316d3d45033d2072f6e9dafb8f7f [file] [log] [blame]
Vitaly Buka4615e0d2015-10-14 15:35:12 -07001// Copyright 2015 The Weave Authors. All rights reserved.
Vitaly Buka7ce499f2015-06-09 08:04:11 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Vitaly Buka912b6982015-07-06 11:13:03 -07005#ifndef LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_
6#define LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_
Vitaly Buka7ce499f2015-06-09 08:04:11 -07007
8#include <string>
9
10#include <base/callback.h>
11
Vitaly Bukab6f015a2015-07-09 14:59:23 -070012namespace weave {
13namespace privet {
Vitaly Buka7ce499f2015-06-09 08:04:11 -070014
15class CloudDelegate;
16class WifiDelegate;
17
18class 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
34 const CloudDelegate* gcd_{nullptr};
35 const WifiDelegate* wifi_{nullptr};
36
37 base::Callback<int(void)> get_random_;
38
39 DISALLOW_COPY_AND_ASSIGN(WifiSsidGenerator);
40};
41
Vitaly Bukab6f015a2015-07-09 14:59:23 -070042} // namespace privet
43} // namespace weave
Vitaly Buka7ce499f2015-06-09 08:04:11 -070044
Vitaly Buka912b6982015-07-06 11:13:03 -070045#endif // LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_