www.beck-ipc.com

GMLib - PPP


PPP

Functions for PPP GSM and GPRS connections

  • gmPPPGPRSOpen
  • gmPPPGPRSOpenExt
  • gmPPPGPRSOpenExt2
  • gmPPPGPRSClose
  • gmPPPGSMOpen
  • gmPPPGSMOpenExt
  • gmPPPGSMClose
  • gmDCDstate
  • gmPPPGetIPConfiguration
  • gmPPPGetClientStatus


  • int gmPPPGPRSOpen(void)

    This function establishes a PPP connection with the GPRS network. It reads the desired values from CHIP.INI [GM01] section for connecting to the GPRS network. For CHIP.INI constants look at CHIP.INI entries and values starting with GM_INI_PPP_.
    If you do not want the parameters read from CHIP.INI, you can alternatively use gmPPPGPRSOpenExt.
    If there's no matching entry in CHIP.INI, the following values will be set by default:

    PPPAUTH = (1), see also gmPPPAuthentication
    PPPUSER = (empty)
    PPPPASSWORD = (empty)
    PPPAPN = (mandatory, APN string has to be provided in the chip.ini)
    PPPGPRSCONNECT = (deprecated, only needed when PPPAPN is not given, gprs connect string)
    PPPDIAL = (deprecated, only needed when PPPAPN is not given, gprs dial string)
    PPPIDLETIMEOUT = 0 (close PPP after this amount of idle time, in seconds, 0: No closing after idle time)
    PPPSETNEWGATEWAY = 1 (set the remote peer as new gateway)

    Return Value

    Return values are described here: Return values For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes.

    Comment

    The CHIP.INI section may look like

    [GM01]
    PPPAUTH=1
    PPPUSER=vodafone
    PPPPASSWORD=vodafone
    PPPAPN=volume.d2gprs.de
    ;PPPGPRSCONNECT=AT+CGDCONT=1,"IP","volume.d2gprs.de"
    ;PPPDIAL=ATD*99***1#
    PPPIDLETIMEOUT=0
    PPPSETNEWGATEWAY=1
    
    Please note that it is mandatory to specify the PDP context 1 if PPPGPRSCONNECT and PPPDIAL are used. (AT+CGDCONT=1 and ATD*99***1 #). The PPPGPRSCONNECT and PPPDIAL settings are deprecated and will not work with newer modems (like GM08).


    Top
    Index page



    int gmPPPGPRSOpenExt(int auth, char * username, char * password, char * gprsConnect, char * gprsDial, unsigned long idleTimeout, int setGateway)

    This function establishes a PPP connection with the GPRS network. If you want to read the parameters from CHIP.INI you can alternatively use gmPPPGPRSOpen.

    Parameters

    auth

    Input parameter: see gmPPPAuthentication

    username

    Input parameter: username if auth is non-zero.

    password

    Input parameter: password if auth is non-zero.

    gprsConnect

    Input parameter: gprs connection string (e.g. AT+CGDCONT=1,"IP","volume.d2gprs.de")
    Please note that it is mandatory to specify the PDP context 1 here (AT+CGDCONT=1 ).

    gprsDial

    Input parameter: gprs dial string (e.g. ATD*99***1#)
    Please note that it is mandatory to specify the PDP context 1 here (ATD*99***1 #).

    idleTimeout

    Input parameter: close PPP after this amount of idle time, in seconds. 0: No closing after idle time

    setGateway

    Input parameter: set the remote peer as new gateway, see gmPPPSetGateway

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes.


    Top
    Index page


    int gmPPPGPRSOpenExt2(int auth, char * username, char * password, char * gprsApn, unsigned long idleTimeout, int setGateway)

    This function establishes a PPP connection with the GPRS network. In contrast to the gmPPPGPRSOpenExt function, it simply requires an APN instead of the kind of cryptic connect and dial strings. For GM07/GM08 this API function needs to be used. The deprecated gmPPPGPRSOpenExt function can no longer be used for these types of modems. If you want to read the parameters from CHIP.INI you can alternatively use gmPPPGPRSOpen.

    Parameters

    auth

    Input parameter: see gmPPPAuthentication

    username

    Input parameter: username if auth is non-zero.

    password

    Input parameter: password if auth is non-zero.

    gprsApn

    Input parameter: gprs APN string (e.g. volume.d2gprs.de)

    idleTimeout

    Input parameter: close PPP after this amount of idle time, in seconds. 0: No closing after idle time

    setGateway

    Input parameter: set the remote peer as new gateway, see gmPPPSetGateway

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes.


    Top
    Index page


    int gmPPPGPRSClose(void)

    This function closes a PPP connection with the GPRS network. If the gateway was set by gmPPPGPRSOpen or gmPPPGPRSOpenExt the old gateway will be restored.

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes.


    Top
    Index page


    int gmPPPGSMOpen(void)

    This function establishes a PPP connection with the GSM network. It reads the desired values from CHIP.INI [GM01] section for connecting to the GSM network. For CHIP.INI constants look at CHIP.INI entries and values starting with GM_INI_PPP_.
    If you do not want the parameters read from CHIP.INI, you can alternatively use gmPPPGSMOpenExt.
    If there's no matching entry in CHIP.INI, the following values will be set by default:

    PPPAUTH = (1), see also gmPPPAuthentication
    PPPUSER = (empty)
    PPPPASSWORD = (empty)
    PPPDIAL = (mandatory, dial string with leading ATD has to be provided in chip ini)
    PPPIDLETIMEOUT = 0 (close PPP after this amount of idle time, in seconds, 0: No closing after idle time)
    PPPSETNEWGATEWAY = 1 (set the remote peer as new gateway

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes.

    Comment

    The CHIP.INI section may look like

    [GM01]
    PPPAUTH=1
    PPPUSER=vodafone
    PPPPASSWORD=vodafone
    PPPDIAL=ATD229000
    PPPIDLETIMEOUT=0
    PPPSETNEWGATEWAY=1
    

    Top
    Index page


    int gmPPPGSMOpenExt(int auth, char * username, char * password, char * gsmDialNumber, unsigned long idleTimeout, int setGateway)

    This function establishes a PPP connection with the GSM network. If you want to read the parameters from CHIP.INI, you can alternatively use gmPPPGSMOpen.

    Parameters

    auth

    Input parameter: see gmPPPAuthentication

    username

    Input parameter: username if auth is non-zero.

    password

    Input parameter: password if auth is non-zero.

    gsmDialNumber

    Input parameter: GSM dial number string (eg. ATD229000)

    idleTimeout

    Input parameter: close PPP after this amount of idle time, in seconds. 0: No closing after idle time

    setGateway

    Input parameter: set the remote peer as new gateway, see gmPPPSetGateway

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes


    Top
    Index page


    int gmPPPGSMClose(void)

    This function closes a PPP connection with the GSM network. If the gateway was set by gmPPPGSMOpen or gmPPPGSMOpenExt, the old gateway will be restored.

    Return Value

    Return values are described here: Return values. For PPP error codes please refer to the @CHIP-RTOS - TCP/IP and PPP error codes


    Top
    Index page


    int gmDCDstate(void)

    This function checks if a (PPP) connection is established. The function can be invoked periodically to assure a permanent connection. Therefore the PIO PIN defined in CHIP.INI or in gmInitExt is used.

    Return Value

    Returns one of the following gmDCDConnection or if no DCD PIO is defined GM_EXIT_FAILURE.

    Comments

    Please note that the DCD signal will always be inactive when the MUX mode is used.


    Top
    Index page


    int gmPPPGetIPConfiguration(gmPPP_IPConfiguration * ipConfiguration)

    This function delivers the IP configuration of the current PPP connection

    Parameters

    ipConfiguration

    Input parameter: Pointer to a gmPPP_IPConfiguration type data structure prepared by caller.

    Return Value

    Returns one of the following:

    GM_EXIT_SUCCESS
    On success

    GM_PPP_CLIENT_NOT_RUNNING
    PPP client is not running

    GM_PPP_CLIENT_NO_LINK
    No PPP connection information available


    Top
    Index page


    int gmPPPGetClientStatus(void)

    This function delivers the PPP client status

    Return Value

    Returns one of the following:

    -1 (PPP_NOTAVAIL) - Client is not running
    0 (PPP_LNKDOWN) - Link is down
    1 (PPP_LNKWILLOPEN) - Link opening in progress
    2 (PPP_LNKUP) - Link is established
    3 (PPP_HALTED) - Halted by PPP_Client_Pause() call


    Top
    Index page


    End of document