nn::boss::RegisterTask Functionnn::Result RegisterTask( Task * pTask, TaskPolicy * pPolicy, TaskAction * pAction, TaskOption * pOption = NULL, u8 taskStep = DEFAULT_STEP_ID );
| Name | Description | |
|---|---|---|
| in | pTask | Specifies a task name. You can use a name of up to seven characters. |
| in | pPolicy | Specifies a task policy. |
| in | pAction | Specifies a task action. (Currently, you can only specify NsaDownloadAction or DownloadAction.) |
| in | pOption | Specifies task options. (Optional) |
| in | taskStep | Specifies a task step ID. (May be omitted if there is only one task step to be executed) |
Result values listed below. | Value | Description |
|---|---|
ResultSuccess |
Registration successful. |
ResultInvalidTaskId |
The task ID pointer is NULL or a zero-length string. |
ResultInvalidPolicy |
The policy information pointer is NULL. |
ResultInvalidAction |
The task action pointer is NULL. |
ResultInvalidTaskPriolity |
The task priority specification is out of range. Confirm that it is in the range of TaskPriority. |
ResultTaskPermissionOutOfRange |
The task permission information is out of range. Confirm that it is in the range of TaskPermission. |
ResultSchedulingPolicyOutOfRange |
The scheduling policy is out of range. Confirm that it is in the range of SchedulingPolicy. |
ResultInvalidTaskTargetDuration |
The task duration is invalid. (This is for future extensibility.) |
ResultActionCodeOutOfRange |
The task action code is out of range. Confirm that it is in the range of Action. |
ResultInvalidUrl |
The URL string pointer is NULL or a zero-length string. |
ResultApInfoTypeOutOfRange |
The AP information type is out of range. Confirm that it is in the range of ApInfoType. |
ResultInvalidFilePath |
The file path string pointer is NULL or a zero-length string. |
ResultInvalidOption |
The task option pointer is NULL, or the option code is out of range. Confirm that it is in the range of ExecOption. |
ResultStorageNotFound |
Storage has not been registered for the corresponding application ID. |
ResultTaskIdAlreadyExist |
Another task of the same name is already registered. |
ResultDatabaseFull |
Storage and tasks cannot be registered because the maximum number of registered application IDs and tasks has been reached. |
ResultIpcNotSessionInitialized |
The session has not been initialized. This result is returned if this function is called before the Initialize function. Always call the Initialize function first thing when you use the BOSS library. |
| A value other than the above. | Unexpected error (see boss_Result.h for error details). |
Registers a task to the library.
You can register two types of tasks: raw download tasks and NSA download tasks. To register a task, you must prepare the TaskPolicy class and the DownloadAction class, which is a subclass of the TaskAction class; or you must prepare the NsaDownloadAction class and the (optional) TaskOption 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 Initialize function. You can also schedule and run a registered task by calling the Task class's Start function.
Common task registration errors
(1) The NS archive download task is registered but storage is not registered. (ResultStorageNotFound)
Use the RegisterStorage function to register storage for the NS archive download task.
(2) A task with the same name is already registered. (ResultTaskIdAlreadyExist)
Either use the UnregisterTask function to delete the task in question or reuse the already-registered task. (3) The task cannot be registered because there is no available space in the task database due to the fact that the task database is full and there are no removable tasks.ResultDatabaseFull
When the task database is full, tasks with a remaining execution count of zero are automatically deleted, and new tasks can be successfully registered. However, this error occurs when there are no tasks with a remaining execution count of zero and no tasks can be deleted. When the database contains any tasks that can be unregistered by the application itself, you can resolve the issue by deleting those tasks using the UnregisterTask function and then attempting registration of the new task again.(An application can get a list of task IDs registered by the executed application by executing the GetTaskIdList function. ) Or, if you wait awhile, the execution count of other tasks (including the tasks of other applications) will reach zero and task registration will succeed. You can therefore also resolve this problem by waiting awhile (until the next time the application starts, for example) and retrying task registration later.
CONFIDENTIAL