#include <notification_internal.h>
#include <notification_text_domain.h>
#include <bundle_internal.h>
+#include <app_control.h>
+#include <app.h>
#include <wifi-direct.h>
__WFD_APP_FUNC_EXIT__;
}
-static void _move_data_to_app_control(const char *key, const char *val, void *data)
+static void _move_data_to_app_control(const char *key, const int type,
+ const bundle_keyval_t *kv, void *data)
{
__WFD_APP_FUNC_ENTER__;
+ void *ptr = NULL;
+ char *buff = NULL;
+ unsigned int size = 0;
- WFD_RET_IF(data == NULL || key == NULL || val == NULL, , "Invialid parameter!");
+
+ WFD_RET_IF(data == NULL || key == NULL || type == 0, , "Invialid parameter!");
app_control_h control = data;
- app_control_add_extra_data(control, key, val);
+
+ if (type == BUNDLE_TYPE_STR)
+ {
+ bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
+ buff = malloc(sizeof(char)* size + 1);
+ snprintf(buff, size + 1, "%s", ((char*) ptr));
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
+
+ app_control_add_extra_data(control, key, buff);
+ free(buff);
+ } else if (type == BUNDLE_TYPE_BYTE) {
+ bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
+ buff = malloc(sizeof(char)* size + 1);
+ snprintf(buff, size + 1, "%s", ((char*) ptr));
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
+
+ app_control_add_extra_data(control, key, buff);
+ free(buff);
+ } else if (type == BUNDLE_TYPE_STR_ARRAY) {
+ int i = 0;
+ void ** array;
+ unsigned int len = 0;
+ size_t *element_size = NULL;
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR_ARRAY -KEY: %s", key);
+ bundle_keyval_get_array_val((bundle_keyval_t *) kv, &array, &len, &element_size);
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "-Array len: %d", len);
+ for (i = 0; i < len; i++) {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "-%s", (char*)array[i]);
+
+ app_control_add_extra_data(control, key, (char*)array[i]);
+ }
+ }
__WFD_APP_FUNC_EXIT__;
}
app_control_set_operation(control, APP_CONTROL_OPERATION_DEFAULT);
app_control_set_app_id(control, app_id);
- bundle_iterate((bundle *)data, _move_data_to_app_control, control);
+ bundle_foreach((bundle *)data, _move_data_to_app_control, control);
- char *launch_type = (char*)bundle_get_val(data, "-t");
+ char *launch_type = NULL;
+ bundle_get_str(data, "-t", &launch_type);
if (!strcmp(launch_type, "reconnect_by_connecting_wifi_ap")) {
ret = app_control_send_launch_request(control, __launch_app_result_cb, NULL);
} else {
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
- ad->noti_screen_mirroring_on = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ ad->noti_screen_mirroring_on = notification_create(NOTIFICATION_TYPE_ONGOING);
WFD_RET_IF(NULL == ad->noti_screen_mirroring_on, "NULL parameters.\n");
noti_err = notification_set_image(ad->noti_screen_mirroring_on, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, SCREEN_MIRRIONG_INDICATOR_ICON_PATH);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
- ad->noti_screen_mirroring_play = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ ad->noti_screen_mirroring_play = notification_create(NOTIFICATION_TYPE_ONGOING);
WFD_RET_IF(NULL == ad->noti_screen_mirroring_play, "NULL parameters.\n");
char msg[WFD_MAX_SIZE] = {0};
app_control_set_package(control, package_name);
app_control_add_extra_data(control, "-t", "notification");
- res = app_control_to_bundle(control, &b);
- if (res != APP_CONTROL_ERROR_NONE) {
- WFD_APP_LOG(WFD_APP_LOG_ERROR, "app_control_to_bundle() return error : %d", res);
- app_control_destroy(control);
- return;
- }
- res = notification_set_execute_option(ad->noti_screen_mirroring_play, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, /*Button Text*/NULL, NULL, b);
+ res = notification_set_launch_option(ad->noti_screen_mirroring_play, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, control);
if (res != NOTIFICATION_ERROR_NONE) {
- WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to notification_set_execute_option. [%d]", res);
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to otification_set_launch_option. [%d]", res);
app_control_destroy(control);
return;
}
/* set the title and content */
wfd_app_get_connected_peers(ad);
- noti_err = notification_set_text(ad->noti_screen_mirroring_play, NOTIFICATION_TEXT_TYPE_TITLE, _("IDS_SMR_BODY_SCREEN_MIRRORING_IS_ENABLED"),
+ noti_err = notification_set_text(ad->noti_screen_mirroring_play, NOTIFICATION_TEXT_TYPE_TITLE, D_("IDS_SMR_BODY_SCREEN_MIRRORING_IS_ENABLED"),
NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_set_text. [%d]", noti_err);
- snprintf(msg, WFD_MAX_SIZE, _("IDS_WIFI_BODY_CONNECTED_TO_PS"), ad->raw_connected_peers[0].ssid);
+ snprintf(msg, WFD_MAX_SIZE, D_("IDS_WIFI_BODY_CONNECTED_TO_PS"), ad->raw_connected_peers[0].ssid);
noti_err = notification_set_text(ad->noti_screen_mirroring_play, NOTIFICATION_TEXT_TYPE_CONTENT,
msg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_set_text. [%d]", noti_err);
cup_limit_mode){
bundle *b = NULL;
b = bundle_create();
- bundle_add(b, "-t", "notification_power_saving_on");
+ bundle_add_str(b, "-t", "notification_power_saving_on");
_launch_app(PACKAGE_ALLSHARE_CAST, b);
bundle_free(b);
}
WFD_APP_LOG(WFD_APP_LOG_LOW, "Ultra power saving mode on\n");
bundle *b = NULL;
b = bundle_create();
- bundle_add(b, "-t", "quit_by_ultra_power_saving_on");
+ bundle_add_str(b, "-t", "quit_by_ultra_power_saving_on");
_launch_app(PACKAGE_ALLSHARE_CAST, b);
bundle_free(b);
if (cup_limit_mode) {
bundle *b = NULL;
b = bundle_create();
- bundle_add(b, "-t", "notification_power_saving_on");
+ bundle_add_str(b, "-t", "notification_power_saving_on");
_launch_app(PACKAGE_ALLSHARE_CAST, b);
bundle_free(b);
}
ad->screen_mirroring_state = WFD_POP_SCREEN_MIRROR_DISCONNECT_BY_RECONNECT_WIFI_AP;
bundle *b = NULL;
b = bundle_create();
- bundle_add(b, "-t", "reconnect_by_connecting_wifi_ap");
+ bundle_add_str(b, "-t", "reconnect_by_connecting_wifi_ap");
_launch_app(PACKAGE_ALLSHARE_CAST, b);
bundle_free(b);
return EINA_FALSE;
}
- if (!strcmp(ev->keyname, KEY_SELECT)) {
+ if (!strcmp(ev->keyname, "XF86Home")) {
WFD_APP_LOG(WFD_APP_LOG_HIGH, "[KEY]KEY_SELECT pressed");
WFD_APP_LOG(WFD_APP_LOG_HIGH, "Mac : %s", ad->mac_addr_connecting);
/* delete the notification */
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_ONGOING);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_delete_all_by_type.(%d)\n", noti_err);
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_delete_all.(%d)\n", noti_err);
return;
}
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
- ad->noti_wifi_direct_on = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ ad->noti_wifi_direct_on = notification_create(NOTIFICATION_TYPE_ONGOING);
WFD_RET_IF(NULL == ad->noti_wifi_direct_on, "NULL parameters.\n");
noti_err = notification_set_image(ad->noti_wifi_direct_on, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, WFD_ACTIVATED_NOTI_ICON_PATH);
if (result < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to set vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
}
- notification_status_message_post(_("IDS_SMR_POP_SCREEN_MIRRORING_HAS_BEEN_DISABLED"));
+ notification_status_message_post(D_("IDS_SMR_POP_SCREEN_MIRRORING_HAS_BEEN_DISABLED"));
}
__WFD_APP_FUNC_EXIT__;
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
- ad->noti_wifi_direct_connected = (notification_h) notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ ad->noti_wifi_direct_connected = (notification_h) notification_create(NOTIFICATION_TYPE_ONGOING);
WFD_RET_IF(NULL == ad->noti_wifi_direct_connected, "NULL parameters.\n");
- bundle *b = NULL;
app_control_h control;
res = app_control_create(&control);
WFD_RET_IF(res != APP_CONTROL_ERROR_NONE, "app_control_create() return error : %d", res);
app_control_set_package(control, PACKAGE);
app_control_add_extra_data(control, NOTIFICATION_BUNDLE_PARAM, NOTIFICATION_BUNDLE_VALUE);
- res = app_control_to_bundle(control, &b);
- if (res != APP_CONTROL_ERROR_NONE) {
- WFD_APP_LOG(WFD_APP_LOG_ERROR, "app_control_to_bundle() return error : %d", res);
- app_control_destroy(control);
- return;
- }
- noti_err = notification_set_execute_option(ad->noti_wifi_direct_connected, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, /*Button Text*/NULL, NULL, b);
+ noti_err = notification_set_launch_option(ad->noti_wifi_direct_connected, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, control);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to notification_set_execute_option. [%d]", noti_err);
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to notification_set_launch_option. [%d]", noti_err);
app_control_destroy(control);
return;
}
/* set the title and content */
noti_err = notification_set_text(ad->noti_wifi_direct_connected, NOTIFICATION_TEXT_TYPE_TITLE,
- _("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"), "IDS_WIFI_BODY_WI_FI_DIRECT_ABB", NOTIFICATION_VARIABLE_TYPE_NONE);
+ D_("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"), "IDS_WIFI_BODY_WI_FI_DIRECT_ABB", NOTIFICATION_VARIABLE_TYPE_NONE);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_set_text. [%d]", noti_err);
noti_err = notification_set_text(ad->noti_wifi_direct_connected, NOTIFICATION_TEXT_TYPE_CONTENT,
- _("IDS_WIFI_BODY_DISABLE_WI_FI_DIRECT_AFTER_USE_ABB"),
+ D_("IDS_WIFI_BODY_DISABLE_WI_FI_DIRECT_AFTER_USE_ABB"),
"IDS_WIFI_BODY_DISABLE_WI_FI_DIRECT_AFTER_USE_ABB", NOTIFICATION_VARIABLE_TYPE_NONE);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_set_text. [%d]", noti_err);