bundle* data = nullptr;
bundle* nthdata = nullptr;
editable_geo geo;
- GList* list;
- const char* set_editable_name = "sample_editor";
const char* get_editable_name = NULL;
- EXPECT_EQ(editable_set_cur_data_idx(EC::received, idx), 0);
EXPECT_EQ(editable_get_cur_data_idx(EC::received, &idx_check), 0);
EXPECT_EQ(idx, idx_check);
EXPECT_EQ(id, 0);
EXPECT_EQ(editable_get_geometry(EC::received, &geo), 0);
- EXPECT_EQ(editable_get_candidates_list(EC::received, &list), 0);
-
- EXPECT_EQ(editable_set_editable_name(EC::received, set_editable_name), 0);
EXPECT_EQ(editable_get_editable_name(EC::received, &get_editable_name), 0);
}
*/
int complication_provider_setup_get_context(app_control_h handle, bundle **context);
+int complication_provider_set_short_text_data(bundle *shared_data, char *text,
+ char *icon, char *title);
+int complication_provider_set_long_text_data(bundle *shared_data, char *text,
+ char *icon, char *title);
+int complication_provider_set_ranged_value_data(bundle *shared_data,
+ int current, int min, int max, char *text, char *icon, char *title);
+int complication_provider_set_time_value_data(bundle *shared_data, char *time_str,
+ char *icon, char *title);
+int complication_provider_set_icon_value_data(bundle *shared_data, char *icon);
+int complication_provider_set_image_value_data(bundle *shared_data, char *image);
+
/*
* @}
*/
return COMPLICATION_ERROR_NONE;
}
+
+static int _add_bundle_data(bundle* shared_data, const char* key, char* value) {
+ int ret;
+
+ ret = bundle_add_str(shared_data, key, value);
+ if (ret == BUNDLE_ERROR_KEY_EXISTS) {
+ bundle_del(shared_data, TEXT_KEY);
+ ret = bundle_add_str(shared_data, key, value);
+ }
+
+ if (ret == BUNDLE_ERROR_OUT_OF_MEMORY) {
+ LOGE("Out of memory : %s, %s fail", key, value);
+ return COMPLICATION_ERROR_OUT_OF_MEMORY;
+ } else if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("IO error : %s, %s fail(%d)", key, value, ret);
+ return COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_short_text_data(
+ bundle* shared_data, char* text, char* icon, char* title) {
+
+ int ret;
+ if (shared_data == NULL || text == NULL) {
+ LOGE("Text value is NULL");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _add_bundle_data(shared_data, TEXT_KEY, text);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ if (icon) {
+ ret = _add_bundle_data(shared_data, ICON_KEY, icon);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+ if (title) {
+ ret = _add_bundle_data(shared_data, TITLE_KEY, title);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_long_text_data(
+ bundle* shared_data, char* text, char* icon, char* title) {
+
+ int ret;
+ if (shared_data == NULL || text == NULL) {
+ LOGE("Text value is NULL");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _add_bundle_data(shared_data, TEXT_KEY, text);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ if (icon) {
+ ret = _add_bundle_data(shared_data, ICON_KEY, icon);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (title) {
+ ret = _add_bundle_data(shared_data, TITLE_KEY, title);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_ranged_value_data(
+ bundle* shared_data, int current, int min, int max, char* text, char* icon,
+ char* title) {
+
+ int ret;
+ char num_str[32] = {0,};
+ if (shared_data == NULL || current < min || current > max || min > max) {
+ LOGE("wrong range %d, %d, %d", current, min, max);
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ snprintf(num_str, sizeof(num_str), "%d", current);
+ ret = _add_bundle_data(shared_data, RANGE_CUR_KEY, num_str);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ snprintf(num_str, sizeof(num_str), "%d", min);
+ ret = _add_bundle_data(shared_data, RANGE_MIN_KEY, num_str);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ snprintf(num_str, sizeof(num_str), "%d", max);
+ ret = _add_bundle_data(shared_data, RANGE_MAX_KEY, num_str);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ if (text) {
+ ret = _add_bundle_data(shared_data, TEXT_KEY, text);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (icon) {
+ ret = _add_bundle_data(shared_data, ICON_KEY, icon);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (title) {
+ ret = _add_bundle_data(shared_data, TITLE_KEY, title);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_time_value_data(
+ bundle* shared_data, char* time_str, char* icon, char* title) {
+
+ int ret;
+ if (shared_data == NULL || time_str == NULL) {
+ LOGE("Time value is NULL");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _add_bundle_data(shared_data, TIME_KEY, time_str);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ if (icon) {
+ ret = _add_bundle_data(shared_data, ICON_KEY, icon);
+ }
+
+ if (title) {
+ ret = _add_bundle_data(shared_data, TITLE_KEY, title);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_icon_value_data(
+ bundle* shared_data, char* icon) {
+
+ int ret;
+ if (shared_data == NULL || icon == NULL) {
+ LOGE("Time value is NULL");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ ret = _add_bundle_data(shared_data, ICON_KEY, icon);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_provider_set_image_value_data(
+ bundle* shared_data, char* image) {
+
+ int ret;
+ if (shared_data == NULL || image == NULL) {
+ LOGE("Image value is NULL");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ ret = _add_bundle_data(shared_data, IMAGE_KEY, image);
+ if (ret != COMPLICATION_ERROR_NONE)
+ return ret;
+
+ return COMPLICATION_ERROR_NONE;
+}
+
#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 TEXT_KEY "__TEXT_KEY__"
+#define ICON_KEY "__ICON_KEY__"
+#define TITLE_KEY "__TITLE_KEY__"
+#define TIME_KEY "__TIME_KEY__"
+#define RANGE_CUR_KEY "__MAX_KEY__"
+#define RANGE_MAX_KEY "__MAX_KEY__"
+#define RANGE_MIN_KEY "__MIN_KEY__"
+#define IMAGE_KEY "__IMAGE_KEY__"
namespace watchface_complication {
int complication_update_cb_del(complication_h handle,
on_complication_update cb);
int complication_send_update_request(complication_h handle);
-int complication_set_provider(const char *provider_id);
int complication_create(int complication_id, const char *default_provider_id,
complication_type default_type, int support_types,
complication_shape_type type,
const char **provider_id);
int complication_get_type(const bundle *candidate,
complication_type *cur_type);
+int complication_get_short_text_data(bundle *data, char **text, char **icon,
+ char **title);
+int complication_get_long_text_data(bundle *data, char **text, char **icon,
+ char **title);
+int complication_get_ranged_value_data(bundle *data, int *current, int *min,
+ int *max, char **text, char **icon, char **title);
+int complication_get_time_value_data(bundle *data, char **time_str, char **icon,
+ char **title);
+int complication_get_icon_value_data(bundle *data, char **icon);
+int complication_get_image_value_data(bundle *data, char **image);
/**
* @}
int editable_on_edit_ready_cb_add(on_edit_ready cb, void *user_data);
int editable_on_edit_ready_cb_del(on_edit_ready cb);
int editable_load_current_data(int editable_id, bundle **current_data);
+int editable_get_editable_name(const editable_h handle,
+ const char **editable_name);
+int editable_get_geometry(const editable_h handle, editable_geo *geo);
/**
* @}
return COMPLICATION_ERROR_NONE;
}
+
+extern "C" EXPORT_API int complication_get_short_text_data(bundle* data,
+ char** text, char** icon, char** title) {
+
+ int ret;
+ if (data == NULL || text == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, TEXT_KEY, text);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (icon)
+ bundle_get_str(data, ICON_KEY, icon);
+ if (title)
+ bundle_get_str(data, TITLE_KEY, title);
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_get_long_text_data(bundle* data,
+ char** text, char** icon, char** title) {
+
+ int ret;
+ if (data == NULL || text == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, TEXT_KEY, text);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (icon)
+ bundle_get_str(data, ICON_KEY, icon);
+ if (title)
+ bundle_get_str(data, TITLE_KEY, title);
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_get_ranged_value_data(bundle* data,
+ int* current_val, int* min_val, int* max_val, char** text, char** icon,
+ char** title) {
+
+ int ret;
+ if (data == NULL || current_val == NULL || min_val == NULL
+ || max_val == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char* num_str;
+ ret = bundle_get_str(data, RANGE_CUR_KEY, &num_str);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ *current_val = atoi(num_str);
+
+ ret = bundle_get_str(data, RANGE_MIN_KEY, &num_str);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ *min_val = atoi(num_str);
+
+ ret = bundle_get_str(data, RANGE_MAX_KEY, &num_str);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ *max_val = atoi(num_str);
+
+ if (text)
+ bundle_get_str(data, TEXT_KEY, text);
+ if (icon)
+ bundle_get_str(data, ICON_KEY, icon);
+ if (title)
+ bundle_get_str(data, TITLE_KEY, title);
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_get_time_value_data(bundle* data,
+ char** time_str, char** icon, char** title) {
+
+ int ret;
+ if (data == NULL || time_str == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, TIME_KEY, time_str);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (icon)
+ bundle_get_str(data, ICON_KEY, icon);
+ if (title)
+ bundle_get_str(data, TITLE_KEY, title);
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_get_icon_value_data(bundle* data,
+ char** icon) {
+
+ int ret;
+ if (data == NULL || icon == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, ICON_KEY, icon);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int complication_get_image_value_data(bundle* data,
+ char** image) {
+
+ int ret;
+ if (data == NULL || image == NULL) {
+ LOGE("Invalid param !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = bundle_get_str(data, IMAGE_KEY, image);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Invalid data !!");
+ return COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return COMPLICATION_ERROR_NONE;
+}
\ No newline at end of file
*selected_data = bundle_dup(setting_data.get()->GetRaw());
else
return COMPLICATION_ERROR_NO_DATA;
-
return COMPLICATION_ERROR_NONE;
}
void *user_data);
int editor_on_request_edit_cb_add(on_request_edit cb, void *user_data);
int editor_on_request_edit_cb_del(on_request_edit cb);
-int editor_update_cur_data(const editable_h handle, int cur_data_idx,
- editable_edit_state state);
int editor_edit_complete();
int editor_edit_preview(const editable_h handle, int cur_data_idx);
int editor_edit_cancel();