Added in API level 33

ServiceDiscoveryInfo


public final class ServiceDiscoveryInfo
extends Object

java.lang.Object
   ↳ android.net.wifi.aware.ServiceDiscoveryInfo


An object providing information about a Wi-Fi Aware discovery session with a specific peer.

Summary

Public methods

List<byte[]> getMatchFilters()

Get the filter which resulted in this service discovery.

String getPairedAlias()

Get the paired device alias if the discovered device has already paired.

AwarePairingConfig getPairingConfig()

Get the discovered device's pairing config.

int getPeerCipherSuite()

Get the cipher suite type specified by the publish session to be used for data-path setup.

PeerHandle getPeerHandle()

Get the peer handle for the peer matching our discovery operation

byte[] getScid()

Get the Security context identifier is associate with PMK for data path security config.

byte[] getServiceSpecificInfo()

The service specific information (arbitrary byte array) provided by the peer as part of its discovery configuration.

Inherited methods

Public methods

getMatchFilters

Added in API level 33
public List<byte[]> getMatchFilters ()

Get the filter which resulted in this service discovery. For PublishConfig.PUBLISH_TYPE_UNSOLICITED, SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE discovery sessions this is the publisher's match filter. For PublishConfig.PUBLISH_TYPE_SOLICITED, SubscribeConfig.SUBSCRIBE_TYPE_ACTIVE discovery sessions this is the subscriber's match filter.

Returns
List<byte[]> A list of byte arrays representing the match filter. An empty list if match filter is not set. This value cannot be null.

getPairedAlias

Added in API level 34
public String getPairedAlias ()

Get the paired device alias if the discovered device has already paired. If not null device will automatically start the NAN pairing verification, DiscoverySessionCallback.onPairingVerificationSucceed(PeerHandle, String) will trigger when verification is finished

Returns
String

getPairingConfig

Added in API level 34
public AwarePairingConfig getPairingConfig ()

Get the discovered device's pairing config. Can be used for the following pairing setup or bootstrapping request.

Returns
AwarePairingConfig This value may be null.

See also:

getPeerCipherSuite

Added in API level 33
public int getPeerCipherSuite ()

Get the cipher suite type specified by the publish session to be used for data-path setup.

Returns
int peerCipherSuite An integer represent the cipher suite used to encrypt the data-path. Value is either 0 or a combination of Characteristics.WIFI_AWARE_CIPHER_SUITE_NONE, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128, and Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256

getPeerHandle

Added in API level 33
public PeerHandle getPeerHandle ()

Get the peer handle for the peer matching our discovery operation

Returns
PeerHandle An opaque handle representing the discovered peer. This value cannot be null.

getScid

Added in API level 33
public byte[] getScid ()

Get the Security context identifier is associate with PMK for data path security config. Only use for Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128 and Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256 to get the PMKID set by WifiAwareDataPathSecurityConfig.Builder.setPmkId(byte[]) from publish session. This can help the Wi-Fi Aware data-path setup to select the correct PMK/PMKID

Returns
byte[] An arbitrary byte array represent the security context identifier. null if Security context identifier is not set.

getServiceSpecificInfo

Added in API level 33
public byte[] getServiceSpecificInfo ()

The service specific information (arbitrary byte array) provided by the peer as part of its discovery configuration.

Returns
byte[] An arbitrary byte array represent the service specific information. null if service specific information is not set.