mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Implement Disconnect from Endpoint feature
PiperOrigin-RevId: 421878981
This commit is contained in:
@@ -457,6 +457,18 @@ void AcceptConnectionDart(Core *pCore, const char *endpoint_id,
|
||||
AcceptConnection(pCore, endpoint_id, listener, callback);
|
||||
}
|
||||
|
||||
void DisconnectFromEndpointDart(Core *pCore, char *endpoint_id,
|
||||
Dart_Port result_cb) {
|
||||
if (!pCore) {
|
||||
PostResult(result_cb, Status::Value::kError);
|
||||
return;
|
||||
}
|
||||
|
||||
ResultCallback callback;
|
||||
SetResultCallback(callback, result_cb);
|
||||
DisconnectFromEndpoint(pCore, endpoint_id, callback);
|
||||
}
|
||||
|
||||
std::string GetPayloadPath(location::nearby::PayloadId payload_id) {
|
||||
PWSTR basePath;
|
||||
|
||||
|
||||
@@ -174,6 +174,17 @@ DLL_EXPORT void __stdcall RequestConnectionDart(
|
||||
DLL_EXPORT void __stdcall AcceptConnectionDart(
|
||||
Core *pCore, const char *endpoint_id, PayloadListenerDart listener_dart,
|
||||
Dart_Port result_cb);
|
||||
|
||||
// Disconnects from a remote endpoint. {@link Payload}s can no longer be sent
|
||||
// to or received from the endpoint after this method is called.
|
||||
// endpoint_id - The identifier for the remote endpoint to disconnect from.
|
||||
// result_cb - to access the status of the operation when available.
|
||||
// Possible status codes include:
|
||||
// Status::STATUS_OK - finished successfully.
|
||||
DLL_EXPORT void __stdcall DisconnectFromEndpointDart(Core *pCore,
|
||||
char *endpoint_id,
|
||||
Dart_Port result_cb);
|
||||
|
||||
// Sends a Payload to a remote endpoint. Payloads can only be sent to remote
|
||||
// endpoints once a notice of connection acceptance has been delivered via
|
||||
// ConnectionListener::onConnectionResult().
|
||||
|
||||
Reference in New Issue
Block a user