1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7 <style type="text/css"><!-- 8 span.static_style 9 { 10 font-size : 8pt; 11 color : white; 12 font-weight : bold; 13 background : #44f; 14 border-left : solid 1px #aaf; 15 border-top : solid 1px #aaf; 16 border-right : solid 1px #00c; 17 border-bottom : solid 1px #00c; 18 padding-left : 2px; 19 padding-right : 2px; 20 } 21 22 span.virtual_style 23 { 24 font-size : 8pt; 25 color : white; 26 font-weight : bold; 27 background : #0a0; 28 border-left : solid 1px #0f0; 29 border-top : solid 1px #0f0; 30 border-right : solid 1px #060; 31 border-bottom : solid 1px #060; 32 padding-left : 2px; 33 padding-right : 2px; 34 } 35 36 span.protected_style 37 { 38 font-size : 8pt; 39 color : white; 40 font-weight : bold; 41 background : #444; 42 border-left : solid 1px #ccc; 43 border-top : solid 1px #ccc; 44 border-right : solid 1px #222; 45 border-bottom : solid 1px #222; 46 padding-left : 2px; 47 padding-right : 2px; 48 } 49 --></style> 50<title>nn::boss::Task</title> 51 </head> 52 <body> 53<h1><CODE>nn::boss::Task</CODE> Class</h1> 54<h2>Syntax</h2> 55 <div class="section"> 56<pre class="definition">class Task</pre> 57 </div> 58<h2>Description</h2> 59 <div class="section"> 60<p>Class for representing tasks. Use this to do such things as register or unregister a task, or for task operations.</p><!-- write here --></div> 61 <a name="function" id="function"> 62<h2>Member Functions</h2> 63 <div class="section"> 64 <table class="members"> 65 <tr> 66 <td width="100"> </td> 67 <th> 68<a href="../../../nn/boss/Task/Task.html"><CODE>Task</CODE></a> 69 </th> 70<td>Constructor.</td> 71 </tr> 72 <tr> 73<td width="100"> <span class="virtual_style" title="virtual">V</span> 74 </td> 75 <th> 76<a href="../../../nn/boss/Task/~Task.html"><CODE>~Task</CODE></a> 77 </th> 78<td>Destructor.</td> 79 </tr> 80 <tr> 81 <td width="100"> </td> 82 <th> 83<a href="../../../nn/boss/Task/Initialize.html"><CODE>Initialize</CODE></a> 84 </th> 85<td>Initializes the registered task with the specified task ID. This initialization makes it possible to reuse objects.</td> 86 </tr> 87 <tr> 88 <td width="100"> </td> 89 <th> 90<a href="../../../nn/boss/Task/UpdateInterval.html"><CODE>UpdateInterval</CODE></a> 91 </th> 92<td>Updates the execution interval for a task after registration. This can be changed even after a task has been instructed to start executing. The valid execution interval ranges from 1 to 3 hours.</td> 93 </tr> 94 <tr> 95 <td width="100"> </td> 96 <th> 97<a href="../../../nn/boss/Task/UpdateIntervalWithSec.html"><CODE>UpdateIntervalWithSec</CODE></a> 98 </th> 99<td>Updates the execution interval for a task after registration. The units are seconds. This can be changed even after a task has been instructed to start executing.</td> 100 </tr> 101 <tr> 102 <td width="100"> </td> 103 <th> 104<a href="../../../nn/boss/Task/UpdateCount.html"><CODE>UpdateCount</CODE></a> 105 </th> 106<td>Updates the execution count for a task after registration. This can be changed even after a task has been instructed to start executing. Specify <CODE>UNLIMITED_COUNT</CODE> for an unlimited execution count.</td> 107 </tr> 108 <tr> 109 <td width="100"> </td> 110 <th> 111<a href="../../../nn/boss/Task/GetInterval.html"><CODE>GetInterval</CODE></a> 112 </th> 113<td>Gets the execution interval. The units are hours. This can be changed even after a task has been instructed to start executing.</td> 114 </tr> 115 <tr> 116 <td width="100"> </td> 117 <th> 118<a href="../../../nn/boss/Task/GetIntervalSec.html"><CODE>GetIntervalSec</CODE></a> 119 </th> 120<td>Gets the execution interval. The units are seconds.</td> 121 </tr> 122 <tr> 123 <td width="100"> </td> 124 <th> 125<a href="../../../nn/boss/Task/GetCount.html"><CODE>GetCount</CODE></a> 126 </th> 127<td>Gets the execution count. Checks the execution count. This function can be used to check whether the count has decreased, so it can be changed. </td> 128 </tr> 129 <tr> 130 <td width="100"> </td> 131 <th> 132<a href="../../../nn/boss/Task/GetServiceStatus.html"><CODE>GetServiceStatus</CODE></a> 133 </th> 134<td>Gets the service status of a task. Applications can check a service's status when they detect a notification from the server indicating that the service was discontinued. If the server has not been accessed since the task was registered, the status will be <CODE>SERVICE_UNKNOWN</CODE>.</td> 135 </tr> 136 <tr> 137 <td width="100"> </td> 138 <th> 139<a href="../../../nn/boss/Task/Start.html"><CODE>Start</CODE></a> 140 </th> 141<td>Starts a task. The scheduled tasks will automatically run in the background when infrastructure connections are enabled. When a task finishes running, the execution count specified in the task's attributes will be decremented by 1, regardless of whether the execution resulted in an error. As a result, unless the execution count is 0, the task will be run again after the execution interval specified in the task's attributes. Tasks whose execution counts reach zero may be deleted automatically if the internal database is filled to capacity. In the following circumstances, tasks won't be scheduled for execution even if a command is issued to start a task. <br />• The task's execution count is 0.<br />• The task's execution priority is <CODE>PRIORITY_STOPPED</CODE>.<br />• Parental Controls are enabled and not deactivated through the task attributes.<br />• The user has not yet agreed to the EULA, and agreement to the EULA hasn't been disabled through the task attributes.<br />• Task execution was stopped in the policy list that was downloaded from a Nintendo Zone access point.<br />• The server hosting the download service issued a "service suspended" notice.<br />• The administrator has temporarily suspended all tasks.<br />As a confirmation method for common cases, it is possible to use the <A><CODE>GetCount</CODE></A> function to confirm the execution count. Parental controls and the EULA consent can be configured with the <CODE>Config</CODE> tool. When the administrator has temporarily paused all tasks, <span>TASK_PAUSED</span> will be returned by the <A><CODE>GetState</CODE></A> function, so identification is possible. <br /> The following methods can be used to wait for task completion.・・Wait for execution to complete with the <A><CODE>WaitFinish</CODE></A> function. ・Specify a maximum waiting time and wait for execution to complete with the <A><CODE>WaitFinish</CODE></A> function. ・The use of polling of the execution completion task is possible by using the <A><CODE>GetState</CODE></A> function. ・Wait for a new arrival event with a registered <CODE>Event</CODE> using the <A><CODE>RegisterNewArrivalEvent</CODE></A> function, and then when completion is detected, you can confirm task status with the <A><CODE>GetState</CODE></A> function, task execution results code with the <A><CODE>GetResult</CODE></A> function amd HTTP communication results code with the <A><CODE>GetHttpStatusCode</CODE></A> function. More detailed information is available at <A><CODE>GetStateDetail</CODE></A>. <br /></td> 142 </tr> 143 <tr> 144 <td width="100"> </td> 145 <th> 146<a href="../../../nn/boss/Task/StartImmediate.html"><CODE>StartImmediate</CODE></a> 147 </th> 148<td>Starts a task immediately. This can only be called after infrastructure connections are enabled. Advance task execution is possible at scheduled times, so this is applicable for immediate execution of tasks that would have normally run in the background. However, execution priority is inherited as an attribute value when a task is registered, so if there if a task arrives with higher priority, note that it will take precedence. The difference with <A><CODE>Start</CODE></A> is that if the execution time has already come and communication has been disconnected, the task execution result will be an error without waiting for a resume state. Another point to note is that when you want to execute the target task only once, you should set the execution count to 1. Setting it to a higher value will mean it will auto-run in the background like a normal task until its execution count reaches zero. See <a href="../../../nn/ac/CTR/Connect.html"><CODE>ac::Connect</CODE></a> for information about how to enable infrastructure connections.</td> 149 </tr> 150 <tr> 151 <td width="100"> </td> 152 <th> 153<a href="../../../nn/boss/Task/Cancel.html"><CODE>Cancel</CODE></a> 154 </th> 155<td>Cancels a running task. You can use the <a href="../../../nn/boss/Task/Start.html"><CODE>Start</CODE></a> function to restart a task that has been canceled. For the cancel state task, calling the <A><CODE>GetState</CODE></A> function will return <span>TASK_STOPPED</span> as the task state.</td> 156 </tr> 157 <tr> 158 <td width="100"> </td> 159 <th> 160<a href="../../../nn/boss/Task/WaitFinish.html"><CODE>WaitFinish</CODE></a> 161 </th> 162<td>Waits for a task to finish within the specified time. This is the same as <a href="../../../nn/boss/Task/WaitFinish.html"><CODE>WaitFinish</CODE></a> except that it also has a timeout feature. If the timestamp indicating when the URL was modified is the same as the previous timestamp, the task downloads nothing and fails to complete. </td> 163 </tr> 164 <tr> 165 <td width="100"> </td> 166 <th> 167<a href="../../../nn/boss/Task/GetState.html"><CODE>GetState</CODE></a> 168 </th> 169<td>Gets the task state. In most cases, tasks transition from step 1 through 5 below. <br />(1) <CODE>TASK_REGISTERED</CODE> (task registered)<br />(2) <CODE>TASK_WAITING_TIMER</CODE> (wait for time after calling <CODE>Start</CODE>)<br />(3) <CODE>TASK_WAITING</CODE> (waiting for execution)<br />(4) <CODE>TASK_RUNNING</CODE> or <CODE>TASK_RETRY</CODE> (task running)<br />(5) <CODE>TASK_DONE</CODE> or <CODE>TASK_ERROR</CODE> (task complete)<br /><br />There are also two special states, <CODE>TASK_PAUSED</CODE> (paused) and <CODE>TASK_STOPPED</CODE> (stopped due to a call to <CODE>Cancel</CODE>). State transitions may occur in a short period of time. Accordingly, the function may not always return all states. </td> 170 </tr> 171 <tr> 172 <td width="100"> </td> 173 <th> 174<a href="../../../nn/boss/Task/GetHttpStatusCode.html"><CODE>GetHttpStatusCode</CODE></a> 175 </th> 176<td>Gets the communication error code. The following is an example of common response codes in HTTP communication.<br />200: A normal HTTP communication result.<br />206: A normal HTTP communication result, but still continuing to receive data. <br />401: The basic authentication result was not correct. Do not use because basic authentication is not supported. <br />404: The URL content could not be found. Check whether the URL was correct, or whether the content has been deleted. <br />403: A URL has been specified for which access is not granted. Check that the URL is correct. <br />500: An error occurred as a result of a server problem. Contact the server administrator.<br /></td> 177 </tr> 178 <tr> 179 <td width="100"> </td> 180 <th> 181<a href="../../../nn/boss/Task/GetCommErrorCode.html"><CODE>GetCommErrorCode</CODE></a> 182 </th> 183<td>This is the old (deprecated) name for <CODE>nn::boss::GetHttpStatusCode</CODE>. Avoid using this: it only exists for compatibility.</td> 184 </tr> 185 <tr> 186 <td width="100"> </td> 187 <th> 188<a href="../../../nn/boss/Task/GetResult.html"><CODE>GetResult</CODE></a> 189 </th> 190<td>Gets the task result code. For more information on task result codes, see <a href="../../../nn/boss/TaskResultCode.html"><CODE>TaskResultCode</CODE></a>.<br /><br /> <B>Notes about common errors that occur during task execution:</B><br /><br />(1) When infrastructure communication was interrupted:<br /><CODE>HTTP_ERROR_RECV</CODE><br /><CODE>HTTP_ERROR_CONNECT</CODE><br /><br />(2) When the connection to the server failed because the server indicated by the URL could not be found:<br /><CODE>HTTP_ERROR_DNS</CODE><br /><CODE>HTTP_ERROR_CONNECT</CODE><br /><br />(3) When the connection to the server failed because HTTPS negotiation failed:<br /><CODE>SSL_ERROR_FAILED</CODE><br /><CODE>SSL_ERROR_VERIFY_COMMON_NAME</CODE><br /><CODE>SSL_ERROR_VERIFY_ROOT_CA</CODE><br /><CODE>SSL_ERROR_VERIFY_CHAIN</CODE><br /><CODE>SSL_ERROR_VERIFY_DATE</CODE><br /><br />(4) When an NSA download failed because there is insufficient space in NSA storage:<br /><CODE>NSA_ERROR_STORAGE_INSUFFICIENCY</CODE><br /><br />(5) When an NSA download failed because the file was either not in NSA format or was corrupted due to a communication error:<br /><CODE>NSA_ERROR_INVALID_FORMAT</CODE><br /><CODE>NSA_ERROR_VERIFY_HASH</CODE><br /><CODE>NSA_ERROR_VERIFY_SIGNATURE</CODE><br /><CODE>NSA_NSD_ERROR_VERIFY_HASH</CODE><br /><CODE>NSA_NSD_ERROR_VERIFY_SIGNATURE</CODE><br /><CODE>NSA_NSD_ERROR_INVALID_FORMAT</CODE></span><br /><br /></td> 191 </tr> 192 <tr> 193 <td width="100"> </td> 194 <th> 195<a href="../../../nn/boss/Task/GetStateDetail.html"><CODE>GetStateDetail</CODE></a> 196 </th> 197<td>Gets the task status. You must prepare a <a href="../../../nn/boss/TaskStatus/Overview.html"><CODE>TaskStatus</CODE></a> instance beforehand. Note that this instance requires approximately 128 bytes of memory. See the <CODE>GetProperty</CODE> member function of the <a href="../../../nn/boss/TaskStatus/Overview.html"><CODE>TaskStatus</CODE></a> class for more information about obtaining the values of the attributes.</td> 198 </tr> 199 <tr> 200 <td width="100"> </td> 201 <th> 202<a href="../../../nn/boss/Task/GetStatus.html"><CODE>GetStatus</CODE></a> 203 </th> 204<td>This is the old (deprecated) name for <CODE>nn::boss::GetStateDetail</CODE>. Avoid using this: it only exists for compatibility.</td> 205 </tr> 206 <tr> 207 <td width="100"> </td> 208 <th> 209<a href="../../../nn/boss/Task/GetError.html"><CODE>GetError</CODE></a> 210 </th> 211<td>Gets the task error state. You must prepare a <a href="../../../nn/boss/TaskError/Overview.html"><CODE>TaskError</CODE></a> instance beforehand. Note that this instance requires approximately 136 bytes of memory.</td> 212 </tr> 213 <tr> 214 <td width="100"> </td> 215 <th> 216<a href="../../../nn/boss/Task/GetInfo.html"><CODE>GetInfo</CODE></a> 217 </th> 218<td>Gets information about a registered task. You must prepare instances of the <a href="../../../nn/boss/TaskPolicy/Overview.html"><CODE>TaskPolicy</CODE></a>, <a href="../../../nn/boss/TaskAction/Overview.html"><CODE>TaskAction</CODE></a>, and <a href="../../../nn/boss/TaskOption/Overview.html"><CODE>TaskOption</CODE></a> classes beforehand. See the <CODE>GetProperty</CODE> member function of each class for more information about obtaining the values of the attributes.</td> 219 </tr> 220 <tr> 221 <td width="100"> </td> 222 <th> 223<a href="../../../nn/boss/Task/GetTaskId.html"><CODE>GetTaskId</CODE></a> 224 </th> 225<td>Gets the task ID.</td> 226 </tr> </table> 227 </div> 228 </a> 229<h2>Revision History</h2> 230 <div class="section"> 231 <dl class="history"> 232 <dt>2010/09/16</dt> 233<dd>Initial version.<br /> 234 </dd> 235 </dl> 236 </div> 237 <hr><p>CONFIDENTIAL</p></body> 238</html>