#include <glib.h>
#include <unistd.h>
#include <aul.h>
+#include <aul_complication.h>
#include <appsvc.h>
#include <stdexcept>
return std::move(ptr);
}
-void Complication::SendDataUpdateRequest() {
+int Complication::SendDataUpdateRequest() {
LOGI("emit signal comp_id %d, type %d",
impl_->complication_id_, impl_->cur_type_);
std::string provider_appid = impl_->GetProviderAppId();
const char* context_data_raw = "";
- bundle *arg_list = bundle_create();
- if (arg_list == NULL)
- std::runtime_error("bundle create failed");
-
- appsvc_set_operation(arg_list, APPSVC_OPERATION_DEFAULT);
- appsvc_set_appid(arg_list, provider_appid.c_str());
- bundle_add_str(arg_list, "__OSP_LAUNCH_TYPE__", "datacontrol");
- bundle_add_str(arg_list, AUL_K_CALLER_APPID,
- ComplicationConnector::GetInst().GetAppId().c_str());
- bundle_add_str(arg_list, AUL_K_CALLEE_APPID, provider_appid.c_str());
- bundle_add_str(arg_list, AUL_K_DATA_CONTROL_TYPE, "CORE");
-
- int pid = appsvc_run_service(arg_list, 0, NULL, NULL);
- LOGI("Launch the provider app: %d, %s", pid, provider_appid.c_str());
- bundle_free(arg_list);
+ int ret;
+
+ ret = aul_complication_update_request(ComplicationConnector::GetInst().GetAppId().c_str(),
+ provider_appid.c_str(), getuid());
+ LOGI("Launch the provider app: %d, %s", ret, provider_appid.c_str());
+
+ if (ret != AUL_R_OK) {
+ if (ret == AUL_R_EILLACC)
+ return COMPLICATION_ERROR_PERMISSION_DENIED;
+ else if (ret == AUL_R_EINVAL)
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ else
+ return COMPLICATION_ERROR_IO_ERROR;
+ }
if (impl_->context_data_ != nullptr)
context_data_raw = impl_->context_data_->ToString();
impl_->cur_type_,
context_data_raw));
LOGI("emit signal done");
+ return COMPLICATION_ERROR_NONE;
}
const char* Complication::GetProviderIdKey() {
COMPLICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
COMPLICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
COMPLICATION_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,
- COMPLICATION_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA
+ COMPLICATION_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA,
+ COMPLICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED
} complication_error;
typedef enum _complication_type {