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     <a href="../../../nn_types/u8.html">u8</a> channel,
21     const void * pData,
22     size_t dataSize
23);
24</pre>
25    </div>
26    <h2>Arguments</h2>
27    <div class="section">
28      <table class="arguments">
29        <thead>
30          <tr>
31            <td width="15" />
32            <th>Name</th>
33            <td>Description</td>
34          </tr>
35        </thead>
36        <tr>
37          <td>in</td>
38          <th><CODE>subId</CODE></th>
39          <td>Communication mode ID. Set this to a value between <CODE>0x00</CODE> and <CODE>0xFE</CODE>.</td>
40        </tr>
41        <tr>
42          <td>in</td>
43          <th><CODE>maxEntry</CODE></th>
44          <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>
45        </tr>
46        <tr>
47          <td>in</td>
48          <th>localId</th>
49          <td>The local communication ID. Specify the value generated by <a href="../../../nn/uds/CTR/CreateLocalCommunicationId.html"><CODE>CreateLocalCommunicationId</CODE></a>.</td>
50        </tr>
51        <tr>
52          <td>in</td>
53          <th>passphrase[]</th>
54          <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>
55        </tr>
56        <tr>
57          <td>in</td>
58          <th>passphraseLength</th>
59          <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>
60        </tr>
61        <tr>
62          <td>in</td>
63          <th>channel</th>
64          <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>
65        </tr>
66        <tr>
67          <td>in</td>
68          <th><CODE>pData</CODE></th>
69          <td>Pointer to the optional data you want to set for the beacon.</td>
70        </tr>
71        <tr>
72          <td>in</td>
73          <th><CODE>dataSize</CODE></th>
74          <td>Size of the optional data you want to set for the beacon. Specify a value up to <a href="../../../nn/uds/CTR/NET_DESC_APPDATA_SIZE_MAX.html"><CODE>NET_DESC_APPDATA_SIZE_MAX</CODE></a>.</td>
75        </tr> </table>
76    </div>
77    <h2>Return Values</h2>
78    <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 />
79      <table class="arguments">
80        <thead>
81          <tr>
82            <th>Value</th>
83            <td>Description</td>
84          </tr>
85        </thead>
86        <tr>
87          <th><CODE>Result::IsSuccess</CODE></th>
88          <td>Successfully established local communication and began operating as a master.</td>
89        </tr>
90        <tr>
91          <th><CODE>ResultNotInitialized</CODE></th>
92          <td>The library is not initialized. Execute the <CODE><a href="../../../nn/uds/CTR/Initialize.html">Initialize</a></CODE> function.</td>
93        </tr>
94        <tr>
95          <th><CODE>ResultInvalidState</CODE></th>
96          <td>Not in an executable state. Returned when executed in a state other than <CODE>STATE_DISCONNECTED</CODE>.</td>
97        </tr>
98        <tr>
99          <th><CODE>ResultOutOfRange</CODE></th>
100          <td>The specified argument was not in a specifiable range. It is possible that it will succeed if you re-execute with an appropriate value for the argument.</td>
101        </tr>
102        <tr>
103          <th><CODE>ResultWirelessOff</CODE></th>
104          <td>Entered wireless-disabled mode. Re-initialization is required.</td>
105        </tr>
106        <tr>
107          <th><CODE>ResultTooLarge</CODE></th>
108          <td>The <SPAN class="argument">dataSize</SPAN> exceeds <CODE><a href="../../../nn/uds/CTR/NET_DESC_APPDATA_SIZE_MAX.html">NET_DESC_APPDATA_SIZE_MAX</a></CODE>.</td>
109        </tr>
110        <tr>
111          <th><CODE>ResultInvalidPointer</CODE></th>
112          <td><SPAN class="argument">pData</SPAN> is <CODE>NULL</CODE>. <CODE>NULL</CODE> is allowed when <SPAN class="argument">dataSize</SPAN> is <CODE>0</CODE>.</td>
113        </tr>
114        <tr>
115          <th>A value other than the above.</th>
116          <td>Failed for reasons other than those given above.</td>
117        </tr>
118      </table> </div>
119    <h2>Description</h2>
120    <div class="section">
121      <p>Sets optional data for the beacon and builds 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><p>Using this <CODE>API</CODE> function allows you to set optional data for the beacon, when building the network. To update the optional data for the beacon after the network has been constructed, use the <CODE><a href="../../../nn/uds/CTR/SetApplicationDataToBeacon.html">SetApplicationDataToBeacon</a></CODE> function. The maximum size of this optional data is <CODE><a href="../../../nn/uds/CTR/NET_DESC_APPDATA_SIZE_MAX.html">NET_DESC_APPDATA_SIZE_MAX</a></CODE> bytes. Since it is not encrypted, note that it can be collected by any general device, such as a computer. Other devices can obtain this data by calling <CODE><A>Scan</A></CODE>, while they are connected as clients or spectators. This function is thread-safe.</p><!-- write here --></div>
122    <h2>Revision History</h2>
123    <div class="section">
124      <dl class="history">
125        <dt>2011/09/07</dt>
126        <dd>Standardized notation for wireless-disabled mode.<br />
127        </dd>
128        <dt>2011/02/21</dt>
129        <dd>Added a timing guideline to the Description. Indicated that the maximum value for <CODE>maxEntry</CODE> is <CODE>NODE_MAX</CODE>.<br />
130        </dd>
131        <dt>2011/01/25</dt>
132        <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 />
133        </dd>
134        <dt>2010/10/15</dt>
135        <dd>Expanded the information on the return values.<br />
136        </dd>
137        <dt>2010/06/14</dt>
138        <dd>Initial version.<br />
139        </dd>
140      </dl>
141    </div>
142  <hr><p>CONFIDENTIAL</p></body>
143</html>