#define __TIZEN_WEB_DOWNLOAD_H__
#include <tizen.h>
+#include <bundle.h>
#ifdef __cplusplus
extern "C"
typedef enum
{
DOWNLOAD_NETWORK_DATA_NETWORK, /**< Download is available through data network */
- DOWNLOAD_NETWORK_WIFI, /**< Download is available through Wi-Fi */
+ DOWNLOAD_NETWORK_WIFI, /**< Download is available through WiFi */
DOWNLOAD_NETWORK_WIFI_DIRECT, /**< Download is available through WiFi-Direct */
- DOWNLOAD_NETWORK_ALL /**< Download is available through either data network or Wi-Fi */
+ DOWNLOAD_NETWORK_ALL /**< Download is available through either data network or WiFi */
} download_network_type_e ;
/**
+ * @brief Enumerations of notification type when client want to register
+ * @see #download_set_notification_type()
+ * @see #download_get_notification_type()
+ */
+typedef enum
+{
+ DOWNLOAD_NOTIFICATION_TYPE_NONE = 0, /**< Do not register notification */
+ DOWNLOAD_NOTIFICATION_TYPE_COMPLETE_ONLY, /**< For success state and failed state */
+ DOWNLOAD_NOTIFICATION_TYPE_ALL /**< For ongoing state, success state and failed state */
+} download_notification_type_e;
+
+
+/**
+ * @brief Enumerations of the type about notification bundle which client want to set when registering notification
+ * @see #download_set_notification_bundle()
+ * @see #download_get_notification_bundle()
+ */
+typedef enum
+{
+ DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING = 0, /**< For bundle for failed and ongoing notification */
+ DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_COMPLETE, /**< For bundle for completed notification */
+ DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_FAILED /**< For bundle for failed notification*/
+} download_notification_bundle_type_e;
+
+
+/**
* @brief Called when the download status is changed.
*
* @param [in] download The download id
/**
- * @brief Gets the netowork type for the downloaded file
+ * @brief Gets the network type for the downloaded file
*
* @param [in] download The download id
* @param [out] net_type The network type which is defined by client.
/**
* @brief Gets the name which is set by user.
*
- * @details If user do not set any name, it retruns NULL.
+ * @details If user do not set any name, it returns NULL.
*
* @remarks The @a file_name must be released with free() by you.
* @param [in] download The download id
/**
* @brief Sets the option value to register notification messages by download service module.
- * @details The tree types of notification message can be posted. Those are completion, failed and ongoing type.
+ * @details The three types of notification message can be posted. Those are completion, failed and ongoing type.
* When the notification message of failed and ongoing types from the notification tray, \n
* the client application which call this API will be launched. \n
*
* @remarks The extra param should be set together (See download_set_notification_extra_param()). \n
- * The downloading and failed notification can be registerd only if the extra param for noticiation message is set. \n
+ * The downloading and failed notification can be registered only if the extra param for notification message is set. \n
* If it is not, the client application can not know who request to launch itself. \n
* It should be necessary to understand the action operation of notification click event.
* @remarks If the competition notification message is selected from the notification tray,\n
/**
* @brief Gets the option value to register notification messages by download service module.
* @param[in] download The download id
- * @param[out] enable The boolean type. The true or false value is retruned
+ * @param[out] enable The boolean type. The true or false value is returned
* @return 0 on success, otherwise a negative error value.
* @retval #DOWNLOAD_ERROR_NONE Successful
* @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
/**
* @brief Sets the extra param data which pass by application service data when notification message is clicked
- * @details When client set the extra param data for ongoing notificaiton action, \n
+ * @details When client set the extra param data for ongoing notification action, \n
* it can get the data through service_get_extra_data() when client application is launched by notification action.
*
* @remarks This function should be called before downloading (See download_start())
* If it is not, user do not receive the download result in case the client process is not alive.
* @remarks The default value is false.
* @param[in] download The download id
- * @param[in] enable The boolean value for auto download which is defined by clinet.
+ * @param[in] enable The boolean value for auto download which is defined by client.
* @return 0 on success, otherwise a negative error value.
* @retval #DOWNLOAD_ERROR_NONE Successful
* @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
* @brief Gets the value of option for auto download.
*
* @param [in] download The download id
- * @param [out] enable The boolean value for auto download which is defined by clinet.
+ * @param [out] enable The boolean value for auto download which is defined by client.
* @return 0 on success, otherwise a negative error value.
* @retval #DOWNLOAD_ERROR_NONE Successful
* @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
* @brief Cancel the download, asynchronously.
*
* @details This function cancels the running download and its state will be #DOWNLOAD_STATE_READY
- * @remarks The cancelled download can be restarted with download_start().
+ * @remarks The canceled download can be restarted with download_start().
* @param [in] download The download id
* @return 0 on success, otherwise a negative error value.
* @retval #DOWNLOAD_ERROR_NONE Successful
/**
* @brief Gets the content name for downloading a file.
*
- * @details This can be defined with referense of HTTP response header data.
+ * @details This can be defined with reference of HTTP response header data.
* The content name can be received when HTTP response header is received.
*
* @param [in] download The download id
int download_get_http_status(int download_id, int *http_status);
/**
+ * @brief Sets bundle data to register notification messages.
+ * @details The three types of notification message can be posted. Those are completion, failed and ongoing type.
+ *
+ * @remarks When the notification message is clicked, the action is decided by bundle data. \n
+ * If the bundle data is not set, the following default operation is executed when the notification message is clicked. \n
+ * 1) Download completed state : The viewer application is executed according to extension name of downloaded content. \n
+ * 2) Download failed state and ongoing state : The client application is executed. \n
+ * @remarks This function should be called before starting download.
+ * @remarks The bundle data MUST BE FREED by client when it is not used any more.
+ * @param[in] download The download id
+ * @param[in] type The enumeration type. See #download_notification_bundle_type_e.
+ * @param[in] bundle The bundle pointer value.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED
+ * @see download_set_notification_type()
+ * @see download_get_notification_bundle()
+ */
+int download_set_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle *b);
+
+/**
+ * @brief Get the bundle data to register notification messages which is set in download_set_notification_bundle().
+ *
+ * @details When the notification message is clicked, the action is decided by bundle data. \n
+ * @param[in] download The download id
+ * @param[in] type The enumeration type. See #download_notification_bundle_type_e.
+ * @param[out] bundle The bundle pointer value.
+ * @remarks The bundle data MUST BE FREED by client when it is not used any more.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @retval #DOWNLOAD_ERROR_NO_DATA the bundle have not been set
+ * @see download_set_notification_bundle()
+ */
+int download_get_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle **b);
+
+/**
+ * @brief Set the title of notification.
+ *
+ * @details When registering notification, the title is displayed at title area of notification message
+ *
+ * @param [in] download The download id
+ * @param [in] title The title for displaying to user
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @pre If the notification option is not enable, this title is not shown to user
+ * @see #download_set_notification_type()
+ * @see #download_get_notification_title()
+ */
+int download_set_notification_title(int download_id, const char *title);
+
+/**
+ * @brief Gets the title of notification when set in #download_set_notification_title()
+ *
+ * @details When registering notification, the title is displayed at title area of notification message
+ *
+ * @param [in] download The download id
+ * @param [out] title The title for displaying to user
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @retval #DOWNLOAD_ERROR_NO_DATA the title have not been set
+ * @pre It can get the title value before calling this API.
+ * @see #download_set_notification_title()
+ */
+int download_get_notification_title(int download_id, char **title);
+
+/**
+ * @brief Set the description of notification.
+ *
+ * @details When registering notification, the description is displayed at description area of notification message
+ *
+ * @param [in] download The download id
+ * @param [in] description The description for displaying to user
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @pre If the notification option is not enable, this description is not shown to user
+ * @see #download_set_notification_type()
+ * @see #download_get_notification_description()
+ */
+int download_set_notification_description(int download_id, const char *description);
+
+/**
+ * @brief Gets the description of notification when set in #download_set_notification_description()
+ *
+ * @details When registering notification, the description is displayed at description area of notification message
+ *
+ * @param [in] download The download id
+ * @param [out] description The description for displaying to user
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @retval #DOWNLOAD_ERROR_NO_DATA the description have not been set
+ * @pre It can get the title value before calling this API.
+ * @see #download_set_notification_description()
+ */
+int download_get_notification_description(int download_id, char **description);
+
+/**
+ * @brief Sets the option value to register notification messages.
+ * @details The three types of notification message can be posted. Those are completion, failed and ongoing type.
+ *
+ * @remarks When the notification message is clicked, the action is decided by bundle data from download_set_notification_bundle(). \n
+ * If the bundle data is not set, the following default operation is executed when the notification message is clicked. \n
+ * 1) Download completed state : The viewer application is executed according to extension name of downloaded content. \n
+ * 2) Download failed state and ongoing state : The client application is executed. \n
+ * @remarks The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE.
+ * @remarks This function should be called before starting download.
+ * @param[in] download The download id
+ * @param[in] type The enumeration type. See #download_notification_type_e.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED
+ * @see download_set_notification_bundle()
+ * @see download_get_notification_type()
+ */
+int download_set_notification_type(int download_id, download_notification_type_e type);
+
+/**
+ * @brief Get the option value to register notification messages which is set in download_set_notification_type().
+ *
+ * @remarks When the notification message is clicked, the action is decided by bundle data from download_set_notification_bundle(). \n
+ * @remarks The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE.
+ * @param[in] download The download id
+ * @param[out] type The enumeration type. See #download_notification_type_e.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DOWNLOAD_ERROR_NONE Successful
+ * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID
+ * @see download_set_notification_type()
+ */
+int download_get_notification_type(int download_id, download_notification_type_e *type);
+
+/**
* @}
*/