This is an old revision of the document!
xAPFlash
Introduction
The xAPFlash application, written by Kevin Hawkins et al, is a GUI front-end that allows you to control xAP compliant devices.
As the name suggests this is a FLASH based application targeted primarily at the O2 Joggler by OpenPeak. However, as this is in Flash it will run on many other supported platforms.
The following have been verified
- Joggler
- WebOS (HP Touchpad)
- Android based systems
- Browsers
- Flash Player (Linux, Windows)
Support
Background
What is xAP? xAP is a protocol implemented as broadcast UDP datagrams. Due to restrictions in Flash it cannot place xAP packets on the wire, this disconnect is resolved by the introduction of a TCP/UDP xAP gateway, the 'iServer'.
The Flash application connects to an iServer which will relay traffic to and from the application. The iServer also has the following benefits:
- TCP is a reliable delivery protocol which is beneficial for wireless devices
- The iServer also performs packet filtering, only providing data to the Flash application for the endpoints it's controlling and monitoring
- Monitoring of packet count and throughput
- Enables external connectivity outside of your LAN
The xAP Flash application can easily interact with all your xAP BSC devices providing immediate state synchronization and real-time status tracking and control. It also integrates easily with non xAP BSC schema devices and endpoints.
Terminology
Some words and their meanings may not be obvious, so getting familiar with the terminology will make reading the rest of this article easier.
Word | Meaning |
---|---|
xAP | xAP Protocol |
xAPBSC | Basic Status and Control Schema often abbreviated to BSC |
endpoint | Any device, physical or logical, on your network that can generate information and/or be controlled though the use of an xAP schema. e.g. dbzoo.livebox.Controller:relay.1 |
Installation
If you have a firewall make sure the following are allowed
Process | Port | Type | Usage | ||||
---|---|---|---|---|---|---|---|
iServer & Flash | 9996 | TCP | Used for connection of the Flash application to the iServer | ||||
iServer | 3639 | UDP | xAP Broadcast port | ||||
iServer & Flash | 843 | TCP | Adobe socket policy server |
Joggler
If you haven't done this then you need to consult the following documentation.
http://www.jogglerwiki.com/wiki/SSH
Above instructions replicated locally in case they ever disappear! Joggler SSH access there is also an alternative method that involves booting into a Ubuntu distribution jogglercommandshell
It's advisable that you are familiar with the Linux environment as the Joggler runs Ubuntu under the bonnet. Instructions will be given to edit files etc and it's assumed you have a working knowledge of vi and associated tools.
iServer installation
The iServer is a TCP/UDP gateway to work around that fact that FLASH cannot participate in UDP based communication. You may run it on the following platforms:
- Joggler
- HAH → Preloaded. It just needs to be enabled
- PC running Windows → install instructions
You do need run at least one of these, somewhere, for the xAPFlash application to communicate.
Joggler xAP binaries
Installation onto the Joggler is straightforward.
# cd /tmp # wget http://www.dbzoo.com/public/joggler-xap.run # sh joggler-xap.run
This self extracting shell script will install the following onto your Joggler.
/ |-- etc | |-- init.d | | `-- boot.d | | `-- S70boot.xap | |-- plugboard | | |-- plugboard.lua | | `-- samples | | |-- airytecSwitchoffApplet.lua | | |-- ... | | `-- xapCacheWebserverApplet.lua | `-- xap.d | |-- build | |-- iserver.ini | |-- plugboard.ini | `-- xap-serial.ini |-- setup `-- usr |-- bin | |-- aliasmsg | |-- bscmsg | |-- iServer | |-- ini | |-- iniget -> ini | |-- iniset -> ini | |-- xap-hub | |-- xap-plugboard | `-- xap-serial |-- lib | `-- libxap2.so `-- share `-- lua `-- 5.1 |-- pl | |-- Date.lua | |-- ... | `-- xml.lua `-- xap |-- bluenode.lua |-- ... `-- roomnodetwin.lua
To enable various features you edit the ini files in /etc/xap.d setting enable=1
If you are running your Joggler over wireless you need to edit /etc/init.d/boot.d/S70boot.xap and uncomment the “ra0” network interface usage.
# Uncomment for WIRELESS MYDEV="-i ra0"
Your hostname for the Joggler by default is “atom” you can change this in /etc/hostname it will be used in the triple “dbzoo.atom.XAP-PROGRAM”
Starting the Joggler xAP software
/etc/init.d/boot.d/S70boot.xap start
see The 'iserver' parent element for configuration of the XML.
xAPFlash installation
If you already have xAPFlash installed on your Joggler this will perform an upgrade of the graphics and application leaving your XML configuration files intact. If you don't already have it installed, it will additionally modify a configuration file so that the LAUNCH icon appears on your Joggler dashboard. A reboot will be required if installing for the first time. UPDATE: I found that even if just upgrading you needed a reboot for the new version to load.
# cd /tmp # wget http://www.dbzoo.com/public/xapflash.run # sh xapflash.run
To check what version you are running, look for a version number string in the xap-hbeat generated by the application
xap-hbeat { v=13 hop=1 uid=FF.0739:0000 class=xap-hbeat.alive interval=60 source=UKUSA.xAPFlash.pc } Heartbeat { Version=beta 0.5g Logon=Joggler IP=192.168.1.4 }
If you are not running the iServer on the Joggler itself, you need to modify the config.xml and adjust the IP address from 127.0.0.1 to that of wherever your external iServer is running.
The following files/directories are placed onto your Joggler
- /media/appshop/xAP
- /media/appshop/applications.xml (modified)
Browser
Works with Internet Explorer, Firefox and Safari, it should work in any browser supporting Flash (v10). Flash however imposes various security restrictions that this application violates. Specifically, it accesses your network via TCP (the iServer) whilst also having access to your local filesystem to read the config file. This combination is forbidden as standard in the Flash security settings and so you will have to relax them by adding the local files folder location as a trusted site.
Navigate to this site to adjust your settings.
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
This site displays a page that show your personalised Flash security settings. Add the folder containing the xAP Joggler files to Flash's trusted sites. This will allow Flash to both access local files and the iServer.
You may also access these setting this way
- Control Panel → Flash Player → Advanced(tab) → Trusted Location Settings…(button)
The xAPFlash GUI is now embedded into the HAH firmware.
Configuration
The file format used for all configuration files is XML. The configuration of the system is split across two files:
- config.xml
- xAPconfig.xml (default and may be changed)
The ordering of pages, buttons and text boxes within the XML is significant as later elements are rendered on top of previous elements.
The system uses a configurable grid (table layout) in which to place an objects starting with position 0,0 as the top left hand corner. The object grid position snaps the top left corner of the object into a grid cell.
For example a 5×3 grid, the default, would have the following cell coordinates.
<gridXmax>5</gridXmax> <!-- maximum grid spaces horizontally --> <gridYmax>3</gridYmax> <!-- maximum grid spaces vertically -->
(0,0) | (1,0) | (2,0) | (3,0) | (4,0) |
(0,1) | (1,1) | (2,1) | (3,1) | (4,1) |
(0,2) | (1,2) | (2,2) | (3,2) | (4,2) |
config.xml
A sample configuration file showing tags and their structure:
<joggler> <version>0.5</version> <name>joggler</name> <xAP> <uid>0737</uid> <indicate1wayBSC/> <bscbuttons/> <bscpages/> <bsctextboxes/> <bscinternals/> </xAP> <usejogglerapi>auto</usejogglerapi> <configfilelocation>local</configfilelocation> <configfile>xapconfig.xml</configfile> <pausescreensaver>true</pausescreensaver> <startupvolumelevel>0</startupvolumelevel> <startupscreenbrightnesslevel>100</startupscreenbrightnesslevel> <iserver> <port>9996</port> <ip>192.168.1.138</ip> <password>Frogstomp</password> </iserver> <layout> <gridXmax>5</gridXmax> <gridYmax>3</gridYmax> <aspectLock>true</aspectLock> <background> <image>background.jpg</image> <scaleX>800</scaleX> <scaleY>420</scaleY> </background> <defaults> <button/> <label/> <time/> <bsctext/> <textbox/> </defaults> </layout> </joggler>
Parent tag: <joggler>
Tag | Value | Description | |||
---|---|---|---|---|---|
<version> | String | A indication of the target for this configuration file. Its purpose is informational only - it's not processed! | |||
<name> | String | A string this is used to construct the xAP source name for the Flash application, this is the xAP instance name to complete the tuple VENDOR.DEVICE.INSTANCE. The VENDOR and DEVICE are hardcoded into the application as UKUSA and xAPFlash respectively. Given the name joggler we would therefore construct the following: UKUSA.xAPFlash.joggler |
|||
<usejogglerapi> | true,false,auto | Activate available API functions. Recommend you use 'auto' When running on the Joggler, it is possible to take advantage of many of the built-in API functions. |
|||
<startupvolumelevel> | 0-100 | Set the Joggler volume level on starting the application. Only used when the Joggler API is detected |
|||
<startupscreenbrightnesslevel> | 0-100 | Set the Joggler screen brighness level on starting the application Only used when the Joggler API is detected |
|||
<pausescreensaver> | Boolean | Will prevent the Joggler screen saver from starting while the application is running Only used when the Joggler API is detected. |
The 'configfilelocation' element
Parent tag: <joggler>
This is a string to indicate the location of where to find the user interface. The default is the local filesystem. It may also be a URL to a local webserver if you have many Jogglers that need to keep their user interfaces in sync.
Note: When using the URL form do no specify the configuration file, simply the location with a trailing /
<configfilelocation>http://webserver.com/configuration/</configfilelocation>
The system will append the <configfile> to the contents of this tag.
The 'configfile' element
Parent tag: <joggler>
Specify the configuration file to load that contains the User Interface definition. Defaults to: xAPconfig.xml
A relative path specification will be from the location of where the xAPFlash application is running.
The 'xAP' parent element
Configuration via the following locations:
- config.xml:
<joggler> <xAP>
- xapconfig.xml:
<joggler> <config> <xAP>
- config.xml:
<joggler> <override> <config> <xAP>
There are four distinct areas within xAPFlash that implement BSC. Pages, Buttons, Text Boxes and some inbuilt endpoints that control internal functionality. Each area is false by default.
Tag | Value | Description | |||
---|---|---|---|---|---|
<uid> | Number | Each xAP application on your network must have a unique UID. If you have more than one Joggler running xapFlash or are running the Flash application more than once then you must adjust this field. |
|||
<bscbuttons> | Boolean | Default: false | |||
<bscpages> | Boolean | Default: false | |||
<bsctextboxes> | Boolean | Default: false | |||
<bscinternals> | Boolean | Default: false | |||
<indicate1wayBSC> | Boolean | Default: false - Used for BSC endpoints that do not respond to query events. Enables usage of the special xapbsc- schema to designate a GUI element as controlling a 1way BSC element, that is a BSC element that does not support xAPBSC.query |
Those bsc… tags
Display elements (pages, text boxes and buttons) are exposed as xAPBSC endpoints in their own right. This means that they generate 'events' on your network as they change state and can be controlled remotely. The visibility of each element is reported using the state= parameter within a xAPBSC.info or xAPBSC.event message. Visibility for any screen element is controllable from xAP using xAPBSC.cmd messages. You must use a non wildcarded target= line and the correct ID= value within your .cmd messages. Buttons also expose their 'pressed' state using an additional level based 'Button.State' endpoint. The actual on/off uses the state= parameter and because buttons can display multiple states they report this using the level=x/10 parameter. Button.State is an input only xAP endpoint and so cannot be controlled from xAP.
The 'iserver' parent element
- config.xml:
<joggler> <iserver>
- xapconfig.xml:
<joggler> <config> <iserver>
- config.xml:
<joggler> <override> <config> <iserver>
The contents of this section informs the system where the iServer is located, if you have installed the iServer onto your Joggler then the IP address will be 127.0.0.1 This is what you need to adjust if you have an external iServer.
Tag | Value | Description | |||
---|---|---|---|---|---|
<port> | number | iServer listening port. Default: 9996 | |||
<ip> | Dotted quad | IPv4 address of the iServer | |||
<password> | String | Optional. Default: Joggler |
<iserver> <port>9996</port> <ip>192.168.1.138</ip> <password>Joggler</password> </iserver>
The 'layout' section
Parent tag locations:
- config.xml:
<joggler> <layout>
- xapconfig.xml:
<joggler> <layout>
- config.xml:
<joggler> <override> <layout>
Configuration tags within this section control Look & Feel of the interface setting up global values and establishing defaults for configurable items; such as labels, buttons and textboxes.
Tag | Value | Description |
---|---|---|
<gridXmax> | Number | The number of horizontal buttons in the default grid. Default: 5 |
<gridYmax> | Number | The number of horizontal buttons in the default grid. Default: 3 |
<aspectLock> | Boolean | Setting this true will ensure that the vertical and horizontal gutter (between button) spacing is the same. This ensures double or treble size buttons remain square and line up |
<marginLeft> | Number | The pixel border width at the left of the Joggler screen (usually positive must not be 0 but can be negative) |
<marginRight> | Number | The pixel border width at the right of the Joggler screen (usually positive must not be 0 but can be negative) |
<marginTop> | Number | The pixel border width at the top of the Joggler screen (usually positive must not be 0 but can be negative) |
<marginBottom> | Number | The pixel border width at the bottom of the Joggler screen (usually positive must not be 0 but can be negative) |
the 'background' section
Parent tag locations:
- config.xml:
<joggler> <layout> <background>
- xapconfig.xml:
<joggler> <layout> <background>
- xapconfig.xml:
<joggler> <page> <background>
- xapconfig.xml:
<joggler> <page> <background>
* config.xml:
<joggler> <override> <layout> <background>Configures a default background image that will appear on each <page> unless override. See the 'page' tag <code xml> <joggler> <layout> <background> background.jpg
<scaleX>800</scaleX> <scaleY>420</scaleY> </background> </layout> </joggler> </code> Remember the Joggler screen size is 800×420. Key legend * L - Usable in the <layout> section * P - Usable in a <page> section * T - Usable in a section
Tag Key Value Description <image> LP String The name of the image file to load as the background.
The following file formats are accepted: JPG, PNG, GIF, BMP and SWF<scaleX> L Number set the width of the background image. Default: 100 <scaleY> L Number set the height of the background image. Default: 100 <width> P Number set the width of the background image. Default: 0 <height> P Number set the width of the background image. Default: 0 <visible> PT Boolean Background is shown <colour> PT String 0xRRGGBB colour specification <posX> P Number Horizontal pixel position for this element
If signed eg +20 then is relative to the default grid position of this element.<posY> P Number Vertical pixel position for this element
If signed eg -20 then is relative to the default grid position of this element.the 'defaults' section
Parent tag locations:
- config.xml:
<joggler> <layout> <defaults>
- xapconfig.xml:
<joggler> <layout> <defaults>
- config.xml:
<joggler> <override> <layout> <defaults>
Here we establish the baseline for our visual components to create a common look and feel and to reduce the amount of repetition in their specification.
We use the British English spelling for colour. Hoo Ra!Parent tag Allowed child tags Description || <font> <fontsize> <fontcolour> <alpha> <offset> || || <bsctext> <font> <fontsize> <fontcolour> <alpha>