1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     uds.h
4 
5   Copyright (C) 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   $Rev: 46526 $
14  *---------------------------------------------------------------------------*/
15 
16 /*!
17     @file
18     @brief  Local Communication (UDS) API function declarations.
19 
20     :include nn/uds.h
21 */
22 
23 #ifndef NN_UDS_H_
24 #define NN_UDS_H_
25 
26 /*!
27     @defgroup nn_uds  Local Communication (UDS) Library
28     @brief  A library for local communication (wireless communication with the CTR).
29 
30 @section nn_uds_overview  Overview
31 
32 The CAFE UDS library supports only master mode, and sends the CTR UDS client to the partner. <br />
33 In addition to this API reference, see the <i>CTR Programming Manual: Wireless Communication</i> provided for the CTR. <br />
34 The CAFE UDS library is the same as the CTR UDS library except for the following points.
35 
36 - Only host mode is supported. <br />
37 - Up to nine devices can be connected, including the host. <br />
38 - The method to detect a state update is different. CTR used an <tt>Event</tt> instance initialized with the <tt>nn::uds::Cafe::Initialize</tt> function, but CAFE uses the <tt>nn::uds::PollStateChange</tt> function. <br />
39 - The default user name is different. If no user name is specified to the <tt>nn::uds::Cafe::Initialize</tt> function, CTR uses the name specified in System Settings. Cafe uses the Mii character name associated with the account that is currently logged in, if no user name is specified. <br />
40 - The boundary of the buffer passed to the API is different. For buffers passed to API functions, such as <tt>nn::uds::Cafe::Initialize</tt>, ensure that they have 64-byte boundary alignment and a byte size that is a multiple of 64. <br />
41 - Link level is not supported. Accordingly, there is no <tt>nn::uds::GetLinkLevel</tt> to get the link level. <br />
42 - Unlike CTR, Cafe does not have an error state (<tt>nn::uds::STATE_ERROR</tt>) that occurs because the wireless button was turned off or to the sleep state when the system is closed.
43 
44 @section nn_uds_notes_about_hbm  Notes About the HOME Button menu
45 
46 We recommend that you use the UDS communications library with threads running on Core 2. For more information, see the Nintendo documentation <i>Foreground and Background Processing for Games</i> (<tt>WiiU-FG_BG_Processing-en.pdf</tt>).
47 
48 When using UDS on a core besides Core 2, specify the <tt>NO_WAIT</tt> option to <tt>nn::uds::ReceiveFrom</tt> and <tt>nn::uds::PollStateChange</tt>. <br />
49 If this library is used without the <tt>NO_WAIT</tt> option specified, API functions may not return until UDS communications are complete. <br />
50 If an application switches to background mode before an API function makes its return,  API calls made before returning to foreground mode are not guaranteed to succeed. <br />
51 For UDS, even if there is no API call, the network in the UDS layer continues to be maintained.
52 
53 @section nn_uds_wifi_and_ethernet  Wi-Fi and Ethernet
54 
55 Both Wi-Fi and Ethernet are unavailable while the UDS library is being used (between successful calls to <tt>nn::uds::Cafe::Initialize</tt> and <tt>nn::uds::Cafe::Finalize</tt>).
56 
57     @{
58 */
59 
60 /*!
61     @namespace  nn::uds
62     @brief  Namespace for the Local Communication (UDS) Library.
63 
64     @}
65 */
66 #if defined(NN_PLATFORM_CTR)
67     /*!
68         @ingroup  nn_uds
69         @namespace  nn::uds::CTR
70         @brief  Namespace for the CTR Local Communication (CTR UDS) Library.
71             (The namespace <tt>nn::uds::CTR</tt> can also be shortened to <tt>nn::uds</tt>.)
72 */
73     #ifdef  __cplusplus
74         #include <nn/uds/CTR/uds_Api.h>
75         #include <nn/uds/CTR/uds_Type.h>
76         #include <nn/uds/CTR/uds_Result.h>
77         #include <nn/uds/CTR/uds_InfoElement.h>
78         #include <nn/uds/CTR/uds_ScanResultReader.h>
79         #include <nn/uds/CTR/uds_NetworkDescription.h>
80 
81         namespace nn {
82             namespace uds {
83                 using namespace nn::uds::CTR;
84             }
85         }
86 
87     #endif // __cplusplus
88 #elif defined(NN_PLATFORM_CAFE)
89     /*!
90         @ingroup  nn_uds
91         @namespace  nn::uds::Cafe
92         @brief  Namespace for the Cafe Local Communication (Cafe UDS) Library.
93             (The namespace <tt>nn::uds::Cafe</tt> can also be shortened to <tt>nn::uds</tt>.)
94 */
95     #ifdef  __cplusplus
96         #include <nn/uds/CAFE/uds_Api.h>
97         #include <nn/uds/CAFE/uds_Type.h>
98         #include <nn/uds/CAFE/uds_Result.h>
99         //#include <nn/uds/CAFE/uds_InfoElement.h>
100         //#include <nn/uds/CAFE/uds_ScanResultReader.h>
101         //#include <nn/uds/CAFE/uds_NetworkDescription.h>
102 
103         namespace nn {
104             namespace uds {
105                 using namespace nn::uds::Cafe;
106             }
107         }
108 
109     #endif // __cplusplus
110 #else
111     #error no platform selected
112 #endif
113 
114 #endif /* NN_UDS_H_ */
115