1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: boss_Task.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. 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: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_BOSS_BOSS_TASK_H_ 17 #define NN_BOSS_BOSS_TASK_H_ 18 19 #include <nn/fnd/fnd_TimeSpan.h> 20 #include <nn/boss/boss_Const.h> 21 #include <nn/boss/boss_Result.h> 22 #include <nn/boss/boss_Types.h> 23 #include <nn/boss/boss_TaskAction.h> 24 #include <nn/boss/boss_TaskPolicy.h> 25 #include <nn/boss/boss_TaskStatus.h> 26 #include <nn/boss/boss_TaskError.h> 27 #include <nn/boss/boss_TaskOption.h> 28 #include <nn/boss/boss_TaskQuery.h> 29 30 31 #ifdef __cplusplus 32 33 namespace nn { 34 namespace boss { 35 36 /* Please see man pages for details 37 38 */ 39 class Task 40 { 41 public: 42 /* Please see man pages for details 43 44 */ 45 explicit Task(void); 46 47 /* Please see man pages for details 48 49 */ 50 virtual ~Task(void); 51 52 /* Please see man pages for details 53 54 55 56 57 58 59 60 */ 61 nn::Result Initialize(const char* pTaskId); 62 63 /* Please see man pages for details 64 65 66 67 68 69 70 71 72 73 74 75 */ UpdateInterval(u32 interval)76 inline nn::Result UpdateInterval(u32 interval){return UpdateIntervalWithSec(interval*60*60);} 77 78 /* Please see man pages for details 79 80 81 82 83 84 85 86 87 88 */ 89 nn::Result UpdateIntervalWithSec(u32 intervalSec); 90 91 /* Please see man pages for details 92 93 94 95 96 97 98 99 100 101 */ 102 nn::Result UpdateCount(u32 count); 103 104 /* Please see man pages for details 105 106 107 108 */ GetInterval(void)109 inline u32 GetInterval(void) 110 { 111 const u32 intervalSec = GetIntervalSec(); 112 if(intervalSec > 0) 113 { 114 return (intervalSec / (60*60)); 115 } 116 else 117 { 118 return 0; 119 } 120 } 121 122 /* Please see man pages for details 123 124 125 126 */ 127 u32 GetIntervalSec(void); 128 129 /* Please see man pages for details 130 131 132 133 134 */ 135 u32 GetCount(void); 136 137 /* Please see man pages for details 138 139 140 141 142 143 144 */ 145 TaskServiceStatus GetServiceStatus(void); 146 147 /* Please see man pages for details 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 */ 186 nn::Result Start(void); 187 188 /* Please see man pages for details 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 */ 205 nn::Result StartImmediate(void); 206 207 /* Please see man pages for details 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 */ 250 nn::Result StartBgImmediate(void); 251 252 /* Please see man pages for details 253 254 255 256 257 258 259 260 261 262 263 264 265 */ 266 nn::Result Cancel(void); 267 268 /* Please see man pages for details 269 270 271 272 273 274 275 276 277 278 279 280 281 282 */ 283 nn::Result WaitFinish(const nn::fnd::TimeSpan& timeout); 284 285 /* Please see man pages for details 286 287 288 289 290 291 292 293 294 295 296 297 */ 298 nn::Result WaitFinish(void); 299 300 /* Please see man pages for details 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 */ 320 TaskStateCode GetState(bool acknowledge=false, u32* pCount=NULL, u8* pStepId=NULL); 321 322 /* Please see man pages for details 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 */ 338 u32 GetHttpStatusCode(u32* pCount=NULL, u8* pStepId=NULL); 339 340 /* Please see man pages for details 341 342 343 */ 344 u32 GetCommErrorCode(u32* pCount=NULL, u8* pStepId=NULL) NN_ATTRIBUTE_DEPRECATED; 345 346 /* Please see man pages for details 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 */ 378 TaskResultCode GetResult(u32* pCount=NULL, u8* pStepId=NULL); 379 380 /* Please see man pages for details 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 */ 402 nn::Result GetStateDetail(TaskStatus* pStatus, bool acknowledge=false, u8* pStepId=NULL, u8 taskStep=CURRENT_STEP_ID); 403 404 /* Please see man pages for details 405 406 407 */ 408 nn::Result GetStatus(TaskStatus* pStatus, u8* pStepId=NULL, u8 taskStep=CURRENT_STEP_ID) NN_ATTRIBUTE_DEPRECATED; 409 410 /* Please see man pages for details 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 */ 426 nn::Result GetError(TaskError* pTaskError, u8* pStepId=NULL, u8 taskStep=CURRENT_STEP_ID); 427 428 /* Please see man pages for details 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 */ 449 nn::Result GetInfo(TaskPolicy* pPolicy, TaskAction* pAction, TaskOption* pOption, u8 taskStep=CURRENT_STEP_ID); 450 451 /* Please see man pages for details 452 453 454 455 456 457 458 459 460 461 */ 462 nn::Result GetActivePriority(TaskPriority* pPriority); 463 464 /* Please see man pages for details 465 466 467 468 469 470 471 472 473 474 */ 475 nn::Result SetQuery(TaskQuery* pQuery); 476 477 /* Please see man pages for details 478 479 480 481 482 483 484 485 486 487 */ 488 nn::Result GetQuery(TaskQuery* pQuery); 489 490 /* Please see man pages for details 491 492 493 494 */ 495 char* GetTaskId(void); 496 497 protected: 498 friend class AccessConfig; 499 TaskConfig m_Task; 500 private: 501 bool CheckTaskId(void); 502 503 }; 504 505 } // end of namespace boss 506 } // end of namespace nn 507 508 #endif // __cplusplus 509 510 #endif /* NN_BOSS_BOSS_TASK_H_ */ 511