nn::uds::CTR::CreateNetwork Function

Syntax

nn::Result CreateNetwork(
     u8 subId,
     u8 maxEntry,
     bit32 localId,
     const char passphrase[],
     size_t passphraseLength
);

Arguments

Name Description
in subId Communication mode ID. Set this to a value between 0x00 and 0xFE.
in maxEntry Maximum number of nodes that can connect to the network. This value can be up to NODE_MAX, including the local device.
in localId The local communication ID. Specify the value generated by CreateLocalCommunicationId.
in passphrase[] String holding the seed of the passphrase to use for wireless layer encryption. With UDS, communication can only be established if uniqueId and passphrase match.
in passphraseLength Passphrase length. Specify a value between UDS_PASSPHRASE_LENGTH_MIN and UDS_PASSPHRASE_LENGTH_MAX, inclusive.

Return Values

Returns the function's execution result. Returns one of the Result values listed below.
Value Description
Result::IsSuccess Successfully established local communication and began operating as a master.
ResultNotInitialized The library is not initialized. Execute the Initialize function.
ResultInvalidState Not in an executable state. Returned when this function is executed in any state other than STATE_DISCONNECTED.
ResultOutOfRange The specified argument value was not in the valid range for the argument. Try again, specifying a valid value for the argument.
ResultWirelessOff Entered wireless-disabled mode. Re-initialization is required.
A value other than the above Failed for reasons other than those given above.

Description

Creates a new network.

Approximately 800 ms is required for completion, in order to then auto-select channels or perform similar processes.

This function is thread-safe.

Revision History

2011/09/07
Standardized notation for wireless-disabled mode.
2011/02/21
Added a timing guideline to the Description. Indicated that the maximum value for maxEntry is NODE_MAX.
2011/01/25
Changed size of passphrase used from "fewer than 255 (provisional)" to "at least 8 and no more than 255," and confirmed.
Changed to automatically set the channel to use, with the old function to specify the channel now limited to debugging purposes.
2010/10/15
Expanded the information on the return values.
2010/06/14
Initial version.

CONFIDENTIAL