# Print output for @column tags ?>
public
static
final
class
PublishConfig.Builder
extends Object
java.lang.Object | |
↳ | android.net.wifi.aware.PublishConfig.Builder |
Builder used to build PublishConfig
objects.
Public constructors | |
---|---|
Builder()
|
Public methods | |
---|---|
PublishConfig
|
build()
Build |
PublishConfig.Builder
|
setMatchFilter(List<byte[]> matchFilter)
The match filter for a publish session. |
PublishConfig.Builder
|
setPublishType(int publishType)
Specify the type of the publish session: solicited (aka active - publish packets are transmitted over-the-air), or unsolicited (aka passive - no publish packets are transmitted, a match is made against an active subscribe session whose packets are transmitted over-the-air). |
PublishConfig.Builder
|
setRangingEnabled(boolean enable)
Configure whether the publish discovery session supports ranging and allows peers to measure distance to it. |
PublishConfig.Builder
|
setServiceName(String serviceName)
Specify the service name of the publish session. |
PublishConfig.Builder
|
setServiceSpecificInfo(byte[] serviceSpecificInfo)
Specify service specific information for the publish session. |
PublishConfig.Builder
|
setTerminateNotificationEnabled(boolean enable)
Configure whether a publish terminate notification
|
PublishConfig.Builder
|
setTtlSec(int ttlSec)
Sets the time interval (in seconds) an unsolicited (
|
Inherited methods | |
---|---|
public Builder ()
public PublishConfig build ()
Build PublishConfig
given the current requests made on the
builder.
Returns | |
---|---|
PublishConfig |
public PublishConfig.Builder setMatchFilter (List<byte[]> matchFilter)
The match filter for a publish 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 be null . |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setPublishType (int publishType)
Specify the type of the publish session: solicited (aka active - publish packets are transmitted over-the-air), or unsolicited (aka passive - no publish packets are transmitted, a match is made against an active subscribe session whose packets are transmitted over-the-air).
Parameters | |
---|---|
publishType |
int : Publish session type:
PublishConfig#PUBLISH_TYPE_SOLICITED or
PublishConfig#PUBLISH_TYPE_UNSOLICITED (the default).
Value is PublishConfig.PUBLISH_TYPE_UNSOLICITED , or PublishConfig.PUBLISH_TYPE_SOLICITED |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setRangingEnabled (boolean enable)
Configure whether the publish discovery session supports ranging and allows peers to
measure distance to it. This API is used in conjunction with
SubscribeConfig.Builder#setMinDistanceMm(int)
and
SubscribeConfig.Builder#setMaxDistanceMm(int)
to specify a minimum and/or
maximum distance at which discovery will be triggered.
Optional. Disabled by default - i.e. any peer attempt to measure distance to this device will be refused and discovery will proceed without ranging constraints.
The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
as described in android.net.wifi.rtt
.
Parameters | |
---|---|
enable |
boolean : If true, ranging is supported on request of the peer. |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setServiceName (String serviceName)
Specify the service name of the publish 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 ('-'), and the period ('.'). 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 publish session.
This value cannot be null . |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setServiceSpecificInfo (byte[] serviceSpecificInfo)
Specify service specific information for the publish session. This is a free-form byte array available to the application to send additional information as part of the discovery operation - 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 be null . |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setTerminateNotificationEnabled (boolean enable)
Configure whether a publish terminate notification
DiscoverySessionCallback#onSessionTerminated()
is reported
back to the callback.
Parameters | |
---|---|
enable |
boolean : If true the terminate callback will be called when the
publish is terminated. Otherwise it will not be called. |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |
public PublishConfig.Builder setTtlSec (int ttlSec)
Sets the time interval (in seconds) an unsolicited (
PublishConfig.Builder#setPublishType(int)
) publish session
will be alive - broadcasting a packet. When the TTL is reached
an event will be generated for
DiscoverySessionCallback#onSessionTerminated()
[unless
setTerminateNotificationEnabled(boolean)
disables the callback].
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 publish session in seconds. |
Returns | |
---|---|
PublishConfig.Builder |
The builder to facilitate chaining
builder.setXXX(..).setXXX(..) . |