ADVANCED: gsmIncomingPDU (Functionblock) |
Top Previous Next |
This function block can be used to check whether there is an incoming SMS PDU binary message from the cellular network or over the RTCU Communication Hub.
The device has a buffer where SMS and PDU messages are stored. To prevent loss of any messages, this buffer can only contain one message at a time. Since this buffer is shared between SMS and PDU messages, it is possible if an SMS message is received and no instance of the gsmIncomingSMS is present in the application that this incoming SMS message will block the possibility of other other PDU messages arriving. Because of this, it is recommended to have an instance of the gsmIncomingSMS even if the application is not normally expecting SMS messages. The buffer will not be filled until either gsmIncomingSMS or gsmIncomingPDU is called.
A PDU message sent from the RTCU IDE (or any other RACP-compliant peer) that uses a cable or data connection will be delivered to the application with the "phone number" set to "9999". See also gsmSendPDU.
Messages received through the RTCU Communication Hub will have the "phone number" set to the node number of the originating node prefixed with "@" (e.g. "@3917321112").
Note: the phone book on the used SIM card must be empty. If a caller that is present in the phone book sends an SMS message, this message will not be delivered to the program.
Input: message : PTR Address of a variable where the message from the sender should be delivered to (only if status is 1 or 2). Please make sure that the size of the variable is big enough to accommodate the biggest SMS message that can be received which in PDU mode is 140 bytes. This variable must be set before the gsmIncomingPDU instance is called the first time.
Please note that if a TEXT type SMS message is received and no instance of the gsmIncomingSMS is present in the application, this incoming TEXT SMS message will block for other PDU SMS messages to arrive. Because of this, it is a good idea to have an instance of the gsmIncomingSMS, even if your application is not expecting TEXT SMS messages.
Output: status : INT (0..4)
phonenumber : STRING Caller id of the sender (if status is 1).
If the number is prefixed with an "@", the message is received through the RTCU Communication Hub and the number after the "@" character is the originating node number (only supported on network-enabled devices).
The "phone number" will be set to "9999" for messages sent from the RTCU IDE (or any other RACP-compliant peer).
length : INT Number of bytes received in the SMS PDU message.
Declaration: FUNCTION_BLOCK gsmIncomingPDU;
Example: INCLUDE rtcu.inc |