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     u8 subId,
16     u8 maxEntry,
17     bit32 localId,
18     const char passphrase[],
19     size_t passphraseLength,
20     u8 channel
21);
22</pre>
23    </div>
24<h2>Arguments</h2>
25    <div class="section">
26      <table class="arguments">
27        <thead>
28          <tr>
29            <td width="15" />
30<th>Name</th>
31<td>Description</td>
32          </tr>
33        </thead>
34        <tr>
35<td>in</td>
36<th>subId</th>
37<td>Communication mode ID. Set this to a value between <CODE>0x00</CODE> and <CODE>0xFE</CODE>.</td>
38        </tr>
39        <tr>
40<td>in</td>
41<th>maxEntry</th>
42<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>
43        </tr>
44        <tr>
45<td>in</td>
46<th>localId</th>
47<td>The local communication ID. Specify the value generated by <a href="../../../nn/uds/CTR/CreateLocalCommunicationId.html"><CODE>CreateLocalCommunicationId</CODE></a>.</td>
48        </tr>
49        <tr>
50<td>in</td>
51<th>passphrase[]</th>
52<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>
53        </tr>
54        <tr>
55<td>in</td>
56<th>passphraseLength</th>
57<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>
58        </tr>
59        <tr>
60<td>in</td>
61<th>channel</th>
62<td>The channel to use for communication. Specify channel <CODE>0</CODE> (automatic), <CODE>1</CODE>, <CODE>6</CODE>, or <CODE>11</CODE>. When this function runs on retail systems, the channel is always selected automatically.</td>
63        </tr> </table>
64    </div>
65<h2>Return Values</h2>
66<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 />
67      <table class="arguments">
68        <thead>
69          <tr>
70<th>Value</th>
71<td>Description</td>
72          </tr>
73        </thead>
74        <tr>
75<th><CODE>Result::IsSuccess</CODE></th>
76<td>Successfully established local communication and began operating as a master.</td>
77        </tr>
78        <tr>
79<th><CODE>ResultNotInitialized</CODE></th>
80<td>The library is not initialized. Execute the <CODE><a href="../../../nn/uds/CTR/Initialize.html">Initialize</a></CODE> function.</td>
81        </tr>
82        <tr>
83<th><CODE>ResultInvalidState</CODE></th>
84<td>Not in an executable state. Returned when executed in a state other than <CODE>STATE_DISCONNECTED</CODE>.</td>
85        </tr>
86        <tr>
87<th><CODE>ResultOutOfRange</CODE></th>
88<td>The specified argument value was not in the valid range for the argument. Try again, specifying a valid value for the argument.</td>
89        </tr>
90        <tr>
91<th><CODE>ResultWirelessOff</CODE></th>
92<td>Transitioned to wireless-disabled mode. Re-initialization is required.</td>
93        </tr>
94        <tr>
95<th>A value other than the above</th>
96<td>Failed for reasons other than those given above.</td>
97        </tr>
98      </table> </div>
99<h2>Description</h2>
100    <div class="section">
101<p>Creates a new network. This function is provided for debugging purposes and can be used to specify the channel to use for wireless communication during development. Note that the <SPAN class="argument">channel</SPAN> argument is ignored on production hardware.</p><p>Approximately 800 ms is needed to complete this because auto-selection of channels and other operations must be performed. </p><!-- write here --></div>
102<h2>Revision History</h2>
103    <div class="section">
104      <dl class="history">
105        <dt>2011/02/21</dt>
106<dd>Added a timing guideline to the Description. Indicated that the maximum value for <CODE>maxEntry</CODE> is <CODE>NODE_MAX</CODE>.<br />
107        </dd>
108        <dt>2011/01/25</dt>
109<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 />
110        </dd>
111        <dt>2010/10/15</dt>
112<dd>Expanded the information on the return values.<br />
113        </dd>
114        <dt>2010/06/14</dt>
115<dd>Initial version.<br />
116        </dd>
117      </dl>
118    </div>
119  <hr><p>CONFIDENTIAL</p></body>
120</html>
121