Move all providers into include/weave/provider
BUG: 24267885
Change-Id: I615611609dd26c73bc662e808c27820fe099218c
Reviewed-on: https://weave-review.googlesource.com/1171
Reviewed-by: Vitaly Buka <[email protected]>
diff --git a/libweave/include/weave/bluetooth.h b/libweave/include/weave/bluetooth.h
deleted file mode 100644
index 69fdc5e..0000000
--- a/libweave/include/weave/bluetooth.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 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_INCLUDE_WEAVE_BLUETOOTH_H_
-#define LIBWEAVE_INCLUDE_WEAVE_BLUETOOTH_H_
-
-namespace weave {
-
-class Bluetooth {
- public:
- // TODO(rginda): Add bluetooth interface methods here.
-
- protected:
- virtual ~Bluetooth() = default;
-};
-
-} // namespace weave
-
-#endif // LIBWEAVE_INCLUDE_WEAVE_BLUETOOTH_H_
diff --git a/libweave/include/weave/config_store.h b/libweave/include/weave/config_store.h
deleted file mode 100644
index 8a5af58..0000000
--- a/libweave/include/weave/config_store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 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_INCLUDE_WEAVE_CONFIG_STORE_H_
-#define LIBWEAVE_INCLUDE_WEAVE_CONFIG_STORE_H_
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include <base/callback.h>
-#include <base/time/time.h>
-#include <weave/enum_to_string.h>
-#include <weave/privet.h>
-
-namespace weave {
-
-struct Settings {
- std::string client_id;
- std::string client_secret;
- std::string api_key;
- std::string oauth_url;
- std::string service_url;
- std::string name;
- std::string description;
- std::string location;
- std::string local_anonymous_access_role;
- bool local_discovery_enabled{true};
- bool local_pairing_enabled{true};
- std::string firmware_version;
- std::string oem_name;
- std::string model_name;
- std::string model_id;
- base::TimeDelta polling_period;
- base::TimeDelta backup_polling_period;
-
- bool wifi_auto_setup_enabled{true};
- bool ble_setup_enabled{false};
- std::set<PairingType> pairing_modes;
- std::string embedded_code;
-
- std::string device_id;
- std::string refresh_token;
- std::string robot_account;
- std::string last_configured_ssid;
-};
-
-class ConfigStore {
- public:
- virtual bool LoadDefaults(Settings* settings) = 0;
- virtual std::string LoadSettings() = 0;
- virtual void SaveSettings(const std::string& settings) = 0;
- virtual void OnSettingsChanged(const Settings& settings) = 0;
-
- virtual std::string LoadBaseCommandDefs() = 0;
- virtual std::map<std::string, std::string> LoadCommandDefs() = 0;
-
- virtual std::string LoadBaseStateDefs() = 0;
- virtual std::string LoadBaseStateDefaults() = 0;
-
- virtual std::map<std::string, std::string> LoadStateDefs() = 0;
- virtual std::vector<std::string> LoadStateDefaults() = 0;
-
- protected:
- virtual ~ConfigStore() = default;
-};
-
-} // namespace weave
-
-#endif // LIBWEAVE_INCLUDE_WEAVE_CONFIG_STORE_H_
diff --git a/libweave/include/weave/device.h b/libweave/include/weave/device.h
index c6b70ea..6d1cd92 100644
--- a/libweave/include/weave/device.h
+++ b/libweave/include/weave/device.h
@@ -9,19 +9,19 @@
#include <set>
#include <string>
-#include <weave/bluetooth.h>
#include <weave/cloud.h>
#include <weave/commands.h>
-#include <weave/config_store.h>
-#include <weave/dns_service_discovery_provider.h>
#include <weave/export.h>
-#include <weave/http_client.h>
-#include <weave/http_server.h>
-#include <weave/network_provider.h>
#include <weave/privet.h>
+#include <weave/provider/bluetooth.h>
+#include <weave/provider/config_store.h>
+#include <weave/provider/dns_service_discovery.h>
+#include <weave/provider/http_client.h>
+#include <weave/provider/http_server.h>
+#include <weave/provider/network.h>
+#include <weave/provider/task_runner.h>
+#include <weave/provider/wifi.h>
#include <weave/state.h>
-#include <weave/task_runner.h>
-#include <weave/wifi_provider.h>
namespace weave {
@@ -38,14 +38,14 @@
virtual ~Device() = default;
virtual void Start(const Options& options,
- ConfigStore* config_store,
- TaskRunner* task_runner,
- HttpClient* http_client,
- NetworkProvider* network,
- DnsServiceDiscoveryProvider* dns_sd,
- HttpServer* http_server,
- WifiProvider* wifi,
- Bluetooth* bluetooth) = 0;
+ provider::ConfigStore* config_store,
+ provider::TaskRunner* task_runner,
+ provider::HttpClient* http_client,
+ provider::Network* network,
+ provider::DnsServiceDiscovery* dns_sd,
+ provider::HttpServer* http_server,
+ provider::Wifi* wifi,
+ provider::Bluetooth* bluetooth_provider) = 0;
virtual Commands* GetCommands() = 0;
virtual State* GetState() = 0;
diff --git a/libweave/include/weave/provider/bluetooth.h b/libweave/include/weave/provider/bluetooth.h
new file mode 100644
index 0000000..d87dcc0
--- /dev/null
+++ b/libweave/include/weave/provider/bluetooth.h
@@ -0,0 +1,23 @@
+// Copyright 2015 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_INCLUDE_WEAVE_PROVIDER_BLUETOOTH_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_BLUETOOTH_H_
+
+namespace weave {
+namespace provider {
+
+// Interface with methods to control bluetooth capability of the device.
+class Bluetooth {
+ public:
+ // TODO(rginda): Add bluetooth interface methods here.
+
+ protected:
+ virtual ~Bluetooth() = default;
+};
+
+} // namespace provider
+} // namespace weave
+
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_BLUETOOTH_H_
diff --git a/libweave/include/weave/provider/config_store.h b/libweave/include/weave/provider/config_store.h
new file mode 100644
index 0000000..85cae42
--- /dev/null
+++ b/libweave/include/weave/provider/config_store.h
@@ -0,0 +1,44 @@
+// Copyright 2015 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_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include <base/callback.h>
+#include <base/time/time.h>
+#include <weave/enum_to_string.h>
+#include <weave/settings.h>
+
+namespace weave {
+namespace provider {
+
+class ConfigStore {
+ public:
+ virtual bool LoadDefaults(Settings* settings) = 0;
+ virtual std::string LoadSettings() = 0;
+ virtual void SaveSettings(const std::string& settings) = 0;
+ virtual void OnSettingsChanged(const Settings& settings) = 0;
+
+ virtual std::string LoadBaseCommandDefs() = 0;
+ virtual std::map<std::string, std::string> LoadCommandDefs() = 0;
+
+ virtual std::string LoadBaseStateDefs() = 0;
+ virtual std::string LoadBaseStateDefaults() = 0;
+
+ virtual std::map<std::string, std::string> LoadStateDefs() = 0;
+ virtual std::vector<std::string> LoadStateDefaults() = 0;
+
+ protected:
+ virtual ~ConfigStore() = default;
+};
+
+} // namespace provider
+} // namespace weave
+
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
diff --git a/libweave/include/weave/dns_service_discovery_provider.h b/libweave/include/weave/provider/dns_service_discovery.h
similarity index 71%
rename from libweave/include/weave/dns_service_discovery_provider.h
rename to libweave/include/weave/provider/dns_service_discovery.h
index bdba69d..dfd94eb 100644
--- a/libweave/include/weave/dns_service_discovery_provider.h
+++ b/libweave/include/weave/provider/dns_service_discovery.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_DNS_SERVICE_DISCOVERY_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_DNS_SERVICE_DISCOVERY_PROVIDER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
#include <string>
#include <vector>
@@ -11,8 +11,9 @@
#include <base/callback.h>
namespace weave {
+namespace provider {
-class DnsServiceDiscoveryProvider {
+class DnsServiceDiscovery {
public:
// Publishes new service using DNS-SD or updates existing one.
virtual void PublishService(const std::string& service_type,
@@ -27,9 +28,10 @@
virtual std::string GetId() const = 0;
protected:
- virtual ~DnsServiceDiscoveryProvider() = default;
+ virtual ~DnsServiceDiscovery() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_DNS_SERVICE_DISCOVERY_PROVIDER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
diff --git a/libweave/include/weave/http_client.h b/libweave/include/weave/provider/http_client.h
similarity index 87%
rename from libweave/include/weave/http_client.h
rename to libweave/include/weave/provider/http_client.h
index 6112271..9671f0d 100644
--- a/libweave/include/weave/http_client.h
+++ b/libweave/include/weave/provider/http_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_HTTP_CLIENT_H_
-#define LIBWEAVE_INCLUDE_WEAVE_HTTP_CLIENT_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
#include <string>
#include <utility>
@@ -13,6 +13,7 @@
#include <weave/error.h>
namespace weave {
+namespace provider {
class HttpClient {
public:
@@ -49,6 +50,7 @@
virtual ~HttpClient() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_HTTP_CLIENT_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
diff --git a/libweave/include/weave/http_server.h b/libweave/include/weave/provider/http_server.h
similarity index 88%
rename from libweave/include/weave/http_server.h
rename to libweave/include/weave/provider/http_server.h
index 2716600..1d4ab1e 100644
--- a/libweave/include/weave/http_server.h
+++ b/libweave/include/weave/provider/http_server.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_HTTP_SERVER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_HTTP_SERVER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
#include <string>
#include <vector>
@@ -12,6 +12,7 @@
#include <weave/stream.h>
namespace weave {
+namespace provider {
class HttpServer {
public:
@@ -53,6 +54,7 @@
virtual ~HttpServer() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_HTTP_SERVER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
diff --git a/libweave/include/weave/network_provider.h b/libweave/include/weave/provider/network.h
similarity index 84%
rename from libweave/include/weave/network_provider.h
rename to libweave/include/weave/provider/network.h
index ac1dcc8..bba60f0 100644
--- a/libweave/include/weave/network_provider.h
+++ b/libweave/include/weave/provider/network.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_NETWORK_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_NETWORK_PROVIDER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_NETWORK_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_NETWORK_H_
#include <string>
@@ -12,6 +12,7 @@
#include <weave/stream.h>
namespace weave {
+namespace provider {
enum class NetworkState {
kOffline = 0,
@@ -22,7 +23,7 @@
// Interface with methods to detect network connectivity and opening network
// connections.
-class NetworkProvider {
+class Network {
public:
// Callback type for AddConnectionChangedCallback.
using ConnectionChangedCallback = base::Closure;
@@ -48,9 +49,10 @@
const ErrorCallback& error_callback) = 0;
protected:
- virtual ~NetworkProvider() = default;
+ virtual ~Network() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_NETWORK_PROVIDER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_NETWORK_H_
diff --git a/libweave/include/weave/task_runner.h b/libweave/include/weave/provider/task_runner.h
similarity index 80%
rename from libweave/include/weave/task_runner.h
rename to libweave/include/weave/provider/task_runner.h
index 43b81b7..daabc7e 100644
--- a/libweave/include/weave/task_runner.h
+++ b/libweave/include/weave/provider/task_runner.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TASK_RUNNER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TASK_RUNNER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_
#include <string>
#include <utility>
@@ -14,6 +14,7 @@
#include <base/time/time.h>
namespace weave {
+namespace provider {
// Interface with methods to post tasks into platform-specific message loop of
// the current thread.
@@ -30,6 +31,7 @@
virtual ~TaskRunner() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TASK_RUNNER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_
diff --git a/libweave/include/weave/test/mock_bluetooth.h b/libweave/include/weave/provider/test/mock_bluetooth.h
similarity index 73%
rename from libweave/include/weave/test/mock_bluetooth.h
rename to libweave/include/weave/provider/test/mock_bluetooth.h
index d02e314..d572fa4 100644
--- a/libweave/include/weave/test/mock_bluetooth.h
+++ b/libweave/include/weave/provider/test/mock_bluetooth.h
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_BLUETOOTH_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_BLUETOOTH_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_BLUETOOTH_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_BLUETOOTH_H_
-#include <weave/bluetooth.h>
+#include <weave/provider/bluetooth.h>
namespace weave {
+namespace provider {
namespace test {
class MockBluetooth : public Bluetooth {
@@ -27,6 +28,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_BLUETOOTH_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_BLUETOOTH_H_
diff --git a/libweave/include/weave/test/mock_config_store.h b/libweave/include/weave/provider/test/mock_config_store.h
similarity index 81%
rename from libweave/include/weave/test/mock_config_store.h
rename to libweave/include/weave/provider/test/mock_config_store.h
index 357db6e..7bc0db7 100644
--- a/libweave/include/weave/test/mock_config_store.h
+++ b/libweave/include/weave/provider/test/mock_config_store.h
@@ -2,17 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_CONFIG_STORE_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_CONFIG_STORE_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_CONFIG_STORE_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_CONFIG_STORE_H_
#include <map>
#include <string>
#include <vector>
#include <gmock/gmock.h>
-#include <weave/config_store.h>
+#include <weave/provider/config_store.h>
namespace weave {
+namespace provider {
namespace test {
class MockConfigStore : public ConfigStore {
@@ -42,6 +43,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_CONFIG_STORE_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_CONFIG_STORE_H_
diff --git a/libweave/include/weave/provider/test/mock_dns_service_discovery.h b/libweave/include/weave/provider/test/mock_dns_service_discovery.h
new file mode 100644
index 0000000..cfb070e
--- /dev/null
+++ b/libweave/include/weave/provider/test/mock_dns_service_discovery.h
@@ -0,0 +1,33 @@
+// Copyright 2015 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_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_DNS_SERVICE_DISCOVERY_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_DNS_SERVICE_DISCOVERY_H_
+
+#include <weave/provider/dns_service_discovery.h>
+
+#include <string>
+#include <vector>
+
+#include <gmock/gmock.h>
+
+namespace weave {
+namespace provider {
+namespace test {
+
+class MockDnsServiceDiscovery : public DnsServiceDiscovery {
+ public:
+ MOCK_METHOD3(PublishService,
+ void(const std::string&,
+ uint16_t,
+ const std::vector<std::string>&));
+ MOCK_METHOD1(StopPublishing, void(const std::string&));
+ MOCK_CONST_METHOD0(GetId, std::string());
+};
+
+} // namespace test
+} // namespace provider
+} // namespace weave
+
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_DNS_SERVICE_DISCOVERY_H_
diff --git a/libweave/include/weave/test/mock_http_client.h b/libweave/include/weave/provider/test/mock_http_client.h
similarity index 84%
rename from libweave/include/weave/test/mock_http_client.h
rename to libweave/include/weave/provider/test/mock_http_client.h
index f5c04ea..21af699 100644
--- a/libweave/include/weave/test/mock_http_client.h
+++ b/libweave/include/weave/provider/test/mock_http_client.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_CLIENT_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_CLIENT_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_CLIENT_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_CLIENT_H_
-#include <weave/http_client.h>
+#include <weave/provider/http_client.h>
#include <memory>
#include <string>
@@ -13,6 +13,7 @@
#include <gmock/gmock.h>
namespace weave {
+namespace provider {
namespace test {
class MockHttpClientResponse : public HttpClient::Response {
@@ -48,6 +49,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_CLIENT_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_CLIENT_H_
diff --git a/libweave/include/weave/test/mock_http_server.h b/libweave/include/weave/provider/test/mock_http_server.h
similarity index 71%
rename from libweave/include/weave/test/mock_http_server.h
rename to libweave/include/weave/provider/test/mock_http_server.h
index 9f8bbcc..3beb4ae 100644
--- a/libweave/include/weave/test/mock_http_server.h
+++ b/libweave/include/weave/provider/test/mock_http_server.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_SERVER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_SERVER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_SERVER_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_SERVER_H_
-#include <weave/http_server.h>
+#include <weave/provider/http_server.h>
#include <string>
#include <vector>
@@ -13,6 +13,7 @@
#include <base/callback.h>
namespace weave {
+namespace provider {
namespace test {
class MockHttpServer : public HttpServer {
@@ -27,6 +28,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_HTTP_SERVER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_HTTP_SERVER_H_
diff --git a/libweave/include/weave/test/mock_network_provider.h b/libweave/include/weave/provider/test/mock_network.h
similarity index 68%
rename from libweave/include/weave/test/mock_network_provider.h
rename to libweave/include/weave/provider/test/mock_network.h
index c519f74..3da43be 100644
--- a/libweave/include/weave/test/mock_network_provider.h
+++ b/libweave/include/weave/provider/test/mock_network.h
@@ -2,19 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_NETWORK_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_NETWORK_PROVIDER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_NETWORK_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_NETWORK_H_
-#include <weave/network_provider.h>
+#include <weave/provider/network.h>
#include <string>
#include <gmock/gmock.h>
namespace weave {
+namespace provider {
namespace test {
-class MockNetworkProvider : public NetworkProvider {
+class MockNetwork : public Network {
public:
MOCK_METHOD1(AddConnectionChangedCallback,
void(const ConnectionChangedCallback&));
@@ -27,6 +28,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_NETWORK_PROVIDER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_NETWORK_H_
diff --git a/libweave/include/weave/test/mock_task_runner.h b/libweave/include/weave/provider/test/mock_task_runner.h
similarity index 82%
rename from libweave/include/weave/test/mock_task_runner.h
rename to libweave/include/weave/provider/test/mock_task_runner.h
index 0aa3186..3c58614 100644
--- a/libweave/include/weave/test/mock_task_runner.h
+++ b/libweave/include/weave/provider/test/mock_task_runner.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_TASK_RUNNER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_TASK_RUNNER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_TASK_RUNNER_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_TASK_RUNNER_H_
-#include <weave/task_runner.h>
+#include <weave/provider/task_runner.h>
#include <algorithm>
#include <queue>
@@ -16,6 +16,7 @@
#include <gmock/gmock.h>
namespace weave {
+namespace provider {
namespace test {
class MockTaskRunner : public TaskRunner {
@@ -58,6 +59,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_TASK_RUNNER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_TASK_RUNNER_H_
diff --git a/libweave/include/weave/test/mock_wifi_provider.h b/libweave/include/weave/provider/test/mock_wifi.h
similarity index 66%
rename from libweave/include/weave/test/mock_wifi_provider.h
rename to libweave/include/weave/provider/test/mock_wifi.h
index 408e0ad..6c53d9a 100644
--- a/libweave/include/weave/test/mock_wifi_provider.h
+++ b/libweave/include/weave/provider/test/mock_wifi.h
@@ -2,19 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_WIFI_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_WIFI_H_
-#include <weave/network_provider.h>
+#include <weave/provider/network.h>
#include <string>
#include <gmock/gmock.h>
namespace weave {
+namespace provider {
namespace test {
-class MockWifiProvider : public WifiProvider {
+class MockWifi : public Wifi {
public:
MOCK_METHOD4(Connect,
void(const std::string&,
@@ -26,6 +27,7 @@
};
} // namespace test
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TEST_MOCK_WIFI_H_
diff --git a/libweave/include/weave/wifi_provider.h b/libweave/include/weave/provider/wifi.h
similarity index 78%
rename from libweave/include/weave/wifi_provider.h
rename to libweave/include/weave/provider/wifi.h
index 4173796..51f370c 100644
--- a/libweave/include/weave/wifi_provider.h
+++ b/libweave/include/weave/provider/wifi.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_WIFI_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_WIFI_H_
#include <string>
@@ -11,9 +11,10 @@
#include <weave/error.h>
namespace weave {
+namespace provider {
// Interface with methods to control WiFi capability of the device.
-class WifiProvider {
+class Wifi {
public:
// Connects to the given network with the given pass-phrase. Implementation
// should post either of callbacks.
@@ -29,9 +30,10 @@
virtual void StopAccessPoint() = 0;
protected:
- virtual ~WifiProvider() = default;
+ virtual ~Wifi() = default;
};
+} // namespace provider
} // namespace weave
-#endif // LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_
+#endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_WIFI_H_
diff --git a/libweave/include/weave/settings.h b/libweave/include/weave/settings.h
new file mode 100644
index 0000000..fa32b86
--- /dev/null
+++ b/libweave/include/weave/settings.h
@@ -0,0 +1,48 @@
+// Copyright 2015 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_INCLUDE_WEAVE_SETTINGS_H_
+#define LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_
+
+#include <set>
+#include <string>
+
+#include <base/time/time.h>
+#include <weave/privet.h>
+
+namespace weave {
+
+struct Settings {
+ std::string client_id;
+ std::string client_secret;
+ std::string api_key;
+ std::string oauth_url;
+ std::string service_url;
+ std::string name;
+ std::string description;
+ std::string location;
+ std::string local_anonymous_access_role;
+ bool local_discovery_enabled{true};
+ bool local_pairing_enabled{true};
+ std::string firmware_version;
+ std::string oem_name;
+ std::string model_name;
+ std::string model_id;
+ base::TimeDelta polling_period;
+ base::TimeDelta backup_polling_period;
+
+ bool wifi_auto_setup_enabled{true};
+ bool ble_setup_enabled{false};
+ std::set<PairingType> pairing_modes;
+ std::string embedded_code;
+
+ std::string device_id;
+ std::string refresh_token;
+ std::string robot_account;
+ std::string last_configured_ssid;
+};
+
+} // namespace weave
+
+#endif // LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_
diff --git a/libweave/include/weave/test/fake_stream.h b/libweave/include/weave/test/fake_stream.h
index 3c21571..8abb491 100644
--- a/libweave/include/weave/test/fake_stream.h
+++ b/libweave/include/weave/test/fake_stream.h
@@ -14,14 +14,16 @@
namespace weave {
+namespace provider {
class TaskRunner;
+}
namespace test {
class FakeStream : public Stream {
public:
- explicit FakeStream(TaskRunner* task_runner);
- FakeStream(TaskRunner* task_runner, const std::string& read_data);
+ explicit FakeStream(provider::TaskRunner* task_runner);
+ FakeStream(provider::TaskRunner* task_runner, const std::string& read_data);
void ExpectWritePacketString(base::TimeDelta, const std::string& data);
void AddReadPacketString(base::TimeDelta, const std::string& data);
@@ -37,7 +39,7 @@
const ErrorCallback& error_callback) override;
private:
- TaskRunner* task_runner_{nullptr};
+ provider::TaskRunner* task_runner_{nullptr};
std::string write_data_;
std::string read_data_;
};
diff --git a/libweave/include/weave/test/mock_dns_service_discovery_provider.h b/libweave/include/weave/test/mock_dns_service_discovery_provider.h
deleted file mode 100644
index 6d187f8..0000000
--- a/libweave/include/weave/test/mock_dns_service_discovery_provider.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 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_INCLUDE_WEAVE_TEST_MOCK_DNS_SERVICE_DISCOVERY_PROVIDER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_DNS_SERVICE_DISCOVERY_PROVIDER_H_
-
-#include <weave/dns_service_discovery_provider.h>
-
-#include <string>
-#include <vector>
-
-#include <gmock/gmock.h>
-
-namespace weave {
-namespace test {
-
-class MockDnsServiceDiscovery : public DnsServiceDiscoveryProvider {
- public:
- MOCK_METHOD3(PublishService,
- void(const std::string&,
- uint16_t,
- const std::vector<std::string>&));
- MOCK_METHOD1(StopPublishing, void(const std::string&));
- MOCK_CONST_METHOD0(GetId, std::string());
-};
-
-} // namespace test
-} // namespace weave
-
-#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_DNS_SERVICE_DISCOVERY_PROVIDER_H_