ThreadNetworkCredentials.Builder

public static class ThreadNetworkCredentials.Builder extends Object

Builder for constructing ThreadNetworkCredentials instances.

Public Method Summary

ThreadNetworkCredentials
build()
Constructs a ThreadNetworkCredentials as configured by this builder.
ThreadNetworkCredentials.Builder
setActiveTimestamp(ThreadNetworkCredentials.Timestamp activeTimestamp)
Sets the Thread Active Timestamp.
ThreadNetworkCredentials.Builder
setChannel(int channelPage, int channel)
Sets Thread Channel and Channel Page.
ThreadNetworkCredentials.Builder
setChannelMasks(Set<ThreadNetworkCredentials.ChannelMaskEntry> channelMasks)
Sets the Thread Channel Masks.
ThreadNetworkCredentials.Builder
setExtendedPanId(byte[] extendedPanId)
Sets the Thread Extended PAN ID.
ThreadNetworkCredentials.Builder
setMeshLocalPrefix(byte[] meshLocalPrefix)
Sets the Thread Network Mesh-Local Prefix.
ThreadNetworkCredentials.Builder
setNetworkKey(byte[] networkKey)
Sets the Thread Network Key.
ThreadNetworkCredentials.Builder
setNetworkName(String networkName)
Sets the Thread Network Name.
ThreadNetworkCredentials.Builder
setPanId(int panId)
Sets the Thread PAN ID with valid value in range of [0x0, 0xfffe].
ThreadNetworkCredentials.Builder
setPskc(byte[] pskc)
Sets the Thread PSKc.
ThreadNetworkCredentials.Builder
setSecurityPolicy(ThreadNetworkCredentials.SecurityPolicy securityPolicy)
Sets the Thread Security Policy.

Inherited Method Summary

Public Methods

public ThreadNetworkCredentials build ()

Constructs a ThreadNetworkCredentials as configured by this builder.

Throws
IllegalStateException if networkKey is missing.

public ThreadNetworkCredentials.Builder setActiveTimestamp (ThreadNetworkCredentials.Timestamp activeTimestamp)

Sets the Thread Active Timestamp. The default Active Timestamp is Timestamp(seconds=1, ticks=0, isAuthoritative=false).

public ThreadNetworkCredentials.Builder setChannel (int channelPage, int channel)

Sets Thread Channel and Channel Page. The default channel page is ThreadNetworkCredentials.CHANNEL_PAGE_2P4GHZ and the channel is randomly selected in range [ThreadNetworkCredentials.CHANNEL_MIN_2P4GHZ, ThreadNetworkCredentials.CHANNEL_MAX_2P4GHZ]. Other channel pages and associated channel are undefined and may lead to undefined behavior if it's applied to Thread devices.

Throws
IllegalArgumentException if invalid channel is specified for the channelPage.

public ThreadNetworkCredentials.Builder setChannelMasks (Set<ThreadNetworkCredentials.ChannelMaskEntry> channelMasks)

Sets the Thread Channel Masks. The default channel masks consist of ThreadNetworkCredentials.DEFAULT_CHANNEL_MASK which enables all 2.4GHz channels.

public ThreadNetworkCredentials.Builder setExtendedPanId (byte[] extendedPanId)

Sets the Thread Extended PAN ID. The default Extended PAN ID is randomly generated.

It's discouraged to call this method to override the default value in production.

public ThreadNetworkCredentials.Builder setMeshLocalPrefix (byte[] meshLocalPrefix)

Sets the Thread Network Mesh-Local Prefix. The default Mesh-Local Prefix is randomly generated with a secure random generator.

It's discouraged to call this method to override the default value in production.

Throws
IllegalArgumentException if length of meshLocalPrefix isn't ThreadNetworkCredentials.LENGTH_MESH_LOCAL_PREFIX or meshLocalPrefix doesn't start with 0xfd.

public ThreadNetworkCredentials.Builder setNetworkKey (byte[] networkKey)

Sets the Thread Network Key. The default Network Key is randomly generated with a secure random generator.

It's discouraged to call this method to override the default value in production.

public ThreadNetworkCredentials.Builder setNetworkName (String networkName)

Sets the Thread Network Name. The default Network Name is randomly generated.

public ThreadNetworkCredentials.Builder setPanId (int panId)

Sets the Thread PAN ID with valid value in range of [0x0, 0xfffe]. The default PAN ID is randomly generated.

It's discouraged to call this method to override the default value in production.

Throws
IllegalArgumentException if panId is not in range of [0x0, 0xfffe].

public ThreadNetworkCredentials.Builder setPskc (byte[] pskc)

Sets the Thread PSKc. The default PSKc has length of 16 bytes and is randomly generated with a secure random generator.

Parameters
pskc the pskc value derived from Extended PAN ID, Network Name and Commissioning Credentials.

public ThreadNetworkCredentials.Builder setSecurityPolicy (ThreadNetworkCredentials.SecurityPolicy securityPolicy)

Sets the Thread Security Policy. The default Security Policy is ThreadNetworkCredentials.DEFAULT_SECURITY_POLICY.