Adds internal set type API for csharp implementation 59/191659/6
authorhyunho <hhstark.kang@samsung.com>
Mon, 22 Oct 2018 02:04:23 +0000 (11:04 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 30 Oct 2018 00:56:25 +0000 (00:56 +0000)
Change-Id: I27a71c609ea476cb546a2ecbbbcd98a899a23a09
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watchface-complication-provider/include/watchface-complication-provider-internal.h [new file with mode: 0644]
watchface-complication-provider/watchface-complication-provider.cc

diff --git a/watchface-complication-provider/include/watchface-complication-provider-internal.h b/watchface-complication-provider/include/watchface-complication-provider-internal.h
new file mode 100644 (file)
index 0000000..2de996a
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ * 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 __TIZEN_APPFW_WATCHFACE_COMPLICATION_PROVIDER_INTERNAL_H__
+#define __TIZEN_APPFW_WATCHFACE_COMPLICATION_PROVIDER_INTERNAL_H__
+
+#include <tizen.h>
+#include <bundle.h>
+#include <watchface-complication-provider.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Sets shared data type.
+ * @details Developer can set different set of data for shared data depends on data type.
+ *          WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : short text, icon, title, extra
+ *          WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : long text, icon, title, extra
+ *          WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : short text, icon, title, current, min, max, extra
+ *          WATCHFACE_COMPLICATION_TYPE_TIME : time, short text, icon, extra
+ *          WATCHFACE_COMPLICATION_TYPE_ICON : icon_path, extra
+ *          WATCHFACE_COMPLICATION_TYPE_IMAGE : image_path, extra
+ * @since_tizen 5.0
+ * @param[in] shared_data The data which will be shared with watch application
+ * @param[in] type The data type of shared_data
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ *         otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @see watchface_complication_type_e
+ *
+ */
+int watchface_complication_provider_data_set_type(bundle *shared_data,
+                       watchface_complication_type_e type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __TIZEN_APPFW_WATCHFACE_COMPLICATION_PROVIDER_INTERNAL_H__ */
\ No newline at end of file
index a1c7f37..a6bea60 100644 (file)
@@ -380,6 +380,20 @@ static int _get_data_type(bundle* shared_data,
   return WATCHFACE_COMPLICATION_ERROR_NONE;
 }
 
+extern "C" EXPORT_API int watchface_complication_provider_data_set_type(
+    bundle* shared_data, watchface_complication_type_e type) {
+  char num_str[32] = {0, };
+
+  if (shared_data == NULL ||
+    !util::CheckComplicationType(static_cast<int>(type))) {
+    LOGE("Invalid param");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  snprintf(num_str, sizeof(num_str), "%d", type);
+  return _add_bundle_data(shared_data, DATA_TYPE_KEY, num_str);
+}
+
 extern "C" EXPORT_API int watchface_complication_provider_data_set_title(
     bundle* shared_data, const char* title) {
   int ret;