#ifndef CORE_INTERNAL_PCP_MANAGER_H_ #define CORE_INTERNAL_PCP_MANAGER_H_ #include #include "core/internal/bandwidth_upgrade_manager.h" #include "core/internal/client_proxy.h" #include "core/internal/endpoint_channel_manager.h" #include "core/internal/endpoint_manager.h" #include "core/internal/medium_manager.h" #include "core/internal/pcp_handler.h" #include "core/listeners.h" #include "core/options.h" #include "core/status.h" #include "core/strategy.h" #include "platform/port/string.h" #include "platform/ptr.h" namespace location { namespace nearby { namespace connections { // Manages all known PCPHandler implementations, delegating operations to the // appropriate one as per the parameters passed in. // //

This will only ever be used by the OfflineServiceController, which has all // of its entrypoints invoked serially, so there's no synchronization needed. template class PCPManager { public: PCPManager(Ptr > medium_manager, Ptr endpoint_channel_manager, Ptr > endpoint_manager, Ptr bandwidth_upgrade_manager); ~PCPManager(); Status::Value startAdvertising( Ptr > client_proxy, const string& endpoint_name, const string& service_id, const AdvertisingOptions& advertising_options, Ptr connection_lifecycle_listener); void stopAdvertising(Ptr > client_proxy); Status::Value startDiscovery(Ptr > client_proxy, const string& service_id, const DiscoveryOptions& discovery_options, Ptr discovery_listener); void stopDiscovery(Ptr > client_proxy); Status::Value requestConnection( Ptr > client_proxy, const string& endpoint_name, const string& endpoint_id, Ptr connection_lifecycle_listener); Status::Value acceptConnection(Ptr > client_proxy, const string& endpoint_id, Ptr payload_listener); Status::Value rejectConnection(Ptr > client_proxy, const string& endpoint_id); proto::connections::Medium getBandwidthUpgradeMedium(); private: bool setCurrentPCPHandler(const Strategy& strategy); PCP::Value deducePCP(const Strategy& strategy); Ptr > getPCPHandler(PCP::Value pcp); typedef std::map > > PCPHandlersMap; PCPHandlersMap pcp_handlers_; Ptr > current_pcp_handler_; }; } // namespace connections } // namespace nearby } // namespace location #include "core/internal/pcp_manager.cc" #endif // CORE_INTERNAL_PCP_MANAGER_H_