Subscribing to first response only from atCmdCreate()


Hello all

I am using atCmdCreate() to send at+csq and collect the response in CSQ_handler (see code). I then send out the signal quality information by text message. The code works fine… my problem is that the response to at+csq comes as two strings: +CSQ: 21,99 followed by OK. As you can see I have atCmdCreate() subscribed to all responses ("*", NULL) so CSQ_handler is called twice, once for each string. I do not want to subscribe to “OK” response, only the “+CSQ: 21,99” response. However “+CSQ: 21,99” is always changing so I cannot specifically subscribe to it alone.

Is there any way to subscribe only to the FIRST response sent by the at command, and one which is unknown?
Or does anyone know of an adl API I can use to retrieve the info provided by +csq?

Thanks in advance

//Handles response to at+csq
bool CSQ_handler(adl_atResponse_t *paras)
	smstext = ( ascii * ) paras->StrData;

	//Send Text with response of at+csq
   adl_smsSend(smshandle, telno, smstext, ADL_SMS_MODE_TEXT);

	adl_atSendResponsePort(ADL_AT_RSP, ADL_PORT_UART1, "After smsSend function\r\n");

	return FALSE;

//Send text to network
bool wind_4_handler(adl_atUnsolicited_t *paras)
	adl_atSendResponse(ADL_AT_UNS,"Indside wind 4 handler\r\n");

   adl_atCmdCreate("at+csq", ADL_AT_PORT_TYPE(ADL_PORT_UART1, TRUE), CSQ_handler, "*", NULL);

	return FALSE;

//Main Function
void main_task(adl_InitType_e InitType)
	adl_atSendResponse(ADL_AT_UNS,"Program started\r\n");

   smshandle = adl_smsSubscribe((adl_smsHdlr_f)SmsHandler,(adl_smsCtrlHdlr_f)SmsCtrlHandler,ADL_SMS_MODE_TEXT);
   adl_atUnSoSubscribe("+WIND: 4",wind_4_handler); //Wait for unsolicited response from firmware


I use the following in most AT command response handlers to filter out the OK when not required:

static bool gsmATCSQ (adl_atUnsolicited_t * AT_Response)
    // Get the string ID
    adl_strID_e str_id = adl_strGetID(AT_Response->StrData);

    // If the string ID is not OK, then process it.
    if (str_id != ADL_STR_OK)
         // This is not an OK string, process as required.

    return OK;


Makes sense. Thanks tomridl