Home
Developer Manual
Contents
1. Code Description 1 Default error 2 Library is not initialized 3 Library is initialized 4 Library initialization error 5 No respond from remote device 20 Library is searching for the devices now 21 Device is not found 31 Device is connected 32 Error during connecting to the device 33 Device is not connected 34 Default port error 50 Phone ID or SMS content is empty 1001 Remote device default error 1011 Bluetooth initialization error on the remote device 1015 Packet error 1031 Messenger module initialization error on the remote device 1032 Messenger module is not initialized on the remote device 1033 Message send error on the remote device 1051 Phone module initialization error on the remote device 1052 Phone module is not initialized on the remote device 1053 Phone accept the call error on the remote device 1054 Phone drop the call error on the remote device 1055 Phone make the call error on the remote device 1072 Messenger module and Phone module is not initialized on the remote device Table 5 Phone library error codes Page 97 AsTeRICS Developer Manual Other Phone Library interface data Data Description enum PhoneState Indicates current phone state PS_IDLE 1 PS_RING PS_ CONNECTED define Default_port 1 Indicates the default port number which can be used in th
2. Sets the property with the specified key in the port with the Page 93 AsTeRICS Developer Manual specified ID with the given string representation of the value String getChannelPropertyKeys String channellD Reads the IDs of all properties set for the specified component Reads the IDs of all properties set for the specified channel String getChannelProperty String channellD String key Returns the value of the property with the specified key in the channel with the specified ID as a string String setChannelProperty String channellD String key String value Sets the property with the specified key in the channel with the specified ID with the given string representation of the value Methods for status checking String queryStatus Queries the status of the ARE system i e OK FAIL etc public String getLogFile Serializes and returns as a string the Log file Table 1 ASAPI server interface Method Description Methods to discover and connect disconnect to AREs InetAddress searchForAREs Searches in the local area network LAN for available instances of the ARE The exact protocol for discovery can vary e g it could be based on UPnP SLP or a custom protocol ASAPI_Server connect InetAddress ipAddress Connects to the ARE at the specified IP address The method returns an instance of the ASAPI Server inter
3. All methods related to model execution are also executed in the ModelExecutor thread In case of sensor plugins e g FacetrackerLK Timer SignalGenerator ButtonGrid other threads are involved that generate event or time based data The FacetrackerLK plugin uses a FrameGrabber thread to grab and forward frames via a callback method Similarly the Timer and SignalGenerator plugins use a thread for periodically scheduling events Finally the ButtonGrid gets informed about button clicks by the Java Swing Event Dispatch Thread EDT If a plugin wants to send data to an output port or trigger events to the event triggerer socket by using the respective methods DefaultRuntimeOutputPort sendData and DefaultRuntimeEventT riggererPort raiseEvent the execution is automatically handed over to the ModelExecutor thread The class AstericsModelExecutionThreadPool contains the code for the single threaded functionality and provides two types of public methods to be used by developers 8 1 Asynchronous method execute public void execute Runnable r Hands over the given Runnable and adds it to a bounded blocking queue default size 500 The Runnable tasks are executed asynchronously in the ModelExecutor thread and rejected if the queue is full This is especially important if a sensor thread produces too many callbacks and hence Runnables to execute If the ModelExecutor thread is too slow because of hardware limitations or because it is bl
4. Access Descritption Data 0Oxa001 Arduino version 1 sensor actuator 0x0000 r Unique serial number 4 bytes 0x0001 r w Set Pin Directions input or output 2 bytes Data Direction State of Port B DDRB and Port D DDRD Bit 0 Pin Input Bit 1 Pin Output 0x0002 Set Output Pin States or Input Pin Pullup State 2 bytes Byte 1 Output Pin values of PORT B Byte 2 Output Pin values of PORTD For Input Pins activate pullup Value 0 off 1 on 0x0003 Get Input PIN Change 2 bytes Byte 1 input PIN values of Port B Byte 2 input PIN values of Port D 0x0004 Activate ADC Periodic Value Reports 2 bytes bytes 0 1 period time 0 off to 65535 milliseconds 0x0005 ADC Value Report 12 bytes 6 channels of ADC values Byte 1 chn1 low byte Byte 2 chn1 high byte Byte 3 chn2 low byte Byte 4 chn2 high byte Byte 5 chn3 low byte Byte 6 chn3 high byte Byte 7 chn4 low byte Byte 8 chn4 high byte Byte 9 chn5 low byte Byte 10 chn5 high byte Byte 11 chn6 low byte Byte 12 chn7 high byte 0x0006 Set PIN Mask for auto send back Input PIN Change events 2 bytes Byte 1 input pins of Port B Byte 2 input pins of Port D 0x0007 Set PWM channel value 2 bytes Byte 1 channel number 0 5 operation mode 0x1x servo Ox2x PWM Byte 2 channel value 0 255 Page 70 AsTeRICS Developer Manual 6 3 1
5. X printStackTrace Example function call Important the files libthrift jar slf4j api 1 6 0 jar and slf4j simple 1 6 0 jar must be included in the build path Page 95 AsTeRICS Developer Manual 10 Native ASAPI Libraries Native ASAPI is a software development kit for 3rd party developers to help them adapt their application for people with motor disabilities Native ASAPI will be delivered as a set of DLL libraries for the Microsoft Windows Operating system Native ASAPI works independently of ARE 10 1 Phone Library The Phone Library is designed to control mobile phones The library uses Bluetooth connection to connect to the Phone Library Server Application running on the mobile phone Currently the Phone Library uses the Microsoft Bluetooth stack other stacks will be considered The Library is delivered as a PhoneLibrary dll file Currently the Phone Library Server Application for Windows Mobile operating system has been developed The Server application works on the phones running Windows Mobile 5 0 and above To install Server application Serverlnstall cab file e On Windows XP install the ActiveSync application e Connect the phone to PC using USB cable On Windows 7 if you connect the Windows Mobile phone for the first time the Microsoft Windows Mobile Device Center application will be installed automatically e Using ActiveSync or Windows Mobile Device Center copy the Server installer to the
6. with features for mouse keyboard joystick emulation e Upon special request CIM firmware for the Arm Cortex M3 or other architectures can be delivered by AsTeRICS partners IMA of FHTW The corresponding JAVA implementations on the ARE side can be found in the respective plugins Arduino and RemoteMouse RemoteKeyboard RemoteJoystick Page 75 AsTeRICS Developer Manual 7 into the Deep Concepts of the ARE middleware The following section describes the ARE architecture for executing system models in more detail A High Level view of all system components looks as follows device Personal Computer Asterics Configuration Suite ASAPI Client execution environment Operating System Windows Linux device Embedded Platform Asterics Runtime Environment AsTeRICS Components AsTeRICS ASAPI System Display Controller Server Optional a Java Virtual Machine execution environments Operating System Linux Figure 1 High level view of the system architecture deployment model 7 1 1 Runtime Model Concepts The ARE hosts and controls the components that realize the Assistive Technology AT applications As such it features a component based approach where various specialized plug ins i e Sensors processors and actuators are interfaced together to realize the desired behavior The main runtime model concepts in the ARE are t
7. ASAPI Client which extends the ASAPI Server with commands for discovering and connecting disconnecting to the server side and the ASAPI Native which provides specialized functionality for deploying certain components directly in the client bypassing the ARE These relationships are illustrated in the above figure The functionality of a full ASAPI Client is defined in deliverable 2 1 System Specification and Architecture 1 section 4 4 Page 86 AsTeRICS Developer Manual 9 1 ASAPI and ARE Interconnection The following figure shows the ASAPI protocol connection to the ARE and the ASAPI native interface which provides certain functions for PC AT developers aside the ARE e g mobile phone access or special PC peripherals which will be investigated during WP6 The native interface can provide well defined functions as sending an SMS which do not imply signal processing plugins of the ARE and can thus be accomplished directly on the PC As soon as the AsTeRICS Runtime Environment and the embedded platform are involved the ASAPI command and data protocol can be used to interact with the ARE The ASAPI protocol is a platform independent specification per se To implement an ASAPI client templates in JAVA server side and C client side will be provided as an early outcome of WP4 Embedded Plattform ARE Java OSGi Figure 10 ASAPI client implementations with without nat
8. 0x05 300 Hz 0x06 600 Hz 0x07 1200 Hz other values are not allowed and will result in an error reply 0x0062 r w BMA180 range 1 byte range 0x00 1g 0x01 0x02 2g 0x03 3g 0x04 4g 0x05 8 g 0x06 16g other values are not allowed and will result in an error reply 0x0063 BMA180 X Y Z data 7 bytes byte 0 TRUE if new data are acquired since last read otherwise false bytes 1 2 acc_x 14 bit value bytes 3 4 acc_y 14 bit value bytes 5 6 acc_z 14 bit value 0x0064 r w Accelerometer Data Event 1 byte 0x00 disabled 0x01 OxFF enabled feature 0x0063 X Y Z data is sent automatically every time when new data are acquired The period is set by feature 0x0061 Page 66 AsTeRICS Developer Manual 6 3 6 PT 1 Core CIM CIM ID Feature Access address Descritption Data 0x0601 0x0000 Unique serial number 4 bytes Core CIM version 1 0x0001 r GPIO Input State 1 byte Bit 0 Input 1 Bit 3 Input 4 0x0002 r w GPIO Input Threshold Voltage 2 bytes bytes 0 1 threshold voltage value for inputs 1 4 0 to 25000 mV 0x0003 r w GPIO Input Pullup State 1 byte Bit 0 Input 1 Bit 3 Input 4 Value 0 off 1 on 33K resisor connected to 3 3 V 0x0004 r w GPIO Input Value Change Event 1 byte Bit 0 Input 1 Bit 3 Input 4 Value 0 off 1
9. Add Variable et Restore Default Entries Apply Revert Page 14 AsTeRICS Developer Manual 2 4 Building ARE Middleware Services and Components For building the ARE middleware and components plugins the supplied ANT build scripts are recommended Apache ANT is a command line based build tool for Java applications 8 Eclipse provides an ANT plugin which operates these build scripts named build xml in the AsTeRICS repository You can either use the command line ant command in a windows shell or use the Eclipse plugin The middleware the services and the components have separate build xml files The middleware and services are required for building the components To build everything a top level build script is available in the ARE folder To use this top level build script switch to the Java Project Perspective right click the build xml file located in ARE section of the Navigator window as shown below and select the second menu entry in the context menu 2 RunAs gt Ant Build r a Toui a Java ARE build xml Eclipse Edit Configuration a File Edit Navigate Search Project rs z Edit configuration and launch Q v Run an Ant build file A 85 Navigator 52 Name ARE build xml oJ se a E Main x Refresh gr Build yg Targets gt gt Classpath lt gt Properties JRE BB Environment Common components junit
10. J FacetrackerCLMInstan Bridge java 3 Statically load the native library MANIFEST MI static Same for both versions System loadLibrary facetrackerLK AstericsErrorHandling instance getLogger fine Loading facetrackerLK d1l1 ok USING opencv097 Uncomment following lines if building the opencv097 based version System loadLibrary cxcore097 e Loading cxcore097 d11 em loadLibrary cv097 ricsErrorHandling instance getLogger fine Loading cv097 d11 System loadLibrary highgui097 AstericsErrorHandling instance getLogger fine Loading opencv097 Uncomment this if building the opencv 2 3 1 based version Figure 27 Loading the right dependencies in Bridge java for the facetrackerLK plugin Lastly it is sufficient to make sure that the actual MANIFEST MF file matches the MANIFEST_videoinput MF that is distributed with the release 13 5 FaceTracker Library At the time of writing we decided not to include the static library built upon the original sources made available by the author to the consortium As soon as a decision will be made a mechanism for building the plugins which depend on the FaceTracker library will be put in place This is not a problem anyway for the runtime distribution as the FaceTracker is compiled statically to the distributed plugins Page 118 AsTeRICS Developer Manual 14 References and R
11. ThreadPoolTasks submitTimeout 20000 o When submitting a task to be executed in the ModelExecutor thread a submit timeout can be configured After the time elapsed a TimeoutException is thrown The timeout value must be specified in milliseconds The submit timeout is used for starting stopping pausing and resuming a model Page 20 AsTeRICS Developer Manual 2 6 Debugging the ARE If the ARE is started using the start_debug bat script and source level debug information was added during the compilation see section 2 3 debugging with Eclipse is supported via a remote debugging connection This is a convenient way for debugging an OSGI based java framework with a lot of plugins To enable the debugging support in Eclipse a Debug Configuration is created via the dedicated menu entry Java ARE components processor adjustmentcurve build xml Eclipse File Edit Navigate Search Project Run Window Help oe E NS Ora were fs Navigator 3 Debug As gt no launch history 4 E ARE Debug e 4 amp components Organize Favorites Create a Remote Java Application Debug Configuration and assign a name for it e g ARE Then specify the connection properties of the Debug Configuration to use the Host localhost and the Socket Port 1044 this port is given in the ARE build scripts for the remote debug server to listen for incoming client connections Create man
12. WINDOWS D CRT SECURE NO WARNINGS D _VC80_UPGRADE 0x0710 D _MBCS Gm EHsc RTC1 MTd GS fp precise Zc wchar_ t Zc forScope Gd analyze errorReport queue link my e file obj DLL OUT my_ c file dl1 INCREMENTAL NO NOLOGO AB PATARA OSV e TB PATA VSsachoeeyzlaie Wecloes iso Wexeleyercias2 Ikauo Yeemercils ave Aaoi Iso UojoxsyavesLS 2 s Ligt Wolegz Isto Wat Twi toes Lalo Hiire Lg Wiktereiaveyil ozs Ho Huser impu OOl oe omoa aa a E ae o Ibs oleaut32 lib NODEFAULTLIB libcd 1lib NODEFAULTLIB atlthunk NODEFAULTLIB LIBCMT MANIFESTUAC level asInvoker uiAccess false DEBUG SUBSYSTEM WINDOWS TLBID 1 DYNAMICBASE NO MACHINE X86 ERRORREPORT QUEUE Note that the compiler and linker switches may differ depending on the nature of your dependency libraries and setup Page 57 AsTeRICS Developer Manual 5 14 External Helper Applications and Tools for Plugins Some pluings make use of external helper applications which are self contained binary executable files and communicate with the particular ARE plugin usually via a socket interface These helper applications are stored in the folder ARE tools Currently the following plugins use external tools Plugin Name Helper Application and Purpose Interface SpeechProcessor Tools SpeechProcessor exe This application
13. ceeeeeeeee etre eee eeeneeee eset eee tteeenaaeeeeeeeeetteeea 28 3 2 1 Component Collection Management in the ACS cccceeeeteeeeteeeeeeeeeeeeee 29 4 Writing AsTeRICS Plugin Code visiescscctecccdieiuassennen henna yieinigee nda ehddac eee ehoneentent 30 4 1 ARE GC ding GUINGCIIIES vias coc cpcet tet cd actot ante teben tiles A alive ee eenaed ues 30 4 1 1 Port Naming Conventions vsckcar cteariehsanratedinnss oe haaae de teatiiwnvectednatieaedaieedl 30 4 1 2 Property Naming Conventions ccccccceeeeeeeeeeeeeceeeeeeeeeeeesaaaeeeeeeeeeeneesaaaes 30 4 1 3 Bundle Descriptor Naming Conventions cc eeeeeeeeeeeeeeeenneeeeeeeeeeeeeeenaaees 31 4 1 4 AsTeRICS Source File header ccccccccceeeeeseceeeceeeeeeeeeeeeeaaeeeeeeeeeeseeenaaees 31 4 1 5 JavaDoc compatible COMMENTS c cccceeeeeeeeeeeeeeeeeeeeeeeeeecaeeeeeeeeeeeeeeesaaees 31 4 2 Implementing AsTeRICS component eeeececcceeeeeeeeeeeeeeeceeeeeeeeeeteeessaeeeeeeeees 32 4 2 1 The Bundle Descriptors auciciec evens da ateacts cecwehid eu eees hapteeeade aie td antesangeerumaadeeeeetes 32 AsTeRICS Developer Manual 4 2 2 The Deployment DeSCriptor cece ccccceceeeeeeeeeeeeeeeeeeeeeeeesenaeeeeeeeeeeeeeeenaaees 33 42 37 The Manitesttilo ti sch es alc Geta a al ena cal cadets aii ecu gt eles 34 4 2 4 Structure of OSGi bundles containing ARE component ccceeeeeeeees 34 4 2 5 Component MOC YS ees ee Seed BN
14. compile and link the videolnput library and use it inside the plugins projects In order to do that it is necessary to move videolnput headers and libraries to the third party folder in the ARE components directory Figure 25 shows the contents of the videolnput folder inside the ARE components libraries 3rdparty folder videolnput h and myqgedit h should go into include and video nput lib goes into lib Page 116 AsTeRICS Developer Manual AsTeRICS gt ARE components libraries 3rdparty videoInput gt 4 New folder Documents library videoInput a Name Date modified Type a include 07 02 2012 22 45 File folder lib 12 02 2012 11 33 File folder Figure 25 videolnput final installation 13 4 Building facetrackerLK Once the Opencv 2 3 1 and Videolnput are in place the building process of the facetrackerLK plugin is straightforward The webcam sln solution is configured with three targets Relase VI Release cv231 and Release cv097 The Relase VI target will use Videolnput to acquire from the webcam and OpenCV 2 3 1 for processing while Release cv231 will use OpenCV 2 3 1 for both tasks Lastly the target Release cv097 will use Videolnput for image acquisition and an old version of the OpenCV for processing If we want to opt for the Videolnput based video capturing then we will proceed as in Figure 26 webcam Microsoft Visual C 2010 Express File Edit View Proje
15. getProperty String String setProperty String String String getAllPorts Port getinputPorts InputPort getOutputPorts OutputPor y getAllPortiDs String getinputPortiDs Stringi getOutputPortiDs Stringi getPortByiD Siring Port 44444 4 interface model Channel OutputPort OutputPort Map lt String String gt getPortType PortType addinputPortEndpoint String InputPort boolean removelnputPortEndpoint String boolean sendDsta D void getSourceComponent Component InputPort getSourcePort QutputPort InputPort Msp lt String String gt getTargetComponent Component getPortType PortType getTargetPort hputPort mustBeConnected boolean receiveData D void HH Figure 5 Runtime model for the binding concept A typical binding is illustrated in Figure 5 The binding is associated to two components and an input and output port one from each of them Typically a source i e output port might be associated to multiple targets i e input ports Nevertheless in this runtime model it is assumed that each binding consists of exactly one source and one target port One to many bindings are also implicitly supported via multiple instances of one to one bindings Special channels can also be formed between event ports In this case both input and output ports can be used to connect multiple channels Event channels can be formed betwe
16. phone e Run the Server installer The server application will be installed 10 1 1 Phone Library interface The library interface is declared in the PhoneLibrary h file Phone library interface functions are declared with the C linkage The Phone Library functions return a positive value if it succeeds If a function fails it returns a value lower than 0 and the returned value is the code of the error Library functions Function Description int init DeviceFound deviceFound NewSMS Initializes the Phome Library The deviceFound newSMS PhoneStateChanged newSMS and phoneStateChanged parameters are phoneStateChanged LPVOID param pointers to the call back functions implemented in the Phone Library user application The param parameter is a parameter defined by the user and passed to the call back functions int close Closes the library int searchDevices Starts searching for devices For each discovered device the DeviceFound call back function is called int connectToDevice unsigned _int64 Connects to the device defined by the deviceAddress Page 96 AsTeRICS Developer Manual deviceAddress int port parameter int disconnect Disconnects the device int makePhoneCall LPWSTR recipientID Makes a phone call The recipientID parameter is the recipient phone ID int acceptCall Accepts incoming phone calls int dropCall This function drops
17. AbstractRuntimeComponentinstance class which every AsTeRICS component extends The method implementation creates the list of valid properties and returns it to the middleware and the latter forwards the string list to the ACS via ASAPI The ACS will dynamically update the property list in the properties window For an example of the dynamic property implementation see the WaveFilePlayer plugin Page 51 AsTeRICS Developer Manual 5 12 Data Synchronization Some plugins need data of multiple input ports to be able to start processing Without data synchronization it is possible that one input port of a plugin receives multiple values before another port gets one value although both signal channels deliver values at the same sampling rate The synchronization service provides a buffering mechanism at the middleware level that can be utilized by plugin developers in order to make sure that incoming data of selected input ports arrives synchronized To use the synchronization service in the plugin code plugin developers are expected to extend the DefaultRuntimelnputPort instead of implementing the Runtime nputPort Basically DefaultRuntimelnputPort provides a default implementation for the necessary buffering methods as shown in the table below public abstract class DefaultRuntimeInputPort implements IRuntimeInputPort private boolean buffering public void receiveData final byte data 3 public void startBuffe
18. AsTeRICS Developer Manual Concept interface Concept model Component interface getProperty String String model Port setProperty String String String ai aha ea getAliPorts Port gel ype getinputPorts inputPort eN farae getOutputPorts OutputPort getDataType DataType getAliPortiDe Stringi getBufferSize int getinputPortiDs Stringi getProperty String String getOutputPortiDs Stringi setProperty String String String getPorByiD String Port a Figure 3 Complex view of runtime model for the component concept These concepts are illustrated in Figure 3 A component can be any of three main realizations sensor processor and actuator On the other hand a port can be instantiated either as an input or an output port Sensors have one or more output ports only actuators have one or more input ports only and processors have both one or more input ports and one or more output ports 7 1 1 2 Ports The ports are the main concepts allowing interfacing between components Ports are classified as input or output ports depending on their role Each port features a buffer where data is accumulated before it is communicated outwards output ports or before it is internally consumed input ports Furthermore each port is associated with a specific data type indicating the type of the data communicating through the port
19. Check targets to execute amp middleware Name Description amp osgi buildARE amp wale E buildServices amp a v buildComponents default m pies build All rif a buildAll release amp tools X classpath X project 1 out of 6 selected build xml Sort targets Hy LPC1758_ T Hide internal targets not selected for execution Target execution order buildComponents Apply Revert D Ge This opens the Edit configuration and launch window where the build targets of the top level build script can be selected These build targets provide different on Click builds for the AsTeRICS framework 2 4 1 One Click Builds The top level build script allows building all components that exist in the source tree It also defines several properties which are inherited to all component build scripts An important example is the debug property which defines via compiler options if the code shall be instrumented with source code level debugging information true or not false The top level build script provides the following targets e BuildARE builds just the middleware e BuildServices builds the middleware and all services eg CIMCommunication etc e BuildAll cleans build targets builds middleware services and components Page 15 AsTeRICS Developer Manual e BuildAll release cleans build targets builds middleware services and components without source l
20. Developer Manual In our case this folder is AsTeRICS ARE components libraries 3rdparty opencv as we can see in Figure 16 The folders that should be moved into it are the includes and the libraries The user can choose whether to link against the static or a dynamic version of the binaries Figure 16 shows the content of the build folder as installed by the original opencv installer opency build x86 vcl0 4 Search vei0 p hare with New folder H S Name Date modified Type i bin 17 08 2011 05 13 File folder J lib 17 0 05 13 File fc dJ staticlib 17 08 2011 05 31 File folder Figure 15 Folder structure created by the OpenCV installer If the choice is to use the dynamic libraries then also the bin folder should be added to the PATH system variable This is not needed if the static version is used just rename the name of the folder to lib when copying fete a GO ARE components libraries 3rdparty opencv gt Search P Organize v Include in library v Share with v New folder S i a actuator oscilloscope Name Date modified Type actuator phonecontrol B TOPS 10 01 2012 12 40 ile folder a actuator platformdigitalout p lib 10 01 201 fol 10 01 201 41 ile folder a actuator platformicd B h 10 01 fold share aun torre o actuator remotejoystick 10 01 Text D t 10 Documen opency bt actuator remotekeyboard OpenCVConf
21. Examples of such data types carrying the representation and semantics as inherited from the Java language are e Byte a single byte e Boolean true or false e String an array of bytes representing ASCII characters e Integer a 32 bit integer e Double a 64 bit double precision scalar The main properties and relationships of the port concept are illustrated in Figure 4 Page 78 AsTeRICS Developer Manual enumeration model DataType dataType readOnly enum BYTE CHAR SHORT enumeration enumeration INTEGER model PortType model Multiplicity LONG FLOAT F ar portType resdOnly multiplicity freadOnly DOUBLE enum enum INPUT ONE_TO_ONE Date Type String OUTPUT ONE_TO_MANY toString String interface model Port getPortType PortType getMultiplicity Multiplicity getDataType DataType getBufferSize int getProperty String String setProperty String String String OutputPort InputPort OutputPort Map lt String String gt InputPort Map lt String String gt getPortType PortType getPortType PortType addinputPortEndpoint String InputPort boolean mustBeConnected boolean removelnputPortEndpoint String boolean receiveData D void sendData D void Figure 4 Runtime model for the port concept The port concept features methods for accessing the port type its multiplicity its data type and also for g
22. IN a since ancateianueahies 74 6 3 14 PT2 ZigBee ClMes bet cish it eee ocetccee cette eacte tate etatenc etal ken eek tae 74 6 4 Demo Implementations of the CIM protocol cc ccecceceeeeceeeeeeeeeeeeeeeetieeeeeeeeeeteees 75 7 into the Deep Concepts of the ARE middleware sssssssseernnnesserrenrrrnrrsssrrrrerrnresset 76 7 1 1 Runtime Model Concepts tcc codke siete estescaesseutertacteesanenviiowmnetteneaneientaana 76 7 1 1 1 COMB OM CTIG t niora edith ea a da E 77 7 1 1 2 POS esaera an an dai a e A teacaveabeass 78 7 1 1 3 Channels aeree a a a a a a aa 80 7 1 1 4 Component Architecture of ARE ssssssssssssersesssssrerrrrrrrrssrrrrrrrnnrrssrrrrrrrnn 80 8 ARE threading concept for model execution 2 cece eeeeeneeee eee eeeeeeeeeeeeeeeeeeeteeeenaeeeeeeees 83 8 1 Asynchronous method execute scot d ecengddivadind Mieseg terete iro Reed eerie 84 8 2 Synchronous method execAndWaitOnModelExecutorLifecycleThread 0 84 8 3 Pro and Contra of the single threaded approach ccceeeeeeeeeeeeeeeeeteeeeeeeeeeeteees 84 9 ASAPI Clients and SerialiSation ccceccccccceeeeeeeeeeeeeeeeeeeeeeeeeseeaaeaaeeeeeeeeeeseseaaaeeeeeees 86 9 1 ASAPI and ARE Interconnection cece ecceeeeeee eter eeeeeeceeeeeeeeeeeetenenaaeeeeeeeeeneneaa 87 9 1 1 ASAPI and ARE in the configuration process eeeeeeeeeeeeeeeeeeeeeeneeneeeeeeees 88 9 2 Available ASAPI COMMANGS 26 cicsiceeceeed avcieieeendd heeded et ee
23. Manual private int addInt final int in buffer addFirst in if buffer size gt bufferSize buffer removeLast float sum Of for int item buffer sum item return Math round sum buffer size private class InputPortl implements IRuntimeInputPort public void receiveData byte data int in ConversionUtils byteArrayToInt data outputPortl sendData ConversionUtils intToByteArray addInt in private class OutputPortl extends DefaultRuntimeOutputPort Override public void sendData byte data super sendData data Note that the implementation details above build upon the code which is generated by the AsTeRICS PluginCreationWizard tool Specifically the above methods belong to the class of the desired Averager plugin which extends and implements the abstract class AbstractRuntineComponentinstance This class provides some standard implementation of the lifecycle support methods The implementations of the input and output ports implement or override that of the IRuntimelnputPort and DefaultRuntimeOutputPort respectively In the first case the receiveData method is overridden so that the input bytes are converted to an integer then processed using the local private method addlnt and finally delegated to the output port The latter has actually no implementation A dummy implementation is used to illustrated overriding the s
24. SEE a E 45 5 4 Keyboard Mouse Native Hook Services ccceeeeeeeeeeeeneeeeeeeeeeeeeeeeaeeeeeeeeeeteeea 45 5 5 Computer Vision SCMICES errsnraeeire ranee E A aY 45 5 6 Data Conversion Utilities icc ces iccsccaseeciteeteersesseessieaateeeveae vadacsnteassaseneess eetintseaneanieee 46 ed E Te 6 gs Ree ee acs eae ose ae oa ae E er ec eh 46 5 7 1 Stat s checking piires nenn a r levee ctor WEE oes 47 58 The ARE Thread Poolkiereerarcreree eee e a E EE E 48 59 TNE ARE GUISUpDOM rinn naeie eel oe coset teteae tera te sel es cena 49 5 10 ARE core events notification SErviCeS ccccceeeeeeeeeeeeceeeeeeeeeeeeeneeaeeeeeeeeeetenas 51 5 11 Dymanmic PrOperiecins 3 ick Gash tai a ee Aa eA toe ee 51 512 Data SYACMrOMiIZatlOne vite Ms ecsGaesse orani OTA eect Sone T AED O eea 52 5 13 Interfacing Native C C Code via JNl sssssssssseeeneesssserserrrnrrsserrrrnrnnnrsssrrrrnrrnneeeet 54 5 13 1 Specifying native libraries in the Manifest cc ccceeeeeeeeeseeeteeeeeeeeeeeeeeesnaaees 54 5 13 2 Java Implementation UNI Bridge ccceeeeesseeeceeeeeeeeeeeeeseeeeeeeeeeeeeeneeeeeaees 54 5 13 3 C Implementation Callbacks and UNI COdC seeeeeseeesseeeseeeeseeeeeeeeeeees 56 5 14 External Helper Applications and Tools for Plugins cceeeeeeeeeeeetteeeeeeteeeeeeee 58 6 Communication Interface Modules and Protocol c ccccceeeeeeeeeeeeeeeeeeeeeeeeesenneeeeeeees 59 6 1 Communica
25. SKF_KeyDown Vkey SKF_KeyUP LeftCtrlkey SKF KeyUP Stopping hook and closing the library void closeLibrary stopHook close Page 105 AsTeRICS Developer Manual 11 Appendix A OSGl related Information 11 1 The OSGi framework and it s layers The core component of its specification is the OSGi framework The Framework provides a standardized environment to applications called bundles and is divided in a number of layers LO Execution environment L1 Modules L2 Life Cycle management L3 Service registry A ubiquitous security system is deeply intertwined with all the layers Figure 14 OSGi layers from http Awww osgi org About Technology The LO Execution environment is the specification of the Java environment Java 2 Configurations and Profiles like J2SE CDC CLDC MIDP etc are all valid execution environments The OSGi platform has also standardized an execution environment based on Foundation Profile and a smaller variation that specifies the minimum requirements on an execution environment to be useful for OSGi bundles The L1 Modules layer defines the class loading policies The OSGi Framework is a powerful and rigidly specified class loading model It is based on top of Java but adds modularization In Java there is normally a single classpath that contains all the classes and resources The OSGi Modules layer adds private classes for a module as well as con
26. actuator modelSwitcher src main java eu asterics component actuator modelSwitcher ModelSwitcherinstance java Eclipse File Edit Run Source Refactor Navigate Search Project Window Help or BH Ord rOvQ G r G6V F vive Grvor FEY Ba SVN Repost iii FB Package Explorer 5 Navigator 3 e 3 ote ModelSwitcherinstance java 53 O El Task List 3 an By ApiDemos ns E I lt cl ill 1 af Le Bp ARE if ELP_SWITCHMODEL equalsIgnoreCase eventPortID i rna al ra i Ae amp components z return elpSwitchModel actuator analogout E3 Uncategorized actuator bardisplay amp actuator digitalout actuator enobiodisplay actuator event_visualizer actuatorfilewriter actuator gui_tester amp actuator irtrans actuator keyboard actuator konnex actuator midi actuator modelSwitcher actuator mouse actuator oscilloscope actuator platformdigitalout actuator platformicd actuator remotejoystick actuator remotekeyboard actuator remotemouse actuator synthetic_voice actuator text_display actuator wavefileplayer libraries compile ne E Problems Javadoc 2 Declaration El Console 3 lt terminated gt ARE build xml Ant Build C Program Files x86 Java jdkd 7 0_01 bin javaw exe 20 12 2011 16 30 07 return null a public IRuntimeEventTriggererPort getEventTriggererPort return null e public Object getRuntimePropertyV
27. added FHTW debugging instructions fast raw port controller updated file directory structure 2 5 Oct 27 2014 Updates for Release Version 2 5 added FHTW websocket info added usage info for threadpool added Java 8 install infos added multithreading info for plugin development 2 6 March 27 Updates for Release Version 2 6 added FHTW 2015 description of single threaded model execution concept Page 2 AsTeRICS Developer Manual Table of Contents Version HISTO 2 4 a2ca ets ec ie cutenens dant inanin in Race cnaine cede Manu hn N n a a RT 2 O aioe 1 07 12 a EEE E EE EE EEE A E E E EE ee 7 1 1 About the AsTeRICS project s sssssssnnennneesseeenerrnrrrsserrrrrrnntrsstrrrrnrnnnnrssrrrnnrnnnneseet 7 1 2 Aboutthis doc ment eee eee E R eae eee 7 1 3 The AsTeRICS Runtime Environment 0 eeeeccecceeeee eee eeeeeseeeeeeeeeeeeeeesesaaaeeeeeees 8 1 3 1 ARE C mponeMSisennnusnnann inan n e a E 9 E E S eD AONI AE E E ee E E E 9 2 Getting Started with AsTeRICS Development cccceeeceeeeeeeeeeenneeeeeeeeeeeeeeneeeeeeeees 10 2 1 The AsTeRICS Source Code Repositry ccccccccccceess cccceeeeeeeeeeeeeseaeeeeeeeeeeeeeees 10 2 1 1 Repository structure 2 222s ect ca nied Kotte Ms ean A ies Ae ee Saeten ees 10 2 2 Setting up the Eclipse IDE for ARE development ccceeeeeeeeeeeeeteeeeeeeeeeeeeee 11 2 3 Setting up build environment for JDK 8 cceceeeceeeeeeeeeeceee
28. an incoming phone call or disconnects phone calls int getPhoneState PhoneState amp phoneState Gets actual phone state of the mobile phone int sendSMS LPWSTR recipientID LPWSTR subject Sends SMSs The recipientID parameter is the recipient phone ID the subject parameter is the message content Table 3 Phone library functions Library call back functions definitions Function Description typedef void __stdcall DeviceFound unsigned _int64 deviceAddress LPWSTR deviceName LPVOID param This function is called when a new device is found The deviceAddress parameter is the address of the discovered device The deviceName parameter is the name of the device If the returned deviceAddress parameter is equal to 0 the device search process finishes typedef void __stdcall NewSMS LPWSTR PhonelD LPWSTR subject LPVOID param This function is called when there is a new SMS available The PhonelD parameter is the sender phone ID The subject parameter is the SMS content typedef void __ stdcall PhoneStateChanged PhoneState phoneState LPWSTR phonelD LPVOID param This function is called when the phone state is changed The phoneState parameter defines current state of the phone The phonelD is the remote phone ID Table 4 Phone library call back functions Error codes returned by functions declared in the PhoneLibraryErrors h file
29. are necessary to build the ACS from it s SVN sources 1 Install Visual Studio The ACS buildflow is testet with VS 2010 the usage of VS 2010 10 is recommended Using the free VS2010 express version is possible with some restriction for example no editor for GUI creation 2 Install SVN plugin for Visual Studio If the subversion repository should be accessed within VisualStudio please install a SVN extension for VS The plugin AnkhSvn is recommended 11 it can be downloaded at http ankhsvn open collab net 3 Install Microsoft Ribbon Library The Microsoft Ribbon Library 12 has to be installed The Ribbon Library used for the compilation of the ACS is version v4 0 0 11019 1 It can be downloaded at http www microsoft com download en details aspx id 1 1877 4 Install the ResXFileCodeGenerator For making the Resource file for language support also available in the xaml format a new code generator has to be installed This is not required for the building process of the ACS but it helps when developing editing the XAML Files Downlaod the CodeGenerator for the Homepage http www codeproject com KB dotnet ResxXFileCodeGeneratorEx aspx and install it If you are using VS2010 also add the ResXFileCodeGeneratorEx reg to your Windows registry by double clicking it This file can be found in the HowTo subfolder of the SVN More on this code generator can be found at 13 Page 109
30. assembly of software built with the Java technology 3 The OSGi Service Platform facilitates the componentization of software modules and applications and assures interoperability of applications and services over a variety of networked devices OSGi technology is the dynamic module system for Java Java provides the portability that is required to support products on many different platforms The OSGi technology provides the standardized primitives that allow applications to be constructed from small reusable and collaborative components These components can be composed into an application and deployed The OSGi Service Platform provides a service oriented architecture that enables these components to dynamically discover each other for collaboration and thereby forms the optimal basis for the AsSTeRICS middleware Page 9 AsTeRICS Developer Manual 2 Getting Started with AsTeRICS Development 2 1 The AsTeRICS Source Code Repository The AsTeRICS source code repository is hosted at github and located at https github com asterics AsTeRICS The source code contains open source software modules in JAVA C and C and proprietary modules by AsTeRICS partners which are available in binary from dll or exe The licenses of the utilized software packages and 3 party products can be viewed in the file documentation licenses doc Currently the editor for OSKA the on screen keyboard application is the only commercial software
31. code KEYBOARDLIBRARY_API int __ stdcall sendKeyByVirtualCode int virtualCode Simulates a key event using a virtual key code SendKeyFlags flags KEYBOARDLIBRARY_API int __ stdcall Simulates text being typed in defined by the text sendText LPWSTR text parameter KEYBOARDLIBRARY_API int __stdcall blockKeys BlockOptions blockOptions Blocks or Passes key events The blockOptions parameter defines the function s behaviour Table 12 Keyboard Library functions Keyboard library interface functions are declared with the C linkage The Keyboard Library function returns a positive value if it succeeds If the function fails it returns a value lower than 0 and the returned value is the code of the error Page 103 AsTeRICS Developer Manual Call back function Function Description typedef int __ stdcall HookCallBack int scanCode int virtualCode HookMessage message HookFlags flags LPVOID param This function is called if there is a new key event The scanCode parameter defines the scan code of the key the virtualCode parameter defines the virtual key code the message defines message type the flags parameter defines additional information about the key event the param parameter is a parameter passed by the user If the returned vaule is lest than 0 the library will block the event if the returned value is greather than 0 the library will pass the event If the
32. controller The port controller provides the same methods for sending packets using the CIM protocol for raw port implementations and for future uses such as a port controller handling Zigbee connections 5 1 2 CiMPortManager All CIM ports and other COM ports are access through the main class of the package CIMPortManager This is implemented as a singleton with a public access method getInstance Thus all calls to the CIM communication service have to be done through CIMPortManager getInstance Upon creation the CIMPortManager detects all the connected CIMs and registers them in a HashMap CIMs are identified and stored by the combination of their CIM Id and their unique number Therefore multiple CIMs of the same CIM Id can be used on the AsTeRICS platform On some computers there exist certain serial ports which do not work correctly and behave strangely An example of such a port is a loopback port which echoes everything written to it or ports created by Bluetooth dongles Since the ClIMPortManager iterates through all serial ports these ports can cause problems in the auto detection of attached CIMs and even lock up the runtime Therefore a file ignore_ports txt in the directory data cimcommunication is parsed upon start of the auto detection This file should be filled with the name of the COM ports behaving erratically one name per line To be able to communicate with a CIM the CIM port manager provides several methods publi
33. creates an instance of the Microsoft speech server for speech synthesis and recognition It accepts a list of commands from the plugin and sends back recognized voice commands TCP IP socket OscGestureFollower Tools GestureFollower gfOSC_v1 4 exe The GestureFollower algorithm by IRCAM Allows training and recognition of several signal patterns for example from multichannel sensor data TCP IP socket Open Sound control OSC protocol FaceTrackerCLM Tools EyesState Trainer EyesStateDetect exe Tools EyesState Trainer EyesStateRecord exe Tools EyesState Trainer EyesState Train exe Training application for detection of open or closed eyes of a user for application with the FaceTrackerCLM plugin The training process is exaplained in the Model Guide for the FaceTrackerCLM plugin Offline interface via file SSVEPStimulator Tools blit exe Creates a flickering images from a given bitmap file and it s x y coordinates on the desktop screen for Software generated visual stimulation in SSVEP BCI tasks Commandline parameters to the application call SSVEPFileWriter ProtocolSSVEPTrain SSVEPDetect Tools SSVEPTrainFunction exe Finds significant frequencies in an SSVEP training recording which has been generated by the SSVEPFileWriter plugin Offline interface via file Page 58 AsTeRICS Developer Manual 6 Communication Interface Modules and Protocol This section desc
34. eee 91 9 37 SeralisatioNise vrei ati caer eadeatiue enel vacate E E ues Gath evenaeioes 94 9 3 1 The TPIT SF IMI OR TG ennnen inenen nnn e donate 94 9 3 2 Ene Thrift Compilet 2c50 hacker k dia ia Meee OA eee 95 9 3 3 Mhe Thrift LIDi ary 2s acetal gece occlude lace e e aA tacs elem nena eck elena ees 95 93 4 Simple Java GClent reserse e E mesilate 95 10 Native ASAPI Libraries a4 tan t2Gca Goede cae ea eae a en aaa neser nennen 96 NOT Phone LIBFANY y cve tre cet cts te iecereitien a a clei ane heer clsty E EEN 96 AsTeRICS Developer Manual 10 1 1 Phone Library intenace sic scicsce eel ecieckads teat ec pedaedeeeda edie 96 10 12 Example OLAS seat cet a e R EEE E 98 10 2 GSM Modem Library 2 3 seseiceciicecens ccven cual ins tenecees cueskueenededvenepes sist sincies aaeeeneneied aerate 99 10 2 1 GSM Modem Library interface cece ceeeeeeeeee eee eeeeeenneeeeee tree teeeenaeeeeeeeeeeteee 99 10 225 EXAMpIG OF USE ce csi cenonsi cat a ated a neat ao tees OR A 101 10 3 3D Mouse LiDrary cisccs aenetion naeticeauieh E A dee eee ede 102 10 3 1 3D Mouse Library interface sseccse cece ce ceceeetet aan oeteraetei dati ene ne tei reaa meted eg 102 10 3 2 Example OF USO ss henra in EEE E hahaa EEOAE nee 102 10 4 Keyboard Library 2 saa Sse as ON ae NS eae Me OM ee ennn 103 10 4 1 Keyboard Library interface ccceeeeccceeee cere eeeeeeeeeeeeeee eee eeeeaaaaaeeeeeeeeeeneea 103 10 4 2 Example Of Se annae a a E EER acne alan
35. event type key event up key event down extended key sent The SKF_KeyPress flag is defindes as SKF_KeyPress SKF_KeyDown SKF_KeyUP Page 104 AsTeRICS Developer Manual enum BlockOptions Used in the BlockKeys function It defines the function s behaviour It can take the following values BO_PassAll BO_BlockAll 1 BO_PassSentFromLibrary BO_BlockAll If it takes the BO_PassSentFromLibrary 2 BO_PassSentFromLibrary value the function passes BO_PassAll 3 keyboard events generated by SendKeyByScanCode y SendKeyByVirtualCode and SendText functions and blocks all other keyboard events Table 15 Other Keyboard Library interface data 10 4 2 Example of use The call back function will block or pass the event according to the blockKeys function int stdcall hookCallBack int scanCode int virtualCode HookMessag message HookFlags flags LPVOID param TEE OA Initialization of the library starting hook setting library to pass event generated by the library and block all other key events void initKeyboardLibrary int result init hookCallBack 0 if result gt 0 Starcuook i blockKeys BO PassSentFromLibrary Sending Ctrl V key combination from the library define Vkey 0x56 define LeftCtrlkey 0xA2 void sendCtrlVv sendKeyByVirtualCode sendKeyByVirtualCode sendKeyByVirtualCode sendKeyByVirtualCode LeftCtrlkey SKF KeyDown Vkey
36. gt lt componentType id asterics averager canonical name eu asterics component processor averager AveragerComponent gt lt type subtype Basic Math gt processor lt type gt lt description gt Linked list based averager lt description gt lt ports gt lt imiowiekorc acl Vatin ILS lt description gt Input port of averager lt description gt lt multiplicity gt one to one lt multiplicity gt lt mustBeConnected gt true lt mustBeConnected gt lt dataType gt integer lt dataType gt lt inputPort gt Oui pul POs lOO ute sla lt description gt Output port of averager lt description gt lt dataType gt integer lt dataType gt lt outputPort gt lt ports gt lt properties gt lt property name buffer size type integer value 50 description The size of the averager s buffer gt lt properties gt lt componentType gt lt componentTypes gt Page 32 AsTeRICS Developer Manual 4 2 2 The Deployment Descriptor Deployment descriptors instruct the ARE of the desired application deployment structure The deployment descriptor is typically composed in the AsTeRICS Configuration Suite ACS but can also be written with a text editor as the bundle descriptor Basically the deployment descriptor contains several component descriptions copied from the corresponding bundle descriptors actual property values and the channel connection between input and output ports of the componen
37. installed AsTeRICS plugin Furthermore the ARE expects a runtime model system model which usually comes from the AsTeRICS Configuration Suite ACS The ACS is running on a Windows Personal Computer net 4 0 required and mainly used to graphically design the layout of the system as a network of interconnected components The system model is another XML file that defines the components participating in a specific application connections between them events and other properties Based on this file ARE knows which plugins to activate and how to define the data flow between them Since the system model represents the main communication means between the ACS and the ARE it is expected to be a serialisable object easy to transfer and translate ARE and ACS communicate through an appropriate TCP IP based communication protocol named ASAPI RPC RMI TCP IP The ARE also provides services to plugin developers for example communication support for COM ports and it allows reporting errors on the runtime environment registering event listeners and interacting with its graphical user interface ARE GUI The ARE GUI is a simple graphical environment developed to allow end users to interact directly with the runtime environment It may be used to modify runtime parameters of a model via buttons or sliders and to monitor live signals and events of the running model Page 8 AsTeRICS Developer Manual 1 3 1 ARE Components The
38. is not found or if the data types of the ports do not match Also an exception is thrown if there is already a channel connected to the specified input port only one channel is allowed per input port except for event ports that can have multiple event sources void removeChannel String channellD throws AsapiException Removes an existing channel between the specified source and target components and ports Throws an exception if the specified channel is not found Methods to read and edit properties even while running String getComponentPropertyKeys String componentID Reads the IDs of all properties set for the specified component String getComponentProperty String componentlID String key Returns the value of the property with the specified key in the component with the specified ID as a string String setComponentProperty String componentiID String key String value Sets the property with the specified key in the component with the specified ID with the given string representation of the value String getPortPropertyKeys String portID Reads the IDs of all properties set for the specified port String getPortProperty String componentID String portID String key Returns the value of the property with the specified key in the component with the specified ID as a string String setPortProperty String componentID String portID String key String value
39. of an example ARE deployment and describes the usage of OSGi bundles i e self contained modules For a brief overview on OSGI see chapter 1 4 Last but not least the developer manual also gives some deeper insights into the middleware the CIM port manager and the communication framework between ACS and ARE which is based upon the ASAPI client server architecture using Thrift For an introduction to ASAPI the AsTeRICS Application Programming Interface see chapter 8 To get used to the AsTeRICS system s capabilities and concepts it is recommend to download and install the AsTeRICS setup installer package from the project homepage and to read the AsTeRICS User Manual which describes the main system components the AsTeRICS Configuration Suite ACS and the AsTeRICS Runtime Envirunment ARE Page 7 AsTeRICS Developer Manual 1 3 The AsTeRICS Runtime Environment The AsTeRICS Runtime environment ARE is an OSGi based middleware 3 which allows software plugins to run in parallel The plugins usually represent a sensor or an actuator and are implemented as independent OSGi bundles The runtime environment identifies AsTeRICS plugins from other OSGi bundles based on metadata defined inside the plugins The ARE expects from plugin developers to define the structure of their plugins properties inputs outputs and event ports in XML files Based on these XMLs the middleware constructs a runtime representation of each
40. of supported features eg 8 bytes for 4 feature addresses 0x10 ARE CIM request write feature bytes according to feature 0x10 CIM ARE reply write feature bytes according to feature 0x11 ARE CIM request read feature bytes according to feature 0x11 CIM gt ARE reply read feature bytes according to feature 0x20 CIM gt ARE event reply bytes according to feature 0x80 ARE CIM request reset CIM 0x80 CIM ARE reply reset CIM 0x81 ARE CIM request start CIM 0x81 CIM ARE reply start CIM 0x82 ARE CIM request stop CIM 0x82 CIM ARE reply stop CIM Page 61 AsTeRICS Developer Manual 6 2 2 Mode Status code in MSB Mode Direction Description Status code Bit 0 ARE CIM CRC mode Bit value 0 CRC is not appended to packet and not checked on receiving side Bit value 1 CRC is checked on receiving side packet is dropped if CRC wrong Bits 1 7 ARE CIM Currently not used Bit 0 CIM ARE CRC mode as in received packet from ARE Bit 1 CIM gt ARE Error 1 Lost packets serial number mismatch Bit 2 CIM gt ARE Error 2 CRC mismatch Bit 3 CIM ARE Error 3 Invalid or unsupported feature Bit 4 CIM gt ARE Error 4 Invalid ARE version Bit 5 CIM gt ARE Error 5 CIM not ready Bit 6 CIM gt ARE Currently not used Bit 7 CIM ARE Other Error description available in data field 6 3 Feature Lists and CIM IDs of all AsTeRIC
41. on 0x0005 r w GPIO Periodic Input Value Event 2 bytes bytes 0 1 period time 0 off to 65535 milliseconds 0x0010 r w GPIO Output State 1 byte Bit 0 Output 1 Bit 3 Output 4 0x0011 r w GPIO Output Pullup State 1 byte Bit 0 Output 1 Bit 3 Output 4 Value 0 off 1 on 0x0020 Ww Store current CIM state to EEPROM as default power on state none 0x0070 Ww clear status LCDisplay none 0x0071 w clear window on status LCDisplay 8 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 width bytes 6 7 height byte per value would be now sufficient but in case of larger display in future word size is used 0x0072 r w set text window on status LCDisplay 8 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 width bytes 6 7 height window must fit on the display otherwise error is returned 0x0073 r w set text font 1 byte 0 Terminal 6 6x8 pixels 1 Terminal 9 6x12 pixels 2 Terminal 18 12x24 pixels 0x0074 w print 1 to 2048 bytes null terminated string prints only part which fits in the text window set by feature 0x0072 Special characters n goes to next line but keeps the column r clears the line inside the window from the current position to the end of the line and then it goes to the beginning of the line So r r clears the full line b goes one charac
42. org 15 Simple Logging Facade for Java SLF4J framework http www slf4j org index html Page 119
43. package within the AsTeRICS framework and not included in the free downloads The OSKA editor is only needed if you want to design custom on screen keyboard layouts for OSKA see AsTeRICS User Manual 2 1 1 Repository structure The source code repository is organised in the following subfolders D acs d Android d ARE I bin di BNClevaluationSuite J CIMs di Documentation d NativeASAPllibraries The ACS folder contains the AsTeRICS Configuration Suite source code The Android folder contains a server application for Android phones which allows interfacing with the AsTeRICS Android plugin to use phone functions in AsTeRICS models The ARE folder contains the middleware and service layers and ARE components The bin folder contains subfolders where ARE and ACS executable files are placed during the build flow These folders contain additional configuration files or dependencies for example the config ini and loader ini files which specify the modules which are loaded by the ARE at startup Additionally the bin folder contains several resources which are useful e g a pre built ACS with demo models in the ACS models folder and the OSKA application Page 10 AsTeRICS Developer Manual The BNClevaluationSuite is a collection of matlab files for analysis and comparison of algorithms for Brain Computer Interfaces contributed by Starlab The CIM folder contains firmware for the microcontroller modules used to inte
44. should indicate the port s use and adhere to the standard Java variable naming conventions The available prefixes are e ip indicates that the port is an instance of IRuntimelnputPort e op indicates that the port is an instance of RuntimeOutputPort e elp indicates that the port is an instance of IRuntimeEventListenerPort e etp indicates that the port is an instance of IRuntimeEventTriggererPort A variable holding an event listener port could therefore be named elpKeyPressed 4 1 2 Property Naming Conventions Plugin properties should be directly mapped to a variable in the plugin code The variable s should be prepended with the prefix prop and adhere to standard Java naming conventions Thus a property could be named nputGainValue and the corresponding variable should be named prop nputGain Value Page 30 AsTeRICS Developer Manual 4 1 3 Bundle Descriptor Naming Conventions The bundle descriptor should serve as an abstraction layer between the user who creates models in the ACS and the developer Thus the names for plugins ports and properties in the bundle descriptor should be as intuitive as possible Names in the bundle descriptor should not include prefixes because the added information is also conveyed in the presentation of plugins in the ACS The bundle descriptor can translate intuitive names e g input switch to the canonical names of plugins e g GpiolnputInstance allowing coexistence of a user and a dev
45. static byte COMMAND REQUEST READ FEATURE 0x11 public final static byte COMMAND REPLY READ FEATURE 0x11 public final static byte COMMAND EVENT REPLY 0x20 public final static byte COMMAND REQUEST RESET CIM byte 0x80 public final static byte COMMAND REPLY RESET CIM byte 0x80 public final static byte COMMAND REQUEST START CIM byte 0x81 public final static byte COMMAND REPLY START CIM byte 0x81 public final static byte COMMAND REQUEST STOP CIM byte 0x82 public final static byte COMMAND REPLY STOP CIM byte 0x82 Furthermore the class contains constants for the global features that every CIM has to provide public static final short FEATURE UNIQUE SERIAL NUMBER 0 Upon reception of an incoming packet the component associated with the CIM sending the packet is notified and a reference to the packet is passed as an instance of CIMProtocolPacket wrapped in a ClIMEvent instance The developer can access all the fields of the packet via the getter methods the class provides public short getAreCimID public byte getSerialNumber public short getFeatureAddress public short getRequestReplyCode public byte getData public int getCrc Page 42 AsTeRICS Developer Manual 5 1 5 Serial ports not adhering to CIM Protocol Raw Ports Some peripherals use a proprietary protocol to transfer their data If this is the case the user can open a raw port t
46. the fonts of their GUI components depending on the space occupied for their plugins on the ARE desktop They need to pass o apanel to which all the internal fonts will be auto adjusted o the maximum font size in case there is more space available than needed o the minimum font size in case there is too little space which causes the text to become non readable Finally the offset argument is used in case we want to occupy a percentage of the available space A good approach to GUI plugin development is to analyse existing plugins which provide GUI elements e g the BarDisplay or Oscilloscope actuators or the Slider or Cellboard sensor components If the plugin uses Swing to implement a GUl widget e g Slider please check the following guidelines as well 4 2 8 Page 50 AsTeRICS Developer Manual 5 10 ARE core events notification services The ARE core events notification service allows plugins to register unregister to the ARE middleware in order to receive notifications of ARE core events e void registerAREEventListener AREEventListener clazz It is sometimes necessary that plugins can be notified of various ARE events so they can react as needed This method can be called by component instances that wish to be notified of such ARE events Currently the core events supported are o preDeployModel registered ARE event listeners will be notified just before the deployment of a model o postDeployModel register
47. the input ports that have been selected Page 53 AsTeRICS Developer Manual 5 13 Interfacing Native C C Code via JNI 5 13 1 Specifying native libraries in the Manifest The Manifest file of a bundle which includes native libraries has to specify these dlls as shown in the following example Manifest Version 1 0 Bundle ManifestVersion 2 Bundle Name asterics sensors mycomponent Bundle SymbolicName org asterics mycomponent Bundle Version 0 1 0 Bundle NativeCode lib native mylib1l dll lib native mylib2 dll lib native mylib3 dll osname win32 processor x86 osname win processor x8 6 64 osname win8 processor x86 osname win8 processor x8 6 64 osname windows 8 processor x86 osname windows 8 processor x86 64 osname windows8 processor x86 osname windows8 processor x86 64 osname Windows 8 1 processor x86 osname Windows 8 1 processor x86 64 DynamicImport Package Components which interface native code via JNI and their respective manifest files can be found in the SVN e g the webcamera component or the signal processing plugins by Starlab Note that the jar containing the dlls can be built manually using the command jar cvfm mybundle jar META INF MANIFEST ME 5 13 2 Java Implementation JNI Bridge The recommended way to interface Java code of an ARE component with native code in a dil is a bridge class which encapsulates the JNI functions and
48. value 50 Using the PluginCreationWizard the bundle descriptor the Manifest file the build script and the skeleton for the JAVA code can be generated see section3 1 Then the actual Java Code which implements the plugin s functionality can be added The functionality of this component is quite simple It takes as input integer values which are queued in a buffer in a first in first out order FIFO Whenever a new value is added the average of the buffer value is computed and provided in the output The size of the buffer is controlled by the buffer size property A possible implementation is shown below public static final int DEFAULT BUFFER_SIZE 10 private final LinkedList lt Integer gt buffer new LinkedList lt Integer gt private int bufferSize DEFAULT BUFFER SIZE public Object setRuntimePropertyValue String propertyName Object newValue if buffer size equalsIgnoreCase propertyName final Object oldValue bufferSize if newValue null if newValue instanceof Integer bufferSize Integer newValue truncate unnecessary tail elements while bufferSize lt buffer size buffer removeLast else AstericsErrorHandling instance reportError this Invalid property value for propertyNamet newValue return oldValue return null Page 36 AsTeRICS Developer
49. x System Components Edit Misc P 2 51 A i vi Options Plugin Plugin Creation Wizard Activation Wizard The creation of a new AsTeRICS plugin for the runtime environment involves several steps e creating the folder structure to store the plugin files e creating the ANT build script file e creating the manifest file e creating the bundle descriptor which specifies the ports and properties of the plugin e creating the source code file of the Javalnstance o defining the ports and properties and implementing the get and set methods for input output eventListener and evenTrigger ports o implementing the get and set methods for property values and the input ports receive handlers This process is similar for each plugin and involves much work and sources of errors especially for people who work with the AsTeRICS framework for the first time Usually you look for a plugin with similar specifications copy its folder structure and then rename and change the files as desired But also this process needs some effort and errors typos can be introduced very easily The purpose of the AsTeRICS Plugin Creation Tools is to make it easy to create new plugins by providing the necessary folder structure the bundle descriptor and a template for the JAVA source code Page 23 AsTeRICS Developer Manual 3 1 The Plugin Creation Wizard The plugin Creation wizard allows definition of characteristics of a new plugin and creates the n
50. 0 PT2 Core CIM CIM ID Feature address Access Descritption Data 0x0602 Core CIM version 2 0x0000 r Unique serial number 4 bytes 0x0001 r Digitallnput State 1 byte Bit 0 Input 1 Bit 2 Input 3 0x0003 r w Digitallnput Pullup State 1 byte Bit 0 Input 1 Bit 2 Input 3 Value 0 off 1 on 33K resisor connected to 3 3 V 0x0004 r w Digitallnput State Change Event 1 byte Bit 0 Input 1 Bit 2 Input 3 Value 0 off 1 on 0x0005 r w Periodic Digitallnput State Event 2 bytes bytes 0 1 period time O off to 65535 milliseconds 0x0010 r w DigitalOutput State 1 byte Bit O Output 1 Bit 1 Output 2 0x0011 r w DigitalOutput Pullup State 1 byte Bit O Output 1 Bit 1 Output 2 Value 0 off 1 on 0x0020 Store current CIM state to EEPROM as default power on state none 0x0031 r w 12 V GPO power output 1 byte 0 disable 1 255 enable 0x0040 Analog nput Value 6 bytes bytes 0 2 Input 1 value bytes 3 5 Input 2 value the values are in mV or miliohms according to the sensor type connected 0x0070 clear status LCDisplay none 0x0071 clear window on status LCDisplay 8 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 width bytes 6 7 height byte per value would be now sufficient but in case of larger display in future word s
51. ARE consist of the following main parts e The ARE middleware e ARE plugins also referred to as components sensor processor and actuator modules which provide functional building blocks for assistive functionalities e A service layer which provides infrastructure to the ARE components for example COM port and communication management for connection of the Communication Interface Modules CIMs The ARE is commonly deployed on an embedded device running an appropriate operating system OS typically an embedded variant of Windows On top of the OS an appropriate Java Virtual Machine JVM is used to host the OSGi component framework which provides support for modularity and dynamic loading unloading of components All the core components of the framework described in detail later are defined as OSGi modules Certain components that need to access legacy code e g written in C or C are also deployed on top of OSGi and are interfaced to the native code using Java Native Interface JNI as needed In this regard and with the exception of the pluggable components that use native code interfaces with platform specific JNI bindings the ARE middleware is expected to be platform independent The implementation requires basically JAVA 1 7 JDK JRE 7 and an OSGi framework which is part of the source code downloads 1 4 About OSGi The Open Service Gateway initiative OSGi is an open specification that enables the modular
52. As gt Ing e008 Derre ted Integer valueOf hexString 16 ntln Converted converted Add V8 Chrome JavaScript Exception Breakpoint san yen e arra Toggle Breakpoint Ctrl Shift B tai 0 0 6x8 0x8 Toggle Line Breakpoint Buffer wrap arr getInt ntln Converted converted Toggle Method Breakpoint Toggle Watchpoint X Skip All Breakpoints Remove All Breakpoints J Add Java Exception Breakpoint Add Class Load Breakpoint Breakpoint Types y i All References All Instances Ctrl Shift N Instance Count Watch Inspect Sates ETCH TT ex Progress a Develops l Shift re per See Set tion C Program Files 685 avaljre7 bin jovew Execute Ctrl U Force Return Alt Shift F ouse jar i Q External Tools gt ae LARE buildaml 3 amp 2 ARE linux build xml 3 ARE build xml 3 4 ARE build xml 1 3 SARE build xml 2 6 ARE linux build xml 1 3 7 ARE linux build xml 2 3 8 testNRSerial build xml Run As External Tools Configurations Organize Favorites 2 Click on tab Classpath and set the new Ant Home by clicking onto the respective button Lm pi Name ARE build xml E Main Refresh ar Build va Targets gt Classpath lt 5 gt Properties E JRE F Environment E Common Classpath a User Entries Up gt Ant Home Default gt BA Additional Tasks amp Support Down Remove Add JARs Add External JARs Add Folders
53. AsTeRICS Developer Manual 12 2 Update Process of the Schemata The XML Schemata describes the structure of plugin input and output ports events properties GUI as well as the model itself See section 4 2 1 The Bundle Descriptors and section 4 2 2 The Deployment Descriptor for further details Reading and writing these xml files will be done using generated classes The xsd exe compiler from the Microsoft Visual Studio e g located at C Program Files x86 Microsoft SDKs Windows v7 0A Bin xsd exe will be used fulfilling these tasks The commands xsd exe bundle model xsd c l cs xsd exe deployment model xsd c l cs creates the files bundle_model cs and deployment_model cs being used in the ACS See the ACS sourcecode for more information about the files Page 110 AsTeRICS Developer Manual 13 Appendix C Guidelines for Building Vision Plugins These notes want to provide a quick help to compile and link the computer vision supported plugins As of the day of the release of this document there are two principal plugins facetrackerLK and facetrackerCLM They both depends on several C C third parties libraries that the developers need to configure correctly in order to complete with success the building process Here s a list of the required libraries for each plugin e facetrackerLK o OpenCv recommended version gt 2 3 x o videolInput latest available e facetrackerCLM o OpenCv recommended ver
54. CIM version informs the ARE about specific feature deviations due to hardware and or firmware revisions The CIM may refuse to execute or respond to certain or all commands from ARE if the ARE version value is below the minimum compatible version required Data Size 0x0000 0x0800 Some of the commands or the answers from CIM may require optional data like the ADC DAC values The size says how many data is attached to the command or answer The maximum data size is limited to 2048 bytes If ARE sends a higher size value the CIM will handle it as incorrect packet and it will not respond to it but try to resynchronize the packet reception In case there is no data attached to the packet this value will be 0x0000 Serial packet number 0x00 0x7f Ox80 Oxff for event replies from CIM The serial number in a packet which is sent from ARE to CIM is incremented by the ARE every packet with values ranging from 0x00 to 0x7f The CIM sends the same value in the response packet This helps to identify what reply belongs to which request A packet which is sent from CIM to ARE without request e g in reaction to an event or periodically will have different serial numbers with the highest bit 0x80 set incremented by the CIM CIM Feature address This value from 0x0000 to Oxffff defines the addressed CIM feature The feature address 0x0000 holds a serial number which is unique for all manufactured CIMs of a specific type Al
55. ICALL Java_org asterics jni Bridge setProperty JNIEnv env jobject obj jstring key jstring value conse char lt sieckeys conse ehari S trVa Me jstring result if key NULL return NULL OutOfMemoryError already thrown strKey env gt GetStringUTFChars key NULL if value NULL return NULL OutOfMemoryError already thrown strValue env gt GetStringUTFChars value NULL if stromp propertyKey strKey 0 result env gt NewStringUTF propertyValue pollingIntervalValue strValue else result NULL property was not found env gt ReleaseStringUTFChars key strKey env gt ReleaseStringUTFChars value strValue return result prepare JNI callback JNIEnv env g_jvm gt AttachCurrentThread void amp env NULL Jelass Elg eny Gor Obnectela cisn Gmolbny i Jnerchod Dimri keny Ce tMethodTDIe E mew oore male cmc a lel pac ki W mae altel VINE perform JNI callback env gt CallVoidMethod jint my new data This native C code needs to be compiled into a dll the JNI header files and libraries have to be specified to the compiler and linker respectively An example for the Microsoft Visual Studio build tools looks as follows el g i C Program Piles x86 vava jdkl 6 0 21 incllude r Program Files x86 java jdk1 6 0 21 include win32 I 3rdparylib my c file cpp ZI nologo JAN Ol Oxy dy ENSA D T IDEBUGH D
56. Input Pullup State 1 byte Bit 0 Input 1 Bit 7 Input 8 Value 0 off 1 on 33K resisor connected to 3 3 V 0x0004 r w GPIO Input Value Change 1 byte Event Bit 0 Input 1 Bit 7 Input 8 Value 0 off 1 on 0x0005 r w GPIO Periodic Input Value 2 bytes Event bytes 0 1 period time 0 off to 65535 milliseconds 0x0010 r w GPIO Output State 1 byte Bit 0 Output 1 Bit 7 Output 8 0x0011 r w GPIO Output Pullup State 1 byte Bit 0 Output 1 Bit 3 Output 4 Value 0 off 1 on 0x0020 Ww Store current CIM state to none EEPROM as default power on state 0x0030 r w 5 24 V power output 2 bytes bytes 0 1 0 bypass to USB 5V 5000 25000 mV Page 63 AsTeRICS Developer Manual 6 3 3 Phone CIM Windows Phone OS CIM ID Feature Access Descritption Data address 0x0301 0x0000 r Unique serial number 4 bytes Phone 0x0001 w Phone Application request actuator Configuration 4 bytes init version 1 init reply 4 bytes error_code 0x0002 w Phone Application request Configuration 4 bytes close close reply 4 bytes error_code 0x0010 w Phone Manager request make call 4 bytes command make call 1 byte phone_id_len X bytes phone_id reply 4 bytes error_code 0x0011 w Phone Manager request accept call 4 bytes accept reply 4 bytes error_code 0x0012 w Phone Manager request drop call 4 bytes drop reply 4 bytes e
57. M ID where CIM ID value means 0x0b01 GPI v 1 0x0c01 GPO v 1 0x0d01 Accelerometer v 1 Page 74 AsTeRICS Developer Manual 0x0093 r Get active paired wireless same as above but the list is limited to CIMs list CIMs which sent at least 1 event since the last ZigBee CIM start 0x0094 w Erase CIM from paired list 6 bytes byte 0 3 unique serial number byte 4 5 CIM ID Note returned error when the specified CIM not paired 0x0095 r w Send and receive remote 8 N bytes wireless CIM features byte 0 3 unique serial number byte 4 5 CIM ID byte 6 7 data length N byte 8 7 N feature data when CIM ID 0x0b01 sent as event by the CIM only N 1 byte 8 GPI input state bit 0 5 input 1 6 state when CIM ID 0x0c01 write only N 1 byte 8 bit 0 1 relay output 1 2 state when CIM ID 0x0d01 sent as event by the CIM only N 6 byte 8 13 accelerometer data ax ay az Note When the connection to the destination is lost the response can take up to 5 seconds 6 4 Demo Implementations of the CIM protocol In the AsTeRICS Source Code package implementations of the CIM protocol can be found the following microcontroller firmware e Folder CIMs Arduino an implementation for the 8 bit Atmel ATmega328 AVR microcontroller architecture with features for reading writing GPIO and ADC e Folder CIMs HID_actuator an implementation for the 8 bit Atmel AT90USB1286
58. S CIMs The following section defines the CIM ID s the feature addresses and the expected data for a particular feature request rep y for all ASTeRICS CIMs 6 3 1 HID CIM CIM ID Feature Access Descritption Data address 0x0101 0x0000 r Unique serial number 4 bytes HID 0x0001 w MOUSE x y pos 4 bytes xxyy actuator relative change version 1 0x0002 w MOUSE buttonstate 1 byte Bit O left click Bit 1 right click Bit3 middle click 0x0003 W MOUSE wheel 1 byte wheel displacement 0x0010 Ww KEYBOARD keypress 2 bytes keycode modifier 0x0011 Ww KEYBOARD keyhold 2 bytes keycode modifier 0x0012 w KEYBOARD keyrelease _______ 0x0020 W JOYSTICK joy1pos analog 4 bytes xxyy 0x0021 Ww JOYSTICK joy2pos analog 4 bytes xxyy 0x0022 Ww JOYSTICK joy3pos digital 1 byte Bits 0 3 left right up dwn 0x0023 w JOYSTICK joybuttonstate 2 bytes Bits 0 9 button pressed 0 1 Page 62 AsTeRICS Developer Manual 6 3 2 PT 1 GPIO CIM Legacy GPIO CIM ID Feature Access Descritption Data address 0x0201 0x0000 r Unique serial number 4 bytes GPIO 0x0001 r GPIO Input State 1 byte version 1 Bit 0 Input 1 Bit 7 Input 8 sensor 0x0002 r w GPIO Input Threshold Voltage 4 bytes actuator bytes 0 1 threshold voltage value for inputs 1 4 0 to 25000 mV bytes 2 3 threshold voltage value for inputs 5 8 0 to 25000 mV 0x0003 r w GPIO
59. SEVENTH FRAMEW PROGRAMME AsTeRICS Developer Manual ion ciety and Media So opean Commiss Ee information 2 5 W AsTeRICS AsTeRICS Developer Manual Version History Version Date Changed Author s 0 1 August 19 First draft UCY 2010 0 2 December 20 Added ACS and Thrift guides KI I 2010 0 3 December 26 Added setup and build environment FHTW 2010 descriptions changed document structure updated component development guide added Native ASAPI and JNI development descriptions 0 4 March 16 Added one click build script and information FHTW 2011 about ignoring COM ports in CIMPortManager 0 5 July 29 2011 Added coding guidelines section FHTW 0 6 September Added local storage information FHTW 19 2011 0 8 September Added header template and javadoc FHTW 28 2011 example 0 9 October 27 Integrated Plugin Tool descriptions and FHTW 2011 CIM Protocol Description reorganized structure 1 2 January 13 Reworked structure added Introduction FHTW 2012 added PluginCreation Tools 1 5 June 20 Some minor revisions based upon user FHTW 2012 feedback additions of features for the final AsTeRICS prototype 1 5a October 23 Update of thrift adding schema compiler KI I 2012 instructions for C 2 0 Nov 13 2012 Added updates for final system prototype FHTW updated CIM protocol information 2 2 Jul 10 2013 Updates for Release Version 2 2
60. a etoe niles 105 11 Appendix A OSGI related Information esosenneeneeeesseeennrrrrrrssertrnrrrnnrnserrrnerrnneeseet 106 11 1 The OSGi framework and it s layers 2 eee cette eeeeeeeeeeeeeeeeeeeeenesaaaaeeeeeees 106 11 2 Modularization in OSGi sii sesktcedsateecelacabicctscceigeiiaksueni teckivehvsa dc skiwes need naked ree 107 11 3 Using OSGI in ASTORICS osecccccceveeseeckeeivcenycongeneseicnetieaaguctvieineettpenteebyss weet teenies 107 12 Appendix B Building the ACS c ccscciettsciaucehotivendls naa ueloceandieeydetnaniieauaieaneiee 109 12 1 Setup of the Development environmMent cccceeeeeeeeeeeeeeeeeneeeeeeeeeeteenenaeeeeeeees 109 12 2 Update Process of thie Schemata cii ktotacte tees etecanneleeetecii aide eae 110 13 Appendix C Guidelines for Building Vision PIUQINS cceeeeeeeeeteeeeeeeeeeeeeeetneees 111 WS HOPS AY AS E E EEEE AE EAE 111 13 2 s BOOST UDAY e aa r a o ed A E AE 112 13 8 Videonu cts eaa a et eet ot Ree Rien a cet ee At Beet ee cad 8 114 13 4 Building Taceiracker sc sisctccsslereGsacten cater cram teenalevenser teenie Meandeclamelene 117 18 5 Face Tracker Library iscsi aneneen aieeaa hdc etenaqes EEKE aia 118 14 References and ReSOurces cicec ccaiiadacetceccedasyssscenteagecnntevesaqusinnicdenenssaeaseeeseneternseasees 119 Page 6 AsTeRICS Developer Manual 1 Introduction 1 1 About the AsTeRICS project AsTeRICS the Assistive Technology Rapid Integration and Construction S
61. actuator AnalogOut jar asterics actuator AndroidPhoneControl jar asterics actuator ApplicationLauncher jar asterics actuator BarDisplay jar asterics actuator DigitalOut jar asterics actuator EnobioDisplay jar asterics actuator EventVisualizer jar asterics actuator FileWriter jar asterics actuator FS20Sender jar asterics actuator GSMModem jar asterics actuator ImageBox jar asterics actuator IrTrans jar asterics actuator Keyboard jar Please note that only the components defined in the loader ini file will be available in the ARE Models involving other components cannot be deployed from the ACS nor started A number of additional bundles which are needed to start the ARE middleware are specified in the config ini file most notably the ARE middleware asterics ARE jar 2 5 3 AsteRICS services An AsteRICS service is a bundle that provides ARE wide functionality usable by other services or plugins The service can be optionally disabled which means that the service bundle is not installed and not activated The file services ini contains a list of general services to be loaded Whereas the services windows ini and services linux ini files contain platform dependent service names You can also create your own use case specific services ini file and edit the start script to load it 2 5 4 Running a deployment The ARE exe starter application launches the ARE without console output and without debugging instrumen
62. ae soe ahaa ego oe 35 4 2 6 Step by Step implementation Averager processor sseeeeeeeeeeeeeeeeeeeeeteees 36 ADT VWRGAOING csiiaiicts a obsiattenwan he a E sha E eels teds 37 4 2 8 Writing plugins USING SWI Qedcrcatecs cece case reien ces pete epee cd tate eted aan costal eles 37 Ao Long lasting method calls st c hccn2celdadsahchee Ne enaesia eae hed Mee eed 38 4 2 10 Sensor callbacks 06s se eS ae IPS Na eae es ae ee 38 4 2 11 Contributing a developed plugin git pull request eeeeeeeeeeeeeeeeeeeeeeteees 38 5 Services and Utils Infrastructure for PIUQINS eeececceeeeeeeeeeeeeeeeeeeeeeeeeeeeseneaeeeeeeeees 39 5 1 Communicating with peripherals CIM Communication service ccccccceeeeees 39 5 1 1 GIMP ortControlle rossii e e erda e E aE RNE 40 5 12 lt CIMP ntManagef aap aa a a a Eaa 40 5 1 3 CIMEventHandler sosennnneeeeeooeeeenrnnnreererenrrnnrrsstrrrerrnnnrtsrerrerrrnnreseerrnnennne reet 41 5 1 4 ClIMPr tocol Packet erecssrihironnonn onnee a E EE 42 5 1 5 Serial ports not adhering to CIM Protocol Raw Ports cccceeeeeeeeeeeees 43 5 2 Communication through a socket interface Remote Connection Managev 43 5 2 1 IRemoteConnectionListener je ccsses ccees veckieesseee secs veakewes taaeesuaeedhepesteseesuaseshciasteees 43 5 2 2 RemoteConnectionManager c cccccccececeeesessccceeeeeeeeeeeeesaaeeeeeeeeeeeeeesaaaes 44 5 3 Coc l Storage Service erreira i a a E
63. age and run configurations Attach to a Java virtual machine accepting debug connections g2 B 2 X BF Name ARE type filter text SS Connect HA Source Common Eclipse Application Project Java Applet a t O Java Application ARE Browse F Ju JUnit Connection Type J JUnit Plug in Test OSGi Framework a Z Remote Java Application Connection Properties TZ ARE l Standard Socket Attach X Host localhost Port 1044 E Allow termination of remote VM Filter matched 8 of 8 items Now launch the ARE using start_debug bat The messages in the console window should indicate the establishment of the listening socket 1044 for the debugging connection Page 21 AsTeRICS Developer Manual GE C Windows system32 cmd exe fee AsTeRICS ARE Version 2 6 java bin java exe set JAUA_BIN java bin java exe gt 2 gt amp 1 Cach n die angegebene Datei nicht finden ing AsTeRICS Runtime vironment wi bug output ning for transport dt_socket at addre 104 oe losgi gt Jul 8 2013 12 4 1 PM eu asteri Information JUM 32 bit detected cim start Bo e Now the usual debugging support of Eclipse can be used including breakpoints in middleware or components variable and context watch windows single stepping etc All these operations are performed in the Eclipse Debug perspective The following screenshot shows a program execution of the ARE which ran into a
64. ailed information about the threading concept see 8 Below is an example of the FacetrackerLK plugin in the callback method for new arriving coordinates public void newCoordinates callback final int pointl x final int pointl _y final int point2 x final int point2 y AstericsModelExecutionThreadPool instance execute new Runnable Override public void run opNoseX sendData ConversionUtils intToBytes pointl x opNoseY sendData ConversionUtils intToBytes pointl y opChinxX sendData ConversionUtils intToBytes point2 x opChiny sendData ConversionUtils intToBytes point2 y 4 2 11 Contributing a developed plugin git pull request The AsTeRICS platform is designed as an open and modular platform The idea is to make it easy for others to develop assistive plugins any end user in the world could benefit from Hence we would love to get your contribution back to the github repository to be able to ship the new plugin with future releases For this purpose please send a pull request https help github com articles using pull requests Page 38 AsTeRICS Developer Manual 5 Services and Utils Infrastructure for plugins The ARE Services are a set of classes that enable the direct interaction between AsTeRICS plugins and other software to directly interact with the runtime environment The most significant ARE Services are e CIM Communication Service the ARE CIM Commun
65. alue String propertyNe Ka SVN Tree Conflicts 7 Search xl Go ES ween 74 Connect Mylyn Connect to your task and ALM tools BE Outline 22 Ta Maeve xls 8 eu asterics component actuato import declarations ModelSwitcherinstance a F ELP_SWITCHMODEL Stri F elpSwitchModel IRuntim new IRuntimeEventLis a F ipModelName timelr Q new RuntimelnputPo A propModel String ModelSwitcherinstance T Congratulations You have now a working AsTeRICS build environment Eclipse provides different views Window gt Show View where the Navigator and the Package Explorer are most useful for Java source code development Note that the Refresh command F5 synchronizes the Navigator view with changes in the local file system 2 3 Setting up build environment for JDK 8 If you follow the steps of 2 2 JDK 8 is supported without modifications In case you have an older installation of Eclipse version lt Luna 4 4 you can either a upgrade to Eclipse Luna or b upgrade the used ant version to at least 1 9 1 In this case you have to tell Eclipse where to find the new version of ant Page 13 AsTeRICS Developer Manual 1 Start Eclipse and click on Run External Tools External Tools Configuration Project Run Window Help Ctrl FLL Fil Li 3 Run Configurations Debug History f main String args yon HexString Debug
66. breakpoint here the OSKA plugin was halted as a command was selected in the OSKA application and transferred to the ARE plugin s command handler s Debug 2 B 69 Variables 3 st IE 5 4 gf Thread pool 1 thread 2 Suspended breakpoint at line 132 in OskaCommandManager Name Value OskaCommandManager handleCommand String line 132 a this OskaCommandManager id 86 ska Communication OskaConnectionListener dataReceived bytel line 184 RemoteConnectionManager SetupThread run line 229 hreadPoolExecutor runWorker ThreadPoolExecutor Worker line not available hreadPoolExecutor Worker run line not available Thread run line not available p Thread DestroyJavaVM Running p Thread AWT EventQueue 0 Running p Daemon Thread AWT Windows Running p Thread AWT Shutdown Running s Daemon Thread Start Level Event Dispatcher Runnina P Oskalnstancejava buildxm J IOskaCommandHandlerjava F OskaActionStringSendTCP D OskaCommandManagerjava 2 O BE Outline ko Maier trouna Tor extractea commana Taise 1T GeTault J handler BRNO w a 8 eu asterics component processor oska boolean handleCommand String input a Q_ OskaCommandManager z commands Hasi String inputs input split 1 1 a actionstiings d if inputs null amp amp inputs length gt 1 a defaultHandler lOskaActionStringHar a __ new IOskaActionStringHandler a String
67. btain data from the embedded platform via a mouse joystick or keyboard hook which is provided via the ASAPI native interface thereby omitting a dedicated TCP IP connection to the ARE via the ASAPI client Page 90 AsTeRICS Developer Manual 9 2 Available ASAPI commands Method Description Methods to setup and deploy a model String getAvailableComponentTypes Returns an array containing all the available i e installed component types These are encoded as strings representing the absolute class name in Java of the corresponding implementation String getModel Returns a string encoding the currently deployed model in XML If there is no model deployed then an empty one is returned String getModelFromFile Returns a string encoding of the model defined in the filename passed as argument If there is no model an empty string is returned void deployModel String modellnXML throws AsapiException Deploys the model encoded in the specified string into the ARE An exception is thrown if the specified string is either not well defined XML or not well defined ASAPI model encoding or if a validation error occurred after reading the model void deployFile String filename throws AsapiException Deploys the model associated to the specified filename An exception is thrown if the specified filename is not found public void newModel throws AREAsapiExcept
68. bundle descriptor xml The Java object code is included in the corresponding folders representing the package structure e g eu asterics component etc Optionally if libraries are needed native or not then they are included in the lib folder The Manifest is included in the META INF folder as per the standard Java OSGi practice Finally the AsTeRICS bundle descriptor is included directly in the root of the JAR file i e Page 34 AsTeRICS Developer Manual 4 2 5 Component lifecyle An ARE component implementation needs to realise the actual component with its lifecycle i e ways to access its ports and properties and methods realizing its lifecycle This is illustrated in the following code package eu asterics mw model runtime public interface IRuntimeComponentInstance public void sterti public void pause public void resume public void stop public IRuntimeInputPort getInputPort final String portID public IRuntimeOutputPort getOutputPort final String portID public IRuntimeEventListenerPort getEventListenerPort final String eventPortID public IRuntimeEventTriggererPort getEventTriggererPort final String eventPortID public Object getRuntimePropertyValue String propertyName public List lt String gt getRuntimePropertyList String key public Object setRuntimePropertyValue String propertyName Object newValue public v
69. by a fallback strategy which is to automatically switch to a new ModelExecutor thread in case of a timeout or a rejected task Page 85 AsTeRICS Developer Manual 9 ASAPI Clients and Serialisation The AsTeRICS Application Programming Interface ASAPI is an interface to enable advanced communications between the AsTeRICS Runtime Environment ARE and external clients In principle ASAPI is a service that is provided by the ARE and can be consumed by different clients deployed on the same as the ARE or remote devices While the ARE is implemented on top of JAVA OSGi ASAPI clients are assumed to be implemented on top of a variety of platforms For this purpose the actual interfacing between clients and the ARE is done at a low TCP UDP IP level For this purpose either a custom TCP UDPI IP protocol will be developed or an existing solution such as Google Protocol Buffers XML RPC or Apache Thrift could be used device device Client e g Windows Server e g Embedded Linux l use interface ASAPI Server I execution environments l l l Network Infrastructure TCP IP based ASAPI Protocol Implementation Figure 9 Basic architecture of ASAPI The basic architecture of ASAPI is illustrated in Figure 9 The ASAPI Server is provided by a JAVA based implementation which utilizes the ARE to provide the specified functionality On the client side two interfaces provide the needed functionality The
70. c CIMPortController getConnection short cimId public CIMPortController getConnection short cimId long uniqueNumber These methods return a ClMPortController read on for details instance of the requested CIM The method using two parameters will return the instance to the port controller which works with the CIM of the exact CIM ID and unique number If the CIM cannot be found null will be returned Page 40 AsTeRICS Developer Manual Requesting a connection without naming a unique number will return the first port controller connected to a CIM of the correct ID found in the HashMap holding all the port controllers Sending data to the connected peripheral can be done in several ways using the following methods of CIMPortManager public int sendPacket short cimId byte data short featureAddress short requestCode boolean crc public int sendPacket CIMUniquelIdentifier cuid byte data short featureAddress short requestCode boolean crc public int sendPacket CIMPortController ctrl byte data short featureAddress short requestCode boolean crc Basically these three methods do the same thing however they do it at different speeds as the first two methods will look up the port controller that the packet should be sent to Again the method taking only the CIM ID as a parameter will look up the first correct port controller The third method which is passed the ClMPortController instance returned on getConnect
71. callbacks and maps the functions of the ARE component s lifecycle port and property management to the corresponding functions in the native code Here is a simple example which comprises one component property and receives data callbacks from a thread implemented in C The received values are transferred to the component s output port package org asterics jni import org asterics mycomponent MyComponentInstance import java util logging Logger public class Bridge Page 54 AsTeRICS Developer Manual ye Statically load the native library ff static System loadLibrary mylib1 loads mylibl dll System loadLibrary mylib2 loads mylib2 dl1l System loadLibrary mylib3 loads mylib3 dll private static final Logger logger Logger getAnonymousLogger private final MyComponentInstance OutputPort my outport public Bridge final MyComponentInstance OutputPort my outport this my outport my outport Activates the underlying native code hardware return 0 if everything was OK a negative number otherwis ad native public int activate Deactivates the underlying native code hardware return 0 if everything was OK a negative number otherwis S native public int deactivate Gets the value of the named property param key the name of the property to be accessed return the value of the named proper
72. command inputs substring inputs indexOf a addCommand String IOskaCommand f a E a addActionString String IOskaActionStri Ey TOskaCommandHandler null a clearHandlers a handler commands get command m _extractActionStrings String List lt Strir if handler null a handleCommand String boolean m handleDefaultCommand String handler handleCommand inputs i 4 m E Console 32 frr a No consoles to display at this time Writable Smart Insert 132 40 If the source level debug information is bee pa Sc missing due to compilation without y Unable to install breakpoint in eu asterics component actuator midi GUISL due to debugging support an error message e memg me number attributes Modify compiler options to generate line number indicates a problem e g the missing line Reason Absent Line Number Information number for breakpoint installation Don ttell me again N Page 22 AsTeRICS Developer Manual 3 A Quick Guide to AsTeRICS Plugin Development This section describes the ASTeRICS Plugin Creation tool and the plugin activation process These tools make it easy to create new plugins and make them available in ACS and ARE They can be started manually from their location in the AsTeRICS_runtime zip package folder ACS tools or they can be launched from the Misc Tab in the main menu of the ACS x ad o AsTeRICS Configuration Suite
73. conds 0x0002 Channel Value Report 4 bytes 2 channels of ADC values Byte 1 chn1 low byte Byte 2 chn1 high byte Byte 3 chn2 low byte Byte 4 chn2 high byte Page 68 AsTeRICS Developer Manual 6 3 8 Sensorboard CIM CIM ID Feature Access Descritption Data address 0xa201 0x0000 r Unique serial number 4 bytes Sensor 0x0001 w Activate Periodic Value 2 bytes board for Reports bytes 0 1 period time 0 off to 65535 low cost eye milliseconds tracker 0x0002 r Sensor Value Report 35 bytes of sensor values 1 accelerometer X MSB 2 accelerometer X LSB 3 accelerometer Y MSB 4 accelerometer Y LSB 5 accelerometer Z MSB 6 accelerometer Z LSB 7 gyro X MSB 8 gyro X LSB 9 gyro Y MSB 10 gyro Y LSB 11 gyro Z MSB 12 gyro Z LSB 13 compass X MSB 14 compass X LSB 15 compass Y MSB 16 compass Y LSB 17 compass Z MSB 18 compass Z LSB 19 IR Cam point 1 X MSB 20 IR Cam point 1 X LSB 21 IR Cam point 1 Y MSB 22 IR Cam point 1 Y LSB 23 IR Cam point 2 X MSB 24 IR Cam point 2 X LSB 25 IR Cam point 2 Y MSB 26 IR Cam point 2 Y LSB 27 IR Cam point 3 X MSB 28 IR Cam point 3 X LSB 29 IR Cam point 3 Y MSB 30 IR Cam point 3 Y LSB 31 IR Cam point 4 X MSB 32 IR Cam point 4 X LSB 33 IR Cam point 4 Y MSB 34 IR Cam point 4 Y LSB 35 pressure sensor Page 69 AsTeRICS Developer Manual 6 3 9 Arduino CIM CIM ID Feature address
74. ct Build Debug Tools Windc Pas Ga s aalo c o P Release v Win32 Solution Explorer al A E od Solution webcam 2 projects facetrackerLK E webcam AsTeRICS Assistive Technology Rapid I uino JUsWINIOG BH Figure 26 Specifying the build target If all goes well during the building process then we will get the facetrackerLK dll ready to be bundled in the usual jar archive that will be executed in the ARE framework A warning is due the current project is configured to link against a custom build of the opencv library which requires a set of additional libraries libjpeg libpng libtiff zlib etc as well as the tbb lib When not required it is possible that the linker will throw an error In this case it is necessary to edit the header opencv_includes h which contains a set of pragma directives targeting those libs Page 117 AsTeRICS Developer Manual Before doing so we should pay attention if the Java code that invokes the DLLs and the MANIFEST file are properly set In case we want to choose the recommended solution based on the most recent opencv 2 3 1 then make sure that the lines in the class Bride java look like in Figure 27 Otherwise uncomment the lines above that loads the opencv 0 97 DLLs and comment the line below that loads the TBB dynamic library f Bi rOvrQ i vG ryi ewv PD E m Si fl wees F build xml build xml D Bardisplaylnstance j D GUl java
75. ctionality in action It uses the data of a SignalGenerator and forwards it through a websocket utilizing the WebSocket plugin The provided index html file of the webserver automatically connects to the given websocket and visualizes the data Important Note The websocket support currently lacks a meaningful data protocol and is not fully implemented The purpose is just to show how it could works 2 5 6 Define autostart model per command line By starting the ARE with the name of a model as first command line parameter a model that should be started automatically can be defined The model must exist in the sub folder models ARE exe CameraMouse acs or start_debug bat CameraMouse acs 2 5 7 Change model execution thread pooling and submit timeouts The file areProperties contains properties to configure GUI related features and to configure the internal model execution behaviour The following internal model execution properties exist e ThreadPool ModelExecutor size 0 Page 19 AsTeRICS Developer Manual o The size of the ModelExecutor thread pool By default the value is 0 which means that a model is executed with a single thread If the value is gt 1 the model is executed with a thread pool of that size o Important Note The multi threaded mode is deprecated and will be removed with the next release 2 7 There is no guarantee for data integrity and thread synchronization when executing a model
76. d after the connection has been closed 5 2 2 RemoteConnectionManager The RemoteConnectionManager is implemented as a singleton and can be accessed via a public static member of the class Thus access is always achieved through RemoteConnectionManager instance A connection is opened by a call the RemoteConnectionManager s method boolean requestConnection String port IRemoteConnectionListener 1 This call will try to access a connection on the specified port Although the port is actually an integer it is passed as a String here The method will return true if a connection on this port has already been established and attach the remote connection listener passed in the second argument to the connection If there is no active connection on the specified port the requestConnection method will initiate the setup of the connection and return false With this return value the user can decide whether he needs to perform setup actions or will be able to do this in the connectionEstablished callback The socket connection handling is implemented using two threads one for sending one for receiving data The receiver thread will continuously read data from the socket and forward it to the registered listener calling the dataReceived method Since incoming data is handled in another thread than the plugin which will use the socket connection access to the methods handling this data or the way of passing data should be done in a synchronised co
77. de block Sending data is done calling the method sendData of RemoteConnectionManager public boolean writeData String port byte data This method is called using a String holding the port number of the connection socket and an array of bytes to be sent The call to this method will place the data in an outgoing queue and return true if this was successful Thus it is not guaranteed that the data has already been sent when the method returns The sender thread will grab data from the outgoing queue and transfer it via the socket or call the connectionLost method of the registered listener if there are problems while sending Page 44 AsTeRICS Developer Manual Once the connection to a socket is not needed anymore the user has to close the connection calling the following method of RemoteConnectionManager public void closeConnection String port This will close the socket connection end all threads and return 5 3 Local Storage Service If a model needs to save its own calibration data training data or other private data that can be different in every model and every instance the local storage service provides a method to save different data to the same file name on a per plugin instance per model basis The service uses a directory tree structure that is placed in the directory the OSGi is run from Data is saved in a directory called storage In this directory directories for every model name of a model that us
78. dth bytes 6 7 height bytes 8 2047 bitmap stream standard 16 level grayscale only part which fits the display is drawn first byte bit 0 3 is 0 0 bit 4 7 is 1 0 if the bitmap width is e g 11 pixels 6 bytes per row and bits 4 to 7 of the last byte are ignored 0x0076 r w status LCDisplay brightness 1 byte brightness 0 100 for backward compatibility the brightness can be set in the CIM s internal menu 0x0078 draw 16x16 predefined icon 6 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 icon index 0 minus 1 plus 2 up 3 down 4 left 5 right 6 play 7 pause 0x0082 read touch panel state 4 bytes bytes 0 1 display coordinate X bytes 2 3 display coordinate Y value 1 means not touched 0x0083 r w touch panel event enable 1 byte 1 enabled 0 disabled when enabled CIM send the X Y coordinates every time the display is touched 0x0090 battery level 1 byte not accessible on request every time the battery charge level changes the CIM sends the level automatically 1 100 when discharging 101 200 when charging 254 battery missing or dead 255 battery status is uknown e g during startup Level lt 15 means hibernate system immediately Page 72 AsTeRICS Developer Manual 6 3 11 PT2 GPI CIM Digitalln CIM ID Featu
79. e bytes 11 13 ADCO6 input value in Ohms 1 5E 06 is maximum OxFFFFFF means anything above 1 5 MOhm byte 14 15 ADCO7 input value byte 16 17 ADC08 input value 0 24000 mV 0x0050 r w DAC Output Value 4 bytes byte 0 DACO1 0 24 0 V byte 3 DAC04 0 24 0 V e g 240 is 24 0V Page 65 AsTeRICS Developer Manual 6 3 5 BMA180 Accelerometer Sensor CIM ID Feature address Access Description Data 0x0501 BMA180 accelerometer sensor version 1 0x0000 r Unique serial number 4 bytes 0x0020 W Store current state to EEPROM as default power on state none 0x0060 r w BMA180 direct register access READ request byte 0 address 00 5B reply byte 0 value WRITE request byte 0 address 00 5B request byte 1 value reply has no data Not all registers or their bits can be written please see the BMA180 reference manual NOTE This is for PT1 HW testing purposes only and shall be never used for normal operation as there can occur collision with new data reading in a high priority interrupt function If you still want to use it disable all BMA180 interrupts in ctrl_reg3 first As a consequence the feature 0x0063 will have no new data until the new_data_int in ctrl_reg3 is re enabled 0x0061 r w BMA180 bandwidth data sample frequency 1 byte bandwidth 0x00 10 Hz 0x01 20 Hz 0x02 40 Hz 0x03 75 Hz 0x04 150 Hz
80. e Standard Windows Libraries Use Unicode Character Set No Common Language Runtime Support Figure 20 Switching Platform Toolset 2 Additional Include directory for the DirectShow and modify the path to extra folder as in Figure 21 onfiguration gt Common Properties 4 Configuration Properti a C C General Debugging VC Directories Active Release libs extra C Program Files Microsoft SDKs Windows v7 1 Samples multimedia directshow baseclasses en Optimization Preprocessor Inherited values Code Generatio Language Precompiled Hq Figure 21 Setting the DirectShow include path 3 Remove redundant library settings Leave only strmiids lib Figure 22 onfiguration Active Release v Platform Active Win32 Configuration Manager a gt Common Properties 4 Configuration Properties General Debugging VC Directories gt C C Librarian General Command Line XML Document Generator gt Browse Information gt Build Events gt Custom Build Step Output File Additional Dependencies Additional Libra Directories Inherited values OutDir TargetName TargetExt dxguid lib ole32 lib strmiids lib uuid lib AdditionalDepei Figure 22 Library settings Page 115 AsTeRICS Developer Manual 4 Comment out DEBUG and _DEBUG pre processing definitions in video nput cpp Sol
81. e cette ee eteneeaaeeeeeeeeeeeeeee 13 2 4 Building ARE Middleware Services and Component cecesseseeeesseeeeeesneees 15 2 4 1 OME Glick BUA S ane sab wey ae hee Se bee ck dy age ote AT te ne 15 2 4 2 Understanding the component build SCripts cccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaeees 16 2 5 Starting the ARE middleware and component deployments cceeeeeeeeeee 17 2 5 1 Structure of the runtime folder DIN ARE ssssssesesseseeseeeeeseeeeeeeeeeeeees 17 2 5 2 Structure of the loader ini file eee cceceeeeeeeeeeeseseeceeeeeeeeeeeenesaaeeeeeeeeeeeeeeesaaeaes 17 2 50 39 PSICRICS SENIGOS rasane n anian a vbr ae a EE evade 18 2 5 4 Running adeployment lt icnedaecudadadedunanasdunaaniedaaee 18 2 5 5 Activation of ARE webservice REST websocket demo ssessssessserreeeese 19 2 5 6 Define autostart model per command line c cccceeeeeeeeeeeeetteeeeeeeeeeeeeeeaaees 19 2 5 7 Change model execution thread pooling and submit timeouts 0 19 267 DEBUGGING ING ARE rs hcetcen tem airs ni AE T AE E eee 21 3 A Quick Guide to AsTeRICS Plugin Development cccceeeeeeeeeeteeeeeeeeeeteeeetneeeeeeees 23 3 1 The Plugin Creation Wize cet cus seat ores catecns saat eco aan coated toh dad tales eee peee ules 24 3 1 1 Created files and folders cnitsees ser tchotchiserMeionaeeie honed Sahadachiv pee etaniebnataess 25 3 2 Plugin Activation in ACS and ARE
82. e connectToDevice method Table 6 Other Phone library interface data 10 1 2 Example of use Call back functions definitions void __stdcall newSMS LPWSTR PhoneID LPWSTR subject LPVOID param get incoming SMS getSMS PhoneID subject void _stdcall phoneStateChanged PhoneState phoneState LPWSTR phoneID LPVOID param auto answer on incoming phone call if phoneState PS_ RING deceprC annii Initialization of the library and connect to the phone int InitLib unsigned int64 deviceAddress ini mesulics result init deviceFound newSMS phoneStateChanged NULL if result lt 0 meacuicm OA result connectToDevice deviceAddress 1 if result lt 0 rewan Op Page 98 AsTeRICS Developer Manual Send SMS int SendSMS LPWSTR recipientID LPWSTR subject return sendSMS recipientID subject Make phone call int MakePhoneCall LPWSTR recipientID return makePhoneCall recipientID Disconnect the phone and close the library int CloseLib disconnect return close 10 2 GSM Modem Library The GSM Model Library interfaces the GSM modem devices connected to the platform It can be used to send and receive SMS 10 2 1 GSM Modem Library interface The library interface is declared in the GSMModemLibrary h file Library functions Function Description i
83. echanism is responsible for recording the current status of the ARE or the error state of a component The status is recorded by creating and storing objects called statusObjects A statusObject stores the status of its creator as a string its creator the ARE or the specific component and the error message Page 47 AsTeRICS Developer Manual public static void setStatusObject String status String componentID String errorMsg The status of the ARE can be one of the following strings UNKNOWN initial state for the ARE OK ARE is running and ready to deploy a model DEPLOYED A model has been deployed and the ARE is now ready to run the model RUNNING A model is running on the ARE PAUSED A model has been deployed and the ARE is in paused mode ERROR An error occurred FATAL_ERROR A fatal error occurred model or deployment aborted The status of a component can only be the ERROR state because this is the only state of a component that we are interested in recording for later use An ERROR statusObject is automatically created when a component calls the reportError method as described above For retrieving the statusObjects the following method is used public StatusObject queryStatus boolean fullList This method is particularly useful for the ACS to determine the current status of the runtime environment and of the deployed components If the ARE or one of the components are ina problematic s
84. ed ARE event listeners will be notified immediately after the deployment of a model o preStartModel registered ARE event listeners will be notified just before the currently deployed model is started o postStopModel registered ARE event listeners will be notified immediately after the deployed model has been stopped e void unregisterAREEventListener AREEventListener clazz Plugins already registered for receiving ARE core events can un register using this method 5 11 Dynamic Properties In some applications the ACS should be able to provide several options for property values which are not known in advance but depend on the current state of the ARE see ASTeRUCS User Manual section Dynamic Properties A typical example is the selection of a file which is available in the ARE file system e g a wav file for the wave player plugin This feature is particularly useful for plugins that are hardware dependent selecting e g a soundcard or a midi player or depend on the file system If a plugin is implementing a dynamic property the values will be requested from the ARE as soon as the ACS is synchronized with the ARE via the ASAPI function List lt String gt getRuntimePropertyList String componentID String key The ARE middleware will forward the request for valid property values to the component instance with the given ID The List lt String gt getRuntimePropertyList String key method has to be implemented in the
85. ed gt i lt dataType gt doub le lt dataType gt lt inputPort gt lt inputPort id in2 i Accor iotiens input port description lt description gt lt multiplicity gt one to one lt multiplicity gt lt mus tBeConnected gt false lt mus tBeConnected gt i lt dataType gt integer lt dataType gt lt finputPort gt lt outputPort id outl gt i lt description gt output port description lt description gt lt dataType gt doub le lt dataType gt lt outputPort gt lt outputPort id out2 gt lt description gt output port description lt description gt i lt dataType gt doub le lt dataType gt lt outputPort gt lt ports gt lt events gt l lt eventListenerPort id istener1 gt i lt description gt elp description dasehiptions F i i lt feventListenerPort gt A i lt eventTriggererPort id triggerl gt i i lt description gt etp description lt description gt lt feventTriggererPort gt The source code folder src main java eu asterics component lt pluginT ype gt lt pluginName gt contains a template for the plugin source code in JAVA including the definitions of the selected ports and properties and the needed get and set methods for ports and property values The code skeleton complies to the AsTeRICS coding guidelines and contains the AsTeRICS source file header only a small portion is shown in the fo
86. eeded folders and files for the Eclipse build flow including the JAVA source code skeleton and the plugin s bundle descriptor ill AsTeRICS Plugin Creation Wizard gt e J Exit Setup PluginName MyPlugin Type processor Subcategory Others Path to existing targetfolder C asterics are components Input Ports Output Ports Event Listener Ports Event Trigger Ports mylnPort double a myOutPort double z yElpPort EtpPort a myOutPort2 double nivel Biz Pet ant Name mylnPort Name myOutPart2 Name myElpPort Data Type double gt Date Type double Name myEtpPort3 Description input port descriptir Description output port descrip Description elp description Description etp description add Input Port delete add Output Port delete add Event Listener Port delete add Event Trigger Port delete Pi rti elek Plugin Description My Plugin description Df y Name myProperty2 myProperty2 integer yeropery Plugin is a Singleton o Data Type integer Sj Plugin has a GUI o Default Value 1 x size 30 Y size 20 of screen size Combo Box Entries testl test2 test3 Oo ns o Description property description add Property delete CREATE PLUGIN As can be seen in the above figure desired input and output ports data types properties and plugin features are simply selected and added to list boxes on the scree
87. eloper language This method of name translation can be applied for plugin names port names and property names 4 1 4 AsTeRICS Source File header Every source file of the AsTeRICS project which will be released as open source under the LGPL license should have the following header AsTeRICS Assistive Technology Rapid Integration and Construction Set d8888 88888888888 8888888b 8888888 d8888b d8888b d88888 888 888 Y88b 888 d88P Y88b d88P Y88b d88P888 888 888 888 888 888 888 Y88b d88P 888 d8888b 888 d88b 888 d88P 888 888 Y888b d88P 888 88K 888 d8P Y8b 8888888P 888 888 Y88b d88P 888 Y8888b 888 88888888 888 T88b 888 888 888 888 d8888888888 X88 888 Y8b 888 T88b 888 Y88b d88P Y88b d88P d88P 888 88888P 888 Y8888 888 T88b 8888888 Y8888P Y8888P homepage http www asterics org This project has been partly funded by the European Commission Grant Agreement Number 247730 License GPL v3 0 GNU General Public License Version 3 0 http www gnu org licenses gpl html FF FF F F F F FF F FF F FF F FF F F OF OF a 4 1 5 JavaDoc compatible comments JavaDoc compatible comments should be used to indicate the author of a source file and to describe the purpose of a function method class and the respective parameters and return values Example for a source file header info Bardisplayinstance java Purpose of this module Implements the Bardisplay actuator plugin author Chris Veigl veigl tech
88. en EventTriggerer and EventListeners ports EventTriggerers generate events and EventListeners register to an ARE service for listening to generated events ARE is responsible for disseminating the generated events to the plugins that have been registered for listening to these events 7 1 1 4 Component Architecture of ARE This subsection describes the internal architecture of the ARE component Naturally the main scope of this component is to maintain and realize the deployed model As such it features the following sub components e Controller This component is responsible for coordinating the actions inside the ARE To achieve this it uses the other sub components described below Page 80 AsTeRICS Developer Manual ModelManager The model manager is used to maintain and manage the model cf section 7 1 1 As such it provides methods for transforming the model from and to standard representations such as XML for validating its consistency and for editing the properties of the modeled concepts i e of the components channels and ports A special feature of the model manager is that it includes an input event port that allows it to be controlled by the Assistive Technology application for switching between various individual models Configurator The configurator is the component which translates the model into actual components and channels It is thus responsible for realizing the encoded models and also for coordi
89. endData method although this could be avoided altogether The private method addlnt realized the core functionality of the averager component Finally the get set property value methods are implemented to allow for getting setting the value of the buffer size property in a straightforward manner 4 2 7 Threading For detailed information about the threading concept see 8 4 2 8 Writing plugins using Swing Page 37 AsTeRICS Developer Manual If a plugin provides a Swing GUI it should only use the asynchronous method SwingUtilities invokeLater and not the synchronous one to perform the GUI updates This is to prevent a potential thread deadlock if an action was originally triggered by a Swing GUI event e g by a button click in the ARE GUI For detailed information about the ARE threading concept see 8 4 2 9 Long lasting method calls If a method call performs a long lasting task and there is no need to await the termination of it the task should be handed over to a worker thread see 5 8 to not block ModelExecutor thread For detailed information about the threading concept see 8 4 2 10 Sensor callbacks In case you write a plugin that uses a separate thread to generate data e g FrameGrabber Timer you should explicitly use the method AstericsModelExecutionThreadPool execute This is to ensure that corresponding data will be delivered within the same task execution For det
90. ering Additionally some helper classes are provided for face detection Page 45 AsTeRICS Developer Manual 5 6 Data Conversion Utilities The middleware provides the class ConversionUtils that provide static helper methods to convert model data types to byte arrays and vice versa The conversion is needed to convert incoming data of input ports or outgoing data to output ports There are methods for each type of conversion If two connected ports output to input have different data types the data is automatically converted to the data type of the input port Check the class ConversionUtils for a full list of supported methods https github com asterics As TeRICS blob master ARE middleware src main java eu asterics mw data ConversionUtils java 5 7 Logging The Logging support provides a uniform way of error reporting in the runtime environment so we have utilized the Java logging libraries and the various severity levels supported The AsTeRICS error handling mechanism is used extensively from the runtime core classes but also utilized by the AsTeRICS components via the AstericsErrorHandling interface Each component is allowed to report an error message a debug information or a simple information to be displayed on the screen The ARE maintains four separate log files and updates them whenever a new error occurs In particular there are different loggers for reporting severe errors warnings fine errors and one logger t
91. es at least one plugin that accesses local storage can be found In the third directory layer directories with the plugin instance name of every plugin that accesses local storage can be found Thus if a model named timertest uses a plugin instance named timer1 that saves local data this data can be found at the path location storage timertest timer1 The service practically consists of only one method public File getLocalStorageFile IRuntimeComponentiInstance component String fileName Calling this method located in the AREServices class will return a File object pointing to the requested file name or null if the file could not be opened or the model name could not be retrieved After opening the file the standard JAVA ways to manipulate files apply 5 4 Keyboard Mouse Native Hook Services The AsTeRICS service jnativehook if enabled provides access to the library https github com kwhat jnativehook Additionally the service contains the singleton NativeHookServices that initializes the library to be usable in plugins A plugin that wants to be a keaboard mouse listener only has to add the listener to the GlobalScreen instance of the library 5 5 Computer Vision Services The AsTeRICS services javacv and computervision if enabled provide access to the library https github com bytedeco javacv which again provides access to numerous libs in the field of computer vision e g OpenCV frame grabbing and frame rend
92. esources 1 AsTeRICS Deliverable D2 1 System Specification and Architecture https oscw integriert studieren jku at oscw bscw cqgi 40517 2 AsTeRICS Deliverable D2 3 Report on API specification for sensors to be integrated into the AsTeRICS Personal Platform httos oscw integriert studieren jku at oscw bscw cqgi 43571 3 Open Service Gateway initiative OSGi open specification http www osgi org 4 Tortoise SVN client for Windows http tortoisesvn tigris org 5 Java Development Kit 6 JDK 6 http www oracle com technetwork java javase downloads index html 6 Eclipse Integrated Development Environment http www eclipse org downloads 7 Subclipse SVN plugin for Eclipse http subclipse tigris org servlets ProjectProcess pagelD p4wYuA 8 Apache ANT commandline based build tool for Java applications http Awww ant apache org 9 OSGi Tutorial by Nearchos Paspallis http nearchos blogspot com 2008 1 2 starting with osgi tutorial 1 html 10 Microsoft Visual Studio 2010 http www microsoft com visualstudio en us products 2010 editions 11 AnkSVN SVN support plugin for Visual Studio http ankhsvn open collab net 12 The Microsoft Ribbon Library http Awww microsoft com downloads en details aspx FamilyID 2bfc3187 74aa 4154 a670 76ef8bc2a0b4 13 The ResXFileCodeGenerator http www codeproject com KB dotnet ResXFileCodeGeneratorEx aspx 14 Apache Thrift http thrift apache
93. et is an open framework for the development of Assistive Technologies with the main focus on novel affordable and flexible AT solutions A plethora of sensor processing and actuator plugins provides a powerful AT centred infrastructure which can be used to control home automation equipment entertainment and ICT devices or use ambient assistive services by means of desired sensor combinations without programming a single line of code Interested 3 parties like research institutions or companies in the field of AT can use the framework to integrate their products into the existing AT landscape The project has been initiated in 2010 as a Special Targeted Research Project in the Seventh Framework Programme of the European Commission in the ICT work programme For further information please visit the project homepage http www asterics org AsTeRICS 1 2 About this document This document provides resources for developers to work with the AsTeRICS framework It includes step by step introductions how to set up the development environment and a 10 Minutes Guide to AsTeRICS Plugin Development which outlines plugin creation for the AsTeRICS Runtime Environment ARE with the AsTeRICS Plugin Wizard Furthermore this document outlines important ARE services which can be used for error reporting or communication with external modules describes the naming conventions for programming and plugin creation illustrates the formation
94. etting and setting property values The main subtypes of port are the OutputPort and the InputPort It should be pointed out that the input port is different from the output port by featuring an additional method for checking whether a binding to the port is mandatory or not This is needed to check whether a component is resolved or not i e by checking whether all its input ports marked as mustBeConnected are indeed connected This is important because it ensures that all the defined components are functional i e appropriately connected before they are activated Finally it should be noted that special port types will also be defined for event communication Unlike common ports which communicate a fixed data type event ports will be able to communicate different events encoded in a uniform way Input event port types will be defined with the mustBeConnected property set to false by definition Also output event ports will allow the formation of multiple channels using the same output port as a common endpoint Page 79 AsTeRICS Developer Manual 7 1 1 3 Channels The channel is the main concept used for interfacing components through ports As such the channels are defined via a source port in a source component and a target port in a target component When formed certain checks are performed to ensure that the data types of the source and the target ports are compatible interface model Compone
95. evel debug information for the eclipse remote debugger e Clean cleans build targets removes all jar files and the out directory The source level debug information is enabled by all build targets of the top level build script except BuildAll release Alternatively individual services or components can be built by selecting their associated build xml script from the corresponding subfolders In these scripts source level debugging information is per default disabled in the compilation step 2 4 2 Understanding the component build scripts A typical ANT build script for an ARE component looks like the following lt project name asterics component id default jar basedir gt lt property name component id value processor MyComponent gt lt lt eet oloba properties Eor Emis ouidi gt lt property name build location out production component id gt lt property name srce java location src main java gt lt property name dist location gt lt property name runtime location examples ARE gt lt property name osgi location osgi gt lt property name middleware location middleware gt lt property name Services location services gt lt property name classpath location gt lt path id asterics classpath gt lt pathelement location bin gt lt pathelement location S osgi org eclipse osgi_ 3 6 0 v20100517 jar gt lt pat
96. face described above masking the functionality provided by the target ARE through ASAPI void disconnect ASAPI_ Server asapi_server Disconnects from the specified instance of the ASAPI Server invalidating the reference Table 2 ASAPI client interface 9 3 Serialisation The serialisation of the data including the calling mechanism is done by Apache Thrift 14 For the reference implementations ASAPI server for ARE in Java and ASAPI client for ACS in C Sharp the version 0 8 0 has been used The following tutorial shows the way from the interface definition to a working Java client 9 3 1 The Thrift definition file In the thrift definition file all functions which should be serializable have to be defined The ASAPI thrift file is used by the Thrift compiler to generate the server and client functions Page 94 AsTeRICS Developer Manual 9 3 2 The Thrift Compiler The source code of the Thrift compiler is part of the Thrift bundle being available at 14 For persons who like the usage of precompiled programs a Windows version of the Thrift 0 8 0 compiler is available at https dist apache org repos dist release thrift 0 8 0 thrift 0 8 0 exe The compiler supports several target languages the most commons are C C Java and php The usage is command line based and quite simple To get the needed Java files the following command has to be used thrift gen java asapi thrift This c
97. further All detected errors lead to a call of handlePacketError with an appropriate ClMEvent implementation The possible implemenations are Page 41 AsTeRICS Developer Manual e ClMEventErrorPacketFault holds information to error in packet and the broken packet itself e ClMEventErrorPacketLost holds information on serial number of lost packet To register the event handler with a specific CIM port controller the ClMPortController class exposes the following methods e addEventHandler ClMEventHandler hdlr e removeEventHandler CIMEventHandler hdlr A port controller can handle multiple attached event handlers and remove each one separately 5 1 4 CIMProtocolPacket This class holds all the information given in a packet transferred to or from a CIM There are two ways the developer has to use this class Upon sending packets the sending component has to set the feature address and the request code The CIMProtocolPacket class provides the constants as static field to facilitate setting commands public final static byte COMMAND REQUEST FEATURE LIST 0x00 public final static byte COMMAND REPLY FEATURE LIST 0x01 public final static byte COMMAND REQUEST WRITE FEATURE 0x10 public final static byte COMMAND REPLY WRITE FEATURE 0x10 public final
98. g As gt System out print1n Read gt y sensor facet Rea opChannell sendData value gt iy sensor fs20r a opChannel2 sendData value 1 gt iy sensorjoyst Compare With gt opChannel3 sendData value 2 gt Gy sensor keyb Replace With gt opChannel4 sendData value 3 gt Si sensor kined Restore from Local History gt sensor lipm gt 7 ra pnan aeii V8 Debugging gt ket html amp gt Gy sensormou Generate Markdown Preview gt Gy sensor open StartExplorer gt gt Sensor oscse Team gt 2 Declaration 4 Search E Console 4 Sy sensor p2_p n a iia Source to display at this time 4 Gy mai Properties Alt Enter gt Gx i gt Sy resources build xml Page 27 AsTeRICS Developer Manual The plugin code can be built using the provided build script right click build xml gt RunAs gt Ant Build in the plugin s folder Gy processor differentiate Gy processor dissimilarity y processor double_dispatcher Gy processor epochaveraging Gy processor epocheutting amp y processor eventcounter Gy processor eventdispatcher amp processor eventtlipfiop amp processor fit Gy processor fir 1 y processor fir12to30 Gy processor fir8to12 amp processor fir8toS00 amp processor hold amp processor integrate amp processor mathevaluator Gy processor matrixproduct Gy processor matrixproductaaa amp processor minmax amp processor oska amp processor pathmultiplexe
99. ge 73 AsTeRICS Developer Manual 6 3 13 PT2 ADC CIM AnalogIN CIM ID Feature Access Descritption Data address 0x0901 0x0000 r Unique serial number 4 bytes ADC version 0x0020 w Store current CIM state to none 1 EEPROM as default power on state 0x0040 r Analoglnput Value 6 bytes bytes 0 2 Input 1 value bytes 3 5 Input 2 value the values are in mV or miliohms according to the sensor type connected 0x0041 r w ADC Periodic Input Value 2 bytes Event bytes 0 1 period time 0 off to 65535 milliseconds value lower than 50 ms results in period of 20 to 50 ms 0x0077 r w RGB status LED override 1 byte bit 0 1 red bit 2 3 green bit 4 5 blue 00 override off 01 always off 10 always on 11 blinking 6 3 14 PT2 ZigBee CIM CIM ID Feature Access Descritption Data address 0x0a01 0x0000 r Unique serial number 4 bytes ZigBee 0x0020 w Store current CIM state to none version 1 EEPROM as default power on state 0x0077 r w RGB status LED override 1 byte bit 0 1 red bit 2 3 green bit 4 5 blue 00 override off 01 always off 10 always on 11 blinking 0x0090 w Init ZigBee pairing mode none for 60 seconds 0x0091 w End ZigBee pairing mode none imediately 0x0092 r Get full paired wireless 2 6XN bytes CIMs list byte 0 1 N number of CIMs followed by N times byte 0 3 unique serial number byte 4 5 CI
100. hat contains them all ARE also maintains a status object for the current status of the runtime environment Whenever a fatal error occurs either internally or caused by one of the deployed components the status changes to fatal error Other possible statuses are unknown OK deployed running and paused The ACS can request the current status of the runtime environment and update its own state accordingly For example the ACS user can be informed about the current ARE status while the ACS will terminate a connection or refuse to establish a new one with a non working ARE Using a Logger is the recommended way to report notifications or error descriptions to the user In the ARE framework using the Java logging service is recommended The Java logger can be configured using the file logging properties see section 2 3 3 1 and used as follows import java util logging Logger l Logger getAnonymousLogger info Component started ARE provides a unified logging and error reporting mechanism The AstericsErrorHandling class provides 4 types of loggers to be used by the ARE deployed components and the Page 46 AsTeRICS Developer Manual ACS It also provides methods for status checking which are responsible for monitoring the current status of the ARE and deployed Components The 4 different loggers correspond to different severity levels as follows Level severe only severe errors are logged Such err
101. he components plugins the ports and the channels also known as bindings These concepts are available for introspection and reflection in runtime i e their properties can be both queried and edited It should be noted that these concepts describe merely types of runtime artifacts For instance component specifies a special component type that can be instantiated multiple times In each instantiation all attributes are static except the properties that can be edited in runtime For example a specialized signal processing processor can be instantiated multiple times with different property values and can be connected to different components While both component instances share the same type they are individually used and maintained in the ARE Page 76 AsTeRICS Developer Manual interface Component Figure 2 Simple view of the runtime model 3 interface Port These artifacts and their relationships are illustrated in Figure 2 This figure illustrates the relationships between components ports and bindings A component consists of one or more ports A binding on the other hand connects exactly two components via two corresponding ports A more detailed description of the main runtime concepts and their relationships is provided in the following paragraphs 7 1 1 1 Components The components are the main artifacts in the ARE runtime model As mentioned before components can serve one of th
102. helement location middleware asterics ARE jar gt lt path gt lt property name resources location src main resources gt lt target name init gt lt Create the time stamp gt lt tstamp gt lt u Create the build directory structure used by compile gt lt mkdir dir build gt lt target gt lt target name compile depends init description compile the source gt lt javac srcedir src java destdir build verbose true debug debug classpath classpath gt lt classpath refid asterics classpath gt lt javac gt lt target gt lt target name jar depends compile description generate the OSGi bundle gt lt jar jarfile dist asterics component id jar basedir build manifest resources META INF MANIFEST MF gt lt fileset dir resources gt lt jar gt lt copy file dist asterics component id jar tofile runtime asterics component id jar gt lt target gt lt project gt In the first section of the build script folder locations for the build intermediates the final build products jar file and the classpath are defined The classpath usually points to the bin folder the middleware asterics ARE jar and the osgi distribution If a component needs additional resources their location has to be defined here Page 16 AsTeRICS Developer Manual Subsequently the build script defines two build targets the c
103. hout optional data without CRC is 11 byes the maximum packet size 2048 bytes data CRC is 2063 bytes 6 2 Request Reply Code The request reply codes have to be supported by all CIMs and specify a generic way to read write features etc Requests are sent from ARE to CIM replies are sent from CIM to ARE and are usually a direct acknowledgement to a request The only exception is when a CIM replies data periodically or on occurrence of an event All CIMs have to implement command with codes lt 0x80 others can be implemented optionally e g the command 0x80 reset CIM could be useful to re initialise ClM functions 0x82 stop CIM could establish a failsafe state if necessary A request reply consists of a high byte MSB and a low byte LSB The LSB specifies the actual command ID In case the packet is sent from ARE to CIM the MSB specifies the transmission mode e g with without CRC In case the packet is sent from CIM to ARE the MSB holds an error status information MSB 8 bit LSB 8 bit Mode Status code Request Reply code Every request from ARE to CIM will be acknowledged by a corresponding reply packet A reply packet may contain feature associated data 6 2 1 Request Reply Code in LSB Request Direction Description Expected Data Reply code 0x00 ARE CIM request feature list 0x00 CIM gt ARE reply feature list list
104. hrough the CIMPortManager method public CIMPortController getRawConnection String portName int baudRate This will open the port with the name specified in the parameter portName and set the communication to the specified Baud rate Data can be sent to peripheral using the sendPacket method for the returned CiMPortController The packet will simply transfer the byte array passed in the data parameter and ignore the values giving the in the other parameter fields Received data will be forwarded to the event handler through calls to handlePacketReceived with a CIMEventRawPacket as parameter This class holds a public member variable b which holds the value of the received byte The event handler has to handle the reconstruction of the proprietary packet itself HighSpeed Raw Ports public CIMPortController getRawConnection String portName int baudRate boolean highSpeed A second variant opf the getRawConnection method allows specification of a highSpeed parameter If highSpeed is true the ClMPortController does not apply any connection handling or callbacks for received data to avoid performance problems in higher bandwidth streaming use cases In this case the ClMPortController can return the JAVA InputStream for the openend COM port connection and the plug developer can use it as desired portController CIMPortManager getInstance getRawConnection COM12 115200 true in portController getInputStream if
105. ication between bundles passes 11 2 Modularization in OSGi One of the most useful features of OSGi is that it allows for modularization of bundles In principle the developer is allowed to specify exactly which classes should be imported and which ones exported at a package level As outlined in 4 2 3 each bundle specifies a manifest file placed in a JAR file at META INF MANIFEST MF where it can specify this kind of details For example the main AsTeRICS middleware bundle could specify the following manifest file Manifest Version 1 0 Bundle ManifestVersion 2 Bundle Name asterics middleware Bundle SymbolicName org asterics mw Bundle Version 0 1 0 Bundle Activator org asterics mw Main DynamicImport Package Export Package org asterics mw component The two last lines indicate that the required packages should be dynamically imported as needed while the org asterics mw component package should be made available for use by other bundles deployed within the same OSGi environment For further information about OSGI please refer to 9 11 3 Using OSGi in AsTeRICS The OSGi is an ideal framework for realizing some of the AsTeRICS components In particular OSGi is intended to provide the underlying framework for the AsTeRICS Runtime Environment ARE as well as the several pluggable components i e sensors processors and actuators The ARE middleware is realized as a collection of modules wh
106. ication service layer is a unified approach to allow plugins of the ARE to communicate with their associated hardware modules attached to the AsTeRICS platform via a COM port A range of hardware modules are provided which implement the dedicated Communication Interface Module CIM protocol Further details on this communication protocol and implementation details for the ARE CIM Communication Service can be found in chapter 5 14 e Remote Connection Service the remote connection services allows external software that cannot be integrated into the standard plugin inter communication system used by the ARE for example because of programming language incompatibilities to work with the AsTeRICS system For example the interconnection of OSKA the On Screen Keyboard Application developed by AsTeRICS partner SENSORY and the ARE uses the Remote Connection Service to send key selection information to the ARE On the other hand the ARE can reply with cell selection commands or other information The actual communication is done via a protocol that can be understood by the Java ServerSocket implementation The port number that the external software component connects to identifies the connecting component e Local Storage Service The Local Storage Service will allow plugins to store individual working data per model and per plugin instance This is necessary when plugins need to store own calibration data pattern recognition samples or simi
107. ich provide bundle discovery lifecycle management communications the server side of the ASAPI communication Page 107 AsTeRICS Developer Manual system etc Furthermore OSGi is used to manage the different components as individual bundles After the ARE has been started the OSGi commands can be used to monitor bundles and manage their lifecycle Double Cinicke ons YS CARES OAC EE C test deployment gt java Djava util logging con mGa ri ISI oye eyakinve r OVO KSNcIE ies Jea Org eC lipses osai SG Oow2OLWOSiky jen exoimiealeppice tion profile console OSEA SS Framework is launched id State Bundle 0 ACTIVE AL ACTIVE OE Giae CIPS enOS Guagor O10 mav 2 0 M0010 5 ilk lea es org asterics middleware 0 1 0 osgi gt install file asterics sensor webcamera jar Bundle id is 2 osgi gt start 2 osgi gt install file asterics processor averager jar Bundle id is 3 OSG Scat 3 osgi gt install file asterics actuator mouse jar Bundle id is 4 osgi gt start 4 osgi gt ss id State Bundle 0 ACTIVE ORCC CIR DS COS Gaigus O n ORANO 1 ACTIVE org asterics middleware 0 1 0 2 ACTIVE org asterics webcamera 0 1 0 3 ACTIVE eu asterics component processor averager 0 1 0 4 ACTIVE eu asterics component actuator mouse 0 1 0 osgi gt Page 108 AsTeRICS Developer Manual 12 Appendix B Building the ACS 12 1 Setup of the Development environment The following steps
108. ig cmake 09 01 o actuator remotemouse o actuator syntheticvoice j a actuator textdisplay a actuator wavefileplayer a libraries o 3rdparty upme p out Figure 16 AsTeRics third party folder structure As a final remark please note that the opencv now uses the Threading Building Blocks TBB from Intel instead of OpenMP to provide where possible parallelisation of the heavy computations often required by algorithms The TBB runtime library is shipped in the same package as the opencv 2 3 1 under the common folder 13 2 Boost Library The Boost libraries are required only for the facetrackerCLM plugin As the opencv boost has a rich Getting Started section which we invite developers to read Boost uses BJam as building tool Once downloaded the source should be unpacked in a local directory The first 2 http threadingbuildingblocks org http www boost org Page 112 AsTeRICS Developer Manual step consists in building of the bjam executable It is sufficient to execute the bootstrap bat batch file in the boost root directory Now open a console Terminal and change directory and issue the following command bjam toolset msvc variant release link static threading multi runtime link static install This command tells the build manager to build a release static and multithreaded version of the boost libraries which links statically to the microsoft runtime The build process will start ta
109. in available gt 100 myHandlePacket byte in read 5 2 Communication through a socket interface Remote Connection Manager When using third party software that runs on the same platform as for example the prominently used On Screen Keyboard Application OSKA it becomes necessary to establish a communication between ARE and the third party application This is managed by the RemoteConnectionManager found in the package eu asterics mw services The main interface to this manager are the classes RemoteConnectionManager and IRemoteConnectionListener 5 2 1 IRemoteConnectionListener This interface is implemented by plugins that need to communicate via a socket communication The interface contains the following methods void connectionEstablished void dataReceived byte data Page 43 AsTeRICS Developer Manual void connectionLost void connectionClosed connectionEstablished is called whenever a plugin requests a connection and the connection has been established This can either happen if a connection has already been established before or if the new connection has finished its setup and connection process dataReceived is called whenever new data arrives from the other end of the connection Data is transferred in a byte array and has to be processed by the event listener connectionLost is called when the connection management cannot read from or write to the socket connectionClosed is calle
110. ion Note that the 32 bit version is also recommended for 64 bit machines e g running Windows 7 as there have been reported problems with the 64 bit version 5 Download and install ant build framework to build AsTeRICS from the command line optional a Download and install the apache ant build framework version gt 1 9 1 http ant apache org bindownload cgi b Create a System Environment Variable ANT HOME which points to the installation directory of ant c Add the ant bin path to the System Environment Variable Path 6 Download and extract the AsTeRICS source code a Use your favourite git client and clone the github repository https github com asterics AsTeRICS git b Or download and extract the zip file into a desired location on your hard disk 7 Start eclipse exe If starting the first time create a workspace folder as suggested 8 Choose File gt New gt JavaProject in the Eclipse main menu disable the option Use default location and browse to the ARE subfolder Page 12 AsTeRICS Developer Manual New Java Project o fees Create a Java Project Enter a project name Project name Use default location Location I JRE Use an execution environment JRE l JavaSE 1 7 x Use a project specific JRE jre7 Use default JRE currently jre7 Configure JREs 9 Then you should see something like this foe es Java ARE components
111. ion Deploys a new empty model into the ARE In essence this is equivalent to creating an empty model and deploying it This results to freeing all resources in the ARE i e if a previous model reserved any void newModel Deploys a new empty model into the ARE In essence this is equivalent to creating an empty model and deploying it using deployModel String above This results in freeing all resources in the ARE i e if a previous model reserved any void runModel throws AsapiException It starts or resumes the execution of the model It throws AsapiException if an error occurs while validating and starting the deployed model public void pauseModel throws AsapiException Briefly stops the execution of the model Its main difference from the stopModel method is that it does not reset the components e g the buffers are not cleared Page 91 AsTeRICS Developer Manual It throws an AsapiException if the deployed model is not started already or if the execution cannot be paused public void stopModel throws AsapiException Stops the execution of the model Unlike the pauseModel method this one resets the components which means that when the model is started again it starts from scratch i e with a new state It throws AsapiException if the deployed model is not started already or if the execution cannot be stopped public void storeModel Stri
112. ion is the fastest method and should be used whenever possible Sending a CIM packet is done by providing the feature address and request code for a certain packet The feature addresses and request codes can be found in the CIM protocol specification and the basic addresses and requests are also provided as static fields in the CIMProtocolPacket class If data has to be attached to a CIM protocol packet a byte array holding said data has to be passed to the method otherwise the data parameter of the method has to be set to null The caller can also decide whether a CRC checksum should be added to the packet although this is currently unimplemented 5 1 3 ClMEventHandler Receiving a packet is done through use of the ClMEventHandler interface This interface should be implemented by plugins that wish to communicate with CIMs or raw ports The interface contains two methods public void handlePacketReceived CIMEvent e public void handlePacketError CIMEvent e These methods are called upon correct reception of a packet or upon discovery of an error timeout of a reply packet transmission errors incorrect order of incoming packets respectively by the port controller Upon correct reception of a CIM protocol based packet the method handlePacketReceived is called with an instance of CIMEventPacketReceived as parameter After conversion of the CIMEvent to this class the packet can be extracted from the event and processed
113. ive functions The following diagrams show two possible scenarios for ASAPI ARE interconnection 1 one for the configuration of the ARE and one for the operation thereof 2 Usually these scenarios will involve primary and secondary users of the AsTeRICS system AT developers use the Configuration Suite to set up the model for the desired AT configuration tailored to a specific use case or end user 1 End users start the system power up the embedded platform or start the ARE on PC or netbook to get their desired AT configuration which operated stand alone or in connection with 3 party applications on a PC or netbook 2 Page 87 AsTeRICS Developer Manual 9 1 1 ASAPI and ARE in the configuration process Setting up a model ASAPI Control Interface configure plugins manage model PC Embedded Platform Universal HID actuator plugin Tremor Reduction Plugin __ i A A i IR Gateway Gripper Plugin Enobio Plugin Plugin JNI JNI Pneumatic SVM Mini USB Gripper CAM IR Gateway Figure 11 AsTeRICS configuration scenario model setup Figure 11 shows the configuration process of the AsTeRICS Runtime Environment by the AsTeRICS Configuration Suite via ASAPI The ASAPI client of the ACS connects to the ARE s ASAPI server It queries the available plugins and their parameters In the above figure some exemplary plugins are sho
114. izardinstance aF elpListener1 IRuntime return null Q new IRuntimeEver aF etpTrigger1 Runtime aF etpTriqger IRuntime E r gt 4 E problems Javadoc Declaration E console 23 i SVN Tree Conflicts History 4 Search x k Sle 4 Bey 75 lt terminated gt AsTeRICS build xml 93 Ant Build C Program Files x86 Java jre6 bin javaw exe 03 10 2011 14 33 17 Tjavacy ioading java lar s t ioat ciass aj javac loading java lang Boolean class java lang Boolean class javac loading java lang Void class java lang Void class javac wrote C eclipse workspace AsTeRICS ARE components out production processor testerFo javac wrote C eclipse workspace AsTeRICS ARE components out production processor testerFo javac wrote C eclipse workspace AsTeRICS ARE components out production processor testerFo javac wrote C eclipse workspace AsTeRICS ARE components out production processor testerFo javac total 422ms jar Building jar C eclipse workspace AsTeRICS ARE components asterics processor testerF copy Copying 1 file to C eclipse workspace AsTeRICS examples ARE BUILD SUCCESSFUL Total time 843 milliseconds 4 gt To see the plugin in the ACS editor window and or start it inside the runtime environment the Plugin Activation Tool can be used see section 3 3 2 Plugin Activation in ACS and ARE To u
115. ize is used the current accessible display area is 114 x 64 pixels 0x0072 r w set text window on status LCDisplay 8 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 width bytes 6 7 height window must fit on the display otherwise error is returned the current accessible display area is 114 x 64 pixels 0x0073 r w set text font 1 byte 0 Terminal 6 6x8 pixels 1 Terminal 9 6x12 pixels 2 Terminal 18 12x24 pixels 0x0074 print 1 to 2048 bytes null terminated string prints only part which fits in the text window set by feature 0x0072 Special characters n goes to next line but keeps the column r clears the line inside the window from the current position to the end of the line and then it goes to the beginning of the Page 71 AsTeRICS Developer Manual line So r r clears the full line b goes one character back and clears it t TAB function the step is 4 columns clears the text from the current position to the new one so 1 4 characters depending on the position f clears the whole text window and sets the position to the top left corner of the window 0x1f the letters after this special character are inverted Oxte the letters after this special character are not inverted 0x0075 draw bitmap 9 to 2048 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 wi
116. king some time It s time to take a break The command will create and install the boost libraries into the C Boost directory this behaviour can be changed by specifying a different directory with the option prefix lt PREFIX gt in the command line The VC projects which uses the boost libraries look for the required includes and libraries specified by two environment variables BOOST_INCLUDES and BOOST LIBS It is therefore necessary to set both accodingly to where the boost libraries were installed In our case the environment variables will be set to the values as in Figure 17 and Figure 18 Local Disk C Boost gt include boost 1_47 gt 4 Se rary Share with New folder A Name Date modified Type Ji boost 21 02 2012 18 46 File folder Figure 17 Boost include path r gt Local Disk C Boost lib s library Share with v New folder z Name Date modified Type ta libboost_chrono wc100 mt s 1_47 lib 21 02 2012 18 48 Object File ya libboost_date_time vc100 mt s 1_47 lib 21 02 2012 18 48 Object File Y libboost_exception vc100 mt s 1_47 lib 21 02 2012 18 48 Object File 2 Y libboost_filesystem vc100 mt s 1_47 lib 21 02 2012 18 48 Object File fod ea a a 1 T 11 MANNIN ALAO ALi a2 Fa Figure 18 Boost library path As a final note please keep in mind that the boost libraries use the autolinking feature that allows the linker to figure out which will be the required libraries duri
117. l 4 Writing AsTeRICS Plugin Code 4 1 ARE Coding Guidelines Coding guidelines are necessary to allow new developers to quickly find their through the code of the ARE They are created in such a way to provide means for developers to understand code of each other but they also make sure that non technical users can find their way through a model in ACS The basic coding guidelines are e Plugins ports and properties should be named intuitively in the bundle descriptor Only if necessary the corresponding variables in the plugin code should be named differently However they should adhere to the naming conventions stated in section 4 1 2 and different names should be commented in the code sections which translate the name into the variable getInputPort getRuntimeProperty e Variable names should always use the Java naming conventions e Every method should be preceded by a JavaDoc compatible header in order to allow new developer to grasp what is going on in it e Where reasonable code comments should be added to improve understanding of code internals e Code should be indented by two spaces per indentations stage Indentations should be done using space and not tabs Tabs should be converted to spaces e Parentheses should be placed in a separate line to facilitate readability 4 1 1 Port Naming Conventions Variables of port instances should be named with a prefix indicating what kind of port it is The rest of the port name
118. l other features and the associated addresses will be defined for a particular ASTeRICS CIM Type A feature definition includes the amount of data which is expected in the optional data field If a command is not associated with a specific feature e g the request get feature list the feature address can have any value and will have no effect For a specification of currently defined features please refer to section 6 3 Request Code Reply code The LSB of this value represents a command code which is globally valid for all CIM Types If sent from ARE to CIM the MSB specifies the transmission mode If sent from CIM to ARE the MSB holds an error status code related to the transmission For a detailed description of Request Reply codes please refer to section 6 2 Optional data 0 2048 The packet can contain up to 2048 bytes of additional data The actual length is given in the Data Size field Optional CRC checksum Oor4 CRC32 checksum if CRC Bit in Command field is set CRC32 with 0x04c11db7 polynomial used also in e g ZIP or Ethernet protocol Page 60 AsTeRICS Developer Manual CIM Protocol Important notes e Italic descriptions refer to communication from CIM to ARE e All integer values version data size serial number feature address command checksum in the packet are stored in little endian format in the packet e The minimum packet size wit
119. lar data In course of the architectural refinements for the final prototype a service class will be provided which generates an according folder and respective file read and write methods e Native Hook Services for systemwide keyboard and mouse capturing e Computer Vision services to support a unified way for frame grabbing computer vision processing and video frame rendering 5 1 Communicating with peripherals CIM Communication service Communication between actuator and sensor components in the ARE and peripheral devices is currently defined to use a serial communication i e a COM port or a virtual COM port Messaging via this interface can either adhere to the CIM protocol see section 5 14 or use any other protocol using the raw port implementation of the CIM communication services All the communication with peripheral devices is done through a service in the ARE service layer called CIM Communication The service is provided as a separate OSGi bundle which places its classes in the package eu asterics mw services cimcommunication Access to the classes is done by exporting the entire package in the bundle Page 39 AsTeRICS Developer Manual Four classes of the CIM Communication service are important to the component programmer e CIMPortManager e ClMController e CIMProtocolPacket e ClMEventHandler 5 1 1 ClMPortController ClMPortController is an abstract class which hides the actual implementation of the port
120. ll usually answer only on a request from the ARE Additionally CIMs could send data without being requested from the ARE for example periodic updates of a value These periodic updates use a reserved The CIMs provide a full list of supported features upon an identification request This offers flexibility if a new module type is manufactured where already known features with known commands are integrated but the number and combination of features is different from the previous module types To provide the possibility to identify CIMs of the same type in the ARE e g when two GPIO CIMS are connected a unique serial number is hardcoded in firmware and can be queried via a feature request Page 59 AsTeRICS Developer Manual 6 1 Communication Mechanism and Packet Format The following table shows the CIM protocol structure Data field Size bytes Range of values Description Packet ID T 0x4054 In case of the lost packet synchronization the 2 bytes packet ID helps to identify the beginning of a packet so that a lost communication with the CIM will be resynchronized ARE ID CIM ID If the packet is sent from ARE to CIM the ARE ID identifies the ARE software version e g Ox010E means 1 14 If the packet is sent from CIM to ARE the CIM ID identifies the CIM type in the MSB and the CIM version in the LSB e g 0x0105 means CIM type 0x01 HID actuator version 5 The
121. llowing screenshot Page 26 AsTeRICS Developer Manual E TesterForWizardInstance java package eu asterics component processor testerForwizard import java util logging Logger import eu asterics mw data Convers ionuUtils import eu asterics mw model runtime AbstractRuntimeComponentiIns tance import eu asterics mw model runtime IRuntimeInputPort import eu asterics mw model runtime IRuntimeoutputPort import eu asterics mw model runtime IRuntimeEventListenerPort import eu asterics mw model runtime IRuntimeEventTriggererPort import eu asterics mw model runtime imp DefaultRuntimeoutputPort import eu asterics mw model runtime imp DefaultRuntimeEventTriggererPort import eu asterics mw services AstericsErrorHand ing B ASTeRICS Assistive Technology Rapid Integration and Construction Set d8888 88888888888 8888888b 8888888 d8888b d8888b d88888 888 888 Y88b 888 d88P Y88b d88P Y88b d88P888 888 888 888 888 888 888 Y88b d88P 888 d8888b 888 d88b 888 d88P 888 888 Y8B8b d88P 888 88K 888 d8P Y8b 8888888P 888 888 88b d88P 888 Y8888b 888 88888888 888 T88b 888 888 888 888 d8888888888 X88 888 Y8b 888 T88b 888 Y88b d88P Y88b d88P d88pP 888 88888P 888 VY8888 888 T88b 8888888 Y8888P Y8888P homepage http www asterics org This project has been funded by the European Commission Grant Agreement Number 247730 License LGPL v3 0 GNU Lesser General Public License Ver
122. lt long ARZ RONGA Page 102 AsTeRICS Developer Manual result if nResult lt 0 return nResult result close if nResult lt 0 return nResult return 1s get3DMouseState x Y Z Ie RV ARZ DETON E 10 4 Keyboard Library The Keyboard Library is designed for developers who need to adapt the computer keyboard for the specialized needs of motor disabled people For example if the application has to use standard keyboard input for the scanning and send the keys in different way Developers using this library will be able to get information about all system key events and send key events to other applications The library uses Low Level Keyboard Hook 10 4 1 Keyboard Library interface Library functions The library interface is declared in the KeyboardLibrary h file Function Description KEYBOARDLIBRARY_API int __stdcall init HookCallBack hookCallBack LPVOID param Initializes the library The hookCallBack parameter is a pointer to the call back function The param parameter is a parameter defined by user KEYBOARDLIBRARY_API int __ stdcall close Closes the library KEYBOARDLIBRARY_API int __ stdcall startHook Starts key events hooking KEYBOARDLIBRARY_API int __ stdcall stopHook Stops key events hooking KEYBOARDLIBRARY_API int __ stdcall sendKeyByScanCode int scanCode SendKeyFlags flags Simulates a key event using a key scan
123. middleware asterics mw services cimcommunication jar CIM port manager asterics0 log application log file jtester exe helper app for checking Java version logging properties configuration of loglevel etc Cree Selijose Osgi SoG OvZ0l0O517 oaewe oso Teire DETON sleeper exe helper app for launcher timing SCSI IONE starts ARE with console output E seart aOebugibat starts ARE with Eclipse debug support SUSIE o Sia starts ARE without console on Linux T Sita re debugmsh starts ARE with debugging on Linux VCChecker jar helper jar for checking VC redist dependency Important Note The osgi configuration folder org eclipse osgi in the profile subdirectory has to be deleted if dlls in jar bundles are updated or changed This folder is automatically created when starting the ARE and holds working data for the OSGI bundles The One Click build xml script described in chapter 2 4 1 deletes the folder automatically 2 5 2 Structure of the loader ini file Page 17 AsTeRICS Developer Manual The loader ini file located in the folder bin ARE profile specifies bundles which will be started by the ARE middleware automatically using the OSGI lifecycle management commands This file is created by the AsSTeRICS Plugin Activation Tool see section 3 2 but could also be updated manually Basically it contains a list of jar files for the built components as shown in the following list asterics
124. mine the state of particular plugins Page 89 AsTeRICS Developer Manual ASAPI and ARE in the runtime system PC ASAPI Control Interface configure plugins managemodel Fo fo fo RES gt ASAPI Data Interface get live data from plugins Universal HID 4 module send data to plugins ASAPI Native Interface connect PC peripheral directly via C Net Embedded Platform JNI Universal HID actuator plugin IR Gateway SVM Plugin SVM Plugin Gripper Flugin Enepioktugin Plugin JNI JNI Reduction Plugin JNI JNI Pneumatic SVM Mini USB Gripper Enobio IR Gateway Webcam CAM Figure 13 AsTeRICS runtime scenario A fully configured ARE can run as a stand alone process providing its functionality or communicate with PC AT software A connection between ARE and ACS is no longer required at that time The above runtime scenario consists of a configured ARE with connected plugins that interface the external sensors Enobio SVM and actuators pneumatic gripper IR gateway Third party applications running on the PC can optionally e query or send data by using ASAPI data commands e use the ASAPI native interface to access supported PC peripherals like mobile phone 3D mouse e use ASAPI to connect to the running ARE and send control commands to modify model or plugin settings If the Universal HID actuator USB dongle is used the PC application can o
125. n Important Notes e the path to the target folder has to exist in the local file system and must point to the ARE components directory where all plugin source files are located e g C asterics bin components e The plugin name must be specified in CamelCase letters capital first letter e g MyPlugin Type and Subcategory have to be specified they define the location where the plugin will appear in the ACS Components menu e It is possible to create a list of possible text selections in a combo box in the ACS property editor The data type for this property must be integer the property gets the number of the selected item Text captions for the combo box entries must be separated with double slash e g Mode 1 Mode 2 Mode 3 Page 24 AsTeRICS Developer Manual 3 1 1 Created files and folders After Create Plugin has been pressed and the plugin creation was completed successfully following sub folders and files are begin created El sre main java eu J asterics component J processor J testerForWizard J resources J META INF The root folder contains the build script which can be executed inside Eclipse to compile and build the plugin jar file iix lt project name asterics lt property name component id value processor testerForwizard g
126. nating the activation i e start and deactivation i e pause and stop of the corresponding components Before realizing certain models the configurator utilizes the validation services of the model manager Also in order to access existing ones or create new instances of components the configurator uses the services available by the component repository Finally it also provides support for forming new channels or dissolving existing ones between certain ports n 4 IModelService i IConfigurstionService ComponentRepository AHH A BundleManager 3 e9 Efiki Figure 6 Internal architecture of the ARE ComponentRepository The component repository serves two roles First it maintains a list with the available component types which can be changed when new components are installed or existing ones uninstalled Second it maintains a repository with the current component instances New instances can be dynamically created and existing ones be dissolved BundleManager This component allows for dynamically installing or uninstalling software bundles containing one or more components This is needed to allow for easy updating of ARE instances with new or updated component implementations For this purpose the OSGi bundle mechanisms will be used In essence when a new bundle is installed or uninstalled it will be checked whether it contains AsTeRICS Page 81 AsTeRICS Developer Manual com
127. nent property include lt jni h gt static JavaVM g jvm etare JOobJect G obj NULL const char propertyKey myProperty const char propertyValue 20 JNIEXPORT jint JNICALL Java_org asterics jni Bridge activate JNIEnv env jobject obj Jint error coce Op error code env gt GetJavaVM amp g jvm age erste Ornc Ooms A0 recurnkerrorkcoder jclass cls env gt GetObjectClass obj Jmerchoo Dim dE keny Cece thocy lls mame wilate eaae gett lialesieala VANS isk mid NU return 1 9 method now found explicitly ask for a global reference g_obj env gt NewGlobalRef obj my E tareas iare r rorurokerroricoder JNIEXPORT jint JNICALL Java_org asterics jni Bridge deactivate JNIEnv env jobject obj SME mets Orme Ccodes o my thread exit Ok env gt DeleteGlobalRef g_obj Be SUISME Creo TEC OC JNIEXPORT jstring JNICALL Java_org asterics jni Bridge getProperty JNIEnv env jobject obj jstring key Conse char strKkey jstring result if key NULL return NULL OutOfMemoryError already thrown strKey env gt GetStringUTFChars key NULL if strcmp propertyKey strKey 0 result env gt NewStringUTF propertyValue result NULL property was not found env gt ReleaseStringUTFChars key strKey return result Page 56 AsTeRICS Developer Manual JNIEXPORT jstring JN
128. ng linking time Page 113 AsTeRICS Developer Manual 13 3 Videolnput Although videolnput is available on the internet as a precompiled static library we need to setup a custom project because the distributed package will not run in a multithreaded environment such as AsTeRICS The suggested version to download is the one available on the gameoverhack github repository Download the zipped package and unpack it on the hard drive For our purposes Videolnput also requires the Microsoft Windows SDK 7 1 or the latest available The SDK available from the Microsoft website The SDK will provide all required DirectShow headers and libraries as explained in the following steps Be sure to include also the Samples in the installation process Although Videolnput source also include DirectShow headers and libraries as well as DirectX libraries we will not use any of them because the building process could be quite problematic Following these instructions instead will lead to a cleaner building process To avoid every problem the suggestion is to remove all lib files inside the folder Our starting point is the Visual Express solution video nput sin located in the folder VC 2008 videolnputcompileAsLib see Figure 19 VC2008 videoInputcompileAslib 4 Search VC2008 videolnputca P rewith v New folder a 0O Name a Debug P Release Y dxguid lib Y ole32 lib Ya oleaut32 lib E q
129. ng modellnXML String filename throws AREAsapiException Stores the XML model specified by the string parameter in the file specified by the filename parameter Throws an AREAsapiException if the file cannot be created or if the model cannot be stored public String listAllStoredModels throws AREAsapiException Returns a list with all stored models Throws AREAsapiException if the models directory could not be found public boolean deleteModelFile String filename throws AREAsapiException Deletes the file of the model specified by the filename parameter Throws AREAsapiException if the file could not be found or could not be deleted public void autostart It is called on startup by the middleware in order to autostart a default model without the need of pressing deploy and start model first Methods to read and edit the model String getComponents Returns an array that includes all existing component instances in the model even multiple instances of the same component type String getChannels String componentID Returns an array containing the IDs of all the channels that include the specified component instance either as a source or target void insertComponent String componentID String componentType throws AsapiException Used to create a new instance of the specified component type with the assigned ID Throws an exception if the specified component type is
130. nikum wien at Date Mar 7 2011 Time 10 55 05 AM bn ae A SR A Page 31 AsTeRICS Developer Manual Example for a method of a class Returns the value of the given property param propertyName the name of the property return the property value public Object getRuntimePropertyValue String propertyName 4 2 Implementing AsTeRICS components This section describes the basic steps required for implementing an AsTeRICS component including a brief introduction to OSGi To illustrate the implementation steps we take a walk through with the implementation of a simple processor component The AsTeRICS schemata of the XML descriptors include two concepts the bundle descriptors and the deployment descriptors 4 2 1 The Bundle Descriptors Bundle descriptors are used to describe the content of an individual bundle typically encapsulating one or more components As such they contain information about the included components their ports their customizable properties and optionally their GUI The following shows a bundle descriptor of a simple processor plugin subtype for the ACS components menu is Basic Math The plugin provides an averaging function for n values property buffer size and has one input port and one output port for integer values lt xml version 1 0 gt lt componentTypes xmlns xsi http www w3 org 2001 XMLSchema instance xSi noNamespaceSchemaLocation bundle model xsd
131. not available or if the specified ID is already defined void removeComponent String componentID throws AsapiException Used to delete the instance of the component that is specified by the given ID Throws an exception if the specified component ID is not defined Page 92 AsTeRICS Developer Manual public String getAllPorts String componentID throws AsapiException Returns an array containing the IDs of all the ports i e includes both input and output ones of the specified component instance An exception is thrown if the specified component instance is not defined public String getInputPorts String componentID throws AsapiException Returns an array containing the IDs of all the input ports of the specified component instance An exception is thrown if the specified component instance is not defined String getOutputPorts String componentID throws AsapiException Returns an array containing the IDs of all the output ports of the specified component instance An exception is thrown if the specified component instance is not defined void insertChannel String channellD String sourceComponentlD String sourcePortlD String targetComponentID String targetPortID throws AsapiException Creates a channel between the specified source and target components and ports Throws an exception if the specified ID is already defined or the specified component or port IDs
132. nt id jar basedir build j manifes t resources META INF MANIFEST MF gt kfileset dir resources gt lt jar gt lt copy Files S dist asterics component id jar tofile runtime asterics component id jar gt lt target gt lt project gt mansa The META INF folder contains the manifest file Page 25 AsTeRICS Developer Manual LN icix anifest Version 1 0 Bundle ManifestVersion 2 Bundle Name asterics processors testerForwizard Bundle SymbolicName eu asterics component processor testerForwizard Bundle Version 0 1 0 DynamicImport Package monss The resources folder contains the bundle descriptor bundle_descriptor xml Benson xm vers ion 1 0 gt hae aaa thas ES in xsis http www w3 org 2001 XMLSchema instance xs 1 noNamespaceSchemaLocation bund1e_model xsd gt eeonpereiele ids asterics testerForwizard canonical_names eu asterics component processor testerForwizard TesterForwizardInstance gt lt type gt processor lt type gt lt singleton gt false lt singleton gt lt description gt test the function of the wizzard lt description gt lt ports gt lt inputPort id inl gt lt description gt input port description lt description gt lt multiplicity gt one to one lt multiplicity gt lt mus tBeConnected gt false lt mus tBeConnect
133. nt init LPWSTR com NewSMSAvailable Initializes the library The com parameter defines the newSMSAvailable ErrorCallback errorCallback modem serial port The newSMSAvailable and LPWSTR pin LPWSTR smsCenterNumber errorCallback parameters are pointers to the call back LPVOID param functions implemented in the user application The pin parameter is the PIN code If the PIN code is not required this parameter should be empty The smsCenterNumber parameter contains the user SMS center number If the number of SMS center is not required this parameter should be empty The param parameter is a parameter defined by the user and passed to the call back functions int close Closes the library int sendSMS LPWSTR recipientID LPWSTR Sends SMSs The recipientID parameter is the subject recipient phone ID the subject parameter is the message content Int getModemPortNumber ModemSearchResult Starts to search modems For each modem found the modemSearchResult _LPVOID param modemSearchResult call back function is called The param parameter is passed to the modemSearchResult call back function Table 7 GSM Modem library functions Page 99 AsTeRICS Developer Manual GSM Mode Library functions are declared with the C linkage A function returns a positive value if it succeeds If the function fails it returns a value lower than 0 and the returned value is the code of the error Library call back function
134. ocked by another execution new incoming calls are simply rejected to avoid knocking out the ARE The method is meant to be used for data and event notification tasks 8 2 Synchronous method execAndWaitOnModelExecutorLifecycle Thread public void execAndWaitOnModelExecutorLifecycleThread Runnable r throws InterruptedException ExecutionException TimeoutException or public lt V gt V execAndWaitOnModelExecutorLifecycleThread Callable lt V gt c throws Exception Performs a synchronous execution of the given Runnable Callable in the ModelExecutor thread If the execution blocks longer than the configured timeout interval default 20000ms see 2 5 7 a TimeoutException is thrown The method is meant to be used for lifecycle tasks and used by the ARE GUI the ASAPIServer the RESTServer and other ARE components 8 3 Pro and Contra of the single threaded approach Using a single thread brings many advantages like e Easier plugin development no need to consider data integrity and thread synchronization e More reliable hardware access Some libraries require a single threaded access Page 84 AsTeRICS Developer Manual e Deterministic sequential execution of model data propagation and event notification On the other hand a hanging O call a long lasting method call or a thread deadlock block the whole model execution or lifecycle task In such a case it wouldn t even be possible to stop a model This problem is accomplished
135. oid syncedValuesReceived HashMap lt String byte gt dataRow Initial The lifecycle support methods are used to intercept AsTeRICS events concerning the component s lifecycle In principle a component can be any of the following INSTALL ComponentType available CREATE INSTANCE e READY Component Instance lifecycle READY ACTIVE stateless stateful e SUSPENDED and pusal SUSPENDED stateful e ACTIVE START STOP STOPPED stateless e STOPPED These states and their possible transitions are illustrated in the figure on the right The rest of the methods are used for supporting the component operations namely accessing the input output ports of the component as well as getting setting its supported properties Page 35 AsTeRICS Developer Manual 4 2 6 Step by Step implementation Averager processor In the following the implementation on a simpe averager component is described This component realizes some simple processing functionality It collects its most recent input from one input port and produces its average at one output port The number of samples to be stored and used for the computation of the average is controlled by a property The component shall have a single input port named in_1 a single output port named out_1 and a single property named buffer size which has the type integer and the default
136. ommand generates the folder gen java containing the files AsapiServer java and AsapiException java Fora more detailed description of the Thrift compiler please see the compiler manual 9 3 3 The Thrift Library For the usage of the generated files a library file must also be generated The source code of the libraries is also available in the thrift bundle from http incubator apache org thrift For all languages being supported by the compiler are libraries available In the source code folders of the libraries is also a language specific instruction please follow the instruction to generate the library file In the case of Java after successfully following the instructions the file libthrift jar will be generated In the case of Java the Thrift library needs additional logging libraries The usage of the Simple Logging Facade for Java SLF4J framework 15 is recommended The Thrift 0 8 0 library was successfully tested with version 1 6 0 of SLF4J 9 3 4 Simple Java Client All preconditions are now fulfilled the Java client can be created now Beside the two generated files AsapiServer java and AsapiException java a main file is needed The key lines concerning the Thrift usage are try TTransport transport new TSocket 10 0 0 1 9090 TProtocol protocol new TBinaryProtocol transport AsapiServer Client client new Calculator Client protocol transport open client NewModel catch TException x
137. ompilation of the Java source code and the creation of the jar file If the jar file shall contain additional dlls with native code they have to be specified in the Manifest file as shows in section 5 13 1 After the jar file has been created in the distribution folder it is copied to the runtime folder bin ARE 2 5 Starting the ARE middleware and component deployments To test the ARE and component bundles open the folder bin ARE and locate the batch file start bat 2 5 1 Structure of the runtime folder bin ARE This folder contains dependencies for running the ARE middleware and the jars resulting from ANT builds it has the following structure ap Jonin ARE data folder for plugin working data models stored models configurations profile T CONTELE o imi system bundles to be started services ini general service bundles to be started services windows ini windows specific service bundles services linux ini linux specific service bundles loader ini plugin bundles to be started TS OLGmecistosecnos apy osgi configuration folder pels ov 2 On Alero cg system log messages stack trace T CEOLE plugin helper apps and dlls i 4 LLiovereSie stores console logging settings to ARE exe starts the ARE without console output areProperties stores recent window GUI properties lt my component jar component bundle s asterics ARE jar ARE
138. ons and applets you need the JDK Java Development Kit which includes the JRE ReadMe ReleaseNotes ReadMe ReleaseNotes Oracle License Oracle License Java SE Products Third Party Licenses Certified System Java SE Products Third Party Licenses Certified System Configurations Configurations Choose the 32bit version for your operating system because some necessary components for interfacing hardware are not supported by the 64bit version by now 2 Create a System Environment Variable JAVA_HOME which points to the folder where you installed the Java JDK The dialog for system environment variables can be iain found via System Properties gt Advanced gt Name der Variablen JAVA_HOME Environment Variables Wert der Variablen Ca a Page 11 AsTeRICS Developer Manual 3 Add the JDK bin path to the System oes bearbeiten Environment Variable Path Name der Variablen Path Wert der Variablen jerprint Manager Pro JAVA_HOME bir ox abbrechen 4 Download and install Eclipse Luna from http www eclipse org downloads Eclipse Luna 4 4 1 Release for Eclipse IDE for Java Developers Ye Downloaded 531 859 Times L Windows 32 Bit Wind 64 Bit The essential tools for any Java developer including a Java IDE a CVS dlient Bs snet ai Git client XML Editor Mylyn Maven integrat
139. ors cause an ARE failure and must be addressed immediately Severe loggers should be used only by ARE Errors of this type will be written in the asterics_logger_severe log file Level warning only warnings and upper level messages are logged Warnings are important and must be addressed soon but not as fatal as the severe errors Warnings can be logged by components using the following method call public void reportError IRuntimeComponentInstance component String errorMsg The messages will be written in the asterics_logger_warning log file Level info only informative and upper level messages are logged Use this logger when you normally wanted to print something on the screen public void reportInfo IRuntimeComponentInstance component String info The messages will be written in the asterics_logger log file Level fine only debug and upper level messages are logged Usage of this logger is mainly for debugging or development time Use the following command public void reportInfo IRuntimeComponentInstance component String info The messages will be written in the asterics_logger_fine log file Please note that each logger by default also logs all messages with severity level higher than its own as well E g the warning logger logs warning and severe messages the info logger logs informative warning and severe messages etc 5 7 1 Status checking The status checking m
140. osition and aspect ratio of graphical elements with respect to the screen resolution of the deployment device For more information about the usage of the ACS GUI editor and the ARE GUI control panel refer to the User Manual TeRICS Runtime Environment 22 Host chrisveigl PC 110520351 SS Er R d ugustmenCuve test ASTeRICS Configuration Sute tol K syre Components Edit Misc HideGUI LoadNextCurve GUI composition using the ACS GUI designer right resulting ARE GUI left In order to be recognized as GUl plugin by ACS and ARE the bundle descriptor of the plugin has to be extended with a dedicated lt gui gt entry which specifies the default size in a virtual coordinate system of 10000 10000 pixels In the deployment model the ACS will create position and size information according to the area defined in the ACS GUI designer lt gui gt lt width gt 5000 lt width gt lt height gt 3000 lt height gt lt gui gt The gui element addition to the bundle descriptor The AsTeRICS middleware provides some services to the plugin developers in order to allow them displaying their GUI element onto the ARE Desktop The middleware services encapsulate the complexity of dealing with positioning and allow displaying all GUI elements onto the same container the ARE Desktop Page 49 AsTeRICS Developer Manual All GUI services are defined in eu asterics mw services AREServices so developer
141. pace in a buffer 17 No modem answer 19 The AT command failed 20 SMS read error 21 SMS send error 22 Phone ID is empty 23 Message content is empty 24 Error respond from the modem 25 Undefined modem answer 26 The string is not a number 100 SMS was not sent 2 Library is initialized correctly Table 9 GSM Modem library errors Page 100 AsTeRICS Developer Manual 10 2 2 Example of use Call back functions definitions if wcslen port gt 0 amp amp wcslen modemName gt 0 get the port for the connection with modem getPort port void __stdcall newSMS LPWSTR PhoneID LPWSTR subject LPVOID param get incoming SMS getSMS PhoneID subject void _stdcall errorCallback int result LPVOID param If result 2 LibraryIsInitialized true void __stdcall modemSearchResult LPCWSTR port LPCWSTR modemName LPVOID param Find the modem Initialize the library and send SMS skiqnc Ikigislicltatloy int result 0 result getModemPortNumber modemSearchResult NULL wait for call back function result init serialPort newSMS errorCallback NULL wait for initialize of the library Result sendSMS phoneNumber Test SMS Page 101 AsTeRICS Developer Manual 10 3 3D Mouse Library The 3D Mouse Library is designed to help in adapting 3Dconnexion 3D Mouse devices fo
142. ponents If it does the components will be registered or unregistered with the component repository by reading appropriate metadata from the bundles The relationships between the sub components are illustrated in Figure 6 Also to illustrate the interaction between these components in use consider the sequence diagram illustrated in Figure 7 Pee ee ce A ete eeiee acces E TTA E NEEE f ACS ARE ACS Client Controller interface interface interface i IModelService IConfigurstionService IComponentRepository design l l l deploy i l deploy xml transformModelFromXML xml getModel Model l deployModel Model validsteModel cestelnstance String String Component connectPorts String String String String Figure 7 Sequence diagram illustrating a typical interaction between ACS and ARE In this diagram an ACS client is used to design an application model i e graphically in an appropriate GUI which is then deployed in he ARE For this the ASAPI protocol is used which however is not illustrated here to avoid cluttering for more information on the ASAPI see section 8 On receiving the deploy message the Controller which is the main component of the ARE uses the model service to transform the model which is encoded in XML into its object representation The resulting model is then deployed using the configuration service The lat
143. r Gy processor pathselector amp processor phone Gy processor signaltranslation amp processor string_dispatcher amp processor testerForWizard src main java eu G asterics component processor G testerForWizard 3 TesterForWizardInstance java resources G META INF R bundle_descriptor xml build xml Ea processor tevt sander Java AsTeRICS ARE components processor testerForwizard src main java eu asterics component processor testerForWizard TesterForWizardinstance java Eclipse I el x File Edit Run Source Refactor Navigate Search Project Window Help ae SlGlSaig vOvary leer leaovy P4e ai Pi vilv mor T Ea SVN Reposi He Package Explorer Navigator 23 La 7 25 simulateamouseinstan ID simpleSpeechBridgej _ TesterForwizardinsta 3 gt 3 D E Task ist 28 _ a Gy processor derivative aj Ovile ele ala 7 if listenerl equalsIgnoreCase eventPortID Find A P All gt Activate return elpListenerl Uncategorized return null Connect Mylyn a aia TRuntimeEventTriggererPort getEventTriggererPort String e Connect to your task and ALM tools if triggerl equalsIgnoreCase eventPortID il a SE Outline 22 _ eo return etpTrigger1 DESEEN eu asterics mw model t a if trigger2 equalsIgnoreCase eventPortID euasterics mw model t i eu asterics mw service return etpTrigger2 a javautloggng Loggell TesterForW
144. r people with motor disabilities It works with the 3D Mice connected to PC via USB such as SpacePilot Pro SoaceExplorer and SpaceNavigator 10 3 1 3D Mouse Library interface The library interface is declared in the Mouse3DLibrary h file Library functions Function Description int init Initializes the 3D Mouse Library int close Closes the Library int get3DMouseState long x long y long z long Rx long Ry long Rz long buttons Gets the actual state of the 3D mouse Parameters are axis axis rotation and button state Table 10 3D Mouse Library functions 3D Mouse library interface functions are declared with the C linkage The 3D Mouse Library function returns a positive value if it succeeds If the function fails it returns a value lower than 0 and the returned value is the code of the error Error codes returned by functions The error codes are declared in the Mouse3DLibraryErrors h file Number Description 4 Default error 2 Library is not initialized 3 Library is initialized 4 Library initialization error 5 The 3D Mouse device not found 6 Data acquire error Table 11 3D Mouse Library errors 10 3 2 Example of use Getting 3D Mouse state buttons int getState long x long y int nResult if nResult lt 0 long saz long Ox MOn IN init return nResu
145. re Access Descritption Data address 0x0701 0x0000 r Unique serial number 4 bytes GPI version 0x0001 r GPIO Input State 1 byte 1 Bit 0 Input 1 Bit 5 Input 6 0x0003 r w GPIO Input Pullup State 1 byte Bit 0 Input 1 Bit 7 Input 8 Value 0 off 1 on 33K resisor connected to 3 3 V 0x0004 r w GPIO Input Value Change 1 byte Event Bit 0 Input 1 Bit 7 Input 8 Value 0 off 1 on 0x0005 r w GPIO Periodic Input Value 2 bytes Event bytes 0 1 period time 0 off to 65535 milliseconds 0x0020 w Store current CIM state to none EEPROM as default power on state 0x0077 r w RGB status LED override 1 byte bit 0 1 red bit 2 3 green bit 4 5 blue 00 override off 01 always off 10 always on 11 blinking 6 3 12 PT2 GPO CIM DigitalOut CIM ID Feature Access Descritption Data address 0x0801 0x0000 r Unique serial number 4 bytes GPO 0x0010 r w GPIO Output State 1 byte version 1 Bit 0 Output 1 Bit 4 Output 5 outputs 1 2 are relays 3 5 are OC 0x0011 r w GPIO Output Pullup State 1 byte Bit 2 Output 3 Bit 4 Output 5 Value 0 off 1 on 0x0020 w Store current CIM state to none EEPROM as default power on state 0x0031 r w 12 V power output 1 byte 0 disable 1 255 enable 0x0077 r w RGB status LED override 1 byte bit 0 1 red bit 2 3 green bit 4 5 blue 00 override off 01 always off 10 always on 11 blinking Pa
146. ree main roles Sensors these are components which only feature output ports i e they do not depend on input from any other components Typical sensors are commonly coupled to underlying hardware sensors to generate their output data e g a face tracking sensor which is coupled to a web camera but they can also be completely realized internally e g a signal generator Processors these are components which feature both input and output ports This is the most common type of components and provides the foundation for forming applications The processor components can be either realized completely internally e g an average which keeps track of the last n values of a scalar value and always outputs their average value or they can be coupled to some external software library or even coupled to a hardware component e g utilize legacy libraries for complex signal processing or even utilize specialized hardware accelerators for highly demanding computations Actuators these are components which only feature input ports i e they do not produce any output that can be utilized by other components The main role of actuators is to enable the desired functionality of the applications and for testing e g a mobile phone actuator allows to place or answer phone calls and to send SMS messages while an oscilloscope actuator allows for viewing and thus testing or debugging of signal generators Short Text Message Page 77
147. returned value is 0 the library will block or pass the event according to the BlockKeys function Table 13 Keyboard Library call back functions Error codes returned by functions The error codes are declared in the KeyboardLibraryErrors h file Number Description 1 Default error 2 Library is not initialized 3 Library is initialized 4 Library initialization error 5 Hook in not initialized 6 Hook is initialized 7 Hook initialization error 8 Hook stopping error 9 Error during key send Table 14 Keyboard Library errors Others Data Description enum HookFlags Flags which defines additional information about the event HF_ExtendedKey the extended key is sent HF_None 0 HF_InjectedKey the key event is sent by application HF_ExtendedKey 1 HF_InjectedKey 2 HF_AltKeyPressed 4 HF_KeyPress 8 HF_SentFromLibrary 0x10 E not by the keyboard HF_AltKeyPressed the Alt key is pressed HF_KeyPress the key is pressed down HF_SentFromLibrary the key is sent from the library enum HookMessage HM_None 0 HM_KEYDOWN 1 HM_KEYUP HM_SYSKEYDOWN HM_SYSKEYUP Defines message type key event down key event up system key event up or system key event up enum SendKeyFlags SKF_KeyDown 1 SKF_KeyUP 2 SKF_KeyPress 3 SKF_KeyExtended 4 Used in the SendKeyByScanCode and SendKeyByVirtualCode functions These flags defines the
148. rface the system to the environment maintained by IMA and FHTW The Documentation folder contains the User and the Developer Manual and OSKA manual and the licence information for the developed and all utilized source code and libraries The NativeASAPI folder contains C libraries for mobile phone and GSM modem access 3d mouse and tremor reduction from own C projects 2 2 Setting up the Eclipse IDE for ARE development The ARE framework is not bound to a specific tool flow or IDE For the convenience of the development process and ease of use for new developers an Eclipse based build is available and will be described in this section If you prefer a different IDE you can skip this section The described setup applies for Microsoft Windows operating systems If Java and the Eclipse IDE are already installed steps 1 4 can be omitted 1 Download and Install the Java Development Kit 7 JDK 7 JDK 8 is supported as well from http www oracle com technetwork java javase downloads index htm Java Platform Standard Edition Java SE 7u2 JDK JRE This release includes performance improvements bug fixes support for Solaris 11 E and Firefox 5 and up Learn more JDK 7 Docs JRE 7 Docs What Java Do Need You must have a copy of Installation the JRE Java Runtime Environment on your ee Instructions Installation Instructions system to run Java applications and applets To develop Java applicati
149. ribes the communication protocol between the AsTeRICS Runtime Environment and the Communication Interface Modules CIMs via the USB standard interface The CIM protocol is a bi directional communication standard between ARE and the external modules As described in chapter 5 1 the ARE provides services for connection and communication with external hardware modules if these modules support the CIM communication protocol in their firmware The CIM protocol defines a unique ID for the CIM type and commands for reading and writing so called features from to the CIM All USB CIMs will be identified and will communicate via USB CDC virtual serial ports If desired a CIM could be connected also via a real serial port and use the same protocol Usually no system driver development is needed to obtain a virtual COM port when a CIM is plugged into the computer s USB port An appropriate inf file is sufficient to create the COM port in the Windows operating system This inf file has to be specified only at the first connection Currently two different inf files are supplied with the AsTeRICS Runtime distribution e the Arduino inf for the Arduino UNO microcontroller which is used for general purpose digital I O and analog input via the Arduino processor plugin e the inf file for all IMA CIMs Analog In Digital In Out Acceleration CIM In the communication process the ARE acts as master and the CIM acts as slave The CIM wi
150. ring AbstractRuntimeComponentInstance c String portID this buffering true public void stopBuffering AbstractRuntimeComponentInstance c String portID this buffering false public boolean isBuffered return this buffering The designer can define that a plugin s input port should be synchronized with some other input ports via the ACS This will cause an argument change of the inputPort element on the deployment model file e g lt inputPort portTypelD inB sync true gt As soon as a model is deployed on the ARE the middleware collects per component every port noted as synchronized port When the model is successfully deployed and started the ARE will buffer data which enters synchronized input ports until data on all synchronized ports has arrived At that point the ARE will call a new AbstractRuntineComponentinstance callback method Developers that wish to support data synchronization need to implement the following method at their component instances public void synced ValuesReceived HashMap lt String byte gt dataRow Where dataRow is a HashMap between Input Port ID and byte For synchronized input ports instead of implementing the regular void receiveData byte data method which delivers incoming data of a single port developers need to implement the Page 52 AsTeRICS Developer Manual syncedValuesReceived method which will be called from the ARE with synchronized data from all
151. rror_code 0x0013 r Phone Manager 1 byte phone_id_len receive call event X bytes phone_id 0x0014 w Phone Manager get request phone state 4 bytes get phone state reply 4 bytes error_code 1 byte state_code 0x0020 w Message Manager request send SMS 1 byte phone_id_len X bytes phone_id 2 bytes message_len Y bytes message reply 4 bytes error_code 0x0021 r Message Manager 1 byte phone_id_len receive SMS event X bytes phone_id 2 bytes message_len Y bytes message Page 64 AsTeRICS Developer Manual 6 3 4 PT 1 ADC CIM Legacy ADC DAC CIM ID Feature Access Descritption Data address 0x0401 0x0000 r Unique serial number 4 bytes ADC version 0x0001 r GPIO Input State 1 byte 1 sensor Bit 0 Input 1 Bit 1 Input 2 actuator 0x0003 r w GPIO Input Pullup State 1 byte Bit 0 Input 1 Bit 1 Input 2 Value 0 off 1 on 33K resisor connected to 3 3 V 0x0004 r w GPIO Input Value Change 1 byte Event Bit 0 Input 1 Bit 2 Input 2 Value 0 off 1 on 0x0005 r w GPIO Periodic Input Value 2 bytes Event bytes 0 1 period time 0 off to 65535 milliseconds 0x0010 r w GPIO Output State 1 byte Bit 0 Output 1 Bit 1 Output 2 0x0020 w Store current CIM state to none EEPROM as default power on state 0x0040 r ADC Input Value 18 bytes bytes 0 1 ADC01 input value byte 6 7 ADC04 input value 0 24000 mV bytes 8 10 ADCO5 input valu
152. s definitions Function Description param typedef void __ stdcall NewSMSAvailable LPCWSTR phonelD LPCWSTR subject LPVOID This function is called when there is a new SMS available The PhonelD parameter is the sender phone ID The subject parameter is the SMS content The param parameter it is parameter defined by user LPVOID param typedef void __ stdcall ErrorCallback int result This function is called when en error is found The result parameter is the error code The param parameter it is parameter defined by user param typedef void __ stdcall ModemSearchResult LPCWSTR port _LPCWSTR modemName LPVOID This function is called when the modem is found The port parameter contains the modem port The modemName parameter contains the modem name The param parameter it is parameter defined by user Table 8 GSM Modem library call back functions Error codes returned by functions The error codes are declared in the Errors h file Code Description 1 Default error 2 Library is not initialized 3 Library is initialized 4 Library initialization error 5 Library is during initialization 10 COMM initialize false 11 No respond on the AT command 12 Cannot register to the GSM network 13 Modem initialize false 14 Write to the modem port error 15 Read from the mode port error 16 Not enough s
153. s need to import this class in order to get access to the following methods void displayPanel JPanel panel RuntimeComponentinstance componentinstance boolean display This method is used for displaying or hiding a plugin s panel at from the ARE desktop Developers need to pass o the panel they want to be displayed or removed o the plugin object in order to help the middleware finding the desired position and dimensions from the deployment model o aboolean argument specifying if they wish to hide or show the given panel Dimension getAvailableSpace IRuntimeComponentinstance componentinstance The space that each plugin will occupy on the ARE desktop is defined by the designer on the ACS and passed to the ARE via ASAPI Plugin developers can get the available space for their graphical elements by calling the getAvailableSpace method which will return the space occupied for the plugin object passed as argument Point getComponentPosition IRuntinmeComponentinstance componentinstance The positioning of plugin s GUI elements is defined by the designer on the ACS and passed to the ARE via ASAPI Plugin developers can get the position of their graphical elements by calling the getComponentPosition which will return the position on screen for the plugin object passed as argument void adjustFonts JPanel panel int maxFontSize int minFontSize int offset This service can be used by plugin developers interested in auto adjusting
154. se a new AsTeRICS plugin which has been built using the Eclipse build flow and exists as executable jar file OSGI bundle two steps are necessary 1 The name of the jar file of the bundle has to be added to the loader ini file of the AsTeRICS Runtime Environment ARE This file is located in the profile subfolder of the ARE and specifies bundles components that are loaded by the ARE at startup All plugins which are used in ARE models or to be precise the bundles which contain those plugins have to be loaded in the ARE framework to be available for deployment To add the new plugin simply open the loader ini file with a text editor and add the name of the jar file Then restart the ARE so that the new bundle is loaded and activated Page 28 AsTeRICS Developer Manual 2 The Plugin has to be announced to the ACS so that it gets visible in the graphical editor and can be used for the creation of deployment models This is done by adding the bundle descriptor of the new plugin to a component collection file extension abd in the ACS folder These component collections contain all bundle descriptors of components which can be used in the ACS The new plugin section can be added either manually or can be downloaded from the running ARE via the ACS Component Collection Manager recommended see 3 2 1 Using the Component Collection Manger the downloaded collection can be stored as default Component Collec
155. sion 2 3 x o videolInput latest available o Boost Library recommended version gt 1 47 o Facetracker based on the source code by Jason Siragih OpenCv and Boost library sources are easily available respective on the official maintainer s sites This is not completely true instead for what concerns videolnput and FaceTracker for which specific instruction will be given separately As a brief disclaimer it is important to take into consideration that this guide is for developers that have a proper knowledge of the basics of application building on a Windows system The base tools on which we base this section are Visual Express 2010 and Eclipse Let s get started then 13 1 OpenCV The best way to achieve our goal is to download the original packages available from the WillowGarage webpage and read thoroughly the install guide therefore in this section we will give only a brief overview of the building process For the impatient at the time of the writing of this section OpenCV distributes an installer that extracts in a folder both the sources and the prebuilt binaries Once the installer completes copying the files what we need to do is to move headers and libraries into a location where the preconfigured Visual Express projects expect to find them http web mac com jsaragih FaceTracker FaceTracker html 3 http opencv willowgarage com wiki http opencv willowgarage com wiki InstallGuide Page 111 AsTeRICS
156. sion 3 0 http www gnu org licenses lgp1 htm1 HSK SRS APPAR AS eS KH AHS SAS SE mansa After the Eclipse IDE has been opened Eclipse must be pushed to refresh the folder structure by pushing F5 Furthermore the path src main java must be configured as source folder gt iy processor ssvendetect a P ia param data a double value gt processor st New gt b processor st Go gi gt rd processor st Into eae void sendData double c gt iy processor st pream ican TODO change this to an gt processor st Show In Alt Shift W gt super sendData Conversior gt iy processor st gt Ge processor st Copy Ctrl C gt y processor te H Copy Qualified Name gt y processor th Paste Ctrl V gt Pe processor w 9 Delete Dees ia ee gt processor y Parses a packet in P2 Format gt y proxy remot Remove from Context Ctrl Alt Shift Down mes as gt y Sensor acce Build Path GB Use as Source Folder gt y sensor anale gt y sensor autos Refactor SS Configure Build Path gt Sy sensor butte g Import Tat x 25 gt y sensor cellb for int k 0 k lt 63 k ee ey Export gt Si sensor igit value k int arra gt Gy sensor editbh Refresh F5 gt Sensor enob Assign Working Sets value k int gt Gy sensor eog x gt sensor even Validate x gt Gy sensor eyetr Profile As gt gt Sy sensor facet Debu
157. t lt set global properties for this build gt lt property name build location out production component id gt lt property name src java location src main java gt lt property name dist location gt lt property name runtime location examples ARE gt lt property name osgi locations osgi gt lt property name midd eware location middleware gt lt property name services location ds _ services gt lt property names classpath Jocation gt i lt path ids asterics classpath gt lt pathelement Jocations bin gt lt pathelement Jocation osgi org eclipse osgi_3 6 0 v20100517 jar gt i lt pathelement location middleware asterics ARE jar gt lt path gt lt property name resources location src main resources gt lt target name init gt lt Create the time stamp gt lt tstamp gt lt Create the build directory structure used by compile gt lt mkdir dir build gt lt target gt H lt target name compile depends init description compile the source gt lt javac srcdirs src java destdir build verbose true E i classpath classpath gt lt classpath refid asterics classpath gt F lt javac gt lt target gt H lt target name jar depends compile description generate the OSGi bundle gt lt jar jarfi e dist asterics compone
158. tate it can be reflected in the ACS The boolean ful List argument specifies whether the error list to be returned will include all statusObjects generated since the ARE startup or just those that have not been requested by the ACS before 5 8 The ARE Thread Pool In order to avoid resource greedy threads and to achieve best thread handling ARE uses one of the Thread Pool implementations provided by Java since JRE 1 5 In particular we have utilized the java util concurrent Executors library for creating a CachedThreadPool A cached thread pool will create threads as needed but will reuse previously instantiated threads when they are available and inactive A cached thread pool is particularly useful for many short lived asynchronous tasks and improves the performance of the runtime environment Page 48 AsTeRICS Developer Manual Developers are expected to use the ARE thread pool for executing their tasks that require a new Thread You will need to import the middleware services package in order to get access to the AstericsThreadPool class 5 9 The ARE GUI support The ARE provides a panel area ARE Desktop where plugins can display their graphical elements using the ARE GUI support classes The ACS provides a dedicated canvas editor that allows end users positioning and resizing graphical elements of the plugins Based on this information the ARE displays plugins on the local device maintaining the correct screen p
159. tation Alternatively the commandline batch script start_debug bat which is provided in the folder bin ARE runs Java with additional configuration parameters including e the location of the OSGi distribution e the profile subfolder which contains the config ini file bin ARE profile e debugging instrumentation for the remote debugging server connection Page 18 AsTeRICS Developer Manual After starting the ARE middleware bundles are loaded and started as specified in loader ini If everything is properly configured the ARE window comes up with a GUI and provides ASAPI server functionalities for connection of the ACS or other client applications 2 5 5 Activation of ARE webservice REST websocket demo The ARE contains a service that creates several web based services These include e awebserver with document root relative to ARE start folder data webservice and URL http localhost 8082 e awebsocket at URL http localhost 8082 ws astericsData e aREST ASAPI interface at URL http localhost 8081 rest e To retrieve the currently deployed model call http localhost 808 1 rest runtime model The webservices are turned off by default and can be activated by a command line switch of the ARE when using the start_debug bat start script AsTeRICS bin ARE gt start_debug bat webservic When deploying and starting the demo model WebSocket_test acs you can see the websocket fun
160. ter back and clears it t TAB function the step is 4 columns clears the text from the Page 67 AsTeRICS Developer Manual current position to the new one so 1 4 characters depending on the position f clears the whole text window and sets the position to the top left corner of the window 0x0075 draw bitmap 9 to 2048 bytes bytes 0 1 top left X bytes 2 3 top left Y bytes 4 5 width bytes 6 7 height bytes 8 2047 bitmap stream standard Windows 2 color BMP order only part which fits the display is drawn first byte bit O is 0 0 bit 7 is 7 0 if the bitmap width is e g 10 pixels stream has 2 bytes per row and bits 2 to 7 of the second byte are ignored 0x0076 r w status LCDisplay backlight 1 byte backlight 0 100 0x0080 read front panel buttons state 1 byte bit O left bit 1 right bit 2 down bit 3 up bit 4 OK 1 pressed 0 not pressed 0x0081 r w front panel buttons change event mask 1 byte bit O left bit 1 right bit 2 down bit 3 up bit 4 OK 1 enabled 0 disabled 6 3 7 EOG CIM CIM ID Feature address Access Descritption Data 0xa101 EOG version 1 sensor actuator 0x0000 Unique serial number 4 bytes 0x0001 Activate Periodic Value Reports 2 bytes bytes 0 1 period time 0 off to 65535 millise
161. ter first validates the model using the model service and then performs a set of commands which aim at realizing the modeled application These commands include the instantiation of Component instances via the component repository and the physical connection of the corresponding ports Page 82 AsTeRICS Developer Manual 8 ARE threading concept for model execution The ARE uses a single threaded approach similar to the one of the Swing Event Dispatch Thread EDT in Java for all tasks related to model deployment and execution This means that the following tasks are all executed within exactly one and the same thread instance e Model lifecycle o Model deployment o Model start pause stop o Model setting property e Model execution o Data propagation Sending data from an output sendData port to input ports receiveData o Event notification Forwarding events from an event triggerer raiseEvent to event listeners receiveEvent Figure 8 illustrates a typical model and involved threads The model is first deployed and started within the ModelExecutor thread Thread Legend ModelExecutor __ FrameGrabber __ Event Dispatch Thread EDT _ Timer _ ASAPIServer _ RESTServer AstericsModelExecutionThreadPool A execute B execAndWaitOnModelExecutorLifecycleThread Figure 8 Illustration of threading concept for model lifecycle tasks and model execution Page 83 AsTeRICS Developer Manual
162. tion for the ACS so that all components will be available when the ACS is started next time Subsequently the plugin can be selected in the components menu of the ACS and the ARE will activate the plugin at startup 3 2 1 Component Collection Management in the ACS The ACS provides a function for downloading the bundle descriptions of all active plugins directly from a running ARE and creating a component collection file from this information System tab Button Download Component Collection weet G 4 8 B amp B amp Disconnect Upload Download Download Store Load Model Activate a Delete a Set as from ARE Model Model Component Collection Model on ARE from Storage Stored Model Stored Model Autorun The component collection will be stored as abd file in the ACS folder subfolder componentcollections The new component collection can be used right after download but will not be available after an ACS restart Within the ACS Component Collection Manager in the Miscellaneous tab component collections can be selected or set as default collection for the ACS startup For details see the User Manual ACS section Please note that the loader ini file has to be updated manually in the ARE s profile subfolder by addition of the new jar filename After restart of the ARE and connection to the ACS the component collection can be downloaded Page 29 AsTeRICS Developer Manua
163. tion Mechanism and Packet Format c eeeeeeeeeeeeeeeeeeneeeeeeeeeeteee 60 6 2 iROGUESI Pepy Goderie n ee recently ee eerie Se Ea 61 AsTeRICS Developer Manual 6 2 1 Request Reply Code in LSB aicccccieiuspetehetiies Weds Ree eee 61 6 2 2 Mode Status code in MS Bex ca iedect ce teceautrteuieleabenieleedsssabenmsereieleweleete eet 62 6 3 Feature Lists and CIM IDs of all ASTeRICS CIMS eee ceeeeeeeee eee eeeeenteeeeeeeeeeteeee 62 6 3 1 AD a 6s Pearertne er eee Dae etn e a a hele PRE Ach pee a 62 632 PT 1 GPIO CIM Legacy GPIO conus Ane eae 63 6 3 3 Phone CIM Windows Phone OS sssssssssensessssessrerrnrresserrrrrrnrrrsserrrerrnneesent 64 6 3 4 PT 1 ADC CIM Legacy ADC DAOQ snsseesssnrneeerresererntsertrnrsrrernrsrrneserre 65 6 3 5 BMA180 Accelerometer Sensor cccceeeeeeseeecceeeeeeeeeeeesesaeeeeeeeeeeteneesaaaaes 66 ORC Chem cal a 2 al aneaeeg eae eae re PEP any error years Pia etree eter ere Pay Ay 67 6 3 7 OG CIN ria sacs e a a E E at r aa Ea aet aE aE EST 68 6 3 8 Sensorboard CUM errean e EA EEE AE E E E E 69 6 3 9 Arduino CIM tet achis ee eae toot tc leit eaea eal Oot te ei stot 70 6 310 PT 2s Ore QIM nene a e ra E ede al a etek 71 6 3 11 PT2 GPI CIM Digital cz ceseccti act aeceeice eae tees gabieeda wae eeareaeteeavaei aaeiieess 73 6 3 12 PT2 GPO CIM DigitalOut cismcescrenersc estes iia robert ieee eens 73 6 3 13 PT2 ADG CIM An lo g
164. trolled linking between modules The module layer is fully integrated with the security architecture enabling the option to deploy closed systems walled gardens or completely user managed systems at the discretion of the manufacturer The L2 Life Cycle layer adds bundles that can be dynamically installed started stopped updated and uninstalled Bundles rely on the module layer for class loading but add an API to manage the modules in run time The lifecycle layer introduces dynamics that are normally Page 106 AsTeRICS Developer Manual not part of an application Extensive dependency mechanisms are used to assure the correct operation of the environment The L3 layer adds a Service Registry The service registry provides a cooperation model for bundles that takes the dynamics into account Bundles can cooperate via traditional class sharing However class sharing is not very compatible with dynamically installing and uninstalling code The service registry provides a comprehensive model to share objects between bundles A number of events are defined to handle the coming and going of services Services are just Java objects that can represent anything Many services are server like objects like an HTTP server while other services represent an object in the real world for example a Bluetooth phone that is nearby The service model is fully security instrumented The service security model provides an elegant way to secure the commun
165. ts Please note that the type_id argument of the component element in deployment descriptor must match the id argument of the componentType element on the bundle descriptor This is how the ARE detects the referred plugin type in the deployment model The following demo deployment descriptor describes a simple model containing two plugins and one channel lt xml version 1 0 encoding UTF 8 gt lt model xmlns xsi http www w3 org 2001 XMLSchema instance xSi noNamespaceSchemaLocation deployment model xsd gt lt components gt lt component type id sensor SignalSource id sensor SignalSource 1 gt lt description gt A Source of two signal cahnnels lt description gt lt poGes gt lt outputPort portTypeID outportl gt lt outputPort portTypeID outport2 gt lt ports gt lt properties gt lt properties gt lt component gt lt component type id actuator SignalTarget id actuator SignalTarget 1 gt lt description gt A Signal Target lt description gt lt ports gt lt inputPort portTypeID in_ x gt lt inputPort portTypeID in_ y gt lt ports gt lt component gt lt components gt lt channels gt lt channel id channel 1 gt lt description gt Connects SignalSource 1 outport 1 to SignalTarget 1 in_x lt description gt lt source gt lt component id sensor SignalSource 1 gt lt port id outportl gt lt source gt Leare t lt component id ac
166. tuator SignalTarget 1 gt lt port id in_ x gt lt target gt lt channel gt lt channels gt lt model gt Page 33 AsTeRICS Developer Manual 4 2 3 The Manifest file The Manifest file tells the bundle name and other informations like import packages and dlls to the OSGi A typical Manifest looks as follows Manifest Version 1 0 Bundle ManifestVersion 2 Bundle Name asterics processors averager Bundle SymbolicName eu asterics component processor averager Bundle Version 0 1 0 DynamicImport Package Please note the empty line at the end of the Manifest file It seems that OSGi needs that empty line in order to work properly An example of a Manifest file of a component containing native code dlls can be found in section 5 13 4 2 4 Structure of OSGi bundles containing ARE components As a common OSGi bundle an AsTeRICS component must be packaged in a JAR file containing the class files object code and the Manifest file In addition to these the AsTeRICS middleware expects the bundle descriptor At this point it should be noted that it is possible to include multiple AsTeRICS components in a single OSGi bundle as long as the bundle descriptor describes all of them Overall the file structure in a typical ASTeRICS bundle looks as follows A eu asterics component apts Jae chk ar lLaltoy native F my Ialioieerieyy soll IL META INF MANIFEST MF
167. ty z native public String getProperty String key Sets the named property to the defined valu param key the name of the property to be accessed param value the value to be assigned to the named property return the value previously assigned to the named property Z native public String setProperty String key final String value This method is called back from the native code on demand to signify an internal error The first argument corresponds to an error code and the second argument corresponds to a textual description of the error param errorCode an error code param message a textual description of the error private void errorReport callback final int errorCode final String message t t Ee logger severe errorCode message This method is called back from the native code to send data to the component s output port param datal range is 0 Short MAX VALUE E private void newData callback final int datal my outport sendData datal Page 55 AsTeRICS Developer Manual 5 13 3 C Implementation Callbacks and JNI code The native C code needs to be compiled into a dll and include the JNI header files and libraries An example for the Microsoft Visual Studio compiler looks as follows The following C example shows how to implement a JNI callback from a C thread and an ARE compliant exchange of a compo
168. uartz lib Y strmbasd lib U strmbase lib t strmiids lib Y uuid lib E videolnput ncb videolnput sin gt videolnput suo _ videolnput suo old fez videoInput vcproj gt videolnput vcproj gameoverW7 gameov Figure 19 videolnput solution When VC10 has finished conversion of the project it will open as a Debug target but for efficiency we will switch from Debug to Release In order all actions that have to be taken 1 Change reference SDK switch Platform Toolset from v100 to Windows7 1SDK see Figure 20 https github com gameoverhack videolnput https github com gameoverhack videoInput zipball master http www microsoft com download en details aspx id 8442 Page 114 AsTeRICS Developer Manual gt Common Properties 4 General 4 Configuration Properties Output Directory General Intermediate Directory Debugging Target Name VC Directories Target Extension gt ere Extensions to Delete on Clean gt Librarian Build Log File b XML Document Generator a laka REA Eees Enable Managed Incremental Build gt Build Events b Custom Build Step Project Defaults Configuration Type Use of MFC Character Set SolutionDir Configuration Configuration ProjectName Jib cdf cache obj ilk resources tlb tli tlh tmp rsp IntDir MSBuildProjectName log Windows7 1SDK Common Language Runtime Support Us
169. ution Explorer p meewe videolnput cpp gt ereoss alal El Global Scope lod Solution videolnput 1 project THE SOFTWARE IS PROVIDED AS IS WITHOUT 4 be videoInput IMPLIED INCLUDING BUT NOT LIMITED TO THE GM External Dependencies FITNESS FOR A PARTICULAR PURPOSE AND NONII Haila flex AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOI GG Resource Files LIABILITY WHETHER IN AN ACTION OF CONTRAI 3 OUT OF OR IN CONNECTION WITH THE SOFTWARE a Source Files THE SOFTWARE videolnput cpp define DEBUG 1 define _DEBUG 1 include videoInput h include tchar h Include Directshow stuff here so we don t include DShow h include streams h include mygedit h include vector include Aviriff h include Windows h Figure 23 Remove troubling defines when targeting Release targets 5 Uncomment VI_COM_MULTI_THREADED define statement in video nput h if you need VI to use multi threaded com Rdefine VI_COM_MULTI_THREADED STUFF YOU DON T CHANGE videoInput defines define VI_VERSION 1995 define VI_MAX_CAMERAS 20 define VI_NUM_TYPES 19 DON T TOUCH I m not touching you define VI_NUM_FORMATS 18 DON T TOUCH Figure 24 Enable COM multithreading 6 Build Just wait 7 Post Build when the building process ends we ll find hopefully the compiled static library in the Release folder in the same folder as the solution Finally we are ready to
170. wn for demonstration purpose The ACS offers dynamic graphic configuration dialogs to the user which allows adjustment of all the plugin parameters Plugins can be graphically connected This process does not need any functional representation of the plugins only a description of the plugins ports data types and parameters All these setup actions are performed via ASAPI control commands The finalized model can be deployed to the ARE Page 88 AsTeRICS Developer Manual Monitoring verifying and adjusting a model PC ASAPI Control Interface configure plugins manage model ASAPI Data Interface get live data from plugins send data to plugins Embedded Platform Universal HID actuator plugin Tremor Reduction Plugin Pneumatic SVM Mini USB Gripper CAM Figure 12 AsTeRICS configuration scenario verification and error checking To verify the setup process a data connection to desired plugins can be opened in the Configuration Suite Thus live sensor values and their transformation due to the applied signal processing plugins can be monitored using feedback elements of the ACS like oscilloscope or bar graphs Parameters of the plugins can be modified using ASAPI control commands until the desired behaviour of the ARE is present Additionally to the live data transmission for feedback purpose status and error information can be queried from the ARE to deter
Download Pdf Manuals
Related Search
Related Contents
DOUGH ROLLER - Equipment Catalog Limited Warranty (North America only) service manual 4554 StarTech.com 4m Mini DisplayPort to DisplayPort Adapter Cable - M/M Copyright © All rights reserved.
Failed to retrieve file