SMSSend (SMS Send)

The SMSSend function is used to send SMS messages through a CELL2XX-SERIES cellular modem.

NOTE: FOR USE WITH CAMPBELL SCIENTIFIC CELL2XX-SERIES CELLULAR MODEMS ONLY. ALSO REQUIRES A CELLULAR ACCOUNT THAT INCLUDES TEXT MESSAGING CAPABILITIES.

Caution: CR6 OS 11.0 updated SMSSend() to handle arrays. Upgrading to this OS will require CRBasic programs running old instances of SMSSend() to be updated. SMSSend() is now an instruction rather than a function. (That is, the ResultCode is included as a parameter. Previously, SMSSend() was set equal to a variable that would hold the ResultCode). There is a new Swath parameter to specify how many messages to send. The Result, PhoneNumber, and Message parameters can all now be arrays which allows multiple messages to be sent to multiple phone numbers with a single SMSSend() instruction.

Syntax

SMSSend ( ResultCode, Swath, PhoneNumber, Message )

Remarks

The SMSSend function generates SMS messages and sends them out on the cellular network.

SMSSend requires the modem to enter command mode. While the modem is in command mode, cellular IP communication will be paused.

NOTE: SMSSend can take up to 5 minutes to send one message. It is recommended to place SMSSend in a slow sequence scan where it will run in the background and not hold up the main program while the datalogger waits for the transaction to complete.

Parameters

ResultCode

A variable of Type Long or Float that holds the result of the instruction.

Result Code Description
0 Timed out waiting for a response from the modem.
-1 Message successfully sent to the network.
-3 Error response from modem.
-5 PhoneNumber or Message parameter is an empty string.
-6 Message sent to the modem, no confirmation response received from the modem.
-7 Timed out waiting for response from the modem.
-8 No internal cellular modem installed or modem is off/disabled
-9 Datalogger timed out waiting for modem to send the message. Message is in Cell2XX queue and may still be sent.
-11 Send failure. External Cell2XX is powered down
-12 Array out of bounds

Type: Long or Float Variable or Variable Array

Swath

The number of SMS messages to be sent. The maximum number of messages possible is 60.

Type: Variable, constant, or expression

PhoneNumber (Phone Number)

A string variable or string array containing the SMS recipient phone number including the country code and area code. The country code for the United States is 1, so the Phone Number is 1+three-digit area code+seven-digit phone number. Do not include dashes or + symbols in the phone number. Enclose the phone number in quotes.

For Example:

Public Tx_Number As String = "14351234567"

Type: Variable or variable array formatted as a string

Message

A string variable or string array containing the text used in the body of the text message. For messages being sent, variables can be included in the message using CRBasic's standard string syntax (for example, "The temperature is " + TempVar + " degrees C").

Type: Variable or variable array formatted as a string

Usage Notes: