Passing a Context to adl_atCmdSendExt


#1

Hello,
I try to call the function adl_atCmdSendExt with a Context. I need to pass an argument to the callback and I think that the context should be the right way to do that. It seems that the Context is something different than what I thought, because it’s always reinitializated to a value I don’t understand.
The documentation is not very clear, in this case, and I don’t find anything related in the forum. Am I missing something?

The following snippet prints a lcontext different than the value I passed as a Context.
(BTW, ATI3 gives the following line: R71a01gg.Q2686H 2076692 052808 20:08 )

s16 atResp ( adl_atResponse_t *param )
{
    if( param->Contxt != NULL )
    {
        TRACE((1, "VALID CONTEXT"));
        u32 lContext= (u32)param->Contxt;
        TRACE((1, "lcontext: %d", lContext));
    }
    else
        TRACE((1, "NULL CONTEXT "));            
    return FALSE;    
}

void adl_main ( adl_InitType_e  InitType )
{
    u32 iContext=12345;
    adl_atCmdSendExt("ati3", ADL_PORT_NONE, 0,(void*)iContext, (adl_atRspHandler_t)atResp, "R", NULL);
}

I wonder if there’s a clean way to pass an argument to the atResp callback. I don’t think that using globals is a good solution.
Is there someone that could help me?

Thank you very much in advance.


#2

I’m having a similar problem.

I’m calling:

adl_atCmdSendExt(“AT+WMSN”, ADL_PORT_OPEN_AT_VIRTUAL_BASE, 0, ctx, at_get_cpu_serial_handler, “*”, NULL)

where ctx is a pointer to a structure of the right size previously allocated with adl_memGet. However, the Contxt field of the adl_atResponse_t is always initialized to the same value (and it’s not the address pointer by ctx!).

I’m going to check on a new firmware to see if there’s any difference… did you find any solution?