Dynamix JS

Building context aware web applications

By - Shivam Verma
Felicitous Computing Institute, Department of Computer Science
National University of Singapore.

What is Dynamix JS

  • Existing browsers restrict web apps from accessing hardware resources on a phone such as the proximity or light sensors
  • Dynamix JS enables web applications to interact with these hardware components
  • Adapt any web-app's behaviour based on the user's context (There's more to context than location)
  • Uses the sensing and communication capabilities provided by the Ambient Dynamix Framework

So, What is Ambient Dynamix ?

  • A light-weight software framework that runs on the Android platform. (Sorry, iOS users)
  • Leverages the Android device's communication capabilities
  • Enables mobile, web and python applications to interact with the physical world
  • Serves as a gateway between incompatible smart devices

Ambient Dynamix's Features

  • Runs as a background service on the user's unmodified mobile device
  • Dynamically install context plug-ins without the need of restarting/updating framework
  • Parallel plug-in installation, plugin updates, external repositories
  • Sends context information to clients using POJOs or string-encoded formats
  • Plug-in security sandbox

How to use Dynamix JS

Step 1: Bind with Dynamix

							
bindDynamix : function() {
	var that = this;
	var bindListener = function (status) {
		switch (status) {
			case Dynamix.Enums.BOUND :
				that.openDynamixSession();
				break;
			case Dynamix.Enums.BIND_ERROR :
				break;
			case Dynamix.Enums.UNBOUND :
				break;
			}
		};
	Dynamix.bind(bindListener);
}
							
						

Cases

  • Binding with a local Dynamix instance
  • Binding with a remote Dynamix instance

How to use Dynamix JS

Step 2: Open a session

							
openDynamixSession : function() {
    var that = this;

    var openSessionCallback = function (status) {
        switch (status) {
            case Dynamix.Enums.SUCCESS :
                that.createContextHandler();
                break;
        }
    };     
    
    var sessionListener = function (status, result) {
        switch (status) {
            case Dynamix.Enums.SESSION_OPENED :
                break;
            case Dynamix.Enums.SESSION_CLOSED :
                break;
            case Dynamix.Enums.PLUGIN_UNINSTALLED :
                break;
            case Dynamix.Enums.PLUGIN_INSTALLED :
                break;
            case Dynamix.Enums.PLUGIN_ENABLED :
                break;
            case Dynamix.Enums.PLUGIN_DISABLED :
                break;
            case Dynamix.Enums.PLUGIN_ERROR :
                break;
        }
    };   

    Dynamix.openDynamixSession({
    	listener: sessionListener, 
    	callback: openSessionCallback
    });
}
							
						

How to use Dynamix JS

Step 3: Create a context handler

							
createContextHandler : function () {
    var that = this;
    var createNewHandlerCallback = function (status, handler) {
        switch (status) {
            case Dynamix.Enums.SUCCESS :
            	that.contextHandler = contextHandler;
                that.addActivityRecognitionContextSupport();
                break;
        }
    };
    Dynamix.createContextHandler(createNewHandlerCallback);
}
							
						

How to use Dynamix JS

Step 4: Add context support

							
addActivityRecognitionSupport : function () {
	var activitySupportCallback = function(status){
		// doSomething();
	};

    this.contextHandler.addContextSupport('org.ambientdynamix.contextplugins.activityrecognition', 
        'org.ambientdynamix.contextplugins.activityrecognition.activityinfo', {
        	callback : activitySupportCallback, 
        	listener : activityListener
    	});
}
							
						

Or use Configured Context Support

Context Firewall Popup

How to use Dynamix JS

Step 5: Context Requests

							
voiceResultsRequest : function () {
	var voiceResultsCallback = function(status, result){
		// doSomething();
	};

    this.contextHandler.contextRequest('org.ambientdynamix.contextplugins.speechtotext', 
        'org.ambientdynamix.contextplugins.voiceresults', {
        	callback : voiceResultsCallback
    	});
}
							
						

Or use Configured Context Requests

Plugins

  • AR Drone
  • Sphero Robotic Ball
  • WeMo WiFi Switch
  • Ambient Media
  • Light Sensor
  • Myo Armband
  • NFC
  • Barcode Scanner
  • Activity Recognition
  • Proximity
  • Gesture Recognition

Ambient Dynamix Architecture

Thank You !

github/vshivam

twitter/vshivam