Update doxygen 72/173072/12
authormk5004.lee <mk5004.lee@samsung.com>
Mon, 19 Mar 2018 10:41:20 +0000 (19:41 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Thu, 29 Mar 2018 06:36:17 +0000 (15:36 +0900)
Change-Id: I0543c8c11a5d1c48f5d8709cad1a58e2530e8f63
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
50 files changed:
unittest/src/test_complication.cc
unittest/src/test_complication_provider.cc
unittest/src/test_editables_container.cc
unittest/src/test_editor.cc
watchface-complication-provider/CMakeLists.txt [changed mode: 0755->0644]
watchface-complication-provider/complication-provider-event-interface.h
watchface-complication-provider/complication-provider-implementation.h
watchface-complication-provider/complication-provider.cc
watchface-complication-provider/complication-provider.h
watchface-complication-provider/include/watchface-complication-provider-manager.h
watchface-complication-provider/include/watchface-complication-provider.h
watchface-complication-provider/watchface-complication-provider-manager.cc
watchface-complication-provider/watchface-complication-provider.cc
watchface-complication/CMakeLists.txt [changed mode: 0755->0644]
watchface-complication/complication-bundle.cc
watchface-complication/complication-bundle.h
watchface-complication/complication-connector-implementation.h
watchface-complication/complication-connector.cc
watchface-complication/complication-connector.h
watchface-complication/complication-event-interface.h
watchface-complication/complication-implementation.h
watchface-complication/complication.cc [changed mode: 0755->0644]
watchface-complication/complication.h
watchface-complication/design-element-implementation.h
watchface-complication/design-element.cc
watchface-complication/design-element.h
watchface-complication/editable-interface.h
watchface-complication/editables-container-event-interface.h
watchface-complication/editables-container-implementation.h
watchface-complication/editables-container.cc
watchface-complication/editables-container.h
watchface-complication/editables-manager.cc
watchface-complication/include/watchface-common.h
watchface-complication/include/watchface-complication-internal.h
watchface-complication/include/watchface-complication.h
watchface-complication/include/watchface-editable.h
watchface-complication/received-editable-implementation.h
watchface-complication/received-editable.cc
watchface-complication/received-editable.h
watchface-complication/shared-handle.h
watchface-complication/watchface-complication-internal.cc
watchface-complication/watchface-complication.cc
watchface-complication/watchface-editable.cc
watchface-editor/CMakeLists.txt [changed mode: 0755->0644]
watchface-editor/editables-editor-event-interface.h
watchface-editor/editables-editor-implementation.h
watchface-editor/editables-editor.cc
watchface-editor/editables-editor.h
watchface-editor/include/watchface-editor.h [changed mode: 0755->0644]
watchface-editor/watchface-editor.cc

index 678d40e..a002d1c 100755 (executable)
@@ -145,11 +145,6 @@ class WFC : public ::testing::Test {
 void on_complication_update_cb(int complication_id, const char* provider_id,
                              complication_type type, const bundle* data,
                              void* user_data) {
-  const char* cur_provider_id = NULL;
-  complication_type cur_type;
-
-  EXPECT_EQ(complication_get_provider_id(data, &cur_provider_id), 0);
-  EXPECT_EQ(complication_get_type(data, &cur_type), 0);
 }
 
 TEST_F(WFC, Create)
@@ -170,7 +165,6 @@ TEST_F(WFC, GetData)
 
   EXPECT_EQ(complication_get_cur_type(WFC::complication, &cur_type), 0);
   EXPECT_EQ(cur_type, COMPLICATION_SHORT_TEXT);
-  EXPECT_EQ(complication_get_id(WFC::complication), comp_id);
 }
 
 TEST_F(WFC, UpdateRequest)
index 5406a71..68ba862 100755 (executable)
@@ -42,10 +42,9 @@ class WCP : public ::testing::Test {
   }
 };
 
-int on_update_request_cb(const char *provider_id, const char *req_appid,
+void on_update_request_cb(const char *provider_id, const char *req_appid,
                         complication_type type, const bundle *context,
                         bundle *share_data, void *user_data) {
-  return 0;
 }
 
 TEST_F(WCP, Create)
@@ -64,12 +63,6 @@ TEST_F(WCP, UpdateRequestCb)
   EXPECT_EQ(complication_provider_update_request_cb_del(providerId.c_str(), on_update_request_cb, NULL), 0);
 }
 
-TEST_F(WCP, GetSupportTypes)
-{
-  int types;
-  EXPECT_EQ(complication_provider_get_support_types(providerId.c_str(), &types), 0);
-}
-
 TEST_F(WCP, NotifyUpdate)
 {
   EXPECT_EQ(complication_provider_notify_update("test"), COMPLICATION_ERROR_INVALID_PARAMETER);
index 9b2f069..408b986 100755 (executable)
@@ -31,6 +31,7 @@
 #include "watchface-complication/received-editable.h"
 #include "watchface-complication/include/watchface-complication.h"
 #include "watchface-complication/include/watchface-editable.h"
+#include "watchface-editor/include/watchface-editor.h"
 
 using namespace std;
 using namespace watchface_complication;
@@ -118,13 +119,12 @@ TEST_F(EC, RequestEdit)
   EXPECT_EQ(EC::container->RequestEdit("Editor"), 0);
 }
 
-int on_edit_ready_cb(editable_container_h handle, const char *editor_appid, void *user_data) {
+void on_edit_ready_cb(editable_container_h handle, const char *editor_appid, void *user_data) {
   /* to do
   editable_add_design_element
   editable_add_complication
   editable_request_edit
   */
-  return 0;
 }
 
 TEST_F(EC, EditReadyCb)
index ebde610..51fd0b8 100755 (executable)
@@ -42,8 +42,7 @@ class WE : public ::testing::Test {
   }
 };
 
-int on_request_edit_cb(const char *appid, editable_list_h list_h, void *user_data) {
-  return 0;
+void on_request_edit_cb(const char *appid, editable_list_h list_h, void *user_data) {
 }
 
 TEST_F(WE, Create)
@@ -124,10 +123,6 @@ class WEL : public ::testing::Test {
   }
 };
 
-int _editable_list_foreach_cb(const editable_h handle, void *user_data) {
-  return 0;
-}
-
 TEST_F(WEL, EditPreview)
 {
   IEditable* ed = static_cast<IEditable*>(WEL::received);
@@ -145,8 +140,6 @@ TEST_F(WEL, EditableList)
   editable_h nthEditor = nullptr;
   const bundle* data = nullptr;
 
-  EXPECT_EQ(editor_foreach_editable_list(WEL::editables, _editable_list_foreach_cb, NULL), 0);
-
   EXPECT_NE(duplist = editor_editable_list_dup(WEL::editables), nullptr);
   EXPECT_GT(editor_editable_list_get_size(WEL::editables), 0);
 
old mode 100755 (executable)
new mode 100644 (file)
index b93631e..01c5b9d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index e33716b..e002a9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 00a8606..c8df25b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index cbbc6aa..a7448be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 953c002..7bf1117 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index d5936c5..a294d68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
 
-struct complication_provider_s {
-  const char *provider_id;
-  const char *provider_name;
-  const char *setup_app_id;
-  int support_types;
-};
+/**
+ * @file watchface-complication-provider.h
+ * @brief This file contains APIs for Complication provider.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE
+ * @{
+ */
 
-typedef int (*on_update_request)(const char *provider_id,
+/**
+ * @brief A callback function to perform when a watchface complication requests data update.
+ * @since_tizen 5.0
+ * @param[in] provider_id The id of the provider
+ * @param[in] req_appid The name of the watchface that update request
+ * @param[in] type Complication Type
+ * @param[in] context The data set in the setting app for the provider
+ * @param[in] share_data The data to update
+ * @param[in] user_data The user data passed from the callback function
+ * @see complication_provider_update_request_cb_add()
+ */
+typedef void (*on_update_request)(const char *provider_id,
                                  const char *req_appid,
                                  complication_type type,
                                  const bundle *context,
                                  bundle *share_data, void *user_data);
 
+/**
+ * @brief Register the callback function to be executed when the update requested.
+ * @since_tizen 5.0
+ * @param[in] provider_id The id of the provider
+ * @param[in] cb The callback function
+ * @param[out] callback_id Id of the registered callback function
+ * @param[in] user_data The user data passed from the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see complication_provider_update_request_cb_del()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+{
+  complication_provider_update_request_cb_add("PROVIDER_ID", _on_update_request_cb, NULL);
+}
+ * @endcode
+ */
 int complication_provider_update_request_cb_add(const char *provider_id,
     on_update_request cb, void *user_data);
+
+/**
+ * @brief Delete a callback function.
+ * @since_tizen 5.0
+ * @param[in] provider_id The id of the provider
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data passed from the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see complication_provider_update_request_cb_add()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+{
+  complication_provider_update_request_cb_del("PROVIDER_ID", _on_update_request_cb, NULL);
+}
+ * @endcode
+ */
 int complication_provider_update_request_cb_del(const char *provider_id,
     on_update_request cb, void *user_data);
-int complication_provider_get_support_types(const char *provider_id,
-    int *types);
-int complication_provider_notify_update(const char *provider_id);
+
+/**
+ * @brief Notify to the complication that there is an update.
+ * @details Complication automatically requests data when notify is received.
+ * @since_tizen 5.0
+ * @param[in] updated_provider_id The id of the provider
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+{
+  const char *provider_id = "org.tizen.comp_provider/battery";
+
+  complication_provider_notify_update(provider_id);
+}
+ * @endcode
+ */
+int complication_provider_notify_update(const char *updated_provider_id);
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
index 83b1e79..1132bda 100644 (file)
@@ -1,6 +1,5 @@
-
 /*
- * 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.
index 6f4e780..bad7fc1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * 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.
@@ -122,20 +122,12 @@ extern "C" EXPORT_API int complication_provider_update_request_cb_del(
   return 0;
 }
 
-extern "C" EXPORT_API int complication_provider_get_support_types(
-  const char *provider_id, int *types) {
-  if (provider_id == NULL || types == NULL)
-    return COMPLICATION_ERROR_INVALID_PARAMETER;
-
-  return 0;
-}
-
 extern "C" EXPORT_API int complication_provider_notify_update(
-  const char* provider_id) {
-  auto cp = __providers.find(provider_id);
+  const char* updated_provider_id) {
+  auto cp = __providers.find(updated_provider_id);
 
   if (cp == __providers.end()) {
-    LOGE("can not find provider (%s)", provider_id);
+    LOGE("can not find provider (%s)", updated_provider_id);
     return COMPLICATION_ERROR_INVALID_PARAMETER;
   }
 
@@ -144,12 +136,12 @@ extern "C" EXPORT_API int complication_provider_notify_update(
   int support_types = ShortText | Image;
 
   if (cp == __providers.end()) {
-    LOGI("create new provider : %s", provider_id);
-    ws = new WatchComplicationProviderStub(provider_id, support_types);
-    __providers[provider_id] = ws;
+    LOGI("create new provider : %s", updated_provider_id);
+    ws = new WatchComplicationProviderStub(updated_provider_id, support_types);
+    __providers[updated_provider_id] = ws;
   }
 
   ws->NotifyDataUpdate();
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
old mode 100755 (executable)
new mode 100644 (file)
index 48d2431..37396c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index eef230f..ddb3548 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 7db4dd4..c2980a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 4c4347c..a86645c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index cf65453..08c48b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index d67e933..8376d3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index b208ed1..fe2cf8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
old mode 100755 (executable)
new mode 100644 (file)
index 956b6a4..455bb7f
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -188,15 +188,16 @@ int Complication::Impl::StoreSetting(int comp_id, std::string& provider_id,
   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));
@@ -205,13 +206,14 @@ int Complication::Impl::StoreSetting(int comp_id, std::string& provider_id,
   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() {
@@ -267,14 +269,16 @@ int Complication::GetLastDataIdx() {
 }
 
 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) {
@@ -283,12 +287,12 @@ 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;
   }
 
 
@@ -296,7 +300,7 @@ int Complication::SetCurDataIdx(int cur_data_idx) {
   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);
@@ -315,7 +319,7 @@ int Complication::SetCurDataIdx(int cur_data_idx) {
                     -1, impl_.get());
   LOGI("subscribe signal %d", impl_->subscribe_id_);
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 const char* Complication::GetCurProviderId() {
index b3aae16..8c1cafe 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 779da4e..1e2015a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 87f65a8..73fb25f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -123,22 +123,22 @@ int DesignElement::UpdateLastDataIdx() {
   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() {
index 71f825a..93bc013 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index e2997fc..5b67ed6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 2e18df6..3e667e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index e64de7a..7ac3cc0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 594b8e5..ba29131 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -129,7 +129,7 @@ int EditablesContainer::RequestEdit(const std::string& editor_id) {
     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());
@@ -164,7 +164,7 @@ int EditablesContainer::RequestEdit(const std::string& editor_id) {
   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);
@@ -185,7 +185,7 @@ int EditablesContainer::RequestEdit(const std::string& editor_id) {
   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,
@@ -197,15 +197,15 @@ void EditablesContainer::OnEditReady(const std::string& editor_id) {
 
 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()) {
@@ -214,7 +214,7 @@ int EditablesContainer::Remove(std::shared_ptr<IEditable> ed) {
     }
   }
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 }  // namespace watchface_complication
index 9c9960e..a15755d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index bdd0dcd..47724b8 100644 (file)
@@ -98,9 +98,9 @@ int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
   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) {
index 2d796ff..491940d 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
 #undef EXPORT_API
 #endif
 #define EXPORT_API __attribute__((visibility("default")))
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/**
+ * @file watchface-common.h
+ * @brief This file contains enumerations for Watchface complication.
+ */
+
+/**
+ * @addtogroup WATCHFACE_COMPLICATION_MODULE
+ * @{
+ */
+
+/**
+ * @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_NONE = TIZEN_ERROR_NONE, /**< Success */
+  COMPLICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+  COMPLICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+  COMPLICATION_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Error from I/O */
+  COMPLICATION_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+  COMPLICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+  COMPLICATION_ERROR_DB = TIZEN_ERROR_COMPLICATION | 0x1, /**< DB Error */
+  COMPLICATION_ERROR_FROM_DBUS = TIZEN_ERROR_COMPLICATION | 0x2, /**< Error from DBUS */
+  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
 }
 #endif
index f8625e6..a18dd30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 14efd10..a36f0a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
+ * @{
+ */
+
+
+/**
+ * @brief Enumeration for Complication shape type.
+ * @since_tizen 5.0
+ */
 typedef enum _complication_shape_type {
-  COMPLICATION_SHAPE_CIRCLE,
-  COMPLICATION_SHAPE_RECT
+  COMPLICATION_SHAPE_CIRCLE, /**< Circle */
+  COMPLICATION_SHAPE_RECT /**< Rectangle */
 } complication_shape_type;
 
 typedef void *complication_h;
+
+/**
+ * @brief The callback function to perform when the complication is updated.
+ * @since_tizen 5.0
+ * @param[in] complication_id A number that identifies the complication
+ * @param[in] provider_id The name of the provider
+ * @param[in] type The type shown in the complication
+ * @param[in] data The data of the complication provided by the provider
+ * @param[in] user_data The user data passed from the callback function
+ */
 typedef void (*on_complication_update)(int complication_id,
                                       const char *provider_id,
                                       complication_type type,
                                       const bundle *data,
                                       void *user_data);
 
+/**
+ * @brief Gets the id of provider in the complication.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @param[out] cur_provider The name of the provider supplying the data
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Complication handle should be created by complication_create().
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+  const char *cur_provider_id;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+
+  ret = complication_get_cur_provider_id(complication, &cur_provider_id);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_get_cur_provider_id(complication_h handle,
     const char **cur_provider);
+
+/**
+ * @brief The currently set type of the complication.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @param[out] cur_type The type shown in the complication
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+  complication_type cur_type;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+
+  ret = complication_get_cur_type(complication, &cur_type);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_get_cur_type(complication_h handle,
     complication_type *cur_type);
+
+/**
+ * @brief Gets all the types that can be displayed.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @param[out] support_types The types shown in the complication
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+  int support_types;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+
+  ret = complication_get_support_types(complication, &support_types);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_get_support_types(complication_h handle, int *support_types);
 
+/**
+ * @brief Register callback function to use for complication update.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Complication handle should be created by complication_create().
+ * @see on_complication_update()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+
+  ret = complication_update_cb_add(complication, _on_complication_update, NULL);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_update_cb_add(complication_h handle, on_complication_update cb,
                                void *user_data);
+
+/**
+ * @brief Unregister a callback function.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @param[in] cb The callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_complication_update()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+
+  ret = complication_update_cb_del(complication, _on_complication_update);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_update_cb_del(complication_h handle,
                                on_complication_update cb);
-int complication_set_provider(const char *provider_id);
+
+/**
+ * @brief Request the provider to update the complication.
+ * @since_tizen 5.0
+ * @param[in] handle Complication handle
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPLICATION_ERROR_IO_ERROR Error from I/O
+ * @retval #COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+  int support_types;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+
+  ret = complication_send_update_request(complication);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return ret;
+}
+ * @endcode
+ */
 int complication_send_update_request(complication_h handle);
-int complication_get_id(complication_h handle);
+
+/**
+ * @brief Create a complication handle.
+ * @details The default provider and type are the items to set for initial display.
+ *          If user selects the other provider and type, they are no longer used.
+ * @since_tizen 5.0
+ * @param[in] complication_id A number that identifies the complication
+ * @param[in] default_provider_id The default provider id
+ * @param[in] default_type The default type to display
+ * @param[in] support_types The type shown in the complication
+ * @param[in] type The shape type of the complication
+ * @param[out] complication_h Complication handle on success
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  int comp_id = 1;
+  complication_h complication;
+
+  ret = complication_create(comp_id, "org.tizen.sample",
+                       COMPLICATION_SHORT_TEXT, COMPLICATION_SHORT_TEXT,
+                       COMPLICATION_SHAPE_CIRCLE, &complication);
+  if (ret != COMPLICATION_ERROR_NONE || complication == NULL)
+    return ret;
+}
+ * @endcode
+ */
 int complication_create(int complication_id, const char *default_provider_id,
                         complication_type default_type, int support_types,
                         complication_shape_type type,
                         complication_h *created_handle);
+
+/**
+ * @brief Destroy a complication handle
+ * @since_tizen 5.0
+ * @param[in] complication_h Complication handle
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Complication handle should be created by complication_create().
+ * @see complication_create()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  int ret;
+  complication_h complication;
+
+  // Create complication
+
+  // Do something
+
+  ret = complication_destroy(complication);
+  if (ret != COMPLICATION_ERROR_NONE)
+    return;
+}
+ * @endcode
+ */
 int complication_destroy(complication_h handle);
-int complication_get_provider_id(const bundle *candidate,
-    const char **provider_id);
-int complication_get_type(const bundle *candidate,
-    complication_type *cur_type);
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
index 34d1e09..9797f10 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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;
+
+/**
+ * @brief The structure for Editable geometry.
+ * @since_tizen 5.0
+ */
 typedef struct _editable_geo {
   int x;
   int y;
@@ -35,46 +50,450 @@ typedef struct _editable_geo {
   int w;
 } editable_geo;
 
+/**
+ * @brief Enumeration for Editable state.
+ * @since_tizen 5.0
+ */
 typedef enum _editable_edit_state {
-  EDITABLE_EDIT_STATE_COMPLETE,
-  EDITABLE_EDIT_STATE_ON_GOING,
-  EDITABLE_EDIT_STATE_CANCEL
+  EDITABLE_EDIT_STATE_COMPLETE, /**< Complete */
+  EDITABLE_EDIT_STATE_ON_GOING, /**< Ongoing */
+  EDITABLE_EDIT_STATE_CANCEL /**< Cancel */
 } editable_edit_state;
 
-typedef int (*on_editable_update)(const editable_h handle,
+/**
+ * @brief Perform edit request of editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] selected_idx Index
+ * @param[in] state Editable state
+ * @param[in] user_data The user data passed from the callback function
+ * @see #editable_edit_state
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  bundle *data;
+  int id;
+
+  editable_get_cur_data(handle, &data);
+  editable_get_editable_id(handle, &id);
+
+  //updata
+}
+ * @endcode
+ */
+typedef void (*on_editable_update)(const editable_h handle,
                                   int selected_idx,
                                   const editable_edit_state state,
                                   void *user_data);
-typedef int (*on_edit_ready)(editable_container_h handle,
+/**
+ * @brief Contain the editable information in the container and make an edit request.
+ * @since_tizen 5.0
+ * @param[in] handle The editable container handle
+ * @param[in] editor_appid The name of editor
+ * @param[in] user_data The user data passed from the callback function
+ * @see editable_on_edit_ready_cb_add()
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  //editable_add_design_element
+  //editable_add_complication
+
+  //editable_request_edit();
+}
+ * @endcode
+ */
+typedef void (*on_edit_ready)(editable_container_h handle,
                              const char *editor_appid, void *user_data);
 
+/**
+ * @brief Add design element to the editable container handle.
+ * @since_tizen 5.0
+ * @param[in] handle The editable container
+ * @param[in] editable_id Editable id
+ * @param[in] current_data_idx The index of the currently set data
+ * @param[in] candiates_list List of design elements
+ * @param[in] geo Position of editable
+ * @param[in] editable_name Name of editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_edit_ready()
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+_on_edit_ready(editable_container_h handle, const char *editor_appid, void *user_data)
+{
+  GList *candidatelist = NULL;
+  editable_geo geo;
+  int editable_id = 1;
+  int current_data_idx = 0;
+
+
+  //make a candidatelist
+  //make a geo
+  //Get current_data_idx
+
+  editable_add_design_element(handle, editable_id, current_data_idx, candidatelist, geo, "Color");
+}
+ * @endcode
+ */
 int editable_add_design_element(editable_container_h handle, int editable_id,
-                                int default_data_idx, GList *candiates_list,
+                                int current_data_idx, GList *candiates_list,
                                 editable_geo geo, const char *editable_name);
+
+/**
+ * @brief Gets the name of the editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[out] editable_name Name of editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const char *name;
+  const editable_h ed;
+
+  //Get ed
+
+  editable_get_editable_name(ed, &name);
+}
+ * @endcode
+ */
 int editable_get_editable_name(const editable_h handle,
     const char **editable_name);
+
+/**
+ * @brief Set the name in editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] editable_name Name of editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const char *name = "Editor";
+  const editable_h ed;
+
+  //Get ed
+
+  editable_set_editable_name(ed, name);
+}
+ * @endcode
+ */
 int editable_set_editable_name(const editable_h handle,
     const char *editable_name);
+
+/**
+ * @brief Retrieves the nth data of editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] nth
+ * @param[in] cur_data
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  bundle *data;
+  int nth = 1;
+
+  //Get ed
+
+  editable_get_nth_data(ed, nth, &name);
+}
+ * @endcode
+ */
 int editable_get_nth_data(const editable_h handle, int nth, bundle **cur_data);
+
+/**
+ * @brief Retrieves the current data in editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[out] cur_data Current data of bundle type
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  bundle *data;
+
+  //Get ed
+
+  editable_get_cur_data(ed, &data);
+}
+ * @endcode
+ */
 int editable_get_cur_data(const editable_h handle, bundle **cur_data);
+
+/**
+ * @brief Gets the index of the current data.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] idx Index
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  int cur_idx = 0;
+
+  //Get ed
+
+  editable_get_cur_data_idx(ed, &cur_idx);
+}
+ * @endcode
+ */
 int editable_get_cur_data_idx(const editable_h handle, int *idx);
+
+/**
+ * @brief Sets the index of the current data.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] idx Index
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  int cur_idx = 1;
+
+  //Get ed
+
+  editable_set_cur_data_idx(ed, cur_idx);
+}
+ * @endcode
+ */
 int editable_set_cur_data_idx(const editable_h handle, int idx);
+
+/**
+ * @brief Gets the id of editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[out] editable_id Id
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  int ed_id = 0;
+
+  //Get ed
+
+  editable_get_editable_id(ed, &ed_id);
+}
+ * @endcode
+ */
 int editable_get_editable_id(const editable_h handle, int *editable_id);
+
+/**
+ * @brief Gets the geometry of the editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[out] geo Geometry of the editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  editable_geo geo;
+
+  //Get ed
+
+  editable_get_geometry(ed, &geo);
+}
+ * @endcode
+ */
 int editable_get_geometry(const editable_h handle, editable_geo *geo);
-int editable_get_candidates_list(const editable_h handle, GList **candiates_list);
 
-bool editable_is_complication(const editable_h handle);
+/**
+ * @brief Gets the candidates list of the editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[out] candiates_list The candidates list
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  const editable_h ed;
+  GList *list = NULL;
+
+  //Get ed
+
+  editable_get_candidates_list(ed, &list);
+}
+ * @endcode
+ */
+int editable_get_candidates_list(const editable_h handle, GList **candidates_list);
+
+/**
+ * @brief Add a complication to the editable container handle.
+ * @since_tizen 5.0
+ * @param[in] handle The editable container handle
+ * @param[in] editable_id Editable id
+ * @param[in] comp Complication handle
+ * @param[in] geo Position of editable
+ * @param[in] editable_name Name of editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+_on_edit_ready(editable_container_h handle, const char *editor_appid, void *user_data)
+{
+  int comp_id = 1;
+  complication_h comp;
+  editable_geo geo;
+
+  geo.x = 100;
+  geo.y = 100;
+  geo.w = 100;
+  geo.h = 100;
+
+  // create complication
+
+  editable_add_complication(handle, comp_id, comp, geo, "Comp");
+}
+ * @endcode
+ */
 int editable_add_complication(editable_container_h handle, int editable_id,
                       complication_h comp, editable_geo geo,
                       const char *editable_name);
-int editable_get_complication(editable_container_h handle, complication_h *comp);
 
+/**
+ * @brief Request editor to edit.
+ * @since_tizen 5.0
+ * @param[in] handle The editable container handle
+ * @param[in] editor_appid The name of editor
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+_on_edit_ready(editable_container_h handle, const char *editor_appid, void *user_data)
+{
+  int comp_id = 1;
+  int design_element_id = 2;
+  complication_h comp;
+  bundle *design_element;
+  GList *candidatelist = NULL;
+  editable_geo geo;
+
+  geo.x = 100;
+  geo.y = 100;
+  geo.w = 100;
+  geo.h = 100;
+
+  // create, add complication
+  editable_add_complication(handle, comp_id, comp, geo, "Comp");
+
+  // create, add design element
+  // make a candidatelist
+  editable_add_design_element(handle, design_element_id, 0, candidatelist, geo, "Color");
+
+  editable_request_edit(handle, editor_appid, _on_editable_update, user_data);
+}
+ * @endcode
+ */
 int editable_request_edit(editable_container_h handle, const char *editor_appid,
                           on_editable_update cb, void *user_data);
+
+/**
+ * @brief Register the callback function to request edit.
+ * @since_tizen 5.0
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_edit_ready()
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  editable_on_edit_ready_cb_add(_on_edit_ready, NULL);
+}
+ * @endcode
+ */
 int editable_on_edit_ready_cb_add(on_edit_ready cb, void *user_data);
+
+/**
+ * @brief Unregister the callback function to request edit.
+ * @since_tizen 5.0
+ * @param[in] cb The callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_edit_ready()
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  editable_on_edit_ready_cb_del(_on_edit_ready);
+}
+ * @endcode
+ */
 int editable_on_edit_ready_cb_del(on_edit_ready cb);
+
+/**
+ * @brief Gets the editable information for the specified id.
+ * @since_tizen 5.0
+ * @param[in] editable_id Id of editable
+ * @param[in] current_data Bundle data containing current information
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPLICATION_ERROR_NO_DATA No data available
+ * @see
+ * @par Sample code:
+ * @code
+#include <watchface-editable.h>
+{
+  int color_edit = 1;
+  bundel *selected_data = NULL;
+
+  editable_load_current_data(color_edit, &selected_data);
+}
+ * @endcode
+ */
 int editable_load_current_data(int editable_id, bundle **current_data);
 
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
index 30e24b8..7a17d52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index 240b389..c6a65ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -100,7 +100,7 @@ int ReceivedEditable::GetCurDataIdx() {
 
 int ReceivedEditable::UpdateLastDataIdx() {
   impl_->last_data_idx_ = impl_->cur_data_idx_;
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 Bundle& ReceivedEditable::GetCurData() {
@@ -120,11 +120,11 @@ Bundle& ReceivedEditable::GetNthData(int nth) {
 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() {
index 8d5efeb..9e3e142 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index ea8d526..68063c3 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * 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_
 
index 83b1e79..1132bda 100644 (file)
@@ -1,6 +1,5 @@
-
 /*
- * 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.
index 2c7510d..c0fc61d 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -28,6 +28,7 @@
 #include "watchface-complication/include/watchface-complication-internal.h"
 #include "watchface-complication/complication.h"
 #include "watchface-complication/shared-handle.h"
+#include "watchface-editor/include/watchface-editor.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -100,7 +101,7 @@ extern "C" EXPORT_API int complication_update_cb_add(complication_h handle,
   auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
   ptr.get()->AddCallbackInfo(new CallbackInfo(cb, user_data));
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_update_cb_del(complication_h handle,
@@ -108,7 +109,7 @@ extern "C" EXPORT_API int complication_update_cb_del(complication_h handle,
   if (handle == NULL || cb == NULL)
     return COMPLICATION_ERROR_INVALID_PARAMETER;
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_send_update_request(
@@ -123,22 +124,18 @@ extern "C" EXPORT_API int complication_send_update_request(
   return ptr.get()->SendDataUpdateRequest();
 }
 
-extern "C" EXPORT_API int complication_get_id(complication_h handle) {
-  if (handle == NULL)
-    return COMPLICATION_ERROR_INVALID_PARAMETER;
-
-  auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
-  auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
-
-  return ptr.get()->GetId();
-}
-
 extern "C" EXPORT_API int complication_create(int complication_id,
     const char *default_provider_id, complication_type default_type,
     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;
 
   // TODO(?) check default value and type is valid
@@ -153,7 +150,7 @@ extern "C" EXPORT_API int complication_create(int complication_id,
   auto sh = SharedHandle<WatchComplicationStub>::Make(ws);
   *created_handle = static_cast<void*>(sh);
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_destroy(complication_h handle) {
@@ -163,7 +160,7 @@ extern "C" EXPORT_API int complication_destroy(complication_h handle) {
   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,
@@ -175,7 +172,7 @@ extern "C" EXPORT_API int complication_get_cur_provider_id(complication_h handle
   auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
   *cur_provider_id = ptr.get()->GetCurProviderId();
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_get_cur_type(complication_h handle,
@@ -189,7 +186,7 @@ extern "C" EXPORT_API int complication_get_cur_type(complication_h handle,
   if (ret != -1)
     *cur_type = static_cast<complication_type>(ret);
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_get_provider_id(const bundle* candidate,
@@ -204,9 +201,9 @@ extern "C" EXPORT_API int complication_get_provider_id(const bundle* candidate,
   if (val != NULL)
     *provider_id = val;
   else
-    return -1;
+    return COMPLICATION_ERROR_NO_DATA;
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int complication_get_type(const bundle* candidate,
@@ -221,7 +218,7 @@ extern "C" EXPORT_API int complication_get_type(const bundle* candidate,
   if (val != NULL)
     *cur_type = static_cast<complication_type>(atoi(val));
   else
-    return -1;
+    return COMPLICATION_ERROR_NO_DATA;
 
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
index 51f7966..a4a37b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -25,6 +25,7 @@
 #include "watchface-complication/design-element.h"
 #include "watchface-complication/shared-handle.h"
 #include "watchface-complication/editables-manager.h"
+#include "watchface-editor/include/watchface-editor.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -130,7 +131,7 @@ class EditablesContainerStub : public EditablesContainer {
 
 static EditablesContainerStub *__container;
 extern "C" EXPORT_API int editable_add_design_element(editable_container_h handle,
-    int edit_id, int default_data_idx, GList* candiatelist, editable_geo geo,
+    int edit_id, int current_data_idx, GList* candiatelist, editable_geo geo,
     const char* editable_name) {
   if (handle == NULL || candiatelist == NULL || editable_name == NULL)
     return COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -152,14 +153,14 @@ extern "C" EXPORT_API int editable_add_design_element(editable_container_h handl
   }
 
   auto de = std::shared_ptr<IEditable>(new DesignElement(edit_id,
-                      default_data_idx,
+                      current_data_idx,
                       std::move(new_list),
                       std::shared_ptr<IEditable::Geometry>(
                         new IEditable::Geometry(0, 0, 100, 100))));
   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,
@@ -175,7 +176,7 @@ 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,
@@ -191,7 +192,7 @@ 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,
@@ -205,14 +206,14 @@ 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,
@@ -222,7 +223,7 @@ 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,
@@ -232,7 +233,7 @@ 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,
@@ -243,7 +244,7 @@ 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,
@@ -254,7 +255,7 @@ 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,
@@ -265,22 +266,22 @@ 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,
@@ -291,7 +292,7 @@ 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,
@@ -301,16 +302,20 @@ 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;
 }
old mode 100755 (executable)
new mode 100644 (file)
index 71f8605..2ac2c83 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index a3f6b2a..20bf6e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
index f4fd1c5..36869d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -93,7 +93,7 @@ void EditablesEditor::OnRequestEdit(const std::string& appid,
 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);
@@ -108,13 +108,13 @@ int EditablesEditor::EditPreview(IEditable& ed, int cur_data_idx) {
         ComplicationConnector::EditableEditPreview),
     g_variant_new("(ii)", cur_data_idx, ed.GetId()));
 
-  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(
@@ -125,13 +125,13 @@ int EditablesEditor::EditComplete() {
     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(
@@ -142,12 +142,12 @@ int EditablesEditor::EditCancel() {
     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,
@@ -157,7 +157,7 @@ int EditablesEditor::NotifyEditReady(std::string appid) {
     ComplicationConnector::GetInst().GetCmdStr(
         ComplicationConnector::EditableEditReady),
     g_variant_new("(s)", ComplicationConnector::GetInst().GetAppId().c_str()));
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 }  // namespace watchface_complication
index 524afcf..498ffd1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
old mode 100755 (executable)
new mode 100644 (file)
index 4c7eb1a..a5578f7
@@ -1,5 +1,5 @@
 /*
- * 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 int (*on_request_edit)(const char *appid, editable_list_h list_h,
+
+/**
+ * @brief When an edit request occurs, it performs an action that shows the list.
+ * @since_tizen 5.0
+ * @param[in] appid Application ID
+ * @param[in] list List of editable
+ * @param[in] user_data The user data passed from the callback function
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editable_list_h list = editor_editable_list_dup(list_h);
+
+  // create list view
+}
+ * @endcode
+ */
+typedef void (*on_request_edit)(const char *appid, editable_list_h list,
                                void *user_data);
-typedef int (*editable_list_foreach_cb)(const editable_h handle,
-                                        void *user_data);
+
+/**
+ * @brief Register the callback function to edit.
+ * @since_tizen 5.0
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data passed from the callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_request_edit()
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editor_on_request_edit_cb_add(_on_request_edit, NULL);
+}
+ * @endcode
+ */
 int editor_on_request_edit_cb_add(on_request_edit cb, void *user_data);
+
+/**
+ * @brief Unregister the callback function.
+ * @since_tizen 5.0
+ * @param[in] cb The callback function
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see on_request_edit()
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editor_on_request_edit_cb_del(_on_request_edit);
+}
+ * @endcode
+ */
 int editor_on_request_edit_cb_del(on_request_edit cb);
-int editor_update_cur_data(const editable_h handle, int cur_data_idx,
-                           editable_edit_state state);
+
+/**
+ * @brief Apply changes in edit mode.
+ * @since_tizen 5.0
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
+ */
 int editor_edit_complete();
+
+/**
+ * @brief Displays the preview of the selected index.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] cur_data_idx Index
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  const editable_h handle;
+  int idx = 1;
+
+  //get editable form list
+
+  editor_edit_preview(handle, idx);
+}
+ * @endcode
+ */
 int editor_edit_preview(const editable_h handle, int cur_data_idx);
+
+/**
+ * @brief Cancel without making any changes in edit mode.
+ * @since_tizen 5.0
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
+ */
 int editor_edit_cancel();
+
+/**
+ * @brief Inform the watchface that the editor is ready to edit.
+ * @since_tizen 5.0
+ * @param[in] appid Application ID
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editor_notify_edit_ready("watchface_appid");
+}
+ * @endcode
+ */
 int editor_notify_edit_ready(const char *appid);
-int editor_foreach_editable_list(editable_list_h list_h,
-                                 editable_list_foreach_cb cb,
-                                 void *user_data);
+
+/**
+ * @brief Copy the editable list.
+ * @since_tizen 5.0
+ * @param[in] source The editable list
+ * @return A list of copied editable objects
+ * @retval A list of editable if success, NULL if failure
+ * @see editable_list_h
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editable_list_h list = editor_editable_list_dup(source_list);
+}
+ * @endcode
+ */
 editable_list_h editor_editable_list_dup(editable_list_h source);
+
+/**
+ * @brief Destroy list of editable.
+ * @since_tizen 5.0
+ * @param[in] list List of editable
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  editor_editable_list_destroy(list);
+}
+ * @endcode
+ */
 int editor_editable_list_destroy(editable_list_h list);
+
+/**
+ * @brief Gets the size of the editable list.
+ * @since_tizen 5.0
+ * @param[in] list List of editable
+ * @return A number of editable list handle on success, 0 on failure
+ * @see #editable_list_h
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  int list_size = editor_editable_list_get_size(list);
+}
+ * @endcode
+ */
 int editor_editable_list_get_size(editable_list_h list);
+
+/**
+ * @brief Gets the nth editable from the editable list.
+ * @since_tizen 5.0
+ * @param[in] list List of editable
+ * @param[in] nth
+ * @return Editable handle on success, NULL on failure
+ * @retval #editable_h Success
+ * @retval NULL Failure
+ * @see #editable_h
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  const editable_h handle = editor_editable_list_nth(list, 0);
+}
+ * @endcode
+ */
 const editable_h editor_editable_list_get_nth(editable_list_h list, int nth);
+
+/**
+ * @brief Gets the size of candidate in editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @return A number of candidates in editable on success, -1 on failure
+ * @see #editable_h
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  int idx = 1;
+  int candidates;
+
+  const editable_h handle = editor_editable_list_nth(list, idx);
+
+  candidates = editor_editable_candidate_list_get_size(handle);
+  if (candidates < 0)
+    return;
+}
+ * @endcode
+ */
 int editor_editable_candidate_list_get_size(const editable_h handle);
+
+/**
+ * @brief Gets the nth candidate data from the editable.
+ * @since_tizen 5.0
+ * @param[in] handle The editable handle
+ * @param[in] nth Index
+ * @return The bundle data of candidate on success, NULL on failure
+ * @see #editable_h
+ * @par Sample code:
+ * @code
+#include <watchface-editor.h>
+{
+  int idx = 1;
+
+  //Get editable handle
+
+  const bundle candidate = editor_editable_candidate_list_get_nth(handle, idx);
+  if (candidate == NULL)
+    return;
+}
+ * @endcode
+ */
 const bundle* editor_editable_candidate_list_get_nth(const editable_h handle,
-                                                     int nth);
+                                              int nth);
+
+/**
+ * @brief Gets the provider's id of the candidate.
+ * @since_tizen 5.0
+ * @param[in] candidate
+ * @param[out] provider_id The name of the provider
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPLICATION_ERROR_NO_DATA No data available
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  const char *provider_id = NULL;
+
+  complication_get_provider_id(candidate, &provider_id);
+}
+ * @endcode
+ */
+int complication_get_provider_id(const bundle *candidate,
+    const char **provider_id);
+
+/**
+ * @brief Gets complication type of the candidate.
+ * @since_tizen 5.0
+ * @param[in] candidate
+ * @param[out] cur_type The type shown in the complication
+ * @return #COMPLICATION_ERROR_NONE if success, other value if failure
+ * @retval #COMPLICATION_ERROR_NONE Success
+ * @retval #COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #COMPLICATION_ERROR_NO_DATA No data available
+ * @see complication_type
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+{
+  complication_type type;
+
+  complication_get_type(candidate, &type);
+}
+ * @endcode
+ */
+int complication_get_type(const bundle *candidate,
+    complication_type *cur_type);
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
index 1d81c42..59cafed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -42,8 +42,8 @@ class CallbackInfo {
     : cb_(cb), user_data_(user_data) {
   }
 
-  void Invoke(const std::string& appid, editable_list_h list_h) {
-    cb_(appid.c_str(), list_h, user_data_);
+  void Invoke(const std::string& appid, editable_list_h list) {
+    cb_(appid.c_str(), list, user_data_);
   }
 
  private:
@@ -99,8 +99,10 @@ class EditablesEditorStub : public EditablesEditor {
 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());
@@ -108,20 +110,24 @@ extern "C" EXPORT_API int editor_on_request_edit_cb_add(on_request_edit cb,
   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);
@@ -137,8 +143,10 @@ extern "C" EXPORT_API int editor_edit_cancel() {
 }
 
 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());
@@ -146,22 +154,7 @@ extern "C" EXPORT_API int editor_notify_edit_ready(const char *appid) {
     __stub->ClearEditableList();
   __stub->NotifyEditReady(std::string(appid));
 
-  return 0;
-}
-
-
-extern "C" EXPORT_API int editor_foreach_editable_list(editable_list_h list_h,
-    editable_list_foreach_cb cb, void *user_data) {
-  if (list_h == NULL || cb == NULL)
-    return COMPLICATION_ERROR_INVALID_PARAMETER;
-
-  GList *iter = list_h;
-  while (iter) {
-    cb((editable_h)iter->data, user_data);
-    iter = iter->next;
-  }
-
-  return 0;
+  return COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API editable_list_h editor_editable_list_dup(
@@ -182,8 +175,13 @@ 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) {
@@ -192,7 +190,7 @@ 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;
   }