# CustomerAtCmdSend() give ERROR Response

**URL:** <https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323>\
**Category:** Open AT\
**Created:** [May 20, 2013, 12:02pm UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323 "2013-05-20T12:02:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [May 20, 2013, 12:02pm UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/1 "2013-05-20T12:02:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rex\_alex](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@Rex\_alex](https://forum.sierrawireless.com/u/Rex_alex)\
**Post date:** [May 22, 2013, 6:48am UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/2 "2013-05-22T06:48:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [May 27, 2013, 8:23am UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/3 "2013-05-27T08:23:13Z")

</div>

> [@Rex\_alex](#):
>
> 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.

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 );
}

```

}

---

<div class="post-metadata">

**Author:** ![Rex\_alex](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@Rex\_alex](https://forum.sierrawireless.com/u/Rex_alex)\
**Post date:** [May 28, 2013, 11:37am UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/4 "2013-05-28T11:37:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [May 28, 2013, 12:39pm UTC](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/5 "2013-05-28T12:39:30Z")

</div>

> [@Rex\_alex](#):
>
> "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."

```auto
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

```auto
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

```auto
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

```auto
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
