Create v3 ConnectionResponseInfo

PiperOrigin-RevId: 533518921
This commit is contained in:
Anay Wadhera
2023-05-19 12:14:15 -07:00
committed by Copybara-Service
parent f80a50f402
commit f727d00ad1
3 changed files with 20 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ cc_library(
hdrs = [
"bandwidth_info.h",
"connection_listening_options.h",
"connection_resolution.h",
"connection_result.h",
"connections_device.h",
"connections_device_provider.h",
"listeners.h",
@@ -12,8 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESOLUTION_H_
#define THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESOLUTION_H_
#ifndef THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESULT_H_
#define THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESULT_H_
#include <string>
#include "connections/status.h"
@@ -25,8 +27,18 @@ struct ConnectionResult {
nearby::connections::Status status;
};
// These fields should never be empty.
struct InitialConnectionInfo {
// 4-digit authentication code shown to user derived by UKEY2.
std::string authentication_digits;
// Raw 32-byte authentication token derived by UKEY2.
std::string raw_authentication_token;
// Specifies if the connection is incoming or outgoing.
bool is_incoming_connection = false;
};
} // namespace v3
} // namespace connections
} // namespace nearby
#endif // THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESOLUTION_H_
#endif // THIRD_PARTY_NEARBY_CONNECTIONS_V3_CONNECTION_RESULT_H_
+4 -3
View File
@@ -18,7 +18,7 @@
#include "absl/functional/any_invocable.h"
#include "connections/listeners.h"
#include "connections/v3/bandwidth_info.h"
#include "connections/v3/connection_resolution.h"
#include "connections/v3/connection_result.h"
#include "internal/interop/device.h"
namespace nearby {
@@ -44,8 +44,9 @@ struct ConnectionListener {
// remote_device - The identifier for the remote endpoint.
// info - Other relevant information about the connection.
absl::AnyInvocable<void(const NearbyDevice& remote_device,
const ConnectionResponseInfo& info)>
initiated_cb = [](const NearbyDevice&, const ConnectionResponseInfo&) {};
const v3::InitialConnectionInfo& info)>
initiated_cb =
[](const NearbyDevice&, const v3::InitialConnectionInfo&) {};
// Called when both sides have accepted or either side has rejected the
// connection. If the {@link ConnectionResolution}'s status is {@link