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 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 Either the session is not initialized or there are incompatible permissions. This Result is returned if this function is called before the Initialize or the InitializePriviledged function is called. Always call the Initialize or InitializePrivileged function first when you use the BOSS library.
A value other than the above. Unexpected error (see boss_Result.h for error 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.

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) You have deleted those tasks that you can delete, but there is still no space in the database for registering new tasks. (ResultDatabaseFull)
Tasks whose execution count is zero will auto-delete when there is no space, but if the execution count is not zero, the task won't be deleted. Use the UnregisterTask function to delete tasks that can be deleted and try registering again.

Revision History

2010/09/16
Initial version.

CONFIDENTIAL