www.beck-ipc.com

GMLib - SMS


SMS

Functions for handling SMS

  • gmGetNextMessage
  • gmGetNextMessageExt
  • gmSendSMSText
  • gmSendSMSTextExt
  • gmWriteTerminalCharacterSet
  • gmStartSMSTask


  • int gmGetNextMessage(char * number, char * time, char * text)

    This function checks the GM0x for a new short message. If a new message is available the number, time and text are returned.
    This function is used if you want to periodically poll for new messages. The message will be deleted to avoid message storage problems in the GM0x.
    Alternatively you can use a callback function that handles new SMS in a task. Please use the SMSCallback parameter of the function gmStartSMSTask.

    Status reports will not be returned by this function. They will be discarded. If status reports are requested for sent short messages with gmSendSMSTextExt, then the function gmGetNextMessageExt should be used to check for incoming SMS and status reports.

    Parameters

    number

    Output parameter: Number of the short message sender. String buffer must have at least a size of 32 characters.

    time

    Output parameter: Time of the short message received String buffer must have at least a size of 32 characters.

    text

    Output parameter: The short message text String buffer must have at least a size of 1536 characters.

    Return Value

    Return values are described here: Return values

    GM_NO_NEW_SMS
    No new SMS arrived.


    Top
    Index page


    int gmGetNextMessageExt(char * number, char * time, char * text, int * refNum, int * state)

    This function checks the GM0x for a new short message or status report. If a new message is available the number, time, text, reference number and status are returned.
    This function is used if you want to periodically poll for new messages or status reports. The message will be deleted to avoid message storage problems in the GM0x.

    Parameters

    number

    Output parameter: Number of the short message sender. String buffer must have at least a size of 32 characters.

    time

    Output parameter: Time of the short message received String buffer must have at least a size of 32 characters.

    text

    Output parameter: The short message text String buffer must have at least a size of 1536 characters.

    refNum

    Output parameter: The reference number (0..255) to a sent SMS, if this message is a status report or -1 if this is a normal incoming SMS.

    state

    Output parameter: This state field has the following meaning:

        Transaction completed:
            -1    : Normal SMS, no status report.
            0x00: Short message delivered successfully
            0x01: Short message forwarded, but unable to confirm delivery
            0x02: Short message replaced
        Temporary error, the service center is still trying to transfer the short message:
            0x20: Congestion
            0x21: Recipient busy
            0x22: No response from recipient
            0x23: Service rejected
            0x24: Quality of service not available
            0x25: Recipient error
        Permanent error, the service center is not making any more transfer attempts:
            0x40: Remote procedure error
            0x41: Incompatible destination
            0x42: Connection rejected by recipient
            0x43: Not obtainable
            0x44: Quality of service not available
            0x45: No interworking available
            0x46: Validity period expired
            0x47: Short message deleted by sender
            0x48: Short message deleted by service center administration
            0x49: Short message does not exist

    Return Value

    Return values are described here: Return values

    GM_NO_NEW_SMS
    No new SMS arrived.


    Top
    Index page


    int gmSendSMSText(char * number, char * text)

    This function sends a short message.

    Parameters

    number

    Input parameter: cell phone number of the recipient

    text

    Input parameter: the short message text

    Return Value

    Return values are described here: Return values


    Top
    Index page


    int gmSendSMSTextExt(char * number, char * text, int report, unsigned char validity, int * refNum)

    This function sends a short message with or without a request for a status report.

    Parameters

    number

    Input parameter: cell phone number of the recipient

    text

    Input parameter: the short message text

    report

    1=Request status report, 0=Don't request status report

    validity

    Validity period:
        0-143: (validity+1) * 5 minutes
        144-167: 12 hours + ((validity-143) * 30 minutes)
        168-196: (validity-166) * 1 day
        197-255: (validity-192) * 1 week

    refNum

    Output parameter: Message reference number (0..255). A status report will refer to this reference number.

    Return Value

    Return values are described here: Return values


    Top
    Index page


    int gmWriteTerminalCharacterSet(int chSet)

    This function determines the terminal character set.

    Parameters

    chSet

    Input parameter: number of character set

    Enum gmTerminalCharacterSet contains possible values. The default value is GM_CHARSET_8859_1 (4) on GM01/GM03/GM05/GM06/GMLGA01/GMLGA02 and GM_CHARSET_ASCII (0) on GM02/GM04.

    Return Value

    Return values are described here: Return values


    Top
    Index page


    int gmStartSMSTask(SMSCallback callback, int interval, int priority)

    This function starts a task that checks for new SMS. In case a new SMS arrived or an error occurred, the defined callback function will be invoked.

    Parameters

    callback

    Input parameter: A pointer to a SMSCallback function.

    interval

    Input parameter: Time in ms between task is invoked and looks for new SMS.

    priority

    Input parameter: task priority, range: between 2 and 127.

    Return Value

    Return values are described here: Return values


    Top
    Index page


    End of document