Skip to content

Android Generic Gateway

Victor Sonora Pombo edited this page Mar 4, 2015 · 2 revisions

About

An UniDA Gateway implementation is offered for Android, that reads the gateway configuration from a given XML file and loads one or more UniDA Device Driver implementations in runtime.

Use

This Android app works only under Android 4 or higher.

Two different UniDA gateways are included with the distributed .apk:

  • an UniDA Generic Gateway that loads its configuration from a given XML document.
  • an UniDA DomoticMobileGateway that contains three devices that work with a typical Android mobile (Vibrator, IR sensor, GPS sensor).

The UniDA Generic Gateway loads its configuration from:

  • /UniDA_Gateway/UniDAGatewayConfig.xml

And loads the drivers implementations contained in:

  • /UniDA_Gateway/drivers/

When the drivers folder and the configuration file are not present, the UniDA DomoticMobileGateway is launched instead.

For the UniDA DomoticMobileGateway, the GPS coordinates of the point used as reference for the PresenseSensor UniDA driver can be introduced via this file:

  • /UniDA_Gateway/DomoticMobileGateway.txt

Example:

-9.2226387 43.4832217 5

Here is a complete example of UniDAGatewayConfig.xml:

<UniDAGateway>
    <GatewayClass>
        http://elite.polito.it/ontologies/dogont.owl#UNIDAGenericGateway
    </GatewayClass>
    <model>
        Gateway that contains a dummy device driver meant for testing only
    </model>  
    <manufacturer>
        GII
    </manufacturer>
    <devices>
        <UniDADevice>   
            <supportedStates>    
                <supportedState>
                    http://elite.polito.it/ontologies/dogont.owl#NumericValueState
                </supportedState>
            </supportedStates>
            <DeviceClass>
                http://elite.polito.it/ontologies/dogont.owl#RandomNumberGenerator
            </DeviceClass>        
            <OperationalState>
                0
            </OperationalState>        
            <isConfigured>
                true
            </isConfigured>        
            <model>
                Random Number Generator
            </model>        
            <manufacturer>
                GII
            </manufacturer>        
            <DeviceDriver>
                com.unida.gateways.dummy.RandomNumberGeneratorDeviceDriver
            </DeviceDriver>
        </UniDADevice>
    </devices>
</UniDAGateway>

The value for the DeviceDriver must be a class that implements the IUniDADeviceDriver interface and is included in one JAR package deployed in the drivers folder.

The values for DeviceClass and supportedState must be an URI for an OWL class contained in the DogOnt ontology as it is used (and briefly expanded for some IoT devices) in the UniDA Library.