Questions about Programming the GSM Module

Hallo,

I am using the Wavecom Software OPEN AT SDK 3.16a with the included Eclipse 3.2 IDE.
The program I am currently writing is to be used on a “New Q24 Series” modem.
So far, I have read several documentations such as the ADL_User_Guide but I cant find the information or simply dont understand I am looking for.

Basically the code should be quite simple:
I want to read the Ring Pin (by connecting RI with GPI) in a loop. As soon as the Ring Indicator and therefor GPI switches to a High State,
the programm leaves the loop and has to read another input, lets say GPIO0 (as an input) for example. When a "1" is detected (this pin will be connected to a button later on), the function to answer the call is executed. Thats about it. Actually the modem should read the GPIO0 another time to wait for a second press of the button to hang up the call but thats only the same function again.
But I have some problems with that:

  1. In my library/header-files (wm_io.h in ADL/basic and adl_gpio.h in ADL/itf) i can`t find the correct definitions for my GPIO ports; there are definitions for Wismo Quik/Pak Q24x0, Q24x3, Q23x3, Q24x6, P32x3, P31x3, P32x6, Q31x6, P5186, Q25X1, Q24CLASSIC/PLUS/AUTO/EXTENDED.
    Which definitions are the right ones for me ? Which library files (basic or itf) should i use anyway ?

  2. I don`t fully understand the “adl_ioRead”-function. What is a “handle” and how can I access/use it ?

  3. Do I have to execute the adl_ioSubscribe function first ? What are the correct parameters and what kind of data does it return ?

I think the coding in C is not the problem, I have been doing that for some time now, but I`m a complete beginner when it comes to modems or anything other than windows applications. I am thankful for any kind of help, answers in German are also appreciated :slight_smile:

Regards,
Nikolas

Hi Nikolas,

→ Why you don’t subscribe call handle? If you do that, you can trigger the Ring event, and after that you can subscribe the GPIO0 for input button.

→ Which WCPU you are using? (Q24 new series include Q24CLASSIC/PLUS/AUTO/EXTENDED) So you can use the library suitable with the WCPU one.

→ adl_ioRead ADL using for reading value of GPIO (config as input) or GPI that you have subscribe before.
→ “handle” is the return value when you subscribe gpio

→ Yes, You must to execute the adl_ioSubscribe function first. It will return the “handle” or error whenever the subscribe successful or not.
Hope can help you.
ttt

Hi trthaithong,
thank you very much for your help.

I have written the code with the understanding i have so far, but Im not sure about some parts. Especially "handles" still pose some problems to me. Ill post the programm here, maybe you can tell me if and where it needs changes.
I think the operational sequence should be o.k. but the functions probably need corrections.

// --- appli.c --- 

// -------------------------------- Definitions ------------------------------------
s32 GPI_status; 
s32 Ring_active;     

void wait_1s();

typedef s8 (* adl_callHdlr_f) ( u16 Event, u32 Call_ID );
typedef void (* adl_ioHdlr_f) ( u8 GpioHandle, u32 GpioState);

main() 

{

// ------------------Endlosschleife, wird immer ausgefuehrt / Loop --------------

while (1) 

    {

// ----------------------- Warten auf Anruf / Wait for Call -------------------------- 

Ring_active=0;   

while(Ring_active==0)  
{
    if(OK==adl_callSubscribe( adl_callHdlr_f (ADL_CALL_EVENT_RING_VOICE, 0) ))   //  ((1)) 
    {
      Ring_active=1;      
    }
    
}

GPI_status=1;


while (GPI_status==1)  // auf ersten Tastendruck warten / wait for 1st Confirmation
    {
        GPI_status=adl_ioRead( adl_ioSubscribe( ADL_IO_Q24CLASSIC_GPI, 1, 0, 0, adl_ioHdlr_f GpioHandler ) );  //  ((2))
    }
    
adl_callAnswer ();   // Anruf annehmen / Answer Call

wait_1s; // entprellen / debouncing  

GPI_status=1;

while (GPI_status==1)  // auf zweiten Tastendruck warten / wait for 2nd Confirmation
    {
        GPI_status=adl_ioRead( adl_ioSubscribe( ADL_IO_Q24CLASSIC_GPI, 1, 0, 0, adl_ioHdlr_f GpioHandler ) );
    }

adl_callHangup();

wait_1s;

}  // Ende Endlosschleife / End of Loop     

}  // Ende Main


void wait_1s()
{;}

My problem lies in the parts marked with ((1)) and ((2))
((1)) The callSubscribe function is set up with the adl_callHdlr_f parameter, is my code correct here ?

((2))
a) According to the definition files the function ioRead needs a u8 type handle as parameter, but the function ioSubscribe returns a s8 value. Can I use it anyway ? Im not even sure whether I can use the code in the way that is shown here. b) I don't understand what i have to insert for the parameter "adl_ioHdlr_f GpioHandler"... any hints ? I dont understand the explaination in the user guide here.
c) Do I have to use “io_unsubscribe” between 2 read actions ?
d) What about the Parameter “Polling” 0/1 - does it have to be enabled or is one single query enough ?

I asked my distributor to send me some sample files, in which gpio values are read and processed, but i haven`t received them yet. Has anybody here written similar code which he or she could show/send me ?

Nikolas