Files
nearby/cpp/core/params.h
T
Alexey Polyudov 204f76077d nearby: snapshot as of cl/296436629
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I2cf5bf225b76f4c1541954651f3a7544a14e0cec
2020-04-04 12:52:31 -07:00

149 lines
4.6 KiB
C++

#ifndef CORE_PARAMS_H_
#define CORE_PARAMS_H_
#include <cstdint>
#include <vector>
#include "core/listeners.h"
#include "core/options.h"
#include "platform/port/string.h"
#include "platform/ptr.h"
namespace location {
namespace nearby {
namespace connections {
struct StartAdvertisingParams {
Ptr<ResultListener> result_listener;
const std::string name;
const std::string service_id;
const AdvertisingOptions advertising_options;
Ptr<ConnectionLifecycleListener> connection_lifecycle_listener;
StartAdvertisingParams(
Ptr<ResultListener> result_listener, const std::string& name,
const std::string& service_id,
const AdvertisingOptions& advertising_options,
Ptr<ConnectionLifecycleListener> connection_lifecycle_listener)
: result_listener(result_listener),
name(name),
service_id(service_id),
advertising_options(advertising_options),
connection_lifecycle_listener(connection_lifecycle_listener) {}
};
struct StopAdvertisingParams {
// Intentionally left empty.
};
struct StartDiscoveryParams {
Ptr<ResultListener> result_listener;
const std::string service_id;
const DiscoveryOptions discovery_options;
Ptr<DiscoveryListener> discovery_listener;
StartDiscoveryParams(Ptr<ResultListener> result_listener,
const std::string& service_id,
const DiscoveryOptions& discovery_options,
Ptr<DiscoveryListener> discovery_listener)
: result_listener(result_listener),
service_id(service_id),
discovery_options(discovery_options),
discovery_listener(discovery_listener) {}
};
struct StopDiscoveryParams {
// Intentionally left empty.
};
struct RequestConnectionParams {
Ptr<ResultListener> result_listener;
const std::string name;
const std::string remote_endpoint_id;
Ptr<ConnectionLifecycleListener> connection_lifecycle_listener;
RequestConnectionParams(
Ptr<ResultListener> result_listener, const std::string& name,
const std::string& remote_endpoint_id,
Ptr<ConnectionLifecycleListener> connection_lifecycle_listener)
: result_listener(result_listener),
name(name),
remote_endpoint_id(remote_endpoint_id),
connection_lifecycle_listener(connection_lifecycle_listener) {}
};
struct AcceptConnectionParams {
Ptr<ResultListener> result_listener;
const std::string remote_endpoint_id;
Ptr<PayloadListener> payload_listener;
AcceptConnectionParams(Ptr<ResultListener> result_listener,
const std::string& remote_endpoint_id,
Ptr<PayloadListener> payload_listener)
: result_listener(result_listener),
remote_endpoint_id(remote_endpoint_id),
payload_listener(payload_listener) {}
};
struct RejectConnectionParams {
Ptr<ResultListener> result_listener;
const std::string remote_endpoint_id;
RejectConnectionParams(Ptr<ResultListener> result_listener,
const std::string& remote_endpoint_id)
: result_listener(result_listener),
remote_endpoint_id(remote_endpoint_id) {}
};
struct SendPayloadParams {
Ptr<ResultListener> result_listener;
const std::vector<std::string> remote_endpoint_ids;
ConstPtr<Payload> payload;
SendPayloadParams(Ptr<ResultListener> result_listener,
const std::vector<std::string>& remote_endpoint_ids,
ConstPtr<Payload> payload)
: result_listener(result_listener),
remote_endpoint_ids(remote_endpoint_ids),
payload(payload) {}
};
struct CancelPayloadParams {
Ptr<ResultListener> result_listener;
const std::int64_t payload_id;
CancelPayloadParams(Ptr<ResultListener> result_listener,
std::int64_t payload_id)
: result_listener(result_listener), payload_id(payload_id) {}
};
struct InitiateBandwidthUpgradeParams {
Ptr<ResultListener> result_listener;
const std::string remote_endpoint_id;
InitiateBandwidthUpgradeParams(Ptr<ResultListener> result_listener,
const std::string& remote_endpoint_id)
: result_listener(result_listener),
remote_endpoint_id(remote_endpoint_id) {}
};
struct DisconnectFromEndpointParams {
const std::string remote_endpoint_id;
explicit DisconnectFromEndpointParams(const std::string& remote_endpoint_id)
: remote_endpoint_id(remote_endpoint_id) {}
};
struct StopAllEndpointsParams {
Ptr<ResultListener> result_listener;
explicit StopAllEndpointsParams(Ptr<ResultListener> result_listener)
: result_listener(result_listener) {}
};
} // namespace connections
} // namespace nearby
} // namespace location
#endif // CORE_PARAMS_H_