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<title>RegisterTask</title>
8  </head>
9  <body>
10<h1><CODE>nn::boss::RegisterTask</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14<a href="../../nn/Result/Overview.html">nn::Result</a> RegisterTask(
15     <a href="../../nn/boss/Task/Overview.html">Task</a> * pTask,
16     <a href="../../nn/boss/TaskPolicy/Overview.html">TaskPolicy</a> * pPolicy,
17     <a href="../../nn/boss/TaskAction/Overview.html">TaskAction</a> * pAction,
18     <a href="../../nn/boss/TaskOption/Overview.html">TaskOption</a> * pOption = NULL,
19     u8 taskStep = DEFAULT_STEP_ID
20);
21</pre>
22    </div>
23<h2>Arguments</h2>
24    <div class="section">
25      <table class="arguments">
26        <thead>
27          <tr>
28            <td width="15" />
29<th>Name</th>
30<td>Description</td>
31          </tr>
32        </thead>
33        <tr>
34<td>in</td>
35<th>pTask</th>
36<td>Specifies a task name. You can use a name of up to seven characters.</td>
37        </tr>
38        <tr>
39<td>in</td>
40<th>pPolicy</th>
41<td>Specifies a task policy.</td>
42        </tr>
43        <tr>
44<td>in</td>
45<th>pAction</th>
46<td>Specifies a task action.( For example, <a href="../../nn/boss/NsaDownloadAction/Overview.html"><CODE>NsaDownloadAction</CODE></a>.)</td>
47        </tr>
48        <tr>
49<td>in</td>
50<th>pOption</th>
51<td>Specifies task options. (Optional)</td>
52        </tr>
53        <tr>
54<td>in</td>
55<th>taskStep</th>
56<td>Specifies a task step ID. (May be omitted if there is only one task step to be executed)</td>
57        </tr> </table>
58    </div>
59<h2>Return Values</h2>
60<div class="section">Returns the function's execution result. Returns one of the <a href="../../nn/Result/Overview.html"><CODE>Result</CODE></A></a> values listed below. <br />
61      <table class="arguments">
62        <thead>
63          <tr>
64<th>Value</th>
65<td>Description</td>
66          </tr>
67        </thead>
68        <tr>
69<th><CODE>ResultSuccess</CODE></th>
70<td>Registration successful.</td>
71        </tr>
72        <tr>
73<th><CODE>ResultInvalidTaskId</CODE></th>
74<td>The task ID pointer is <CODE>NULL</CODE> or a zero-length string.</td>
75        </tr>
76        <tr>
77<th><CODE>ResultInvalidPolicy</CODE></th>
78<td>The policy information pointer is <CODE>NULL</CODE>.</td>
79        </tr>
80        <tr>
81<th><CODE>ResultInvalidAction</CODE></th>
82<td>The task action pointer is <CODE>NULL</CODE>.</td>
83        </tr>
84        <tr>
85<th><CODE>ResultInvalidTaskPriolity</CODE></th>
86<td>The task priority specification is out-of-range. Confirm that it is in the range of <CODE><a href="../../nn/boss/TaskPriority.html">TaskPriority</a></CODE>.</td>
87        </tr>
88        <tr>
89<th><CODE>ResultTaskPermissionOutOfRange</CODE></th>
90<td>The task permission information is out of range. Confirm that it is in the range of <CODE><a href="../../nn/boss/TaskPermission.html">TaskPermission</a></CODE>.</td>
91        </tr>
92        <tr>
93<th><CODE>ResultSchedulingPolicyOutOfRange</CODE></th>
94<td>The scheduling policy is out of range. Confirm that it is in the range of <CODE><a href="../../nn/boss/SchedulingPolicy.html">SchedulingPolicy</a></CODE>.</td>
95        </tr>
96        <tr>
97<th><CODE>ResultInvalidTaskTargetDuration</CODE></th>
98<td>The task duration is invalid. (This is for future extensibility.)</td>
99        </tr>
100        <tr>
101<th><CODE>ResultActionCodeOutOfRange</CODE></th>
102<td>The task action code is out of range. Confirm that it is in the range of <CODE><a href="../../nn/boss/Action.html">Action</a></CODE>.</td>
103        </tr>
104        <tr>
105<th><CODE>ResultInvalidUrl</CODE></th>
106<td>The URL string pointer is <CODE>NULL</CODE> or a zero-length string.</td>
107        </tr>
108        <tr>
109<th><CODE>ResultApInfoTypeOutOfRange</CODE></th>
110<td>The AP information type is out of range. Confirm that it is in the range of <CODE><a href="../../nn/boss/ApInfoType.html">ApInfoType</a></CODE>.</td>
111        </tr>
112        <tr>
113<th><CODE>ResultInvalidFilePath</CODE></th>
114<td>The file path string pointer is <CODE>NULL</CODE> or a zero-length string.</td>
115        </tr>
116        <tr>
117<th><CODE>ResultInvalidOption</CODE></th>
118<td>The task option pointer is <CODE>NULL</CODE>, or the <CODE>option</CODE> code is out of range. Confirm that it is in the range of <CODE><a href="../../nn/boss/ExecOption.html">ExecOption</a></CODE>.</td>
119        </tr>
120        <tr>
121<th><CODE>ResultStorageNotFound</CODE></th>
122<td>Storage has not been registered for the corresponding application ID.</td>
123        </tr>
124        <tr>
125<th><CODE>ResultTaskIdAlreadyExist</CODE></th>
126<td>Another task of the same name is already registered.</td>
127        </tr>
128        <tr>
129<th><CODE>ResultDatabaseFull</CODE></th>
130<td>Storage and tasks cannot be registered because the maximum number of registered application IDs and tasks has been reached.</td>
131        </tr>
132        <tr>
133<th><CODE>ResultIpcNotSessionInitialized</CODE></th>
134<td>The session has not been initialized. This result is returned if this function is called before the <CODE><a href="../../nn/boss/Initialize.html">Initialize</A></CODE> function. Always call the <CODE>Initialize</CODE> function first thing when you use the BOSS library. </td>
135        </tr>
136        <tr>
137<th>A value other than the above.</th>
138<td>Unexpected error (see <CODE>boss_Result.h</CODE> for error details).</td>
139        </tr>
140      </table> </div>
141<h2>Description</h2>
142    <div class="section">
143<p>Registers a task to the library.</p><p>To register tasks, you must prepare the <a href="../../nn/boss/TaskPolicy/Overview.html"><CODE>TaskPolicy</CODE></a> class, a subclass of the <a href="../../nn/boss/TaskAction/Overview.html"><CODE>TaskAction</CODE></a> class (such as <a href="../../nn/boss/NsaDownloadAction/Overview.html"><CODE>NsaDownloadAction</CODE></a>), and the optional <a href="../../nn/boss/TaskOption/Overview.html"><CODE>TaskOption</CODE></a> class. See the topic for each class for more information on which attributes must be set. After you have finished registering a task, you can reuse each of these instances as necessary by calling the <CODE>Initialize</CODE> function. You can schedule and run a registered task by calling the <a href="../../nn/boss/Task/Overview.html"><CODE>Task</CODE></a> class's <CODE>Start</CODE> function.<br /> <br /><B>Common task registration errors</B><br /><br />(1) An NSA download task is registered when no storage has been registered (<a href="../../nn/boss/ResultStorageNotFound/Overview.html"><CODE>ResultStorageNotFound</CODE></a>).<br />Use the <a href="../../nn/boss/RegisterStorage.html"><CODE>RegisterStorage</CODE></a> function to register storage for the NSA download task.<br /><br />(2) A task with the same name is already registered (<a href="../../nn/boss/ResultTaskIdAlreadyExist/Overview.html"><CODE>ResultTaskIdAlreadyExist</CODE></a>).<br />Either use the <a href="../../nn/boss/UnregisterTask.html"><CODE>UnregisterTask</CODE></a> function to delete one of the tasks in question or reuse the task that has already been registered.<br /><br />(3) The task cannot be registered because the task database is full and no existing tasks can be deleted (<a href="../../nn/boss/ResultDatabaseFull/Overview.html"><CODE>ResultDatabaseFull</CODE></a>).<br />When the task database is full, tasks with a remaining execution count of zero are automatically deleted so that new tasks can be registered successfully. However, if no tasks can be deleted because none of them have a remaining execution count of zero, this error occurs. If it is possible to delete any of the tasks registered by the application itself, you can resolve this issue by deleting one of those tasks by using the <a href="../../nn/boss/UnregisterTask.html"><CODE>UnregisterTask</CODE></a> function and then attempting to register the new task again.(The application can run the <a href="../../nn/boss/GetTaskIdList.html"><CODE>GetTaskIdList</CODE></a> function to get a list of the task IDs for tasks it has registered.)<br /> Alternatively, after some time elapses, it is possible that the execution count of some other task (maybe even some other application's task) will reach zero, allowing your task to be registered successfully.<br /> You can therefore also resolve this problem by waiting awhile (until the next time the application starts, for example) and retrying task registration later.<br /><br /></p><!-- write here --></div>
144<h2>Revision History</h2>
145    <div class="section">
146      <dl class="history">
147        <dt>2010/09/16</dt>
148<dd>Initial version.<br />
149        </dd>
150      </dl>
151    </div>
152  <hr><p>CONFIDENTIAL</p></body>
153</html>
154