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