diff --git a/connections/c/nc.cc b/connections/c/nc.cc index 128eeb29..df1b8d40 100644 --- a/connections/c/nc.cc +++ b/connections/c/nc.cc @@ -527,7 +527,7 @@ void NcInjectEndpoint(NC_INSTANCE instance, const NC_DATA* service_id, } ::nearby::connections::OutOfBandConnectionMetadata - cpp_out_of_band_connection_metadata; + cpp_out_of_band_connection_metadata{}; cpp_out_of_band_connection_metadata.endpoint_id = metadata->endpoint_id; cpp_out_of_band_connection_metadata.endpoint_info = { metadata->endpoint_info.data, @@ -537,6 +537,10 @@ void NcInjectEndpoint(NC_INSTANCE instance, const NC_DATA* service_id, cpp_out_of_band_connection_metadata.remote_bluetooth_mac_address = { metadata->remote_bluetooth_mac_address.data, static_cast(metadata->remote_bluetooth_mac_address.size)}; + cpp_out_of_band_connection_metadata.ble_peripheral_native_id = { + metadata->ble_peripheral_native_id.data, + static_cast(metadata->ble_peripheral_native_id.size)}; + cpp_out_of_band_connection_metadata.psm = metadata->psm; nc_context->core->InjectEndpoint( std::string(service_id->data, service_id->size), diff --git a/connections/c/nc_types.h b/connections/c/nc_types.h index 5e3364df..da202844 100644 --- a/connections/c/nc_types.h +++ b/connections/c/nc_types.h @@ -305,6 +305,10 @@ typedef struct NC_OUT_OF_BAND_CONNECTION_METADATA { // generated such that no two IDs are identical. int endpoint_id; + // + // Properties for BLUETOOTH out-of-band connections. + // + // Endpoint info to use for the injected connection; will be included in the // endpoint_found_cb callback. Should uniquely identify the InjectEndpoint() // call so that the client which made the call can verify the endpoint @@ -315,6 +319,16 @@ typedef struct NC_OUT_OF_BAND_CONNECTION_METADATA { // Used for Bluetooth connections. NC_DATA remote_bluetooth_mac_address; + + // + // Properties for BLE out-of-band connections. + // + + // The BLE peripheral native ID to use for the BLE connection. + NC_DATA ble_peripheral_native_id; + + // The Protocol/Service Multiplexer(psm) value to use for the BLE connection. + int psm; } NC_OUT_OF_BAND_CONNECTION_METADATA, *PNC_OUT_OF_BAND_CONNECTION_METADATA; // Defines the minimal function interface for reading phenotype flags. Callbacks diff --git a/connections/out_of_band_connection_metadata.h b/connections/out_of_band_connection_metadata.h index d9cb3644..56513e71 100644 --- a/connections/out_of_band_connection_metadata.h +++ b/connections/out_of_band_connection_metadata.h @@ -17,9 +17,7 @@ #include #include "connections/medium_selector.h" -#include "connections/strategy.h" #include "internal/platform/byte_array.h" -#include "proto/connections_enums.pb.h" namespace nearby { namespace connections { @@ -47,6 +45,19 @@ struct OutOfBandConnectionMetadata { // Used for Bluetooth connections. ByteArray remote_bluetooth_mac_address; + + // + // Properties for BLE out-of-band connections. + // + + // The BLE peripheral native ID to use for the BLE connection. + // On Apple platform, the native ID is NSUUID in string format like + // "E621E1F8-C36C-495A-93FC-0C247A3E6E5F", other platform will be MAC address + // as string format like "0C:24:7A:3E:6E:5F". + std::string ble_peripheral_native_id; + + // The Protocol/Service Multiplexer(psm) value to use for the BLE connection. + int psm; }; } // namespace connections