%files -n %{name}-devel
%{_includedir}/watchface-complication/*.h
+%{_includedir}/watchface-complication/*.hh
%{_includedir}/watchface-common/*.h
+%{_includedir}/watchface-common/*.hh
%{_libdir}/pkgconfig/watchface-complication.pc
%attr(0644,root,root) %{_libdir}/%{name}.so
%files -n libwatchface-common-devel
%{_includedir}/watchface-common/*.h
+%{_includedir}/watchface-common/*.hh
%{_libdir}/pkgconfig/watchface-common.pc
%attr(0644,root,root) %{_libdir}/libwatchface-common.so
#include <memory>
#include <list>
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/complication-internal.hh"
#include "watchface-complication/include/watchface-complication.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
#include "parser/complication_parser_plugin_internal.h"
#define DEFAULT_MAX "default-max"
#define DEFAULT_MIN "default-min"
#define DEFAULT_IMAGE "default-image"
+#define DEFAULT_SMALL_IMAGE "default-small-image"
#define DEFAULT_EXTRA_DATA "default-extra-data"
using namespace std;
{"ranged-value-type", WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE},
{"time-type", WATCHFACE_COMPLICATION_TYPE_TIME},
{"icon-type", WATCHFACE_COMPLICATION_TYPE_ICON},
- {"image-type", WATCHFACE_COMPLICATION_TYPE_IMAGE}
+ {"image-type", WATCHFACE_COMPLICATION_TYPE_IMAGE},
+ {"small-image-type", (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE},
};
struct xml_to_bundle_key_map {
{DEFAULT_MAX, RANGE_MAX_KEY},
{DEFAULT_MIN, RANGE_MIN_KEY},
{DEFAULT_IMAGE, IMAGE_KEY},
- {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY}
+ {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY},
+ {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY},
+ {DEFAULT_SMALL_IMAGE, SMALL_IMAGE_KEY}
};
static uid_t __target_uid;
if (strcmp(element_name, DEFAULT_TITLE) != 0 &&
strcmp(element_name, DEFAULT_LONG_TEXT) != 0 &&
strcmp(element_name, DEFAULT_ICON) != 0 &&
+ strcmp(element_name, DEFAULT_SMALL_IMAGE) != 0 &&
strcmp(element_name, DEFAULT_EXTRA_DATA) != 0) {
LOGE("type (%d) do not support (%s)", type, element_name);
is_valid = false;
is_valid = false;
}
break;
+ case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE :
+ if (strcmp(element_name, DEFAULT_SMALL_IMAGE) != 0 &&
+ strcmp(element_name, DEFAULT_EXTRA_DATA) != 0) {
+ LOGE("type (%d) do not support (%s) %s", type, element_name, DEFAULT_SMALL_IMAGE);
+ is_valid = false;
+ }
+ break;
case WATCHFACE_COMPLICATION_TYPE_TIME :
if (strcmp(element_name, DEFAULT_SHORT_TEXT) != 0 &&
strcmp(element_name, DEFAULT_TIMEZONE_ID) != 0 &&
#include <dlog.h>
#include <tzplatform_config.h>
-#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-util.hh"
#include "parser/complication_parser_plugin_internal.h"
#define BUSY_WAITING_USEC 50000 /* 0.05 sec */
'test'
);
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 128,
+ 'test'
+);
+
INSERT INTO complication_provider (
pkgid, appid, provider_id, trusted, period) VALUES (
'org.tizen.gmock_comp_provider2',
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication-provider/complication-provider.h"
+#include "watchface-complication-provider/complication-provider.hh"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
#include "mock/tzplatform_config_mock.h"
#include "mock/app_common.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/complication.h"
+#include "watchface-complication/complication.hh"
#include "mock/tzplatform_config_mock.h"
#include "mock/app_common.h"
#include "mock/mock_util.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/db-manager.h"
+#include "watchface-complication/db-manager.hh"
using namespace std;
using namespace watchface_complication;
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/design-element.h"
+#include "watchface-complication/design-element.hh"
using namespace std;
using namespace tizen_base;
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
#include "watchface-complication/include/watchface-complication.h"
#include "watchface-complication/include/watchface-editable.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/editables-manager.h"
+#include "watchface-complication/editables-manager.hh"
using namespace std;
using namespace tizen_base;
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-editor/editables-editor.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-complication/received-editable.hh"
#include "watchface-complication/include/watchface-editable.h"
#include "watchface-editor/include/watchface-editor.h"
#include "mock/cynara_mock.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/received-editable.hh"
using namespace std;
using namespace tizen_base;
#include <watchface-complication-provider-internal.h>
#include <app_control_internal.h>
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-common/include/watchface-common-internal.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
#include "mock/system_info_mock.h"
#include "mock/tzplatform_config_mock.h"
ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
EXPECT_EQ(is_valid, true);
+
+ watchface_complication_provider_data_set_type(shared,
+ static_cast<watchface_complication_type_e>(WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE));
+ watchface_complication_provider_data_set_small_image_path(shared, "res/data.png");
+ ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(is_valid, true);
}
TEST_F(CWCP, watchface_complication_provider_event_get_type)
#include <watchface-complication-provider.h>
#include <watchface-complication-provider-internal.h>
-#include "watchface-complication/complication.h"
+#include "watchface-complication/complication.hh"
#include "mock/system_info_mock.h"
#include "mock/tzplatform_config_mock.h"
#include "mock/app_common.h"
snprintf(num_str, sizeof(num_str), "%d", LongText);
b.Add("__DATA_TYPE_KEY__", num_str);
watchface_complication_provider_data_set_long_text(b.GetHandle(), "longtext");
+ watchface_complication_provider_data_set_small_image_path_with_aod(b.GetHandle(),
+ "data/small.png", "data/aod_small.png");
parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
LongText,
777,
"__COMP_UPDATED__",
parameters);
+ b.Delete("__DATA_TYPE_KEY__");
+ snprintf(num_str, sizeof(num_str), "%d", SmallImage);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_small_image_path_with_aod(
+ b.GetHandle(), "data/small_img.png", "data/aod_small_img.png");
+ parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ SmallImage,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
if (g_main_loop_is_running(loop_))
g_main_loop_quit(loop_);
return G_SOURCE_CONTINUE;
free(sc_text);
} else if (type == WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
- char *longtext;
+ char *longtext, *image, *aod_image;
watchface_complication_data_get_long_text(data, &longtext);
EXPECT_STREQ(longtext, "longtext");
free(longtext);
+
+ watchface_complication_data_get_small_image_path(data, &image);
+ EXPECT_STREQ(image, "data/small.png");
+ free(image);
+
+ watchface_complication_data_get_aod_small_image_path(data, &aod_image);
+ EXPECT_STREQ(aod_image, "data/aod_small.png");
+ free(aod_image);
+
} else if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
long time;
watchface_complication_data_get_timestamp(data, &time);
EXPECT_EQ(cur, 10);
EXPECT_EQ(min, 0);
EXPECT_EQ(max, 100);
+ } else if (type ==
+ static_cast<watchface_complication_type_e>(WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE)) {
+ char* image, *aod_image;
+ watchface_complication_data_get_small_image_path(data, &image);
+ EXPECT_STREQ(image, "data/small_img.png");
+ free(image);
+ watchface_complication_data_get_aod_small_image_path(data, &aod_image);
+ EXPECT_STREQ(aod_image, "data/aod_small_img.png");
+ free(aod_image);
}
}
RunLoop();
}
+TEST_F(CWC, watchface_complication_data_get_small_image_path)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE,
+ (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
TEST_F(CWC, watchface_complication_data_get_ranged_value)
{
g_dbus_connection_signal_subscribe_fake.custom_fake =
#include <watchface-editable.h>
#include <watchface-editable-internal.h>
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
#include "mock/system_info_mock.h"
#include "mock/tzplatform_config_mock.h"
#include <watchface-editor.h>
#include <vector>
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
#include "mock/system_info_mock.h"
#include "mock/tzplatform_config_mock.h"
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-common.h DESTINATION include/watchface-common)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/watchface-common-internal.h DESTINATION include/watchface-common)
\ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/watchface-common-internal.hh DESTINATION include/watchface-common)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-common-internal.h DESTINATION include/watchface-common)
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2020 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 __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
+#define __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE 0x80 /**< Small Image */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2020 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_COMMON_SHARED_HANDLE_H_
-#define WATCHFACE_COMMON_SHARED_HANDLE_H_
-
-namespace watchface_complication {
-
-template<class T>
-class SharedHandle {
- public:
- static SharedHandle* Make(T* ptr) {
- return new SharedHandle(ptr);
- }
-
- static SharedHandle* Make(std::shared_ptr<T> ptr) {
- return new SharedHandle(ptr);
- }
-
- static std::shared_ptr<T> Share(SharedHandle* h) {
- return h->ptr_;
- }
-
- std::shared_ptr<T> GetPtr() const {
- if (ptr_ == nullptr)
- return std::shared_ptr<T>({});
- return ptr_;
- }
-
- T* GetRawPtr() const {
- if (ptr_ == nullptr)
- return nullptr;
- return ptr_.get();
- }
-
- private:
- SharedHandle(T* ptr) : ptr_(ptr) {}
- SharedHandle(std::shared_ptr<T> ptr) : ptr_(ptr) {}
-
- private:
- std::shared_ptr<T> ptr_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMMON_SHARED_HANDLE_H_
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2020 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_COMMON_SHARED_HANDLE_H_
+#define WATCHFACE_COMMON_SHARED_HANDLE_H_
+
+namespace watchface_complication {
+
+template<class T>
+class SharedHandle {
+ public:
+ static SharedHandle* Make(T* ptr) {
+ return new SharedHandle(ptr);
+ }
+
+ static SharedHandle* Make(std::shared_ptr<T> ptr) {
+ return new SharedHandle(ptr);
+ }
+
+ static std::shared_ptr<T> Share(SharedHandle* h) {
+ return h->ptr_;
+ }
+
+ std::shared_ptr<T> GetPtr() const {
+ if (ptr_ == nullptr)
+ return std::shared_ptr<T>({});
+ return ptr_;
+ }
+
+ T* GetRawPtr() const {
+ if (ptr_ == nullptr)
+ return nullptr;
+ return ptr_.get();
+ }
+
+ private:
+ SharedHandle(T* ptr) : ptr_(ptr) {}
+ SharedHandle(std::shared_ptr<T> ptr) : ptr_(ptr) {}
+
+ private:
+ std::shared_ptr<T> ptr_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMMON_SHARED_HANDLE_H_
\ No newline at end of file
+++ /dev/null
-/*
- * 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_COMMON_WATCHFACE_COMMON_INTERNAL_H_
-#define WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
-
-#include <tizen.h>
-
-#ifdef EXPORT_API
-#undef EXPORT_API
-#endif
-
-#define EXPORT_API __attribute__((visibility("default")))
-
-#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
-#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
-#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
-#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
-#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
-#define ICON_KEY "__ICON_KEY__"
-#define AOD_ICON_KEY "__AOD_ICON_KEY__"
-#define TITLE_KEY "__TITLE_KEY__"
-#define TIME_KEY "__TIME_KEY__"
-#define TIME_ZONE_KEY "__TIME_ZONE_KEY__"
-#define TIME_ZONE_ID_KEY "__TIME_ZONE_ID_KEY__"
-#define TIME_COUNTRY_KEY "__TIME_COUNTRY_KEY__"
-#define TIME_CITY_KEY "__TIME_CITY_KEY__"
-#define RANGE_CUR_KEY "__CUR_KEY__"
-#define RANGE_MAX_KEY "__MAX_KEY__"
-#define RANGE_MIN_KEY "__MIN_KEY__"
-#define IMAGE_KEY "__IMAGE_KEY__"
-#define AOD_IMAGE_KEY "__AOD_IMAGE_KEY__"
-#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
-#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
-#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
-#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
-#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
-#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
-#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
-#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum _editor_error_e {
- WATCHFACE_EDITOR_ERROR_NONE = 0x01, /**< Error none */
- WATCHFACE_EDITOR_ERROR_PERMISSION_DENY = 0x02, /**< Watchface do not have privileges for provider application. */
- WATCHFACE_EDITOR_ERROR_EVENT_NOT_SUPPORT = 0x04 /**< Watchface complication do not support provider's events. */
-} watchface_editor_error_e;
-
-struct complication_time_info_s {
- char *timezone;
- char *timezone_id;
- char *country;
- char *city;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
--- /dev/null
+/*
+ * 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_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+#define WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+
+#include <tizen.h>
+
+#ifdef EXPORT_API
+#undef EXPORT_API
+#endif
+
+#define EXPORT_API __attribute__((visibility("default")))
+
+#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
+#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
+#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
+#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
+#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
+#define ICON_KEY "__ICON_KEY__"
+#define AOD_ICON_KEY "__AOD_ICON_KEY__"
+#define TITLE_KEY "__TITLE_KEY__"
+#define TIME_KEY "__TIME_KEY__"
+#define TIME_ZONE_KEY "__TIME_ZONE_KEY__"
+#define TIME_ZONE_ID_KEY "__TIME_ZONE_ID_KEY__"
+#define TIME_COUNTRY_KEY "__TIME_COUNTRY_KEY__"
+#define TIME_CITY_KEY "__TIME_CITY_KEY__"
+#define RANGE_CUR_KEY "__CUR_KEY__"
+#define RANGE_MAX_KEY "__MAX_KEY__"
+#define RANGE_MIN_KEY "__MIN_KEY__"
+#define IMAGE_KEY "__IMAGE_KEY__"
+#define SMALL_IMAGE_KEY "__SMALL_IMAGE_KEY__"
+#define AOD_IMAGE_KEY "__AOD_IMAGE_KEY__"
+#define AOD_SMALL_IMAGE_KEY "__AOD_SMALL_IMAGE_KEY__"
+#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
+#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
+#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
+#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
+#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
+#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
+#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
+#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _editor_error_e {
+ WATCHFACE_EDITOR_ERROR_NONE = 0x01, /**< Error none */
+ WATCHFACE_EDITOR_ERROR_PERMISSION_DENY = 0x02, /**< Watchface do not have privileges for provider application. */
+ WATCHFACE_EDITOR_ERROR_EVENT_NOT_SUPPORT = 0x04 /**< Watchface complication do not support provider's events. */
+} watchface_editor_error_e;
+
+struct complication_time_info_s {
+ char *timezone;
+ char *timezone_id;
+ char *country;
+ char *city;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+++ /dev/null
-/*
- * 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_COMMON_WATCHFACE_EXCEPTION_H_
-#define WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
-
-#include <string>
-#include <exception>
-
-#include "watchface-common/include/watchface-common.h"
-
-#define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
-
-namespace watchface_complication {
-/* LCOV_EXCL_START */
-class Exception : public std::exception {
- public:
- explicit Exception(int error_code, std::string file = __FILE__,
- int line = __LINE__ ) {
- _error_code = error_code;
- _whatMessage = file.substr(file.find_last_of("/") + 1) + ":"
- + std::to_string(line) + GetErrorString(error_code);
- }
- virtual ~Exception() {}
- virtual const char *what(void) const noexcept {
- return _whatMessage.c_str();
- }
- int GetErrorCode() {
- return _error_code;
- }
-
- private:
- int _error_code;
- std::string _whatMessage;
- std::string GetErrorString(int error_code) {
- switch (error_code) {
- case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY:
- return ": OUT_OF_MEMORY";
- case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER:
- return ": INVALID_PARAMETER";
- case WATCHFACE_COMPLICATION_ERROR_IO_ERROR:
- return ": IO_ERROR";
- case WATCHFACE_COMPLICATION_ERROR_NO_DATA:
- return ": NO_DATA";
- case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED:
- return ": PERMISSION_DENIED";
- case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED:
- return ": NOT_SUPPORTED";
- case WATCHFACE_COMPLICATION_ERROR_DB:
- return ": DB_ERROR";
- case WATCHFACE_COMPLICATION_ERROR_DBUS:
- return ": DBUS_ERROR";
- case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY:
- return ": EDIT_NOT_READY";
- case WATCHFACE_COMPLICATION_ERROR_EXIST_ID:
- return ": EXIST_ID";
- case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST:
- return ": NOT_EXIST";
- default :
- return "";
- }
- }
-};
-/* LCOV_EXCL_STOP */
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
--- /dev/null
+/*
+ * 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_COMMON_WATCHFACE_EXCEPTION_H_
+#define WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
+
+#include <string>
+#include <exception>
+
+#include "watchface-common/include/watchface-common.h"
+
+#define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
+
+namespace watchface_complication {
+/* LCOV_EXCL_START */
+class Exception : public std::exception {
+ public:
+ explicit Exception(int error_code, std::string file = __FILE__,
+ int line = __LINE__ ) {
+ _error_code = error_code;
+ _whatMessage = file.substr(file.find_last_of("/") + 1) + ":"
+ + std::to_string(line) + GetErrorString(error_code);
+ }
+ virtual ~Exception() {}
+ virtual const char *what(void) const noexcept {
+ return _whatMessage.c_str();
+ }
+ int GetErrorCode() {
+ return _error_code;
+ }
+
+ private:
+ int _error_code;
+ std::string _whatMessage;
+ std::string GetErrorString(int error_code) {
+ switch (error_code) {
+ case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY:
+ return ": OUT_OF_MEMORY";
+ case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER:
+ return ": INVALID_PARAMETER";
+ case WATCHFACE_COMPLICATION_ERROR_IO_ERROR:
+ return ": IO_ERROR";
+ case WATCHFACE_COMPLICATION_ERROR_NO_DATA:
+ return ": NO_DATA";
+ case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED:
+ return ": PERMISSION_DENIED";
+ case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED:
+ return ": NOT_SUPPORTED";
+ case WATCHFACE_COMPLICATION_ERROR_DB:
+ return ": DB_ERROR";
+ case WATCHFACE_COMPLICATION_ERROR_DBUS:
+ return ": DBUS_ERROR";
+ case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY:
+ return ": EDIT_NOT_READY";
+ case WATCHFACE_COMPLICATION_ERROR_EXIST_ID:
+ return ": EXIST_ID";
+ case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST:
+ return ": NOT_EXIST";
+ default :
+ return "";
+ }
+ }
+};
+/* LCOV_EXCL_STOP */
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
#include <map>
#include <list>
-#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-util.hh"
#include "watchface-common/include/watchface-common.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
#ifdef LOG_TAG
#undef LOG_TAG
return true;
case WATCHFACE_COMPLICATION_TYPE_IMAGE:
return true;
+ case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE:
+ return true;
default:
return false;
}
is_valid = false;
break;
}
+ case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE : {
+ if (shared_data.GetString(SMALL_IMAGE_KEY).empty())
+ is_valid = false;
+ break;
+ }
case WATCHFACE_COMPLICATION_TYPE_NO_DATA :
is_valid = true;
break;
}
int ConvertPathToAppPath(const char* appid, bundle* data) {
- list<string> key_list {ICON_KEY, IMAGE_KEY, AOD_ICON_KEY, AOD_IMAGE_KEY};
+ list<string> key_list {ICON_KEY, IMAGE_KEY, AOD_ICON_KEY,
+ AOD_IMAGE_KEY, SMALL_IMAGE_KEY, AOD_SMALL_IMAGE_KEY};
for (auto& i : key_list) {
char* path;
int ret = bundle_get_str(data, i.c_str(), &path);
+++ /dev/null
-/*
- * 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_COMMON_WATCHFACE_UTIL_H_
-#define WATCHFACE_COMMON_WATCHFACE_UTIL_H_
-
-#include <gio/gio.h>
-#include <bundle.h>
-#include <bundle_cpp.h>
-#include <sqlite3.h>
-#include <tzplatform_config.h>
-
-#include <string>
-#include "watchface-common/include/watchface-common.h"
-#include "watchface-common/watchface-common-internal.h"
-
-#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
-
-enum cynara_result {
- COMPLICATION_CYNARA_UNKNOWN,
- COMPLICATION_CYNARA_ALLOWED,
- COMPLICATION_CYNARA_DENIED,
-};
-
-namespace watchface_complication {
-namespace util {
- enum CmdType {
- CompUpdateRequest,
- CompUpdated,
- CompNotifyDataUpdate,
- CompNotifyListeningStatus,
- EditableEditRequest,
- EditableEditComplete,
- EditableEditPreview,
- EditableEditCancel,
- EditableEditReady,
- SetupReply,
- EditResult,
- ProviderReady
- };
-
- enum EncodeType {
- Name,
- CompPath,
- EditablePath
- };
-
- EXPORT_API bool CheckWatchFeatureEnabled();
- EXPORT_API int CheckPrivilege(const char* privilege);
- EXPORT_API int CheckPrivilege(std::string privilege, cynara_result *pcr);
- EXPORT_API int CheckPrivilege(std::string& privilege,
- GDBusConnection *connection,
- std::string& sender_name,
- std::string& sender_appid);
- EXPORT_API int GetSenderPid(GDBusConnection *conn, const std::string& sender_name);
- EXPORT_API std::string GetSenderAppid(GDBusConnection *conn,
- const std::string& sender_name);
- EXPORT_API bool CheckSender(const char* sender_app_id,
- const std::string& sender_name,
- GDBusConnection* conn);
- EXPORT_API bool CheckComplicationType(int type);
- EXPORT_API std::string EncodeStr(EncodeType type, std::string appid);
- EXPORT_API std::string EncodeStr(EncodeType type, std::string appid, int compid);
- EXPORT_API std::string GetAppId();
- EXPORT_API std::string GetCmdStr(CmdType type);
- EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
- EXPORT_API std::string GetAppPath(const char* appid, char* path);
- EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
- EXPORT_API bool IsValidData(tizen_base::Bundle shared_data);
- EXPORT_API int GetDataType(tizen_base::Bundle shared_data);
- EXPORT_API int ConvertAulError(int ret);
- EXPORT_API void DestroyTimeInfo(struct complication_time_info_s* info);
-
- class EXPORT_API DBHelper {
- public:
- using Cursor = std::unique_ptr<sqlite3_stmt, decltype(sqlite3_finalize)*>;
- DBHelper()
- : db_(nullptr, sqlite3_close_v2), stmt_(nullptr, sqlite3_finalize) {}
-
- bool Open();
- bool Open(int mode);
- void Close();
- bool Prepare(const std::string& query);
- bool Exec(const std::string& query);
- const Cursor& GetCursor() const;
- int Step() const;
- int Reset() const;
-
- bool Bind(int pos, std::string text);
- bool Bind(int pos, int val);
-
- const char* GetText(int pos) const;
- int GetInt(int pos) const;
-
- private:
- const char* GetParserDataPath() const;
-
- private:
- std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
- Cursor stmt_;
- };
-} // namespace util
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMMON_WATCHFACE_UTIL_H_
--- /dev/null
+/*
+ * 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_COMMON_WATCHFACE_UTIL_H_
+#define WATCHFACE_COMMON_WATCHFACE_UTIL_H_
+
+#include <gio/gio.h>
+#include <bundle.h>
+#include <bundle_cpp.h>
+#include <sqlite3.h>
+#include <tzplatform_config.h>
+
+#include <string>
+#include "watchface-common/include/watchface-common.h"
+#include "watchface-common/watchface-common-internal.hh"
+
+#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
+
+enum cynara_result {
+ COMPLICATION_CYNARA_UNKNOWN,
+ COMPLICATION_CYNARA_ALLOWED,
+ COMPLICATION_CYNARA_DENIED,
+};
+
+namespace watchface_complication {
+namespace util {
+ enum CmdType {
+ CompUpdateRequest,
+ CompUpdated,
+ CompNotifyDataUpdate,
+ CompNotifyListeningStatus,
+ EditableEditRequest,
+ EditableEditComplete,
+ EditableEditPreview,
+ EditableEditCancel,
+ EditableEditReady,
+ SetupReply,
+ EditResult,
+ ProviderReady
+ };
+
+ enum EncodeType {
+ Name,
+ CompPath,
+ EditablePath
+ };
+
+ EXPORT_API bool CheckWatchFeatureEnabled();
+ EXPORT_API int CheckPrivilege(const char* privilege);
+ EXPORT_API int CheckPrivilege(std::string privilege, cynara_result *pcr);
+ EXPORT_API int CheckPrivilege(std::string& privilege,
+ GDBusConnection *connection,
+ std::string& sender_name,
+ std::string& sender_appid);
+ EXPORT_API int GetSenderPid(GDBusConnection *conn, const std::string& sender_name);
+ EXPORT_API std::string GetSenderAppid(GDBusConnection *conn,
+ const std::string& sender_name);
+ EXPORT_API bool CheckSender(const char* sender_app_id,
+ const std::string& sender_name,
+ GDBusConnection* conn);
+ EXPORT_API bool CheckComplicationType(int type);
+ EXPORT_API std::string EncodeStr(EncodeType type, std::string appid);
+ EXPORT_API std::string EncodeStr(EncodeType type, std::string appid, int compid);
+ EXPORT_API std::string GetAppId();
+ EXPORT_API std::string GetCmdStr(CmdType type);
+ EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
+ EXPORT_API std::string GetAppPath(const char* appid, char* path);
+ EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
+ EXPORT_API bool IsValidData(tizen_base::Bundle shared_data);
+ EXPORT_API int GetDataType(tizen_base::Bundle shared_data);
+ EXPORT_API int ConvertAulError(int ret);
+ EXPORT_API void DestroyTimeInfo(struct complication_time_info_s* info);
+
+ class EXPORT_API DBHelper {
+ public:
+ using Cursor = std::unique_ptr<sqlite3_stmt, decltype(sqlite3_finalize)*>;
+ DBHelper()
+ : db_(nullptr, sqlite3_close_v2), stmt_(nullptr, sqlite3_finalize) {}
+
+ bool Open();
+ bool Open(int mode);
+ void Close();
+ bool Prepare(const std::string& query);
+ bool Exec(const std::string& query);
+ const Cursor& GetCursor() const;
+ int Step() const;
+ int Reset() const;
+
+ bool Bind(int pos, std::string text);
+ bool Bind(int pos, int val);
+
+ const char* GetText(int pos) const;
+ int GetInt(int pos) const;
+
+ private:
+ const char* GetParserDataPath() const;
+
+ private:
+ std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
+ Cursor stmt_;
+ };
+} // namespace util
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMMON_WATCHFACE_UTIL_H_
+++ /dev/null
-/*
- * 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_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
-
-#include <bundle_cpp.h>
-
-#include <string>
-
-#include "watchface-complication/complication-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IComplicationProviderEvent {
- public:
- virtual void OnDataUpdated(const std::string& provider_id,
- ComplicationType type,
- const std::unique_ptr<tizen_base::Bundle>& data) = 0;
- virtual void OnProviderError(const std::string& provider_id,
- ComplicationType type, int error) = 0;
- virtual void OnNotifyDataUpdate() = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
--- /dev/null
+/*
+ * 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_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+
+#include <bundle_cpp.h>
+
+#include <string>
+
+#include "watchface-complication/complication-internal.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IComplicationProviderEvent {
+ public:
+ virtual void OnDataUpdated(const std::string& provider_id,
+ ComplicationType type,
+ const std::unique_ptr<tizen_base::Bundle>& data) = 0;
+ virtual void OnProviderError(const std::string& provider_id,
+ ComplicationType type, int error) = 0;
+ virtual void OnNotifyDataUpdate() = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+++ /dev/null
-/*
- * 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_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-#include <map>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-common/watchface-util.h"
-
-namespace watchface_complication {
-
-class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
- public:
- virtual ~Impl();
-
- private:
- friend class ComplicationProvider;
-
- void OnSignal(GDBusConnection* connection,
- const std::string& sender_name,
- const std::string& object_path,
- const std::string& interface_name,
- const std::string& signal_name,
- GVariant* parameters) override;
- void OnVanish(const std::string& name) override;
- void OnAppear(const std::string& name, const std::string& name_owner) override;
- std::list<std::string>& GetRequiredPrivileges();
- int NotifyProviderReady();
- Impl(ComplicationProvider* parent, const std::string& provider_id);
- class SenderInfo {
- public:
- SenderInfo(const std::string& sender_name, const char* sender_app_id,
- int watcher_id, std::string watch_name);
- int CheckPrivilege(std::list<std::string>& required_privileges,
- GDBusConnection* connection);
- bool CheckAppid(const std::string& Appid);
- const std::string& GetAppid() const;
- int GetWatcherID();
- std::string& GetWatchName();
- cynara_result GetPrivilegeResult();
- void SetPrivilegeResult(cynara_result result);
- int GetListeningCount() const;
- void SetListeningCount(int count);
-
- private:
- std::string sender_name_;
- std::string sender_app_id_;
- int watcher_id_;
- std::string watch_name_;
- std::list<std::string> sender_privileges_;
- cynara_result privilege_result_;
- int listening_count_ = 0;
- };
- SenderInfo* GetSenderInfo(std::string sender_name,
- GDBusConnection* connection, GVariant* parameters);
-
- private:
- ComplicationProvider* parent_;
- int subscribe_id_;
- std::string provider_id_;
- std::string setup_appid_;
- int supported_types_;
- std::map<std::string, SenderInfo*> sender_info_;
- std::list<std::string> required_privileges_;
- std::unique_ptr<IGDBus> gdbus_;
- bool trusted_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-
--- /dev/null
+/*
+ * 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_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+#include <map>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-common/watchface-util.hh"
+
+namespace watchface_complication {
+
+class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
+ public:
+ virtual ~Impl();
+
+ private:
+ friend class ComplicationProvider;
+
+ void OnSignal(GDBusConnection* connection,
+ const std::string& sender_name,
+ const std::string& object_path,
+ const std::string& interface_name,
+ const std::string& signal_name,
+ GVariant* parameters) override;
+ void OnVanish(const std::string& name) override;
+ void OnAppear(const std::string& name, const std::string& name_owner) override;
+ std::list<std::string>& GetRequiredPrivileges();
+ int NotifyProviderReady();
+ Impl(ComplicationProvider* parent, const std::string& provider_id);
+ class SenderInfo {
+ public:
+ SenderInfo(const std::string& sender_name, const char* sender_app_id,
+ int watcher_id, std::string watch_name);
+ int CheckPrivilege(std::list<std::string>& required_privileges,
+ GDBusConnection* connection);
+ bool CheckAppid(const std::string& Appid);
+ const std::string& GetAppid() const;
+ int GetWatcherID();
+ std::string& GetWatchName();
+ cynara_result GetPrivilegeResult();
+ void SetPrivilegeResult(cynara_result result);
+ int GetListeningCount() const;
+ void SetListeningCount(int count);
+
+ private:
+ std::string sender_name_;
+ std::string sender_app_id_;
+ int watcher_id_;
+ std::string watch_name_;
+ std::list<std::string> sender_privileges_;
+ cynara_result privilege_result_;
+ int listening_count_ = 0;
+ };
+ SenderInfo* GetSenderInfo(std::string sender_name,
+ GDBusConnection* connection, GVariant* parameters);
+
+ private:
+ ComplicationProvider* parent_;
+ int subscribe_id_;
+ std::string provider_id_;
+ std::string setup_appid_;
+ int supported_types_;
+ std::map<std::string, SenderInfo*> sender_info_;
+ std::list<std::string> required_privileges_;
+ std::unique_ptr<IGDBus> gdbus_;
+ bool trusted_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+
#include <list>
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication-provider/complication-provider.h"
-#include "watchface-complication-provider/complication-provider-implementation.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-complication-provider/complication-provider.hh"
+#include "watchface-complication-provider/complication-provider-implementation.hh"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
#ifdef LOG_TAG
+++ /dev/null
-/*
- * 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_PROVIDER_COMPLICATION_PROVIDER_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
-
-#include <gio/gio.h>
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication-event-interface.h"
-#include "watchface-complication/complication-connector.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ComplicationProvider : public IComplicationEvent {
- public:
- explicit ComplicationProvider(const std::string& provider_id);
- virtual ~ComplicationProvider(); /* LCOV_EXCL_LINE */
-
- public:
- void OnDataUpdateRequest(const std::string& sender_appid,
- ComplicationType type,
- const tizen_base::Bundle& context,
- tizen_base::Bundle* shared_data) override;
- void OnConsumerStatusChange(const std::string& sender_appid,
- watchface_complication_consumer_status_e status) override;
-
- int NotifyDataUpdate();
- const std::string& GetProviderId() const;
- static bool SetupReplyToEditor(std::string editor_appid,
- int editable_id, const char* raw);
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
--- /dev/null
+/*
+ * 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_PROVIDER_COMPLICATION_PROVIDER_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
+
+#include <gio/gio.h>
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication-event-interface.hh"
+#include "watchface-complication/complication-connector.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ComplicationProvider : public IComplicationEvent {
+ public:
+ explicit ComplicationProvider(const std::string& provider_id);
+ virtual ~ComplicationProvider(); /* LCOV_EXCL_LINE */
+
+ public:
+ void OnDataUpdateRequest(const std::string& sender_appid,
+ ComplicationType type,
+ const tizen_base::Bundle& context,
+ tizen_base::Bundle* shared_data) override;
+ void OnConsumerStatusChange(const std::string& sender_appid,
+ watchface_complication_consumer_status_e status) override;
+
+ int NotifyDataUpdate();
+ const std::string& GetProviderId() const;
+ static bool SetupReplyToEditor(std::string editor_appid,
+ int editable_id, const char* raw);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
bundle *shared_data, const char *icon_path, const char *aod_icon_path);
int watchface_complication_provider_data_set_image_path_with_aod(
bundle *shared_data, const char *image_path, const char *aod_image_path);
-
+int watchface_complication_provider_data_set_small_image_path(
+ bundle* shared_data, const char* small_image_path);
+int watchface_complication_provider_data_set_small_image_path_with_aod(
+ bundle* shared_data, const char* image_path, const char* small_image_path);
typedef enum _watchface_complication_consumer_status {
WATCHFACE_COMPLICATION_CONSUMER_LISTENING_START = 0x1,
#include <map>
#include <list>
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication-provider/complication-provider.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
+#include "watchface-complication-provider/complication-provider.hh"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-complication/complication-internal.hh"
#ifdef LOG_TAG
#undef LOG_TAG
return _add_bundle_data(shared_data, IMAGE_KEY, image_path);
}
+extern "C" EXPORT_API int watchface_complication_provider_data_set_small_image_path_with_aod(
+ bundle* shared_data, const char* image_path, const char* aod_image_path) {
+ int ret;
+ watchface_complication_type_e type;
+
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (shared_data == nullptr || image_path == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _get_data_type(shared_data, &type);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ if (type != WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE &&
+ type != WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
+ LOGE("Invalid type, not allowed for this type !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (aod_image_path != nullptr) {
+ ret = _add_bundle_data(shared_data, AOD_SMALL_IMAGE_KEY, aod_image_path);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return _add_bundle_data(shared_data, SMALL_IMAGE_KEY, image_path);
+}
+
extern "C" EXPORT_API int watchface_complication_provider_data_set_title(
bundle* shared_data, const char* title) {
int ret;
return _add_bundle_data(shared_data, IMAGE_KEY, image_path);
}
+extern "C" EXPORT_API int watchface_complication_provider_data_set_small_image_path(
+ bundle* shared_data, const char* image_path) {
+ int ret;
+ watchface_complication_type_e type;
+
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (shared_data == nullptr || image_path == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _get_data_type(shared_data, &type);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ if (type != WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE &&
+ type != WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
+ LOGE("Invalid type, not allowed for this type !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return _add_bundle_data(shared_data, SMALL_IMAGE_KEY, image_path);
+}
+
extern "C" EXPORT_API int watchface_complication_provider_data_set_ranged_value(
bundle* shared_data, double current_value, double min_value,
double max_value) {
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-editable.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-complication.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-complication-internal.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/complication-internal.h DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/complication-internal.hh DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
#include <string>
#include <list>
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
#ifdef LOG_TAG
#undef LOG_TAG
#include <list>
-#include "watchface-complication/complication-connector.h"
+#include "watchface-complication/complication-connector.hh"
#include "watchface-complication/complication-connector-implementation.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication/package-manager.h"
-#include "watchface-complication/gdbus.h"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication/package-manager.hh"
+#include "watchface-complication/gdbus.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_COMPLICATION_CONNECTOR_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
-
-#include <gio/gio.h>
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication-internal.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-complication/package-manager-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ComplicationConnector {
- public:
- static ComplicationConnector& GetInst();
- IGDBus* CreateGDBus();
- IPackageManager* CreatePackageManager();
- bool EmitSignal(IGDBus::SigType type, std::string target_id, std::string id,
- int sub_id, std::string cmd, GVariant* data);
- void WatchPackageEvent(IPackageManager::IPackageEvent* pe);
- void UnWatchPackageEvent(IPackageManager::IPackageEvent* pe);
-
- private:
- ComplicationConnector();
- int Init();
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
--- /dev/null
+/*
+ * 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_COMPLICATION_CONNECTOR_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
+
+#include <gio/gio.h>
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-complication/package-manager-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ComplicationConnector {
+ public:
+ static ComplicationConnector& GetInst();
+ IGDBus* CreateGDBus();
+ IPackageManager* CreatePackageManager();
+ bool EmitSignal(IGDBus::SigType type, std::string target_id, std::string id,
+ int sub_id, std::string cmd, GVariant* data);
+ void WatchPackageEvent(IPackageManager::IPackageEvent* pe);
+ void UnWatchPackageEvent(IPackageManager::IPackageEvent* pe);
+
+ private:
+ ComplicationConnector();
+ int Init();
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
+++ /dev/null
-/*
- * 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_COMPLICATION_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
-
-#include <bundle_cpp.h>
-
-#include <string>
-
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IComplicationEvent {
- public:
- virtual void OnDataUpdateRequest(const std::string& sender_appid,
- ComplicationType type,
- const tizen_base::Bundle& context,
- tizen_base::Bundle* shared_data) = 0;
- virtual void OnConsumerStatusChange(const std::string& sender_appid,
- watchface_complication_consumer_status_e status) = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
--- /dev/null
+/*
+ * 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_COMPLICATION_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
+
+#include <bundle_cpp.h>
+
+#include <string>
+
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
+
+namespace watchface_complication {
+
+class EXPORT_API IComplicationEvent {
+ public:
+ virtual void OnDataUpdateRequest(const std::string& sender_appid,
+ ComplicationType type,
+ const tizen_base::Bundle& context,
+ tizen_base::Bundle* shared_data) = 0;
+ virtual void OnConsumerStatusChange(const std::string& sender_appid,
+ watchface_complication_consumer_status_e status) = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
+++ /dev/null
-/*
- * 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_COMPLICATION_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <dlog.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <map>
-#include <list>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "WATCHFACE_COMPLICATION"
-
-namespace watchface_complication {
-
-class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
- public:
- void OnSignal(GDBusConnection* connection,
- const std::string& sender_name,
- const std::string& object_path,
- const std::string& interface_name,
- const std::string& signal_name,
- GVariant* parameters) override;
- void OnVanish(const std::string& name) override;
- void OnAppear(const std::string& name, const std::string& name_owner) override;
- void OnAppDisabled(const std::string& appid) override;
- void OnAppUninstalled(const std::string& appid) override;
- virtual ~Impl();
-
- private:
- friend class Complication;
-
- Impl(Complication* parent, int id, int supported_types, int supported_event_types,
- const std::string& default_provider_id,
- ComplicationType default_type);
- void RestoreStateOrSetDefault();
- int StoreSetting(int comp_id, std::string& provider_id,
- ComplicationType type);
- std::unique_ptr<tizen_base::Bundle> LoadSetting();
- int AddCandidate(std::string provider_id, int type);
- int AddCandidates(std::string provider_id, int types);
- int AddCandidates(int types);
- int UpdateCandidatesInfo();
- int MakeCandidatesList();
- int LoadPeriod();
- void LoadLabel();
- int LoadContext();
- int LoadCurProviderFromPrev();
- int LoadCurProviderFromDefault();
- void UpdateLastDataFields();
- int UpdateProviderInfo();
- int DeleteAppContext(const char* appid);
- int ReplaceUnavailableProvider(const char* deleted_appid);
- bool CheckCachedPrivilege(std::string privilege);
- int CheckNotSupported(std::string provider_id);
- int GetNotSupportedEvents(std::string provider_id);
- std::string GetNotSupportedPrivileges(std::string provider_id);
- bool IsValidSender(GDBusConnection* connection,
- const std::string& sender_name);
- void UpdatedProcess(GVariant* parameters);
- void NotifyDataUpdateProcess(GVariant* parameters);
- void ProviderReadyProcess(GVariant* parameters);
- int UpdateCurProvider(std::string new_provider_id, ComplicationType type);
-
- private:
- Complication* parent_;
- int complication_id_ = -1;
- int editable_id_ = -1;
- int supported_types_ = -1;
- int supported_event_types_ = -1;
- std::string default_provider_appid_;
- std::string default_provider_id_;
- ComplicationType default_type_;
- std::shared_ptr<IEditable::Highlight> highlight_;
- std::string cur_provider_appid_;
- std::string cur_provider_id_;
- ComplicationType cur_type_;
- std::string last_provider_id_;
- ComplicationType last_type_ = NoData;
- std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
- std::list<std::unique_ptr<ProviderInfo>> allowed_list_;
- std::list<std::unique_ptr<ProviderInfo>> denied_list_;
- std::list<std::unique_ptr<ProviderInfo>> priority_list_;
- std::list<std::string> privilege_list_;
- int cur_data_idx_ = -1;
- std::unique_ptr<tizen_base::Bundle> context_data_;
- std::unique_ptr<tizen_base::Bundle> last_context_data_;
- std::unique_ptr<tizen_base::Bundle> last_data_;
- int last_data_idx_ = -1;
- std::string name_;
- int subscribe_id_ = -1;
- int watcher_id_ = -1;
- static const std::string provider_id_key_;
- static const std::string provider_type_key_;
- static const std::string supported_events_error_key_;
- static const std::string privilege_error_key_;
- static std::list<int> complication_id_list_;
- IEditable::EditableState ed_state_ = Complete;
- guint periodic_timer_ = 0;
- std::unique_ptr<IGDBus> gdbus_;
- std::unique_ptr<IPackageManager> package_;
- EditablesManager& editables_manager_;
- bool mock_ = false;
- bool is_provider_ready_ = false;
- int listening_status_ = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * 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_COMPLICATION_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <dlog.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <map>
+#include <list>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "WATCHFACE_COMPLICATION"
+
+namespace watchface_complication {
+
+class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
+ public:
+ void OnSignal(GDBusConnection* connection,
+ const std::string& sender_name,
+ const std::string& object_path,
+ const std::string& interface_name,
+ const std::string& signal_name,
+ GVariant* parameters) override;
+ void OnVanish(const std::string& name) override;
+ void OnAppear(const std::string& name, const std::string& name_owner) override;
+ void OnAppDisabled(const std::string& appid) override;
+ void OnAppUninstalled(const std::string& appid) override;
+ virtual ~Impl();
+
+ private:
+ friend class Complication;
+
+ Impl(Complication* parent, int id, int supported_types, int supported_event_types,
+ const std::string& default_provider_id,
+ ComplicationType default_type);
+ void RestoreStateOrSetDefault();
+ int StoreSetting(int comp_id, std::string& provider_id,
+ ComplicationType type);
+ std::unique_ptr<tizen_base::Bundle> LoadSetting();
+ int AddCandidate(std::string provider_id, int type);
+ int AddCandidates(std::string provider_id, int types);
+ int AddCandidates(int types);
+ int UpdateCandidatesInfo();
+ int MakeCandidatesList();
+ int LoadPeriod();
+ void LoadLabel();
+ int LoadContext();
+ int LoadCurProviderFromPrev();
+ int LoadCurProviderFromDefault();
+ void UpdateLastDataFields();
+ int UpdateProviderInfo();
+ int DeleteAppContext(const char* appid);
+ int ReplaceUnavailableProvider(const char* deleted_appid);
+ bool CheckCachedPrivilege(std::string privilege);
+ int CheckNotSupported(std::string provider_id);
+ int GetNotSupportedEvents(std::string provider_id);
+ std::string GetNotSupportedPrivileges(std::string provider_id);
+ bool IsValidSender(GDBusConnection* connection,
+ const std::string& sender_name);
+ void UpdatedProcess(GVariant* parameters);
+ void NotifyDataUpdateProcess(GVariant* parameters);
+ void ProviderReadyProcess(GVariant* parameters);
+ int UpdateCurProvider(std::string new_provider_id, ComplicationType type);
+
+ private:
+ Complication* parent_;
+ int complication_id_ = -1;
+ int editable_id_ = -1;
+ int supported_types_ = -1;
+ int supported_event_types_ = -1;
+ std::string default_provider_appid_;
+ std::string default_provider_id_;
+ ComplicationType default_type_;
+ std::shared_ptr<IEditable::Highlight> highlight_;
+ std::string cur_provider_appid_;
+ std::string cur_provider_id_;
+ ComplicationType cur_type_;
+ std::string last_provider_id_;
+ ComplicationType last_type_ = NoData;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+ std::list<std::unique_ptr<ProviderInfo>> allowed_list_;
+ std::list<std::unique_ptr<ProviderInfo>> denied_list_;
+ std::list<std::unique_ptr<ProviderInfo>> priority_list_;
+ std::list<std::string> privilege_list_;
+ int cur_data_idx_ = -1;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_data_;
+ int last_data_idx_ = -1;
+ std::string name_;
+ int subscribe_id_ = -1;
+ int watcher_id_ = -1;
+ static const std::string provider_id_key_;
+ static const std::string provider_type_key_;
+ static const std::string supported_events_error_key_;
+ static const std::string privilege_error_key_;
+ static std::list<int> complication_id_list_;
+ IEditable::EditableState ed_state_ = Complete;
+ guint periodic_timer_ = 0;
+ std::unique_ptr<IGDBus> gdbus_;
+ std::unique_ptr<IPackageManager> package_;
+ EditablesManager& editables_manager_;
+ bool mock_ = false;
+ bool is_provider_ready_ = false;
+ int listening_status_ = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
+++ /dev/null
-/*
- * Copyright (c) 2020 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_COMPLICATION_INTERNAL_H__
-#define __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
-
-#include <watchface-common.h>
-
-namespace watchface_complication {
-
-typedef enum {
- NoData = WATCHFACE_COMPLICATION_TYPE_NO_DATA,
- ShortText = WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
- LongText = WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
- RangedValue = WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
- Time = WATCHFACE_COMPLICATION_TYPE_TIME,
- Icon = WATCHFACE_COMPLICATION_TYPE_ICON,
- Image = WATCHFACE_COMPLICATION_TYPE_IMAGE
-} ComplicationType;
-
-typedef enum {
- EventNone = WATCHFACE_COMPLICATION_EVENT_NONE,
- EventTap = WATCHFACE_COMPLICATION_EVENT_TAP,
- EventDoubleTap = WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP
-} ComplicationEventType;
-
-} // namespace watchface_complication
-
-#endif /* __TIZEN_APPFW_COMPLICATION_INTERNAL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2020 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_COMPLICATION_INTERNAL_H__
+#define __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
+
+#include <watchface-common.h>
+#include "watchface-common/include/watchface-common-internal.h"
+
+namespace watchface_complication {
+
+typedef enum {
+ NoData = WATCHFACE_COMPLICATION_TYPE_NO_DATA,
+ ShortText = WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ LongText = WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
+ RangedValue = WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
+ Time = WATCHFACE_COMPLICATION_TYPE_TIME,
+ Icon = WATCHFACE_COMPLICATION_TYPE_ICON,
+ Image = WATCHFACE_COMPLICATION_TYPE_IMAGE,
+ SmallImage = WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE
+} ComplicationType;
+
+typedef enum {
+ EventNone = WATCHFACE_COMPLICATION_EVENT_NONE,
+ EventTap = WATCHFACE_COMPLICATION_EVENT_TAP,
+ EventDoubleTap = WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP
+} ComplicationEventType;
+
+} // namespace watchface_complication
+
+#endif /* __TIZEN_APPFW_COMPLICATION_INTERNAL_H__ */
#include <pkgmgr-info.h>
#include <stdexcept>
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-implementation.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-implementation.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-complication/complication-internal.hh"
#include "watchface-complication/include/watchface-complication-internal.h"
#include <iostream>
+++ /dev/null
-/*
- * 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_COMPLICATION_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication-provider/complication-provider-event-interface.h"
-#include "watchface-complication/editable-interface.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/editables-manager.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API Complication : public IEditable
- , public IComplicationProviderEvent {
- public:
- Complication(int id, int supported_types, int supported_event_types,
- const std::string& default_provider_id,
- ComplicationType default_type);
- virtual ~Complication();
-
- public:
- class ProviderInfo {
- public:
- ProviderInfo(std::string provider_id, int types)
- : provider_id_(provider_id), types_(types) {
- }
-
- const std::string& GetProviderId() const {
- return provider_id_;
- }
-
- int GetTypes() const {
- return types_;
- }
-
- private:
- std::string provider_id_;
- int types_;
- };
-
- int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
- std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
- std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
- std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
- std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
- int GetCurDataIdx() const override;
- int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() const override;
- int UpdateLastData() override;
- const std::string& GetLabel() const override;
- void OnEditableUpdated(int selected_idx,
- IEditable::EditableState state) override;
- void OnDataUpdated(const std::string& provider_id,
- ComplicationType type,
- const std::unique_ptr<tizen_base::Bundle>& data) override;
- void OnProviderError(const std::string& provider_id, ComplicationType type,
- int error) override;
- void OnNotifyDataUpdate() override;
- int GetEditableId() const override;
- int SetEditableId(int id) override;
- void SetLabel(const std::string& name) override;
- void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() const override;
- int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
- std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
- int UpdateLastContext() override;
- std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
- std::string GetSetupAppId() const override;
-
- int GetComplicationId() const;
- int SendDataUpdateRequest(bool launch_option = true);
- std::string GetCurProviderId() const;
- std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
- int GetProviderType(const tizen_base::Bundle& candidate_data) const;
- int GetCurType() const;
- int TouchLaunch(watchface_complication_event_type_e event_type);
- int ApplyAllowedList(
- std::list<std::unique_ptr<ProviderInfo>> allowed_list);
- int ApplyDeniedList(
- std::list<std::unique_ptr<ProviderInfo>> denied_list);
- int ApplyPriorityList(
- std::list<std::unique_ptr<ProviderInfo>> allowed_list);
- int ClearAllowedList();
- int ClearPriorityList();
- int ClearDeniedList();
- int Init();
- void SetListeningStatus(watchface_complication_consumer_status_e state);
- void NotifyListeningStatus(watchface_complication_consumer_status_e state);
-
- public:
- static const char* GetProviderIdKey();
- static const char* GetProviderTypeKey();
- static const char* GetSupportedEventsErrorKey();
- static const char* GetPrivilegeErrorKey();
- static gboolean PeriodCallback(gpointer user_data);
- static int GetDefaultData(
- std::string provider_id, int type, tizen_base::Bundle* data);
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_COMPLICATION_H_
--- /dev/null
+/*
+ * 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_COMPLICATION_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication-provider/complication-provider-event-interface.hh"
+#include "watchface-complication/editable-interface.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
+
+namespace watchface_complication {
+
+class EXPORT_API Complication : public IEditable
+ , public IComplicationProviderEvent {
+ public:
+ Complication(int id, int supported_types, int supported_event_types,
+ const std::string& default_provider_id,
+ ComplicationType default_type);
+ virtual ~Complication();
+
+ public:
+ class ProviderInfo {
+ public:
+ ProviderInfo(std::string provider_id, int types)
+ : provider_id_(provider_id), types_(types) {
+ }
+
+ const std::string& GetProviderId() const {
+ return provider_id_;
+ }
+
+ int GetTypes() const {
+ return types_;
+ }
+
+ private:
+ std::string provider_id_;
+ int types_;
+ };
+
+ int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+ std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
+ int SetCurDataIdx(int cur_data_idx) override;
+ int GetLastDataIdx() const override;
+ int UpdateLastData() override;
+ const std::string& GetLabel() const override;
+ void OnEditableUpdated(int selected_idx,
+ IEditable::EditableState state) override;
+ void OnDataUpdated(const std::string& provider_id,
+ ComplicationType type,
+ const std::unique_ptr<tizen_base::Bundle>& data) override;
+ void OnProviderError(const std::string& provider_id, ComplicationType type,
+ int error) override;
+ void OnNotifyDataUpdate() override;
+ int GetEditableId() const override;
+ int SetEditableId(int id) override;
+ void SetLabel(const std::string& name) override;
+ void SetState(IEditable::EditableState state) override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+ int UpdateLastContext() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
+
+ int GetComplicationId() const;
+ int SendDataUpdateRequest(bool launch_option = true);
+ std::string GetCurProviderId() const;
+ std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
+ int GetProviderType(const tizen_base::Bundle& candidate_data) const;
+ int GetCurType() const;
+ int TouchLaunch(watchface_complication_event_type_e event_type);
+ int ApplyAllowedList(
+ std::list<std::unique_ptr<ProviderInfo>> allowed_list);
+ int ApplyDeniedList(
+ std::list<std::unique_ptr<ProviderInfo>> denied_list);
+ int ApplyPriorityList(
+ std::list<std::unique_ptr<ProviderInfo>> allowed_list);
+ int ClearAllowedList();
+ int ClearPriorityList();
+ int ClearDeniedList();
+ int Init();
+ void SetListeningStatus(watchface_complication_consumer_status_e state);
+ void NotifyListeningStatus(watchface_complication_consumer_status_e state);
+
+ public:
+ static const char* GetProviderIdKey();
+ static const char* GetProviderTypeKey();
+ static const char* GetSupportedEventsErrorKey();
+ static const char* GetPrivilegeErrorKey();
+ static gboolean PeriodCallback(gpointer user_data);
+ static int GetDefaultData(
+ std::string provider_id, int type, tizen_base::Bundle* data);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_COMPLICATION_H_
#include <pkgmgr_installer_info.h>
#include <vconf.h>
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-common/watchface-util.h"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-common/watchface-util.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_DB_MANAGER_H_
-#define WATCHFACE_COMPLICATION_DB_MANAGER_H_
-
-#include <gio/gio.h>
-#include <sqlite3.h>
-#include <watchface-common.h>
-#include <bundle_cpp.h>
-
-#include <string>
-#include <memory>
-#include <list>
-
-namespace watchface_complication {
-
-class EXPORT_API DBManager {
- public:
- class ProviderInfo {
- std::string provider_id_;
- int type_;
- public:
- ProviderInfo(std::string provider_id, int type)
- : provider_id_(provider_id), type_(type) {
- }
- std::string& GetProviderId() {
- return provider_id_;
- }
- int GetType() {
- return type_;
- }
- };
- static std::unique_ptr<tizen_base::Bundle> GetDefaultData(
- const char* provider_id, int support_type);
- static std::string GetProviderAppId(const char* provider_id);
- static std::list<std::string> GetRequiredPrivilegeList(
- std::string& provider_id);
- static int GetRequiredSupportEvents(std::string& provider_id);
- static std::list<std::unique_ptr<ProviderInfo>> GetProviderListWithTypes(
- int supported_types);
- static int GetSupportTypes(std::string& provider_id, int* types);
- static int GetProviderPeriod(std::string& provider_id, int* period);
- static std::string GetLabel(const char* provider_id);
- static std::string GetIcon(std::string provider_id, std::string locale);
- static std::string GetSetupAppId(const char* provider_id);
- static bool IsProviderExist(std::string& provider_id, int support_type);
- static std::list<std::string> GetProviderListWithAppId(const char* provider_id);
- static int GetTrustedInfo(std::string& provider_id, bool* trusted);
- static std::string GetSystemLocale();
-
- private:
- DBManager(); /* LCOV_EXCL_LINE */
- virtual ~DBManager(); /* LCOV_EXCL_LINE */
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_DB_MANAGER_H_
--- /dev/null
+/*
+ * 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_DB_MANAGER_H_
+#define WATCHFACE_COMPLICATION_DB_MANAGER_H_
+
+#include <gio/gio.h>
+#include <sqlite3.h>
+#include <watchface-common.h>
+#include <bundle_cpp.h>
+
+#include <string>
+#include <memory>
+#include <list>
+
+namespace watchface_complication {
+
+class EXPORT_API DBManager {
+ public:
+ class ProviderInfo {
+ std::string provider_id_;
+ int type_;
+ public:
+ ProviderInfo(std::string provider_id, int type)
+ : provider_id_(provider_id), type_(type) {
+ }
+ std::string& GetProviderId() {
+ return provider_id_;
+ }
+ int GetType() {
+ return type_;
+ }
+ };
+ static std::unique_ptr<tizen_base::Bundle> GetDefaultData(
+ const char* provider_id, int support_type);
+ static std::string GetProviderAppId(const char* provider_id);
+ static std::list<std::string> GetRequiredPrivilegeList(
+ std::string& provider_id);
+ static int GetRequiredSupportEvents(std::string& provider_id);
+ static std::list<std::unique_ptr<ProviderInfo>> GetProviderListWithTypes(
+ int supported_types);
+ static int GetSupportTypes(std::string& provider_id, int* types);
+ static int GetProviderPeriod(std::string& provider_id, int* period);
+ static std::string GetLabel(const char* provider_id);
+ static std::string GetIcon(std::string provider_id, std::string locale);
+ static std::string GetSetupAppId(const char* provider_id);
+ static bool IsProviderExist(std::string& provider_id, int support_type);
+ static std::list<std::string> GetProviderListWithAppId(const char* provider_id);
+ static int GetTrustedInfo(std::string& provider_id, bool* trusted);
+ static std::string GetSystemLocale();
+
+ private:
+ DBManager(); /* LCOV_EXCL_LINE */
+ virtual ~DBManager(); /* LCOV_EXCL_LINE */
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_DB_MANAGER_H_
+++ /dev/null
-/*
- * 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_DESIGN_ELEMENT_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/editables-manager.h"
-
-namespace watchface_complication {
-
-class DesignElement::Impl {
- public:
- virtual ~Impl() = default;
-
- private:
- friend class DesignElement;
- Impl(DesignElement* parent, int id, int cur_data_idx);
- Impl(Impl const& other) = default;
- Impl(Impl && other) = default;
- Impl& operator=(Impl const& other) = default;
- Impl& operator=(Impl && other) = default;
-
- private:
- DesignElement* parent_;
- int id_ = -1;
- int cur_data_idx_;
- int last_data_idx_;
- std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
- std::shared_ptr<IEditable::Highlight> highlight_;
- EditableShapeType shape_type_ = Circle;
- std::string name_;
- IEditable::EditableState ed_state_ = Complete;
- std::unique_ptr<tizen_base::Bundle> context_data_;
- std::unique_ptr<tizen_base::Bundle> last_context_data_;
- EditablesManager& editables_manager_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
-
-
-
--- /dev/null
+/*
+ * 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_DESIGN_ELEMENT_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/editables-manager.hh"
+
+namespace watchface_complication {
+
+class DesignElement::Impl {
+ public:
+ virtual ~Impl() = default;
+
+ private:
+ friend class DesignElement;
+ Impl(DesignElement* parent, int id, int cur_data_idx);
+ Impl(Impl const& other) = default;
+ Impl(Impl && other) = default;
+ Impl& operator=(Impl const& other) = default;
+ Impl& operator=(Impl && other) = default;
+
+ private:
+ DesignElement* parent_;
+ int id_ = -1;
+ int cur_data_idx_;
+ int last_data_idx_;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+ std::shared_ptr<IEditable::Highlight> highlight_;
+ EditableShapeType shape_type_ = Circle;
+ std::string name_;
+ IEditable::EditableState ed_state_ = Complete;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
+ EditablesManager& editables_manager_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
+
+
+
#include <unistd.h>
#include <utility>
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/design-element-implementation.h"
-#include "watchface-complication/editables-manager.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/design-element-implementation.hh"
+#include "watchface-complication/editables-manager.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_DESIGN_ELEMENT_H_
-#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editable-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API DesignElement : public IEditable {
- public:
- DesignElement(int id, int cur_data_idx);
- virtual ~DesignElement();
- DesignElement(DesignElement const& other) = default;
- DesignElement(DesignElement && other) = default;
- DesignElement& operator=(DesignElement const& other) = default;
- DesignElement& operator=(DesignElement && other) = default;
-
- public:
- int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
- std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
- std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
- std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
- std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
- int GetCurDataIdx() const override;
- int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() const override;
- int UpdateLastData() override;
- const std::string& GetLabel() const override;
- void OnEditableUpdated(int selected_idx,
- IEditable::EditableState state) override;
- int GetEditableId() const override;
- int SetEditableId(int id) override;
- void SetLabel(const std::string& name) override;
- void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() const override;
- int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
- std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
- int UpdateLastContext() override;
- std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
- std::string GetSetupAppId() const override;
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
--- /dev/null
+/*
+ * 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_DESIGN_ELEMENT_H_
+#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editable-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API DesignElement : public IEditable {
+ public:
+ DesignElement(int id, int cur_data_idx);
+ virtual ~DesignElement();
+ DesignElement(DesignElement const& other) = default;
+ DesignElement(DesignElement && other) = default;
+ DesignElement& operator=(DesignElement const& other) = default;
+ DesignElement& operator=(DesignElement && other) = default;
+
+ public:
+ int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+ std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
+ int SetCurDataIdx(int cur_data_idx) override;
+ int GetLastDataIdx() const override;
+ int UpdateLastData() override;
+ const std::string& GetLabel() const override;
+ void OnEditableUpdated(int selected_idx,
+ IEditable::EditableState state) override;
+ int GetEditableId() const override;
+ int SetEditableId(int id) override;
+ void SetLabel(const std::string& name) override;
+ void SetState(IEditable::EditableState state) override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+ int UpdateLastContext() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
+++ /dev/null
-/*
- * 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_EDITABLE_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
-#include <bundle_cpp.h>
-
-#include <string>
-#include <list>
-#include <memory>
-
-#include "watchface-complication/include/watchface-editable.h"
-
-namespace watchface_complication {
-
-class IEditable {
- public:
- enum EditableShapeType {
- Circle = WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE,
- Rectangle = WATCHFACE_EDITABLE_SHAPE_TYPE_RECT
- };
-
- enum EditableState {
- Complete = WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE,
- OnGoing = WATCHFACE_EDITABLE_EDIT_STATE_ONGOING,
- Cancel = WATCHFACE_EDITABLE_EDIT_STATE_CANCEL
- };
-
- class Geometry {
- public:
- Geometry()
- : x_(0), y_(0), w_(0), h_(0) {
- }
-
- Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
- }
-
- Geometry(Geometry&& info)
- : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
- }
-
- Geometry(const Geometry& info)
- : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
- }
-
- Geometry& operator = (const Geometry& info) {
- if (this != &info) {
- x_ = info.GetX();
- y_ = info.GetY();
- w_ = info.GetW();
- h_ = info.GetH();
- }
- return *this;
- }
-
- Geometry& operator = (Geometry&& info) noexcept {
- if (this != &info) {
- x_ = info.GetX();
- y_ = info.GetY();
- w_ = info.GetW();
- h_ = info.GetH();
- }
- return *this;
- }
-
- const int GetX() const {
- return x_;
- }
-
- const int GetY() const {
- return y_;
- }
-
- const int GetW() const {
- return w_;
- }
-
- const int GetH() const {
- return h_;
- }
-
- void SetX(int x) {
- x_ = x;
- }
-
- void SetY(int y) {
- y_ = y;
- }
-
- void SetW(int w) {
- w_ = w;
- }
-
- void SetH(int h) {
- h_ = h;
- }
-
- private:
- int x_;
- int y_;
- int w_;
- int h_;
- };
-
- class NormalizedGeometry {
- public:
- NormalizedGeometry()
- : norm_x_(0), norm_y_(0), norm_w_(0), norm_h_(0) {
- }
-
- NormalizedGeometry(double norm_x, double norm_y, double norm_w, double norm_h)
- : norm_x_(norm_x), norm_y_(norm_y), norm_w_(norm_w), norm_h_(norm_h) {
- }
-
- NormalizedGeometry(NormalizedGeometry&& info)
- : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
- norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
- }
-
- NormalizedGeometry(const NormalizedGeometry& info)
- : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
- norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
- }
-
- NormalizedGeometry& operator = (const NormalizedGeometry& info) {
- if (this != &info) {
- norm_x_ = info.GetNormalizedX();
- norm_y_ = info.GetNormalizedY();
- norm_w_ = info.GetNormalizedW();
- norm_h_ = info.GetNormalizedH();
- }
- return *this;
- }
-
- NormalizedGeometry& operator = (NormalizedGeometry&& info) noexcept {
- if (this != &info) {
- norm_x_ = info.GetNormalizedX();
- norm_y_ = info.GetNormalizedY();
- norm_w_ = info.GetNormalizedW();
- norm_h_ = info.GetNormalizedH();
- }
- return *this;
- }
-
- const double GetNormalizedX() const {
- return norm_x_;
- }
-
- const double GetNormalizedY() const {
- return norm_y_;
- }
-
- const double GetNormalizedW() const {
- return norm_w_;
- }
-
- const double GetNormalizedH() const {
- return norm_h_;
- }
-
- void SetNormalizedX(double x) {
- norm_x_ = x;
- }
-
- void SetNormalizedY(double y) {
- norm_y_ = y;
- }
-
- void SetNormalizedW(double w) {
- norm_w_ = w;
- }
-
- void SetNormalizedH(double h) {
- norm_h_ = h;
- }
-
- private:
- double norm_x_;
- double norm_y_;
- double norm_w_;
- double norm_h_;
- };
-
- class Highlight {
- public:
- Highlight() {}
- Highlight(EditableShapeType shape_type)
- : geo_(std::move(std::unique_ptr<Geometry>(new Geometry(0, 0, 0, 0)))),
- norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
- shape_type_(shape_type) {
- }
-
- Highlight(std::unique_ptr<Geometry> geo, EditableShapeType shape_type)
- : geo_(std::move(geo)),
- norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
- shape_type_(shape_type) {
- }
-
- Highlight(tizen_base::Bundle encoded) {
- Decode(encoded);
- }
-
- Highlight(const Highlight& hi) {
- geo_ = std::unique_ptr<Geometry>(new Geometry(*hi.geo_));
- norm_geo_ = std::unique_ptr<NormalizedGeometry>(
- new NormalizedGeometry(*hi.norm_geo_));
- shape_type_ = hi.shape_type_;
- }
-
- const Geometry* GetGeometry() const {
- return geo_.get();
- }
-
- void SetGeometry(Geometry geo) {
- if (geo_.get() == NULL)
- geo_ = std::move(std::unique_ptr<Geometry>(new Geometry()));
- geo_.get()->SetX(geo.GetX());
- geo_.get()->SetY(geo.GetY());
- geo_.get()->SetW(geo.GetW());
- geo_.get()->SetH(geo.GetH());
- }
-
- void SetNormalizedGeometry(std::unique_ptr<NormalizedGeometry> geo) {
- norm_geo_ = std::move(geo);
- }
-
- const NormalizedGeometry* GetNormalizedGeometry() const {
- return norm_geo_.get();
- }
-
-
- void Encode(tizen_base::Bundle* encoded) {
- encoded->Add("SHAPE_TYPE", std::to_string(shape_type_));
- if (geo_ != nullptr) {
- encoded->Add("GEO_X", std::to_string(geo_->GetX()));
- encoded->Add("GEO_Y", std::to_string(geo_->GetY()));
- encoded->Add("GEO_W", std::to_string(geo_->GetW()));
- encoded->Add("GEO_H", std::to_string(geo_->GetH()));
- }
-
- if (norm_geo_ != nullptr) {
- encoded->Add("GEO_NORMALIZED_X",
- std::to_string(norm_geo_->GetNormalizedX()));
- encoded->Add("GEO_NORMALIZED_Y",
- std::to_string(norm_geo_->GetNormalizedY()));
- encoded->Add("GEO_NORMALIZED_W",
- std::to_string(norm_geo_->GetNormalizedW()));
- encoded->Add("GEO_NORMALIZED_H",
- std::to_string(norm_geo_->GetNormalizedH()));
- }
- }
-
- void Decode(tizen_base::Bundle encoded) {
- std::string shape_str = encoded.GetString("SHAPE_TYPE");
- if (shape_str.empty())
- return;
-
- shape_type_ = (EditableShapeType)stoi(shape_str);
- std::string x_str = encoded.GetString("GEO_X");
- if (!x_str.empty()) {
- std::string y_str = encoded.GetString("GEO_Y");
- std::string w_str = encoded.GetString("GEO_W");
- std::string h_str = encoded.GetString("GEO_H");
- geo_ = std::unique_ptr<Geometry>(new Geometry(
- stoi(x_str), stoi(y_str), stoi(w_str), stoi(h_str)));
- }
-
- std::string norm_x_str = encoded.GetString("GEO_NORMALIZED_X");
- if (!norm_x_str.empty()) {
- std::string norm_y_str = encoded.GetString("GEO_NORMALIZED_Y");
- std::string norm_w_str = encoded.GetString("GEO_NORMALIZED_W");
- std::string norm_h_str = encoded.GetString("GEO_NORMALIZED_H");
- norm_geo_ = std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(
- stof(norm_x_str), stof(norm_y_str), stof(norm_w_str), stof(norm_h_str)));
- }
- }
-
- const EditableShapeType GetShapeType() const {
- return shape_type_;
- }
-
- void SetShapeType(EditableShapeType shape_type) {
- shape_type_ = shape_type;
- }
-
- private:
- std::unique_ptr<Geometry> geo_;
- std::unique_ptr<NormalizedGeometry> norm_geo_;
- EditableShapeType shape_type_ = Circle;
- };
- virtual ~IEditable() = default;
- virtual int GetEditableId() const = 0;
- virtual int SetEditableId(int id) = 0;
- virtual std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const = 0;
- virtual int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) = 0;
- virtual std::shared_ptr<tizen_base::Bundle> GetCurData() const = 0;
- virtual std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const = 0;
- virtual int GetCurDataIdx() const = 0;
- virtual int SetCurDataIdx(int cur_data_idx) = 0;
- virtual int GetLastDataIdx() const = 0;
- virtual int UpdateLastData() = 0;
- virtual const std::string& GetLabel() const = 0;
- virtual void SetLabel(const std::string& name) = 0;
- virtual void OnEditableUpdated(int selected_idx, EditableState state) = 0;
- virtual void SetState(EditableState state) = 0;
- virtual EditableState GetState() const = 0;
- virtual std::string GetSetupAppId() const = 0;
- virtual int SetContext(std::unique_ptr<tizen_base::Bundle> context) = 0;
- virtual std::unique_ptr<tizen_base::Bundle>& GetContext() const = 0;
- virtual int UpdateLastContext() = 0;
- virtual std::unique_ptr<tizen_base::Bundle>& GetLastContext() const = 0;
- virtual std::shared_ptr<Highlight> GetHighlight() const = 0;
- virtual int SetHighlight(std::shared_ptr<Highlight> highlight) = 0;
- void SetEditSequence(int seq) {
- edit_sequence_ = seq;
- }
-
- int GetEditSequence() {
- return edit_sequence_;
- }
-
- private:
- int edit_sequence_ = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
--- /dev/null
+/*
+ * 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_EDITABLE_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
+#include <bundle_cpp.h>
+
+#include <string>
+#include <list>
+#include <memory>
+
+#include "watchface-complication/include/watchface-editable.h"
+
+namespace watchface_complication {
+
+class IEditable {
+ public:
+ enum EditableShapeType {
+ Circle = WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE,
+ Rectangle = WATCHFACE_EDITABLE_SHAPE_TYPE_RECT
+ };
+
+ enum EditableState {
+ Complete = WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE,
+ OnGoing = WATCHFACE_EDITABLE_EDIT_STATE_ONGOING,
+ Cancel = WATCHFACE_EDITABLE_EDIT_STATE_CANCEL
+ };
+
+ class Geometry {
+ public:
+ Geometry()
+ : x_(0), y_(0), w_(0), h_(0) {
+ }
+
+ Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
+ }
+
+ Geometry(Geometry&& info)
+ : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
+ }
+
+ Geometry(const Geometry& info)
+ : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
+ }
+
+ Geometry& operator = (const Geometry& info) {
+ if (this != &info) {
+ x_ = info.GetX();
+ y_ = info.GetY();
+ w_ = info.GetW();
+ h_ = info.GetH();
+ }
+ return *this;
+ }
+
+ Geometry& operator = (Geometry&& info) noexcept {
+ if (this != &info) {
+ x_ = info.GetX();
+ y_ = info.GetY();
+ w_ = info.GetW();
+ h_ = info.GetH();
+ }
+ return *this;
+ }
+
+ const int GetX() const {
+ return x_;
+ }
+
+ const int GetY() const {
+ return y_;
+ }
+
+ const int GetW() const {
+ return w_;
+ }
+
+ const int GetH() const {
+ return h_;
+ }
+
+ void SetX(int x) {
+ x_ = x;
+ }
+
+ void SetY(int y) {
+ y_ = y;
+ }
+
+ void SetW(int w) {
+ w_ = w;
+ }
+
+ void SetH(int h) {
+ h_ = h;
+ }
+
+ private:
+ int x_;
+ int y_;
+ int w_;
+ int h_;
+ };
+
+ class NormalizedGeometry {
+ public:
+ NormalizedGeometry()
+ : norm_x_(0), norm_y_(0), norm_w_(0), norm_h_(0) {
+ }
+
+ NormalizedGeometry(double norm_x, double norm_y, double norm_w, double norm_h)
+ : norm_x_(norm_x), norm_y_(norm_y), norm_w_(norm_w), norm_h_(norm_h) {
+ }
+
+ NormalizedGeometry(NormalizedGeometry&& info)
+ : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
+ norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
+ }
+
+ NormalizedGeometry(const NormalizedGeometry& info)
+ : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
+ norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
+ }
+
+ NormalizedGeometry& operator = (const NormalizedGeometry& info) {
+ if (this != &info) {
+ norm_x_ = info.GetNormalizedX();
+ norm_y_ = info.GetNormalizedY();
+ norm_w_ = info.GetNormalizedW();
+ norm_h_ = info.GetNormalizedH();
+ }
+ return *this;
+ }
+
+ NormalizedGeometry& operator = (NormalizedGeometry&& info) noexcept {
+ if (this != &info) {
+ norm_x_ = info.GetNormalizedX();
+ norm_y_ = info.GetNormalizedY();
+ norm_w_ = info.GetNormalizedW();
+ norm_h_ = info.GetNormalizedH();
+ }
+ return *this;
+ }
+
+ const double GetNormalizedX() const {
+ return norm_x_;
+ }
+
+ const double GetNormalizedY() const {
+ return norm_y_;
+ }
+
+ const double GetNormalizedW() const {
+ return norm_w_;
+ }
+
+ const double GetNormalizedH() const {
+ return norm_h_;
+ }
+
+ void SetNormalizedX(double x) {
+ norm_x_ = x;
+ }
+
+ void SetNormalizedY(double y) {
+ norm_y_ = y;
+ }
+
+ void SetNormalizedW(double w) {
+ norm_w_ = w;
+ }
+
+ void SetNormalizedH(double h) {
+ norm_h_ = h;
+ }
+
+ private:
+ double norm_x_;
+ double norm_y_;
+ double norm_w_;
+ double norm_h_;
+ };
+
+ class Highlight {
+ public:
+ Highlight() {}
+ Highlight(EditableShapeType shape_type)
+ : geo_(std::move(std::unique_ptr<Geometry>(new Geometry(0, 0, 0, 0)))),
+ norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
+ shape_type_(shape_type) {
+ }
+
+ Highlight(std::unique_ptr<Geometry> geo, EditableShapeType shape_type)
+ : geo_(std::move(geo)),
+ norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
+ shape_type_(shape_type) {
+ }
+
+ Highlight(tizen_base::Bundle encoded) {
+ Decode(encoded);
+ }
+
+ Highlight(const Highlight& hi) {
+ geo_ = std::unique_ptr<Geometry>(new Geometry(*hi.geo_));
+ norm_geo_ = std::unique_ptr<NormalizedGeometry>(
+ new NormalizedGeometry(*hi.norm_geo_));
+ shape_type_ = hi.shape_type_;
+ }
+
+ const Geometry* GetGeometry() const {
+ return geo_.get();
+ }
+
+ void SetGeometry(Geometry geo) {
+ if (geo_.get() == NULL)
+ geo_ = std::move(std::unique_ptr<Geometry>(new Geometry()));
+ geo_.get()->SetX(geo.GetX());
+ geo_.get()->SetY(geo.GetY());
+ geo_.get()->SetW(geo.GetW());
+ geo_.get()->SetH(geo.GetH());
+ }
+
+ void SetNormalizedGeometry(std::unique_ptr<NormalizedGeometry> geo) {
+ norm_geo_ = std::move(geo);
+ }
+
+ const NormalizedGeometry* GetNormalizedGeometry() const {
+ return norm_geo_.get();
+ }
+
+
+ void Encode(tizen_base::Bundle* encoded) {
+ encoded->Add("SHAPE_TYPE", std::to_string(shape_type_));
+ if (geo_ != nullptr) {
+ encoded->Add("GEO_X", std::to_string(geo_->GetX()));
+ encoded->Add("GEO_Y", std::to_string(geo_->GetY()));
+ encoded->Add("GEO_W", std::to_string(geo_->GetW()));
+ encoded->Add("GEO_H", std::to_string(geo_->GetH()));
+ }
+
+ if (norm_geo_ != nullptr) {
+ encoded->Add("GEO_NORMALIZED_X",
+ std::to_string(norm_geo_->GetNormalizedX()));
+ encoded->Add("GEO_NORMALIZED_Y",
+ std::to_string(norm_geo_->GetNormalizedY()));
+ encoded->Add("GEO_NORMALIZED_W",
+ std::to_string(norm_geo_->GetNormalizedW()));
+ encoded->Add("GEO_NORMALIZED_H",
+ std::to_string(norm_geo_->GetNormalizedH()));
+ }
+ }
+
+ void Decode(tizen_base::Bundle encoded) {
+ std::string shape_str = encoded.GetString("SHAPE_TYPE");
+ if (shape_str.empty())
+ return;
+
+ shape_type_ = (EditableShapeType)stoi(shape_str);
+ std::string x_str = encoded.GetString("GEO_X");
+ if (!x_str.empty()) {
+ std::string y_str = encoded.GetString("GEO_Y");
+ std::string w_str = encoded.GetString("GEO_W");
+ std::string h_str = encoded.GetString("GEO_H");
+ geo_ = std::unique_ptr<Geometry>(new Geometry(
+ stoi(x_str), stoi(y_str), stoi(w_str), stoi(h_str)));
+ }
+
+ std::string norm_x_str = encoded.GetString("GEO_NORMALIZED_X");
+ if (!norm_x_str.empty()) {
+ std::string norm_y_str = encoded.GetString("GEO_NORMALIZED_Y");
+ std::string norm_w_str = encoded.GetString("GEO_NORMALIZED_W");
+ std::string norm_h_str = encoded.GetString("GEO_NORMALIZED_H");
+ norm_geo_ = std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(
+ stof(norm_x_str), stof(norm_y_str), stof(norm_w_str), stof(norm_h_str)));
+ }
+ }
+
+ const EditableShapeType GetShapeType() const {
+ return shape_type_;
+ }
+
+ void SetShapeType(EditableShapeType shape_type) {
+ shape_type_ = shape_type;
+ }
+
+ private:
+ std::unique_ptr<Geometry> geo_;
+ std::unique_ptr<NormalizedGeometry> norm_geo_;
+ EditableShapeType shape_type_ = Circle;
+ };
+ virtual ~IEditable() = default;
+ virtual int GetEditableId() const = 0;
+ virtual int SetEditableId(int id) = 0;
+ virtual std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const = 0;
+ virtual int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) = 0;
+ virtual std::shared_ptr<tizen_base::Bundle> GetCurData() const = 0;
+ virtual std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const = 0;
+ virtual int GetCurDataIdx() const = 0;
+ virtual int SetCurDataIdx(int cur_data_idx) = 0;
+ virtual int GetLastDataIdx() const = 0;
+ virtual int UpdateLastData() = 0;
+ virtual const std::string& GetLabel() const = 0;
+ virtual void SetLabel(const std::string& name) = 0;
+ virtual void OnEditableUpdated(int selected_idx, EditableState state) = 0;
+ virtual void SetState(EditableState state) = 0;
+ virtual EditableState GetState() const = 0;
+ virtual std::string GetSetupAppId() const = 0;
+ virtual int SetContext(std::unique_ptr<tizen_base::Bundle> context) = 0;
+ virtual std::unique_ptr<tizen_base::Bundle>& GetContext() const = 0;
+ virtual int UpdateLastContext() = 0;
+ virtual std::unique_ptr<tizen_base::Bundle>& GetLastContext() const = 0;
+ virtual std::shared_ptr<Highlight> GetHighlight() const = 0;
+ virtual int SetHighlight(std::shared_ptr<Highlight> highlight) = 0;
+ void SetEditSequence(int seq) {
+ edit_sequence_ = seq;
+ }
+
+ int GetEditSequence() {
+ return edit_sequence_;
+ }
+
+ private:
+ int edit_sequence_ = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
+++ /dev/null
-/*
- * 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_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
-#include <bundle_cpp.h>
-
-#include <string>
-#include <list>
-#include <memory>
-
-#include "watchface-complication/complication.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IEditablesContainerEvent {
- public:
- virtual void OnEditResult(std::shared_ptr<IEditable> editable, int result) = 0;
- virtual void OnRequestEdit(const std::string& appid,
- std::list<std::shared_ptr<IEditable>> e_list) = 0;
- virtual void OnSetupReply(const std::string& appid, int editable_id,
- std::unique_ptr<tizen_base::Bundle> context) = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
--- /dev/null
+/*
+ * 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_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+#include <bundle_cpp.h>
+
+#include <string>
+#include <list>
+#include <memory>
+
+#include "watchface-complication/complication.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IEditablesContainerEvent {
+ public:
+ virtual void OnEditResult(std::shared_ptr<IEditable> editable, int result) = 0;
+ virtual void OnRequestEdit(const std::string& appid,
+ std::list<std::shared_ptr<IEditable>> e_list) = 0;
+ virtual void OnSetupReply(const std::string& appid, int editable_id,
+ std::unique_ptr<tizen_base::Bundle> context) = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+++ /dev/null
-/*
- * 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_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-
-namespace watchface_complication {
-
-class EditablesContainer::Impl : IGDBus::IGDBusEvent {
- public:
- virtual ~Impl();
-
- private:
- friend class EditablesContainer;
-
- void OnSignal(GDBusConnection* connection,
- const std::string& sender_name,
- const std::string& object_path,
- const std::string& interface_name,
- const std::string& signal_name,
- GVariant* parameters) override;
- void OnVanish(const std::string& name) override;
- void OnAppear(const std::string& name, const std::string& name_owner) override;
- void CancelEditing();
- explicit Impl(EditablesContainer* parent);
- Impl(Impl const& other) = default;
- Impl(Impl && other) = default;
- Impl& operator=(Impl const& other) = default;
- Impl& operator=(Impl && other) = default;
-
- private:
- EditablesContainer* parent_;
- int subscribe_id_;
- std::string editor_id_;
- std::string sender_name_;
- int watcher_id_ = -1;
- std::list<std::shared_ptr<IEditable>> ed_list_;
- std::unique_ptr<IGDBus> gdbus_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-
-
-
--- /dev/null
+/*
+ * 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_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+namespace watchface_complication {
+
+class EditablesContainer::Impl : IGDBus::IGDBusEvent {
+ public:
+ virtual ~Impl();
+
+ private:
+ friend class EditablesContainer;
+
+ void OnSignal(GDBusConnection* connection,
+ const std::string& sender_name,
+ const std::string& object_path,
+ const std::string& interface_name,
+ const std::string& signal_name,
+ GVariant* parameters) override;
+ void OnVanish(const std::string& name) override;
+ void OnAppear(const std::string& name, const std::string& name_owner) override;
+ void CancelEditing();
+ explicit Impl(EditablesContainer* parent);
+ Impl(Impl const& other) = default;
+ Impl(Impl && other) = default;
+ Impl& operator=(Impl const& other) = default;
+ Impl& operator=(Impl && other) = default;
+
+ private:
+ EditablesContainer* parent_;
+ int subscribe_id_;
+ std::string editor_id_;
+ std::string sender_name_;
+ int watcher_id_ = -1;
+ std::list<std::shared_ptr<IEditable>> ed_list_;
+ std::unique_ptr<IGDBus> gdbus_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+
+
+
#include <utility>
#include <vector>
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/editables-container-implementation.h"
-#include "watchface-complication/complication-internal.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-complication/gdbus-interface.h"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/editables-container-implementation.hh"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-complication/gdbus-interface.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_EDITABLES_CONTAINER_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-editor/editables-editor-event-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesContainer : IEditablesEditorEvent {
- public:
- EditablesContainer();
- virtual ~EditablesContainer(); /* LCOV_EXCL_LINE */
- int Add(std::shared_ptr<IEditable> ed, int editable_id);
- int Remove(std::shared_ptr<IEditable> ed);
- int RequestEdit();
- void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
- IEditable::EditableState state) override;
- void OnEditReady(const std::string& editor_id) override;
- bool IsExist(int editable_id);
- bool SendEditResult(int editable_id, int edit_seq, int result);
-
- private:
- bool SendEventToEditor(std::string cmd, GVariant* data);
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
--- /dev/null
+/*
+ * 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_EDITABLES_CONTAINER_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-editor/editables-editor-event-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesContainer : IEditablesEditorEvent {
+ public:
+ EditablesContainer();
+ virtual ~EditablesContainer(); /* LCOV_EXCL_LINE */
+ int Add(std::shared_ptr<IEditable> ed, int editable_id);
+ int Remove(std::shared_ptr<IEditable> ed);
+ int RequestEdit();
+ void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
+ IEditable::EditableState state) override;
+ void OnEditReady(const std::string& editor_id) override;
+ bool IsExist(int editable_id);
+ bool SendEditResult(int editable_id, int edit_seq, int result);
+
+ private:
+ bool SendEventToEditor(std::string cmd, GVariant* data);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
+++ /dev/null
-/*
- * 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_EDITABLES_MANAGER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <app_common.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-
-namespace watchface_complication {
-
-class EditablesManager::Impl {
- public:
- virtual ~Impl() {
- if (setting_db_ != NULL)
- sqlite3_close(setting_db_);
- if (context_db_ != NULL)
- sqlite3_close(context_db_);
- }
-
- private:
- friend class EditablesManager;
- Impl();
- static std::string GetEditablesDataPath() {
- char* app_data_path = app_get_data_path();
- char setting_data_path[PATH_MAX] = {0, };
-
- if (app_data_path != NULL) {
- snprintf(setting_data_path, PATH_MAX, "%s.watchface_editables.db",
- app_data_path);
- LOGI("get setting data path %s", setting_data_path);
- free(app_data_path);
- }
-
- return std::string(setting_data_path);
- }
-
- private:
- sqlite3* setting_db_ = NULL;
- sqlite3* context_db_ = NULL;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * 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_EDITABLES_MANAGER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <app_common.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+
+namespace watchface_complication {
+
+class EditablesManager::Impl {
+ public:
+ virtual ~Impl() {
+ if (setting_db_ != NULL)
+ sqlite3_close(setting_db_);
+ if (context_db_ != NULL)
+ sqlite3_close(context_db_);
+ }
+
+ private:
+ friend class EditablesManager;
+ Impl();
+ static std::string GetEditablesDataPath() {
+ char* app_data_path = app_get_data_path();
+ char setting_data_path[PATH_MAX] = {0, };
+
+ if (app_data_path != NULL) {
+ snprintf(setting_data_path, PATH_MAX, "%s.watchface_editables.db",
+ app_data_path);
+ LOGI("get setting data path %s", setting_data_path);
+ free(app_data_path);
+ }
+
+ return std::string(setting_data_path);
+ }
+
+ private:
+ sqlite3* setting_db_ = NULL;
+ sqlite3* context_db_ = NULL;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
#include <aul.h>
#include <sqlite3.h>
-#include "watchface-complication/editables-manager.h"
-#include "watchface-complication/editables-manager-implementation.h"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-complication/editables-manager-implementation.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_EDITABLES_MANAGER_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
-
-#include <gio/gio.h>
-#include <watchface-common.h>
-#include <bundle_cpp.h>
-
-#include <string>
-#include <memory>
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesManager {
- public:
- static EditablesManager& GetInst();
- int StoreSetting(int editable_id, bundle_raw* raw_data);
- std::unique_ptr<tizen_base::Bundle> LoadSetting(int editable_id);
- int StoreContext(int editable_id, const char* provider_id,
- tizen_base::Bundle* context);
- std::unique_ptr<tizen_base::Bundle> LoadContext(
- int editable_id, const char* provider_id);
- int DeleteContext(int editable_id, const char* provider_id);
-
- private:
- EditablesManager();
- virtual ~EditablesManager();
- int Init();
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
--- /dev/null
+/*
+ * 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_EDITABLES_MANAGER_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
+
+#include <gio/gio.h>
+#include <watchface-common.h>
+#include <bundle_cpp.h>
+
+#include <string>
+#include <memory>
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesManager {
+ public:
+ static EditablesManager& GetInst();
+ int StoreSetting(int editable_id, bundle_raw* raw_data);
+ std::unique_ptr<tizen_base::Bundle> LoadSetting(int editable_id);
+ int StoreContext(int editable_id, const char* provider_id,
+ tizen_base::Bundle* context);
+ std::unique_ptr<tizen_base::Bundle> LoadContext(
+ int editable_id, const char* provider_id);
+ int DeleteContext(int editable_id, const char* provider_id);
+
+ private:
+ EditablesManager();
+ virtual ~EditablesManager();
+ int Init();
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
+++ /dev/null
-/*
- * 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_GDBUS_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
-
-#include <string>
-
-namespace watchface_complication {
-
-class IGDBus {
- public:
- enum SigType {
- Complication,
- Editable
- };
- class IGDBusEvent {
- public:
- virtual void OnSignal(GDBusConnection* connection,
- const std::string& sender_name,
- const std::string& object_path,
- const std::string& interface_name,
- const std::string& signal_name,
- GVariant* parameters) = 0;
- virtual void OnVanish(const std::string& name) = 0;
- virtual void OnAppear(const std::string& name,
- const std::string& name_owner) = 0;
- };
- virtual ~IGDBus() = default;
- virtual int Watch(std::string id, IGDBusEvent* listener) = 0;
- virtual void UnWatch(int watcher_id) = 0;
- virtual bool EmitSignal(SigType type, std::string target_id, std::string id,
- int sub_id, std::string cmd, GVariant* data) = 0;
- virtual int SubscribeSignal(SigType type, std::string id, int sub_id,
- IGDBusEvent* listener) = 0;
- virtual void UnSubscribeSignal(int subscribe_id) = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
--- /dev/null
+/*
+ * 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_GDBUS_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
+
+#include <string>
+
+namespace watchface_complication {
+
+class IGDBus {
+ public:
+ enum SigType {
+ Complication,
+ Editable
+ };
+ class IGDBusEvent {
+ public:
+ virtual void OnSignal(GDBusConnection* connection,
+ const std::string& sender_name,
+ const std::string& object_path,
+ const std::string& interface_name,
+ const std::string& signal_name,
+ GVariant* parameters) = 0;
+ virtual void OnVanish(const std::string& name) = 0;
+ virtual void OnAppear(const std::string& name,
+ const std::string& name_owner) = 0;
+ };
+ virtual ~IGDBus() = default;
+ virtual int Watch(std::string id, IGDBusEvent* listener) = 0;
+ virtual void UnWatch(int watcher_id) = 0;
+ virtual bool EmitSignal(SigType type, std::string target_id, std::string id,
+ int sub_id, std::string cmd, GVariant* data) = 0;
+ virtual int SubscribeSignal(SigType type, std::string id, int sub_id,
+ IGDBusEvent* listener) = 0;
+ virtual void UnSubscribeSignal(int subscribe_id) = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
+++ /dev/null
-/*
- * 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_GDBUS_H_
-#define WATCHFACE_COMPLICATION_GDBUS_H_
-
-#include <unistd.h>
-#include <dlog.h>
-
-#include <memory>
-#include <list>
-#include <string>
-
-#include "watchface-common/watchface-util.h"
-#include "watchface-complication/gdbus-interface.h"
-
-#define COMPLICATION_INTERFACE "org.tizen.watchface_complication"
-
-namespace watchface_complication {
-
-class GDBus : public IGDBus {
- public:
- GDBus(GDBusConnection* conn)
- : conn_(conn) { }
-
- virtual ~GDBus() {
- for (auto& id : subscribe_list_) {
- g_dbus_connection_signal_unsubscribe(conn_, id);
- }
- }
-
- int Watch(std::string appid, IGDBus::IGDBusEvent* listener) {
- int watcher_id;
- std::string name;
-
- LOGI("watch on : %s", appid.c_str());
- name = util::EncodeStr(util::EncodeType::Name, appid);
- watcher_id = g_bus_watch_name_on_connection(
- conn_,
- name.c_str(),
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- AppearCb,
- VanishCb,
- listener,
- NULL);
- LOGI("watch %s, %d", name.c_str(), watcher_id);
-
- if (watcher_id == 0) {
- LOGI("watch on name failed %s, %d", name.c_str(), watcher_id);
- THROW(WATCHFACE_COMPLICATION_ERROR_IO_ERROR);
- }
-
- return watcher_id;
- }
-
- void UnWatch(int watcher_id) {
- LOGI("unwatch : %d", watcher_id);
- g_bus_unwatch_name(watcher_id);
- }
-
- bool EmitSignal(SigType type, std::string target_id, std::string id,
- int sub_id, std::string cmd, GVariant* data) {
- GError* err = NULL;
- gboolean result = TRUE;
- std::string path = util::EncodeStr(
- type == Complication ?
- util::EncodeType::CompPath : util::EncodeType::EditablePath,
- id, sub_id);
- std::string name = util::EncodeStr(util::EncodeType::Name, target_id);
-
- LOGI("emit : %s, %s, %d, %s", target_id.c_str(), id.c_str(), sub_id,
- cmd.c_str());
- LOGI("emit signal %s, %s", name.empty() ? NULL : name.c_str(), path.c_str());
- result = g_dbus_connection_emit_signal(
- conn_,
- name.empty() ? NULL : name.c_str(),
- path.c_str(),
- COMPLICATION_INTERFACE,
- cmd.c_str(), data, &err);
- if (result == FALSE) {
- LOGE("g_dbus_connection_emit_signal() is failed");
- if (err != NULL) {
- LOGE("g_dbus_connection_emit_signal() err : %s",
- err->message);
- g_error_free(err);
- }
- } else {
- LOGI("Successfully emit signal to %s, %s, %s", name.c_str(), path.c_str(),
- cmd.c_str());
- }
- return result;
- }
-
- void UnSubscribeSignal(int subscribe_id) {
- LOGI("unsubscribe : %d", subscribe_id);
- g_dbus_connection_signal_unsubscribe(conn_, subscribe_id);
- }
-
- int SubscribeSignal(SigType type, std::string id,
- int sub_id, IGDBus::IGDBusEvent* listener) {
- LOGI("subscribe : %s, %d", id.c_str(), sub_id);
- std::string path = util::EncodeStr(
- type == Complication ?
- util::EncodeType::CompPath : util::EncodeType::EditablePath,
- id, sub_id);
- int subscribe_id = g_dbus_connection_signal_subscribe(
- conn_,
- NULL,
- COMPLICATION_INTERFACE,
- NULL,
- path.c_str(),
- NULL,
- G_DBUS_SIGNAL_FLAGS_NONE,
- SignalCb,
- listener,
- NULL);
- if (subscribe_id == 0) {
- LOGE("subscribe fail (%s)", path.c_str());
- return 0;
- }
-
- LOGI("subscribe %s, %d", path.c_str(), subscribe_id);
- subscribe_list_.push_back(subscribe_id);
-
- return subscribe_id;
- }
-
- private:
- static void SignalCb(GDBusConnection* connection,
- const gchar* sender_name,
- const gchar* object_path,
- const gchar* interface_name,
- const gchar* signal_name,
- GVariant* parameters,
- void* user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
-
- rs->OnSignal(connection, sender_name, object_path, interface_name,
- signal_name, parameters);
- }
-
- static void VanishCb(GDBusConnection* connection,
- const gchar* name, gpointer user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
- rs->OnVanish(name);
- }
-
- static void AppearCb(GDBusConnection* connection,
- const gchar* name, const gchar* name_owner, gpointer user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
- rs->OnAppear(name, name_owner);
- }
-
- private:
- std::list<int> subscribe_list_;
- GDBusConnection* conn_ = nullptr;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_GDBUS_H_
--- /dev/null
+/*
+ * 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_GDBUS_H_
+#define WATCHFACE_COMPLICATION_GDBUS_H_
+
+#include <unistd.h>
+#include <dlog.h>
+
+#include <memory>
+#include <list>
+#include <string>
+
+#include "watchface-common/watchface-util.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+#define COMPLICATION_INTERFACE "org.tizen.watchface_complication"
+
+namespace watchface_complication {
+
+class GDBus : public IGDBus {
+ public:
+ GDBus(GDBusConnection* conn)
+ : conn_(conn) { }
+
+ virtual ~GDBus() {
+ for (auto& id : subscribe_list_) {
+ g_dbus_connection_signal_unsubscribe(conn_, id);
+ }
+ }
+
+ int Watch(std::string appid, IGDBus::IGDBusEvent* listener) {
+ int watcher_id;
+ std::string name;
+
+ LOGI("watch on : %s", appid.c_str());
+ name = util::EncodeStr(util::EncodeType::Name, appid);
+ watcher_id = g_bus_watch_name_on_connection(
+ conn_,
+ name.c_str(),
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ AppearCb,
+ VanishCb,
+ listener,
+ NULL);
+ LOGI("watch %s, %d", name.c_str(), watcher_id);
+
+ if (watcher_id == 0) {
+ LOGI("watch on name failed %s, %d", name.c_str(), watcher_id);
+ THROW(WATCHFACE_COMPLICATION_ERROR_IO_ERROR);
+ }
+
+ return watcher_id;
+ }
+
+ void UnWatch(int watcher_id) {
+ LOGI("unwatch : %d", watcher_id);
+ g_bus_unwatch_name(watcher_id);
+ }
+
+ bool EmitSignal(SigType type, std::string target_id, std::string id,
+ int sub_id, std::string cmd, GVariant* data) {
+ GError* err = NULL;
+ gboolean result = TRUE;
+ std::string path = util::EncodeStr(
+ type == Complication ?
+ util::EncodeType::CompPath : util::EncodeType::EditablePath,
+ id, sub_id);
+ std::string name = util::EncodeStr(util::EncodeType::Name, target_id);
+
+ LOGI("emit : %s, %s, %d, %s", target_id.c_str(), id.c_str(), sub_id,
+ cmd.c_str());
+ LOGI("emit signal %s, %s", name.empty() ? NULL : name.c_str(), path.c_str());
+ result = g_dbus_connection_emit_signal(
+ conn_,
+ name.empty() ? NULL : name.c_str(),
+ path.c_str(),
+ COMPLICATION_INTERFACE,
+ cmd.c_str(), data, &err);
+ if (result == FALSE) {
+ LOGE("g_dbus_connection_emit_signal() is failed");
+ if (err != NULL) {
+ LOGE("g_dbus_connection_emit_signal() err : %s",
+ err->message);
+ g_error_free(err);
+ }
+ } else {
+ LOGI("Successfully emit signal to %s, %s, %s", name.c_str(), path.c_str(),
+ cmd.c_str());
+ }
+ return result;
+ }
+
+ void UnSubscribeSignal(int subscribe_id) {
+ LOGI("unsubscribe : %d", subscribe_id);
+ g_dbus_connection_signal_unsubscribe(conn_, subscribe_id);
+ }
+
+ int SubscribeSignal(SigType type, std::string id,
+ int sub_id, IGDBus::IGDBusEvent* listener) {
+ LOGI("subscribe : %s, %d", id.c_str(), sub_id);
+ std::string path = util::EncodeStr(
+ type == Complication ?
+ util::EncodeType::CompPath : util::EncodeType::EditablePath,
+ id, sub_id);
+ int subscribe_id = g_dbus_connection_signal_subscribe(
+ conn_,
+ NULL,
+ COMPLICATION_INTERFACE,
+ NULL,
+ path.c_str(),
+ NULL,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ SignalCb,
+ listener,
+ NULL);
+ if (subscribe_id == 0) {
+ LOGE("subscribe fail (%s)", path.c_str());
+ return 0;
+ }
+
+ LOGI("subscribe %s, %d", path.c_str(), subscribe_id);
+ subscribe_list_.push_back(subscribe_id);
+
+ return subscribe_id;
+ }
+
+ private:
+ static void SignalCb(GDBusConnection* connection,
+ const gchar* sender_name,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* signal_name,
+ GVariant* parameters,
+ void* user_data) {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+
+ rs->OnSignal(connection, sender_name, object_path, interface_name,
+ signal_name, parameters);
+ }
+
+ static void VanishCb(GDBusConnection* connection,
+ const gchar* name, gpointer user_data) {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ rs->OnVanish(name);
+ }
+
+ static void AppearCb(GDBusConnection* connection,
+ const gchar* name, const gchar* name_owner, gpointer user_data) {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ rs->OnAppear(name, name_owner);
+ }
+
+ private:
+ std::list<int> subscribe_list_;
+ GDBusConnection* conn_ = nullptr;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_GDBUS_H_
char **icon_path);
int watchface_complication_data_get_aod_image_path(const bundle *shared_data,
char **image_path);
+int watchface_complication_data_get_aod_small_image_path(const bundle* data,
+ char** image_path);
+int watchface_complication_data_get_small_image_path(const bundle* data,
+ char** image_path);
typedef struct complication_denied_list_ *complication_denied_list_h;
typedef struct complication_priority_list_ *complication_priority_list_h;
+++ /dev/null
-/*
- * 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_PACKAGE_MANAGER_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
-
-#include <string>
-
-namespace watchface_complication {
-
-class IPackageManager {
- public:
- class IPackageEvent {
- public:
- virtual void OnAppDisabled(const std::string& appid) = 0;
- virtual void OnAppUninstalled(const std::string& appid) = 0;
- };
- virtual void Watch(IPackageEvent* pe) = 0;
- virtual void UnWatch(IPackageEvent* pe) = 0;
- virtual bool CheckDisabled(const std::string& appid) = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
--- /dev/null
+/*
+ * 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_PACKAGE_MANAGER_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
+
+#include <string>
+
+namespace watchface_complication {
+
+class IPackageManager {
+ public:
+ class IPackageEvent {
+ public:
+ virtual void OnAppDisabled(const std::string& appid) = 0;
+ virtual void OnAppUninstalled(const std::string& appid) = 0;
+ };
+ virtual void Watch(IPackageEvent* pe) = 0;
+ virtual void UnWatch(IPackageEvent* pe) = 0;
+ virtual bool CheckDisabled(const std::string& appid) = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
+++ /dev/null
-/*
- * 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_PACKAGE_MANAGER_H_
-#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
-
-#include <unistd.h>
-#include <dlog.h>
-
-#include <memory>
-#include <list>
-#include <string>
-
-namespace watchface_complication {
-
-class PackageManager : public IPackageManager {
- public:
- PackageManager() { }
- void Watch(IPackageEvent* pe) override {
- ComplicationConnector::GetInst().WatchPackageEvent(pe);
- }
- void UnWatch(IPackageEvent* pe) override {
- ComplicationConnector::GetInst().UnWatchPackageEvent(pe);
- }
- bool CheckDisabled(const std::string& appid) override {
- pkgmgrinfo_appinfo_h app_handle;
- int ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid.c_str(), &app_handle);
- if (ret != PMINFO_R_OK)
- return false;
- pkgmgrinfo_appinfo_destroy_appinfo(app_handle);
- return true;
- }
- private:
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
--- /dev/null
+/*
+ * 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_PACKAGE_MANAGER_H_
+#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
+
+#include <unistd.h>
+#include <dlog.h>
+
+#include <memory>
+#include <list>
+#include <string>
+
+namespace watchface_complication {
+
+class PackageManager : public IPackageManager {
+ public:
+ PackageManager() { }
+ void Watch(IPackageEvent* pe) override {
+ ComplicationConnector::GetInst().WatchPackageEvent(pe);
+ }
+ void UnWatch(IPackageEvent* pe) override {
+ ComplicationConnector::GetInst().UnWatchPackageEvent(pe);
+ }
+ bool CheckDisabled(const std::string& appid) override {
+ pkgmgrinfo_appinfo_h app_handle;
+ int ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid.c_str(), &app_handle);
+ if (ret != PMINFO_R_OK)
+ return false;
+ pkgmgrinfo_appinfo_destroy_appinfo(app_handle);
+ return true;
+ }
+ private:
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
+++ /dev/null
-/*
- * 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_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/received-editable.h"
-
-namespace watchface_complication {
-
-class ReceivedEditable::Impl {
- public:
- virtual ~Impl() = default;
-
- private:
- friend class ReceivedEditable;
- Impl(ReceivedEditable* parent, std::string raw);
- Impl(Impl const& other) = default;
- Impl(Impl && other) = default;
- Impl& operator=(Impl const& other) = default;
- Impl& operator=(Impl && other) = default;
-
- private:
- ReceivedEditable* parent_;
- int id_ = -1;
- tizen_base::Bundle* cur_data_ = nullptr;
- std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
- std::shared_ptr<IEditable::Highlight> highlight_;
- EditableShapeType shape_type_ = Circle;
- std::string name_;
- std::string setup_appid_;
- int cur_data_idx_ = -1;
- int last_data_idx_ = -1;
- IEditable::EditableState ed_state_ = Complete;
- std::unique_ptr<tizen_base::Bundle> context_data_;
- std::unique_ptr<tizen_base::Bundle> last_context_data_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-
-
-
--- /dev/null
+/*
+ * 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_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/received-editable.hh"
+
+namespace watchface_complication {
+
+class ReceivedEditable::Impl {
+ public:
+ virtual ~Impl() = default;
+
+ private:
+ friend class ReceivedEditable;
+ Impl(ReceivedEditable* parent, std::string raw);
+ Impl(Impl const& other) = default;
+ Impl(Impl && other) = default;
+ Impl& operator=(Impl const& other) = default;
+ Impl& operator=(Impl && other) = default;
+
+ private:
+ ReceivedEditable* parent_;
+ int id_ = -1;
+ tizen_base::Bundle* cur_data_ = nullptr;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+ std::shared_ptr<IEditable::Highlight> highlight_;
+ EditableShapeType shape_type_ = Circle;
+ std::string name_;
+ std::string setup_appid_;
+ int cur_data_idx_ = -1;
+ int last_data_idx_ = -1;
+ IEditable::EditableState ed_state_ = Complete;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+
+
+
#include <utility>
#include <vector>
-#include "watchface-complication/received-editable.h"
-#include "watchface-complication/received-editable-implementation.h"
-#include "watchface-common/watchface-exception.h"
+#include "watchface-complication/received-editable.hh"
+#include "watchface-complication/received-editable-implementation.hh"
+#include "watchface-common/watchface-exception.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_RECEIVED_EDITABLE_H_
-#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editable-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ReceivedEditable : public IEditable {
- public:
- explicit ReceivedEditable(std::string raw);
- virtual ~ReceivedEditable();
- ReceivedEditable(ReceivedEditable const& other) = default;
- ReceivedEditable(ReceivedEditable && other) = default;
- ReceivedEditable& operator=(ReceivedEditable const& other) = default;
- ReceivedEditable& operator=(ReceivedEditable && other) = default;
-
- public:
- int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
- std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
- std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
- std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
- std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
- int GetCurDataIdx() const override;
- int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() const override;
- int UpdateLastData() override;
- const std::string& GetLabel() const override;
- void OnEditableUpdated(int selected_idx,
- IEditable::EditableState state) override;
- int GetEditableId() const override;
- int SetEditableId(int id) override;
- void SetLabel(const std::string& name) override;
- void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() const override;
- int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
- std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
- int UpdateLastContext() override;
- std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
- std::string GetSetupAppId() const override;
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
--- /dev/null
+/*
+ * 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_RECEIVED_EDITABLE_H_
+#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editable-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ReceivedEditable : public IEditable {
+ public:
+ explicit ReceivedEditable(std::string raw);
+ virtual ~ReceivedEditable();
+ ReceivedEditable(ReceivedEditable const& other) = default;
+ ReceivedEditable(ReceivedEditable && other) = default;
+ ReceivedEditable& operator=(ReceivedEditable const& other) = default;
+ ReceivedEditable& operator=(ReceivedEditable && other) = default;
+
+ public:
+ int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+ std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
+ int SetCurDataIdx(int cur_data_idx) override;
+ int GetLastDataIdx() const override;
+ int UpdateLastData() override;
+ const std::string& GetLabel() const override;
+ void OnEditableUpdated(int selected_idx,
+ IEditable::EditableState state) override;
+ int GetEditableId() const override;
+ int SetEditableId(int id) override;
+ void SetLabel(const std::string& name) override;
+ void SetState(IEditable::EditableState state) override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+ int UpdateLastContext() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
#include "watchface-complication/include/watchface-complication.h"
#include "watchface-complication/include/watchface-complication-internal.h"
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication/complication.h"
-#include "watchface-common/shared-handle.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication/complication.hh"
+#include "watchface-common/shared-handle.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
#ifdef LOG_TAG
#undef LOG_TAG
WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE |
WATCHFACE_COMPLICATION_TYPE_TIME |
WATCHFACE_COMPLICATION_TYPE_ICON |
- WATCHFACE_COMPLICATION_TYPE_IMAGE)) {
+ WATCHFACE_COMPLICATION_TYPE_IMAGE |
+ WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE)) {
LOGE("Invalid param : supported_types(%d)", supported_types);
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
int ret = ptr.get()->GetCurType();
if (WATCHFACE_COMPLICATION_TYPE_NO_DATA <= ret &&
- WATCHFACE_COMPLICATION_TYPE_IMAGE >= ret) {
+ WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE >= ret) {
*cur_type = static_cast<watchface_complication_type_e>(ret);
} else {
LOGW("cur type : %d", ret);
return __get_complication_data(data, AOD_IMAGE_KEY, image_path);
}
+extern "C" EXPORT_API int watchface_complication_data_get_aod_small_image_path(
+ const bundle* data, char** image_path) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (data == nullptr || image_path == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return __get_complication_data(data, AOD_SMALL_IMAGE_KEY, image_path);
+}
+
+extern "C" EXPORT_API int watchface_complication_data_get_small_image_path(
+ const bundle* data, char** image_path) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (data == nullptr || image_path == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return __get_complication_data(data, SMALL_IMAGE_KEY, image_path);
+}
+
extern "C" EXPORT_API int watchface_complication_data_get_long_text(
const bundle* data, char** long_text) {
if (!watchface_complication::util::CheckWatchFeatureEnabled())
#include "watchface-complication/include/watchface-editable.h"
#include "watchface-complication/include/watchface-editable-internal.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/design-element.h"
-#include "watchface-common/shared-handle.h"
-#include "watchface-complication/editables-manager.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-exception.h"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/design-element.hh"
+#include "watchface-common/shared-handle.hh"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-exception.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
-
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IEditablesEditorEvent {
- public:
- virtual void OnEditReady(const std::string& editor_id) = 0;
- virtual void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
- IEditable::EditableState state) = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
--- /dev/null
+/*
+ * 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_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
+
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IEditablesEditorEvent {
+ public:
+ virtual void OnEditReady(const std::string& editor_id) = 0;
+ virtual void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
+ IEditable::EditableState state) = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
+++ /dev/null
-/*
- * 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_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
-
-namespace watchface_complication {
-
-class EditablesEditor::Impl : IGDBus::IGDBusEvent {
- public:
- virtual ~Impl() = default;
-
- private:
- friend class EditablesEditor;
-
- void OnSignal(GDBusConnection* connection,
- const std::string& sender_name,
- const std::string& object_path,
- const std::string& interface_name,
- const std::string& signal_name,
- GVariant* parameters) override;
- void OnVanish(const std::string& name) override;
- void OnAppear(const std::string& name, const std::string& name_owner) override;
- int CheckPrivilege();
- explicit Impl(EditablesEditor* parent);
- Impl(Impl const& other) = default;
- Impl(Impl && other) = default;
- Impl& operator=(Impl const& other) = default;
- Impl& operator=(Impl && other) = default;
-
- private:
- EditablesEditor* parent_;
- int subscribe_id_;
- std::string edit_appid_;
- std::unique_ptr<IGDBus> gdbus_;
- std::list<std::shared_ptr<IEditable>> editable_list_;
- std::list<SharedHandle<EditablesEditor::EditInfo>*> edit_info_list_;
- int edit_sequence_ = 0;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * 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_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
+
+namespace watchface_complication {
+
+class EditablesEditor::Impl : IGDBus::IGDBusEvent {
+ public:
+ virtual ~Impl() = default;
+
+ private:
+ friend class EditablesEditor;
+
+ void OnSignal(GDBusConnection* connection,
+ const std::string& sender_name,
+ const std::string& object_path,
+ const std::string& interface_name,
+ const std::string& signal_name,
+ GVariant* parameters) override;
+ void OnVanish(const std::string& name) override;
+ void OnAppear(const std::string& name, const std::string& name_owner) override;
+ int CheckPrivilege();
+ explicit Impl(EditablesEditor* parent);
+ Impl(Impl const& other) = default;
+ Impl(Impl && other) = default;
+ Impl& operator=(Impl const& other) = default;
+ Impl& operator=(Impl && other) = default;
+
+ private:
+ EditablesEditor* parent_;
+ int subscribe_id_;
+ std::string edit_appid_;
+ std::unique_ptr<IGDBus> gdbus_;
+ std::list<std::shared_ptr<IEditable>> editable_list_;
+ std::list<SharedHandle<EditablesEditor::EditInfo>*> edit_info_list_;
+ int edit_sequence_ = 0;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
#include <stdexcept>
#include <vector>
-#include "watchface-editor/editables-editor.h"
-#include "watchface-editor/editables-editor-implementation.h"
-#include "watchface-complication/received-editable.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-editor/editables-editor-implementation.hh"
+#include "watchface-complication/received-editable.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
-#include "watchface-complication/gdbus-interface.h"
+#include "watchface-complication/gdbus-interface.hh"
#ifdef LOG_TAG
#undef LOG_TAG
+++ /dev/null
-/*
- * 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_EDITOR_EDITABLES_EDITOR_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container-event-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesEditor : IEditablesContainerEvent {
- public:
- class EditInfo {
- public:
- EditInfo(EditablesEditor* editor, int edit_seq, std::shared_ptr<IEditable> editable)
- : editor_(editor), edit_seq_(edit_seq), edit_timer_(0), editable_(editable) {
- }
-
- EditInfo(EditInfo&& info)
- : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
- edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
- }
-
- EditInfo(const EditInfo& info)
- : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
- edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
- }
-
- EditInfo& operator = (const EditInfo& info) {
- if (this != &info) {
- editor_ = info.GetEditor();
- edit_seq_ = info.GetSequence();
- editable_ = info.GetEditable();
- edit_timer_ = info.GetTimer();
- }
- return *this;
- }
-
- EditInfo& operator = (EditInfo&& info) noexcept {
- if (this != &info) {
- editor_ = info.GetEditor();
- edit_seq_ = info.GetSequence();
- editable_ = info.GetEditable();
- edit_timer_ = info.GetTimer();
- }
- return *this;
- }
-
- EditablesEditor* GetEditor() const {
- return editor_;
- }
-
- int GetSequence() const {
- return edit_seq_;
- }
-
- int GetTimer() const {
- return edit_timer_;
- }
-
- void SetTimer(int timer) {
- edit_timer_ = timer;
- }
-
- std::shared_ptr<IEditable> GetEditable() const {
- return editable_;
- }
-
- private:
- EditablesEditor* editor_;
- int edit_seq_;
- int edit_timer_;
- std::shared_ptr<IEditable> editable_;
- };
-
- EditablesEditor();
- virtual ~EditablesEditor();
- void OnEditResult(std::shared_ptr<IEditable> editable, int result) override;
- void OnRequestEdit(const std::string& appid,
- std::list<std::shared_ptr<IEditable>> e_list) override;
- void OnSetupReply(const std::string& appid,
- int editable_id, std::unique_ptr<tizen_base::Bundle> context) override;
- int EditPreview(std::shared_ptr<IEditable> ed, int cur_data_idx,
- int reply_timeout, bool auto_reply);
- int EditComplete();
- int EditCancel();
- int NotifyEditReady(std::string appid);
- void RemoveEditInfo(IEditable& ed);
- std::shared_ptr<EditInfo> FindEditInfo(int edit_id, int edit_seq);
-
- private:
- class Impl;
- std::unique_ptr<Impl> impl_;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
--- /dev/null
+/*
+ * 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_EDITOR_EDITABLES_EDITOR_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container-event-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesEditor : IEditablesContainerEvent {
+ public:
+ class EditInfo {
+ public:
+ EditInfo(EditablesEditor* editor, int edit_seq, std::shared_ptr<IEditable> editable)
+ : editor_(editor), edit_seq_(edit_seq), edit_timer_(0), editable_(editable) {
+ }
+
+ EditInfo(EditInfo&& info)
+ : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
+ edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
+ }
+
+ EditInfo(const EditInfo& info)
+ : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
+ edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
+ }
+
+ EditInfo& operator = (const EditInfo& info) {
+ if (this != &info) {
+ editor_ = info.GetEditor();
+ edit_seq_ = info.GetSequence();
+ editable_ = info.GetEditable();
+ edit_timer_ = info.GetTimer();
+ }
+ return *this;
+ }
+
+ EditInfo& operator = (EditInfo&& info) noexcept {
+ if (this != &info) {
+ editor_ = info.GetEditor();
+ edit_seq_ = info.GetSequence();
+ editable_ = info.GetEditable();
+ edit_timer_ = info.GetTimer();
+ }
+ return *this;
+ }
+
+ EditablesEditor* GetEditor() const {
+ return editor_;
+ }
+
+ int GetSequence() const {
+ return edit_seq_;
+ }
+
+ int GetTimer() const {
+ return edit_timer_;
+ }
+
+ void SetTimer(int timer) {
+ edit_timer_ = timer;
+ }
+
+ std::shared_ptr<IEditable> GetEditable() const {
+ return editable_;
+ }
+
+ private:
+ EditablesEditor* editor_;
+ int edit_seq_;
+ int edit_timer_;
+ std::shared_ptr<IEditable> editable_;
+ };
+
+ EditablesEditor();
+ virtual ~EditablesEditor();
+ void OnEditResult(std::shared_ptr<IEditable> editable, int result) override;
+ void OnRequestEdit(const std::string& appid,
+ std::list<std::shared_ptr<IEditable>> e_list) override;
+ void OnSetupReply(const std::string& appid,
+ int editable_id, std::unique_ptr<tizen_base::Bundle> context) override;
+ int EditPreview(std::shared_ptr<IEditable> ed, int cur_data_idx,
+ int reply_timeout, bool auto_reply);
+ int EditComplete();
+ int EditCancel();
+ int NotifyEditReady(std::string appid);
+ void RemoveEditInfo(IEditable& ed);
+ std::shared_ptr<EditInfo> FindEditInfo(int edit_id, int edit_seq);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace watchface_complication
+
+#endif // WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
#include <watchface-complication.h>
#include <watchface-editable.h>
-#include <watchface-common-internal.h>
+#include <watchface-common-internal.hh>
#ifdef __cplusplus
extern "C" {
#include <string>
#include "watchface-editor/include/watchface-editor.h"
-#include "watchface-complication/complication.h"
-#include "watchface-editor/editables-editor.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
#ifdef LOG_TAG
#undef LOG_TAG