It has a simple organization as follows:{"":{"config": {"":"",...},"in": {"":""|"/",...},"out": {"":"",...}},"":...}This structure can be seen as a collection ofkey/value pairs through which the blocks, that theend-user application will use, are i<strong>de</strong>ntified, andtheir basic configuration information is provi<strong>de</strong>d. Aslong as there is a correspon<strong>de</strong>nce between the representedblocks (CLASS in "") and Javaclasses (CLASS.class, in Java), the WFM will beable to instantiate and build the <strong>de</strong>fined system in runtime.This structure is not only easily read but can alsobe written or edited very simply. Future work will befocused on having this structure generated through avisual programming tool and fed to the applicationautomatically.Figure 1: Architecture of our <strong>de</strong>mo application, wherebiosignals are acquired from an external hardware <strong>de</strong>vice,displayed in a mobile <strong>de</strong>vice through a rich user interface,and sent to a remote server for efficient processing; the resultsof the processing stage is returned back to the phonefor presentation to the user.Conceptually, the framework uses three types ofblocks: a) the normal blocks, which take input data,perform a specific task, and output results; b) theSources, which are a special type of blocks that onlyhave outputs; c) Sinks, that are a special type of blockwhich only have inputs. Our framework has the un<strong>de</strong>rlyingassumption that the functional blocks aretriggered by the output data produced by the Sourceblocks, and thus, a normal system operational flowstarts on the sources and generally ends on Sinks (aspart 1 of Figure 1).All the information about the type, input/outputconnections and configuration of the blocks, which,overall, characterize a realization of a system, is representedusing a structure <strong>de</strong>fined according to theData Processing Language, which will be further <strong>de</strong>tailedin the next section.2.2 Data Processing LanguageThe <strong>de</strong>scription of a system to be instantiated by theWFM, is <strong>de</strong>scribed using a JSON-based specificationto which we called Data Processing Language (DPL).2.3 Workflow ManagerThe WFM is the core of the mobile framework, andit manages the execution and interaction between thedifferent blocks. It contains a handle to every importantinstance of the system, and it is through the WFMinstance that most of the others communicate.The most <strong>de</strong>manding task performed by the WFMis the initial network setup from the DPL structure.As soon as the end-user application starts, a JSONstructure, following the specification <strong>de</strong>scribed in theprevious section, is fed to the WFM. Then, using athe high performance JSON processing library, allblocks are instantiated sequentially, configured, andconnected among themselves through their input andoutput channels.Once the whole system is assembled, all that remainsto be done is to trigger it, namely by startingthe sources. Then, the arrival of the data itself to theinput of the next block triggers its operation, and soon. Finally, the processed data will arrive to a sinkwhich gets the flow to an end. Sinks end the flow eitherby saving, streaming or displaying their input.Usually, this action of starting the sources, istriggered by an UI event. Since the UI is shownthrough a Webview, which, in turn displays HTMLcontent, the native part of the application must beable to exchange events with the Javascript si<strong>de</strong>.Hence, the Webview class provi<strong>de</strong>s a method calledaddJavascriptInterface, that binds a Java objectto Javascript. This object turns out to be the interfacebetween the Java (the native Android) and Javascript
(in the HTML page) worlds (further explanation continueson the next section).The WFM communicates with this interface(hereafter called JSI) through messages containingcommands to be executed. For this reason, the WFMhas also the very important task, which is to parse an<strong>de</strong>xecute these command messages. Likewise, sincethe only way to the JSI is across the WFM, all datathat needs to be displayed to the user has to arrive tothe WFM to be correctly dispatched.2.4 User InterfaceThe UI is, as in most applications, one of the mostimportant parts of the platform. It needs to be able notonly to accurately display the data to the user, but alsoto get his inputs, all this in intuitive and aestheticalways (Tidwell, 2011).Another concern taken into account in the <strong>de</strong>signof our framework was the unification of the layoutof the platform, between the mobile or other clients.This led to the use of the Android OS Webview component,that enabled the interaction and display ofHTML content, which also allows the use of exactlythe same UI both on the mobile phone, and on a standardPC interface.The presentation layer is <strong>de</strong>coupled from the processingbackbone. In the Android case, the Javascriptinterface is configured to receive commands from JSI;in a client running in a browser, it is configured to receivecommands from a Websocket.The mechanism behind this versatility is hid<strong>de</strong>n inthe script contained in the HTML file. This script isresponsible for the seamless behavior of the UI eitheron the browser or in the Android: all the commands tobe executed by the JavaScript world are handled by anobject bound to the JSI instance in Android. So, if itdoes not exist, it is created as a JS websocket, linkingthe page in the browser directly to the server.In or<strong>de</strong>r not to computationally overload the Webkitengine, responsible for ren<strong>de</strong>ring the HTML pagewith the layout (as it does in the built in browser ofthe OS) all the processing is done at the Java backend,before reaching the Webview, since, in addition,we believe that, in Android, native methods are fasterand more efficient than web scripts.3 MOBILEBIT PROOF OFCONCEPT: CARDIOWATCHTo <strong>de</strong>monstrate the potential of our framework, a<strong>de</strong>mo application was built, entitled ”CardioWatch”.The goal of this application is to show the subjectheartbeat, measured using a bioPLUX, biosignal acquisition<strong>de</strong>vice connected to an 1 lead ECG sensor.The acquisition unit is interfaced with the Android environmentvia Bluetooth. On the other end, there isa remote server that performs the signal processing,which is accessible over the web.Insi<strong>de</strong> the Android-powered <strong>de</strong>vice this is materializedthrough a system composed by a sequence offour blocks: a BioPlux, a Websocket, a FlotBlockand an HTMLfield, which are, respectively, the virtualrepresentation of: the acquisition <strong>de</strong>vice; the implementedsocket connection to the server; the ECGline chart; and the heart rate (HR) numeric display.The Data Processing Language structure, correspondingto our application example, is the following:{"BioPlux:Bio":{"config":{"MACaddress":"12:34:56:78:9A:BC"},"in":{},"out":{"0":"ECG"}},"Websocket:Wskt":{"config":{"Port":"9999","Host_URL":"123.456.7.890"},"in":{"0":"ECG"},"out":{"0":"SV","1":"HR"}},"FlotBlock:Flot":{"config":{"FlotDiv_id":"graphHol<strong>de</strong>r"},"in":{"2":"SV"},"out":{}},"HTMLfield:HR":{"config":{"FieldDiv_id":"hr"},"in":{"0":"Wskt/1"},"out":{}}}Here we can see how the connections between theinput (in) and output (out) channels of the blocks areperformed and also how the configuration parameters(fields un<strong>de</strong>r config) vary amongst the blocks. Eachblock extends the abstract Block class, although theyperform very distinct tasks.For instance, the BioPlux block implements methodsfor controlling a bioPLUX (Gamboa and Silva,2007) <strong>de</strong>vice via Bluetooth. This <strong>de</strong>vice is connectedto a pair of electro<strong>de</strong>s that gathers the ECG signalfrom the hands, at a configurable sampling frequencythat can go up to 1000Hz, and sends them to the Android<strong>de</strong>vice, namely to the BioPlux block (whichends up being a virtual image of the actual <strong>de</strong>vice).The Websocket is a block that implements a fullduplexsingle socket connection (Websocket, 2012)over which messages can be sent/received to/from aremote server. With this, the gathered signal can beremotely filtered, analyzed and returned along withsome of its features. In this <strong>de</strong>mo case, at the server,the signal is filtered, downsampled, and the instantheart rate is computed and retrieved. This functionalityprovi<strong>de</strong>s a rapid prototyping framework of com-