Access Keys:
Skip to content (Access Key - 0)
 

Adding a web view to panel.xml

Eric Bariaux

On Mar 15, 2011 10:09

I have started work on integrating a web view in panel.xml so it can be used on OR consoles.
At this stage, the idea is not to integrate a full web browser but to point it at a given page to display information like a video feed, a dynamic image (e.g. consumption data updated from a server), ...
Currently the element looks like this in the panel.xml
<absolute left="80" top="58" width="640" height="240">
<web id="6" src="http://192.168.1.117/control/faststream.jpg?stream=full&fps=8.0" username="admin" password="meinsm"/>
</absolute>

A web tag, embedded in a positioning element. Attributes are the URL and potentially a username/password if content is protected with basic authentication.

Any comments, requirements, ideas are welcomed.

 
Labels: , ,
Participants: Rui Costa , Alexander Schwithal , Andrew Ball , Eric Bariaux , Juha Lindfors , Mario , pierce maher
  1. Apr 18, 2011

    pierce maher says:

    Hi Eric I read your post some time and had the following question. There are s...

    Hi Eric

    I read your post some time and had the following question.

    There are several applications which use a web interface which I would like to use with Openremote.

    I currently use squeezebox as my music server. This is an open source music server which can use PC's or Logitech hardware to

    play the music. There is an iPhone application called iPeng which acts as a remote for Squeezebox server.

    it has a web interface and can be accessed by

    1) Install the iPeng Plugin on your Squeezebox Server
    2) Create an url object with http://<yourserver>:9000/iPeng

    You can then controll the music server using this web page.

    Would it be possable to switch from Openremote to this web page and back again.

    This would allow you to access this controller direct from Openremote

    1. Apr 19, 2011

      Eric Bariaux says:

      There is even no need to switch, the web page is embedded as part of the screen,...

      There is even no need to switch, the web page is embedded as part of the screen, so you can have both a web view and other controls on the same screen.
      So all sites working with Safari on the iPhone/iPad should work fine in this web view.
      The only thing is that it does not have navigation buttons or the URL bar. URL is fixed in the configuration (panel.xml) and all navigation must occur using the links in the page.
      Navigation and control of URL could be added later I believe but this would mean a bit more thought is required on "scripting/action" on the client side.

      1. Apr 19, 2011

        pierce maher says:

        Hi Eric Is this available now to test? Pierce

        Hi Eric

        Is this available now to test?

        Pierce

        1. Apr 20, 2011

          Eric Bariaux says:

          The iOS console that supports this is available in this branch : https://openrem...

          The iOS console that supports this is available in this branch : https://openremote.svn.sourceforge.net/svnroot/openremote/workspace/ebariaux/iPad_Console_2_0_0_Betas_Linphone

          There is no integration at this point in the designer, so you need to manually edit the panel.xml, repackage as a zip file and upload to controller to test.

          Eric

  2. Apr 21, 2011

    Juha Lindfors says:

    Looks good to me, I like the <web> element. Have pinged Andrew Ball for h...

    Looks good to me, I like the <web> element.

    Have pinged Andrew Ball for his attention to this development to keep Android in sync (after a few other tasks first) – please keep us updated here on development and if there's anything at a solution level (obviously not code) that might be useful for knowledge-transfer from iOS to Android.

    1. Apr 22, 2011

      pierce maher says:

      Hi Eric do you have an example on how the panel.xml should be edite to. If you...

      Hi Eric

      do you have an example on how the panel.xml should be edite to.

      If you could supply this It would help

      Pierce

      1. Apr 22, 2011

        Eric Bariaux says:

        The web tag takes the following format: <web id="xxx" src="your url" usern...

        The web tag takes the following format:

        <web id="xxx" src="your url" username="optional user name" password="optional password"/>
        

        You would only include the username/password if the URL you're trying to reach requires basic authentication.
        The web tag can appear anywhere a button, image, switch ... or other widget appear.

        Eric

    2. Apr 22, 2011

      pierce maher says:

      Hi Eric do you have an example on how the panel.xml should be edite to. If you...

      Hi Eric

      do you have an example on how the panel.xml should be edite to.

      If you could supply this It would help

      Pierce

      1. Apr 25, 2011

        pierce maher says:

        Hi Eric Can you give me some help on setting this up. I download from https://o...

        Hi Eric

        Can you give me some help on setting this up.
        I download from https://openremote.svn.sourceforge.net/svnroot/openremote/workspace/ebariaux/iPad_Console_2_0_0_Betas_Linphone/

        where should I put this once downloaded?

        Do I need to re build the controler?

        If I want to have a button linked to a web page how should it be coded in the XML.

        If you can help on the above it would help

        Regards

        Pierce

        1. Apr 26, 2011

          Eric Bariaux says:

          Hello Pierce, The code I linked to is the console code for iOS. You need to com...

          Hello Pierce,

          The code I linked to is the console code for iOS. You need to compile that project and install on your device (iPad/iPhone).
          For this, you need a Mac with the iOS dev tools and be a registered developer.
          If this is not your case, then the easiest thing is to send me your UDID (eric [at] openremote [dot] org) and I can create a specific build for you.

          Do I need to re build the controler?

          For the controller, you can use the "standard" one, there is nothing specific for this feature.

          If I want to have a button linked to a web page how should it be coded in the XML.

          There is no interaction at this time with the <web> element on the console. So if you want a button to navigate to this web page, put the <web> element on a screen and use the normal navigation mechanism from OR to navigate to that page. You'll also want a "normal" OR button to navigate away from that page.

          Eric

  3. May 05, 2011

    Andrew Ball says:

    What sort of behavior do we want if the web server involved has an invalid SSL c...

    What sort of behavior do we want if the web server involved has an invalid SSL certificate? The default for the Android WebView widget is to cancel the request, although I believe I can also ignore the SSL error on Android 2.2 and above at least.

    1. May 10, 2011

      Juha Lindfors says:

      Let's use the default behavior if we can indicate with the UI widget somehow why...

      Let's use the default behavior if we can indicate with the UI widget somehow why the content is not being presented (visually indicate error condition, the actual description of the error may need to show up elsewhere).

      IgnoreSSLError could also be a valid attribute to the <web> element which at least puts the responsibility to the user to ignore security related errors. Not sure if it applies to iOS panels the same but at least it would be valid on Android.

      1. May 26, 2011

        Juha Lindfors says:

        So Andrew is voting for "IgnoreSSLError" optional attribute in the schema, I'm f...

        So Andrew is voting for "IgnoreSSLError" optional attribute in the schema, I'm fine with it too.

        Eric, any comments?

        1. May 27, 2011

          Eric Bariaux says:

          I'm fine with adding this as an optional attribute to the schema. I'm not sure I...

          I'm fine with adding this as an optional attribute to the schema.
          I'm not sure I'll be able to honor it on iOS though, as I don't know the behaviour of the web view in case of invalid certificate, I would need to test.

          1. May 27, 2011

            Juha Lindfors says:

            Alright, we could document it as "Android-only" in the schema until and unless c...

            Alright, we could document it as "Android-only" in the schema until and unless confirmed on iOS.

  4. May 10, 2011

    Andrew Ball says:

    I've been working on this for the Android console in the following branch in Sub...

    I've been working on this for the Android console in the following branch in Subversion: https://openremote.svn.sourceforge.net/svnroot/openremote/workspace/andrewball/Android_Console_2_0_0_Betas_web_element (build instructions at http://openremote.org/display/docs/Building+OpenRemote+Android+2.0+Console )

    My implementation should be fairly functional at this point.

    Here's the panel.xml I've been using:

    <?xml version="1.0" encoding="UTF-8"?>
    <openremote xmlns="http://www.openremote.org" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://www.openremote.org 
      http://www.openremote.org/schemas/panel.xsd">
      <panels>
        <panel id="73" name="Web Demonstration">
          <include type="group" ref="74" />
        </panel>
      </panels>
      <screens>
        <screen id="75" name="Starting Screen">
          <absolute left="20" top="20" width="400" height="500">
            <web id="76" src="http://192.168.42.101/~aball/authenticated/" username="user" password="password" />
            <!-- <web id="76" src="http://192.168.42.101/~aball/" /> -->
            <!-- produces an error page -->
            <!-- <web id="76" src="invalid!" username="user" password="password" />  -->
            <!-- produces an error page, id different on purpose to distinguish this error (missing URL) from an invalid URL when testing -->
            <!-- <web id="77" username="user" password="password" /> -->
          </absolute>
        </screen>
      </screens>
      <groups>
        <group id="74" name="Default Group">
          <include type="screen" ref="75" />
        </group>
      </groups>
    </openremote>
    
    1. May 19, 2011

      Eric Bariaux says:

      I did add one feature to this yesterday, I made the web element a "sensory" one,...

      I did add one feature to this yesterday, I made the web element a "sensory" one, meaning a sensor can be linked to it. When it is, the value of the sensor is used to update the URL.
      At this stage, the username/password can't be updated, so the ones provided in the XML are always applied to any further request.

      1. May 23, 2011

        Andrew Ball says:

        Eric, would you give an example panel.xml for linking the URL to a sensor value?...

        Eric, would you give an example panel.xml for linking the URL to a sensor value? Perhaps relevant bits of controller.xml as well?

        Thanks,
        Andrew

        1. May 25, 2011

          Eric Bariaux says:

          On the panel.xml side, the web element just references the sensor, like this ...

          On the panel.xml side, the web element just references the sensor, like this

          <web id="2501" src="http://192.168.11.100:8080/beehive/rest/user/demo/graph/temp1?period=2011&amp;width=580&amp;height=360" username="demo" password="openremote">
            <link type="sensor" ref="10011"/>
          </web>
          

          On the controller.xml side, this can be any custom sensor, so something along those lines would do

            <sensors>
              <sensor id = "10011" name = "temperature" type = "custom">
                <include type="command" ref="9999"/>
              </sensor>
            </sensors>
          

          The string returned by the sensor is used "as is" as the URL to load.
          In the iOS code, I keep track of the last value and only reload if the sensor value is really different.
          This is because, on iOS at least, a change notification is posted each time a sensor returns from its polling (even if the value did not change), and the polling can happen at high frequency.

    2. Nov 02, 2011

      Rui Costa says:

      This is working on Android? Can you explain in detail how I can do it? I would l...

      This is working on Android? Can you explain in detail how I can do it? I would like to show on Openremote 4 IP cameras. I think the only way is with web panel, right? Anyone is implementing another way?

    3. Nov 02, 2011

      Rui Costa says:

      This is working on Android? Can you explain in detail how I can do it? I would l...

      This is working on Android? Can you explain in detail how I can do it? I would like to show on Openremote 4 IP cameras. I think the only way is with web panel, right? Anyone is implementing another way?

      1. Dec 01

        Mario says:

        I tried in controller.xml <sensor id="833" name="test" type="custom"> ...

        I tried in controller.xml

        <sensor id="833" name="test" type="custom">
        <include type="command" ref="892" />
        </sensor>

        an on panel side the following

        <web id="825" src="http://www.google.com?width=580&height=360">
        <link type="sensor" ref="833" />
        </web>

        There is only a wite page.

        Any ideas?

        1. Dec 07

          Mario says:

          Works! For Testing I always use the webconsole. After reading in Jira I checked,...

          Works! For Testing I always use the webconsole. After reading in Jira I checked, that it is not supported yet. In my Android Emulator everything works fine. Thanks for the awesome feature.

          1. Dec 22

            Rui Costa says:

            Good news. I will try it.

            Good news. I will try it.

            1. Feb 29

              Alexander Schwithal says:

              Does anyone know if the web element is supported under the current version of th...

              Does anyone know if the web element is supported under the current version of the webconsole?

              Thanks and good evening

              1. Mar 04

                Juha Lindfors says:

                No, not yet.

                No, not yet.

Adaptavist Theme Builder Powered by Atlassian Confluence
Free theme builder license