By - Shivam Verma
Felicitous Computing Institute, Department of Computer Science
National University of Singapore.
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);
}
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
});
}
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);
}
addActivityRecognitionSupport : function () {
var activitySupportCallback = function(status){
// doSomething();
};
this.contextHandler.addContextSupport('org.ambientdynamix.contextplugins.activityrecognition',
'org.ambientdynamix.contextplugins.activityrecognition.activityinfo', {
callback : activitySupportCallback,
listener : activityListener
});
}
voiceResultsRequest : function () {
var voiceResultsCallback = function(status, result){
// doSomething();
};
this.contextHandler.contextRequest('org.ambientdynamix.contextplugins.speechtotext',
'org.ambientdynamix.contextplugins.voiceresults', {
callback : voiceResultsCallback
});
}