1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: uds_Result.h 4 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 $Rev: 37513 $ 11 *--------------------------------------------------------------------------- 12 13 14 */ 15 16 #ifndef NN_UDS_CTR_UDS_RESULT_H_ 17 #define NN_UDS_CTR_UDS_RESULT_H_ 18 19 #include <nn/Result.h> 20 21 /* Please see man pages for details 22 23 */ 24 25 26 namespace nn { 27 namespace uds { 28 namespace CTR { 29 //New definitions 30 31 /* 32 33 */ 34 enum Description 35 { 36 DESCRIPTION_NETWORK_IS_FULL = 1, // 37 DESCRIPTION_WIFI_OFF = 2, // 38 DESCRIPTION_INVALID_PARAMS = 3, // 39 DESCRIPTION_MISCELLANOUS_SYSTEM_ERROR= 4, // 40 DESCRIPTION_MALFORMED_DATA = 5, // 41 DESCRIPTION_INVALID_SDK_VERSION = 6, // Non-public error: The SDK version of UDS is invalid. 42 DESCRIPTION_MAX 43 }; 44 45 /* Please see man pages for details 46 47 48 */ 49 50 /* Please see man pages for details 51 52 53 54 */ 55 NN_DEFINE_RESULT_CONST( 56 ResultNotFoundNetwork, 57 Result::LEVEL_STATUS, Result::SUMMARY_NOT_FOUND, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_FOUND 58 ); 59 60 /* Please see man pages for details 61 62 63 64 */ 65 NN_DEFINE_RESULT_CONST( 66 ResultAlreadyNetworkIsFull, 67 Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, DESCRIPTION_NETWORK_IS_FULL 68 ); 69 70 /* Please see man pages for details 71 72 73 74 */ 75 NN_DEFINE_RESULT_CONST( 76 ResultDeniedFromMaster, 77 Result::LEVEL_STATUS, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, Result::DESCRIPTION_CANCEL_REQUESTED 78 ); 79 80 /* Please see man pages for details 81 82 83 84 */ 85 NN_DEFINE_RESULT_CONST( 86 ResultConnectionTimeout, 87 Result::LEVEL_STATUS, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, Result::DESCRIPTION_TIMEOUT 88 ); 89 90 /* Please see man pages for details 91 92 93 94 */ 95 NN_DEFINE_RESULT_CONST( 96 ResultInvalidState, 97 Result::LEVEL_STATUS, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_AUTHORIZED 98 ); 99 100 /* Please see man pages for details 101 102 103 104 105 */ 106 NN_DEFINE_RESULT_CONST( 107 ResultInvalidNode, 108 Result::LEVEL_STATUS, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_FOUND 109 ); 110 111 /* Please see man pages for details 112 113 114 115 116 */ 117 NN_DEFINE_RESULT_CONST( 118 ResultOutOfResource, 119 Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_OUT_OF_MEMORY 120 ); 121 122 /* Please see man pages for details 123 124 125 126 */ 127 NN_DEFINE_RESULT_CONST( 128 ResultBufferIsFull, 129 Result::LEVEL_STATUS, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_BUSY 130 ); 131 132 /* Please see man pages for details 133 134 135 136 137 138 139 */ 140 NN_DEFINE_RESULT_CONST( 141 ResultWirelessOff, 142 Result::LEVEL_STATUS, Result::SUMMARY_STATUS_CHANGED, Result::MODULE_NN_UDS, DESCRIPTION_WIFI_OFF 143 ); 144 145 /* Please see man pages for details 146 147 148 149 */ 150 NN_DEFINE_RESULT_CONST( 151 ResultNotInitialized, 152 Result::LEVEL_USAGE, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_INITIALIZED 153 ); 154 155 /* Please see man pages for details 156 157 158 159 */ 160 NN_DEFINE_RESULT_CONST( 161 ResultAlreadyOccupiedWirelessDevice, 162 Result::LEVEL_USAGE, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_UDS, Result::DESCRIPTION_ALREADY_INITIALIZED 163 ); 164 165 /* Please see man pages for details 166 167 168 169 */ 170 NN_DEFINE_RESULT_CONST( 171 ResultOutOfRange, 172 Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_OUT_OF_RANGE 173 ); 174 175 /* Please see man pages for details 176 177 178 179 */ 180 NN_DEFINE_RESULT_CONST( 181 ResultMisalignedAddress, 182 Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_MISALIGNED_ADDRESS 183 ); 184 185 /* Please see man pages for details 186 187 188 189 */ 190 NN_DEFINE_RESULT_CONST( 191 ResultMisalignedSize, 192 Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_MISALIGNED_SIZE 193 ); 194 195 /* Please see man pages for details 196 197 198 199 */ 200 NN_DEFINE_RESULT_CONST( 201 ResultTooLarge, 202 Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_TOO_LARGE 203 ); 204 205 /* Please see man pages for details 206 207 208 209 */ 210 NN_DEFINE_RESULT_CONST( 211 ResultNotAuthorized, 212 Result::LEVEL_USAGE, Result::SUMMARY_WRONG_ARGUMENT, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_AUTHORIZED 213 ); 214 215 /* Please see man pages for details 216 217 218 219 */ 220 NN_DEFINE_RESULT_CONST( 221 ResultMiscellaneousSystemError, 222 Result::LEVEL_TEMPORARY, Result::SUMMARY_INTERNAL, Result::MODULE_NN_UDS, DESCRIPTION_MISCELLANOUS_SYSTEM_ERROR 223 ); 224 225 /* Please see man pages for details 226 227 228 229 */ 230 NN_DEFINE_RESULT_CONST( 231 ResultNotImplemented, 232 Result::LEVEL_STATUS, Result::SUMMARY_NOT_SUPPORTED, Result::MODULE_NN_UDS, Result::DESCRIPTION_NOT_IMPLEMENTED 233 ); 234 235 /* Please see man pages for details 236 237 238 239 */ 240 NN_DEFINE_RESULT_CONST( 241 ResultMalformedData, 242 Result::LEVEL_USAGE, Result::SUMMARY_CANCELLED, Result::MODULE_NN_UDS, DESCRIPTION_MALFORMED_DATA 243 ); 244 /* 245 246 */ 247 248 /****************************** 249 Errors used only in the system 250 ******************************/ 251 NN_DEFINE_RESULT_CONST( 252 ResultInvalildSdkVersion, 253 Result::LEVEL_FATAL, Result::SUMMARY_NOT_SUPPORTED, Result::MODULE_NN_UDS, DESCRIPTION_INVALID_SDK_VERSION 254 ); 255 256 /****************************** 257 The following legacy Result codes were used in the UDS library for CTR-SDK 0.10.2 and earlier. 258 For now, these codes will be left in place to maintain compatibility with legacy code. 259 We plan to remove them by the CTR-SDK 1.0 official release. Please update your code. 260 ******************************/ 261 262 /*--- Handle as success ---*/ 263 //Processing is already complete MakeResultAlreadyDone()264 inline nn::Result MakeResultAlreadyDone() 265 { 266 return ResultSuccess(); 267 } 268 269 //There was no data to obtain MakeResultNoData()270 inline nn::Result MakeResultNoData() 271 { 272 return ResultSuccess(); 273 } 274 275 /*--- Connection failure ---*/ 276 //No target network was found MakeResultNotFoundNetwork()277 inline nn::Result MakeResultNotFoundNetwork() 278 { 279 return ResultNotFoundNetwork(); 280 } 281 //Insufficient resources for target network MakeResultInsufficientResourceAtMaster()282 inline nn::Result MakeResultInsufficientResourceAtMaster() 283 { 284 return ResultAlreadyNetworkIsFull(); 285 } 286 //Connection from Master denied MakeResultDeniedFromMaster()287 inline nn::Result MakeResultDeniedFromMaster() 288 { 289 return ResultDeniedFromMaster(); 290 } 291 //Timeout during connection process MakeResultConnectionTimeout()292 inline nn::Result MakeResultConnectionTimeout() 293 { 294 return ResultConnectionTimeout(); 295 } 296 297 /*--- General errors ---*/ 298 //The current state does not allow execution MakeResultInvalidState()299 inline nn::Result MakeResultInvalidState() 300 { 301 return ResultInvalidState(); 302 } 303 //Library not initialized MakeResultNotInitialized()304 inline nn::Result MakeResultNotInitialized() 305 { 306 return ResultNotInitialized(); 307 } 308 //Already initialized MakeResultAlreadyInitialized()309 inline nn::Result MakeResultAlreadyInitialized() 310 { 311 return ResultAlreadyOccupiedWirelessDevice(); 312 } 313 //Invalid arguments MakeResultInvalidParam()314 inline nn::Result MakeResultInvalidParam() 315 { 316 return ResultOutOfRange(); 317 } 318 //Buffer is full MakeResultBufferFull()319 inline nn::Result MakeResultBufferFull() 320 { 321 return ResultBufferIsFull(); 322 } 323 //Data is too big MakeResultTooLarge()324 inline nn::Result MakeResultTooLarge() 325 { 326 return ResultTooLarge(); 327 } 328 //There are no target nodes MakeResultNotFoundTarget()329 inline nn::Result MakeResultNotFoundTarget() 330 { 331 return ResultInvalidNode(); 332 } 333 //Feature is not implemented MakeResultNotImplemented()334 inline nn::Result MakeResultNotImplemented() 335 { 336 return ResultNotImplemented(); 337 } 338 //Insufficient resources MakeResultOutOfResouece()339 inline nn::Result MakeResultOutOfResouece() 340 { 341 return ResultNotImplemented(); 342 } 343 344 345 } // namespace CTR 346 } // namespace uds 347 } // namespace nn 348 349 #endif //NN_UDS_CTR_UDS_RESULT_H_ 350