/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
extern "C" {
#endif
+/**
+ * @file watchface-complication-provider.h
+ * @brief This file contains APIs for Complication provider.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE
+ * @{
+ */
+
struct complication_provider_s {
const char *provider_id;
const char *provider_name;
*/
int complication_provider_setup_get_context(app_control_h handle, bundle **context);
+/*
+ * @}
+ */
+
#ifdef __cplusplus
}
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ws->NotifyDataUpdate();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int complication_provider_setup_reply_to_editor(
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bundle* setting_data;
bundle_raw* raw_data = NULL;
int raw_len;
+ int ret;
char buf[32];
if (provider_id.empty() || type < 0)
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
setting_data = bundle_create();
if (setting_data == NULL) {
LOGE("bundle_create failed");
- return -1;
+ return COMPLICATION_ERROR_OUT_OF_MEMORY;
}
snprintf(buf, sizeof(buf), "%d", static_cast<int>(type));
bundle_encode(setting_data, &raw_data, &raw_len);
bundle_free(setting_data);
- if (EditablesManager::GetInst().StoreSetting(comp_id, raw_data) != 0) {
+ ret = EditablesManager::GetInst().StoreSetting(comp_id, raw_data);
+ if (ret != COMPLICATION_ERROR_NONE) {
free(raw_data);
- return -1;
+ return ret;
}
- free(raw_data);
- return 0;
+ free(raw_data);
+ return COMPLICATION_ERROR_NONE;
}
std::string Complication::Impl::GetProviderAppId() {
}
int Complication::UpdateLastDataIdx() {
+ int ret;
- if (impl_->StoreSetting(impl_->complication_id_, impl_->cur_provider_id_,
- impl_->cur_type_) != 0)
- return -1;
+ ret = impl_->StoreSetting(impl_->complication_id_, impl_->cur_provider_id_,
+ impl_->cur_type_);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
impl_->last_data_idx_ = impl_->cur_data_idx_;
LOGI("update last data idx : %d", impl_->last_data_idx_);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int Complication::SetCurDataIdx(int cur_data_idx) {
if (cur_data_idx < 0 || cur_data_idx >= (int)impl_->candidates_list_.size()) {
LOGE("Invalid index");
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
}
if (impl_->cur_data_idx_ == cur_data_idx) {
LOGI("Same with cur data idx skip setting process");
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
Bundle& data = GetCurData();
if (data.GetRaw() == NULL) {
LOGI("GetCurData failed");
- return -1;
+ return COMPLICATION_ERROR_NO_DATA;
}
bundle_get_str(data.GetRaw(), impl_->provider_id_key_.c_str(), &provider_id);
-1, impl_.get());
LOGI("subscribe signal %d", impl_->subscribe_id_);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
const char* Complication::GetCurProviderId() {
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int ret = EditablesManager::GetInst().StoreSetting(impl_->id_, raw_data);
free(raw_data);
- if (ret != 0)
- return -1;
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
impl_->last_data_idx_ = impl_->cur_data_idx_;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int DesignElement::SetCurDataIdx(int cur_data_idx) {
if (cur_data_idx < 0 || cur_data_idx >= (int)impl_->candidates_list_.size()) {
LOGE("Invalid index");
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
}
LOGI("set cur data %d", cur_data_idx);
impl_->cur_data_idx_ = cur_data_idx;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
const std::string& DesignElement::GetName() {
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (ed == NULL) {
if (str_raw)
free(str_raw);
- return -1;
+ return COMPLICATION_ERROR_OUT_OF_MEMORY;
}
bundle_add(ed, "EDITABLE_ID", std::to_string(i.get()->GetId()).c_str());
if (container == NULL) {
if (str_raw)
free(str_raw);
- return -1;
+ return COMPLICATION_ERROR_OUT_OF_MEMORY;
}
bundle_add_str_array(container, "EDITABLE_LIST", list_arr.get(), list_idx);
impl_->watcher_id_ = ComplicationConnector::GetInst().Watch(editor_id,
this->impl_.get());
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
void EditablesContainer::OnUpdate(const IEditable& ed, int selected_idx,
int EditablesContainer::Add(std::shared_ptr<IEditable> ed) {
if (ed == nullptr)
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
impl_->ed_list_.push_back(ed);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int EditablesContainer::Remove(std::shared_ptr<IEditable> ed) {
if (ed == nullptr)
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
for (auto& i : impl_->ed_list_) {
if (i.get() == ed.get()) {
}
}
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
} // namespace watchface_complication
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (r != SQLITE_OK) {
LOGE("sqlite3_exec error(query = %s, error = %s)", query, error);
sqlite3_free(error);
- return -1;
+ return COMPLICATION_ERROR_DB;
}
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
extern "C" {
#endif
+/**
+ * @brief Enumeration for Complication Error
+ */
typedef enum _complication_error {
COMPLICATION_ERROR_NONE = TIZEN_ERROR_NONE,
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_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED
+ COMPLICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ COMPLICATION_ERROR_DB = TIZEN_ERROR_COMPLICATION | 0x1, /**< DB Error */
+ COMPLICATION_ERROR_DBUS = TIZEN_ERROR_COMPLICATION | 0x2, /**< DBUS Error */
+ COMPLICATION_ERROR_EDIT_NOT_READY = TIZEN_ERROR_COMPLICATION | 0x3, /**< Edit not ready */
} complication_error;
+/**
+ * @brief Enumeration for Complication Type.
+ * @since_tizen 5.0
+ */
typedef enum _complication_type {
- COMPLICATION_NO_DATA = 0x01,
- COMPLICATION_SHORT_TEXT = 0x02,
- COMPLICATION_LONG_TEXT = 0x04,
- COMPLICATION_RANGED_VALUE = 0x08,
- COMPLICATION_TIME = 0x10,
- COMPLICATION_ICON = 0x20,
- COMPLICATION_IMAGE = 0x40,
- COMPLICATION_TYPE_MAX = COMPLICATION_NO_DATA |
- COMPLICATION_SHORT_TEXT |
- COMPLICATION_LONG_TEXT |
- COMPLICATION_RANGED_VALUE |
- COMPLICATION_TIME |
- COMPLICATION_ICON |
- COMPLICATION_IMAGE,
+ COMPLICATION_NO_DATA = 0x01, /**< No Data */
+ COMPLICATION_SHORT_TEXT = 0x02, /**< Short Text */
+ COMPLICATION_LONG_TEXT = 0x04, /**< Long Text */
+ COMPLICATION_RANGED_VALUE = 0x08, /**< Ranged Value */
+ COMPLICATION_TIME = 0x10, /**< Time */
+ COMPLICATION_ICON = 0x20, /**< Icon */
+ COMPLICATION_IMAGE = 0x40, /**< Image */
} complication_type;
#ifdef __cplusplus
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
extern "C" {
#endif
+/**
+ * @file watchface-complication.h
+ * @brief This file contains APIs and enumerations for Watchface complication.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE
+ * @{
+ */
typedef enum _complication_shape_type {
COMPLICATION_SHAPE_CIRCLE,
COMPLICATION_SHAPE_RECT
int complication_get_type(const bundle *candidate,
complication_type *cur_type);
+/**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
extern "C" {
#endif
+/**
+ * @file watchface-editable.h
+ * @brief This file contains APIs and enumerations for Watchface editable.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE
+ * @{
+ */
+
typedef void *editable_h;
typedef void *editable_container_h;
typedef struct _editable_geo {
int editable_on_edit_ready_cb_del(on_edit_ready cb);
int editable_load_current_data(int editable_id, bundle **current_data);
+/**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int ReceivedEditable::UpdateLastDataIdx() {
impl_->last_data_idx_ = impl_->cur_data_idx_;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
Bundle& ReceivedEditable::GetCurData() {
int ReceivedEditable::SetCurDataIdx(int cur_data_idx) {
if (cur_data_idx < 0 || cur_data_idx >= (int)impl_->candidates_list_.size()) {
LOGE("Invalid index");
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
}
impl_->cur_data_idx_ = cur_data_idx;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
const std::string& ReceivedEditable::GetName() {
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef WATCHFACE_COMPLICATION_SHARED_HANDLE_H_
#define WATCHFACE_COMPLICATION_SHARED_HANDLE_H_
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int support_types, complication_shape_type shape_type,
complication_h *created_handle) {
if (support_types < COMPLICATION_NO_DATA ||
- support_types > COMPLICATION_TYPE_MAX)
+ support_types > (COMPLICATION_NO_DATA |
+ COMPLICATION_SHORT_TEXT |
+ COMPLICATION_LONG_TEXT |
+ COMPLICATION_RANGED_VALUE |
+ COMPLICATION_TIME |
+ COMPLICATION_ICON |
+ COMPLICATION_IMAGE))
return COMPLICATION_ERROR_INVALID_PARAMETER;
try {
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
delete sh;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int complication_get_cur_provider_id(complication_h handle,
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
de.get()->SetName(std::string(editable_name));
ec->Add(de);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_add_complication(editable_container_h handle,
ec->Add(SharedHandle<IEditable>::Share(sh));
LOGI("Add comp %d", edit_id);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_request_edit(editable_container_h handle,
LOGI("Request edit to %s", editor_appid);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_on_edit_ready_cb_add(on_edit_ready cb,
auto ci = new ReadyCallbackInfo(cb, user_data);
__container->AddReadyCallbackInfo(ci);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_on_edit_ready_cb_del(on_edit_ready cb) {
if (cb == NULL)
return COMPLICATION_ERROR_INVALID_PARAMETER;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_cur_data_idx(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
*idx = ie->GetCurDataIdx();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_set_cur_data_idx(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
ie->SetCurDataIdx(idx);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_cur_data(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
Bundle& data = ie->GetCurData();
*cur_data = data.GetRaw();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_nth_data(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
Bundle& data = ie->GetNthData(nth);
*cur_data = data.GetRaw();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_editable_id(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
*editable_id = ie->GetId();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_geometry(const editable_h handle,
editable_geo *geo) {
if (handle == NULL || geo == NULL)
return COMPLICATION_ERROR_INVALID_PARAMETER;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_candidates_list(const editable_h handle,
- GList **candiates_list) {
- if (handle == NULL || candiates_list == NULL)
+ GList **candidates_list) {
+ if (handle == NULL || candidates_list == NULL)
return COMPLICATION_ERROR_INVALID_PARAMETER;
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_get_editable_name(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
if (!ie->GetName().empty())
*editable_name = ie->GetName().c_str();
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_set_editable_name(const editable_h handle,
IEditable* ie = static_cast<IEditable*>(handle);
ie->SetName(std::string(editable_name));
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editable_load_current_data(int editable_id,
bundle **selected_data) {
+ if (selected_data == NULL)
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+
std::unique_ptr<Bundle> setting_data =
EditablesManager::GetInst().LoadSetting(editable_id);
if (setting_data != nullptr)
*selected_data = bundle_dup(setting_data.get()->GetRaw());
else
return COMPLICATION_ERROR_NO_DATA;
+
return COMPLICATION_ERROR_NONE;
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int EditablesEditor::EditPreview(IEditable& ed, int cur_data_idx) {
if (impl_->edit_appid_.empty()) {
LOGE("Editing is not ready");
- return -1;
+ return COMPLICATION_ERROR_EDIT_NOT_READY;
}
ReceivedEditable& re = static_cast<ReceivedEditable&>(ed);
g_variant_new("(iis)", cur_data_idx, ed.GetId(),
(context == nullptr) ? "" : context->ToString()));
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int EditablesEditor::EditComplete() {
if (impl_->edit_appid_.empty()) {
LOGE("Editing is not ready");
- return -1;
+ return COMPLICATION_ERROR_EDIT_NOT_READY;
}
ComplicationConnector::GetInst().EmitSignal(
ComplicationConnector::GetInst().GetCmdStr(
ComplicationConnector::EditableEditComplete), NULL);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int EditablesEditor::EditCancel() {
if (impl_->edit_appid_.empty()) {
LOGE("Editing is not ready");
- return -1;
+ return COMPLICATION_ERROR_EDIT_NOT_READY;
}
ComplicationConnector::GetInst().EmitSignal(
ComplicationConnector::GetInst().GetCmdStr(
ComplicationConnector::EditableEditCancel), NULL);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
int EditablesEditor::NotifyEditReady(std::string appid) {
if (appid.empty())
- return -1;
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
ComplicationConnector::GetInst().EmitSignal(
ComplicationConnector::Editable,
ComplicationConnector::GetInst().GetCmdStr(
ComplicationConnector::EditableEditReady),
g_variant_new("(s)", ComplicationConnector::GetInst().GetAppId().c_str()));
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
} // namespace watchface_complication
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
extern "C" {
#endif
+/**
+ * @file watchface-complication-editor.h
+ * @brief This file contains APIs for Watchface editor.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE_INTERNAL
+ * @{
+ */
+
typedef GList *editable_list_h;
typedef void (*on_setup_result)(editable_h ed, bundle *new_context,
void *user_data);
*/
int editor_is_setup_app_exist(const editable_h handle, bool *exist);
+/**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
static std::unique_ptr<EditablesEditorStub> __stub = nullptr;
extern "C" EXPORT_API int editor_on_request_edit_cb_add(on_request_edit cb,
void *user_data) {
- if (cb == NULL)
+ if (cb == NULL) {
+ LOGE("Invalid parameter");
return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
if (__stub == nullptr)
__stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
auto ci = new CallbackInfo(cb, user_data);
__stub->AddCallbackInfo(ci);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editor_on_request_edit_cb_del(on_request_edit cb) {
- if (cb == NULL)
+ if (cb == NULL) {
+ LOGE("Invalid parameter");
return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editor_edit_preview(const editable_h handle,
int cur_data_idx) {
- if (handle == NULL)
+ if (handle == NULL) {
+ LOGE("Invalid parameter");
return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
IEditable* ed = static_cast<IEditable*>(handle);
ed->SetCurDataIdx(cur_data_idx);
}
extern "C" EXPORT_API int editor_notify_edit_ready(const char *appid) {
- if (appid == NULL)
+ if (appid == NULL) {
+ LOGE("Invalid parameter");
return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
if (__stub == nullptr)
__stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
__stub->ClearEditableList();
__stub->NotifyEditReady(std::string(appid));
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editor_foreach_editable_list(editable_list_h list_h,
iter = iter->next;
}
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API editable_list_h editor_editable_list_dup(
extern "C" EXPORT_API int editor_editable_list_destroy(editable_list_h list) {
/* list items are managed by EditablesEditor */
+ if (list == NULL) {
+ LOGE("Invalid parameter");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
g_list_free(list);
- return 0;
+ return COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int editor_editable_list_get_size(editable_list_h list) {
extern "C" EXPORT_API const editable_h editor_editable_list_get_nth(
editable_list_h list, int nth) {
- if (list == NULL) {
+ if (list == NULL || nth < 0) {
LOGE("Invalid parameter");
return NULL;
}
__stub->AddSetupCallbackInfo(ci);
return COMPLICATION_ERROR_NONE;
-}
\ No newline at end of file
+}