Webinos Logo

The Remote UI API

Webinos API Specifications

30 Aug 2012

Authors


Abstract

The webinos remoteUI API provides means to create and access a UI on a remote device using DOM manipulation commands.

Table of Contents

  1. Introduction
  2. Interfaces and Dictionaries
    1. Webinos
  3. Callbacks
    1. RemoteDOMSuccessCB
    2. RemoteDOMErrorCB
  4. Features
  5. Full WebIDL

Summary of Methods

Interface Method
Webinos void remoteDOM(RemoteDOMSuccessCB? successCallback, RemoteDOMErrorCB? errorCallback, DOMstring remoteComand)

Introduction

Any webinos device can offer access to its UI the same way any other service is offered. The access to the service is governed by policy settings on the local and remote device.

No direct access to remote object can and will be created. Basic values from the remote DOM can be retrieved, but not objects.

Interfaces and Dictionaries

Interface Webinos (partial interface)

Creates the webinos.remoteUI namespace..

WebIDL
         partial interface Webinos { 

        void remoteDOM(RemoteDOMSuccessCB? successCallback, RemoteDOMErrorCB? errorCallback, DOMstring remoteComand);
                
        };

On binding to the service, a window on the remote device is opened, which needs to be uniquely recognizeable as a window instantiated by a remote instance by having a specific frame and including information about which application on which device has opened it remotely. The purpose of this is to avoid remote programs being able to spoof the appearance of programs running locally on the device.

The window will show a textual/graphical presentation of the device that runs the widget and the iconic/text representation of the application using the window. Within the window, the access to the DOM 'document' element is restricted the document element of an iFrame. If the browser supports it, the iFrame should be instantiated with the 'sandbox' attribute.

The opened window on the remote device contains as named elements a head element with the id "head" and a body element with the id 'body".

Methods

remoteDOM

Sends a DOM manipulation command to the remote UI and evaluates (executes) it there.

Signature
void remoteDOM(RemoteDOMSuccessCB? successCallback, RemoteDOMErrorCB? errorCallback, DOMstring remoteComand);

Binding to a service creates an object that exposes the remoteDOM method, which takes, in addition to a success and error callback a DOMstring paramenter.

This string will be transmitted to the remote device and executed there, using the eval() method.

All remote DOM commands need to be individually and directly executable on the remote 'document' element.

Code example
 webinos.discovery.findServices(new ServiceType{api:'http://webinos.org/api/remoteUI'}, 
   {onFound: function (service) {
   remote_doc = service;   
  }});          
 remote_doc.remoteDOM("document.getElementById('body').appendChild((document.createElement('div'))).id='div-id';");
 remote_doc.remoteDOM("document.getElementById('div-id').appendChild(document.createElement('p')).id='p-id'; ");
 remote_doc.remoteDOM("document.getElementById('p-id').textContent =('You got mail!'); ");
               
Parameters
  • successCallback
    • Optional: No.
    • Nullable: Yes
    • Type: RemoteDOMSuccessCB
    • Description: Callback issued when successfully remote command was handled successfully
  • errorCallback
    • Optional: No.
    • Nullable: Yes
    • Type: RemoteDOMErrorCB
    • Description: Callback issued if an error occurs during issuing a remote command
  • remoteComand
    • Optional: No.
    • Nullable: No
    • Type: DOMstring
    • Description: The remore command to be evalated on the remote UI
Return value
void

Callbacks

RemoteDOMSuccessCB

Callback for successful DOM maniulation

WebIDL
        callback RemoteDOMSuccessCB = void (DOMString? retval);
Signature
void RemoteDOMSuccessCB(DOMString? retval);
Parameters
  • retval
    • Optional: No.
    • Nullable: Yes
    • Type: DOMString
    • Description: Basic type return value for any DOM call that returns a value on avaluation (such as getWidth()).

RemoteDOMErrorCB

Callback for failed DOM maniulation

WebIDL
        callback RemoteDOMErrorCB  = void (DOMError error);
Signature
void RemoteDOMErrorCB(DOMError error);
Parameters
  • error
    • Optional: No.
    • Nullable: No
    • Type: DOMError
    • Description: DOMErrorcontaining information about the error.

Features

This is the list of URIs used to declare this API's features, for use in the widget config.xml and as identifier for service type in service discovery functionality. For each URI, the list of functions covered is provided.

http://webinos.org/api/remoteUI

Full WebIDL

WebIDL
         partial interface Webinos { 

        void remoteDOM(RemoteDOMSuccessCB? successCallback, RemoteDOMErrorCB? errorCallback, DOMstring remoteComand);
                
        };


        

        callback RemoteDOMSuccessCB = void (DOMString? retval);
                        

        callback RemoteDOMErrorCB  = void (DOMError error);