コード例 #1
0
ファイル: avrcp.c プロジェクト: mjbshaw/bluez
static int handle_register_notification_cmd(struct avrcp *session,
						uint8_t transaction,
						uint8_t event,
						uint32_t interval,
						void *user_data)
{
	struct avrcp_device *dev = user_data;
	struct hal_ev_avrcp_register_notification ev;

	DBG("");

	/* TODO: Add any missing events supported by Android */
	switch (event) {
	case AVRCP_EVENT_STATUS_CHANGED:
	case AVRCP_EVENT_TRACK_CHANGED:
	case AVRCP_EVENT_PLAYBACK_POS_CHANGED:
		break;
	default:
		return -EINVAL;
	}

	ev.event = event;
	ev.param = interval;

	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_AVRCP,
					HAL_EV_AVRCP_REGISTER_NOTIFICATION,
					sizeof(ev), &ev);

	push_request(dev, AVRCP_REGISTER_NOTIFICATION, event, transaction);

	return -EAGAIN;
}
コード例 #2
0
ファイル: memcached.c プロジェクト: AlexShiLucky/lighttpd2
liMemcachedRequest* li_memcached_get(liMemcachedCon *con, GString *key, liMemcachedCB callback, gpointer cb_data, GError **err) {
	int_request* req;

	if (!li_memcached_is_key_valid(key)) {
		g_set_error(err, LI_MEMCACHED_ERROR, LI_MEMCACHED_BAD_KEY, "Invalid key: '%s'", key->str);
		return NULL;
	}

	if (-1 == con->fd) memcached_connect(con);
	if (-1 == con->fd) {
		if (NULL == con->err) {
			g_set_error(err, LI_MEMCACHED_ERROR, LI_MEMCACHED_DISABLED, "Not connected");
		} else if (err) {
			*err = g_error_copy(con->err);
		}
		return NULL;
	}

	req = g_slice_new0(int_request);
	req->req.callback = callback;
	req->req.cb_data = cb_data;

	req->type = REQ_GET;
	req->key = g_string_new_len(GSTR_LEN(key));

	if (!push_request(con, req, err)) {
		free_request(con, req);
		return NULL;
	}

	return &req->req;
}
コード例 #3
0
ファイル: http_request_parser.c プロジェクト: V-E-O/meinheld
static int
message_begin_cb(http_parser *p)
{
    request *req = NULL;
    PyObject *environ = NULL;
    client_t *client = get_client(p);

    DEBUG("message_begin_cb");

    req = new_request();
    if(req == NULL){
        return -1;
    }
    req->start_msec = current_msec;
    client->current_req = req;
    environ = new_environ(client);
    client->complete = 0;
    /* client->bad_request_code = 0; */
    /* client->body_type = BODY_TYPE_NONE; */
    /* client->body_readed = 0; */
    /* client->body_length = 0; */
    req->environ = environ;
    push_request(client->request_queue, client->current_req);
    return 0;
}
コード例 #4
0
ファイル: runner.cpp プロジェクト: sanyaade-teachings/marsyas
void Runner::push_staged_control_values()
{
  if (m_set_controls_event) {
    push_request( m_set_controls_event );
    m_set_controls_event = 0;
  }
}
コード例 #5
0
ファイル: avrcp.c プロジェクト: mjbshaw/bluez
static int handle_get_play_status_cmd(struct avrcp *session,
					uint8_t transaction, void *user_data)
{
	struct avrcp_device *dev = user_data;

	DBG("");

	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_AVRCP,
					HAL_EV_AVRCP_GET_PLAY_STATUS, 0, NULL);

	push_request(dev, AVRCP_GET_PLAY_STATUS, 0, transaction);

	return -EAGAIN;
}
コード例 #6
0
ファイル: http_client.cpp プロジェクト: denizt/cpprestsdk
void _http_client_communicator::async_send_request(const std::shared_ptr<request_context> &request)
{
    if (m_client_config.guarantee_order())
    {
        // Send to call block to be processed.
        push_request(request);
    }
    else
    {
        // Schedule a task to start sending.
        pplx::create_task([this, request]
        {
            open_and_send_request(request);
        });
    }
}
コード例 #7
0
ファイル: runner.cpp プロジェクト: sanyaade-teachings/marsyas
void Runner::enqueue_control_value(const MarControlPtr & control,
                                   const any & value,
                                   bool push)
{
  if (push)
  {
    push_request( new SetControlEvent(control, value) );
  }
  else
  {
    if (!m_set_controls_event)
      m_set_controls_event = new SetControlsEvent;

    m_set_controls_event->control_values[control] = value;
  }
}
コード例 #8
0
ファイル: avrcp.c プロジェクト: mjbshaw/bluez
static int handle_get_element_attrs_cmd(struct avrcp *session,
					uint8_t transaction, uint64_t uid,
					uint8_t number, uint32_t *attrs,
					void *user_data)
{
	struct avrcp_device *dev = user_data;
	uint8_t buf[IPC_MTU];
	struct hal_ev_avrcp_get_element_attrs *ev = (void *) buf;
	int i;

	DBG("");

	ev->number = number;
	/* Set everything in case of empty list */
	if (ev->number == 0) {
		for (i = 0; i < HAL_AVRCP_MEDIA_ATTR_DURATION; i++) {
			/* Skip 0x00 as the attributes start with 0x01 */
			ev->attrs[i] = i + 1;
		}
		ev->number = i;
		goto done;
	}

	for (i = 0; i < number; i++)
		ev->attrs[i] = attrs[i];

done:
	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_AVRCP,
					HAL_EV_AVRCP_GET_ELEMENT_ATTRS,
					sizeof(*ev) + ev->number, ev);

	push_request(dev, AVRCP_GET_ELEMENT_ATTRIBUTES, 0, transaction);

	return -EAGAIN;

}