1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     uds_Result.h
4 
5   Copyright (C) 2009-2011 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: 56250 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_UDS_CAFE_UDS_RESULT_H_
17 #define NN_UDS_CAFE_UDS_RESULT_H_
18 
19 #include <nn/Result.h>
20 
21 /*! @file
22 @brief UDS library result values.
23 */
24 
25 
26 namespace nn {
27 namespace uds {
28 namespace Cafe {
29 //New definitions.
30 
31 /*!
32 @ingroup nn_uds
33 @defgroup    nn_uds_result  Local Communication (UDS) Results
34 @brief A list of <tt>Results</tt> used in the Local Communication (UDS) library.
35     @{
36 */
37 
38     /*!
39         @private
40 @brief <tt>Result</tt> code details.
41     */
42     enum Description
43     {
44         DESCRIPTION_NETWORK_IS_FULL          = 1,        //!< Could not connect because the maximum number of stations that can connect to the network has been reached.
45 //      DESCRIPTION_WIFI_OFF                 = 2,        //   Failed because the system is in wireless off mode.
46         DESCRIPTION_INVALID_PARAMS           = 3,        //!< A parameter error other than <tt>@ref nn::uds::Cafe::ResultOutOfRange</tt>, <tt>@ref nn::uds::Cafe::ResultTooLarge</tt>, or <tt>@ref ResultNotAuthorized</tt>.
47 //      DESCRIPTION_MISCELLANOUS_SYSTEM_ERROR= 4,        // The function failed because of a system error. It may succeed if called again.
48         DESCRIPTION_MALFORMED_DATA           = 5,        //!< Detected the possibility of tampering.
49         DESCRIPTION_INVALID_SDK_VERSION      = 6,        //   Non-public error: the UDS SDK version is invalid.
50         DESCRIPTION_SYSTEM_ERROR             = 7,        //!< The function failed because of a system error.
51         DESCRIPTION_UNKNOWN                  = 8,        //   Unknown error.
52         DESCRIPTION_PENDING                  = 9,        //   The process is put on hold.
53         DESCRIPTION_NO_ACCOUNT               = 10,       //   The current account is not set.
54         DESCRIPTION_MAX
55     };
56 
57 #ifdef NN_UDS_SUPPORT_CLIENT
58 /*!
59 @class nn::uds::Cafe::ResultNotFoundNetwork
60 Indicates that the network to which a connection was attempted using <tt>ConnectNetwork</tt> was not found.
61 */
62     NN_DEFINE_RESULT_CONST(
63         ResultNotFoundNetwork,
64         Result::LEVEL_STATUS, Result::SUMMARY_NOT_FOUND, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_FOUND
65     );
66 
67 /*!
68 @class nn::uds::Cafe::ResultAlreadyNetworkIsFull
69 @brief Indicates that the network to which a connection was attempted using <tt>ConnectNetwork</tt> is full. (The number of devices connected to that network has already reached the maximum.)
70 */
71     NN_DEFINE_RESULT_CONST(
72         ResultAlreadyNetworkIsFull,
73         Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, DESCRIPTION_NETWORK_IS_FULL
74     );
75 
76 /*!
77 @class nn::uds::Cafe::ResultDeniedFromMaster
78 @brief Indicates that the attempt to connect to the network using <tt>@ref ConnectNetwork</tt> was denied by the host.
79 If the host application is not intentionally prohibiting connection, this error may also occur when the connection cannot be made because of poor signal quality.
80 */
81     NN_DEFINE_RESULT_CONST(
82         ResultDeniedFromMaster,
83         Result::LEVEL_STATUS, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, Result::DESCRIPTION_CANCEL_REQUESTED
84     );
85 
86 /*!
87 @class nn::uds::Cafe::ResultConnectionTimeout
88 @brief The connection to the network using the <tt>@ref ConnectNetwork</tt> function timed out.
89 */
90     NN_DEFINE_RESULT_CONST(
91         ResultConnectionTimeout,
92         Result::LEVEL_STATUS, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, Result::DESCRIPTION_TIMEOUT
93     );
94 #endif
95 
96 /*!
97 @class nn::uds::Cafe::ResultAlreadyNetworkIsFull
98 @brief Indicates that the network has already reached the maximum number of connected devices.
99 */
100     NN_DEFINE_RESULT_CONST(
101         ResultAlreadyNetworkIsFull,
102         Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, DESCRIPTION_NETWORK_IS_FULL
103     );
104 
105 /*!
106 @class nn::uds::Cafe::ResultInvalidState
107 @brief Indicates that the function cannot run in the current library state. This result can also occur if the connection is lost during communication.
108 */
109     NN_DEFINE_RESULT_CONST(
110         ResultInvalidState,
111         Result::LEVEL_STATUS, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_AUTHORIZED
112     );
113 
114 /*!
115 @class nn::uds::Cafe::ResultInvalidNode
116 @brief Indicates that the node with the specified node ID does not exist on the network.
117 This result can also occur when the node attempts to send a packet to itself, or when the connection target disconnects from the network.
118 */
119     NN_DEFINE_RESULT_CONST(
120         ResultInvalidNode,
121         Result::LEVEL_STATUS, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_FOUND
122     );
123 
124 /*!
125 @class nn::uds::Cafe::ResultOutOfResource
126 @brief Indicates that the library is out of resources. This result is returned when the size of the receive buffer specified using the <tt>@ref Attach</tt> function exceeds that of the buffer specified when <tt>@ref Initialize</tt> was called.
127 
128 */
129     NN_DEFINE_RESULT_CONST(
130         ResultOutOfResource,
131         Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_OUT_OF_MEMORY
132     );
133 
134 /*!
135 @class nn::uds::Cafe::ResultBufferIsFull
136 @brief This mostly occurs if <tt>@ref SendTo</tt> is called with high frequency, and send operations get backed up. The data being sent is lost if an error occurs.
137 */
138     NN_DEFINE_RESULT_CONST(
139         ResultBufferIsFull,
140         Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_BUSY
141     );
142 
143 #if 0
144 /*!
145 @class nn::uds::Cafe::ResultWirelessOff
146 @brief Indicates that the system entered wireless-disabled mode after the UDS library was initialized.
147 
148 After the system enters wireless-disabled mode and until <tt>@ref Finalize</tt> is called, the UDS library interprets the wireless state as disabled even if the system subsequently enters wireless-enabled mode.
149 To use UDS communication again, you must rerun the <tt>@ref Initialize</tt> function in wireless-enabled mode.
150 */
151     NN_DEFINE_RESULT_CONST(
152         ResultWirelessOff,
153         Result::LEVEL_STATUS, Result::SUMMARY_STATUS_CHANGED, Result::MODULE_NN_UDS, DESCRIPTION_WIFI_OFF
154     );
155 #endif
156 
157 /*!
158 @class nn::uds::Cafe::ResultBusy
159 @brief Indicates that the process is busy.
160 */
161     NN_DEFINE_RESULT_CONST(
162     ResultBusy,
163     Result::LEVEL_STATUS, Result::SUMMARY_NOTHING_HAPPENED, Result::MODULE_NN_UDS, Result::DESCRIPTION_BUSY
164     );
165 
166 /*!
167 @class nn::uds::Cafe::ResultNotInitialized
168 @brief Indicates that the library has not been initialized. This error can be resolved by calling the <tt>@ref Initialize</tt> function.
169 */
170     NN_DEFINE_RESULT_CONST(
171         ResultNotInitialized,
172         Result::LEVEL_USAGE, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_INITIALIZED
173     );
174 
175 /*!
176 @class nn::uds::Cafe::ResultAlreadyOccupiedWirelessDevice
177 @brief UDS communication cannot be used at the moment because other communication is already in progress.
178 */
179     NN_DEFINE_RESULT_CONST(
180         ResultAlreadyOccupiedWirelessDevice,
181         Result::LEVEL_USAGE, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_ALREADY_INITIALIZED
182     );
183 
184 /*!
185 @class nn::uds::Cafe::ResultOutOfRange
186 @brief Indicates that one or more of the arguments were set to values outside their valid ranges.
187 */
188     NN_DEFINE_RESULT_CONST(
189         ResultOutOfRange,
190         Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_OUT_OF_RANGE
191     );
192 
193 /*!
194 @class nn::uds::Cafe::ResultMisalignedAddress
195 @brief Indicates that the address alignment is invalid.
196 */
197     NN_DEFINE_RESULT_CONST(
198         ResultMisalignedAddress,
199         Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_MISALIGNED_ADDRESS
200     );
201 
202 /*!
203 @class nn::uds::Cafe::ResultMisalignedSize
204 @brief Indicates that the size alignment is invalid.
205 */
206     NN_DEFINE_RESULT_CONST(
207         ResultMisalignedSize,
208         Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_MISALIGNED_SIZE
209     );
210 
211 /*!
212 @class nn::uds::Cafe::ResultTooLarge
213 @brief Indicates that one or more of the arguments had data that exceeded the maximum size. This error occurs for functions that send data.
214 */
215     NN_DEFINE_RESULT_CONST(
216         ResultTooLarge,
217         Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_TOO_LARGE
218     );
219 
220 /*!
221 @class nn::uds::Cafe::ResultNotAuthorized
222 @brief Indicates that one or more of the arguments contain a value that is permitted only in special cases.
223 */
224     NN_DEFINE_RESULT_CONST(
225         ResultNotAuthorized,
226         Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_AUTHORIZED
227     );
228 
229 #if 0
230 /*!
231 @class nn::uds::Cafe::ResultMiscellaneousSystemError
232 @brief A temporary failure resulting from something on the system side. Normally, if you retry with the same arguments, the function succeeds.
233 */
234     NN_DEFINE_RESULT_CONST(
235         ResultMiscellaneousSystemError,
236         Result::LEVEL_TEMPORARY, Result::SUMMARY_INTERNAL, Result::MODULE_NN_UDS, DESCRIPTION_MISCELLANOUS_SYSTEM_ERROR
237     );
238 #endif
239 
240 /*!
241 @class nn::uds::Cafe::ResultNotImplemented
242 @brief The function is defined but not implemented.
243 */
244     NN_DEFINE_RESULT_CONST(
245         ResultNotImplemented,
246         Result::LEVEL_STATUS, Result::SUMMARY_NOT_SUPPORTED, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_IMPLEMENTED
247     );
248 
249 /*!
250 @class nn::uds::Cafe::ResultMalformedData
251 @brief Indicates that the data is not correct, and that the received data may have been tampered with.
252 */
253     NN_DEFINE_RESULT_CONST(
254         ResultMalformedData,
255         Result::LEVEL_USAGE, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, DESCRIPTION_MALFORMED_DATA
256     );
257 /*!
258 @class nn::uds::Cafe::ResultInvalidPointer
259 @brief Indicates that an invalid pointer was passed as a parameter.
260 */
261     NN_DEFINE_RESULT_CONST(
262         ResultInvalidPointer,
263         Result::LEVEL_USAGE, Result::SUMMARY_INVALID_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_INVALID_POINTER
264     );
265 
266 #if 0
267 /*!
268 :private
269 @class nn::dlp::Cafe::ResultRequestCanceled
270 @brief Request canceled.
271 */
272     NN_DEFINE_RESULT_CONST(
273         ResultRequestCanceled,
274         Result::LEVEL_STATUS, Result::SUMMARY_INVALID_STATE , Result::MODULE_NN_UDS, Result::DESCRIPTION_CANCEL_REQUESTED
275     );
276 #endif
277 
278     /*!
279 @class nn::uds::Cafe::ResultNotFound
280 @brief Not found.
281     */
282         NN_DEFINE_RESULT_CONST(
283             ResultNotFound,
284             Result::LEVEL_TEMPORARY, Result::SUMMARY_NOT_FOUND, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_FOUND
285         );
286 
287 /******************************
288 Errors used only by the system.
289  ******************************/
290     NN_DEFINE_RESULT_CONST(
291         ResultInvalildSdkVersion,
292         Result::LEVEL_FATAL, Result::SUMMARY_NOT_SUPPORTED, Result::MODULE_NN_UDS, DESCRIPTION_INVALID_SDK_VERSION
293     );
294 
295     NN_DEFINE_RESULT_CONST(
296         ResultSystemError,
297         Result::LEVEL_FATAL, Result::SUMMARY_INTERNAL, Result::MODULE_NN_UDS, DESCRIPTION_SYSTEM_ERROR
298     );
299 
300     NN_DEFINE_RESULT_CONST(
301         ResultNoAccount,
302         Result::LEVEL_FATAL, Result::SUMMARY_NOT_FOUND, Result::MODULE_NN_UDS, DESCRIPTION_NO_ACCOUNT
303     );
304 
305     NN_DEFINE_RESULT_CONST(
306         ResultRequestPending,
307         Result::LEVEL_INFO, Result::SUMMARY_SUCCESS, Result::MODULE_NN_UDS, DESCRIPTION_PENDING
308     );
309 
310 
311     NN_DEFINE_RESULT_CONST(
312         ResultUnknown,
313         Result::LEVEL_PERMANENT, Result::SUMMARY_NOT_SUPPORTED, Result::MODULE_NN_UDS, DESCRIPTION_UNKNOWN
314     );
315 
316     NN_DEFINE_RESULT_CONST(
317         ResultAlreadyNetworkIsFull,
318         Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, DESCRIPTION_NETWORK_IS_FULL
319     );
320 
321 /*!
322     @}
323 */
324 
325 } // namespace Cafe
326 } // namespace uds
327 } // namespace nn
328 
329 #endif //NN_UDS_CAFE_UDS_RESULT_H_
330