class WatchComplication : public Complication {
public:
- WatchComplication(int id, int support_types,
+ WatchComplication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
- : Complication(id, support_types, default_provider_id, default_type) {
+ : Complication(id, supported_types, supported_event_types,
+ default_provider_id, default_type) {
SetCurDataIdx(0);
SetLabel("TestComplication");
SetHighlight(std::unique_ptr<IEditable::Highlight>(
string providerId = "org.tizen.watchface_sample_provider/test";
virtual void SetUp() {
- complication = new WatchComplication(0, ShortText, providerId.c_str(), ShortText);
+ complication =
+ new WatchComplication(0, ShortText, Tap, providerId.c_str(), ShortText);
}
virtual void TearDown() {
delete complication;
watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
}
virtual void TearDown() {
} watchface_complication_type_e;
/**
+ * @brief Enumeration for Complication event type.
+ * @details Watchface should transfer the touch event to complication provider
+ * to trigger the complication tap action.
+ * #WATCHFACE_COMPLICATION_EVENT_NONE is transferred to the complication provider
+ * when the complication is launched without tap event.
+ * @since_tizen 5.0
+ */
+typedef enum _complication_event_type {
+ WATCHFACE_COMPLICATION_EVENT_NONE = 0x01, /**< Complication is not tapped */
+ WATCHFACE_COMPLICATION_EVENT_TAP = 0x02, /**< Tap */
+ WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP = 0x04 /**< Double Tap */
+} watchface_complication_event_type_e;
+
+/**
* @}
*/
int subscribe_id_;
std::string provider_id_;
std::string setup_appid_;
- int support_types_;
+ int supported_types_;
std::map<std::string, SenderInfo*> sender_info_;
std::list<std::string> required_privileges_;
};
std::list<std::string> privlege_list;
required_privileges_.push_back(std::string(PRIVILEGE_DATASHARING));
- ret = DBManager::GetSupportTypes(provider_id_, &support_types_);
+ ret = DBManager::GetSupportTypes(provider_id_, &supported_types_);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
THROW(ret);
return;
}
- if ((support_types_ & type) == 0) {
- LOGE("Not supported type [%d][%d]", support_types_, type);
+ if ((supported_types_ & type) == 0) {
+ LOGE("Not supported type [%d][%d]", supported_types_, type);
return;
}
const char *extra_data);
/**
- * @brief Checks whether app is launched by complication touch or not.
+ * @brief Gets touch event type that is transferred from watchface.
* @since_tizen 5.0
- * @remarks @a is_touch_launch is true when provider app is launched by watchface_complication_touch_launch().
+ * @remarks @a event_type is the type of touch event transftered from the watchface
+ * by watchface_complication_transfer_event().
* @param[in] handle The app control handle
- * @param[out] is_touch_launch The value that tell it's launched by touch.
+ * @param[out] event_type The value that tells touch event type that is transferred.
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_complication_touch_launch()
- * @see watchface_complication_provider_touch_launch_get_provider_id()
- * @see watchface_complication_provider_touch_launch_get_complication_type()
- * @see watchface_complication_provider_touch_launch_get_context()
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * #retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_event_type_e
+ * @see watchface_complication_transfer_event()
+ * @see watchface_complication_provider_event_get_provider_id()
+ * @see watchface_complication_provider_event_get_complication_type()
+ * @see watchface_complication_provider_event_get_context()
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
- bool is_touch_launch;
+ watchface_complication_event_type_e event_type;
char *provider_id;
watchface_complication_type_e type;
bundle *context
- watchface_complication_provider_is_touch_launch(app_control, &is_touch_launch);
- if (is_touch_launch) {
- watchface_complication_provider_touch_launch_get_provider_id(app_control,
+ watchface_complication_provider_event_get_type(app_control, &event_type);
+ if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
+ watchface_complication_provider_event_get_provider_id(app_control,
&provider_id);
- watchface_complication_provider_touch_launch_get_complication_type(
+ watchface_complication_provider_event_get_complication_type(
app_control, &type);
- watchface_complication_provider_touch_launch_get_context(app_control,
+ watchface_complication_provider_event_get_context(app_control,
&context);
// Do something
}
}
* @endcode
*/
-int watchface_complication_provider_is_touch_launch(app_control_h handle,
- bool *is_touch_launch);
+int watchface_complication_provider_event_get_type(app_control_h handle,
+ watchface_complication_event_type_e *event_type);
/**
* @brief Gets provider id of touched complication.
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_complication_touch_launch()
- * @see watchface_complication_provider_is_touch_launch()
- * @see watchface_complication_provider_touch_launch_get_complication_type()
- * @see watchface_complication_provider_touch_launch_get_context()
+ * @see watchface_complication_transfer_event()
+ * @see watchface_complication_provider_event_get_complication_type()
+ * @see watchface_complication_provider_event_get_context()
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
- bool is_touch_launch;
+ watchface_complication_event_type_e event_type;
char *provider_id;
watchface_complication_type_e type;
bundle *context
- watchface_complication_provider_is_touch_launch(handle, &is_touch_launch);
- if (is_touch_launch) {
- watchface_complication_provider_touch_launch_get_provider_id(handle,
+ watchface_complication_provider_event_get_type(app_control, &event_type);
+ if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
+ watchface_complication_provider_event_get_provider_id(app_control,
&provider_id);
- watchface_complication_provider_touch_launch_get_complication_type(
- handle, &type);
- watchface_complication_provider_touch_launch_get_context(handle,
+ watchface_complication_provider_event_get_complication_type(
+ app_control, &type);
+ watchface_complication_provider_event_get_context(app_control,
&context);
// Do something
}
-
- free(provider_id);
}
* @endcode
*/
-int watchface_complication_provider_touch_launch_get_provider_id(
+int watchface_complication_provider_event_get_provider_id(
app_control_h handle, char **provider_id);
/**
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_complication_touch_launch()
- * @see watchface_complication_provider_is_touch_launch()
- * @see watchface_complication_provider_touch_launch_get_provider_id()
- * @see watchface_complication_provider_touch_launch_get_context()
+ * @see watchface_complication_transfer_event()
+ * @see watchface_complication_provider_event_get_provider_id()
+ * @see watchface_complication_provider_event_get_context()
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
- bool is_touch_launch;
+ watchface_complication_event_type_e event_type;
char *provider_id;
watchface_complication_type_e type;
bundle *context
- watchface_complication_provider_is_touch_launch(handle, &is_touch_launch);
- if (is_touch_launch) {
- watchface_complication_provider_touch_launch_get_provider_id(handle,
+ watchface_complication_provider_event_get_type(app_control, &event_type);
+ if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
+ watchface_complication_provider_event_get_provider_id(app_control,
&provider_id);
- watchface_complication_provider_touch_launch_get_complication_type(
- handle, &type);
- watchface_complication_provider_touch_launch_get_context(handle,
+ watchface_complication_provider_event_get_complication_type(
+ app_control, &type);
+ watchface_complication_provider_event_get_context(app_control,
&context);
// Do something
}
}
* @endcode
*/
-int watchface_complication_provider_touch_launch_get_complication_type(
+int watchface_complication_provider_event_get_complication_type(
app_control_h handle, watchface_complication_type_e *type);
/**
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_complication_touch_launch()
- * @see watchface_complication_provider_is_touch_launch()
- * @see watchface_complication_provider_touch_launch_get_provider_id()
- * @see watchface_complication_provider_touch_launch_get_type()
+ * @see watchface_complication_transfer_event()
+ * @see watchface_complication_provider_event_get_provider_id()
+ * @see watchface_complication_provider_event_get_complication_type()
* @see watchface_complication_provider_setup_reply_to_editor()
* @see watchface_complication_provider_setup_is_editing()
* @see watchface_complication_provider_setup_get_context()
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
- bool is_touch_launch;
+ watchface_complication_event_type_e event_type;
char *provider_id;
watchface_complication_type_e type;
bundle *context
- watchface_complication_provider_is_touch_launch(handle, &is_touch_launch);
- if (is_touch_launch) {
- watchface_complication_provider_touch_launch_get_provider_id(handle,
+ watchface_complication_provider_event_get_type(app_control, &event_type);
+ if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
+ watchface_complication_provider_event_get_provider_id(app_control,
&provider_id);
- watchface_complication_provider_touch_launch_get_complication_type(
- handle, &type);
- watchface_complication_provider_touch_launch_get_context(handle,
+ watchface_complication_provider_event_get_complication_type(
+ app_control, &type);
+ watchface_complication_provider_event_get_context(app_control,
&context);
// Do something
}
}
* @endcode
*/
-int watchface_complication_provider_touch_launch_get_context(
+int watchface_complication_provider_event_get_context(
app_control_h handle, bundle **context);
/*
return _add_bundle_data(shared_data, EXTRA_DATA_KEY, extra_data);
}
-extern "C" EXPORT_API int watchface_complication_provider_is_touch_launch(
- app_control_h handle, bool* is_touch_launch) {
- int ret;
- char* value = NULL;
- bundle* data;
-
- if (handle == NULL || is_touch_launch == NULL) {
- LOGE("Invalid param");
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
-
- ret = app_control_to_bundle(handle, &data);
- if (ret != APP_CONTROL_ERROR_NONE) {
- LOGE("Invalid param");
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
-
- ret = bundle_get_str(data, AUL_K_COMPLICATION_MODE, &value);
- if (ret != BUNDLE_ERROR_NONE) {
- *is_touch_launch = false;
- return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
-
- ret = bundle_get_str(data, TOUCH_LAUNCH_DATA_KEY, &value);
- if (ret != BUNDLE_ERROR_NONE) {
- *is_touch_launch = false;
- return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
-
- *is_touch_launch = true;
- return WATCHFACE_COMPLICATION_ERROR_NONE;
-}
-
static int _get_value_from_touch_launch_data(app_control_h handle,
const char* key, char** value) {
bundle* data = NULL;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+extern "C" EXPORT_API int watchface_complication_provider_event_get_type(
+ app_control_h handle, watchface_complication_event_type_e* event_type) {
+ int ret;
+ char* value = NULL;
+ bundle* data;
+
+ if (handle == NULL || event_type == NULL) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = app_control_to_bundle(handle, &data);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, AUL_K_COMPLICATION_MODE, &value);
+ if (ret != BUNDLE_ERROR_NONE) {
+ *event_type = WATCHFACE_COMPLICATION_EVENT_NONE;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ }
+
+ ret = _get_value_from_touch_launch_data(handle,
+ TOUCH_LAUNCH_EVENT_KEY, &value);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
+ if (ret == WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER ||
+ ret == WATCHFACE_COMPLICATION_ERROR_NO_DATA) {
+ *event_type = WATCHFACE_COMPLICATION_EVENT_NONE;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ } else {
+ return ret;
+ }
+ }
+
+ *event_type = static_cast<watchface_complication_event_type_e>(
+ strtol(value, NULL, 10));
+ free(value);
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
extern "C" EXPORT_API
-int watchface_complication_provider_touch_launch_get_provider_id(
+int watchface_complication_provider_event_get_provider_id(
app_control_h handle, char** provider_id) {
int ret;
char* value = NULL;
}
extern "C" EXPORT_API
-int watchface_complication_provider_touch_launch_get_complication_type(
+int watchface_complication_provider_event_get_complication_type(
app_control_h handle, watchface_complication_type_e* type) {
int ret;
char* value = NULL;
}
extern "C" EXPORT_API
-int watchface_complication_provider_touch_launch_get_context(
+int watchface_complication_provider_event_get_context(
app_control_h handle, bundle** context) {
int ret;
char* value = NULL;
private:
friend class Complication;
- Impl(Complication* parent, int id, int support_types,
+ Impl(Complication* parent, int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type);
int FindCandidateDataIdx(std::string provider_id, int type);
Complication* parent_;
int complication_id_ = -1;
int editable_id_ = -1;
- int support_types_ = -1;
+ int supported_types_ = -1;
+ int supported_event_types_ = -1;
std::string default_provider_appid_;
std::string default_provider_id_;
ComplicationType default_type_;
const std::string Complication::Impl::provider_id_key_ = "__PROVIDER_ID_KEY__";
const std::string Complication::Impl::provider_type_key_ = "__PROVIDER_TYPE_KEY__";
-Complication::Complication(int id, int support_types,
+Complication::Complication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
- : impl_(new Impl(this, id, support_types, default_provider_id, default_type)) {
+ : impl_(new Impl(this, id, supported_types, supported_event_types,
+ default_provider_id, default_type)) {
ComplicationConnector::GetInst().AddPackageEventListener(impl_.get());
}
}
Complication::Impl::Impl(Complication* parent, int id,
- int support_types,
+ int supported_types,
+ int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
- : parent_(parent), complication_id_(id), support_types_(support_types),
+ : parent_(parent), complication_id_(id), supported_types_(supported_types),
+ supported_event_types_(supported_event_types),
default_provider_id_(default_provider_id), default_type_(default_type) {
int ret;
ret = LoadPrevProviderInfo();
return impl_->last_context_data_;
}
-int Complication::TouchLaunch() {
+int Complication::TouchLaunch(watchface_complication_event_type_e event_type) {
const char* context_data_raw = NULL;
int ret;
std::string provider_appid = DBManager::GetProviderAppId(
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
+ char event_str[32] = {0,};
+ snprintf(event_str, sizeof(event_str), "%d", event_type);
+ bundle_add_str(launch_data, TOUCH_LAUNCH_EVENT_KEY, event_str);
+
bundle_add_str(launch_data, TOUCH_LAUNCH_PROVIDER_ID_KEY,
impl_->cur_provider_id_.c_str());
int Complication::Impl::MakeCandidatesList() {
candidates_list_.clear();
- if ((support_types_ & NoData) == 1) {
+ if ((supported_types_ & NoData) == 1) {
int ret = AddCandidate("", static_cast<int>(NoData));
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
}
}
} else {
- int ret = AddCandidates(support_types_);
+ int ret = AddCandidates(supported_types_);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
}
class EXPORT_API Complication : public IEditable
, public IComplicationProviderEvent {
public:
- Complication(int id, int support_types,
+ Complication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type);
virtual ~Complication();
const char* GetCurProviderId();
const char* GetProviderId(const Bundle* data);
int GetCurType();
- int TouchLaunch();
+ int TouchLaunch(watchface_complication_event_type_e event_type);
int ApplyAllowedList(
std::list<std::unique_ptr<ProviderInfo>> allowed_list);
int ClearAllowedList();
}
std::list<std::unique_ptr<DBManager::ProviderInfo>>
-DBManager::GetProviderListWithTypes(int support_types) {
+DBManager::GetProviderListWithTypes(int supported_types) {
int ret;
char* provider_id = NULL;
int types = 0;
return provider_list;
}
- sqlite3_bind_int(stmt, 1, support_types);
+ sqlite3_bind_int(stmt, 1, supported_types);
while (sqlite3_step(stmt) == SQLITE_ROW) {
provider_id = (char*)sqlite3_column_text(stmt, 0);
types = sqlite3_column_int(stmt, 1);
int DBManager::GetSupportTypes(std::string& provider_id, int* types) {
int ret;
- int support_types = 0;
+ int supported_types = 0;
sqlite3_stmt* stmt;
sqlite3* db;
sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
while (sqlite3_step(stmt) == SQLITE_ROW)
- support_types = sqlite3_column_int(stmt, 0);
+ supported_types = sqlite3_column_int(stmt, 0);
sqlite3_finalize(stmt);
CloseDB(db);
- *types = support_types;
+ *types = supported_types;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
static std::list<std::string> GetRequiredPrivlegeList(
std::string& provider_id);
static std::list<std::unique_ptr<ProviderInfo>> GetProviderListWithTypes(
- int support_types);
+ 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);
#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__"
namespace watchface_complication {
Image = WATCHFACE_COMPLICATION_TYPE_IMAGE
} ComplicationType;
+typedef enum {
+ None = WATCHFACE_COMPLICATION_EVENT_NONE,
+ Tap = WATCHFACE_COMPLICATION_EVENT_TAP,
+ DoubleTap = WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP
+} ComplicationEventType;
+
} // namespace watchface_complication
#endif /* __TIZEN_APPFW_WATCHFACE_COMPLICATION_INTERNAL_H__ */
ret = watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || complication == NULL)
return ret;
ret = watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || complication == NULL)
return ret;
ret = watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || complication == NULL)
return ret;
int ret;
int comp_id = 1;
complication_h complication;
- int support_types;
+ int supported_types;
ret = watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || complication == NULL)
return ret;
* @details The default provider and type are the items to set for initial display.
* User should not enter null as the default provider and will receive an error.
* If user selects the other provider and type, they are no longer used.
- * You can specify support_types by combining the types you want to show in the complication.
+ * You can specify @a supported_types by combining the types you want to show in the complication.
+ * You can specify @a supported_event_types by combining the event types you want to handle for the complication.
* @since_tizen 5.0
* @privilege http://tizen.org/privilege/packagemanager.info
* @remarks The @a created_handle should be released using watchface_complication_destroy().
* @param[in] complication_id A number that identifies the complication
* @param[in] default_provider_id The default provider id
* @param[in] default_type The default type to display
- * @param[in] support_types The type shown in the complication
+ * @param[in] supported_types The type shown in the complication, values of #watchface_complication_type_e combined with bitwise 'or'.
+ * @param[in] supported_event_types The event type supported by complication, values of #watchface_complication_event_type_e combined with bitwise 'or'.
+ * Complication can send supported event to the provider using watchface_complication_transfer_event().
* @param[out] created_handle Complication handle on success
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE Provider aplication is not available now for some reason. (eg. uninstall, disable)
* @see watchface_complication_type_e
+ * @see watchface_complication_event_type_e
+ * @see watchface_complication_transfer_event()
* @par Sample code:
* @code
#include <watchface-complication.h>
+
+complication_h complication;
+void on_tap() {
+ watchface_complication_transfer_event(complication,
+ WATCHFACE_COMPLICATION_EVENT_TAP);
+}
+
{
int ret;
int comp_id = 1;
- complication_h complication;
ret = watchface_complication_create(comp_id, "org.tizen.sample",
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT|WATCHFACE_COMPLICATION_TYPE_ICON,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
&complication);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || complication == NULL)
return ret;
int watchface_complication_create(int complication_id,
const char *default_provider_id,
watchface_complication_type_e default_type,
- int support_types,
+ int supported_types,
+ int supported_event_types,
complication_h *created_handle);
/**
char **extra_data);
/**
- * @brief Launches current complication's provider application.
+ * @brief Transfers touch event to the complication provider.
* @details This function launchs the provider application with extra data,
- * so that provider can tell it is launched by touching.
+ * so that provider can tell it is launched by transferred touch event.
* @since_tizen 5.0
* @privilege http://tizen.org/privilege/appmanager.launch
* @privilege http://tizen.org/privilege/datasharing
* the watchface application needs those privileges to use this function.
* If your app doesn't have those privileges, this function will return #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED.
* @param[in] handle The complication handle
+ * @param[in] event_type The event type that is transferred to complication provider
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_complication_provider_is_touch_launch()
- * @see watchface_complication_provider_get_touch_launch_get_provider_id()
- * @see watchface_complication_provider_get_touch_launch_get_type()
+ * @see watchface_complication_provider_event_get_type()
+ * @see watchface_complication_provider_event_get_provider_id()
+ * @see watchface_complication_provider_event_get_complication_type()
* @par Sample code:
* @code
#include <watchface-complication.h>
void _on_complication_clicked(complication_h handle)
{
- watchface_complication_touch_launch(handle);
+ watchface_complication_transfer_event(handle, WATCHFACE_COMPLICATION_EVENT_TAP);
}
* @endcode
*/
-int watchface_complication_touch_launch(complication_h handle);
+int watchface_complication_transfer_event(complication_h handle,
+ watchface_complication_event_type_e event_type);
/**
* @brief The complication allowed list handle.
class WatchComplicationStub : public Complication {
public:
- WatchComplicationStub(int id, int support_types,
+ WatchComplicationStub(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
- : Complication(id, support_types, default_provider_id, default_type) {
+ : Complication(id, supported_types, supported_event_types,
+ default_provider_id, default_type) {
}
virtual ~WatchComplicationStub() = default;
extern "C" EXPORT_API int watchface_complication_create(int complication_id,
const char* default_provider_id, watchface_complication_type_e default_type,
- int support_types, complication_h* created_handle) {
- if (support_types < WATCHFACE_COMPLICATION_TYPE_NO_DATA ||
- support_types > (WATCHFACE_COMPLICATION_TYPE_NO_DATA |
+ int supported_types, int supported_event_types, complication_h* created_handle) {
+ if (supported_types < WATCHFACE_COMPLICATION_TYPE_NO_DATA ||
+ supported_types > (WATCHFACE_COMPLICATION_TYPE_NO_DATA |
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT |
WATCHFACE_COMPLICATION_TYPE_LONG_TEXT |
WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE |
WATCHFACE_COMPLICATION_TYPE_IMAGE))
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ if (supported_event_types < WATCHFACE_COMPLICATION_EVENT_NONE ||
+ supported_event_types > (WATCHFACE_COMPLICATION_EVENT_NONE |
+ WATCHFACE_COMPLICATION_EVENT_TAP |
+ WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP))
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+
try {
auto ws = new WatchComplicationStub(
complication_id,
- support_types,
+ supported_types,
+ supported_event_types,
default_provider_id,
static_cast<ComplicationType>(default_type));
LOGI("comp created");
return __get_complication_data(data, EXTRA_DATA_KEY, extra_data);
}
-extern "C" EXPORT_API int watchface_complication_touch_launch(
- complication_h handle) {
- if (handle == NULL)
+extern "C" EXPORT_API int watchface_complication_transfer_event(
+ complication_h handle, watchface_complication_event_type_e event_type) {
+ if (handle == NULL
+ || event_type < WATCHFACE_COMPLICATION_EVENT_NONE
+ || event_type > WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
- return ptr.get()->TouchLaunch();
+ return ptr.get()->TouchLaunch(event_type);
}
typedef struct provider_info_ {