mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Roll forward to cl/314747126
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: Ie19e006429b138b3768e97dae971a43fdc5ef8bf
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef CORE_V2_INTERNAL_SERVICE_CONTROLLER_H_
|
||||
#define CORE_V2_INTERNAL_SERVICE_CONTROLLER_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "core_v2/internal/client_proxy.h"
|
||||
#include "core_v2/listeners.h"
|
||||
#include "core_v2/options.h"
|
||||
#include "core_v2/params.h"
|
||||
#include "core_v2/payload.h"
|
||||
#include "core_v2/status.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
|
||||
// Interface defines the core functionality of Nearby Connections Service.
|
||||
//
|
||||
// In every method, ClientProxy* represents the client app which receives
|
||||
// notifications from Nearby Connections service and forwards them to the app.
|
||||
// ResultCallback arguments are not provided for this class, because all methods
|
||||
// are called synchronously.
|
||||
// The rest of arguments have the same meaning as the corresponding
|
||||
// methods in the definition of location::nearby::Core API.
|
||||
//
|
||||
// See details here:
|
||||
// cpp/core_v2/core.h
|
||||
class ServiceController {
|
||||
public:
|
||||
virtual ~ServiceController() = default;
|
||||
ServiceController() = default;
|
||||
ServiceController(const ServiceController&) = delete;
|
||||
ServiceController& operator=(const ServiceController&) = delete;
|
||||
|
||||
// Starts advertising an endpoint for a local app.
|
||||
virtual Status StartAdvertising(ClientProxy* client_proxy,
|
||||
const std::string& service_id,
|
||||
const ConnectionOptions& options,
|
||||
const ConnectionRequestInfo& info) = 0;
|
||||
virtual void StopAdvertising(ClientProxy* client_proxy) = 0;
|
||||
|
||||
virtual Status StartDiscovery(ClientProxy* client_proxy,
|
||||
const std::string& service_id,
|
||||
const ConnectionOptions& options,
|
||||
const DiscoveryListener& listener) = 0;
|
||||
virtual void StopDiscovery(ClientProxy* client_proxy) = 0;
|
||||
|
||||
virtual Status RequestConnection(ClientProxy* client_proxy,
|
||||
const std::string& endpoint_id,
|
||||
const ConnectionRequestInfo& info) = 0;
|
||||
virtual Status AcceptConnection(ClientProxy* client_proxy,
|
||||
const std::string& endpoint_id,
|
||||
const PayloadListener& listener) = 0;
|
||||
virtual Status RejectConnection(ClientProxy* client_proxy,
|
||||
const std::string& endpoint_id) = 0;
|
||||
|
||||
virtual void InitiateBandwidthUpgrade(ClientProxy* client_proxy,
|
||||
const std::string& endpoint_id) = 0;
|
||||
|
||||
virtual void SendPayload(ClientProxy* client_proxy,
|
||||
const std::vector<std::string>& endpoint_ids,
|
||||
Payload payload) = 0;
|
||||
|
||||
virtual Status CancelPayload(ClientProxy* client_proxy,
|
||||
std::int64_t payload_id) = 0;
|
||||
|
||||
virtual void DisconnectFromEndpoint(ClientProxy* client_proxy,
|
||||
const std::string& endpoint_id) = 0;
|
||||
};
|
||||
|
||||
} // namespace connections
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // CORE_V2_INTERNAL_SERVICE_CONTROLLER_H_
|
||||
Reference in New Issue
Block a user