X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fwrt-installer%2Fwrt_installer_api.h;h=bb4ff8dea16b954756162f769e48481f6242aa56;hb=22da51a3726e6645e723a56e2b199206c7610f9a;hp=6f2bea6aa033bd0471fb30711eda7617176bbc66;hpb=5d0b581548563b0b271382c1aedb900ff055cd42;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/wrt-installer/wrt_installer_api.h b/src/wrt-installer/wrt_installer_api.h old mode 100755 new mode 100644 index 6f2bea6..bb4ff8d --- a/src/wrt-installer/wrt_installer_api.h +++ b/src/wrt-installer/wrt_installer_api.h @@ -20,12 +20,6 @@ * @brief This file contains declarations of wrt_installer_api */ -/* - * @defgroup wrt_engine_group WebRunTime engine Library - * @ingroup internet_FW - * Functions to APIs to access wrt-engine - */ - #ifndef WRT_INSTALLER_API_H_ #define WRT_INSTALLER_API_H_ @@ -40,314 +34,52 @@ extern "C" { #endif -/** - * Callback function type invoked after async init function - */ typedef void (*WrtInstallerInitCallback)(WrtErrStatus status, - void *data); - -/** - * Callback function type invoked after async functions - */ + void *data); typedef void (*WrtPluginInstallerStatusCallback)(WrtErrStatus status, void *data); - -/** - * Callback function type invoked after async functions - */ typedef void (*WrtInstallerStatusCallback)(std::string tizenId, - WrtErrStatus status, - void *data); - -/** - * Callback function type invoked after async functions - */ + WrtErrStatus status, + void *data); typedef void (*WrtProgressCallback)(float percent, const char *description, void *data); -/** - * Callback function type invoked when all plugin installations are finished - */ -typedef void (*WrtAllPluginInstalledCallback)(void *userdata); - -typedef struct -{ - WrtAllPluginInstalledCallback plugin_installed_cb; - char *plugin_path; - void *user_data; -} wrt_plugin_data; - -/** - * @fn int wrt_installer_init(void *userdata, WrtInstallerInitCallback callback) - * @brief Initializes WRT - * - * This method is used to initialize wrt-engine. - * It connects to database, initializes webkit, widget and plugin logic. - * - * @param [in] userdata - User parameters to be passed to the callback - * @param [in] callback - The callback function that is launched, after - * wrt initialization. - * The callback is called in the context of the - * application's main loop. - * - * @return 0 on success, -1 on failure - * - * Sample code: - * @code - * int main (int argc, char *argv[]) - * { - * init_loop(argc, argv); - * printf("Initializing WRT"); - * wrt_init(NULL, &init_cb); - * - * wait_for_wrt_init(); - * printf("Starting tests"); - * - * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc, - * argv); - * - * wrt_installer_shutdown(); - * quit_loop(); - * return status; - * } - * @endcode - * - * @see wrt_installer_shutdown - */ -typedef enum wrt_widget_install_mode_e +enum WrtInstallMode { - /** - * Raw install bit flags - */ - WRT_WIM_NOT_INSTALLED = (1 << 0), - WRT_WIM_INCOMING_VERSION_NOT_STD = (1 << 1), - WRT_WIM_EXISTING_VERSION_NOT_STD = (1 << 2), - WRT_WIM_BOTH_VERSIONS_NOT_STD = (1 << 3), - WRT_WIM_EXISTING_VERSION_OLDER = (1 << 4), - WRT_WIM_EXISTING_VERSION_EQUAL = (1 << 5), - WRT_WIM_EXISTING_VERSION_NEWER = (1 << 6), - - /** - * Update default policies - */ - - /* Never update policy - */ - WRT_WIM_POLICY_NEVER_UPDATE = WRT_WIM_NOT_INSTALLED, - - /* WAC update policy - */ - WRT_WIM_POLICY_WAC = WRT_WIM_NOT_INSTALLED | - WRT_WIM_EXISTING_VERSION_OLDER, - - /* Always update policy - */ - WRT_WIM_POLICY_ALWAYS_INSTALL = WRT_WIM_NOT_INSTALLED | - WRT_WIM_INCOMING_VERSION_NOT_STD | - WRT_WIM_EXISTING_VERSION_NOT_STD | - WRT_WIM_BOTH_VERSIONS_NOT_STD | - WRT_WIM_EXISTING_VERSION_OLDER | - WRT_WIM_EXISTING_VERSION_EQUAL | - WRT_WIM_EXISTING_VERSION_NEWER, - - /* Force install policy - */ - WRT_WIM_POLICY_FORCE_INSTALL = WRT_WIM_POLICY_ALWAYS_INSTALL, - /* Installation from directory - forced update - */ - WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL -} wrt_widget_update_mode_t; - -int wrt_installer_init(void *userdata, - WrtInstallerInitCallback callback); - -/** - * @fn void wrt_installer_shutdown(void) - * @brief Deinitializes WRT - * - * This method is used to deinitialize wrt-engine. - * It deinitializes widget logic, plugin logic, shuts down connection to - * database, switchs back to single thread and does deinit checks. - * - * @return nothing - * - * Sample code: - * @code - * int main (int argc, char *argv[]) - * { - * init_loop(argc, argv); - * printf("Initializing WRT"); - * wrt_init(NULL, &init_cb); - * - * wait_for_wrt_init(); - * printf("Starting tests"); - * - * int status = DPL_TestRunnerSingleton_Instance().ExecTestRunner(argc, - * argv); - * - * wrt_installer_shutdown(); - * quit_loop(); - * return status; - * } - * @endcode - * - * @see wrt_init - */ + WRT_INSTALL_MODE_UNKNOWN = 0, + WRT_INSTALL_MODE_INSTALL_WGT, + WRT_INSTALL_MODE_INSTALL_DIRECTORY, + WRT_INSTALL_MODE_INSTALL_PRELOAD, + WRT_INSTALL_MODE_REINSTALL +}; + +void wrt_installer_init( + void *userdata, + WrtInstallerInitCallback callback); void wrt_installer_shutdown(void); - -/** - * @fn void wrt_install_widget(const char *widget_package_path, - * void *user_parameter, - * WrtInstallerStatusCallback status_callback, - * WrtProgressCallback progress_callback, - * wrt_widget_update_mode_t update_mode, - * bool quiet, - * bool preload); - * - * @brief Installs widget from given path - * - * This method is used to install widget from a given path. - * - * @param [in] widget_package_path Path of the widget package. - * @param [in] user_parameter User parameters to be passed to the callback - * @param [in] status_cb Call to this one will be done at the end of - * operation - * The callback is called in the context of the - * application's - * @param [in] progress_cb Callback function to get data of install - * progress - * If you don't want to get progress data, this - * should be NULL - * @param [in] install_mode Installation mode - * @param [in] quiet quiet mode - * @param [in] preload preload widget install - * @return Nothing (status returned in callback). - * - * Sample code: - * @code - * wrt_install_widget(path.c_str(), - * NULL, - * install_cb, - * progress_cb, - * WRT_WIM_POLICY_WAC, - * false, - * false); - * @endcode - * - * @see wrt_installer_uninstall_widget - */ -void wrt_install_widget(const char *path, - void *user_parameter, - WrtInstallerStatusCallback status_callback, - WrtProgressCallback progress_callback, - wrt_widget_update_mode_t update_mode, - bool quiet, - bool preload, - std::shared_ptr pkgmgrInterface - ); - -/** - * @fn void wrt_installer_uninstall_widget (const char * const pkg_name, - * void* userdata, - * WrtInstallerStatusCallback cb) - * @brief Uninstalls widget using its name - * - * This method is used to uninstall the widget specified by its pkgname. - * The callback function is called when the uninstall operation is done. - * - * @param [in] pkg_name - package name - * @param [in] userdata - user parameters to be passed to the callback - * @param [in] status_cb - Call to this one will be done at the end of - * operation - * The callback is called in the context of the - application's - * @param [in] progress_cb - Callback function to get data of install progress - * If you don't want to get progress data, this - * should be NULL - * - * @return nothing (status returned in callback). - * - * Sample code: - * @code //TODO SAMPLE - * wrt_installer_uninstall_widget( appId, NULL, uninstall_cb, progress_cb); - * @endcode - * - * @see wrt_installer_install_widget - */ -void wrt_uninstall_widget (const char * const pkg_name, - void* userdata, - WrtInstallerStatusCallback status_cb, - WrtProgressCallback progress_cb, - std::shared_ptr pkgmgrSignalInterface); - -/** - * @fn void wrt_install_plugin(const char *pluginDirectory, - * void *userData, - * WrtInstallerStatusCallback statusCallback, - * WrtProgressCallback progressCallback) - * - * @brief Installs plugin from given path - * - * This method installs new plugin from specified location and calls a callback - * function when the operation is done. - * - * @param [in] pluginDirectory - plugin directory - * @param [in] userData - user parameters to be passed to the callback - * @param [in] statusCallback - user callback to call after installation - * @param [in] progressCallback - user callback to call when plugin - * installation progress has changed - * - * @return nothing (status returned in callback). - * - * Sample code: - * @code - * wrt_install_plugin("/usr/lib/wrt-plugins/",NULL,NULL,NULL); - * @endcode - * - * @see wrt_install_plugin - */ +void wrt_install_widget( + const char *path, + void *user_parameter, + WrtInstallerStatusCallback status_callback, + WrtProgressCallback progress_callback, + WrtInstallMode install_mode, + bool quiet, + std::shared_ptr + pkgmgrInterface + ); +void wrt_uninstall_widget ( + const char * const tzAppid, + void* userdata, + WrtInstallerStatusCallback status_cb, + WrtProgressCallback progress_cb, + std::shared_ptr + pkgmgrSignalInterface); void wrt_install_plugin(const char *pluginDirectory, - void *userData, - WrtPluginInstallerStatusCallback statusCallback, - WrtProgressCallback progressCallback); + void *userData, + WrtPluginInstallerStatusCallback statusCallback, + WrtProgressCallback progressCallback); -/** - * @brief To install plugins for first excution - * - * This method install plugins - * - * @return nothing - */ -void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb, - void *user_param); - -/** - * @brief To initialize for tests - * - * This method is wrt init for tests - * - * @return int - */ -int wrt_installer_init_for_tests(void *userdata, - WrtInstallerInitCallback callback); - -/** - * @brief To shutdown for tests - * - * This method is wrt shutdown for tests - * - * @return int - */ -void wrt_installer_shutdown_for_tests(); - -/** - * @brief wrt_get_widget_by_guid Returns pkgname by pkg guid (widgetId) - * @param pkgname pkgname argument ot be set - * @param guid guid that we look for - * @return error code - */ -WrtErrStatus wrt_get_widget_by_guid(std::string &pkgname, const std::string guid); #ifdef __cplusplus } #endif