CTR Pia  4.11.3
Game Communication Engine
local_LocalNetworkSetting.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: local_LocalNetworkSetting.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/definitions.h>
18 #include <pia/common/common_RootObject.h>
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace local
25 {
26 
27 /*!
28 @cond PRIVATE
29 */
30 static const u8 LOCAL_NETWORK_VERSION = 1;
31 //! @endcond
32 
33 static const u8 STATION_MAX_ENTRY = 12; //!< The maximum number of nodes that can connect. The local network host is included in the number of connected nodes.
34 static const u32 SCAN_NETWORK_NUM_MAX = 16; //!< Defines the maximum number of search results that can be stored at one time when performing a network search.
35 
36 static const u32 DEFAULT_AROUND_NETWORK_SEARCH_SCAN_INTERVAL = 200; //!< Default value, in milliseconds, for the scan interval during nearby network search.
37 static const u16 DEFAULT_AROUND_NETWORK_SEARCH_SCAN_TIME = 20; //!< Default value, in milliseconds, for the scan time during nearby network search.
38 static const u32 DEFAULT_AROUND_NETWORK_SEARCH_NETWORK_LIFE_TIME = 5000;//!< Default value, in milliseconds, for the holding period for a discovered network during nearby network search.
39 
40 /*!
41 @cond PRIVATE
42 @brief Local network state update event.
43 */
44 enum LocalUpdateEvent
45 {
46  LocalUpdateEventUnknown = 0, //!< Specifies an unknown state other than one of the following defined states. This state does not occur as long as the process is running normally.
47  LocalUpdateEventDisconnected, //!< The event that occurs when disconnected from the local network.
48  LocalUpdateEventMigrationStarted //!< Host migration has started.
49 };
50 
51 typedef void (*LocalUpdateEventCallback)(LocalUpdateEvent e, u8 transportId, void* pParam);
52 //! @endcond
53 
54 /*!
55 @cond PRIVATE
56 */
57 enum LocalNetworkType
58 {
59  LOCAL_NETWORK_TYPE_UDS = 0
60 };
61 //! @endcond
62 
63 /*!
64  @brief Class for configuring a local network.
65 
66  @details This class is never instantiated by an application.
67  Use a class that inherits this class.
68 
69  @see nn::pia::local::UdsNetworkSetting
70 
71  @date 2014-03-03 Initial version.
72 */
74 {
75 protected:
77  : m_IsEnableHostMigration(false),
80  {
81  }
82 
83 public:
84  virtual LocalNetworkType GetLocalNetworkType() const = 0;
85 
86  bool m_IsEnableHostMigration; //!< Enables or disables local network host migration. Enabled if <tt>true</tt>; disabled if <tt>false</tt>.
87  bool m_IsEnableAroundNetworkSearch; //!< Enables or disables nearby network search. Enabled if <tt>true</tt>; disabled if <tt>false</tt>.
88  u8 m_ApplicationVersion; //!< Specifies the application version. Applications running a different version than this value can find the created network but not connect to it.
89 };
90 
91 
92 /*!
93  @brief Class for configuring the creation of a local network.
94 
95  @details This class is never instantiated by an application.
96  Use a class that inherits this class.
97 
98  @see nn::pia::local::UdsCreateNetworkSetting
99 
100  @date 2014-03-03 Initial version.
101 */
103 {
104 protected:
106  {
107  }
108 };
109 
110 
111 /*!
112  @brief Class that holds information about a local network.
113 
114  @details This class is never instantiated by an application.
115  Use a class that inherits this class.
116 
117  @see nn::pia::local::UdsNetworkDescription
118 
119  @date 2014-03-03 Initial version.
120 */
122 {
123 public:
124  virtual u32 GetCurrentParticipants() const = 0;
125  virtual u32 GetMaxParticipants() const = 0;
126  virtual bool IsOpened() const = 0;
127  virtual u32 GetLocalCommunicationId() const = 0;
128  virtual u8 GetSubId() const = 0;
129  virtual u16 GetChannel() const = 0;
130  virtual void GetBssid(bit8* pBssidBuffer) const = 0;
131 
132 protected:
134  {
135  }
136 
137 public:
138  virtual void Copy(const LocalNetworkDescription* description) = 0;
139 };
140 
141 
142 /*!
143  @brief Class for configuring a connection to a local network.
144 
145  @details This class is never instantiated by an application.
146  Use a class that inherits this class.
147 
148  @see nn::pia::local::UdsConnectNetworkSetting
149 
150  @date 2014-03-03 Initial version.
151 */
153 {
154 protected:
156  : m_pLocalNetworkDescription(NULL)
157  {
158  }
159 
160 public:
161  LocalNetworkDescription* m_pLocalNetworkDescription; //!< Information about the target network.
162 };
163 
164 /*!
165 @cond PRIVATE
166 The following declarations are for internal use by the library.
167 */
168 class LocalScanNetworkSetting : public nn::pia::common::RootObject
169 {
170 protected:
171  LocalScanNetworkSetting()
172  : m_paLocalNetworkDescriptionArray(NULL),
173  m_pFoundNetworkNum(NULL)
174  {
175  }
176 
177 public:
178  LocalNetworkDescription* m_paLocalNetworkDescriptionArray; // SCAN_NETWORK_NUM_MAX
179  u32* m_pFoundNetworkNum;
180 };
181 
182 class LocalConnectionStatus : public nn::pia::common::RootObject
183 {
184 protected:
185  LocalConnectionStatus()
186  {
187  }
188 
189 public:
190  virtual u8 GetParticipantNum() const = 0;
191 };
192 
193 class LocalBeaconSystemData
194 {
195 public:
196  u32 m_NetworkId; //!< Specifies the network ID determined by the host. This ID is used to determine whether to connect to a network during host migration.
197  u32 m_SessionId; //!< Session ID that does not change during host migration.
198  u8 m_NetworkVersion; //!< Specifies the local network version.
199  u8 m_ApplicationVersion; //!< Specifies the application version set by the application.
200  u8 m_Reserved[6];
201 
202 protected:
203  LocalBeaconSystemData()
204  : m_NetworkId(0),
205  m_SessionId(0),
206  m_NetworkVersion(LOCAL_NETWORK_VERSION),
208  {
209  memset(m_Reserved, 0, sizeof(m_Reserved));
210  }
211 };
212 
213 
214 /*!
215 Internal library declarations end here.
216 @endcond
217 */
218 
219 
220 /*!
221  @brief Class that holds information about stations connected to a local network.
222 
223  @details This class is never instantiated by an application.
224  Use a class that inherits this class.
225 
226  @see nn::pia::local::UdsStationInfo
227 
228  @date 2014-03-03 Initial version.
229 */
231 {
232 protected:
234  : m_Role(STATION_INFO_ROLE_NONE)
235  {
236  }
237 
238 public:
239 /*!
240  @brief Indicates the station's role (not connected, host, or client).
241 */
243  {
244  STATION_INFO_ROLE_NONE = 0, //!< Not connected
246  STATION_INFO_ROLE_CLIENT //!< Client
247  };
248  STATION_INFO_ROLE m_Role; //!< The station's role (not connected, host, or client).
249 };
250 
251 
252 /*!
253  @brief Class that holds information about the network discovered using nearby network search.
254 
255  @details This class is never instantiated by an application.
256  Use a class that inherits this class.
257 
258  @see nn::pia::local::UdsAroundNetworkInfo
259 
260  @date 2015-02-10 Initial version.
261 */
263 {
264 protected:
266 
267 public:
268 };
269 
270 /*!
271  @brief Class for configuring the nearby network search feature.
272 
273  @date 2015-02-10 Initial version.
274 */
276 {
277 public:
279  : m_LocalCommunicationId(0)
280  , m_SubId(0xff)
281  , m_ScanInterval(DEFAULT_AROUND_NETWORK_SEARCH_SCAN_INTERVAL)
282  , m_ScanTime(DEFAULT_AROUND_NETWORK_SEARCH_SCAN_TIME)
283  , m_NetworkInfoLifeTime(DEFAULT_AROUND_NETWORK_SEARCH_NETWORK_LIFE_TIME)
284  {
285  }
286 
287  u32 m_LocalCommunicationId; //!< Specifies the local communication ID. Specify the value generated by <tt>@ref LocalNetwork::CreateLocalCommunicationId</tt>.
288  u8 m_SubId; //!< Specifies an ID for identifying the communication mode. To search all IDs, specify <tt>0xff</tt>.
289  u32 m_ScanInterval; //!< The scan interval, in milliseconds.
290  u16 m_ScanTime; //!< The scan time, in milliseconds.
291  u32 m_NetworkInfoLifeTime; //!< The holding period, in milliseconds, for the discovered network.
292 };
293 
294 }
295 }
296 } // End of namespace nn::pia::local.
bool m_IsEnableHostMigration
Enables or disables local network host migration. Enabled if true; disabled if false.
Definition: local_LocalNetworkSetting.h:86
Host.
Definition: local_LocalNetworkSetting.h:245
static const u16 DEFAULT_AROUND_NETWORK_SEARCH_SCAN_TIME
Default value, in milliseconds, for the scan time during nearby network search.
Definition: local_LocalNetworkSetting.h:37
static const u8 STATION_MAX_ENTRY
The maximum number of nodes that can connect. The local network host is included in the number of con...
Definition: local_LocalNetworkSetting.h:33
Definition: assert.h:115
static const u32 DEFAULT_AROUND_NETWORK_SEARCH_SCAN_INTERVAL
Default value, in milliseconds, for the scan interval during nearby network search.
Definition: local_LocalNetworkSetting.h:36
Class for configuring a local network.
Definition: local_LocalNetworkSetting.h:73
bool m_IsEnableAroundNetworkSearch
Enables or disables nearby network search. Enabled if true; disabled if false.
Definition: local_LocalNetworkSetting.h:87
Class that holds information about the network discovered using nearby network search.
Definition: local_LocalNetworkSetting.h:262
u16 m_ScanTime
The scan time, in milliseconds.
Definition: local_LocalNetworkSetting.h:290
static const u32 DEFAULT_AROUND_NETWORK_SEARCH_NETWORK_LIFE_TIME
Default value, in milliseconds, for the holding period for a discovered network during nearby network...
Definition: local_LocalNetworkSetting.h:38
u8 m_SubId
Specifies an ID for identifying the communication mode. To search all IDs, specify 0xff...
Definition: local_LocalNetworkSetting.h:288
u8 m_ApplicationVersion
Specifies the application version. Applications running a different version than this value can find ...
Definition: local_LocalNetworkSetting.h:88
u32 m_LocalCommunicationId
Specifies the local communication ID. Specify the value generated by LocalNetwork::CreateLocalCommuni...
Definition: local_LocalNetworkSetting.h:287
static const u32 SCAN_NETWORK_NUM_MAX
Defines the maximum number of search results that can be stored at one time when performing a network...
Definition: local_LocalNetworkSetting.h:34
Class for configuring the creation of a local network.
Definition: local_LocalNetworkSetting.h:102
LocalNetworkDescription * m_pLocalNetworkDescription
Information about the target network.
Definition: local_LocalNetworkSetting.h:161
Class that holds information about a local network.
Definition: local_LocalNetworkSetting.h:121
STATION_INFO_ROLE
Indicates the station&#39;s role (not connected, host, or client).
Definition: local_LocalNetworkSetting.h:242
STATION_INFO_ROLE m_Role
The station&#39;s role (not connected, host, or client).
Definition: local_LocalNetworkSetting.h:248
u32 m_ScanInterval
The scan interval, in milliseconds.
Definition: local_LocalNetworkSetting.h:289
Class for configuring the nearby network search feature.
Definition: local_LocalNetworkSetting.h:275
Class for configuring a connection to a local network.
Definition: local_LocalNetworkSetting.h:152
u32 m_NetworkInfoLifeTime
The holding period, in milliseconds, for the discovered network.
Definition: local_LocalNetworkSetting.h:291
This is the common base class used inside the Pia library.
Definition: common_RootObject.h:40
Class that holds information about stations connected to a local network.
Definition: local_LocalNetworkSetting.h:230