Tunnel – API used for reading MTX-Tunnel GPIOs and ADCs from 3rd party site

¿Buscas alguna otra cosa?

Scenario details:

  • Monitor the modem’s inputs remotely and present values in a 3rd-party web page
  • MTX-Tunnel has to be permanently connected to GPRS in server mode, waiting for HTTP GET connections coming from this web page
  • The end customer web page will be ASP language programmed and will collect all of the values and display them

Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2

Config.txt configuration file:

Configuration Observations
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_model: MTX-4G-JAVA-IOT-STD-N
MTX_mode: none
MTX_ping: 30
MTX_pingIP: 8.8.8.8
WEBSERVER_enabled: on
WEBSERVER_firewall: off
WEBSERVER_login: user
WEBSERVER_password: 1234
WEBSERVER_skin: http://www.mtxtunnel.com/webserverimg/
WEBSERVER_gsmScript: http://www.blogelectronica.com/gps/gsm.php
GPRS APN from your network operator
GPRS Login
GPRS Password
Modem is permanently connected to GPRS
MTX-Terminal modem model used
No gateways
Minutes for connectivity supervisor
Connectivity supervisor IP address
Webserver sevice enable
Firewall disabled
Webserver login
Webserver password
Webserver skin
Script GSM positioning

ASP page programming example:

The ASP programming example for this scenario is very simple.

Basically, in ASP code we use AT commands that are executed remotely and collect the responses. The command used is AT^MTXTUNNEL=GETIOS which obtain all of the digital and analog input values in one shot.

The results of these values are shown in the web explorer:

<%
set XmlObj = Server.CreateObject(“Microsoft.XMLHTTP”)
XmlObj.open “GET”, “http://mtxtunnel.dyndns.org/api.html?ATCOMMAND=AT%5EMTXTUNNEL=GETIOS&LOGIN=user&PASS=1234”, false
XmlObj.send
datosDelMTXTunnel = XmlObj.responseText
cadenaInicio=”<MTXTUNNEL>AT^MTXTUNNEL=GETIOS “
posiIni=instr(1,datosDelMTXTunnel,cadenaInicio)
posiFin=instr(1,datosDelMTXTunnel,”</MTXTUNNEL>”)
datosIO=mid(datosDelMTXTunnel,len(cadenaInicio),posiFinlen(cadenaInicio))
vectorDatos=split(datosIO,”,”)
for i=0 to 9
Response.write(“El Value de GPIO” & i+1 & “ es: “ & vectorDatos(i) & “<br>”)
next
Response.write(“El Value de ADC1 es: “ & vectorDatos(10) & “<br>”)
Response.write(“El Value de ADC2 es: “ & vectorDatos(11) & “<br>”)
%>

The web page will show: