Tunnel – AT Commands User Procedure

¿Buscas alguna otra cosa?

In main applications, MTX-Tunnel is used as a simple GPRS-Serial gateway. But sometimes, MTX-Tunnel needs to be integrated into a third-party system application which needs to access the modem remotely to find out a digital input value, network coverage, to check incoming SMS or an important action like remotely or locally changing a configuration value without using OTAP or MES respectively.

User API consists of a set of special AT commands intended to integrate MTX-Tunnel in an end custom application. You can execute standard AT commands on MTX-Tunnel, such as the typical commands like “AT+CSQ” to check the network coverage, or “AT^SSIO” to change a digital output or commute a relay. However, MTX-Tunnel includes a series of special commands (API) which allows for the easy integration of MTX-Tunnel either in the system or that of a third party.

AT Commands MTX-Tunnel User Procedure

If you are not familiar with MTX-Tunnel, we recommend you do this test configuration to learn about the “MTX-Tunnel TCP-Server” scenario. Follow these steps:

Using main serial port COM1 (can the GPRS-serial tunnel be established or not?)

The AT command has a special syntax as the MTX-Tunnel application is running so tunnels can be created and the command is on the same channel…

Special syntax is used with AT commands between following TAGS <MTXTunnel> -</MTXTUNNEL>

For example, if you send this special command:

<MTXTUNNEL>AT</MTXTUNNEL>

You also will be receive the response by special syntax command:

<MTXTUNNEL>AT OK</MTXTUNNEL>

All these special syntax commands use the COM1 port and will be not resent by 2G/3G/4G as they are interpreted as an AT command by MTX-Tunnel. This way, the machine connected to COM1 can also have modem control.

To enable this feature the configuration parameter MTX_ATMux must be “on”. If you do not need this feature please do not enable the above command, you will save CPU resources.

NOTE: the encapsulated command should NOT end up in return (0x13 0x10). It must send exactly and only those characters so the command can be interpreted.

Using main serial port COM1 DB9 (without encapsulation)

It is possible to send the AT command without encapsulating using a special mode of the MTX-Tunnel, just for when the modem is used as a TCP Server or CSD (GSM call) gateway. In that situation it is possible to use the parameter MTX_ATMux: modem.

This way you will be able to send AT commands to the modem when there is not a TCP server connection established in that moment.

Using secondary serial port COM2

You do not need to use special syntax to send AT commands with COM2, just use normal syntax. Please be sure to configure the MTX_portAux parameter to “on”. If you do not need this feature please do not enable the above command, you will save CPU resources.

Please note that TELNET bypass (second GPRS-serial tunnel, to use 2 equipments) cannot be created if you need to use COM2 for auxiliary AT command use.

SMS messaging

You can send AT commands and receive their answer using SMS messages. Parameter configuration needed: SMS_ATEnabled “on” and SMS_ATResponse “on”.

No special syntax has to be used, MTX-Tunnel will use AT commands if the SMS message begins with “mtxtunnel” (or the specific SMS_header). For example, with a SMS with the text: “mtxtunnel at+csq” the modem ask with another SMS with the signal level.

HTTP

It has been explained that Web Browser can be used to send AT commands. There is a more highly recommended way using “api.html” WebServer.

For example this way you read a digital input, change the level of the digital output and switch a relay or remotely read the network coverage as follows:
http://mtxtunnel.dyndns.org/api.html?ATCOMMAND=AT%2BCSQ&LOGIN=user&PASS=1234

MTX-Tunnel will answer:

<MTXTUNNEL>AT+CSQ
+CSQ: 25, 99
OK
</MTXTUNNEL>

You need to extract the answer from the AT command between <MTXTunnel> tags.

Please note that URL syntax needs to be used and in this order: ATCOMMAND, LOGIN y PASSWORD.

Please also note that in URL special characters used on AT commands, like the “plus”, “+”, cannot be used and need to be decoded as follows:

%20 > blank space
+ > blank space
%21 > !
%22 > \
%23 > “
%24 > $
%25 > %
%26 > &
%27 > ‘
%28 > (
%29 > )
%2ª > *
%2B > +
%2C > ,
%2D > –
%2E > .
%2F > /
%3A > :
%3B > ;
%3C > <
%3D > =
%3E > >
%3F > ?
%40 > @
%5B > [
%5C > \
%5D > ]
%5E > ^
%5F > _

Telnet

In the previous chapter, we explained how to use TELNET to send AT commands. It is easy and convenient.

Using socket client connection

MTX-Tunnel is able to remotely send AT commands using the GRPS/3G — Serial tunnel Gateway which is created when a TCP client socket is created. As explained before, this is useful when the network operator does not allow input connections or server mode.

To use this option please remember to configure MTX with parameter MTX_ATEmbedded to “on”.

To remotely send AT commands via a client socket you should encapsulate the command in between the following tags: <MTXTUNNELR> </ MTXTUNNELR>

For example, if you send the command:

<MTXTUNNELR> AT </ MTXTUNNELR>

Your response will be:

<MTXTUNNELR> AT OK </ MTXTUNNELR>