Пример #1
0
static void _tab_view_select_DEVICE_cb(void *data, Evas_Object *obj, void *event_info)
{
	RETM_IF(!event_info, "event_info is NULL");
	RETM_IF(!data, "data is NULL");
	tab_view_data *tab_data = (tab_view_data *) data;

	if(event_info != tab_data->pressed_toolbar_item)
	{
		Evas_Object **content_to_switch_to = NULL;
		tab_data->pressed_toolbar_item = event_info;
		if(tab_data->state!=STATE_DEVICE){
			tab_data->state=STATE_DEVICE;
			content_to_switch_to = &tab_data->ongoing_notification_tab;

		}

		if(!*content_to_switch_to)
		{

			*content_to_switch_to = _tab_view_create_tab_content(data);
		}

		_tab_view_switch_content(*content_to_switch_to, tab_data);

	}
}
Пример #2
0
static void _on_message_received_cb(int port_id,
        const char *rem_app_name,
        const char *rem_port_name,
        bool trusted_message,
        bundle *rec_msg,
        void *user_data)
{
    DBG("Received message from port %d", port_id);

    RETM_IF(!user_data, "user_data is NULL");

    proxy_client *proxy_cl = user_data;

    if (port_id != proxy_cl->local_port_id)
    {
        ERR("Receive message by unknown port id = %d", port_id);
        return;
    }

    int res = _proxy_client_set_remote_data(proxy_cl, rem_app_name, rem_port_name);
    RETM_IF(res != SVC_RES_OK ,"Failed to set remote data to message port");

    if (proxy_cl->cb_func)
    {
        res = proxy_cl->cb_func(proxy_cl->cb_data, rec_msg);
        RETM_IF(res != SVC_RES_OK ,"Message port callback function failed");
    }
    else
    {
        DBG("Message port callback function not set");
    }
}
Пример #3
0
//1click
static void _tab_view_fill_list(Evas_Object *list, tab_view_data *data)
{
	RETM_IF(!list, "list is NULL");
	RETM_IF(!data, "data is NULL");

	int size = 0;
	evas_object_data_set(list , "view_data", data->navi);

	notification_data *notification_list = NULL;

	if (STATE_INTERFACE == data->state)
	{
		notification_list = interface_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{	notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, log_fill_item_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, notification_item_fill_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, ongoingnotification_item_fill_cb, &notification_list[2]);

	}
	else if (STATE_DEVICE == data->state)
	{
		notification_list = device_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{
				notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, devicestatus_item_fill_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, file_item_fill_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, preference_item_fill_cb, &notification_list[2]);
			elm_list_item_append(list, notification_list[3].name, NULL, NULL, sensor_item_fill_cb, &notification_list[3]);
			elm_list_item_append(list, notification_list[4].name, NULL, NULL, mediarecorder_item_fill_cb, &notification_list[4]);

	}
	else if(STATE_COMMUNICATION == data->state)
	{
		notification_list = communication_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{
				notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, bouetooth_fill_item_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, gps_fill_item_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, http_fill_item_cb, &notification_list[2]);
			elm_list_item_append(list, notification_list[3].name, NULL, NULL, nfc_fill_item_cb, &notification_list[3]);
			elm_list_item_append(list, notification_list[4].name, NULL, NULL, socket_fill_item_cb, &notification_list[4]);

	}


}
Пример #4
0
static void _tab_view_switch_content(Evas_Object *content_to_switch_to, tab_view_data *data)
{
	RETM_IF(!content_to_switch_to, "content_to_switch_to is NULL");
	RETM_IF(!data, "data is NULL");
	Evas_Object *content_to_switch_from = NULL;

	content_to_switch_from = elm_object_part_content_unset(data->layout, "elm.swallow.content");
	evas_object_hide(content_to_switch_from);
	elm_object_part_content_set(data->layout, "elm.swallow.content", content_to_switch_to);
	evas_object_show(content_to_switch_to);
}
Пример #5
0
static void _main_view_resume_cb(void *data, Evas_Object *obj, void *event_info)
{
    RETM_IF(!data, "data is NULL");
    main_view *main_view_data = data;

    _main_view_start_camera_preview(main_view_data->camera);
}
Пример #6
0
static void _main_view_pause_cb(void *data, Evas_Object *obj, void *event_info)
{
	INF("In _main_view_pause_cb function");
    RETM_IF(!data, "data is NULL");
    main_view *main_view_data = data;
    _main_view_stop_camera_preview(main_view_data->camera);
}
Пример #7
0
void tab_view_add(Evas_Object *parent)
{
	RETM_IF(!parent, "parent is NULL");

	tab_view_data *data = calloc(1, sizeof(tab_view_data));
	data->navi = parent;

	data->layout = ui_utils_layout_add(data->navi, _tab_view_destroy, data);
	if(!data->layout)
	{
		free(data);
		return;
	}

	data->tab = elm_toolbar_add(data->navi);
	if(!data->tab)
	{
		evas_object_del(data->layout);
		return;
	}
	elm_toolbar_shrink_mode_set(data->tab, ELM_TOOLBAR_SHRINK_EXPAND);
	elm_toolbar_transverse_expanded_set(data->tab, EINA_TRUE);
	elm_object_style_set(data->tab, "tabbar");

	_tab_view_fill(data);
	data->navi_item = elm_naviframe_item_push(data->navi, NULL, NULL, NULL, data->layout, "tabbar/notitle");
	elm_object_item_part_content_set(data->navi_item, "tabbar", data->tab);

	/* Create badge */
	int err = badge_new(PACKAGE);
	if(BADGE_ERROR_NONE != err)
	{
		ERR("Badge is not created.");
	}
}
Пример #8
0
 void _tab_view_layout_fill_cb2depth(void *data, Evas_Object *obj, void *event_info)
{
	RETM_IF(!obj, "obj is NULL");
	RETM_IF(!data, "data is NULL");


    elm_list_item_selected_set(event_info, EINA_FALSE);
    notification_data *notification_info = (notification_data *)data;




    Evas_Object *navi = evas_object_data_get(notification_info->status, "view_data");

    RETM_IF(!navi, "navi is NULL");

    notification_info->callback(notification_info);
    layout_view_add(navi, notification_info);
}
Пример #9
0
static void _main_view_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
{
    RETM_IF(!data, "data is null");
    DBG(" <<< called");
    main_view *main_view_data = data;
    if (main_view_data->popup)
    {
        DBG("popup closed");
        evas_object_del(main_view_data->popup);
        main_view_data->popup = NULL;
    }
}
Пример #10
0
static void _main_view_show_warning_popup(Evas_Object *navi, const char *caption, const char *text, const char *button_text, void *data)
{
    RETM_IF(!data, "data is null");
    DBG(" <<< called");
    main_view *main_view_data = data;

    Evas_Object *popup = elm_popup_add(navi);
    RETM_IF(!popup, "popup is not created");
    elm_object_part_text_set(popup, "title,text", caption);
    elm_object_text_set(popup, text);
    evas_object_show(popup);

    Evas_Object *button = elm_button_add(popup);
    RETM_IF(!button, "button is not created");
    elm_object_style_set(button, POPUP_BUTTON_STYLE);
    elm_object_text_set(button, button_text);
    elm_object_part_content_set(popup, POPUP_BUTTON_PART, button);
    evas_object_smart_callback_add(button, "clicked", _main_view_popup_close_cb, main_view_data);

    eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _main_view_popup_close_cb, main_view_data);

    main_view_data->popup = popup;
}
Пример #11
0
static void _tab_view_fill(tab_view_data *data)
{
	Elm_Object_Item *notification_item = NULL;

	RETM_IF(!data, "data is NULL");

	notification_item = elm_toolbar_item_append(data->tab, NULL,
			"INTERFACE", _tab_view_select_INTERFACE_cb, data);
	elm_toolbar_item_append(data->tab, NULL,
			"DEVICE", _tab_view_select_DEVICE_cb, data);
	elm_toolbar_item_append(data->tab, NULL,
			"COMMUNICATION", _tab_view_select_COMMUNICATION_cb, data);


	elm_toolbar_select_mode_set(data->tab, ELM_OBJECT_SELECT_MODE_ALWAYS);
	elm_toolbar_item_selected_set(notification_item, EINA_TRUE);
}
Пример #12
0
static void _main_view_camera_capturing_cb(camera_image_data_s *image_data, camera_image_data_s *postview, camera_image_data_s *thumbnail, void *user_data)
{
	main_view *main_view_data = user_data;

	INF("Camera Capturing");

    if (!main_view_data->camera_enabled)
    {
        ERR("Camera hasn't been initialized.");
        return;
    }
    if(image_data != NULL)
    {
    	INF("Image Size: %u, Width: %d Height: %d", image_data->size, image_data->width, image_data->height);
    	/*
    	 * File Operations
    	 */
    	FILE *file = fopen(CAMERA_DIRECTORY, "w+");
    	RETM_IF(!file, "fopen() failed");
    	size_t size = fwrite(image_data->data, image_data->size, 1, file);
    	WARN_IF(size != 1, "fwrite() failed");
    	fclose(file);


    	if(image_data->format == CAMERA_PIXEL_FORMAT_NV12)
    	{

    	}
    	else if(image_data->format == CAMERA_PIXEL_FORMAT_RGBA)
    	{

    	}
    	else if (image_data->format == CAMERA_PIXEL_FORMAT_JPEG)
        {

        }
    }
//    _main_view_stop_camera_preview(main_view_data->camera);
}
static void _found_resource(iotcon_remote_resource_h resource, iotcon_error_e result,
		void *user_data)
{
	int ret;
	GList *node;
	char *resource_host;
	char *resource_uri_path;
	char *resource_device_id;
	iotcon_resource_interfaces_h resource_interfaces;
	iotcon_resource_types_h resource_types;
	iotcon_remote_resource_h cloned_resource;

	RETM_IF(IOTCON_ERROR_NONE != result, "Invalid result(%d)", result);

	if (NULL == resource)
		return;

	INFO("===== resource found =====");

	/* get the resource URI */
	ret = iotcon_remote_resource_get_uri_path(resource, &resource_uri_path);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_get_uri_path() Fail(%d)", ret);
		return;
	}

	/* get the device unique id.
	 * this is unique per-server independent on how it was discovered. */
	ret = iotcon_remote_resource_get_device_id(resource, &resource_device_id);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_get_device_id() Fail(%d)", ret);
		return;
	}
	DBG("[%s] resource device id : %s", resource_uri_path, resource_device_id);

	node = g_list_find_custom(device_id_list, resource_device_id, _device_id_compare);

	door_resource_device_id = strdup(resource_device_id);
	if (NULL == door_resource_device_id) {
		ERR("strdup(door_resource_device_id) Fail");
		return;
	}

	device_id_list = g_list_append(device_id_list, door_resource_device_id);

	if (node) {
		DBG("This device(%s) is already found. skip !", door_resource_device_id);
		return;
	}

	/* get the resource host address */
	ret = iotcon_remote_resource_get_host_address(resource, &resource_host);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_get_host_address() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}
	DBG("[%s] resource host : %s", resource_uri_path, resource_host);

	/* get the resource interfaces */
	ret = iotcon_remote_resource_get_interfaces(resource, &resource_interfaces);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_get_interfaces() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	ret = iotcon_resource_interfaces_foreach(resource_interfaces, _get_res_iface_cb,
			resource_uri_path);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_resource_interfaces_foreach() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	/* get the resource types */
	ret = iotcon_remote_resource_get_types(resource, &resource_types);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_get_types() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	ret = iotcon_resource_types_foreach(resource_types, _get_res_type_cb,
			resource_uri_path);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_resource_types_foreach() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	ret = iotcon_remote_resource_clone(resource, &cloned_resource);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_clone() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	/* Start Monitoring */
	ret = iotcon_remote_resource_start_monitoring(cloned_resource, _state_changed_cb,
			NULL);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_start_monitoring() Fail(%d)", ret);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	/* Start Caching */
	ret = iotcon_remote_resource_start_caching(cloned_resource,
			_representation_changed_cb, NULL);
	if (IOTCON_ERROR_NONE != ret) {
		ERR("iotcon_remote_resource_start_caching() Fail(%d)", ret);
		iotcon_remote_resource_stop_monitoring(resource);
		device_id_list = g_list_remove(device_id_list, door_resource_device_id);
		free(door_resource_device_id);
		return;
	}

	device_id_list = g_list_remove(device_id_list, door_resource_device_id);
	free(door_resource_device_id);
}