コード例 #1
0
int at_send_command_multiline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse, ...)
{
    int err;

    struct atcontext *ac = getAtContext();
    va_list ap;
    va_start(ap, pp_outResponse);

    err = at_send_command_full (command, MULTILINE, responsePrefix,
                                    NULL, ac->timeoutMsec, pp_outResponse, 1, ap);
    va_end(ap);

    if (err == AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL
            && (*pp_outResponse)->p_intermediates == NULL)
        /* Command with pp_outResponse must have an intermediate response */
        err = AT_ERROR_INVALID_RESPONSE;

    /* Free response in case of error */
    if (err != AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL) {
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
    }

    if (err != AT_NOERROR)
        ALOGI(" --- %s", at_str_err(-err));

    return -err;
}
コード例 #2
0
int at_send_command_transparent (const char *command,
                                 const char *pdu,
                                 size_t length,
                                 const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    struct atcontext *context = get_at_context();

    ENTER;

    context->pdu_length = length;

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    pdu, context->timeoutMsec, pp_outResponse, 0, empty);
    if (err == AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL
            && (*pp_outResponse)->p_intermediates == NULL)
        /* Command with pp_outResponse must have an intermediate response */
        err = AT_ERROR_INVALID_RESPONSE;

    /* Free response in case of error */
    if (err != AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL) {
         at_response_free(*pp_outResponse);
         *pp_outResponse = NULL;
    }

    if (err != AT_NOERROR)
        MBMLOGE("%s --- %s", command, at_str_err(-err));

    EXIT;
    return -err;
}
コード例 #3
0
int at_send_command_sms (const char *command,
                                const char *pdu,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    struct atcontext *ac = getAtContext();

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    pdu, ac->timeoutMsec, pp_outResponse, 0, empty);

    if (err == AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL
            && (*pp_outResponse)->p_intermediates == NULL)
        /* Command with pp_outResponse must have an intermediate response */
        err = AT_ERROR_INVALID_RESPONSE;

    /* Free response in case of error */
    if (err != AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL) {
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
    }

    if (err != AT_NOERROR)
        ALOGI(" --- %s", at_str_err(-err));

    return -err;
}
コード例 #4
0
int at_send_command_numeric (const char *command,
                                 ATResponse **pp_outResponse)
{
    int err;

    struct atcontext *context = get_at_context();

    ENTER;

    err = at_send_command_full (command, NUMERIC, NULL,
                                    NULL, context->timeoutMsec, pp_outResponse, 0, empty);

    if (err == AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL
            && (*pp_outResponse)->p_intermediates == NULL)
        /* Command with pp_outResponse must have an intermediate response */
        err = AT_ERROR_INVALID_RESPONSE;

    /* Free response in case of error */
    if (err != AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL) {
         at_response_free(*pp_outResponse);
         *pp_outResponse = NULL;
    }

    if (err != AT_NOERROR)
        MBMLOGE("%s --- %s", command, at_str_err(-err));

    EXIT;
    return -err;
}
コード例 #5
0
int at_send_command_singleline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse, ...)
{
    int err;

    struct atcontext *context = get_at_context();
    va_list ap;
    va_start(ap, pp_outResponse);

    ENTER;

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    NULL, context->timeoutMsec, pp_outResponse, 1, ap);
    if (err == AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL
            && (*pp_outResponse)->p_intermediates == NULL)
        /* Command with pp_outResponse must have an intermediate response */
        err = AT_ERROR_INVALID_RESPONSE;

    /* Free response in case of error */
    if (err != AT_NOERROR && pp_outResponse != NULL
            && (*pp_outResponse) != NULL) {
         at_response_free(*pp_outResponse);
         *pp_outResponse = NULL;
    }

    va_end(ap);

    if (err != AT_NOERROR)
        MBMLOGE("%s --- %s", command, at_str_err(-err));

    EXIT;
    return -err;
}
コード例 #6
0
ファイル: atchannel.c プロジェクト: TribeMedia/sierra-ril
/**
 * Issue a single normal AT command with no intermediate response expected
 *
 * "command" should not include \r
 * pp_outResponse can be NULL
 *
 * if non-NULL, the resulting ATResponse * must be eventually freed with
 * at_response_free
 */
int at_send_command (const char *command, ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, NO_RESULT, NULL,
                                NULL, 0, pp_outResponse);

    return err;
}
コード例 #7
0
ファイル: atchannels.c プロジェクト: WayWingsDev/mediatek
int at_send_command_multiline(  const char * command,
                                const char * responsePrefix,
                                ATResponse ** pp_outResponse,
                                RILChannelCtx * p_channel)
{
	int err;
	err = at_send_command_full(command, MULTILINE, responsePrefix, NULL, 0, pp_outResponse, p_channel);
	return err;
}
コード例 #8
0
int at_send_command_timeout (const char *command, long long timeout, ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, NO_RESULT, NULL,
                                    NULL, timeout, pp_outResponse);

    return err;
}
コード例 #9
0
int at_send_command_multiline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, MULTILINE, responsePrefix,
                                    NULL, TGM_TIMEOUT, pp_outResponse);

    return err;
}
コード例 #10
0
/**
 * Issue a single normal AT command with no intermediate response expected.
 *
 * "command" should not include \r.
 */
int at_send_command (const char *command, ...)
{
    int err;

    struct atcontext *ac = getAtContext();
    va_list ap;
    va_start(ap, command);

    err = at_send_command_full (command, NO_RESULT, NULL,
            NULL, ac->timeoutMsec, NULL, 1, ap);
    va_end(ap);

    if (err != AT_NOERROR)
        ALOGI(" --- %s", at_str_err(-err));

    return -err;
}
コード例 #11
0
int at_send_command_raw (const char *command, ATResponse **pp_outResponse)
{
    struct atcontext *ac = getAtContext();
    int err;

    err = at_send_command_full (command, MULTILINE, "",
            NULL, ac->timeoutMsec, pp_outResponse, 0, empty);

    /* Don't check for intermediate responses as it is unknown if any
     * intermediate responses are expected. Don't free the response, instead,
     * let calling function free the allocated response.
     */

    if (err != AT_NOERROR)
        ALOGI(" --- %s", at_str_err(-err));

    return -err;
}
コード例 #12
0
ファイル: atchannels.c プロジェクト: WayWingsDev/mediatek
int at_send_command_numeric(const char *	command,
			    ATResponse **	pp_outResponse,
			    RILChannelCtx *	p_channel)
{
	int err;
	err = at_send_command_full(command, NUMERIC, NULL, NULL, 0, pp_outResponse, p_channel);

	if (err == 0 && pp_outResponse != NULL && 
        (*pp_outResponse)->success > 0 && 
        (*pp_outResponse)->p_intermediates == NULL) 
    {
		/* successful command must have an intermediate response */
		at_response_free(*pp_outResponse);
		*pp_outResponse = NULL;
		return AT_ERROR_INVALID_RESPONSE;
	}

	return err;
}
コード例 #13
0
ファイル: atchannels.c プロジェクト: WayWingsDev/mediatek
int at_send_command_sms(const char *	command,
                        const char *	pdu,
                        const char *	responsePrefix,
                        ATResponse **	pp_outResponse,
                        RILChannelCtx * p_channel)
{
	int err;
	err = at_send_command_full(command, SINGLELINE, responsePrefix, pdu, 0, pp_outResponse, p_channel);

	if (err == 0 && pp_outResponse != NULL && 
        (*pp_outResponse)->success > 0 && 
        (*pp_outResponse)->p_intermediates == NULL) {
		/* successful command must have an intermediate response */
		at_response_free(*pp_outResponse);
		*pp_outResponse = NULL;
		return AT_ERROR_INVALID_RESPONSE;
	}

	return err;
}
コード例 #14
0
/**
 * Issue a single normal AT command with no intermediate response expected.
 *
 * "command" should not include \r.
 * pp_outResponse can be NULL.
 *
 * if non-NULL, the resulting ATResponse * must be eventually freed with
 * at_response_free.
 */
int at_send_command (const char *command, ...)
{
    int err;

    struct atcontext *context = get_at_context();
    va_list ap;
    va_start(ap, command);

    ENTER;

    err = at_send_command_full (command, NO_RESULT, NULL,
                                    NULL, context->timeoutMsec, NULL, 1, ap);
    va_end(ap);

    if (err != AT_NOERROR)
        MBMLOGE("%s --- %s", command, at_str_err(-err));

    EXIT;
    return -err;
}
コード例 #15
0
int at_send_command_singleline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    NULL, 5000, pp_outResponse);

    if (err == 0 && pp_outResponse != NULL
        && (*pp_outResponse)->success > 0
        && (*pp_outResponse)->p_intermediates == NULL
    ) {
        /* successful command must have an intermediate response */
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
        return AT_ERROR_INVALID_RESPONSE;
    }

    return err;
}
コード例 #16
0
ファイル: atchannels.c プロジェクト: WayWingsDev/mediatek
/* atci start */
int at_send_command_raw(const char *command, ATResponse **pp_outResponse, RILChannelCtx *p_channel)
{
	int err;
	err = at_send_command_full(command, RAW, NULL, NULL, 0, pp_outResponse, p_channel);
	return err;
}