#include <dpl/log/log.h>
namespace InstallerCallbacksTranslate {
-WrtErrStatus TranslateError(CommonError::Type status)
-{
- switch (status) {
- case CommonError::WrtSuccess:
- return WRT_SUCCESS;
-
- case CommonError::HandleNotFound:
- return WRT_ERROR_HANDLE_NOT_FOUND;
-
- case CommonError::AlreadyRunning:
- return WRT_ERROR_ALREADY_RUNNING;
-
- case CommonError::InvalidLanguage:
- return WRT_ERROR_INVALID_LANGUAGE;
-
- case CommonError::AlreadyStopped:
- return WRT_ERROR_ALREADY_STOPPED;
-
- case CommonError::StillAuthorizing:
- return WRT_ERROR_STILL_AUTHORIZING;
-
- case CommonError::EarlyKilled:
- return WRT_ERROR_EARLY_KILLED;
-
- case CommonError::AccessDenied:
- return WRT_ERROR_ACCESS_DENIED;
-
- default:
- LogError("Untranslatable error: " << status);
- return WRT_ERROR_INTERNAL;
- }
-}
-
-void StatusCallback(std::string tizenId,
- CommonError::Type result,
- void *data)
-{
- LogDebug("StatusCallback called " << tizenId << " | " << result);
- Assert(data != NULL);
-
- WrtErrStatus error = TranslateError(result);
- StatusCallbackStruct* statusCallbackStruct =
- static_cast<StatusCallbackStruct*>(data);
-
- if (statusCallbackStruct->status_callback) {
- statusCallbackStruct->status_callback(tizenId,
- error,
- statusCallbackStruct->userdata);
- } else {
- LogInfo("StatusCallback: ignoring NULL callback pointer");
- }
-
- delete statusCallbackStruct;
-}
// callback for finished install
void installFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type status)
+ std::string tizenId,
+ Jobs::WidgetInstall::Exceptions::Type status)
{
Assert(userParam != NULL);
errorStatus = WRT_SUCCESS;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorInvalidWidgetPackage:
- errorStatus = WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorWidgetDoesNotExist:
errorStatus = WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST;
break;
errorStatus = WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorOutOfDiskSpace:
- errorStatus = WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorInvalidPackage:
errorStatus = WRT_INSTALLER_ERROR_INVALID_CERTIFICATE;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorAlreadyInstalled:
- errorStatus = WRT_INSTALLER_ERROR_ALREADY_INSTALLED;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorInternal:
errorStatus = WRT_INSTALLER_ERROR_INTERNAL;
break;
// callback for finished install
void uninstallFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type status)
+ std::string tizenId,
+ Jobs::WidgetUninstall::Exceptions::Type status)
{
Assert(userParam != NULL);
}
void pluginInstallFinishedCallback(void *userParam,
- Jobs::PluginInstall::Exceptions::Type status)
+ Jobs::PluginInstall::Exceptions::Type status)
{
Assert(userParam);
// callback for progress of install OR uninstall
void installProgressCallback(void *userParam,
- ProgressPercent percent,
- const ProgressDescription &description)
+ ProgressPercent percent,
+ const ProgressDescription &description)
{
Assert(userParam != NULL);
LogInfo("installProgressCallback: ignoring NULL callback pointer");
}
}
-
} //namespace