This is an example for one of the most commonly used functions, which is to alert certain recipients ("clients") for state changes that occur on the inputs of the GAT device.
In this example, the voltage inputs are connected to mechanical switches, which means that we check if voltage is present on some input or not.
The scenario of this application is as follows:
- When voltage input #1 gets activated,
client #1 will receive the message "Input #1 ON". - Client #2 will be informed about both the activation
and the deactivation of voltage input #2,
with the messages "Input #2 ON" and "Input #2 OFF" respectively. - When voltage input #3 gets activated,
all clients will receive the message "Input #3 ON".
The above are implemented with the following application program:
TN ;Telephone Numbers list IM 1 1 ;Input #1 event Messages go to client #1 IM 2 2 ;Input #2 event Messages go to client #2 IM 3 9 ;Input #3 event Messages go to all clients |
This simple application program contains two different parameters setup commands:
- The command "TN" is used to inform the GAT device with the telephone numbers of the 3 clients.
- The command "IM" is used to setup the messages which are sent as reaction to each voltage input event.
All the commands and messages are written with plain Latin letters (ASCII).
In this program text we are using a nice capability of the "GATcomm" application:
The comments in a program are very useful for the user to understand it,
either when the program becomes complicated
or when some time has passed from the original writing.
The (green) text after the character ";" are comments, which can be written in any language.
The user can add comments in any position in the program.
Any text that starts with the character ";" and until the end of the line is cosidered as comment.
You can easily upload this program to the GAT device with the help of the "GATcomm" application,
or send to the GAT device an SMS like the following:
0000 |
The "0000" at the start of the message is the security code, which is needed so the GAT device accepts any command.
One step further...
On some situations, we need to filter the voltage inputs to avoid false alarms due to electrical or mechanical noise or any other unwanted short events.
This is done by increasing the response time of the voltage input.
The default response time of the voltage inputs is 1 second, so if we are alright with this there is no need for further commands.
Let's say that for the above example, we need different response times, and specifically:
- 3 seconds for voltage input #1
- 5 seconds for voltage input #2
- 20 seconds for voltage input #3
The command to setup this parameter is the "IT", and to achieve the desired result we must add the following commands to the program:
IT 1 30 ;Input #1 reaction time: 3 seconds |
So the full program becomes like this:
TN ;Telephone Numbers list IM 1 1 ;Input #1 event Messages go to client #1 IM 2 2 ;Input #2 event Messages go to client #2 IM 3 9 ;Input #3 event Messages go to all clients IT 1 30 ;Input #1 reaction time: 3 seconds |
In the case where the device is already installed and working on some remote place, we can send to it an SMS to modify its parameters while it is working:
0000 IT 1 30 IT 2 50 IT 3 200 |
About commands syntax
If you pay attention to the above message, you will notice that the commands are all in one line. The GAT device accepts a lot of freedom in writing commands. The basic premise is that the message starts with the (correct) security code followed by at least one space or line break character. Even the space character between the command and the first parameter may be missing, as shown in the following message:
0000 IT1 30 IT2 50 IT3 200 |
The default communication behavior of the GAT device is to answer to any incoming commands message with a confirmation message.
The confirmation message for the above commands message would be:
O.K. IT1 30 IT2 50 IT3 200 |
which is the received message with one difference: The security code has been replace with "O.K.".
In case where the GAT device finds some error in the received message, it will return a message where it will try to show the position of the error.
So let's say that we send the following message:
0000 IT1 30 IY2 50 IT3 200 |
The second command is written wrongly "IY" instead of the correct "IT".
The GAT device will answer with the following message:
E013 IT1 30 >IY2 50 IT3 200 |
The answer message starts now with "E013" which means "Error at position #13" and the character '>' is inserted right before the wrong command.
This was a first example about the programming and functionality of the GAT devices.
Intentionally we don't involved much the "GATcomm" software, to show that some simple job can be done just by writing and sending some commands via SMS with the mobile phone.