buffet: Extracted libweave into separate directory
It still has references to dbus, buffet and other ChromeOS specific
stuff.
BUG=brillo:1235
TEST=FEATURES=test emerge-gizmo buffet
Change-Id: Ib108960ee88afcf2ecdddf37ce30bd5f168c0034
Reviewed-on: https://chromium-review.googlesource.com/283509
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/libweave/src/privet/wifi_ssid_generator.h b/libweave/src/privet/wifi_ssid_generator.h
new file mode 100644
index 0000000..8e7ec63
--- /dev/null
+++ b/libweave/src/privet/wifi_ssid_generator.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_
+#define LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_
+
+#include <string>
+
+#include <base/callback.h>
+
+namespace privetd {
+
+class CloudDelegate;
+class WifiDelegate;
+
+class WifiSsidGenerator final {
+ public:
+ WifiSsidGenerator(const CloudDelegate* gcd, const WifiDelegate* wifi);
+ ~WifiSsidGenerator() = default;
+
+ std::string GenerateFlags() const;
+
+ // Can return empty string if CloudDelegate is not ready.
+ std::string GenerateSsid() const;
+
+ private:
+ friend class WifiSsidGeneratorTest;
+
+ // Sets object to use |n| instead of random number for SSID generation.
+ void SetRandomForTests(int n);
+
+ const CloudDelegate* gcd_{nullptr};
+ const WifiDelegate* wifi_{nullptr};
+
+ base::Callback<int(void)> get_random_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiSsidGenerator);
+};
+
+} // namespace privetd
+
+#endif // LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_