blob: 33e96280e77aa85bb39356566e44360e56b883b9 [file] [log] [blame]
Vitaly Buka7ce499f2015-06-09 08:04:11 -07001// Copyright 2014 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 BUFFET_PRIVET_WIFI_SSID_GENERATOR_H_
6#define BUFFET_PRIVET_WIFI_SSID_GENERATOR_H_
7
8#include <string>
9
10#include <base/callback.h>
11
12namespace privetd {
13
14class CloudDelegate;
15class WifiDelegate;
16
17class WifiSsidGenerator final {
18 public:
19 WifiSsidGenerator(const CloudDelegate* gcd, const WifiDelegate* wifi);
20 ~WifiSsidGenerator() = default;
21
22 std::string GenerateFlags() const;
23
24 // Can return empty string if CloudDelegate is not ready.
25 std::string GenerateSsid() const;
26
27 private:
28 friend class WifiSsidGeneratorTest;
29
30 // Sets object to use |n| instead of random number for SSID generation.
31 void SetRandomForTests(int n);
32
33 const CloudDelegate* gcd_{nullptr};
34 const WifiDelegate* wifi_{nullptr};
35
36 base::Callback<int(void)> get_random_;
37
38 DISALLOW_COPY_AND_ASSIGN(WifiSsidGenerator);
39};
40
41} // namespace privetd
42
43#endif // BUFFET_PRIVET_WIFI_SSID_GENERATOR_H_