# KeyPad - J101

**URL:** <https://forum.sierrawireless.com/t/keypad-j101/229>\
**Category:** Open AT\
**Created:** [January 18, 2006, 5:22pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229 "2006-01-18T17:22:34Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 18, 2006, 5:22pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/1 "2006-01-18T17:22:34Z")

</div>

Hi, howÂ´s everyone!?

Does anybody has ever worked with 2501Q and itÂ´s KeyPad function!?

The User Manual doesnÂ´t make clear the use of it. IÂ´ve been testing some GPIO pins and they worked fine.

But IÂ´m still curious about the KeyPad.

Any start up is really appreciated!

Thanks!

Henrique

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 18, 2006, 7:40pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/2 "2006-01-18T19:40:28Z")

</div>

I followed the Keyboard sample from the Wavecom and IÂ´m trying to detach the code from that structure…

The code is (keyboard.c ; keyb.h is the same keyboard.h):

```auto
/* -------- */
/* Includes */
/* -------- */

#include "adl_global.h"
#include "keyb.h"
#include "multi_app.h"

/* --------- */
/* Constants */
/* --------- */

// Keys constants
enum
{
    DK_KEY_DTMF_1,
    DK_KEY_DTMF_2,
    DK_KEY_DTMF_3,
    DK_KEY_DTMF_4,
    DK_KEY_DTMF_5,
    DK_KEY_DTMF_6,
    DK_KEY_DTMF_7,
    DK_KEY_DTMF_8,
    DK_KEY_DTMF_9,
    DK_KEY_DTMF_STAR,
    DK_KEY_DTMF_0,
    DK_KEY_DTMF_HASH,
    DK_KEY_DTMF_A,
    DK_KEY_DTMF_B,
    DK_KEY_DTMF_C,
    DK_KEY_DTMF_D,
    DK_KEY_DTMF_LAST,
    DK_KEY_LEVEL_UP = 20,
    DK_KEY_LEVEL_DOWN
};

/* --------- */
/* Variables */
/* --------- */

/* Keyboard Handler */
key_Handler_f key_Handler;

/* First Subscription flag */
bool bOnce = TRUE;

/* Timer for key repetition */
adl_tmr_t * tRepeat;

/* Constants */
#define KEY_NONE 0xFF

/* Timer delays */
u32 key_RepeatTickTime; // Timer before each repeat
u32 key_RepeatTickDelay; // Delay before repeat

/* Prototypes */
bool key_UnsoHandler ( adl_atUnsolicited_t * Param );
void key_TimerHandler ( u8 Id );
void key_init ( void );

/* Keyboard Timer Handler */
void key_TimerHandler ( u8 Id )
{
    /* ReStart the Key timer, faster */
    tRepeat = adl_tmrSubscribe ( FALSE, key_RepeatTickTime, ADL_TMR_TYPE_TICK, key_TimerHandler );
    
    /* Call Unsolicited handler */
    key_UnsoHandler ( ( adl_atUnsolicited_t * ) NULL );
}

/ *************************************************************************** /
/* Function : dk_KeyboardHandler */
/*-------------------------------------------------------------------------*/
/* Object : Keyboard Handler */
/* */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/* Key | X | | | Key index */
/*--------------------+---+---+---+----------------------------------------*/
/* Pressed | X | | | Key pressed or released */
/*--------------------+---+---+---+----------------------------------------*/
/ *************************************************************************** /
void dk_KeyboardHandler ( u8 Key, u8 Pressed )
{
	ascii Tecla [20];

    // Check for DTMF key
    if ( Key < DK_KEY_DTMF_LAST )
    {
        s32 sReturn;
        
        if ( Pressed )
        {
            // DTMF play
			sprintf(Tecla, "\r\n Tecla: %d\r\n", Key);

			adl_atSendResponse(ADL_AT_UNS, Tecla);
        }
        else
        {
            // DTMF stop

			adl_atSendResponse(ADL_AT_UNS, "\r\n PRESSED Key < DK_KEY_DTMF LAST STOP\r\n");
        }
    }
    else if ( Key == DK_KEY_LEVEL_UP )
    {
        // Sound level up
        if ( Pressed )
        {
            // Check if max is not reached yet
            if ( dk_SndLevel < DK_SND_LEVEL_MAX )
            {

                TRACE (( dk_TraceLevel, "New sound level : %d", dk_SndLevel ));
            }
            else
            {
                TRACE (( dk_TraceLevel, "Max sound level : %d", dk_SndLevel ));
            }
            
            // Play a little sound

			adl_atSendResponse(ADL_AT_UNS, "\r\n PRESSIONADA \r\n");
        }
    }
    else if ( Key == DK_KEY_LEVEL_DOWN )
    {
        // Sound level down
        if ( Pressed )
        {
            // Check if max is not reached yet
            if ( dk_SndLevel > DK_SND_LEVEL_MIN )
            {

                TRACE (( dk_TraceLevel, "New sound level : %d", dk_SndLevel ));
            }
            else
            {
                TRACE (( dk_TraceLevel, "Min sound level : %d", dk_SndLevel ));
            }
            
            // Play a little sound

        }
    }
}

void key_init ( void )
{
	key_Subscribe ( dk_KeyboardHandler, 0, 0 );
}

/* Keyboard unsolicited handler */
bool key_UnsoHandler ( adl_atUnsolicited_t * Param )
{
    u8 iKey = KEY_NONE,
            iPressed = 1;
    ascii lBuffer[3];
    
    /* Last pressed key */
    static u8 iPressedKey = KEY_NONE;
        
    /* Get Key code */
    if ( Param )
    {
        iKey = wm_atoi ( wm_strGetParameterString ( lBuffer, Param->StrData, 1 ) );
        iPressed = wm_atoi ( wm_strGetParameterString ( lBuffer, Param->StrData, 2 ) );
    }
    
    if ( iPressed )
    {
        /* Key Pressed */
        if ( iKey != KEY_NONE )
        {
            /* Save the pressed key */
            iPressedKey = iKey;
        
            /* Start the Key timer on the first time */
            if ( key_RepeatTickDelay )
            {
                tRepeat = adl_tmrSubscribe ( FALSE, key_RepeatTickDelay, ADL_TMR_TYPE_TICK, key_TimerHandler );
            }
        }
        
        TRACE (( key_TraceLevel, "Key pressed %d", iPressedKey ));
        
        /* Call Key handler */
        if ( key_Handler )
        {
            key_Handler ( iPressedKey, iPressed );
        }
    }
    else
    {
        /* Stop the Key timer */
        adl_tmrUnSubscribe ( tRepeat, key_TimerHandler, ADL_TMR_TYPE_TICK );
        tRepeat = NULL;
        
        TRACE (( key_TraceLevel, "Key released %d", iPressedKey ));
        
        /* Call Key handler */
        if ( key_Handler )
        {
            key_Handler ( iPressedKey, iPressed );
        }
        
        /* Reset the saved key */
        iPressedKey = KEY_NONE;
    }
    
    /* Do not display keyboard events */
    return FALSE;
}

/* Keyboard handler subscription */
void key_Subscribe ( key_Handler_f KeyHandler, u32 RepeatTickTime, u32 RepeatTickDelay )
{
    TRACE (( key_TraceLevel, "Keyboard Handler Subscription (%d,%d)", RepeatTickTime, RepeatTickDelay ));
    
    /* Set Keyboard Handler */
    key_Handler = KeyHandler;
    
    /* Set Repeat Timers parameters */
    key_RepeatTickTime = RepeatTickTime ? RepeatTickTime : 1;
    key_RepeatTickDelay = RepeatTickDelay;
    
    if ( bOnce )
    {
        /* Only first time */
        bOnce = FALSE;
        
        /* Send command to get keyboard events */
        adl_atCmdCreate ( "at+cmer=,1", FALSE, ( adl_atRspHandler_t ) NULL, NULL );
        
        /* Subscribe to Keyboard events */
        adl_atUnSoSubscribe ( "+CKEV: ", key_UnsoHandler );
    }
}

/* Keyboard handler Unsubscription */
void key_Unsubscribe ( key_Handler_f KeyHandler )
{
    TRACE (( key_TraceLevel, "Keyboard Handler Unsubscription" ));
    
    if ( KeyHandler == key_Handler )
    {
        /* Unsubscribe from keyboard handler */
        adl_atCmdCreate ( "at+cmer=,0", FALSE, ( adl_atRspHandler_t ) NULL, NULL );
        adl_atUnSoUnSubscribe ( "+CKEV: ", key_UnsoHandler );
        key_Handler = NULL;
        
        /* Unsubscribe from all timers */
        if ( tRepeat )
        {
            adl_tmrUnSubscribe ( tRepeat, key_TimerHandler, ADL_TMR_TYPE_TICK );
            tRepeat = NULL;
        }
        
        bOnce = TRUE;
    }
}
```

ThatÂ´s the piece of code IÂ´m trying then to use on a previous application. But… when I try to call key\_init() it doesnÂ´t compile and it doesnÂ´t show any error messages either.

Any ideas?

Thanks

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 18, 2006, 8:28pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/3 "2006-01-18T20:28:21Z")

</div>

Just a wild guess - but I think you should define key\_Subscribe before you actually use it (or put least the prototype of the function at the beginning of the file).

Hope this helps…

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 19, 2006, 12:27pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/4 "2006-01-19T12:27:24Z")

</div>

Nah… it didnÂ´t work… I know…itÂ´s hard to tell…

As this code has some mistake VisualC accuses error on some good code and I can never know where the real error is.

Best regards,

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 19, 2006, 12:48pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/5 "2006-01-19T12:48:09Z")

</div>

Did you find the real error?

If not, could you post the error message? Maybe it can give some clue although it might complain about good code…

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 19, 2006, 1:06pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/6 "2006-01-19T13:06:45Z")

</div>

HereÂ´s the Log:

```auto
--------------------Configuration: MultiApp - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_MultiApp.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_MultiApp.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_MultiApp_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_MultiApp.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: IPConnect - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_IPConnect.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_IPConnect.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_IPConnect_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_IPConnect.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: Socket - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
Get ../../src/Socket.c Socket.c
 Use YTPP
... Compiling Socket.c
 
Socket.c: In function `tcp_pfResponseCbk':
Socket.c:156: warning: passing arg 3 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:156: warning: passing arg 4 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:156: warning: passing arg 5 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c: In function `tcp_ConnectHandler':
Socket.c:360: warning: passing arg 3 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:360: warning: passing arg 4 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:360: warning: passing arg 5 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c: At top level:
Socket.c:455: warning: type mismatch with previous implicit declaration
Socket.c:107: warning: previous implicit declaration of `Socket_start'
Socket.c:455: warning: `Socket_start' was previously implicitly declared to return `int'
Socket.c: In function `Socket_start':
Socket.c:465: warning: passing arg 1 of `ip_Subscribe' from incompatible pointer type
Socket.c: At top level:
Socket.c:514: warning: type mismatch with previous implicit declaration
Socket.c:266: warning: previous implicit declaration of `Socket_stop'
Socket.c:514: warning: `Socket_stop' was previously implicitly declared to return `int'
Socket.c: In function `Socket_stop':
Socket.c:520: warning: passing arg 2 of `ed_SocketLTCPStop' from incompatible pointer type
Socket.c: In function `Socket_init':
Socket.c:562: warning: assignment discards qualifiers from pointer target type
Socket.c:563: warning: assignment discards qualifiers from pointer target type
Socket.c:564: warning: assignment from incompatible pointer type
 
---------------------------------------
 
    Copy all needed library and object files
 
 Make links ../../../Libraries/MultiApp/gcc/out/gcc_MultiApp.lib ../out/gcc_MultiApp.lib
 Make links ../../../Libraries/IPConnect/gcc/out/gcc_IPConnect.lib ../out/gcc_IPConnect.lib
 Make links C:/OpenAT/OtherLibs/TCPIP/v3.02/gcc_eDLib_302.lib ../out/gcc_eDLib_302.lib
 Make links /cygdrive/C/OpenAT/V302/TgtGen/Adl/Library/gcc_wmadl_302.b03.lib ../out/gcc_wmadl_302.b03.lib
---------------------------------------
 
... Link step in progress ...
 
 
... Link gcc_Socket_32.bin ...
 
/cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-nm: gcc_Socket_32.elf: No such file or directory
make: *** [make_single_bin] Error 1
 
    Build an X-MODEM binary : 'gcc_Socket_32.wpb.dwl'
 
 
... Convert gcc_Socket_32.wpb in X-MODEM format ...
 
genBin : Version v1a06 Copyright (c) WAVECOM
genBin : No Error
 
... Build gcc_Socket_32.wpb.dwl ...
 
---------------------------------------
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
 
WARNING : misc_status.log is incomplete. Check manually if any errors exist
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_eDLib_302.lib, gcc_IPConnect.lib, gcc_MultiApp.lib, gcc_wmadl_302.b03.lib, 
---------------------------------------
---------------------------------------
    End process.
 

Socket - 1 error(s), 18 warning(s)
```

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 19, 2006, 1:19pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/7 "2006-01-19T13:19:26Z")

</div>

Hi Henrique,

in this log, I would try to fix the warnings about implicit declarations first…

So, try to put the prototypes for

… Socket\_start(…);  
… Socket\_stop(…);

into the header file…

Hope it works then…

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 19, 2006, 5:46pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/8 "2006-01-19T17:46:44Z")

</div>

Unfortunatelly… nothing…  
As IÂ´m working ON the Socket Sample… the multi\_app is still bothering me… I guess itÂ´s making all the implicit declaration mess…

I declared all the prototypes into the header but IÂ´m still getting the errors.

I put three codes in here : keyboard.c, socket.c and the log

If you think itÂ´s to much work on this help… no problem! I understand!

keyboard.c:

```auto
/* -------- */
/* Includes */
/* -------- */

#include "adl_global.h"
#include "keyb.h"
#include "multi_app.h"

/* --------- */
/* Constants */
/* --------- */

// Keys constants
enum
{
    DK_KEY_DTMF_1,
    DK_KEY_DTMF_2,
    DK_KEY_DTMF_3,
    DK_KEY_DTMF_4,
    DK_KEY_DTMF_5,
    DK_KEY_DTMF_6,
    DK_KEY_DTMF_7,
    DK_KEY_DTMF_8,
    DK_KEY_DTMF_9,
    DK_KEY_DTMF_STAR,
    DK_KEY_DTMF_0,
    DK_KEY_DTMF_HASH,
    DK_KEY_DTMF_A,
    DK_KEY_DTMF_B,
    DK_KEY_DTMF_C,
    DK_KEY_DTMF_D,
    DK_KEY_DTMF_LAST,
    DK_KEY_LEVEL_UP = 20,
    DK_KEY_LEVEL_DOWN
};

/* --------- */
/* Variables */
/* --------- */
static u8 dk_TraceLevel; // Trace Level defined on entry point
static u8 dk_SndLevel = 7; // Current sound level

/* Keyboard Handler */
key_Handler_f key_Handler;

/* First Subscription flag */
bool bOnce = TRUE;

/* Timer for key repetition */
adl_tmr_t * tRepeat;

/* Constants */
#define KEY_NONE 0xFF

/* Timer delays */
u32 key_RepeatTickTime; // Timer before each repeat
u32 key_RepeatTickDelay; // Delay before repeat

/* Prototypes */
bool key_UnsoHandler ( adl_atUnsolicited_t * Param );
void key_TimerHandler ( u8 Id );
void key_init ( void );
void key_Subscribe ( key_Handler_f KeyHandler, u32 RepeatTickTime, u32 RepeatTickDelay );

/* Keyboard Timer Handler */
void key_TimerHandler ( u8 Id )
{
    /* ReStart the Key timer, faster */
    tRepeat = adl_tmrSubscribe ( FALSE, key_RepeatTickTime, ADL_TMR_TYPE_TICK, key_TimerHandler );
    
    /* Call Unsolicited handler */
    key_UnsoHandler ( ( adl_atUnsolicited_t * ) NULL );
}

/ *************************************************************************** /
/* Function : dk_KeyboardHandler */
/*-------------------------------------------------------------------------*/
/* Object : Keyboard Handler */
/* */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/* Key | X | | | Key index */
/*--------------------+---+---+---+----------------------------------------*/
/* Pressed | X | | | Key pressed or released */
/*--------------------+---+---+---+----------------------------------------*/
/ *************************************************************************** /
void dk_KeyboardHandler ( u8 Key, u8 Pressed )
{
	ascii Tecla [20];

    // Check for DTMF key
    if ( Key < DK_KEY_DTMF_LAST )
    {
        s32 sReturn;
        
        if ( Pressed )
        {
            // DTMF play
			sprintf(Tecla, "\r\n Tecla: %d\r\n", Key);

			adl_atSendResponse(ADL_AT_UNS, Tecla);
        }
        else
        {
            // DTMF stop

			adl_atSendResponse(ADL_AT_UNS, "\r\n PRESSIONADA Key < DK_KEY_DTMF LAST STOP\r\n");
        }
    }
    else if ( Key == DK_KEY_LEVEL_UP )
    {
        // Sound level up
        if ( Pressed )
        {
            // Check if max is not reached yet
            if ( dk_SndLevel < DK_SND_LEVEL_MAX )
            {

                TRACE (( dk_TraceLevel, "New sound level : %d", dk_SndLevel ));
            }
            else
            {
                TRACE (( dk_TraceLevel, "Max sound level : %d", dk_SndLevel ));
            }
            
            // Play a little sound

			adl_atSendResponse(ADL_AT_UNS, "\r\n PRESSIONADA \r\n");
        }
    }
    else if ( Key == DK_KEY_LEVEL_DOWN )
    {
        // Sound level down
        if ( Pressed )
        {
            // Check if max is not reached yet
            if ( dk_SndLevel > DK_SND_LEVEL_MIN )
            {

                TRACE (( dk_TraceLevel, "New sound level : %d", dk_SndLevel ));
            }
            else
            {
                TRACE (( dk_TraceLevel, "Min sound level : %d", dk_SndLevel ));
            }
            
            // Play a little sound

        }
    }
}

void key_init ( void )
{
	key_Subscribe ( dk_KeyboardHandler, 0, 0 );
}

/* Keyboard unsolicited handler */
bool key_UnsoHandler ( adl_atUnsolicited_t * Param )
{
    u8 iKey = KEY_NONE,
            iPressed = 1;
    ascii lBuffer[3];
    
    /* Last pressed key */
    static u8 iPressedKey = KEY_NONE;
        
    /* Get Key code */
    if ( Param )
    {
        iKey = wm_atoi ( wm_strGetParameterString ( lBuffer, Param->StrData, 1 ) );
        iPressed = wm_atoi ( wm_strGetParameterString ( lBuffer, Param->StrData, 2 ) );
    }
    
    if ( iPressed )
    {
        /* Key Pressed */
        if ( iKey != KEY_NONE )
        {
            /* Save the pressed key */
            iPressedKey = iKey;
        
            /* Start the Key timer on the first time */
            if ( key_RepeatTickDelay )
            {
                tRepeat = adl_tmrSubscribe ( FALSE, key_RepeatTickDelay, ADL_TMR_TYPE_TICK, key_TimerHandler );
            }
        }
        
        TRACE (( key_TraceLevel, "Key pressed %d", iPressedKey ));
        
        /* Call Key handler */
        if ( key_Handler )
        {
            key_Handler ( iPressedKey, iPressed );
        }
    }
    else
    {
        /* Stop the Key timer */
        adl_tmrUnSubscribe ( tRepeat, key_TimerHandler, ADL_TMR_TYPE_TICK );
        tRepeat = NULL;
        
        TRACE (( key_TraceLevel, "Key released %d", iPressedKey ));
        
        /* Call Key handler */
        if ( key_Handler )
        {
            key_Handler ( iPressedKey, iPressed );
        }
        
        /* Reset the saved key */
        iPressedKey = KEY_NONE;
    }
    
    /* Do not display keyboard events */
    return FALSE;
}

/* Keyboard handler subscription */
void key_Subscribe ( key_Handler_f KeyHandler, u32 RepeatTickTime, u32 RepeatTickDelay )
{
    TRACE (( key_TraceLevel, "Keyboard Handler Subscription (%d,%d)", RepeatTickTime, RepeatTickDelay ));
    
    /* Set Keyboard Handler */
    key_Handler = KeyHandler;
    
    /* Set Repeat Timers parameters */
    key_RepeatTickTime = RepeatTickTime ? RepeatTickTime : 1;
    key_RepeatTickDelay = RepeatTickDelay;
    
    if ( bOnce )
    {
        /* Only first time */
        bOnce = FALSE;
        
        /* Send command to get keyboard events */
        adl_atCmdCreate ( "at+cmer=,1", FALSE, ( adl_atRspHandler_t ) NULL, NULL );
        
        /* Subscribe to Keyboard events */
        adl_atUnSoSubscribe ( "+CKEV: ", key_UnsoHandler );
    }
}

/* Keyboard handler Unsubscription */
void key_Unsubscribe ( key_Handler_f KeyHandler )
{
    TRACE (( key_TraceLevel, "Keyboard Handler Unsubscription" ));
    
    if ( KeyHandler == key_Handler )
    {
        /* Unsubscribe from keyboard handler */
        adl_atCmdCreate ( "at+cmer=,0", FALSE, ( adl_atRspHandler_t ) NULL, NULL );
        adl_atUnSoUnSubscribe ( "+CKEV: ", key_UnsoHandler );
        key_Handler = NULL;
        
        /* Unsubscribe from all timers */
        if ( tRepeat )
        {
            adl_tmrUnSubscribe ( tRepeat, key_TimerHandler, ADL_TMR_TYPE_TICK );
            tRepeat = NULL;
        }
        
        bOnce = TRUE;
    }
}
```

socket.c:

```auto
/ *************************************************************************** /
/* File : Socket.c */
/*-------------------------------------------------------------------------*/
/* Object : Customer application */
/* */
/* contents : Customer main procedures */
/* */
/* Change : */
/ *************************************************************************** /

/* -------- */
/* Includes */
/* -------- */

#include "adl_global.h"
#include "multi_app.h"
#include "ipconnect.h"
#include "ed_socket.h"
#include "ed_dialup.h"
#include "adl_TimerHandler.h"
#include "adl_call.h"
#include "adl_fcm.h"
//#include "keyboard.h"
//#include "adl_gpio.h"

/* ---------- */
/* Constantes */
/* ---------- */

// Application name
static const ascii * Socket_NameBuffer = "Seletron Rastreamento";

/* VariÃ¡veis Globais */
//static u8 socket_TraceLevel;
static int i=1;

/* VariÃ¡veis reservadas Ã GPS */
static s8 gps_GpsHandle; // GPS service handle
static bool gps_GpsAutoStart; // GPS autostart parameter (to allow or not hardware reset)
static u8 gps_PollingTimer; 
static bool Atualiza_GPS = FALSE;

static u8 Time_Get_Request; 

static bool liberado = FALSE;
static bool socket_liberado = TRUE;

/* VariÃ¡veis - Controle de IOs */
s8 HANDLE_GPIO;
static bool PINO = FALSE;

/* VariÃ¡veis Globais reservadas Ã coordenadas Geograficas */
ascii Latitude[20];
ascii LatInd[20];
ascii Longitude[20];
ascii LonInd[20];

/* SMS */
static s8 sms_lcd_clock_Handle_txt;
bool SMS_CLOCK_Handler(ascii *SmsTel, ascii *SmsTimeOrLength, ascii *SmsText);
void SMS_CLOCK_ctrl_Handler(u8 Event, u16 Nb);

static int j=1;

// Commands strings
static const ascii * SOCKET_CMD_START = "at+SOCKETSTART";

void tcp_pfDataRequest ( u16 MaxLen, u32 id );
u16 tcp_pfDataHnd ( u16 DataLen, u8 * Data, u32 id );
void tcp_pfResponseCbk ( s32 Event, u32 id );

bool gps_GpsHandler ( adl_gpsEvent_e Event, adl_gpsData_t * GPSData );

/* Prototipo - UART2 */
/*
void UART2_Enable ( void );
void fcmCtrlH ( u8 event );
void fcmDataH ( u16 DataLen, u8 * Data );
bool Res_WMFM1_Handler ( void );
bool Res_IPR_Handler ( void );
*/

/ *************************************************************************** /
/* Local functions */
/ *************************************************************************** /
/* Convert an IP address from u32 to ascii * */
ascii * ConvertIP_itoa ( u32 iIP, ascii * aIP )
{
    wm_sprintf ( aIP, "%d.%d.%d.%d",
                      ( iIP >> 24 ) & 0xFF,
                      ( iIP >> 16 ) & 0xFF,
                      ( iIP >> 8 ) & 0xFF,
                        iIP & 0xFF );
    return aIP;
}

void Temporizador(u8 Id)
{

	adl_atSendResponse(ADL_AT_RSP, "\r TEMPORIZADOR ATIVADO \r\n");

	if ((socket_liberado == TRUE)&&(Atualiza_GPS==TRUE))
	{
		socket_liberado = FALSE;
		liberado = TRUE;
		Atualiza_GPS = FALSE;

	    //Envia pedido de abertura de Socket TCP 
		//ed_SocketTCPStart ( ED_ID_TCPSOCKET_1, 0,tcp_pfResponseCbk, tcp_pfDataHnd, tcp_pfDataRequest);

		Socket_start();
	}

	if (PINO==FALSE)
	{
		PINO=TRUE;
		adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, 0x00000000);
	}
	else
	{
		PINO=FALSE;
		adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, ADL_IO_Q25X1_GPO_1);
	}

}

// Interrompe Resposta de Callback
void tcp_Stop_pfResponseCbk ( s32 Event, u32 id )
{	
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCPSTOPRESONSECBK START\r\n");
	switch ( Event )
    {
		case ED_OK_TCP_CLOSED:
			//TRACE (( socket_TraceLevel, "tcp_Stop_pfResponseCbk: Socket close" ));
			adl_atSendResponse(ADL_AT_UNS, "\r\nSocket Close\r\n");
		break;
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCPSTOPRESONSECBK END\r\n");
}

//Chamado quando uma conexÃ£o Socket TCP Ã© aberta ou quando ocorre um erro
void tcp_pfResponseCbk ( s32 Event, u32 id )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_RESPONSECBK START\r\n");
	ascii Buff[50];
	s8 sReturn = ERROR;
	u8 Listen=0;

	wm_sprintf ( Buff, "tcp_pfResponseCbk: %d (id : %d)", Event, id );
     //TRACE (( socket_TraceLevel, Buff )); 
	 switch ( Event )
    {
		case ED_OK_TCP_CLOSED:
			//TRACE (( socket_TraceLevel, "tcp_pfResponseCbk: Socket close" ));
			adl_atSendResponse(ADL_AT_UNS, "\r\nSocket Closed\r\n");
			sReturn = ed_SocketTCPStart ( ED_ID_TCPSOCKET_1, Listen,tcp_pfResponseCbk, tcp_pfDataHnd, tcp_pfDataRequest);
			wm_sprintf ( Buff, "ed_SocketTCPStart: %d", sReturn);
			//TRACE (( socket_TraceLevel, Buff )); 
			i=1;
			break;

		case ED_INFO_LISTEN_SET:
			adl_atSendResponse(ADL_AT_UNS, "\r\nSocket Created\r\n");
			break;

	} 
	 adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_RESPONSECBK END\r\n");
}

//Chamado para informar ao aplicativo que ele pode enviar novos dados
void tcp_pfDataRequest ( u16 MaxLen, u32 id )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_DATAREQUEST START\r\n");
	ascii Buff[50];

	// --> SMS
	ascii Telefone [20];
	ascii Telefone2 [20];
	ascii Mensagem [100];

	wm_sprintf(Telefone, "03191221337");
	wm_sprintf(Telefone2, "03188138486");

	// **********************************

	// Flag para garantir envio Ãºnico de string
    if (liberado==TRUE)
	{
	   ascii request [100]; 
	   u16 len; 

	   adl_atSendResponse(ADL_AT_RSP, "\r Sending GET Request FUNCTION\r\n");

	   wm_memset (request, '\0',100); 

	   //wm_sprintf(request,"GET /gps.asp?latitude=%s HTTP/1.0\r\nHost:sanabiovilela.homeip.net\r\nContent-Type: text/html\r\n\r\n",Latitude); 
	   
	   wm_sprintf(request,"GET /gps.asp?latitude=%s-latind=%s HTTP/1.0\r\nHost:sanabiovilela.savedme.com\r\nContent-Type: text/html\r\n\r\n",Latitude, LatInd); 
	   
	   // Enviando SMS
	   wm_sprintf ( Mensagem + wm_strlen ( Mensagem ), "LOCALIZACAO do Henrique - Latitude: %s - Longitude: %s\x1a", Latitude, Longitude);
	   adl_smsSend ( sms_lcd_clock_Handle_txt, Telefone, Mensagem, ADL_SMS_MODE_TEXT );
	   adl_smsSend ( sms_lcd_clock_Handle_txt, Telefone2, Mensagem, ADL_SMS_MODE_TEXT );

	   adl_atSendResponse(ADL_AT_UNS, request);

	   len = wm_strlen(request); 

	   ed_SendDataExt ( request, len , FALSE, ED_ID_TCPSOCKET_1 ); 
	
	   liberado=FALSE;
	 }

	// **********************************

	wm_sprintf ( Buff, " tcp_pfDataRequest: %d", MaxLen);
    //TRACE (( socket_TraceLevel, Buff )); 

    
 

    adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_DATAREQUEST END\r\n");
}

//Chamado para receber dados/resposta do remoto para o aplicativo
u16 tcp_pfDataHnd ( u16 DataLen, u8 * Data, u32 id )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_DATAHND START\r\n");

	ascii Buff[50];

	ascii BuffDisp[250];

	ascii * TheBuffer;
	s32 sreturn=ERROR;

	wm_sprintf(BuffDisp, "\r\n Display Buffer: %d \r\n", Data);

	adl_atSendResponse(ADL_AT_UNS, BuffDisp);

	 if ( DataLen && Data && i)
    {
		//TRACE (( socket_TraceLevel, "tcp_pfDataHnd: %d", DataLen ));

		wm_sprintf(BuffDisp, "\r\n DataLEN: %d \r\n", DataLen);
		adl_atSendResponse(ADL_AT_UNS, BuffDisp);

        wm_strncpy ( Buff, Data, 10 );
        Buff [10] = 0;
        //TRACE (( socket_TraceLevel, Buff ));

		wm_sprintf(BuffDisp, "\r\n Buffer: %s \r\n", Buff);
		adl_atSendResponse(ADL_AT_UNS, BuffDisp);

		// Verifica se o comando foi entendido pelo servidor, se sim, fechar Socket TCP
		sreturn = wm_strncmp ( Buff, "REGISTRADO", 10 );

		if (sreturn==0)
		{
			//socket_liberado = TRUE;
			Socket_stop();
			adl_atSendResponse(ADL_AT_UNS, "\r\n REGISTRADO OK \r\n");
		}

		

		
	}
	else if ( DataLen==0 && Data==NULL)
	{
		//TRACE (( socket_TraceLevel,"tcp_pfDataHnd: Socket close" ));  

		adl_atSendResponse(ADL_AT_UNS, "\r\n tcp_pfDataHdn: SOCKET CLOSE \r\n");
		
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_DATAHAND END\r\n");
	return DataLen; // Accept all data => eDlib delete them from its queue
	
}

// --> Parte SMS
bool SMS_CLOCK_Handler(ascii *SmsTel, ascii *SmsTimeOrLength, ascii *SmsText)
{
    bool breturn = TRUE;

}

void SMS_CLOCK_ctrl_Handler(u8 Event, u16 Nb)
{
	adl_atSendResponse(ADL_AT_UNS, "\r\n SMS Handler Clock \r\n");
}

s16 CGATT_0_Response_Handler (adl_atResponse_t *paras)
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nCGATT_0_RESPONSE_HANDLER START\r\n");
	
	//TRACE (( socket_TraceLevel, "CGATT_Response_Handler" ));  
	switch ( paras->RspID )
    {
		case ADL_STR_OK:
			//GPRS is attached, we set a timer 
			//TRACE (( socket_TraceLevel, "CGATT_0_Response_Handler: ADL_STR_OK" ));  
			ip_Unsubscribe(); 
			break;
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nCGATT_0_RESPONSE_HANDLER END\r\n");
	return FALSE;
}

// Gerenciador de ConexÃ£o TCP - ConfiguraÃ§Ã£o TCP
void tcp_ConnectHandler ( s32 Event, u32 id )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nTCP_CONNECTHANDLER START\r\n");
	ascii Buff[50];
	s8 sReturn = ERROR;
	u8 Listen=1;
	ed_SocketSetupParams_t Params;
	ed_dialupIPInfos_t Infos;
	ascii locIP[20];
	ascii distIP[20];
	ascii gway[20];

	wm_sprintf ( Buff, " tcp_ConnectHandler: %d", Event);
	//TRACE (( socket_TraceLevel, Buff ));
  
	
	 switch ( Event )
    {
		case ED_OK_GPRS_SESSION_SET: // Setando conexÃ£o GPRS 
			
			// Partes comentadas eram utilizadas como TRACE
			
			Params.TcpPort=80;
			Params.TcpTxDelay=200;
			wm_sprintf ( Params.TcpServ, "201.17.212.120");
			sReturn = ed_SocketSetConfig ( ED_ID_TCPSOCKET_1, &Params );
			//wm_sprintf ( Buff, " ed_SocketSetConfig: %d", sReturn);
			sReturn=ed_SocketGetConfig ( ED_ID_TCPSOCKET_1, &Params );
			//wm_sprintf ( Buff, " ed_SocketGetConfig: %d", sReturn);
			//wm_sprintf ( Buff, " TcpPort: %d", Params.TcpPort);
			//wm_sprintf ( Buff, " TcpServ: %s", Params.TcpServ);
			//wm_sprintf ( Buff, " TcpTxDelay: %d", Params.TcpTxDelay);

			sReturn=ed_DialupGetIpInformations(&Infos);
			
			wm_sprintf ( Buff, "\r\nLocal IP : %s\r\n", ConvertIP_itoa ( Infos.LocalIP, locIP ));
			adl_atSendResponse(ADL_AT_UNS, Buff);
			wm_sprintf ( Buff, "DistantIP: %s\r\n", ConvertIP_itoa ( Infos.DistantIP, distIP ));
			adl_atSendResponse(ADL_AT_UNS, Buff);
			wm_sprintf ( Buff, "Gateway: %s\r\n", ConvertIP_itoa ( Infos.Gateway, gway ));
			adl_atSendResponse(ADL_AT_UNS, Buff);
			
			//Envia pedido de abertura de Socket TCP 
			sReturn=ed_SocketTCPStart ( ED_ID_TCPSOCKET_1, 0,tcp_pfResponseCbk, tcp_pfDataHnd, tcp_pfDataRequest);

			//wm_sprintf ( Buff, "ed_SocketTCPStart: %d", sReturn);

		break;

	case ED_OK_ON_HOOK : // "Log off" da rede GPRS
		adl_atCmdCreate("at+cgatt=0",TRUE, (adl_atRspHandler_t) CGATT_0_Response_Handler,"OK",NULL );
		break;
	}
	 adl_atSendResponse(ADL_AT_UNS, "\r\nCONNECT_HANDLER END\r\n");
}

void Timer_Handler(u8 Id)
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nTIMER_HANDLER START\r\n");
	s8 sReturn = ERROR;
	ascii Buff[50];
	adl_tmr_t *tt;
	u16 timeout_period=20;

	//Tenta uma conexÃ£o IP a cada 2 segundos 
	
	// Estabelece sesao IP com o provedor de servico e recebe um endereco IP
	sReturn =ip_Connect ( IP_BEARER_GPRS, IP_MODE_CONNECT);
	adl_atSendResponse(ADL_AT_UNS, "\r\n Establish IP session with service provider and Receives IP Address \r\n");

	
	//wm_sprintf ( Buff, " ip_Connect: %d", sReturn);
	//TRACE (( socket_TraceLevel, Buff ));
	if(sReturn!=0)
	{
		tt=(adl_tmr_t *)adl_tmrSubscribe(FALSE, timeout_period, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t) Timer_Handler);			
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nTIMER_HANDLER END\r\n");
}

s16 CGATT_Response_Handler (adl_atResponse_t *paras)
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nCGATT_RESPONSE_HANDLER START\r\n");
	adl_tmr_t *tt;
	u16 timeout_period=20;
	
	//TRACE (( socket_TraceLevel, "CGATT_Response_Handler"));
	switch ( paras->RspID )
    {
		case ADL_STR_OK:
			// Logado na Rede GPRS, deve-se setar um periodo de timeout: timeout_period 
			//TRACE (( socket_TraceLevel, "ADL_STR_OK" ));
			tt=(adl_tmr_t *)adl_tmrSubscribe(FALSE, timeout_period, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t) Timer_Handler);
			adl_atSendResponse(ADL_AT_UNS, "\r\nCGATT OK!\r\n");
			break;
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nCGATT_RESPONSE_HANDLER END\r\n");
	return FALSE;
}

//Pin Code CallBack
void SimHandler ( u8 Event )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nSIMHANDLER START\r\n");
	ascii Buff[50];

	wm_sprintf ( Buff, "SimHandler: %d\r\n",Event );
	
	 switch ( Event )
    {
        case ADL_SIM_STATE_FULL_INIT :
			//Pin Code OK
			//Gprs attach
			adl_atCmdCreate("at+cgatt=1",TRUE, (adl_atRspHandler_t) CGATT_Response_Handler,"OK",NULL );
			adl_atSendResponse(ADL_AT_UNS, "\r\nPin Code OK - Sends CGATT=1 command\r\n");
			break;
	}
	adl_atSendResponse(ADL_AT_UNS, "\r\nFIM SIMHANDLER\r\n");
}

/ *************************************************************************** /
/* Function : Socket_start */
/*-------------------------------------------------------------------------*/
/* Object : Start Application Function */
/* */
/*--------------------+---+---+---+----------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/* Port | X | | | Start command port */
/*--------------------+---+---+---+----------------------------------------*/
/ *************************************************************************** /
void Socket_start ( void )//( u8 Port )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nSOCKETSTART START\r\n");
    bool bReturn = TRUE;
	ascii Buff[50];
	ascii * PinCode=NULL;//"8888";//NULL;
	s8 sReturn = ERROR;
	adl_simState_e Sim_State;

	//Subscribe to IPConnect library
	sReturn =ip_Subscribe ( tcp_ConnectHandler );
	//wm_sprintf ( Buff, " ip_Subscribe: %d", sReturn);
	//TRACE (( socket_TraceLevel, Buff ));

	//Enter Pin Code
	Sim_State=adl_simGetState();
	if(Sim_State==ADL_SIM_EVENT_FULL_INIT)
	{
		adl_atSendResponse(ADL_AT_UNS, "\r\nSimState==JA FOI INICIADO\r\n");
		
		///*Comando para habilitar o CHIP --> PIN CODE
		//adl_atCmdCreate("at+cpin=3765",TRUE, (adl_atRspHandler_t) CGATT_0_Response_Handler,"OK+CPIN",NULL );
		//*/
		//adl_atCmdCreate("at+cpin",TRUE, (adl_atRspHandler_t) CGATT_0_Response_Handler,"OK+CPIN",NULL );
		
		adl_atCmdCreate("at+cgatt=1",TRUE, (adl_atRspHandler_t) CGATT_Response_Handler,"OK+CGATT",NULL );
		
		adl_atSendResponse(ADL_AT_UNS, "\r\nPin Code OK - Trying CGATT=1\r\n");
				
	}
		else	
		{
			adl_simSubscribe(SimHandler,PinCode);
			adl_atSendResponse(ADL_AT_UNS, "\r\nRECEBE CODIGO PIN\r\n");
		}

	adl_atSendResponse(ADL_AT_UNS, "\r\nSOCKETSTART END\r\n");

	// Inicio do Timer para Envio das Coordenadas
	//Time_Get_Request = 100; // 100 * 100ms = 10s
	//adl_tmrSubscribe(TRUE, Time_Get_Request, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)Temporizador);

}

/ *************************************************************************** /
/* Function : Socket_stop */
/*-------------------------------------------------------------------------*/
/* Object : Stop Application Function */
/* */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/ *************************************************************************** /
void Socket_stop ( void )
{
	adl_atSendResponse(ADL_AT_UNS, "\r\nSOCKETSTOP START\r\n");
	s8 sReturn = ERROR;
	ascii Buff[50];
    
    // Unsubscribe from Socket service
	sReturn = ed_SocketLTCPStop ( ED_ID_TCPSOCKET_1, tcp_Stop_pfResponseCbk );
	wm_sprintf ( Buff, " ed_SocketLTCPStop: %d", sReturn);
	//TRACE (( socket_TraceLevel, Buff ));
	sReturn =ip_Connect ( IP_BEARER_GPRS, IP_MODE_DISCONNECT);
	wm_sprintf ( Buff, " ip_Connect: %d", sReturn);
	//TRACE (( socket_TraceLevel, Buff ));
	

	adl_atSendResponse(ADL_AT_UNS, "\r\nSOCKETSTOP END\r\n");
	socket_liberado = TRUE;
	adl_atSendResponse(ADL_AT_UNS, "\r\n PRONTO PARA NOVA CONEXAO \r\n");

    
}

/ *************************************************************************** /
/* Function : Socket_init */
/*-------------------------------------------------------------------------*/
/* Object : Application entry point */
/* */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/* InitType | X | | | Application Init state */
/*--------------------+---+---+---+----------------------------------------*/
/* PinCode | X | | | PIN code to use on SIM service subs. */
/*--------------------+---+---+---+----------------------------------------*/
/* ApplicationData | X | X | | Application data struct to fill */
/*--------------------+---+---+---+----------------------------------------*/
/ *************************************************************************** /
void Socket_init( adl_InitType_e InitType, ascii * PinCode, ma_Element_t * ApplicationData )
{

	//ascii Telefone [20];

	//wm_sprintf(Telefone, "03191221337");

    // Fill application data structure
    ApplicationData->AppName = Socket_NameBuffer;
    ApplicationData->AppCmd = SOCKET_CMD_START;
    ApplicationData->AppStart = Socket_start;
    ApplicationData->AppStop = Socket_stop;
	
	/* Configura parametros de conexao */
	//Set_GPRS();

	/* Inicio do Timer para Envio das Coordenadas */
	Time_Get_Request = 70; // 100 * 100ms = 20s
	adl_tmrSubscribe(TRUE, Time_Get_Request, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)Temporizador);

	/* Inicializa GPS e define tempo de acesso ao mesmo --> GPS Callback Handler */
	gps_PollingTimer = 20;
	gps_GpsHandle = adl_gpsSubscribe ( gps_GpsHandler, gps_PollingTimer );

	/* SMS */
	sms_lcd_clock_Handle_txt = adl_smsSubscribe(SMS_CLOCK_Handler, SMS_CLOCK_ctrl_Handler, ADL_SMS_MODE_TEXT);

	

	/* GPIO */
	HANDLE_GPIO = adl_ioSubscribe(ADL_IO_Q25X1_GPO_1, 0,0,0, (adl_ioHdlr_f) NULL);
	//adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, 0x00000000);//ADL_IO_Q25X1_GPO_1);
	adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, ADL_IO_Q25X1_GPO_1);

	/* Keyboard service */
    key_init();

	//adl_callSetup(Telefone,ADL_CALL_MODE_VOICE);
	
}

/*
void UART2_Enable ( void )
{

	adl_atCmdCreate( "AT+WMFM=0,1,2", FALSE, Res_WMFM1_Handler, "*", NULL );

	adl_atCmdCreate( "AT+IPR=19200", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );

	Handle = adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, fcmCtrlH, fcmDataH );

}

void fcmCtrlH ( u8 event )
{
    switch ( Event )
    {
        case ADL_FCM_RET_ERROR_GSM_GPRS_ALREADY_OPENNED :
            TRACE (( 1, "Flow GSM already Opened"));
        break;
	}
}

void fcmDataH ( u16 DataLen, u8 * Data )
{
    u8 result;

    adl_atSendResponse(ADL_AT_UNS, "\r\n<- Receive FCM Data Blocks \r\n");
    DUMP ( 1, Data, DataLen );

}

bool Res_WMFM1_Handler ( void )
{
	return TRUE;
}

bool Res_IPR_Handler ( void )
{
	return TRUE;
}

*/

/ **************************************************************************** /
/* Function : gps_GpsHandler */
/*--------------------------------------------------------------------------*/
/* Object : Gps events handler */
/* */
/* Return : According to GpsAutoStart parameter */
/* */
/*--------------------+---+---+---+-----------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+-----------------------------------------*/
/* Event | X | | | Notified event */
/*--------------------+---+---+---+-----------------------------------------*/
/* GPSData | X | | | Polling GPS Data */
/*--------------------+---+---+---+-----------------------------------------*/
/ **************************************************************************** /
bool gps_GpsHandler ( adl_gpsEvent_e Event, adl_gpsData_t * GPSData )
{
	u8 Tamanho1;
	u8 Tamanho2;
        
    // Switch on event
    switch ( Event )
    {
        case ADL_GPS_EVENT_POLLING_DATA :
        {
            // Received data from GPS
            ascii RspStr [80];
			ascii Correcao [80];
            adl_gpsPosition_t Position;

            // Build string
            wm_sprintf ( RspStr, "\r\n+GPSTIME: %s,%s\r\n", GPSData->Position.UTC_time, GPSData->Position.date );
            adl_atSendResponse ( ADL_AT_UNS, RspStr );

			adl_gpsGetPosition ( gps_GpsHandle, &Position );
            wm_sprintf ( RspStr + wm_strlen ( RspStr ), "%s,%s,%s,%s\r\n",
                                     Position.latitude,
                                     Position.latitude_Indicator,
                                     Position.longitude,
                                     Position.longitude_Indicator );

			adl_atSendResponse ( ADL_AT_UNS, RspStr );

			//wm_sprintf ( Correcao + wm_strlen ( Correcao ), "Correcao: %s,%s,%s,%s\r\n",Position.geoid_Sep,Position.geoid_Sep_Unit,Position.Age_Dif_Cor,Position.Dif_Ref_ID);
			//adl_atSendResponse (ADL_AT_UNS, Correcao);

			Tamanho1 = wm_strlen(Position.latitude);
			Tamanho2 = wm_strlen(Position.longitude);

			if ((Tamanho1>0)&&(Tamanho2>0))
			{
			   wm_sprintf ( Latitude , "%s", Position.latitude);
			   wm_sprintf ( LatInd, "%s", Position.latitude_Indicator);

			   wm_sprintf (Longitude, "%s", Position.longitude);
			   wm_sprintf (LonInd, "%s", Position.longitude_Indicator);

			   Atualiza_GPS = TRUE;
			}

        }
        break;
    }
	return gps_GpsAutoStart;
    
}
```

Log:

```auto
--------------------Configuration: MultiApp - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_MultiApp.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_MultiApp.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_MultiApp_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_MultiApp.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: IPConnect - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_IPConnect.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_IPConnect.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_IPConnect_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_IPConnect.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: Socket - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
    Copy all needed library and object files
 
 Make links ../../../Libraries/MultiApp/gcc/out/gcc_MultiApp.lib ../out/gcc_MultiApp.lib
 Make links ../../../Libraries/IPConnect/gcc/out/gcc_IPConnect.lib ../out/gcc_IPConnect.lib
 Make links C:/OpenAT/OtherLibs/TCPIP/v3.02/gcc_eDLib_302.lib ../out/gcc_eDLib_302.lib
 Make links /cygdrive/C/OpenAT/V302/TgtGen/Adl/Library/gcc_wmadl_302.b03.lib ../out/gcc_wmadl_302.b03.lib
---------------------------------------
 
... Link step in progress ...
 
 
... Link gcc_Socket_32.bin ...
 
/cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-nm: gcc_Socket_32.elf: No such file or directory
make: *** [make_single_bin] Error 1
 
    Build an X-MODEM binary : 'gcc_Socket_32.wpb.dwl'
 
 
... Convert gcc_Socket_32.wpb in X-MODEM format ...
 
genBin : Version v1a06 Copyright (c) WAVECOM
genBin : No Error
 
... Build gcc_Socket_32.wpb.dwl ...
 
---------------------------------------
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
 
WARNING : misc_status.log is incomplete. Check manually if any errors exist
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_eDLib_302.lib, gcc_IPConnect.lib, gcc_MultiApp.lib, gcc_wmadl_302.b03.lib, 
---------------------------------------
---------------------------------------
    End process.
 

Socket - 1 error(s), 1 warning(s)
```

Thanks for all the efforts!

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 20, 2006, 7:28am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/9 "2006-01-20T07:28:11Z")

</div>

hmmmm…

Could you check the .mak file in the project directory?

is there keyboard.c in the source list? for example:

```auto
SRC_C_LIST = \
main.c \
Socket.c \
keyboard.c \
```

Also, are you able to run the program in RTE from Visual C++?

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 20, 2006, 10:51am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/10 "2006-01-20T10:51:05Z")

</div>

Well Jan…

1. ThereÂ´s no “keyboard.c” in Socket.mak (why not if I created the file inside the project?)  
Can I change with a Notepad or thereÂ´s a proper way?

2. No… it wonÂ´t run (RTE) with keyboard calling or not. It points to code on “ipconnect.c” that I didnÂ´t even change.

```auto
--------------------Configuration: IPConnect_rte - Win32 Debug--------------------
Compiling...
ipconnect.c
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(142) : error C2275: 's8' : illegal use of this type as an expression
        c:\openat\v302\tgtgen\wmheader\wm_types.h(48) : see declaration of 's8'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(142) : error C2146: syntax error : missing ';' before identifier 'sReturn'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(142) : error C2065: 'sReturn' : undeclared identifier
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(143) : error C2275: 's8' : illegal use of this type as an expression
        c:\openat\v302\tgtgen\wmheader\wm_types.h(48) : see declaration of 's8'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(143) : error C2146: syntax error : missing ';' before identifier 'TmpReturn'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(143) : error C2065: 'TmpReturn' : undeclared identifier
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(208) : warning C4047: '=' : 'void (__cdecl *)(int ,int )' differs in levels of indirection from 'char *'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(269) : warning C4028: formal parameter 2 different from declaration
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(269) : warning C4024: 'ed_DialupConnectionStart' : different types for formal and actual parameter 1
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(277) : warning C4028: formal parameter 2 different from declaration
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(277) : warning C4024: 'ed_DialupConnectionStop' : different types for formal and actual parameter 1
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(332) : warning C4047: '==' : 'void (__cdecl *)(int ,int )' differs in levels of indirection from 'char *'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(333) : warning C4047: '==' : 'unsigned short (__cdecl *)(unsigned short ,unsigned char *,int )' differs in levels of indirection from 'char *'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(404) : warning C4047: '==' : 'void (__cdecl *)(int ,int )' differs in levels of indirection from 'char *'
c:\wavecom\projetos_temp\libraries\ipconnect\src\ipconnect.c(405) : warning C4047: '==' : 'void (__cdecl *)(unsigned short ,int )' differs in levels of indirection from 'char *'
Error executing cl.exe.

Socket_rte.dll - 6 error(s), 9 warning(s)
```

I have no idea what to do… 🙂

thanks,

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 20, 2006, 11:19am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/11 "2006-01-20T11:19:17Z")

</div>

> [@sanabiovilela](#):
>
> 1. ThereÂ´s no “keyboard.c” in Socket.mak (why not if I created the file inside the project?)  
> Can I change with a Notepad or thereÂ´s a proper way?

You can change it with Notepad. I always adjusted the .mak file with a text editor, I don’t think that this is done automatically. If somebody here knows how the .mak file can be updated without editing it, I would like to know!

> [@sanabiovilela](#):
>
> 1. No… it wonÂ´t run (RTE) […]

oh, oh! I have no clue either… Anybody else here have seen this??

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 20, 2006, 11:24am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/12 "2006-01-20T11:24:22Z")

</div>

If it makes things easier… hereÂ´s the whole project:

[http://us.f1.yahoofs.com/bc/3916e96b/bc/socket/Socket.zip?bfnsM0DBcXp1e8bl](http://us.f1.yahoofs.com/bc/3916e96b/bc/socket/Socket.zip?bfnsM0DBcXp1e8bl)

Best Regards,

Henrique

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 20, 2006, 11:39am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/13 "2006-01-20T11:39:52Z")

</div>

Jan… the keyboard.c wasnÂ´t inside the src folder. Now it is and itÂ´s declared on the Socket.mak.

When I try to run Visual C++ returns no Errors and 18 Warnings. But the dwl file wonÂ´t be generated.

Things here only work when I get 3 errors… this way everything works fine… weird… but thatÂ´s what really happen.

HereÂ´s the log:

```auto
--------------------Configuration: MultiApp - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_MultiApp.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_MultiApp.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_MultiApp_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_MultiApp.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: IPConnect - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
... Creating library gcc_IPConnect.lib with gcc_arm parameter
 
---------------------------------------
 
 
---------------------------------------
Cleaning temporary files (*.tmp / *.trc)
 
 
---------------------------------------
 Generation done with SGT v1.2.11
 Library generated : gcc_IPConnect.lib
 Compiler keyword : gcc_arm
 Compiler release : GCC ARM
 C compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 ASM compiler path : /cygdrive/C/OpenAT/Tools/GCC/bin/arm-elf-gcc
 customer release : gcc
 Name of the current directory : gcc
 Log file : ../out/gcc_IPConnect_status.log
 Release of the environement : CYGWIN_NT-5.0 MicoEstrela 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
---------------------------------------
 
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_IPConnect.lib, 
---------------------------------------
---------------------------------------
    End process.
 
--------------------Configuration: Socket - Win32 Wismo_Target--------------------
 
 
-----------------------------
 Software Generation Toolkit
-----------------------------
 
 SGT_VER = v1.2.11
 SGT_DIR = /cygdrive/C/OpenAT/Tools/SGT/v1.2.11
 Scripts path for SGT :
  /cygdrive/C/OpenAT/Tools/SGT/v1.2.11/script_sgt
 
 Type help_sgt for a list of SGT commands
 
-----------------------------
 
Check environment settings...
 
    Launch a full library or binary process
 
 
---------------------------------------
 
Get ../../src/Socket.c Socket.c
 Use YTPP
... Compiling Socket.c
 
Socket.c: In function `tcp_pfResponseCbk':
Socket.c:166: warning: passing arg 3 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:166: warning: passing arg 4 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:166: warning: passing arg 5 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c: In function `tcp_ConnectHandler':
Socket.c:370: warning: passing arg 3 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:370: warning: passing arg 4 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c:370: warning: passing arg 5 of `ed_SocketTCPStart' from incompatible pointer type
Socket.c: At top level:
Socket.c:465: warning: type mismatch with previous implicit declaration
Socket.c:117: warning: previous implicit declaration of `Socket_start'
Socket.c:465: warning: `Socket_start' was previously implicitly declared to return `int'
Socket.c: In function `Socket_start':
Socket.c:475: warning: passing arg 1 of `ip_Subscribe' from incompatible pointer type
Socket.c: At top level:
Socket.c:524: warning: type mismatch with previous implicit declaration
Socket.c:276: warning: previous implicit declaration of `Socket_stop'
Socket.c:524: warning: `Socket_stop' was previously implicitly declared to return `int'
Socket.c: In function `Socket_stop':
Socket.c:530: warning: passing arg 2 of `ed_SocketLTCPStop' from incompatible pointer type
Socket.c: In function `Socket_init':
Socket.c:570: warning: assignment discards qualifiers from pointer target type
Socket.c:571: warning: assignment discards qualifiers from pointer target type
Socket.c:572: warning: assignment from incompatible pointer type
 
---------------------------------------
 
make: *** No rule to make target `keyboard.o', needed by `gcc_Socket_32'. Stop.
 
    Build an X-MODEM binary : 'gcc_Socket_32.wpb.dwl'
 
 
... Convert gcc_Socket_32.wpb in X-MODEM format ...
 
genBin : Version v1a06 Copyright (c) WAVECOM
genBin : No Error
 
... Build gcc_Socket_32.wpb.dwl ...
 
---------------------------------------
 
 
---------------------------------------
    Find errors occurred when using SGT
 
Analyze errors in Log files
 
 
WARNING : misc_status.log is incomplete. Check manually if any errors exist
---------------------------------------
Analyze errors in tmp files if they exists.
 
---------------------------------------
Libraries available in out directory :
gcc_eDLib_302.lib, gcc_IPConnect.lib, gcc_MultiApp.lib, gcc_wmadl_302.b03.lib, 
---------------------------------------
---------------------------------------
    End process.
 

Socket - 0 error(s), 18 warning(s)
```

Best Regards,

Henrique

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [January 20, 2006, 1:54pm UTC](https://forum.sierrawireless.com/t/keypad-j101/229/14 "2006-01-20T13:54:27Z")

</div>

There seems to be still a problem with your keyboard.c file or the makefile:

> [@](#):
>
> make: \*\*\* No rule to make target `keyboard.o', needed by `gcc\_Socket\_32’. Stop.

Same here… need to have 3 errors for things to work 😆

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [January 23, 2006, 11:14am UTC](https://forum.sierrawireless.com/t/keypad-j101/229/15 "2006-01-23T11:14:36Z")

</div>

Hi Jan… I solved the problem but I still donÂ´t know what really happened.

First: I put all the “keyboard.c” code lines inside the “socket.c”.

I got erros anyway… then I realized that socket.c wasnÂ´t finding the keyboard.h (even though the keyboard.h was in the proper path and it was created inside the project) the code lines inside the keyboard.h.

So… I put the line codes from the keyboard.h in the socket.h

But Visual C++ couldnÂ´t even make the type key\_handler\_f exist!

So… I cut the code that once was in “keyboard.h” and then in “socket.h” and I paste them between the prototype line codes of “socket.c”.

Now the Visual C++ recognizes the type “key\_handler\_f”… and everything is fine!

Really weird… ☹

Thanks for all the Help! Maybe this crazy thing may help some newbie as I am!

Best Regards,

Henrique
