1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: boss_Task.h 4 5 Copyright (C)2009-2011 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: 38576 $ 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 29 30 #ifdef __cplusplus 31 32 namespace nn { 33 namespace boss { 34 35 /* Please see man pages for details 36 37 */ 38 class Task 39 { 40 public: 41 /* Please see man pages for details 42 43 */ 44 explicit Task(void); 45 46 /* Please see man pages for details 47 48 */ 49 virtual ~Task(void); 50 51 /* Please see man pages for details 52 53 54 55 56 57 58 59 */ 60 nn::Result Initialize(const char* pTaskId); 61 62 /* Please see man pages for details 63 64 65 66 67 68 69 70 71 72 73 74 */ UpdateInterval(u32 interval)75 inline nn::Result UpdateInterval(u32 interval){return UpdateIntervalWithSec(interval*60*60);} 76 77 /* Please see man pages for details 78 79 80 81 82 83 84 85 86 87 */ 88 nn::Result UpdateIntervalWithSec(u32 intervalSec); 89 90 /* Please see man pages for details 91 92 93 94 95 96 97 98 99 100 */ 101 nn::Result UpdateCount(u32 count); 102 103 /* Please see man pages for details 104 105 106 107 */ GetInterval(void)108 inline u32 GetInterval(void) 109 { 110 const u32 intervalSec = GetIntervalSec(); 111 if(intervalSec > 0) 112 { 113 return (intervalSec / (60*60)); 114 } 115 else 116 { 117 return 0; 118 } 119 } 120 121 /* Please see man pages for details 122 123 124 125 */ 126 u32 GetIntervalSec(void); 127 128 /* Please see man pages for details 129 130 131 132 133 */ 134 u32 GetCount(void); 135 136 /* Please see man pages for details 137 138 139 140 141 142 143 */ 144 TaskServiceStatus GetServiceStatus(void); 145 146 /* Please see man pages for details 147 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 nn::Result Start(void); 183 184 /* Please see man pages for details 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 */ 201 nn::Result StartImmediate(void); 202 203 /* Please see man pages for details 204 205 206 207 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 nn::Result StartBgImmediate(void); 239 240 /* Please see man pages for details 241 242 243 244 245 246 247 248 249 250 251 252 253 */ 254 nn::Result Cancel(void); 255 256 /* Please see man pages for details 257 258 259 260 261 262 263 264 265 266 267 268 269 270 */ 271 nn::Result WaitFinish(const nn::fnd::TimeSpan& timeout); 272 273 /* Please see man pages for details 274 275 276 277 278 279 280 281 282 283 284 285 */ 286 nn::Result WaitFinish(void); 287 288 /* Please see man pages for details 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 */ 308 TaskStateCode GetState(bool acknowledge=false, u32* pCount=NULL, u8* pStepID=NULL); 309 310 /* Please see man pages for details 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 */ 326 u32 GetHttpStatusCode(u32* pCount=NULL, u8* pStepID=NULL); 327 328 /* Please see man pages for details 329 330 331 */ 332 u32 GetCommErrorCode(u32* pCount=NULL, u8* pStepID=NULL) NN_ATTRIBUTE_DEPRECATED; 333 334 /* Please see man pages for details 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 */ 366 TaskResultCode GetResult(u32* pCount=NULL, u8* pStepID=NULL); 367 368 /* Please see man pages for details 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 */ 390 nn::Result GetStateDetail(TaskStatus* pStatus, bool acknowledge=false, u8* pStepID=NULL, u8 taskStep=CURRENT_STEP_ID); 391 392 /* Please see man pages for details 393 394 395 */ 396 nn::Result GetStatus(TaskStatus* pStatus, u8* pStepID=NULL, u8 taskStep=CURRENT_STEP_ID) NN_ATTRIBUTE_DEPRECATED; 397 398 /* Please see man pages for details 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 */ 414 nn::Result GetError(TaskError* pTaskError, u8* pStepID=NULL, u8 taskStep=CURRENT_STEP_ID); 415 416 /* Please see man pages for details 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 */ 437 nn::Result GetInfo(TaskPolicy* pPolicy, TaskAction* pAction, TaskOption* pOption, u8 taskStep=CURRENT_STEP_ID); 438 439 /* Please see man pages for details 440 441 442 443 444 445 446 447 448 449 */ 450 nn::Result GetActivePriority(TaskPriority* pPriority); 451 452 /* Please see man pages for details 453 454 455 456 */ 457 char* GetTaskId(void); 458 459 protected: 460 friend class AccessConfig; 461 TaskConfig m_Task; 462 private: 463 bool CheckTaskId(void); 464 465 }; 466 467 } // end of namespace boss 468 } // end of namespace nn 469 470 #endif // __cplusplus 471 472 #endif /* NN_BOSS_BOSS_TASK_H_ */ 473