Moderro Interactive Kiosk

Introduction

Introduction

Interactive Experience Platform includes two parts: Moderro Interactive Kiosk and Moderro Management Server. Moderro Interactive Kiosk can be configured and controlled remotely using iServices Management Server.

Moderro Interactive Kiosk is a a Linux-based device, which is designed to run feature rich HTML and JavaScript applications. The central part of its software is a specially designed embedded web browser. In contrast to regular desktop browsers, such as Mozilla Firefox or Google Chrome, this browser is not only a browser for HTML documents, but a platform for feature rich applications. This platform is tightly integrated with device’s hardware, its capabilities are far beyond the capabilities of regular desktop browsers. For example, in your HTML and JavaScript application you can easily implement a video conferencing or a communication with monitor, connected to the device via serial port.

We call our embedded browser Cobra.

In contrast to regular desktop browsers, Cobra has a lot of features to meet special needs of your applications. Cobra assumes a touch screen, operated with either fingers or stylus, can be connected to the device. Of cource, mouse and keyboard are supported also. From web application developer’s prospective those new features are represented by new JavaScript objects and functions, introduced by Cobra.

Notice on JavaScript

In contrast to statically typed programming languages like C and C++, in JavaScript there is no notation to describe functions and object protytypes. However, it is very helpful for developer to have such a description as a reference. In this manual we use IDL-like notation to describe JavaScript functions and object prototypes.

IDL-like declaration:
interface Factorial {
    readonly attribute int lastValue;

    int value(in int n) const;
}
                
As an example, listing above declares Factorial interface, which allows you to calculate n! with function value() and to get the last calculated value using lastValue read-only attribute.

Note 1. We say «object A implements interface B». However, if you try to call typeof() function for object A you will not see «B» as the result. The result will be «Object».

Signals and slots

Cobra introduces a new communication mechanism for JavaScript objects. It is called «signals and slots».
This mechanism came from Digia’s Qt library, which Cobra had been built upon.

Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Cobra’s JavaScript API.

In GUI programming, when we change one widget, we often want another widget to be notified. More generally, we want objects of any kind to be able to communicate with one another. For example, if a user clicks a «Close» button, we probably want the window’s close() method to be called.

A signal is emitted when a particular event occurs. Cobra’s JavaScript objects have many predefined signals. As an example of signal-slot mechanism usage network operations can be mentioned.

Since web applications are primarily related to network, the majority of new JavaScript objects, introduced by Cobra, are network-related as well. To allow web application to have a responsive user interface, all those new objects perform asynchronously. To support that asynchrony Cobra uses signals and slots.

Note 2. At first, you can think about signals like about JavaScript events with a different API, and about slots — like about JavaScript event handlers.

As we mentioned earlier, the notation we use to describe object prototypes is very close to IDL. In addition to IDL-like syntax we use «signals» and «slots» keywords to describe signals and slots.

Imagine we have a Clock JavaScript object, which implements the following interface.

Clock interface declaration:
interface Clock {
    readonly attribute Date timestamp;

signals:
    void tick();
}
                

This interface declares tick() signal, which is fired by the object every second. To use this signal in JavaScript you can write the following code.

Using Clock’s signal:
var clock;
...
function updateClock() {
    document.getElementById("textClock").innerHTML = clock.timestamp.toString();
}

function init() {
    clock.tick.connect(updateClock);
}
                

Assuming function init() is called when HTML document is loaded, that function connects tick() signal to updateClock() slot. As the result the innerHTML attribute of DOM element with «textClock» id will be changed to current timestamp every second.

Moderro Interactive Kiosk

System overview

Properties

Moderro Interactive Kiosk software is configured and controlled using properties. Property is similar to Microsoft Windows Registry item, but provides much more functionality. For example, in contrast to registry item, we have a very rich type system for our properties, we have an ability to subscribe to property changes, etc.

Software engineer declares property with some type. In contrast to other systems, we support virtually any type. It can be either an integral type (enumerate, integer, boolean, real, etc.) or a collection type (structure, list, map, hash, set, etc.) or even a composition of those types (list of structures, some field of the structure can be a map of integer and vector of string).

Property can be declared persistent, that means it can contain some configuration parameter for the application. At the same time that property can be used from another application to control or get information from the application, which owns the property. And the third, that property can be replicated to and from Moderro Management Server, and thus, provide a way to configure the application remotely.

The following diagram shows how two different applications («module 1» and «module 2») in device's firmware can communicate to each other using properties.

Figure 1

Moderro Interactive Kiosk

System overview

Management System

Moderro Management Server is an appliance. Its user interface is implemented as a web application. It does not require to install any software on administrator's computer.

Since we do not want to shock our potential administrator with a new and unusual concepts in our Management System, we decided to make its user interface metaphors as similar as possible to ones Microsoft Management Server uses. For example, we use domain, group, profile, policy and other metaphors, a Windows administrator is familiar with. If a potential administrator has an experience in MMS, that would help him (or her) a lot.

In order to make our Management System work, we require just an HTTPS access to it from the devices you want to control and from the administrators' computers.

In contrast to other management systems, we do not require the device and the management system to be in the same local network. That means your devices can be located behind firewalls. To support firewalls our management protocol is designed as a one way protocol. That means device always initiates the communication.

The management protocol is based on HTTPS, it consists of requests and responses. It is synchronous. In addition to HTTPS, our protocol uses a token-based device authentication algorithm to increase security. When device registers in the Management System, it receives a token from it. In every request device has to provide that token to be authenticated in the Management System. In every response the Management System sends a new token, which has to be used in the next device request.

Moderro Management Server supports different versions of device firmware at the same time.

You can easily integrate your existing systems with Moderro Management Server using a simple protocol, based on XML and HTTPS.

Moderro Interactive Kiosk

System overview

Management Protocol

The following diagram shows a successful startup scenario for device, which is registered in iServices Management Server.

Figure 2

Here is the list of requests the current revision (3) of management protocol supports.

Is available
Asks Management System if it is available. Management System can reply, that it is not available now, for example, if it is under a maintenance.
Is registered
Asks if the current device is registered in the Management System.
Register
Register the device in the Management System. To perform this request successfully device has to provide a name and a password of some user (registered in the Management System), who has a right to register devices.
Unregister
Unregister the device in the Management System. To perform this request successfully the device has to provide a name and a password of some user (registered in the Management System), who has a right to unregister devices.
Load device information
Loads device information (like device name, description, location) from the Management System.
Save device information
Saves device information to the Management System.
Load device profile
Load device's properties from the Management System.
Save device profile
Saves all device’s properties to the Management System.
Sync device profile
Synchronizes devices properties to the Management System.
Ping
Reports device status to the Management System.
Save events
Saves device events to the Management System.
Save screenshot
Saves device screenshot to the Management System.

Moderro Interactive Kiosk

System overview

Applications

The core application in our system is a web browser named Cobra. So, our applications are pretty much web applications.

In contrast to desktop browsers, it is not only a browser, but also an application environment. That means it contains a lot of features to meet some specific needs of your applications. For example, it allows you to control the device entirely. From a web application you can access any property of any application in the system, so, you have a full control over the device your application is running on.

In addition to that, you can easily control some peripheral devices connected to the system (like printers, web cameras, devices connected via serial port). For example, you can print some resource given by a URL (HTML page, PDF document or image) from your web application silently (no print dialog appears), set all the printing parameters for your printing job (paper size, resolution, etc.). You can easily control your TV via serial port implementing any proprietary TV control protocol in your web application. All those features are implemented asynchronously, so, you do not stop your web application animations or interactivity.

We also provide many specialized widgets to use in your web applications. Those widgets provide a functionality which is very hard if even possible to imlement in JavaScript. As an example, we have a videoplayer, which supports most of video and audio formats and codecs. In contrast to ’regular’ video players implemented as NP plugins, our widget has a very rich and easy to use JavaScript API, has some interesting features (like smart caching) other players lack. Another example is ticker widget, which can be implemented in JavaScript, but being implemented in C++ works much faster.

Moderro Interactive Kiosk

Features

Features

Security

Virus free environment.
Since Moderro Interactive Kiosk is a Linux-based device, it cannot be infected by viruses.

Read only file system.
All file systems, which contain device software, are read-only file systems. They even cannot be remounted in read-write mode. Because of that you can be sure the device software is not altered by some intruder. Device has two read-write file systems: one small to store settings, and another to store content cache. However, binary applications cannot be run from those file systems.

No 3rd party binary software.
Moderro Interactive Kiosk does not allow to run any 3rd party binary software on it. The only one type of applications is allowed — web applications (applications written using HTML and JavaScript). This kind of applications is totally controlled, they are executing in browser’s security sandbox.

Appllication development

APIs.
Since Moderro Interactive Kiosk can run web applications only. However, in contrast to regular desktop web browsers, Moderro Interactive Kiosk provides a lot of proprietary APIs to create feature rich applications. Those APIs allow applications to communicate with various types of devices, such as cameras, printers, scanners, barcode scanners, credit card scanners, etc. It is even possible to control some device via a serial port from your web application.

Feature rich widgets.
In addition to APIs Moderro Interactive Kiosk provides a lot of visual components to enhance the capabilities of your application. As an example PDF viewer or video player can be mentioned. In contrast to regular way to view PDF documents or play video in desktop web applications, you will be able to have an absolute control over those parts of your application. For example, you can open a PDF document on any page, turn over the pages, print any page, etc. You cannot do that with a regular PDF reader plug-in in your desktop browser.

Touch screens support.
Moderro Interactive Kiosk supports a wide variety of touch screens.

Dual head support.
Moderro Interactive Kiosk can work with two monitors at the same time.

Voice over IP support.
Moderro Interactive Kiosk supports IP telephony based on Session Initiation Protocol (SIP), it is compatible with Cisco VoIP products, such as Cisco Unified Communications Manager (CUCM).

Video conference support.
Moderro Interactive Kiosk applications can easily utilize its video conferencing capabilities.

Third party systems integration

Moderro Interactive Kiosk is a system, you can easily integrate your existing systems with. We provide a simple and well documented XML-based API to control the device. For security reasons this feature is turned off by default.

JavaScript injection

This feature allows to incorporate JavaScript code into an alien web page. This feature gives a way to modify existing web content to better fit in the curernt application environment. As an example, if you want to show some web site as a part of your application in iframe, and that alien web site contains come controls to do search, you can remove those controls with JavaScript injection.

To turn this feature on you must set two properties:

  • browser.content.javascript.injection.enabled property must be set to true.
  • browser.content.javascript.injection.rules must contain injection rules.
The second property is a map with URL wildcard as a key and JavaScript code as a value. Both properties are runtime properties, so, you are able to change their values inside your application, and those changes become effective immediately.

With this feature turned on when Cobra loads some URL, it checkes that URL against injection rules. If some rule matches, Cobra executes the correspondent JavaScript code from the rule for the current window object. If multiple rules match, all the code from all those matched rules will be execued.

Note 1. Cobra’s global JavaScript objects are registered before any injection, so, you are able to use them in the injected code.

User-Agent rules

This feature allows to fake User-Agent field in HTTP headers of browser’s requests.

To turn this feature on you must set two properties:

  • browser.content.useragent.rules.enabled property must be set to true.
  • browser.content.useragent.rules must contain rules.
The second property is a map with URL wildcard as a key and User-Agent string as a value. Both properties are runtime properties, so, you are able to change their values inside your application, and those changes become effective immediately.

With this feature turned on when Cobra loads some URL, it checkes that URL against User-Agent rules. If some rule matches, Cobra uses the correspondent string as the User-Agent for the HTTP request. If multiple rules match, the first matched rule will be used.

Content caching

When you develop an application, which has to be usable when you do not have a good network bandwidth, content caching becomes a very important feature.

Regular desktop browsers do not give your application an ability to fully control content caching. In Cobra we have special APIs to control content caching.

We distinguish regular web content like HTML documents, JavaScript code, CSS code, images, etc. from media content like video and audio files. We provide two different APIs to control caching for both types of content (see sections global.networkCache and global.mediaCache).

Widgets

Plugins API

Plugins API

In addition to «regular» plugins (like Adobe Flash Player) Cobra provides several proprietary widgets (plugins) to simplify developer’s life. Those widgets can be configured and controlled from JavaScript.

Note 1. For historical reasons we use terms «widget» and «plugin» in this manual simultaneously. Those terms reference the same essence.

The next section describes particular plugin APIs. In addition to API, described in a particular section, every plugin inherits the following interface (i.e. contains all the members, mentioned in that interface).

Interface implementation:
interface Plugin {
    readonly attribute int status;
signals:
    void statusChanged(in int status);
    void ready();
    void error(in string message);
}
                
status
Contains current plugin status. 0 means it’s ready to be used, 1 means it’s in progress (usualy it means the initialization process in not finished yet), and 2 means error.
statusChanged()
Fires when plugin’s status is changed.
ready()
Fires when plugin becomes ready, i.e. its status changed to 0.
error()
Fires when error occurs, i.e. plugin’s status changed to 2. message contains error message.

The good practice is to always check plugin’s status before you use it. It’s especially important when you use network-related plugins (which load their content from network), because those plugins perform asynchronously.

Widgets

Plugins Reference

videoplayer

videoplayer plugin allows you to play video in your application. It supports the majority of modern video and audio formats and codecs. It also allows you to use various transport protocols for your video (such as HTTP, RTSP, MMS, etc.).

This plugin also provides a minimal user interface to control video playback and volume. That user interface can be turned off, however.

Listing 3.2 declares videoplayer JavaScript API.

Interface declaration:
interface VideoPlayer {
	attribute bool safeMode;
	attribute string url;
	attribute bool autoPlay;
	attribute bool loop;
	attribute int volume;
	attribute bool isMuted;
	attribute double speed;
	attribute double position;
	readonly attribute long long length;
	attribute long long time;
	readonly attribute bool isPlaying;
	readonly attribute bool isTrickPlaying;
	attribute bool isPaused;
	readonly attribute bool isSeekable;
	attribute bool isFullScreen;
	readonly attribute int subtitlesCount;
	readonly attribute map<string, string> subtitlesMap;
	attribute int subtitle;
	readonly attribute string errorString;
    
parameters:
	bool safeMode;
	bool autoPlay;
	bool loop;
	int volume;
	bool muted;
	int fileCaching;
	int networkCaching;
	bool hwAcceleration;
	string deinterlacing;
	int fontSize;
	string url;
	string path;

slots:
	int play(in string url);
	int pause();
	int resume();
	int stop();
	void setSubtitle (in int subtitle);
	void fastForward (in double rate=10.0, in int frameDisplayTime = 500);
	void rewind (in double rate=10.0, in int frameDisplayTime = 500);
	
signals:
	void opening();
	void buffering();
	void started();
	void paused();
	void resumed();
	void stopped();
	void endReached();
	void error();
	
	void volumeChanged(in int volume);
	void muted(in bool muted);
	void seekableChanged(in bool seekable);
	void fullScreenMode(in bool enabled);
}
                
length
Current media length in milliseconds.
time
Current media time in milliseconds.
subtitlesCount
Number of subtitle tracks.
subtitlesMap
An associative array with a subtitle's id as a key, and a subtitle's description as a value. Please remember that the id is passed as a string, use parseInt() to convert it to an integer. The array is not sorted by key.
subtitle
Current subtitle track.
isTrickPlaying
true if fast forward or rewind is in progress.
safeMode
If true, the videoplayer object will recreate internal video object every time it starts playing.
autoPlay
Start playing automatically.
loop
Whether to loop video playing.
volume
Volume level, from 0 to 100.
muted
Start in muted state.
fileCaching
File caching in milliseconds.
networkCaching
Network caching in milliseconds.
hwAcceleration
Whether to use hardware acceleration.
deinterlacing
Deinterlacing mode. If auto, video player will try to deinterlace the video if it's interlaced. If on, deinterlacing is enforced. If off, deinterlacing is off.
fontSize
Font size for subtitles.
url
URL to play.
path
Local file path to play. If URL is not empty, this parameter is ignored.
fastForward
Start fast forward playback. rate defines forwarding speed. As an example if rate == 10.0 that means it will be forwarding ten times faster than the regular playback. rate must be greater than 1. During the fast forwarding the player displays separate frames instead of contiguous video. frameDisplayTime defines how many milliseconds every frame will be showed. frameDisplayTime must be greater or equal to 100. Otherwise 100 milliseconds will be used as its value.
rewind
Start rewind playback. rate defines rewinding speed. As an example if rate == 10.0 that means it will be rewinding ten times faster than the regular playback. rate must be greater than 1. During the fast forwarding the player displays separate frames instead of contiguous video. frameDisplayTime defines how many milliseconds every frame will be showed. frameDisplayTime must be greater or equal to 100. Otherwise 100 milliseconds will be used as its value.

Note 1. isFullScreen must be used before video playback is started; otherwise it will only take effect after playback stop and restart.

Note 2. Due to some technical reasons you cannot use file:// URL in <param> tag of videoplayer object. Instead you have to set its url attribute at run time.

Note 3. When fast forward or rewind is in progress, and player hits the movie end or beginning endReached() signal fires.

Change log:
       
Aug-26-2015 safeMode added  
  autoPlay added  
  loop added  
  volume added  
  muted added  
  fileCaching added  
  networkCaching added  
  hwAcceleration added  
  deinterlacing added  
  fontSize added  
  url added  
  path added  
Mar-25-2015 fastForward changed  
  rewind changed  
Mar-14-2015 isTrickPlaying added  
  fastForward added  
  rewind added  
Feb-20-2015 speed added  
Nov-13-2013 controlsVisible removed  
  progressIndicatorVisible removed  

Widgets

Plugins Reference

pdfviewer

Interface declaration:
interface PdfViewer {
	attribute string url;
	attribute int dpi;
	attribute bool controlsVisible;
	attribute bool pageNumberVisible;
	attribute int pageNumber;
	readonly attribute int numberOfPages;
    
methods:
	int next();
	int previous();

parameters:
	string url;
    
signals:
	void loadStarted();
	void loadFinished(in bool ok);
}
                
url
URL pointing to a PDF document.
Change log:
       
Aug-26-2015 url added  

Widgets

Plugins Reference

webclip

webclip plugin is inspired by Mac OS X dashboard plugin with the same name. This plugin allows you to include an other web site elements to your web application. Only what you need to know to do that is the web site URL and the CSS selector, which addresses the alien element you want to include.

Interface declaration:
interface WebClip {
    readonly attribute string url;
    readonly attribute string selector;
    attribute int reloadInterval; // In seconds.
    
parameters:
    int reloadInterval;
    int timeout;
    string url;
    string selector;

slots:
    void load();
}
                
Change log:
       
Aug-26-2015 reloadInterval added  
  timeout added  
  url added  
  selector added  

Widgets

Plugins Reference

camera

camera plugin allows you to access a USB web camera connected to the Kiosk. This plugin allows you to make shots and get those shots as JPEG images. It is highly recommended to use UVC camera.

Note 1. Please remember that camera hot plugging is supported by the application, but hot unplugging is not.

Interface declaration:
interface Camera {
    readonly attribute string errorString;
    readonly attribute string toJpeg;
    readonly attribute bool ready;
    attribute bool controlsVisible;
    attribute int delay;
    attribute string cameraDevice;
    readonly attribute int camerasFound;

parameters:
    string cameraDevice;
    int delay;
    bool constrolsVisible;

slots:
    void discover();
    void shoot();
    void setEnabled(in bool enabled);

signals:
    void captured();
    void error();
    void discovered(in int numberOfCameras);
    void discovered();
}
                
cameraDevice
Specifies the system device associated with the selected camera. Use global.system.webCameras to get the map with the found cameras and their associated devices.
camerasFound
The number of found cameras. Deprecated, use global.system.webCameras instead.
cameraDevice
Lowlevel device to use for this camera object.
delay
Delay in seconds before shooting.
constrolsVisible
Show controls.
discover()
Discover cameras. Deprecated, use global.system.webCameras instead.
Change log:
       
Aug-26-2015 cameraDevice added  
  delay added  
  constrolsVisible added  
Jul-06-2014 cameraDevice deprecated  
  camerasFound deprecated  
  discover() deprecated  

Widgets

Plugins Reference

remotedesktop

Interface declaration:
interface RemoteDesktop{
	readonly attribute bool isConnected;
	attribute bool interactive;

methods:
	void connectToHost(in string host, in int port, in string password, in bool interactive = true, in string serverPublicKey = "");
	void disconnect();
	string errorString(in int code);

signals:
	void error(in int code);
	void connected();
	void disconnected();
}
                
interactive
Whether the user can control the remote desktop with mouse and keyboard. Please remember that even if interactive is true, the server can decline the user activity events.
connectToHost
Connect to the given host and port with the given password. If serverPublicKey is not empty it will be compared to the public key of the server. If it does not match, connection won't be established. serverPublicKey must be generated using RSA algorithm and encoded in PEM format.
disconnect
Disconnect from the host.
errorString
Returns the error description.

Note. This plugin uses a proprietary protocol and is compatible with Remote Desktop Server only.

Widgets

Plugins Reference

ticker

ticker plugin allows you to create a ticker displaying a scrolling text.

Interface declaration:
interface Ticker {
    attribute string text;
    attribute int fontSize;
    attribute string fontFamily;
    attribute bool fontBold;
    attribute bool fontItalic;
    attribute string backgroundImage;
    attribute string backgroundColor;
    attribute string textColor;
    attribute string direction;
    attribute int speed;

parameters:
    string text;
    int fontSize;
    string fontFamily;
    bool fontBold;
    bool fontItalic;
    string backgroundImage;
    string backgroundColor;
    string textColor;
    string direction;
    int speed;
}
                
property
Description.
property
Description.
text
Text to display
.
fontSize
Font size
.
fontFamily
Font family
.
fontBold
If font is bold
.
fontItalic
If font is italic
.
backgroundImage
Background image as a pure BASE64 data (without data: HTML prefix)
.
backgroundColor
Background color
.
textColor
Text color in format #RRGGBB
.
direction
Scrolling direction. Possible values: LeftToRight, RightToLeft, TopToBottom, BottomToTop
.
speed
Scrolling speed. Possible values: 1 to 12
.
Change log:
       
Aug-26-2015 text added  
  fontSize added  
  fontFamily added  
  fontBold added  
  fontItalic added  
  backgroundImage added  
  backgroundColor added  
  textColor added  
  direction added  
  speed added  

Widgets

Plugins Reference

vncviewer

vncviewer provides a VNC viewer in a form of browser widget.

Interface declaration:
interface VncViewer {
    readonly attribute int port;
    readonly attribute bool isConnected;
    attribute bool readOnly;
    attribute bool scalingEnabled;

methods:
    bool connect(in string host, in int port, in string password = "");

parameters:
    string host;
    int port;
    bool autostart;
    bool scale;
    bool readonly;
    string password;

slots:
    void disconnect();

signals:
    void connected();
    void disconnected();
    void error(in string message);
}
                
port
Specifies port number where the viewer is connecting to. Default value is 5900.
readOnly
Specifies if the viewer accepts any user input.
connect(in string host, in int port, in string password)
Connects to a VNC server running at host host and listening port port. Note, that this method accepts a port, not a display number.
isConnected
Returns true if the viewer is connected to some VNC server.
host
Host to connect to.
port
Port to connect to.
autostart
Start connection immediately.
scale
Scaling factor.
readonly
If controls are disabled.
password
Password if connection is protected.
disconnect()
Closes the connection to VNC server.
connected()
Fired when a connection to some VNC server is established. This signal fires both for active and listening mode.
disconnected()
Fired when the connection to VNC server brakes.
error(in string message)
Fires when some error occurs.
Change log:
       
Aug-26-2015 host added  
  port added  
  autostart added  
  scale added  
  readonly added  
  password added  

Widgets

Plugins Reference

sipphone

sipphone widget allows you to make SIP phone calls to another SIP endpoint. This plug-in acts like a True Sip endpoint and supports both audio and video calls. Both SD (g711) and HD (g7221) audio codecs are supported. For video, it supports H.263 and H.264 codecs.

Interface declaration:

interface SipPhone {
    attribute int height;
    attribute int width;
    attribute string backgroundColor;
    attribute string idleImage;
    attribute bool videoEnabled; // Is true by default
    attribute string status;

parameters:
    int width;
    int height;
    int backgroundColor;
    string camera;
    string resolution;
    string bitrate;
    string fps;

slots:
    int start(in string username,
    in string password,
    in string domain,
    in string transport);
    
    void call(in string sipUri, in bool withVideo);
    void hangup();
    void sendDtmf(in string dtmfkey);
    bool setidleImage(in string imgurl, in bool stretchFlag);
    bool changeidleImage(in string imgurl, in bool stretchFlag);
    bool addVideoToCall(in bool videoFlag);
    bool enableAudibleTones(in bool toneFlag);
    string cameraDevice() const;
    int setCameraDevice(in string deviceId);
    int capture() const;
    string getImage() const; // Returns the Jpeg imgage if captured
    string callerId() const;
    
    void answer();
    void reject();
    void setAutoAnswer(in bool autoAnswerFlag);


signals:
    void ready();
    void registered();
    void placingCall();
    void incomingCall();
    void established();
    void ring();
    void disconnected();
    void video();
    void novideo();
    void hold();
    void resume();
    void captured();
    void error(in int code, in string explanation)
}

                
width
This defines the Width for the Sip Widget.
height
This defines the Height for the Sip Widget.
backgroundColor
This defines Backgroundcolor of Widget.
camera
Use this to specify what USB Webcam to use. This should be in the Unix Device format like /dev/video0.
resolution
This parameter could be used when you want Sip Widget to send the video at the specified resolution. Please note, if you choose higher resolution like 1280x720 or 1920x1080 then the CPU utilization will shoot up. Also note that the resolution should be in the format of WxH. If the WxH is not in the Aspect binding ratio, SipPhone will try to match the video encode to the closest possible resolution.
bitrate
Using this parameter you can specify what should be the minimum Bitrate Sip Widget should use when sending the encoded frame.
fps
Using this parameter you can specify what should be the minimum fps (Frames Per Second) that the video should be captured for encode.
start(in string username, in string password, in string domain, in string transport)
This method call is to be used to set the SIP Credentials that is needed to get registered with the SIP Registrar (or Call manager). The needed credentials are, User name, Password, Domain (IP Address or Domain Name of the SIP Registrar) and the transport to be used (UDP or TCP).
call(in string sipUri, in bool withVideo)
This method should be used only after the start() method is called. This method initates the call to the sipUri (Called party). The second parameter is optional. By default it is true, which means if you do not specifiy the parameter it will make a Video call. By making the second argument as false, you can achieve Audio Only Call
hangup()
This method, when called, disconnects the existing call.
sendDtmf(in string dtmfkey)
This method should be used to send DTMF tones to be sent to SIP Proxy. Valid Keys are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, * and #.
setidleImage(in string imgUrl, in bool stretchFlag)
This method can be used to display an image, like logo or some graphic when the SIP Widget is Registered and not in a call. This method provides a mechanism for the widget to display an image when it is not in a Call. The parameters are imgUrl, the URL for the image to be displayed, stretchFlag, which indicates whether to auto-resize or not the image to the given Frame.
changeidleImage(in string imgUrl, bool stretchFlag)
This method is similar in functionality to setidleImage. You could use this method to change the appearance of the widget like coding it in a Javascript to change the idleimage to create the sense of screen saver for the widget.
addVideoToCall(in bool videoFlag)
This method enables to either add or remove the video stream from an existing video call. The pre-requisite is that the call should be negotiated as a video call. Call this function with a true to enable the video stream in the call. Call this function with videoFlag as False to disable the video stream from the video call. By default, video stream is enabled.
enableAudibleTones(in bool toneFlag)
If you would like to enable default audible alerts for all the call events then call this API with a true parameter. By default audible alerts are aisabled.
cameraDevice()
This method returns the Currently Configured Webcam that is being used by the SIP Widget. The value returned would be in the UNIX format like /dev/video0.
setCameraDevice()
Use this method to Let the SIP Widget know what Webcam to use to place the call. You need to call this API with UNIX format identifier for Camera, like /dev/video0 or /dev/video1.
Note: Call this API before start() Method in the Javascript.
capture()
Use this method to Initiate taking a still image when the Video call is in progress. This is useful if you would like to take a snapshot of say the participant and save it for future. Caution: Call this routine only when there is an Active Video Call.
getImage()
Call this method after you have recieved captured() signal. When called, this routine returns base64 content of the JPEG image captured.
callerId()
Call this method to retrieve the Calling Party Identity When you recieve incoming() signal. When called, this routine returns the called party address as string.
answer()
Accepts incoming call.
reject()
Reject incoming call.
setAutoAnswer(in bool autoAnswerFlag)
Enables auto answer mode if autoAnswerFlag is true.
ready()
This Signal is indicative that Values given for initializing the sipphone is accepted.
registered()
This Signal means that the sipphone is now registered with the SIP Registrar (or Call Manager) and you can make/receive calls from the widget.
placingCall()
This Signal means the widget is trying to place the call to the Called party of interest.
incomingCall()
This Signal means the widget is receiving an Incoming Call request from another SIP peer.
established()
This Signal is indicative that the Call is in progress.
ring()
This Signal means that the Called party has been notified about the incoming call.
disconnected()
This Signal means that the Call has been terminated.
video()
This Signal means that the Call was negotiated as a video call and the remote site video is available to display.
novideo()
This Signal means that the Call that was negotiated does not have video being sent by the remote end. The Application can use video/novideo signal to better the User experience like showing some Please wait message or something in those lines.
hold()
This Signal means that the Remote party has put the Call on Hold.
resume()
This Signal means that the Remote party has Resumed the Call.
captured()
This Signal is fired when User action of taking a still snapshot of an video call is successfuly finished. Once this Signal is fired the Application can call getImage() to get the Captured Image (as JPEG image).
error(in int code, in string explanation)
This Signal is indicative of any errors whilst the widget operation. The signal has a code and an explanation about what was the error that was encountered.

Error codes:
  • 404 : No answer
  • 401 : Registration failed
  • 485 : User busy
  • 494 : User not found
  • 486 : Call manager not able to route call
  • 503 : Service unavailable
Change log:
       
Aug-26-2015 width added  
  height added  
  backgroundColor added  
  camera added  
  resolution added  
  bitrate added  
  fps added  
Jul-18-2015 callerId() added  
Jan-14-2015 getImage() added  
  getImage removed  
Jan-12-2015 getImage added  
  capture() added  
  captured() added  
Sep-11-2014 cameraDevice() added  
  setCameraDevice() added  
Feb-6-2014 video() added  
  novideo() added  
  hold() added  
  resume() added  
  answer() added  
  reject() added  
  setAutoAnswer() added  
Nov-17-2013 sendDtmf() added  

Widgets

Plugins Reference

jcf

jcf is the Native implementation of Cisco Jabber Client Framework. This widget is similar in functionality to the sipphone, except that JCF is Cisco Proprietry implementation. This plugin enables the Application to behave like a Feature Rich SIP endpoint and supports a wide range of Audio and Video Codecs. They include g711, g722, g722.1, g729 for Audio and H.264, H.263 and H.261 for Video Codecs. The Cisco OpenH.264 implementation which cisco has opened up for general public consumption is feature rich and is compatible with most H.264 decoders. If you have a deployment that uses lots of Cisco Endpoints, then it is recommend to use this Widget instead of the sipphone widget.

Interface declaration:
interface Jcf
{
    attribute string status;
    attribute string idleImage;

parameters:

    string camera;

slots:

    int start (in string domain,
               in string username,
               in string password,
               in string tftpAddr);
    void call(in string sipUri,
              in bool withVideo);
    void hangup();
    int callHold();
    int callResume();
    int setVolume(in int vol);
    int mute();
    int unmute();
    bool isRegistered();
    void sendDtmf(in string dtmfkey);
    string cameraDevice();
    int setCameraDevice(in string cameraName);
    int answer(in bool videoFlag);
    int reject();
    bool setidleImage(in string imgurl, in bool stretchFlag);
    bool changeidleImage(in string imgurl, in bool stretchFlag);
    bool addVideoToCall(in bool videoFlag);

signals:

    void idle();
    void incomingCall(in string peer);
    void placingCall();
    void ring();
    void trying();
    void established();
    void disconnected();
    void registered();
    void telemetry(in string callStats);
    void hold();
    void resume();
    void novideo();
    void video();
    void error(in int code, in string message);
};
                
camera
Use this to specify what camera to be used. This should be the Camera Name.
start(in string domain, in string username, in string password)
This method call is to be used to register with the CUCM specified by the variable domain either as an IP address or as a FQDN. The credentials will be used to register ourself as a Cisco Endpoint with the UCM.
call(in string sipUri, in bool withVideo)
This method should be used only after the start(...) method is called. This method initiates the call to the sipUri (Called party). The Second Parameter is Optional. By default it is True, which means if you do not specifiy the parameter it will make a Video call. By making the second Argument as False, you can achieve Audio Only Call.
hangup()
This method, when called, disconnects the existing call.
callHold()
This method, when called, will Hold the Call. Till callResume() is called, the call (the other party) will be in the Hold state.
callResume()
This method, when called, will Resume an Already Held Call.
setVolume(in int vol)
Use this method, to set the Volume of the Application. One big advantage of Jcf over Sipphone is that Jcf provides Application level Volume control. This API could be used to control the volume.
mute()
This method, when called, will Mute the Microphone and will not transmit any Audio Data out.
unmute()
This method, when called, will Un-Mute the Microphone and will start transmitting the Audio Data to the other end.
isRegistered()
This method, when called, returns Boolean True or False based on the endpoint is Registered or Not respectively.
sendDtmf(in string dtmfkey)
This method, when called with the Numeric 0-9,* or # will transmit them as RFC2833 to the other end.
cameraDevice()
This method, when called returns the Existing CameraDevices.
setCameraDevice(in string cameraName)
This method, when called, instructs Jcf to use the camera specified by the cameraName.
answer(in bool withVideo)
Use this method to Accept an Incoming call. The withVideo parameter is an optional parameter. By default it is set to True. If you would like to answer an incoming call with Audio only, call this method with false as the value.
reject()
Use this method if you would like to reject the Incoming Call.
setidleImage(in string imgUrl, in bool stretchFlag)
This method can be used to display an image, like logo or some graphic when the SIP Widget is Registered and not in a call. This method provides a mechanism for the widget to display an image when it is not in a Call. The parameters are imgUrl, the URL for the image to be displayed, stretchFlag, which indicates whether to auto-resize or not the image to the given Frame.
changeidleImage(in string imgUrl, in bool stretchFlag)
This method is similar in functionality tosetidleImage. You could use this method to change the appearance of the widget like coding it in a JavaScript to change the idleimage to create the sense of screen saver for the widget.
addVideoToCall(in bool videoFlag)
This method enables to either Add or Remove the Video stream from an Existing Video Call. The pre-requisite is that the Call should be negotiated as a Video call. Call this function with a True to enable the Video Stream in the call. Call this function with videoFlag as False to disable the Video Stream from the video call. By Default, Video stream is enabled.
ready()
This Signal is indicative that Values given for initializing the sipphone is accepted.
registered()
This Signal means that the sipphone is now registered with the SIP Registrar (or Call Manager) and you can make/receive calls from the widget.
placingCall()
This Signal means the widget is trying to place the call to the Called party of interest.
incomingCall()
This Signal means the widget is receiving an Incoming Call request from another SIP peer.
established()
This Signal is indicative that the Call is in progress.
ring()
This Signal means that the Called party has been notified about the incoming call.
disconnected()
This Signal means that the Call has been terminated.
telemetry(in string callStats)
This Signal contain the Call details about the recently diconnected call. Use this to display as regular Telemetry data.
video()
This Signal means that the Call was negotiated as a video call and the remote site video is available to display.
novideo()
This Signal means that the Call that was negotiated does not have video being sent by the remote end. The Application can use video/novideo signal to better the User experience like showing some Please wait message or something in those lines.
hold()
This Signal means that the Remote party has put the Call on Hold.
resume()
This Signal means that the Remote party has Resumed the Call.
error(in int code, in string explanation)
This Signal is indicative of any errors whilst the widget operation. The signal has a code and an explanation about what was the error that was encountered.
Change log:
       
May-18-2016 width changed  
May-01-2016 camera added  
  start() added  
  call() added  
  hangup() added  
  callHold() added  
  callResume() added  
  setVolume() added  
  mute() added  
  unmute() added  
  isRegistered() added  
  sendDtmf() added  
  cameraDevice() added  
  answer() added  
  reject() added  
  setidleImage() added  
  changeidleImage() added  
  addVideoToCall() added  
  ready() added  
  registered() added  
  placingCall() added  
  incomingCall() added  
  established() added  
  ring() added  
  disconnected() added  
  telemetry() added  
  video() added  
  novideo() added  
  hold() added  
  resume() added  
  error() added  

Widgets

Plugins Reference

webbrowser

webbrowser is an alternative of iframe HTML element. In contrast to iframe, it allows to completely control the web document loaded in it and does not obey the same origin policy.

Interface declaration:
interface WebBrowser {
    attribute string url;
    attribute bool navigationPanelVisible;
    attribute bool titlePanelVisible;
    attribute double zoomFactor;

parameters:
    string url;
    bool navigationPanelVisible;
    bool titlePanelVisible;
    double zoomFactor;

public slots:
    variant evaluateJavaScript(in string scriptSource);

signals:
    void loadStarted();
    void loadFinished(in bool ok);
    void loadProgress(in int percent);
    void urlChanged(in string url);
    void linkClicked(in string url);
    void titleChanged(in string title);
}

				
property
Description.
property
Description.
url
URL to display.
navigationPanelVisible
If navigation panel is visible.
titlePanelVisible
If title is visible.
zoomFactor
Zoom factor, 1.0 by default.
Change log:
       
Aug-26-2015 url added  
  navigationPanelVisible added  
  titlePanelVisible added  
May-26-2014 zoomFactor added  

JavaScript global objects

JavaScript global objects

In addition to standard JavaScript global objects (such as window or document) Cobra provides several non-standard global objects to allow web applications to be better integrated with the Moderro Interactive Kiosk. Those objects implement functionality which is not available in a regular browser’s JavaScript.

Javascript Global Objects

Reference

global.device

It is possible to obtain some general device-related information using global.device global object.

Interface implementation:
interface Device{
    readonly attribute string name;
    readonly attribute string description;
    readonly attribute string product;
    readonly attribute string family;
    readonly attribute string model;
    readonly attribute string version;
    readonly attribute string versionSystem;
    readonly attribute string versionApplications;
    readonly attribute string location;
    readonly attribute string serialNumber;
    readonly attribute string licenseKey;
    readonly attribute bool licenseValid;
    readonly attribute string buildTimestamp;
    readonly attribute string buildTimestampSystem;
    readonly attribute string buildTimestampApplications;
}
                
name
Device name.
description
Device description. Can contain any text, supplied by administrator.
product
Product name.
family
Family name. Family name specifies device hardware in general, so, you can use model name to make assumptions about device capabilities.
model
Model name. Model name detalizes device hardware, i.e. how much memory it has.
version
Device firmware version.
versionSystem
Device system firmware version.
versionApplications
Device applications firmware version.
location
Device location. Contains text supplied by administrator.
serialNumber
Device serial number.
licenseKey
Device license key.
licenseValid
Returns true if the license key is valid and false otherwise.
buildTimestamp
Firmware build time stamp in human-readable form.
buildTimestampSystem
System firmware build time stamp in human-readable form.
buildTimestampApplications
Applications firmware build time stamp in human-readable form.

Javascript Global Objects

Reference

global.bus

Unidirectional bus to communicate with other Cobra instances. This object implements Bus interface.

Interface implementation:
interface Bus {
    void send(in object obj) const;
    bool haveOtherInstances() const;

signals:
    void received(in object obj);
}
                
send()
Sends the given object to other Cobra instances. The object itself can represent simple types (integers, strings, etc.) as well as complex types like associative arrays.
haveOtherInstances()
Returns true if there are other Cobra instances that can recieve events.
received()
Fires when an event has arrived from another Cobra instance.

Javascript Global Objects

Reference

global.system

Interface implementation:
interface System {
    readonly attribute int screen;
    readonly attribute int masterScreen;
    readonly attribute list<string> usbDevices;
    readonly attribute list<string, string> webCameras	;
    attribute int idleTimeout;
    
    string envVariable(in string name) const;
    int setEnvVariable(in string name,
                        in string value,
                        in bool overwrite = true);
    int unsetEnvVariable(in string name);
    Screenshot screenshot(in int width, in int height);
    
    void debug(in string message) const;
    void info(in string message) const;
    void warning(in string message) const;
    void error(in string message) const;
    
    void moveMouse(in int x, in int y) const;
    void mouseClick(in int button = 0) const;

signals:
    void mouseDoubleClicked(in int x, in int y, in int button);
    void mouseMoved(in int x, in int y, in int button);
    void mousePressed(in int x, in int y, in int button);
    void mouseReleased(in int x, in int y, in int button);
    void mouseWheelRotated(in int x, in int y, in int button);
    void idle();
    void usbConnected(in string idAndName);
    void usbDisconnected(in string idAndName);
    void goingdown();
}
                
screen
Returns screen number the browser started on. Using this value web application can show different content on different monitors.
masterScreen
Returns the number of screen showed on the master display.
usbDevices
Contains the list of the connected USB devies. Each string has the following format: "<ID1>:<ID2> <NAME>", for example "0000:1111 Company Ltd. Optical Mouse". See http://www.linux-usb.org/usb-ids.html for more about ID1 and ID2.
webCameras
Contains the map of the connected web cameras. Each entry has a camera device as a key, and the camera name as a value.
idleTimeout
Contains timeout in seconds. After that time of user inactivity idle() signal fires. Default value is 5.
envVariable()
Returns value of environment variable name or empty string if there is no a variable with that name.
setEnvVariable()
Adds the variable name to the environment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is true; if overwrite is false, then the value of name is not changed. Returns zero on success, or -1 on error.
unsetEnvVariable()
Deletes the variable name from the environment. If name does not exist in the environment, then the method succeeds, and the environment is unchanged. Returns zero on success, or -1 on error.
screenshot()
Takes screenshot and scales it to width by height size with respect of aspect ratio.
debug()
Sends debug message to syslog and to event system.
info()
Sends info message to syslog and to event system.
warning()
Sends warning message to syslog and to event system.
error()
Sends error message to syslog and to event system.
moveMouse()
Move the mouse cursor to the specified global position.
mouseClick()
Simulate the mouse button click. If button is 0 (the default) the left button is simulated, and the right otherwise.
mouseDoubleClicked()
Fires when some mouse button is double clicked.
mouseMoved()
Fires when mouse is moving.
mousePressed()
Fires when some mouse button is pressed.
mouseReleased()
Fires when some mouse button is released.
mouseWheelRotated()
Fires when mouse wheel is rotated.
idle()
Fires when system is in idle state (no user interaction).
usbConnected()
Fires when USB device is connected. The string parameter has the following format: "<ID1>:<ID2> <NAME>", for example "0000:1111 Company Ltd. Optical Mouse". See http://www.linux-usb.org/usb-ids.html for more about ID1 and ID2. Please remember that all the existing USB devices will fire this signal during application startup, so if you have 5 USB devices connected you will get 5 usbConnected() signals with ids of that devices during application startup.
usbDisconnected()
Fires when USB device is disconnected. The string parameter has the following format: "<ID1>:<ID2> <NAME>", for example "0000:1111 Company Ltd. Optical Mouse". See http://www.linux-usb.org/usb-ids.html for more about ID1 and ID2.
goingdown()
Fires when system is going to reboot or power off.

Note 1. screenshot() returns object, which implements Screenshot interface:

interface Screenshot {
    readonly attribute int width;
    readonly attribute int height;
    readonly attribute string base64Data;
}
                        
width
Screenshot width.
height
Screenshot height.
base64Data
Screenshot data as a base64-encoded PNG image.
Change log:
       
Jul-28-2014 goingdown() added  
Jul-17-2014 screenshot() changed  
Jul-06-2014 webCameras added  
Dec-07-2013 usbDevices changed  
  watchForUsbConnections() removed  
Dec-06-2013 watchForUsbConnections() added  
Sep-10-2013 usbConnected() added  
  usbDisconnected() added  

Javascript Global Objects

Reference

global.network

Network information can be obtained using global.network global object. It implements Network interface.

Interface implementation:
interface Network {
    readonly attribute string ifName;
    readonly attribute bool isWireless;
    readonly attribute string ip;
    readonly attribute string mask;
    readonly attribute string mac;
    readonly attribute string ethernetMac;
    readonly attribute string wirelessMac;
    readonly attribute string defaultGateway;
    readonly attribute string list <string> dnsServers;
}
                
ifName
Active network interface name (like 'eth0' or 'wan0').
isWireless
If true, wireless network interface is active.
ip
Active network interface IP address.
mask
Active network interface subnet mask.
mac
Active network interface MAC address.
ethernetMac
The first ethernet interface MAC address.
wirelessMac
The first wireless interface MAC address.
defaultGateway
Default gateway IP address.
dnsServers
List of DNS servers IP addresses.

Javascript Global Objects

Reference

global.printer

global.printer implements Printer interface which allows to control the default printer connected to the Moderro Interactive Kiosk either locally or via network. Since it contains network-related stuff (you are able to print files located remotely), this interface is asynchronous.

This object allows you to print PDF files, images, plain text documents and HTML documents.

Note 1. While printing HTML document you are not able to print external resources referred by that document, such as images, flash clips or plugins. Only basic HTML4 formatting is supported.

Plain text and HTML documents have to be UTF-8 encoded in order to be printed correctly.

Printer object interface implementation:
interface Printer{
    attribute bool collateCopies;
    readonly attribute int colorCount;
    attribute ColorMode colorMode;
    attribute int copyCount;
    attribute bool doubleSidedPrinting;
    attribute DuplexMode duplex;
    attribute bool fontEmbeddingEnabled;
    readonly attribute int fromPage;
    readonly attribute int toPage;
    attribute bool fullPage;
    readonly attribute int widthMM;
    readonly attribute int heightMM;
    readonly attribute bool isValid;
    readonly attribute string name;
    attribute Orientation orientation;
    attribute PageOrder pageOrder;
    attribute PaperSize paperSize;
    attribute PaperSource paperSource;
    readonly attribute PrinterState state;
    attribute int resolution;
    readonly attribute list <int> supportedResolutions;
    readonly attribute list <PaperSize> supportedPaperSizes;
    readonly attribute bool supportsMultipleCopies;
    readonly attribute list <string> availablePrinters;
    readonly attribute string defaultPrinter;
    readonly attribute map status;

    slot bool abort();
    slot bool newPage();
    slot bool clearJobQueue();

    list <real> getPageMargins(in Unit unit) const;
    void setPageMargins(in real left, in real top, in real right, in real bottom, in Unit unit);
    bool setCurrentPrinter(in string printerName);
    list <real> paperExactSize(Unit unit) const;
    void setPaperExactSize(in real width, in real height, Unit unit) const;
    int print(in string url);
    int printCurrentPage();
    int printCurrentPageRect(in int left, in int top, in int width, in int height);
    int printElementBySelector(in string cssSelector);
    void setFromTo(in int from, in int to);
    void clearStatusHistory();
    void startStatusPolling();
    void stopStatusPolling();

signals:
    void errorStatus(in Date date, in int code, in string errorString);
}
                

Note 1. This interface will be definitely changed in the future to provide access to non-default printers.

collateCopies
Contains true if collation is turned on when multiple copies is selected. Contains false if it is turned off when multiple copies is selected. When collating is turned off the printing of each individual page will be repeated the numCopies amount before the next page is started. With collating turned on all pages are printed before the next copy of those pages is started.
colorCount
Contains the number of different colors available for the printer.
colorMode
Contains the current color mode.
copyCount
Contains the number of copies that will be printed. The default value is 1.
doubleSidedPrinting
Contains true if double side printing is enabled.
duplex
Contains the current duplex mode.
fontEmbeddingEnabled
Contains true if font embedding is enabled.
fromPage
Contains the number of the first page in a range of pages to be printed. Pages in a document are numbered according to the convention that the first page is page 1. By default, this attribute contains a special value of 0, meaning that the "from page" setting is unset. This is read-only attribute, use setFromTo() method to set page range.
toPage
Contains the number of the last page in a range of pages to be printed. Pages in a document are numbered according to the convention that the first page is page 1. By default, this attribute contains a special value of 0, meaning that the "to page" setting is unset. This is read-only attribute, use setFromTo() method to set page range.
fullPage
Contains true if the origin of the printer's coordinate system is at the corner of the page and false if it is at the edge of the printable area.
widthMM
Contains the width of printing area in millimeters.
heightMM
Contains the height of printing area in millimeters.
isValid
Contains true if the printer currently selected is a valid printer in the system.
name
Contains the current printer name.
orientation
Contains the orientation setting.
pageOrder
Contains the current page order.
paperSize
Contains the printer paper size.
paperSource
Contains the printer's paper source.
printerState
Contains the current state of the printer. This may not always be accurate (for example if the printer doesn't have the capability of reporting its state to the operating system).
resolution
Contains the current assumed resolution of the printer.
supportedResolutions
Contains a list of the resolutions (a list of dots-per-inch integers) that the printer says it supports.
supportedPaperSizes
Contains a list of paper sizes that the printer says it supports.
supportsMultipleCopies
Returns true if the printer supports printing multiple copies of the same document in one job; otherwise false is returned. On most systems this function will return true.
availablePrinters
Contains a list of names of supported printers connected to the device.
defaultPrinter
Contains a name of default printer.
status
Printer status as reported by the driver. Works only with HP printers.
Status codes and description are listed here.
abort()
Aborts the current print run. Returns true if the print run was successfully aborted and printerState will return Printer::Aborted; otherwise returns false. It is not always possible to abort a print job. For example, all the data has gone to the printer but the printer cannot or will not cancel the job when asked to.
newPage()
Tells the printer to eject the current page and to continue printing on a new page. Returns true if this was successful; otherwise returns false.
clearJobQueue()
Tells the printer to cancel all print jobs. Returns true on success; otherwise returns false.
getPageMargins()
Returns the page margins for this printer as an array of four real numbers for left, top, right and bottom margins in specified length unit.
setPageMargins()
Sets the left, top, right and bottom page margins for this printer in specified length unit.
setCurrentPrinter()
Sets the printer identified by it's name as a current printer. Returns true on success, false on failure. List of all printer's names can be retrieved using availablePrinters attribute. Initially defaultPrinter is considered current.
paperExactSize()
Returns the paper size as an array of two real numbers for page width and height in specified length unit.
setPaperExactSize()
Sets the paper width and height in specified length unit.
print()
Print document given by its URL. The url can be local file system path or an HTTP URL. Returns PrintJob object.
printCurrentPage()
Print web page currently opened in browser. Returns PrintJob object.
printCurrentPageRect()
Print rectangle of the current web page defined by left, top, width and height arguments. Returns PrintJob object.
printElementBySelector()
Print first element matching given CSS selector. Returns PrintJob object.
setFromTo()
Sets the range of pages to be printed. Pages in a document are numbered according to the convention that the first page is page 1. All pages will be prined if the both arguments are 0.
clearStatusHistory()
Clears the queue with the printer status history.
startStatusPolling()
Starts polling for a new printer status.
stopStatusPolling()
Stops polling for a new printer status.
errorStatus()
Fires when an error status event has arrived from printer.

All global.printer methods related to performing actual printing return objects implementing PrintJob interface.

Print job object interface:
interface PrintJob {
    readonly attribute JobState state;
    readonly attribute string errorString;
    readonly attribute string printerName;
    readonly attribute bool isFinished;
    
    void cancel();
    void remove();
    
    signal void finished();
    signal void error();
    signal void stateChanged();
}
				
state
Contains current state of the print job. Can have one of the following values:
'Downloading' — document is being downloaded from remote server,
'Held' — job is held for printing,
'Pending' — job is waiting to be printed,
'Processing' — job is currently printing,
'Completed' — job has completed successfully,
'Stopped' — job has been stopped,
'Aborted' — job has aborted due to error.
errorString
Contains string describing error if any has occured.
printerName
Contains name of a printer performing the job.
isFinished
Contains true if printer finished processing the job, successfully or not, or false otherwise.
cancel()
Tells the printer to cancel processing the print job. Returns true on success, false on failure. Note that it's not always possible to stop printing immediately if this process already started.
remove()
Tells the browser to remove job object. Information about all processed and finished jobs are kept in memory, if application uses printing extensively it may be necessary to free resources associated with finished jobs manually using this method. Job object should never be used after the call of this method.
finished()
Emitted when job is finished processing, successfully or not.
error()
Emitted when error related to the job occurs.
stateChanged()
Emitted every time when job state changes.
Change log:
       
Jun-8-2015 startStatusPolling() added
  stopStatusPolling() added
Mar-25-2015 errorStatus() added
  clearStatusHistory() added
Mar-6-2015 status added
Sep-7-2013 setCurrentPrinter() changed type changed

Javascript Global Objects

Reference

global.serialPorts

global.serialPorts object is a factory for SerialPort objects. You can create multiple SerialPort objects in your application.

global.serialPorts object interface implementation:
    readonly attribute list <string> availableDevices;
    readonly attribute list <int> standardbaudRates;
    
    bool contains(in string deviceName) const;
    SerialPort port(in string deviceName);
    bool deletePort(in Object port);
    bool deletePort(in string deviceName);
    void deleteAll();
                
SerialPort interface implementation:
    attribute enum BaudRate baudRate;
    attribute enum DataBits dataBits;
    attribute enum Parity parity;
    attribute enum StopBits stopBits;
    attribute enum FlowControl flowControl;
    attribute int dataErrorPolicy;
    attribute bool dataTerminalReady;
    attribute bool requestToSend;
    readonly attribute int error;
    attribute bool settingsRestoredOnClose;

    ByteArray readAll();
    long long write(in ByteArray data);

signals:
    void aboutToClose();
    void bytesWritten(in long long bytes);
    void readChannelFinished();
    void readyRead();
    void baudRateChanged(in int baudRate, in int direction);
    void dataBitsChanged(in int dataBits);
    void parityChanged(in int parity);
    void stopBitsChanged(in int stopBits);
    void flowControlChanged(in int flow);
    void dataErrorPolicyChanged(in int policy);
    void dataTerminalReadyChanged(in bool set);
    void requestToSendChanged(in bool set);
    void error(in int serialPortError);
    void settingsRestoredOnCloseChanged(in bool restore);
                

Javascript Global Objects

Reference

global.keyboard

IMPORTANT! This global object was removed.

This object allows to control a screen keyboard. This keyboard can interfere with automatic screen keyboard, so, if you want to control screen keyboard in your JavaScript application, it is strongly recommended to turn automatic screen keyboard off by setting browser.screen.keyboard.enabled property to false. You can use only one screen keyboard in your application.

Interface implementation:
interface Keyboard {
    readonly attribute bool isVisible;

    void show(in int globalX, in int globalY);
    void hide();
    void move(in int globalX, in int globalY);
}
                

Note 1. globalX and globalY coordinates here are relative to the top left corner of the screen.

Change log:
       
Mar-04-2015 global.keyboard removed  
Nov-24-2013 show() changed  
  move() changed  

Javascript Global Objects

Reference

global.registry

This object implements Registry interface. It allows to get and set properties values. It also allows to get and set persistent values in the device profile.

Note 1. Wrong use of this API can be very dangerous. For example, wrong values for network-related properties can make your device unaccessible. In the worst case you will have to reburn the firmware of your device with an emergency USB stick.

Note 2. When you use this object first time it will take several seconds for it to be initialized, since it has to get the information on all properties in the system.

Interface implementation:
interface Registry {
    readonly attribute string list <string> properties;
    readonly attribute string module;
    readonly attribute bool isStandalone;
    readonly attribute string serviceHost;
    readonly attribute unsigned int servicePort;
    readonly attribute bool isDmmEnabled;
    readonly attribute string dmmUrl;
    readonly attribute int lastUpdated;
    readonly attribute int expiresIn;
    
    bool exists(in string propertyName) const;
    string value(in string propertyName) const;
    int setValue(in string propertyName, 
                in string propertyValue) const;
    
    string title(in string propertyName) const;
    string description(in string propertyName) const;
    
    bool isPersistent (in string propertyName) const;
    bool isGlobal(in string propertyName) const;
    bool isInternal (in string propertyName) const;
    bool isRunTime(in string propertyName) const;
    bool isIpc (in string propertyName) const;
    bool isReadable(in string propertyName) const;
    bool isWritable(in string propertyName) const;
    string persistentValue(in string propertyName) const;
    int setPersistentValue(in string propertyName,
                            in string propertyValue) const;
    bool subscribe(in string propertyName);

signals:

    void changed(in string propertyName);
}
                
properties
Returns names for all available properties in the system.
module
Returns module name for the browser process.
isStandalone
Returns true if the device is in stand-alone mode (is not registered in Management system).
serviceHost
Management system host name or IP address.
servicePort
Management system port.
isDmmEnabled
Returns true if Cisco DMM support is turned on.
dmmUrl
Returns Cisco DMM URL.
lastUpdated
Returns time stamp in seconds since the begining of Epoch (1-Jan-1970, 12:00 AM), when the registry was updated from the management server.
expiresIn
Returns time in seconds. After that amount of time the registry has to be considered as expired and has to be refreshed from the management server side. If contains a negative number or zero, the registry will not expire. Note, this value is not counted down as time goes. It updates every time the registry updates from the management server.
exists()
Returns true if the property with name propertyName exists.
value()
Returns string serialization for the value of property propertyName. Note, that if the property type is not integral (something like struct or list) this method returns XML.
setValue()
Sets value for property propertyName. If the property type is not integral, you have to provide an XML serialization as a property value. Returns zero on success, or -1 on error.
title()
Returns property title.
description()
Returns property description.
isPersistent()
Returns true if the property is persistent. That means its value will be obtained from the persistent storage at the module startup and it'll be saved to the persistent storage every time the property value changes.
isGlobal()
Returns true if the property is global. If property is global that means it has only one persistent value for all modules and it appears in the spec only once. Its full qualified name does not contain module section.
isInternal()
Returns true if the property is internal. This property cannot be accessed from a module this property does not belong to.
isRunTime()
Returns true if the property is run time. Changing this property's value implies immediate action.
isIpc()
Returns true if the property is used for IPC. It's an internal property used for IPC purposes only. So, it has to be ignored by management systems.
isReadable()
Returns true if the property value can be read.
isWritable()
Returns true if the property value can be changed.
persistentValue()
Returns string serialization for the value of property propertyName from the persistent storage.
setPersistentValue()
Sets value for property propertyName in the persistent storage.
subscribe()
Subscribe global.registry object to monitor propertyName property changes. When you subscribe global.registry to monitor some property, signal changed() fires every time property value changes. Note, that subscriptions persist even if you unload the page, where you called subscribe() method.
changed()
Fires when value of property propertyName changes. It fires only if you previously called subscribe() method with that property name.
Change log:
       
Aug-3-2013 subscribe() added  
  changed() added  

Javascript Global Objects

Reference

global.display

This object implements Display interface.

Note 1. This object controls brightness and contrast using DDC (Display Data Channel). Not all displays support that. So, for some displays brightness and contrast adjustment will not work.

Note 2. This object in its implementation changes values of display.* properties. So, if some policy containing display.* properties is applied to the device, this object will not work.

Note 3. If you have multiple displays connected to the device, rotationAngle attribute will rotate all the screens. As to brightness and contrast, in the current version only the first found display will be affected.

Interface implementation:
interface Display {
    readonly attribute bool isBrightnessEnabled;
    attribute int brightness;

    readonly attribute bool isContrastEnabled;
    attribute int contrast;

    attribute int rotationAngle;
    readonly attribute bool isStandBy;
    
signals:
    void standBy(in bool inStandBy);
}
                
isBrightnessEnabled
Returns value of display.brightness.enabled property (which is false by default). If it is false, display brightness cannot be adjusted.
isContrastEnabled
Returns value of display.contrast.enabled property (which is false by default). If it is false, display contrast cannot be adjusted.
isStandBy
Checks is if the display is in standby mode.
rotationAngle
Allows to get and set screen rotation angle. Only the following values are valid: 0, 90, 180 and 270. If you use an invalid value, this method does nothing.
standBy()
Fires when the display goes to standby mode.
Change log:
       
Jul-15-2015 isStandBy added
  standBy() added

Javascript Global Objects

Reference

global.magstripe

This object allows to read data from magstripe readers and barcode scanners.

Interface implementation:
interface Magstripe {
    void open(in string deviceName);
    void close();

signals:
	void opened();
    void scanning();
    void scanned(out string data);
    void error(out string error);
}
                
open(in string deviceName)
Open the device for reading data. If deviceName is not empty, use this device name, and browser.magstripe.scanner property otherwise.
close()
Close the device.
opened()
The device has been open successfully.
scanning()
The device has started data scanning.
scanned(out string data)
The device has finished scanning, read the scanned data from deviceName.
error(out string error)
Error has occured.

Javascript Global Objects

Reference

global.vncserver

This object allows to control local VNC server. This server can be used to give a visual access to the device.

Interface implementation:
interface VncServer {
    bool start(in string password = "",
                in string host = "",
                in int port = −1,
                in bool readOnly = false);
    
    bool start(in int x,
                in int y,
                in int width,
                in int height,
                in string password = "",
                in string host = "",
                in int port = −1,
                in bool readOnly = false);
    
    readonly attribute bool isRunning;
    readonly attribute bool isReadOnly;
    readonly attribute rect geometry;
    
    slots:
        bool stop();
}
                
start(in string password = "", in string host = "", in int port = −1, in bool readOnly = false)
Starts the VNC server for full screen.
If password is not empty, use this password to protect the VNC connection.
If host is not empty, try to connect to this host, and start locally otherwise.
If port is less than zero, use the default VNC port, or use this port otherwise.
If readOnly is true, the VNC server does not accept any input from connected clients. Returns true in the case of success and false in the case of failure.
start(in rect rc, in string password = "", in string host = "", in int port = −1, in bool readOnly = false)
Starts the VNC server for rectangular area (x, y, width, height).
If password is not empty, use this password to protect the VNC connection.
If host is not empty, try to connect to this host, and start locally otherwise.
If port is less than zero, use the default VNC port, or use this port otherwise.
If readOnly is true, the VNC server does not accept any input from connected clients.
If the rectangular area is empty, this method does nothing and returns false. Returns true in the case of success and false in the case of failure.
start(in int x, in int y, in int width, in int height, in string password = "", in string host = "", in int port = −1, in bool readOnly = false)
Starts the VNC server for rectangular area (rc).
If password is not empty, use this password to protect the VNC connection.
If host is not empty, try to connect to this host, and start locally otherwise.
If port is less than zero, use the default VNC port, or use this port otherwise.
If readOnly is true, the VNC server does not accept any input from connected clients.
If the rectangular area is empty, this method does nothing and returns false. Returns true in the case of success and false in the case of failure.
isRunning
Returns true if the VNC server is running.
isReadOnly
Returns true if the VNC server does not accept any input from connected VNC clients.
geometry
Returns geometry of the rectangular area the VNC server is running for. If the server is not running or no coordinates have been specified via start(), returns an invalid rect (geometry.x, geometry.y, geometry.width, and geometry.height are undefined).
stop()
Stops the VNC server. Returns true in the case of success (or the server is not running) and false in the case of failure.

Note 1. You should avoid running the VNC server for areas containing video, either playing in flash or in videoplayer widget.

Javascript Global Objects

Reference

global.mediaCache

This object allows to control the local media cache.

Interface implementation:
interface MediaCache {
    readonly attribute long long capacity;
    readonly attribute long long size;
    readonly attribute long long free;
    readonly attribute bool isEmpty;
    readonly attribute int fileCount READ fileCount;
    readonly attribute Array urls;
    
    int clear(in long long size) const;
    bool contains(in string url) const;
    int load(in string url) const;
    bool remove(in string url) const;
    bool isLocked(in string url) const;
    long long fileSize(in string url) const;
    Date created(in string url) const;
    Date lastAccessed(in string url) const;
    QString mimeType(in string url) const;

slots:
    int clear();

signals:
    void overloaded();
    void loadStarted(in string url);
    void loadFinished(in string url);
    void notCacheable(in string url);
    void loadError(in string url, in string errorString);
    void removed(in string url);
    void cleared();
    void locked(in string url);
    void unlocked(in string url);
}
                
capacity
Cache capacity in bytes.
size
Cache size (occupied space) in bytes.
free
Available space in the cache in bytes.
isEmpty
Returns true if there are no files in the cache.
fileCount
Number of files in the cache.
urls
List of cached URLs in the order of last access date and time. Files accessed earlier go first.
clear(in long long size)
Remove the most rarely used files to get at least size bytes available in the cache.
contains(in string url)
Returns true if the cache has the result of HTTP GET request to URL url cached.
load(in string url)
Load the specified URL into the cache
remove(in string url)
Remove the file correspondent to URL url from the cache.
isLocked(in string url)
Returns true if the file correspondent to URL url is in use.
fileSize(in string url)
Returns size in bytes for the file correspondent to URL url.
created(in string url)
Returns creation date and time for the file correspondent to URL url.
lastAccessed(in string url)
Returns last access date and time for the file correspondent to URL url.
mimeType(in string url)
Returns MIME type for the file correspondent to URL url.
clear()
Clear the cache. All the files (including locked ones) will be removed from the cache.

Note 1. You should use clear() method very carefully, since it can put your application in an inconsistent state. For example, it can cause playback errors for the video player.

The following properties are connected to media cache.
browser.cache.media.enabled
Specifies whether media cache is enabled. You must set this property to true to turn on the media cache.
browser.cache.media.size
Specifies media cache size in megabytes (default is 2048). Must not be zero to turn on media content caching. We do not recommend to use size less than 50 Megabytes.
browser.cache.media.path
Specifies the path, where the cached content will be stored. You do not need to change this property, unless you want to place the cache on an external storage connected via USB.
browser.cache.media.mode
Caching mode. This is the most important property for media cache. Here is the list of values you can set for this property:
  • MediaCacheCheckIfExpired — Default value. Every time your application requests some media resource, check if it is expired. If it is the case, the content will be recached, if not, the cached content will be returned.
  • MediaCacheNeverExpired — If content is cached, never check if it's expired (offline mode). In contrast to CacheAlwaysCache value for browser.cache.web.mode, media cache in this mode will try to load uncached content from the network.
Change log:
       
Mar-2-2015 load() added  
  loadError() changed  

Javascript Global Objects

Reference

global.networkCache

This object allows to control the local network cache. It's very similar to global.mediaCache.

Interface implementation:
interface NetworkCache {
    readonly attribute long long capacity;
    readonly attribute long long size;
    readonly attribute long long free;
    readonly attribute bool isEmpty;
    
    bool contains(in string url) const;
    bool remove(in string url) const;
    Date lastModified(in string url) const;
slots:
    int clear();
}
                
capacity
Cache capacity in bytes.
size
Cache size (occupied space) in bytes.
free
Available space in the cache in bytes.
isEmpty
Returns true if there are no files in the cache.
contains(in string url)
Returns true if the cache has the result of HTTP GET request to URL url cached.
remove(in string url)
Remove the file correspondent to URL url from the cache.
lastModified(in string url)
Returns last modification date and time for the file correspondent to URL url.
clear()
Clear the cache. All the files (including locked ones) will be removed from the cache.
The following properties are connected to network cache.
browser.cache.web.enabled
Specifies whether web cache is enabled. This property must be set to true to turn on web content caching.
browser.cache.web.size
Specifies web cache size in megabytes (default is 1024). Must not be zero to turn on web content caching. We do not recommend to use size less than 50 megabytes.
browser.cache.web.path
Specifies the path, where the cached content will be stored. You do not need to change this property, unless you want to place the cache on an external storage connected via USB.
browser.cache.web.mode
Caching mode. This is the most important property for web cache. Here is the list of values you can set for this property:
  • CacheAlwaysNetwork Always load from network and do not check if the cache has a valid entry (similar to the «Reload» feature in browsers).
  • CachePreferNetwork Load from the network if the cached entry is older than the network entry.
  • CachePreferCache Default value. Load from cache if available, otherwise load from network. Note that this can return possibly stale (but not expired) items from cache.
  • CacheAlwaysCache Only load from cache, indicating error if the item was not cached (i.e., offline mode).
browser.cache.media.clear
Once you set this property to true, the media cache is cleared. If you read value of this property, you always get false.

If you need to cache some web content to be able to use it later in offline mode, you have to load that content with browser.cache.web.mode set to any value but CacheAlwaysCache. After that from your application you have to set this property to CacheAlwaysCache. Note, in that mode if you did not cache some content your application requires, that content will not be loaded from the network when your application requests it. Instead you will see «Service temporarily unavailable» error message.

Javascript Global Objects

Reference

global.applicationData

global.applicationData object allows the web application to store its persistent data on the management server. This object is nothing but a convenience API to access application.data property. Once you change the data, it will be automatically saved to the management server.

Note 1. This object does not allow you to control the application in real time. As an example, if you construct some policy containing application.data property on the management server and apply that policy as an action to the device running your application, the application will not know about that until the next reboot. Moreover, if the application changes the data after that policy has been applied, the changes you are trying to make with that policy will be lost. This approach tries to prevent inconsistent behavior of the application.

Interface implementation:
interface ApplicationData {
    readonly attribute bool isReadOnly;
    readonly attribute int size;
    readonly attribute bool isEmpty;
    readonly attribute list <string> keys;
    readonly attribute list <string> values;

    bool contains(in String key) const;
    String value(in String key) const;
    String value(in String key, in String defaultValue) const;
    void insert(in String key, in String value);
    bool remove(in String key);
    String take(in String key); // Returns value and removes it from the data.

slots:
	void clear();
}
                

Note 2. Sometimes the value of application.data property can be defined with a policy. That means it cannot be changed on the management server from the device side. In that case isReadOnly attribute returns true. The application still can change its data using insert(), remove(), take() or clear() methods. However, the data will not be saved on the management server.

Javascript Global Objects

Reference

global.resources

Interface implementation:
interface Resources {
    readonly attribute int cpuLoad; // CPU load in percents.
    readonly attribute list <double> cpuFrequency; // Instant frequency in MHz per core.
    
    readonly attribute int memoryAllocated; // Available memory in percents.
    readonly attribute long long memoryTotal; // RAM size in bytes.
    
    readonly attribute int storageAllocated; // Occupied room in data partition in percents.
    readonly attribute unsigned long long storageFree; // Available room in datapartition in bytes.
    readonly attribute unsigned long long storageTotal; // Capacity of the data partition in bytes.
    readonly attribute unsigned long long storageCapacity; //Capacity of the entire SSD in bytes.
}
                

Javascript Global Objects

Reference

global.ir

Note 1. This feature is experimental.

This object implements Ir interface. It allows to recieve signals from the infrared remote control.

Interface implementation:
interface Ir {
    readonly attribute string lastError;
    list <string> availableControls() const;
    bool setCurrentControl(in string device);
signals:
    event(in uint key, in string skey, in string configName) const;
    error(in string err) const;
}
                
lastError
Last error occured.
availableControls()
Returns the list of the supported remote controls.
setCurrentControl(in string device)
Set the current remote control to use. The device name must be obtained from availableControls() list. Leave the device name empty to use browser.ir.configuration. In this case you should set browser.ir.configuration to the valid LIRC configuration.
event(in uint key, in string skey, in string configName)
Remote control event. The event control code is set to key, control name (like "poweroff", "ch1", "up" etc.) is set to skey and the configuration name is set to configName (rarely needed).

Javascript Global Objects

Reference

global.scanner

This object implements scanner interface. It allows to scan documents with scanners.

Interface implementation:
interface Scanner {
    attribute uint dpiX;
    attribute uint dpiY;
    attribute bool color;
    attribute string source;
    readonly attribute list <string> devices;
    readonly attribute list <string> sources;
    readonly attribute string lastError;
    readonly attribute string base64Data;
    readonly attribute bool busy;

    void setCurrentScanner(in string deviceName);

signals:
    void finished();
    void error(out string error);

slots:
    start();
    stop();
    shutdown();
}
                
dpiX
DPI X of the selected scanner.
dpiY
DPI Y of the selected scanner.
color
Is selected scanner in color mode.
source
Document source.
devices
List of available scanners.
sources
List of available document sources.
lastError
Last error occured.
base64Data
Scanned image as base64 JPEG data.
busy
Check if the scanner is busy
setCurrentScanner(in string deviceName)
Set the current scanner to use. Need to call this method before scanning.
finished()
The scanner has finished scanning.
error(out string error)
Error has occured.
start()
Start scanning from the selected scanner and document source.
stop()
Stop scanning.
shutdown()
Shutdown scanning subsystem and reset all internal caches.

Note 1. Please remember that scanner hot plugging (or unplugging) is not supported by the application. If you plug in a new scanner, you need to restart the application to use it.

Javascript Global Objects

Reference

global.videoEncoder

global.videoEncoder object allows the web application to take a video feed from either a WEBCAM or a HDMI Source and encode it to MPEG2-TS (MPEG2 Transport Stream) and stream it out to an endpoint either via UDP or via TCP. This object can be coupled with the video player and can serve as a Local view of the Encoded frame that is being sent out on the Wire.

Note 1. While using TCP as the connection type, ensure that the TCP Endpoint on the host to which you are interested to stream to is listening on the port of interest.

Note 2. While using WEBCAM, make sure the Inputresolution that you select is supported by the camera. The Recommended way is to use either a 720p or a 1080i. Lower resolution Camera may not give the desired output.

Interface implementation:
interface videoEncoder
{
    readonly attribute bool isAvailable; // Checks if Encoder is Available
    readonly attribute int status;
    readonly attribute int errorCode;
    readonly attribute string errorMessage;
    
    readonly attribute int videoInputCount;
    readonly attribute list <string> videoInputDescription;
    readonly attribute string snapshot;
    
    attribute string targetHost; // Target Host where MPEG2-TS has to be sent
    attribute int targetPort; // Target Port on Target Host to Receive it
    attribute int protocol;  // Udp=0, Tcp=1
    
    attribute int videoMode;  // SD=0, HD=1, CUSTOM=2
    attribute int videoSource; // Must be in [0, videoInputCount] range. 0 is for HDMI, 1-videoInputCount is for WEBCAMs

    attribute int h264Profile;
    attribute int inputResolution;
    attribute bool isProgressive;
    attribute int streamType;

    attribute int inputFrameRate; // 15, 24, 30, 60
    attribute int outputFrameRate; // 15, 24, 30, 60
    attribute int averageOutputBitRate;
    attribute int minimumOutputBitRate;
    attribute int maximumOutputBitRate;

    attribute int outputResolution;

    attribute int audioBitRate;

signals:
    notready();
    ready();
    started();
    stopped();
    error(in int code, in string message);

slots:
    start();
    stop();
    takeSnapShot();
    

}
                
global.videoEncoder object enumeration:
{
    enum ErrorCodes
    {
        videoEncoderNotPresent = -1,
        UnabletoStopStreaming = -2,
        UnabletoStartStartStreaming = -3,
        RemoteSideNotListening = -4,
        MemoryExuastionError = -5,
        NoHdmiVideoSignal = -6,
        BothUsbAndPcieTogetherNotSupported = -7,
        HdmiVideoFormatNotUnderstood = -8,
    };
    enum Protocol
    {
        ProtocolUdp = 0,
        ProtocolTcp = 1,
    };
    enum VideoMode
    {
        VideoModeSD = 0,
        VideoModeHD = 1,
        VideoModeCustom = 2,
    };
    enum VideoSource
    {
        HdmiVideo = 0,
        WebcamVideo = 1,
    };
    enum H264Profile
    {
        H264ProfileBaseLine = 0,
        H264ProfileMain = 1,
        H264ProfileExtended = 2,
    };
    enum InputResolution
    {
        InputResolution1920x1080 = 0,
        InputResolution1280x720 = 1,
        InputResolution1024x600 = 2,
    };
    enum OutputResolution
    {
        OutputResolution1920x1080 = 0,
        OutputResolution1280x720  = 1,
        OutputResolution1200x672 = 2,
        OutputResolution1168x656 = 3,
        OutputResolution1024x576 = 4,
        OutputResolution768x432 = 5,
    };
    enum StreamType
    {
        StreamPgoram = 0,
        StreamTransport = 1,
        StreamMp4 = 2,
        StreamElementary = 3,
        StreamRaw = 4,
    };
    enum InputFrameRate
    {
        Input15fps = 0,
        Input24fps = 1,
        Input30fps = 2,
        Input60fps = 3,
    };
    enum OutputFrameRate
    {
        Output15fps = 0,
        Output24fps = 1,
        Output30fps = 2,
        Output60fps = 3,
    };
}
                
isAvailable
Use this routine to check if the box has videoEncoder Module in it. A True value indicates Presences of the Module.
status
Represents Status of videoEncoder. The Status are listed above as enumeration for your reference.
errorCode
This Attribute will be set when an Error Occurs. Use this attribute for your Error Handling in your Application.
errorMessage
This Routine returns the Error String corresponding to the errorCode that ws set. Use this function to display Error Message to user in your Application
videoInputCount
Returns Available Video sources including the HDMI input from the USB Dongle and all available WEBCAMs
videoInputDescription
Returns Description of all videoInput devices present in the box.
snapshot
Returns the captured snapshot from the HDMI encode stream as base64data. The returned data is the JPEG image.
targetHost
Returns TargetHost to which the Encoded Stream is being Sent.
targetPort
Returns PortNumber on which the Encoded Stream is being sent
protocol
Returns integer value for the Transport Protocol. 0 for Udp, 1 for Tcp
videoMode
Returns Video Mode that the videoEncoder is operating on. Values are 0 - SD, 1 - HD, 2 for Custom
videoSource
Returns the Video Source being selected for Encoding either as 0 - HDMI 1 to videoInputCount for Webcam
h264Profile
Returns the Encoding H.264 profile being used by the encoder. 0 for Baseline, 1 for Main and 2 for Extended Profile.
inputResolution
Returns the InputResolution that is being used for the Source. Possible Values are 0 for 1920x1080 resolution, 1 for 1280x720 and 2 for 1024x600.
isProgressive
Returns true if the Scan Format is set to Progressive
streamType
Returns the Input Stream Type that is Configured on the ENcoder. Possible Values are 0 = Program Stream, 1 = Transport Stream, 2 = Mpeg4 Stream (default), 3 = Elementary Stream and 4 = Raw Stream
inputFrameRate
Returns the Video-In Frame Rate as integer value in Fps, Possible values are 0 for 15fps, 1 for 24fps, 2 for 30fps and 3 for 60 fps.
outputFrameRate
Returns the Video-Out Frame Rate as integer value in Fps, Possible values are 0 for 15fps, 1 for 24fps, 2 for 30fps and 3 for 60 fps.
averageOutputBitRate
Returns the Video-Out Average Bit Rate in kbps
minimumOutputBitRate
Returns the Video-Out Minimum Bit Rate in kbps
maximumOutputBitRate
Returns the Video-Out Maximum Bit Rate in kbps
outputResolution
Returns the Video-Out Resolution from the Encoding Stream. Possible values are 0 for 1920x1080, 1 for 1280x720, 2 for 1200x672, 3 for 1168x656, 4 for 1024x576 and 5 for 768x432
audioBitRate
Returns the Audio-Out Bit Rate being sent from the Encoder in bps
setTargetHost(in string targetHost)
Allows you to set the Target Host (IP Address either as Unicast or Multicast ipv4 Address)
setTargetPort(in string targetPort)
Allows you to set the Target Host's (Layer4) port Number (TCP or UDP port number)
setProtocol(in int transportProtocol)
Allows you Transport (Layer4) Protocol to be used when sending the Encoded stream. Choices are 0 for Udp, 1 for Tcp
setVideoMode(in int videoMode)
Allows you to set video Encode Mode either as SD (Standard Definition) or HD (High Definition). If you would like to Still Finetune the Encoding Properties, you can select the CUSTOM option. Choices are 0 for SD, 1 for HD and 2 for Custom
setVideoSource(in int videoSource)
Allows you to set the videoSource for the Encoder. Choices are 0 for HDMI Input from USB Dongle, and [1 to videoInputCount] for all available (v4l compliant) Webcams
setH264Profile(in int h264Profile)
Allows you to set the H.264 profile to be used for Encoding. Choices are 0 for baseline profile, 1 for main profile and 2 (default) for extended profile
setInputResolution(in int inputResolution)
Allows you to set the Input Resolution for the Video Source. Choices are 0 for 1920x1080, 1 for 1280x720 and 2 for 1024x600
setProgressive(in int flag)
Allows you to set the input Scan format to Progressive. Call this API with parameter of 1 to set to Progressive. Choices are 0 or 1
setStreamType(in int streamType)
Allows you to set the Stream Type for the Video-In stream. Choices are 0 for PS, 1 for TS (default), 2 for Mp4, 3 for ES and 4 for Raw
setInputFrameRate(in int frameRate)
Allows you to set the Incoming (Video-In) Frame rate in fps. Choices are 0 for 15fps, 1 for 24fps, 2 for 30fps and 3 for 60fps
setOutputFrameRate(in int frameRate)
Allows you to set the Output (Video-Out) Frame rate in fps. Choices are 0 for 15fps, 1 for 24fps, 2 for 30fps and 3 for 60fps
setAverageOutputFrameRate(in int avgRate)
Allows you to set the Average Output Rate (Video-Out) in kbps
setMinimumOutputBitRate(in int minRate)
Allows you to set the Minimum Output Rate (Video-Out) in kbps
setMaximumOutputBitRate(in int maxRate)
Allows you to set the Maximum Output Rate (Video-Out) in kbps
setOutputResolution(in int outputResolution)
Allows you to set the Output Resolution for Video-Out. Choices are 0 for 1920x1280, 1 for 1280x720, 2 for 1200x672, 3 for 1168x656, 4 for 1024x576 and 5 for 768x432
setAudioBitRate(in int bitRate)
Allows you to set the Audio-In bit rate in kbps
Change log:
       
Oct-16-2013 snapshot added  
  takeSnapShot() added  

Javascript Global Objects

Reference

global.window

This objects allows to manipulate browser windows.

global.window object interface implementation:
interface Window {
	Object open(in string url,
			in bool isModal = true,
			in bool showDecorations = false);
	bool close(in Object window);
	bool close(in DomElement e);

signals:

	void closed(in string windowObjectName);
}
                
open()
Open a new browser window. url must be a fully qualified URL (relative URLs are not supported). If showDecorations is false both navigation bar and window title will be hidden.
close()
Close window previously opened with open() method. You can pass to this method either Object returned from open() method or any DOM element. In the last case the window DOM element belongs to will be closed.
closed()
Fired when windows opened with open() method is closed.

When you open a new window with open() method, you will get a new window object in return. That object has the following interface.

NewWindow object interface implementation:
interface NewWindow {
	attribute string objectName;
	attribute int x;
	attribute int left;
	attribute int y;
	attribute int top;
	attribute int width;
	attribute int height;
}
				
Change log:
       
Nov-13-2013 Window interface created  
  open() created  
  close(window) created  
  close(DomElement) created  
  closed() created  
  NewWindow interface created  
  objectName created  
  x created  
  y created  
  left created  
  top created  
  width created  
  height created  

Notes on HTML5

HTML5 SQL storage

HTML5 SQL storage

To enable HTML5 SQL storage the following properties must be set to true:

  • browser.storage.enabled = true
  • browser.storage.html5.database.enabled = true
  • browser.storage.html5.enabled = true
The maximum size of all databases used by all web applications cannot exceed 10 megabytes. Cobra uses SQLite as a DBMS for the SQL storage. So, you can consult SQLite manuals to learn the details (see http://sqlite.org/lang.html).

Network Proxy

Network Proxy

Moderro Interactive Kiosk supports HTTP proxying only. There are to ways to configure the system to use proxy. You can either use static configuration or an autoconfiguration script.

Static Proxy Configuration

To configure the system to use a static HTTP proxy you have to set network.proxy.mode to ProxyStatic.

network.proxy.host and network.proxy.port properties must contain host address and port number for the proxy.

If your proxy requires authorization, you can use network.proxy.user and net- work.proxy.password properties to set user name and password.

Network Proxy

Proxy Autoconfiguration Script

Network Proxy

Moderro Interactive Kiosk supports HTTP proxying only. There are to ways to configure the system to use proxy. You can either use static configuration or an autoconfiguration script.

Proxy Autoconfiguration Script

If you have multiple proxy servers that support many clients, you can use an autoconfiguration script to configure all of your devices. The autoconfiguration script contains a JavaScript function that determines which proxy, if any, device uses when accessing various URLs.

When Cobra browser starts, it loads the autoconfiguration script. Each time the browser loads a URL, it uses the configuration script to determine if it should use a proxy and, if so, which proxy it should use. This feature lets you provide an easy way to configure all devices in your organization. There are two ways you can setup the autoconfiguration script for your devices:

  • You can provide a URL to a file containing your autoconfiguration script. To do that you have to set network.proxy.mode property to ProxyAutoConfigUrl and set the script file URL in network.proxy.autoconfig.url. Note, this file will be loaded by device just once, when the device starts.
  • You can store your autoconfiguration file as a value of network.proxy.autoconfig.script property. network.proxy.mode property must be set to ProxyAutoConfigScript in this case.

The proxy autoconfiguration script must define the function:

string FindProxyForURL(in string url, in string host)
which will be called by the browser in the following way for every URL that is retrieved by it. Here url is the full URL being accessed, host is the hostname extracted from the URL. This is only for convenience, it is the exact same string as between :// and the first : or / after that. The port number is not included in this parameter. It can be extracted from the URL when necessary.

The function returns a string describing the configuration. If the string is null, no proxies should be used. The string can contain any number of the following building blocks, separated by a semicolon:

"DIRECT"
Connections should be made directly, without any proxies.
"PROXY host:port"
The specified proxy should be used.

Note 1. Moderro Interactive Kiosk does not support Socks proxy, so, "SOCKS host:port" block in result of FindProxyForURL() will be considered as an error.

If there are multiple semicolon-separated settings, the left-most setting will be used, until the device fails to establish the connection to the proxy. In that case the next value will be used, etc. If all proxies are down, and there was no DIRECT option specified, the HTTP request will fail.

For example, string

"PROXY w3proxy.netscape.com:8080; PROXY mozilla.netscape.com:8081"
means primary proxy is w3proxy:8080; if that goes down start using mozilla:8081 until the primary proxy comes up again.

String
"PROXY w3proxy.netscape.com:8080; PROXY mozilla.netscape.com:8081; DIRECT"
means same as above, but if both proxies go down, automatically start making direct connections.

Here is an example of simple autoconfiguration script:
function FindProxyForURL(url, host){
    if (host.indexof("google.com") >= 0)
    return "192.168.0.101:3128;DIRECT";
    return "DIRECT";
}
                	

Network Proxy

Proxy Autoconfiguration Script

Autoconfiguration Script Functions

Moderro Interactive Kiosk supports the following utility functions in proxy autoconfiguration script.

bool dnsDomainIs(in string host, in string domain)
Evaluates hostnames and returns true if hostnames match. Used mainly to match and exception individual hostnames.
// If the hostname matches or contains google.com (e.g. maps.google.com, www.google.com),
// send direct to the Internet.

if (dnsDomainIs(host, "google.com"))
	return "DIRECT";
bool shExpMatch(in string text, in string wildcard)
Will attempt to match hostname or URL to a specified shell expression, and returns true if matched.
Example 1:
// Any requests with a hostname ending with the extension .local
// will be sent direct to the Internet.

if (shExpMatch(url, "*.local")) 
	return "DIRECT";
Example 2:
// A request for the host vpn.domain.com or any request for a file or folder in the
// location http://abcdomain.com/folder/ will be sent direct to the Internet.

if (shExpMatch(host, "vpn.domain.com") || shExpMatch(url, "http://abcdomain.com/folder/*"))
	return "DIRECT";
bool isInNet(in string host, in string networkAddress, in string networkMask)
This function evaluates the IP address of a hostname, and if within a specified subnet returns true. If a hostname is passed the function will resolve the hostname to an IP address.
// If IP of requested website website falls within IP range, send direct to the Internet.

if (isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0"))
	return "DIRECT";
string myIpAddress()
Returns the IP address of the host machine.
// If the machine requesting a website falls within IP range,
// send traffic via proxy 10.10.5.1 running on port 8080.

if (isInNet(myIpAddress(), "10.10.1.0", "255.255.255.0"))
	return "PROXY 10.10.5.1:8080";
string dnsResolve(in string host)
Resolves hostnames to an IP address. This function can be used to reduce the number of DNS lookups, e.g. below example.
// If IP of the requested host falls within any of the ranges specified, send direct.

if (isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0")
		|| isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0")
		|| isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") 
		|| isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
	return "DIRECT";
bool isPlainHostName(in string host)
This function will return true if the hostname contains no dots, e.g. http://intranet Useful when applying exceptions for internal websites, e.g. may not require resolution of a hostname to IP address to determine if local.
// If user requests plain hostnames, e.g. http://intranet/,
// http://webserver−name01/, send direct.

if (isPlainHostName(host))
	return "DIRECT";
bool localHostOrDomainIs(in string host, in string domain)
Evaluates hostname and only returns true if exact hostname match is found.
// If the Host requested is "www" or "www.google.com", send direct.

if (localHostOrDomainIs(host, "www.google.com"))
	return "DIRECT";
// // If the Host requested is "google.com" or a subdomain of google.com, e.g. "example.google.com", send direct.

if (localHostOrDomainIs(host, ".google.com"))
	return "DIRECT";
bool isResolvable(in string host)
Attempts to resolve a hostname to an IP address and returns true if successful.
WARNING! This may cause a browser to temporarily hang if a domain isn’t resolvable.
//  If the host requested can be resolved by DNS, send via proxy1.example.com.

if (isResolvable(host))
	return "PROXY proxy1.example.com:8080";
uint dnsDomainLevels(in string host)
This function returns the number of DNS domain levels (number of dots) in the hostname. Can be used to exception internal websites which use short DNS names, e.g. http://intranet.
// If hostname contains any dots, send via proxy1.example.com, otherwise send direct.

if (dnsDomainLevels(host) > 0)
	return "PROXY proxy1.example.com:8080";
return "DIRECT";
bool weekdayRange(in string from, in string to)
Allows rules to be time based, e.g. only return a proxy during specific days.
// If during the period of Monday to Friday, proxy1.example.com will be returned, otherwise
// users will go direct for any day outside this period.

if (weekdayRange("MON", "FRI"))
	return "PROXY proxy1.example.com:8080";
return "DIRECT";
bool dateRange(in string from, in string to)
Allows rules to be time based e.g. only return a proxy during specific months.
//  If during the period of January to March, proxy1.example.com will be returned, otherwise
// users will go direct for any month outside this period.

if (dateRange("JAN", "MAR"))
	return "PROXY proxy1.example.com:8080";
return "DIRECT";
bool timeRange(in uint from, in uint to)
Allows rules to be time based e.g. only return a proxy during specific hours.
// If during the period 8am to 6pm, proxy1.example.com will be returned, otherwise
// users will go direct for any time outside this period.

if (timeRange(8, 18))
	return "PROXY proxy1.example.com:8080";
return "DIRECT";
void alert(in string text)
This function is not specified in the original PAC specification. The function can be used to output the value of a variable or result of a function in a form of device event (on informational level). This can be useful for troubleshooting PAC file rule issues.
// Outputs the resolved IP address of the host in the browser 
// to end−user or error console.

var resolved_host = dnsResolve(host);
alert (resolved_host);

Network Proxy

Proxy Autoconfiguration Script

Performance Tuning

When device uses proxy autoconfiguration script, it significantly degrades its network performance, because every time device tries to load some URL, that URL has to be checked with FindProxyForURL() JavaScript function.

To prevent that we added some properties to cache autoconfiguration results:

  • network.proxy.autoconfig.cache.enabled This boolean property specifies if autoconfiguration script results will be cached. If it’s true (which is the default value), autoconfiguration script will be evaluated just once for every requested host. The next time that host will be requested, the cached value will be used. For example, if the browser requests URL http://www.cnn.com/US/?hpt=sitenav, and autoconfiguration script returns "192.168.0.1:3128" for it, the next time browser requests http://www.cnn.com:8080/index.html, autoconfiguration script will not be evaluated, and "192.168.0.1:3128" proxy will be used again. If your script returns different values for the same host (for example, if your script returns time-based results), you have to set this value to false to make your script work. Do not set this value to false if you don’t really need that.
  • network.proxy.autoconfig.cache.size This property contains maximum number of items in HTTP proxy autoconfiguration cache. Default value is 5000.
  • network.proxy.autoconfig.check.interval Every time your autoconfiguration script returns ’PROXY host:port’ block, the proxy server mentioned in that block has to be verified. This property allows to assume that the proxy server is alive (or not alive) during this period of time (in minutes) after the check. If this property is set to 0, the check will be performed every time you script returns ’PROXY’ block. That will significantly degrade device network performance. The default value is 60 minutes.