1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7<title>CreateNetwork</title>
8  </head>
9  <body>
10<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/uds/Overview.html">uds</a>::<a href="../../../nn/uds/CTR/Overview.html">CTR</a>::CreateNetwork</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14<a href="../../../nn/Result/Overview.html">nn::Result</a> CreateNetwork(
15     <a href="../../../nn_types/u8.html">u8</a> subId,
16     <a href="../../../nn_types/u8.html">u8</a> maxEntry,
17     <a href="../../../nn_types/bit32.html">bit32</a> localId,
18     const char passphrase[],
19     size_t passphraseLength
20);
21</pre>
22    </div>
23<h2>Arguments</h2>
24    <div class="section">
25      <table class="arguments">
26        <thead>
27          <tr>
28            <td width="15" />
29<th>Name</th>
30<td>Description</td>
31          </tr>
32        </thead>
33        <tr>
34<td>in</td>
35<th>subId</th>
36<td>Communication mode ID. Set this to a value between <CODE>0x00</CODE> and <CODE>0xFE</CODE>.</td>
37        </tr>
38        <tr>
39<td>in</td>
40<th>maxEntry</th>
41<td>Maximum number of nodes that can connect to the network. This value can be up to <a href="../../../nn/uds/CTR/NODE_MAX.html"><CODE>NODE_MAX</CODE></a>, including the local device.</td>
42        </tr>
43        <tr>
44<td>in</td>
45<th>localId</th>
46<td>The local communication ID. Specify the value generated by <a href="../../../nn/uds/CTR/CreateLocalCommunicationId.html"><CODE>CreateLocalCommunicationId</CODE></a>.</td>
47        </tr>
48        <tr>
49<td>in</td>
50<th>passphrase[]</th>
51<td>String holding the seed of the passphrase to use for wireless layer encryption. With UDS, communication can only be established if <SPAN class="argument">uniqueId</SPAN> and <SPAN class="argument">passphrase</SPAN> match.</td>
52        </tr>
53        <tr>
54<td>in</td>
55<th>passphraseLength</th>
56<td>Passphrase length. Specify a value between <a href="../../../nn/uds/CTR/UDS_PASSPHRASE_LENGTH_MIN.html"><CODE>UDS_PASSPHRASE_LENGTH_MIN</CODE></a> and <a href="../../../nn/uds/CTR/UDS_PASSPHRASE_LENGTH_MAX.html"><CODE>UDS_PASSPHRASE_LENGTH_MAX</CODE></a>, inclusive.</td>
57        </tr> </table>
58    </div>
59<h2>Return Values</h2>
60<div class="section">Returns the function's execution result. Returns one of the <a href="../../../nn/Result/Overview.html"><CODE>Result</CODE></A> values listed below. <br />
61      <table class="arguments">
62        <thead>
63          <tr>
64<th>Value</th>
65<td>Description</td>
66          </tr>
67        </thead>
68        <tr>
69<th><CODE>Result::IsSuccess</CODE></th>
70<td>Successfully established local communication and began operating as a master.</td>
71        </tr>
72        <tr>
73<th><CODE>ResultNotInitialized</CODE></th>
74<td>The library is not initialized. Execute the <CODE><a href="../../../nn/uds/CTR/Initialize.html">Initialize</a></CODE> function.</td>
75        </tr>
76        <tr>
77<th><CODE>ResultInvalidState</CODE></th>
78<td>Not in an executable state. Returned when this function is executed in any state other than <CODE>STATE_DISCONNECTED</CODE>.</td>
79        </tr>
80        <tr>
81<th><CODE>ResultOutOfRange</CODE></th>
82<td>The specified argument value was not in the valid range for the argument. Try again, specifying a valid value for the argument.</td>
83        </tr>
84        <tr>
85<th><CODE>ResultWirelessOff</CODE></th>
86<td>Entered wireless-disabled mode. Re-initialization is required.</td>
87        </tr>
88        <tr>
89<th>A value other than the above</th>
90<td>Failed for reasons other than those given above.</td>
91        </tr>
92      </table> </div>
93<h2>Description</h2>
94    <div class="section">
95<p>Creates a new network.</p><p>Approximately 800 ms is required for completion, in order to then auto-select channels or perform similar processes.<br /><br /> This function is thread-safe.</p><!-- write here --></div>
96<h2>Revision History</h2>
97    <div class="section">
98      <dl class="history">
99        <dt>2011/09/07</dt>
100<dd>Standardized notation for wireless-disabled mode.<br />
101        </dd>
102        <dt>2011/02/21</dt>
103<dd>Added a timing guideline to the Description. Indicated that the maximum value for <CODE>maxEntry</CODE> is <CODE>NODE_MAX</CODE>.<br />
104        </dd>
105        <dt>2011/01/25</dt>
106<dd>Changed size of passphrase used from &quot;fewer than 255 (provisional)&quot; to &quot;at least 8 and no more than 255,&quot; and confirmed.<br />Changed to automatically set the channel to use, with the old function to specify the channel now limited to debugging purposes.<br />
107        </dd>
108        <dt>2010/10/15</dt>
109<dd>Expanded the information on the return values.<br />
110        </dd>
111        <dt>2010/06/14</dt>
112<dd>Initial version.<br />
113        </dd>
114      </dl>
115    </div>
116  <hr><p>CONFIDENTIAL</p></body>
117</html>