nn::boss::RegisterTask Function

Syntax

nn::Result RegisterTask(
Task * pTask,
TaskPolicy * pPolicy,
TaskAction * pAction,
TaskOption * pOption = NULL,
u8 taskStep = DEFAULT_STEP_ID
);

Arguments

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)

Return Values

Returns the function's execution result. Returns one of the 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 invalid. 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. (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 Either the session had not been initialized or there were incompatible permissions. This Result value is returned if you call this function before Initialize or InitializePrivileged. Always call Initialize or InitializePrivileged first when you use the BOSS library.
A value other than the above. Unexpected error (see boss_Result.h for details).

Description

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.

Here are some common task registration errors and the how to handle them:

(1) Storage was not registered when registering the NSA download task (ResultStorageNotFound)
Register the NSA download tasking using RegisterStorage.

(2) A task with the same name has been registered already (ResultTaskIdAlreadyExist)
Delete the pertinent task with UnregisterTask or make re-use of the already registered task.

(3) Removable tasks have been deleted but there is no space in the database for registering a task (ResultDatabaseFull).
Tasks that have counted down to zero are automatically deleted when there is no space, but tasks that have not counted down to zero are not deleted. Use UnregisterTask to delete removable tasks and try registering again.

Revision History

2010/09/16
Initial version.

CONFIDENTIAL