Implement Disconnect from Endpoint feature

PiperOrigin-RevId: 421878981
This commit is contained in:
hai007
2022-01-14 11:52:50 -08:00
committed by Copybara-Service
parent cf937ed90f
commit 40ac9b3b25
2 changed files with 23 additions and 0 deletions
+12
View File
@@ -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;
+11
View File
@@ -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().