示例#1
0
void
screen_reader_launch(void)
{
	if (!screen_reader_on)
		return;
	if (is_screen_reader_running()) {
		dlog_print(DLOG_DEBUG, LOG_TAG, "screen reader already running");
		return;
	}
	app_control_h app_control;
	int ret = app_control_create(&app_control);
	dlog_print(DLOG_DEBUG, LOG_TAG, "app_control_create: %i", ret);

	if (ret == APP_CONTROL_ERROR_NONE) {
		ret = app_control_set_app_id(app_control, "org.tizen.screen-reader");
		dlog_print(DLOG_DEBUG, LOG_TAG, "app_control_set_app_id: %i", ret);
	}

	if (ret == APP_CONTROL_ERROR_NONE) {
		ret = app_control_send_launch_request(app_control, launch_reply_callback, NULL);
		dlog_print(DLOG_DEBUG, LOG_TAG, "app_control_send_launch_request: %i", ret);
	}

	screen_reader_on = ret == APP_CONTROL_ERROR_NONE;

	app_control_destroy(app_control);
}
示例#2
0
bool Application::openURL(const std::string &url)
{
    bool flag = false;
    if(0==url.length())
    {
        return flag;
    }
    app_control_h app_control;

    app_control_create(&app_control);
    app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW);
    app_control_set_uri(app_control, url.c_str());

    int ctrlError;
    if ((ctrlError=app_control_send_launch_request(app_control, NULL, NULL)) == APP_CONTROL_ERROR_NONE)
    {
        flag = true;
    }
    else
    {
        dlog_print(DLOG_ERROR, LOG_TAG, "open url failed, and returned %d", ctrlError);
    }

    app_control_destroy(app_control);
    return flag;
}
示例#3
0
static iotjs_error_t tizen_send_launch_request(const char* json,
                                               void* hbridge) {
  DDDLOG("%s", __func__);

  bundle* b;
  int ret;

  ret = bundle_from_json(json, &b);
  if (ret != BUNDLE_ERROR_NONE) {
    DDLOG("bundle_from_json failed");
    return IOTJS_ERROR_INVALID_PARAMETER;
  }

  app_control_h app_control = NULL;

  app_control_create(&app_control);
  app_control_import_from_bundle(app_control, b);

  ret = app_control_send_launch_request(app_control, NULL, NULL);

  if (ret != APP_CONTROL_ERROR_NONE) {
    DDDLOG("app_control_send_launch_request failed");
    switch (ret) {
      case APP_CONTROL_ERROR_INVALID_PARAMETER:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_INVALID_PARAMETER");
        break;
      case APP_CONTROL_ERROR_OUT_OF_MEMORY:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_OUT_OF_MEMORY");
        break;
      case APP_CONTROL_ERROR_APP_NOT_FOUND:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_APP_NOT_FOUND");
        break;
      case APP_CONTROL_ERROR_LAUNCH_REJECTED:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_LAUNCH_REJECTED");
        break;
      case APP_CONTROL_ERROR_LAUNCH_FAILED:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_LAUNCH_FAILED");
        break;
      case APP_CONTROL_ERROR_TIMED_OUT:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_TIMED_OUT");
        break;
      case APP_CONTROL_ERROR_PERMISSION_DENIED:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_PERMISSION_DENIED");
        break;
      default:
        iotjs_bridge_set_err(hbridge, "APP_CONTROL_ERROR_UNKNOWN");
        break;
    }
    return IOTJS_ERROR_RESULT_FAILED;
  }

  bundle_free(b);
  app_control_destroy(app_control);

  return IOTJS_ERROR_NONE;
}