W&T Interfaces
for TCP/IP, Ethernet, RS-232, RS-485, USB, 20mA
Glass and plastic fiber optic, http, SNMP, OPC, I/O digital, I/O analog, ISA, PCI, ...?
      Products
Home Contact   Distributors worldwide
Languages:
DE

US

ES

IT

RU
Web-IO Universal
Digital
Analog
Web-IO application-ready
Monitor climate
Alarm Reporting Center
Web-Count / S0 acquisition
IP monitoring
Data Server
Motherbox 2
pure.box 2
Network Memory
TCP/IP-Ethernet servers
Com-Server (serial)
USB Server
Serial interfaces
USB, RS232, RS485, 20mA
Isolators & fiber optics
USB, RS232, RS485, 20mA
PC cards
PCI Express, PCI and
ISA bus
...
Printer interfaces
Accessories
Downloads
Old
Shopping basket Your shopping basket

 
      Technical knowledge
Books, articles, glossaries...
Technical background info
Applications for Com-Server,
USB Server
, Web-IO,
Web Thermometer,
Motherbox and pure.box
 
Application for the Web-IO Digital:

iPhone optimized Web pages for Web-IO applications




 Additional links: Product overview Application overview Print version


The techniques shown here refer to the Apple iPhone, but they can be adapted to any Internet-capable cell phone by changing the display size to the corresponding display resolution. The only prerequisite is support of JavaScript and in particular HTTP Request Objects (AJAX technology).

As for the iPhone, there are two variations:

iPhone display range

To keep creation of the Web page simple, you should decide on a variation and construct the Web page accordingly.

If there is WLAN access, the example shown functions on all iPod Touch models!

Example: Displaying room climate on the iPhone

In the first example we will measure temperature, relative humidity and barometric pressure using a Web-Thermo-Hygrobarograph and display it on the iPhone as a dynamic Web page.

Temperature monitoring with the Web-IO

As already noted, for Web pages which are optimized especially for the iPhone it is important to define the HTML elements size and position to pixel accuracy.

iPhone display pixels

The drawing should help in arranging the elements and undrestanding the following source text.

<user.htm>
<html>
  <head>
    <title>Aktuelles Klima</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="viewport" content="width=320" />
    <style type="text/css">
    <!--
      * { font-family:Verdana, Helvetica; }
      .description { position:absolute;
                     text-align:center;
                     font-size:18px;
                     left:0px;
                     height:20px;
                     width:320px; }
      .value       { position:absolute;
                     background-color:#99CCFF;
                     text-align:center;
                     font-size:60px;
                     left:0px;
                     height:80px;
                     width:320px; }
    -->
    </style>

  </head>

The source text begins with the Web-IO specific tag <user.htm>, which the Web-IO needs for internally associating into the file system. The <user.htm> tag is not passed from the Web-IO to the browser.

Then follows the normal <head> area of the Web page. Important is the specifier "viewport". This limits the normal zoom-out of the Web page to 320 pixels, so that the Web page can always be displayed in full and in the desired scaling.

Further on in the source text DIV elements for description and display are created. Corresponding CSS-Style information is contained in the head for these elements. Among other things, height and left position are defined.

  <body>
    <div class="description" style="top:10px; ">
      Temperatur
    </div>
    <div id="temperature" class="value" style="top:30px;">
      <w&t_tags=t1>°C
    </div>
    <div class="description" style="top:120px; ">
      Relative Luftfeuchte
    </div>
    <div id="humidity" class="value" style="top:140px; ">
      <w&t_tags=h1> %
    </div>
    <div class="description" style="top:230px; ">
      Luftdruck
    </div>
    <div id="pressure" class="value" style="top:250px;">
      <w&t_tags=pa>hPa
    </div>
  </body>
</html>

Then follows the <body> area of the Web page. Here the CSS Classes and the top specifiers, are used to bring the individual DIV elements into position. For the DIV elements that still need to be changed after loading the Web page are assigned an ID. As the display text special W&T tags are entered. These tags are replaced by the currently valid value by the Web-IO when the page is loaded into the browser.

<script language="JavaScript" type="text/javascript">

  function DataRequest(sendstring)
  { var xmlHttp = window.ActiveXObject ?
             new ActiveXObject("Microsoft.XMLHTTP") : xmlHttp = new XMLHttpRequest();
    if (xmlHttp)
    { xmlHttp.onreadystatechange = function()
      { if (xmlHttp.readyState == 4)
        { if (xmlHttp.status == 200)
          { var ReceiveData = xmlHttp.responseText.split(";");
            document.getElementById('temperature').innerHTML =                           ReceiveData[0].substring(0,ReceiveData[0].length-2) + '°C';
            document.getElementById('humidity').innerHTML = ReceiveData[1]
            document.getElementById('pressure').innerHTML = ReceiveData[2]
            xmlHttp=null;
          }
        }
      }
      xmlHttp.open("GET", sendstring, true);
      xmlHttp.setRequestHeader("Connection", "close");
      xmlHttp.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
      xmlHttp.send(null);
      maintimer = setTimeout("DataRequest('single')", 5000);
    }
  }

  DataRequest('single');


</script>

The core of the Web page is the JavaScript section, which is contained in the <head> area of the Web page. Here the DataRequest function is used to send the command single to the Web-IO. The Web-IO sends the values for temperature, relative humidity and barometric pressure semi-colon delineated. The split statement separates the values and writes them to a variable array.

In this method document.getElementById the corresponding DIV elements are selected for display and the current values entered.

A timer causes this to happen cyclically every 5000ms.

The Web page is now finished and just needs to be uploaded to the Web-IO.

Uploading a specific Web page

You don’t have a Web-IO yet but would like to try the example out sometime?

No problem: We will be glad to send you the Web-Thermo-Hygrobarograph at no charge for 30 days. Simply fill out a sample ordering form, and we will ship the Web-IO for testing on an open invoice. If you return the unit within 30 days, we will simply mark the invoice as paid.

To sample orders   To sample orders Download program example   To download area

 
    Additional application examples for Web-IO Digital
Web techniques
     
     
     
     
  Your own web pages
       
        PHP and AJAX - dynamic web pages also for multiple Web-IOs
        Mashup web pages - displaying values in Google Maps
        Java-Applet - use the integrated applet
        Java-Applet - Example: display in- and outputs
        Java-Applet: Example: display in- and outputs and control the outputs
        Java-Applet - Example: display counters
        Java-Applet - Example: Open doors and switch lights from the browser
        Web-IO with iPhone: visualize and control
        Web-IO with iPhone example: control shutter blinds
        Web-IO with iPhone example: monitor room climate
        Web-IO with iPhone example: display measurement values
System integration
     
     
     
     
     
      Box-to-Box
Data acquisition
     
      FTP data logger - example
Timer
     
      CRON timer (Linux)
      Task planner as timer
Individual programming
     
      Visual Basic.Net 2005/2008/2010
      Visual Basic.Net 2005/2008/2010 with WuTdevice.dll
      Visual C++
      Visual C#
      Visual C# with WuTdevice.dll
      Visual C++ (Linux with QT-Designer)
      Visual Delphi
      Visual Delphi.Net (2005)
      Lazarus / FreePascal
      Java
      control using VBScript
Web-IO system
     
     
      Motherbox - Access multiple Web-IOs
      Motherbox - Logically link Web-IOs
      Limit monitoring
  Web-IO - Options for network linking
       
        DSL
        UMTS/GPRS/mobile phone network
        Satellite radio

 
 
  • Mister Wong
  • Google Bookmarks
  • Twitter
  • Facebook
  • Digg
   Imprint
We are here for you personally! Wiesemann & Theis GmbH Tel.: +49 202/2680-110 (M-F 8:00 - 5:00)
Porschestr. 12 fax: +49 202/2680-265
42279 Wuppertal Individual e-mail

© Wiesemann & Theis GmbH, subject to error and alteration: Since we can make errors, none of our statements should be used without verification. Please report any mistakes or misunderstandings so that we can be aware of them and respond appropriately as quickly as possible.