/* Function:    rtsp_send_request
 * Description: Send out an DESCRIBE request and process the response
 * Parameters:  abs_path              - absolute ptah for rtsp url
 *              accept_media_type     - media types to include in RTSP header
 *              abort_time            - time after which reqyest should be
 *                                      aborted
 * Returns:     Success or failed
 */
rtsp_ret_e rtsp_send_request (const char *abs_path,
                              const char *accept_media_type,
                              abs_time_t abort_time)
{
    rtsp_ret_e ret;

    if (!abs_path) {
        return RTSP_SEND_ERR;
    }
    ret = SendRequest(abs_path, accept_media_type);
    if (ret != RTSP_SUCCESS) {
        VQEC_LOG_ERROR("rtsp_send_request:: Failed sending DESCRIBE "
                        "request to %s!\n",
                        abs_path);
        return RTSP_SEND_ERR;
    }
    else {
        ret = RecvResponse(abort_time);
        if (ret != RTSP_SUCCESS) {
            VQEC_LOG_ERROR("rtsp_send_request:: Failed receiving "
                            "the response!\n");
            return RTSP_RESP_ERR;
        }
        else {
            ret = ValidateResponse(client.response.data_buffer);
        }
    }

    return ret;
}
Esempio n. 2
0
void Query::DoCommand() {
	doubleValue = 0;
	stringValue.clear();
	intValue = 0;
	positionValue.x = 0;
	positionValue.y = 0;
	vectorValue.clear();

	InitializeCommand(requestCommand);
	SendRequestAndReceiveResponse(requestCommand);
	if (ValidateResponse(responseStream)) {
		ReadResponse(responseStream);
	}
	else {
		stringstream ss;
		ss << "Wrong response to command " << commandId << ", variable " << variableId << " " << responseStatus.getDescription();
		string msg = ss.str();
//		cout << msg << endl;
		throw TraciException(msg);
	}
}