CustomerAtCmdSend() give ERROR Response

Hi,

  I am working DEV studio 2.2.1. In this i tried the sample code given in the name of at_cmd_service().

For this code CustomerATcommandSubscription() is used to subscribe the AT+Customer command. the used code is below
s16 s16Return = adl_atCmdSubscribe( “AT+CUSTOMER”,
( adl_atCmdHandler_t )ATCmdCustomer_Handler,
ADL_CMD_TYPE_READ | ADL_CMD_TYPE_TEST |
ADL_CMD_TYPE_PARA | 0x11 );
the s16Return value is ‘0’. but the function which is used to read this command give ERROR response see the code below
s8Return = adl_atCmdSendExt( “AT+CUSTOMER?”,
//ADL_PORT_OPEN_AT_VIRTUAL_BASE,
ADL_PORT_UART1,
ADL_NI_LAUNCH,
NULL,
( adl_atRspHandler_t ) ATCmdCustomer_Response_Handler,
“*”,
NULL );
can anyone explain why this error occurs?

I am using SL6087 with XM0110 through I2C communication

Thanks

Hi,

adl_atCmdSendExt (with a NI parameter different from 0) finds out if the command has been subscribed.

So it is better to call the API adl_atCmdSendExt() inside the command handler of adl_atCmdSubscribe() API which is used to subscribe the command.

Thanks.

can anyole explain me exactle where i called adl_atCmdSendExt() function in adl_atCmdSubscribe().
adl_atCmdSubscribe() is defined as follows

s16 s16Return = adl_atCmdSubscribe( “AT+CUSTOMER”,
( adl_atCmdHandler_t )ATCmdCustomer_Handler,
ADL_CMD_TYPE_READ | ADL_CMD_TYPE_TEST |
ADL_CMD_TYPE_PARA | 0x11 );

ATCmdCustomer_Handler is defined as follows

void ATCmdCustomer_Handler ( adl_atCmdPreParser_t *paras )
{
TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, “ATCmdCustomer_Handler: Response handled” ) );
TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, paras->StrData ) );

/*
 * When this handler is called, the customer command (here 'AT+CUSTOMER?' was sent by the
 * Open AT® application).
 * The specific customer command treatment could be inserted or called in this handler
 * Because the subscription was made only on the READ syntax, this handler is called
 * only if the command is 'AT+CUSTOMER?". It 'AT+CUSTOMER=?' command is sent by the application,
 * the response will be ERROR and this handler is not called.
 */

/*
 * Command treatment:
 * Because the subscription was only made on the READ type command, a +CUSTOMER response is returned
 */
if ( ADL_CMD_TYPE_READ == paras->Type )
{
    adl_atSendResponsePort( ADL_AT_INT,
                            paras->Port,
                            "\r\nCUSTOMER RESPONSE\r\n" );
    adl_atSendStdResponseSpe ( ADL_AT_PORT_TYPE ( paras->Port, ADL_AT_RSP ),
                               ADL_STR_OK,
                               paras->NI );
}

}

Hi,

According to the description,adl_atCmdSubscribe() API subscribes for “AT+CUSTOM” command ,as command type as READ,PARA or TEST(ADL_CMD_TYPE_READ | ADL_CMD_TYPE_TEST |ADL_CMD_TYPE_PARA ).So when the callback command handler will be called and params->type will check if it is of type READ,PARA or ACT…

So,in the description which you have mentioned that
"Because the subscription was made only on the READ syntax, this handler is called

  • only if the command is 'AT+CUSTOMER?". It ‘AT+CUSTOMER=?’ command is sent by the application,
  • the response will be ERROR and this handler is not called."

But according to the subscription ,callback will be called for AT+CUSTOM?(read),AT+CUSTOM=?(test),AT+CUSTOM=X,Y(para)

Can you pelase explain more…

What is the exact usecase.

Thanks

s16 CustomerATcommandSubscription ( void )
{
    /* Subscribe to the 'AT+CUSTOMER' command. */
    s16 s16Return = adl_atCmdSubscribe( "AT+CUSTOMER",
                                        ( adl_atCmdHandler_t )ATCmdCustomer_Handler,
                                        ADL_CMD_TYPE_READ | ADL_CMD_TYPE_TEST |
                                        ADL_CMD_TYPE_PARA | 0x11 );
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Customer command subscription %d", s16Return ) );
    if ( 0 > s16Return )
    {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Customer command subscription failed !") );
    }
    return s16Return;
}

the function ATCmdCustomer_Handler is defined as

void ATCmdCustomer_Handler ( adl_atCmdPreParser_t *paras )
{
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdCustomer_Handler: Response handled" ) );
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, paras->StrData ) );

    /*
     * When this handler is called, the customer command (here 'AT+CUSTOMER?' was sent by the
     * Open AT® application).
     * The specific customer command treatment could be inserted or called in this handler
     * Because the subscription was made only on the READ syntax, this handler is called
     * only if the command is 'AT+CUSTOMER?". It 'AT+CUSTOMER=?' command is sent by the application,
     * the response will be ERROR and this handler is not called.
     */

    /*
     * Command treatment:
     * Because the subscription was only made on the READ type command, a +CUSTOMER response is returned
     */
    if ( ADL_CMD_TYPE_READ == paras->Type )
    {
        adl_atSendResponsePort( ADL_AT_INT,
                                paras->Port,
                                "\r\nCUSTOMER RESPONSE\r\n" );
        adl_atSendStdResponseSpe ( ADL_AT_PORT_TYPE ( paras->Port, ADL_AT_RSP ),
                                   ADL_STR_OK,
                                   paras->NI );
    }

}

The function CustomerATcommandSend () defined as

void CustomerATcommandSend ( void )
{
    s8 s8Return = 0;
    /*
     * We send the 'AT+CUSTOMER?' and subscribe to its responses with the adl_atCmdSendExt API.
     * Because this command is subscribed by the Open AT® command and is not supported by the Sierra
     * Wireless stack, the adl_atCmdSendExt API has to be used and the 3rd parameter (NI)
     * has to be set to ADL_NI_LAUNCH.
     * Others value for this parameter will request to treat this command by the stack, and an ERROR will
     * be returned by the Sierra Wireless stack because this command is not supported.
     * This is the method in order to create a specific AT command in an Open AT® application
     * and to call it by the application itself.
     * Moreover, the application can specify on which port the command has to be sent (in this
     * case, the command will be sent on the internal port between ADL and the Sierra Wireless stack.
     */
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+CUSTOMER?' using the adl_atCmdSendExt API") );
    s8Return = adl_atCmdSendExt( "AT+CUSTOMER?",
                                 //ADL_PORT_OPEN_AT_VIRTUAL_BASE,
                                 ADL_PORT_UART1,
                                 ADL_NI_LAUNCH,
                                 NULL,
                                 ( adl_atRspHandler_t ) ATCmdCustomer_Response_Handler,
                                 "*",
                                 NULL );

    if ( 0 > s8Return )
    {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "CustomerATcommandSend: error in adl_atCmdSendExt: %d", s8Return ) );
    }
}

The function ATCmdCustomer_Response_Handler() is defined as

s16 ATCmdCustomer_Response_Handler ( adl_atResponse_t *paras )
{
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdCustomer_Response_Handler: Response handled" ) );
    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, paras->StrData ) );
    return FALSE;
}

while calling CustomerATcommandSend ()function it receives ERROR response only
can you explain
the code which i have used given in the samples at_cmd_service

Thanks