SubscribeConfig.Builder
  public
  static
  final
  
  class
  SubscribeConfig.Builder
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.net.wifi.aware.SubscribeConfig.Builder | 
Builder used to build SubscribeConfig objects.
Summary
| Public constructors | |
|---|---|
| 
      Builder()
       | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        SubscribeConfig | 
      build()
      Build  | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setInstantCommunicationModeEnabled(boolean enabled, int band)
      Configure whether to enable and use instant communication for this subscribe session. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setMatchFilter(List<byte[]> matchFilter)
      The match filter for a subscribe session. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setMaxDistanceMm(int maxDistanceMm)
      Configure the maximum distance to a discovered publisher at which to trigger a discovery notification. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setMinDistanceMm(int minDistanceMm)
      Configure the minimum distance to a discovered publisher at which to trigger a discovery notification. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setPairingConfig(AwarePairingConfig config)
      Set the  | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setServiceName(String serviceName)
      Specify the service name of the subscribe session. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setServiceSpecificInfo(byte[] serviceSpecificInfo)
      Specify service specific information for the subscribe session. | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setSubscribeType(int subscribeType)
      Sets the type of the subscribe session: active (subscribe packets are transmitted over-the-air), or passive (no subscribe packets are transmitted, a match is made against a solicited/active publish session whose packets are transmitted over-the-air). | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setTerminateNotificationEnabled(boolean enable)
      Configure whether a subscribe terminate notification
  | 
| 
        
        
        
        
        
        SubscribeConfig.Builder | 
      setTtlSec(int ttlSec)
      Sets the time interval (in seconds) an active (
  | 
| Inherited methods | |
|---|---|
Public constructors
Public methods
build
public SubscribeConfig build ()
Build SubscribeConfig given the current requests made on the
 builder.
| Returns | |
|---|---|
| SubscribeConfig | |
setInstantCommunicationModeEnabled
public SubscribeConfig.Builder setInstantCommunicationModeEnabled (boolean enabled, int band)
Configure whether to enable and use instant communication for this subscribe session.
 Instant communication will speed up service discovery and any data-path set up as part of
 this session. Use Characteristics.isInstantCommunicationModeSupported() to check
 if the device supports this feature.
 
Note: due to increased power requirements of this mode - it will only remain enabled for 30 seconds from the time the discovery session is started.
| Parameters | |
|---|---|
| enabled | boolean: true for enable instant communication mode, default is false. | 
| band | int: When setting toScanResult.WIFI_BAND_5_GHZ, device will try to enable
     instant communication mode on 5Ghz, but may fall back to 2.4Ghz due to regulatory
     requirements.
 Value isScanResult.WIFI_BAND_24_GHZ, orScanResult.WIFI_BAND_5_GHZ | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | the current Builderbuilder, enabling chaining of builder methods.
 This value cannot benull. | 
setMatchFilter
public SubscribeConfig.Builder setMatchFilter (List<byte[]> matchFilter)
The match filter for a subscribe session. Used to determine whether a service discovery occurred - in addition to relying on the service name.
Optional. Empty by default.
| Parameters | |
|---|---|
| matchFilter | List: A list of match filter entries (each of which is an arbitrary byte
                    array).
 This value may benull. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setMaxDistanceMm
public SubscribeConfig.Builder setMaxDistanceMm (int maxDistanceMm)
Configure the maximum distance to a discovered publisher at which to trigger a discovery
 notification. I.e. discovery will be triggered if we've found a matching publisher
 (based on the other criteria in this configuration) and the distance to the
 publisher is smaller than the value specified in this API. Can be used in conjunction
 with setMinDistanceMm(int) to specify a geofence, i.e. discovery with min <=
 distance <= max.
 
 For ranging to be used in discovery it must also be enabled on the publisher using
 PublishConfig.Builder.setRangingEnabled(boolean). However, ranging may
 not be available or enabled on the publisher or may be temporarily disabled on either
 subscriber or publisher - in such cases discovery will proceed without ranging.
 
 When ranging is enabled and available on both publisher and subscriber and a service
 is discovered based on geofence constraints the
 DiscoverySessionCallback.onServiceDiscoveredWithinRange(PeerHandle, byte[], List, int)
 is called, otherwise the
 DiscoverySessionCallback.onServiceDiscovered(PeerHandle, byte[], List)
 is called.
 
 The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
 as described in android.net.wifi.rtt.
 
 Note: The maximum distance is same as inner threshold of ingress geofence. This can be
 less than setMinDistanceMm(int) which is same as outer threshold of egress
 geofence i.e. discovery with  distance <= max or distance >= min.
| Parameters | |
|---|---|
| maxDistanceMm | int: Maximum distance, in mm, to the publisher below which to trigger
                      discovery. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setMinDistanceMm
public SubscribeConfig.Builder setMinDistanceMm (int minDistanceMm)
Configure the minimum distance to a discovered publisher at which to trigger a discovery
 notification. I.e. discovery will be triggered if we've found a matching publisher
 (based on the other criteria in this configuration) and the distance to the
 publisher is larger than the value specified in this API. Can be used in conjunction with
 setMaxDistanceMm(int) to specify a geofence, i.e. discovery with min <=
 distance <= max.
 
 For ranging to be used in discovery it must also be enabled on the publisher using
 PublishConfig.Builder.setRangingEnabled(boolean). However, ranging may
 not be available or enabled on the publisher or may be temporarily disabled on either
 subscriber or publisher - in such cases discovery will proceed without ranging.
 
 When ranging is enabled and available on both publisher and subscriber and a service
 is discovered based on geofence constraints the
 DiscoverySessionCallback.onServiceDiscoveredWithinRange(PeerHandle, byte[], List, int)
 is called, otherwise the
 DiscoverySessionCallback.onServiceDiscovered(PeerHandle, byte[], List)
 is called.
 
 The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
 as described in android.net.wifi.rtt.
 
 Note: The minimum distance is same as outer threshold of egress geofence. This can be
 more than setMaxDistanceMm(int) which is same as inner threshold of ingress
 geofence i.e. discovery with  distance <= max or distance >= min.
| Parameters | |
|---|---|
| minDistanceMm | int: Minimum distance, in mm, to the publisher above which to trigger
                      discovery. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setPairingConfig
public SubscribeConfig.Builder setPairingConfig (AwarePairingConfig config)
Set the AwarePairingConfig for this subscribe session, the peer can use this info
 to determine the config of the following bootstrapping, pairing setup/verification
 request.
| Parameters | |
|---|---|
| config | AwarePairingConfig: The pairing config set to the peer. Only valid whenCharacteristics.isAwarePairingSupported()is true.
 This value may benull. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | the current Builderbuilder, enabling chaining of builder methods.
 This value cannot benull. | 
See also:
setServiceName
public SubscribeConfig.Builder setServiceName (String serviceName)
Specify the service name of the subscribe session. The actual on-air value is a 6 byte hashed representation of this string.
The Service Name is a UTF-8 encoded string from 1 to 255 bytes in length. The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric values (A-Z, a-z, 0-9), the hyphen ('-'), the period ('.') and the underscore ('_'). All valid multi-byte UTF-8 characters are acceptable in a Service Name.
Must be called - an empty ServiceName is not valid.
| Parameters | |
|---|---|
| serviceName | String: The service name for the subscribe session.
 This value cannot benull. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setServiceSpecificInfo
public SubscribeConfig.Builder setServiceSpecificInfo (byte[] serviceSpecificInfo)
Specify service specific information for the subscribe session. This is a free-form byte array available to the application to send additional information as part of the discovery operation - i.e. it will not be used to determine whether a publish/subscribe match occurs.
Optional. Empty by default.
| Parameters | |
|---|---|
| serviceSpecificInfo | byte: A byte-array for the service-specific
            information field.
 This value may benull. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setSubscribeType
public SubscribeConfig.Builder setSubscribeType (int subscribeType)
Sets the type of the subscribe session: active (subscribe packets are transmitted over-the-air), or passive (no subscribe packets are transmitted, a match is made against a solicited/active publish session whose packets are transmitted over-the-air).
| Parameters | |
|---|---|
| subscribeType | int: Subscribe session type:SubscribeConfig.SUBSCRIBE_TYPE_ACTIVEorSubscribeConfig.SUBSCRIBE_TYPE_PASSIVE.
 Value isSubscribeConfig.SUBSCRIBE_TYPE_PASSIVE, orSubscribeConfig.SUBSCRIBE_TYPE_ACTIVE | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setTerminateNotificationEnabled
public SubscribeConfig.Builder setTerminateNotificationEnabled (boolean enable)
Configure whether a subscribe terminate notification
 DiscoverySessionCallback.onSessionTerminated() is reported
 back to the callback.
| Parameters | |
|---|---|
| enable | boolean: If true the terminate callback will be called when the
            subscribe is terminated. Otherwise it will not be called. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
setTtlSec
public SubscribeConfig.Builder setTtlSec (int ttlSec)
Sets the time interval (in seconds) an active (
 SubscribeConfig.Builder.setSubscribeType(int)) subscribe session
 will be alive - i.e. broadcasting a packet. When the TTL is reached
 an event will be generated for
 DiscoverySessionCallback.onSessionTerminated().
 
     Optional. 0 by default - indicating the session doesn't terminate on its own.
     Session will be terminated when DiscoverySession.close() is
     called.
| Parameters | |
|---|---|
| ttlSec | int: Lifetime of a subscribe session in seconds. | 
| Returns | |
|---|---|
| SubscribeConfig.Builder | The builder to facilitate chaining builder.setXXX(..).setXXX(..). | 
