// Copyright 2015 The Weave 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_PRIVET_MANAGER_H_ #define LIBWEAVE_SRC_PRIVET_PRIVET_MANAGER_H_ #include #include #include #include #include #include #include #include "src/privet/cloud_delegate.h" #include "src/privet/security_manager.h" #include "src/privet/wifi_bootstrap_manager.h" namespace libwebserv { class ProtocolHandler; class Request; class Response; class Server; } namespace weave { class ComponentManager; class DeviceRegistrationInfo; class DnsServiceDiscovery; class Network; namespace privet { class CloudDelegate; class DaemonState; class DeviceDelegate; class PrivetHandler; class Publisher; class SecurityManager; class Manager : public CloudDelegate::Observer { public: explicit Manager(provider::TaskRunner* task_runner); ~Manager() override; void Start(provider::Network* network, provider::DnsServiceDiscovery* dns_sd, provider::HttpServer* http_server, provider::Wifi* wifi, AuthManager* auth_manager, DeviceRegistrationInfo* device, ComponentManager* component_manager); std::string GetCurrentlyConnectedSsid() const; void AddOnPairingChangedCallbacks( const Device::PairingBeginCallback& begin_callback, const Device::PairingEndCallback& end_callback); private: // CloudDelegate::Observer void OnDeviceInfoChanged() override; void PrivetRequestHandler( std::unique_ptr request); void PrivetRequestHandlerWithData( const std::shared_ptr& request, const std::string& data); void PrivetResponseHandler( const std::shared_ptr& request, int status, const base::DictionaryValue& output); void OnChanged(); void OnConnectivityChanged(); provider::TaskRunner* task_runner_{nullptr}; std::unique_ptr cloud_; std::unique_ptr device_; std::unique_ptr security_; std::unique_ptr wifi_bootstrap_manager_; std::unique_ptr publisher_; std::unique_ptr privet_handler_; ScopedObserver cloud_observer_{this}; base::WeakPtrFactory weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(Manager); }; } // namespace privet } // namespace weave #endif // LIBWEAVE_SRC_PRIVET_PRIVET_MANAGER_H_