コード例 #1
0
Eina_Bool Browser_Common_View::_share_via_nfc(std::string url)
{
	BROWSER_LOGD("[%s]", __func__);
	if (url.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	struct ug_cbs cbs = {0, };
	cbs.layout_cb = __ug_layout_cb;
	cbs.result_cb = NULL;//__ug_result_cb;
	cbs.destroy_cb = __ug_destroy_cb;
	cbs.priv = (void *)this;

	char *share_url = (char *)strdup(url.c_str());
	if (!share_url) {
		BROWSER_LOGE("strdup failed");
		return EINA_FALSE;
	}

	service_h data = NULL;
	service_create(&data);
	if (data == NULL) {
		BROWSER_LOGE("fail to service_create.");
		return EINA_FALSE;
	}
	if (service_add_extra_data(data, "count", "1")) {
		BROWSER_LOGE("service_add_extra_data is failed.");
		service_destroy(data);
		return EINA_FALSE;
	}
	if (service_add_extra_data(data, "request_type", "data_buffer")) {
		BROWSER_LOGE("service_add_extra_data is failed.");
		service_destroy(data);
		return EINA_FALSE;
	}
	if (service_add_extra_data(data, "request_data", share_url)) {
		BROWSER_LOGE("service_add_extra_data is failed.");
		service_destroy(data);

		free(share_url);
		return EINA_FALSE;
	}

	if(!ug_create(NULL, "share-nfc-efl", UG_MODE_FULLVIEW, data, &cbs))
		BROWSER_LOGE("ug_create is failed.");

	if (service_destroy(data))
		BROWSER_LOGE("service_destroy is failed.");

	free(share_url);

	return EINA_TRUE;
}
コード例 #2
0
Eina_Bool Browser_Common_View::_post_to_sns(std::string sns_name, std::string url)
{
	BROWSER_LOGD("sns_name=[%s],  url=[%s]", sns_name.c_str(), url.c_str());
	if (url.empty() || sns_name.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	int index = 0;
	for (index = 0 ; index < m_sns_name_list.size() ; index++) {
		if (m_sns_name_list[index].find(sns_name) != string::npos)
			break;
	}

	if (m_sns_path_list[index].find("twitter") != string::npos
	    || m_sns_path_list[index].find("facebook") != string::npos) {

		int ret = 0;
		service_h service_handle = NULL;
		if (service_create(&service_handle) < 0) {
			BROWSER_LOGE("Fail to create service handle");
			return EINA_FALSE;
		}
		if (!service_handle) {
			BROWSER_LOGE("service handle is NULL");
			return EINA_FALSE;
		}
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, (char *)url.c_str()) < 0) {
			BROWSER_LOGE("Fail to set post data");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_set_package(service_handle, m_sns_path_list[index].c_str()) < 0) {
			BROWSER_LOGE("Fail to set SNS");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
			BROWSER_LOGE("Fail to launch service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
		service_destroy(service_handle);
	}

	return EINA_TRUE;
}
コード例 #3
0
Eina_Bool Browser_Common_View::_add_to_contact(std::string number)
{
	if (number.empty()) {
		BROWSER_LOGE("number is null");
		return EINA_FALSE;
	}
	struct ug_cbs cbs = {0, };
	cbs.layout_cb = __ug_layout_cb;
	cbs.result_cb = NULL;//__ug_result_cb;
	cbs.destroy_cb = __ug_destroy_cb;
	cbs.priv = (void *)this;

	char *phone_number = (char *)strdup(number.c_str());
	if (!phone_number) {
		BROWSER_LOGE("strdup failed");
		return EINA_FALSE;
	}

	service_h data = NULL;
	service_create(&data);
	if (data == NULL) {
		BROWSER_LOGE("fail to service_create.");
		return EINA_FALSE;
	}
/*
type.
CT_UG_REQUEST_ADD = 21,
CT_UG_REQUEST_ADD_WITH_NUM = 22,
CT_UG_REQUEST_ADD_WITH_EMAIL = 23,
CT_UG_REQUEST_ADD_WITH_WEB = 24,
*/
	if (service_add_extra_data(data, "type", "22")) {
		BROWSER_LOGE("service_add_extra_data is failed.");
		service_destroy(data);
		return EINA_FALSE;
	}
	if (service_add_extra_data(data, "ct_num", number.c_str())) {
		BROWSER_LOGE("service_add_extra_data is failed.");
		service_destroy(data);
		return EINA_FALSE;
	}

	if (!ug_create(NULL, "contacts-details-efl", UG_MODE_FULLVIEW, data, &cbs))
		BROWSER_LOGE("ug_create is failed.");

	if (service_destroy(data))
		BROWSER_LOGE("service_destroy is failed.");

	free(phone_number);
}
コード例 #4
0
int test_cb_service_check_processed() {
	assert(OK == neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA, test_nebmodule->module_handle, 0,  _test_cb));
	event_broker_options = BROKER_EVERYTHING;
	check_result *cr = check_result_new(0, "Some output");
	host *host = host_new("MyHost");
	service *service = service_new(host, "MyService");
	nebstruct_service_check_data *ds = NULL;
	assert(OK == handle_async_service_check_result(service, cr));
	ds = (nebstruct_service_check_data *) received_callback_data[NEBCALLBACK_SERVICE_CHECK_DATA][NEBTYPE_SERVICECHECK_PROCESSED];
	ok(ds != NULL, "SERVICE_CHECK_DATA callback invoked");
	ok(ds->type == NEBTYPE_SERVICECHECK_PROCESSED, "nebstruct has expected type") || diag("Type was %d", ds->type);
	ok(!strcmp(ds->host_name, "MyHost"), "nebstruct has expected hostname");
	ok(!strcmp(ds->service_description, "MyService"), "nebstruct has expected service description");
	ok(ds->attr == NEBATTR_NONE, "nebstruct has no attributes set");
	clear_callback_data();

	/* test stalking */
	/* a change in plugin output should result in the NEBATTR_CHECK_ALERT attribute being set
	 * for a service, for which stalking is enabled
	 *
	 * This output change is emulated implicitly by our fixture where service->plugin_output
	 * is "Initial state" and cr->output is "Some output"
	 * */
	service->stalking_options |= ~0; /*stalk all the states*/
	assert(OK == handle_async_service_check_result(service, cr));
	ds = (nebstruct_service_check_data *) received_callback_data[NEBCALLBACK_SERVICE_CHECK_DATA][NEBTYPE_SERVICECHECK_PROCESSED];
	ok(ds->attr == NEBATTR_CHECK_ALERT, "nebstruct has NEBATTR_CHECK_ALERT attribute set");

	clear_callback_data();
	check_result_destroy(cr);
	service_destroy(service);
	host_destroy(host);
	return 0;
}
コード例 #5
0
ファイル: js_service.c プロジェクト: CrashSerious/showtime
static void
js_service_destroy(js_service_t *jss)
{
  service_destroy(jss->jss_s);
  LIST_REMOVE(jss, jss_link);
  js_service_release(jss);
}
コード例 #6
0
static void playMusic()
{
	service_h service;
	service_create(&service);
	service_set_operation(service, SERVICE_OPERATION_VIEW);
	service_set_package(service, SOUND_PLAYER_PKG_NAME);
	service_set_uri(service, "file:///opt/usr/media/Downloads/2.mp3");
	if (service_send_launch_request(service, NULL, NULL) == SERVICE_ERROR_NONE) {
		printf("Success\n");
	} else {
		printf("Fail\n");
	}
	service_destroy(service);
}
コード例 #7
0
ファイル: wii_dvd.c プロジェクト: Bibamaru/showtime
static void 
dvdprobe(callout_t *co, void *aux)
{
  disc_scanner_t *ds = aux;

  callout_arm(&ds->ds_timer, dvdprobe, ds, 1);

  if(ds->ds_disc_inserted == 0) {

    DI_Mount();

    if(DI_GetStatus() == DVD_NO_DISC)
      return;

    TRACE(TRACE_INFO, "DVD", "DVD inserted");
    ds->ds_disc_inserted = 1;
    ds->ds_disc_ready = 0;

  } else {
    uint32_t s = DI_GetStatus();


    if(s == DVD_UNKNOWN) {
      ds->ds_disc_inserted = 0;
      notify_add(NOTIFY_ERROR, NULL, 5, "Unknown disc inserted, ejecting...");
      DI_Eject();
      return;
    }

    if(!(s & DVD_READY)) {
      TRACE(TRACE_DEBUG, "DVD", "Waiting for disc ready state = %x", s);
      return;
    }

    if(!ds->ds_disc_ready)
      check_disc_type(ds);

    if(DI_GetCoverRegister(&s) || !(s & DVD_COVER_DISC_INSERTED)) {
      ds->ds_disc_inserted = 0;
      TRACE(TRACE_INFO, "DVD", "DVD no longer present");
      
      if(ds->ds_service != NULL) {
	service_destroy(ds->ds_service);
	ds->ds_service = NULL;
      }
    }
  }
}
コード例 #8
0
void _rbutton_click_cb(void *data, Evas_Object *obj, void *event_info)
{
	service_h service;
	int ret;

	ret = service_create(&service);
	if (ret != SERVICE_ERROR_NONE) {
		INFO_LOG(UG_NAME_ERR, "service_create failed: %d", ret);
		return;
	}

	service_add_extra_data(service, "result", "rbutton_click");
	ug_send_result(ug_app_state->ug, service);

	service_destroy(service);

	wifi_exit();
}
コード例 #9
0
ファイル: linux_dvd.c プロジェクト: Cy-4AH/showtime
static void
set_status(disc_scanner_t *ds, disc_status_t status, const char *title)
{
  char buf[64];
  char url[URL_MAX];
  if(ds->ds_status == status)
    return;

  ds->ds_status = status;

  if(ds->ds_svc != NULL) {
    service_destroy(ds->ds_svc);
    ds->ds_svc = NULL;
  }

  switch(status) {
  case DISC_NO_DRIVE:
  case DISC_NO_DISC:
    break;

  case DISC_AUDIO:
    snprintf(buf, sizeof(buf), "Audio CD");
    snprintf(url, sizeof(url), "audiocd:%s", ds->ds_dev);
    ds->ds_svc = service_create(url, buf, url, "music", NULL, 0, 1,
				SVC_ORIGIN_MEDIA);
    break;

  case DISC_ISOFS:
    snprintf(buf, sizeof(buf), "DVD: %s", title);
    snprintf(url, sizeof(url), "dvd:%s", ds->ds_dev);

    ds->ds_svc = service_create(url, buf, url, "video", NULL, 0, 1,
				SVC_ORIGIN_MEDIA);
    break;

  case DISC_UNKNOWN_TYPE:
#if 0 /* FIXME: Must not pass url as NULL */
    snprintf(buf, sizeof(buf), "Unknown disc");
    ds->ds_svc = service_create(ds->ds_dev, buf, NULL, SVC_TYPE_VIDEO, NULL, 0);
#endif
    break;
  }
}
コード例 #10
0
ファイル: sd.c プロジェクト: dev-life/showtime
void
si_destroy(service_instance_t *si)
{
  if(si->si_service != NULL)
    service_destroy(si->si_service);

  setting_destroy(si->si_setting_enabled);
  setting_destroy(si->si_setting_title);
  setting_destroy(si->si_setting_type);

  prop_destroy(si->si_settings);
  free(si->si_settings_path);
  htsmsg_destroy(si->si_settings_store);

  LIST_REMOVE(si, si_link);

  free(si->si_id);
  free(si->si_url);
  free(si);
}
コード例 #11
0
ファイル: bookmarks.c プロジェクト: MatChung/showtime
static void
bookmark_destroyed(void *opaque, prop_event_t event, ...)
{
  bookmark_t *bm = opaque;
  prop_sub_t *s;
  va_list ap;
  va_start(ap, event);

  if(event != PROP_DESTROYED)
    return;

  s = va_arg(ap, prop_sub_t *);

  prop_unsubscribe(bm->bm_title_sub);
  prop_unsubscribe(bm->bm_url_sub);
  prop_unsubscribe(bm->bm_type_sub);

  service_destroy(bm->bm_service);

  free(bm);

  bookmark_save();
  prop_unsubscribe(s);
}
コード例 #12
0
Eina_Bool Browser_Common_View::_send_via_email(std::string url, Eina_Bool attach_file)
{
	BROWSER_LOGD("[%s], url[%s]", __func__, url.c_str());
	if (url.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	service_h service_handle = NULL;
	if (service_create(&service_handle) < 0) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!service_handle) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (attach_file) {
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
		return EINA_FALSE;
	}

		if (service_set_uri(service_handle, url.c_str()) < 0) {
			BROWSER_LOGE("Fail to set uri");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
	} else {
		if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
			BROWSER_LOGE("Fail to set service operation");
			service_destroy(service_handle);
			return EINA_FALSE;
		}

		if (strstr(url.c_str(), BROWSER_MAIL_TO_SCHEME)) {
			if (service_add_extra_data(service_handle, SERVICE_DATA_TO, url.c_str() + strlen(BROWSER_MAIL_TO_SCHEME)) < 0) {
				BROWSER_LOGE("Fail to set mailto data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		} else {
			if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}
	}

	if (service_set_package(service_handle, SEC_EMAIL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}
	service_destroy(service_handle);

	return EINA_TRUE;
}
コード例 #13
0
Eina_Bool Browser_Common_View::_launch_streaming_player(const char *url, const char *cookie)
{
	BROWSER_LOGD("%s", __func__);
	if (!url || strlen(url) == 0) {
		BROWSER_LOGE("url is empty");
		return EINA_FALSE;
	}

	bool is_running = false;
	if (app_manager_is_running(SEC_VT_CALL, &is_running) < 0) {
		BROWSER_LOGE("Fail to get app running information\n");
		return EINA_FALSE;
	}
	if (is_running) {
		BROWSER_LOGE("video-call is running......\n");
		show_msg_popup(BR_STRING_WARNING_VIDEO_PLAYER);
		return EINA_FALSE;
	}

	service_h service_handle = NULL;

	if (service_create(&service_handle) < 0) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!service_handle) {
		BROWSER_LOGE("service handle is NULL");
		return EINA_FALSE;
	}

	BROWSER_LOGD("url=[%s]", url);
	if (service_add_extra_data(service_handle, "path", url) < 0) {
		BROWSER_LOGE("Fail to set extra data");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (cookie && strlen(cookie)) {
		if (service_add_extra_data(service_handle, "cookie", cookie) < 0) {
			BROWSER_LOGE("Fail to set extra data");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
	}

	if (service_set_package(service_handle,SEC_STREAMING_PLAYER) < 0) {
		BROWSER_LOGE("Fail to set package");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	service_destroy(service_handle);

	return EINA_TRUE;
}
コード例 #14
0
Eina_Bool Browser_Common_View::_send_via_message(std::string url, std::string to, Eina_Bool attach_file)
{
	BROWSER_LOGD("[%s], url[%s], to[%s]", __func__, url.c_str(), to.c_str());
	if (url.empty() && to.empty()) {
		show_msg_popup(BR_STRING_EMPTY);
		return EINA_FALSE;
	}

	service_h service_handle = NULL;
	if (service_create(&service_handle) < 0) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!service_handle) {
		BROWSER_LOGE("Fail to create service handle");
		return EINA_FALSE;
	}

	if (!url.empty()) {
		if (attach_file) {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}

			if (service_add_extra_data(service_handle, "ATTACHFILE", url.c_str())) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		} else {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}

			if (service_add_extra_data(service_handle, SERVICE_DATA_TEXT, url.c_str()) < 0) {
				BROWSER_LOGE("Fail to set extra data");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}
	}

	if (!to.empty()) {
		if (url.empty()) {
			if (service_set_operation(service_handle, SERVICE_OPERATION_SEND_TEXT) < 0) {
				BROWSER_LOGE("Fail to set service operation");
				service_destroy(service_handle);
				return EINA_FALSE;
			}
		}

		if (service_add_extra_data(service_handle, SERVICE_DATA_TO , to.c_str()) < 0) {
			BROWSER_LOGE("Fail to set extra data");
			service_destroy(service_handle);
			return EINA_FALSE;
		}
	}

	if (service_set_package(service_handle, SEC_MESSAGE) < 0) {//SEC_EMAIL
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}

	if (service_send_launch_request(service_handle, NULL, NULL) < 0) {
		BROWSER_LOGE("Fail to launch service operation");
		service_destroy(service_handle);
		return EINA_FALSE;
	}
	service_destroy(service_handle);

	return EINA_TRUE;
}