X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=api.js;h=32f663360d570dce1bce77c4fd1288e44c8cf75d;hb=refs%2Fheads%2Ftizen_ivi_genivi;hp=28ed951397b55c3400d6418076503452cb7c39c6;hpb=455c3732f7fb1b5a8b6f757bdbe0e47e81a72963;p=profile%2Fivi%2FGhostCluster.git diff --git a/api.js b/api.js index 28ed951..32f6633 100644 --- a/api.js +++ b/api.js @@ -107,8 +107,8 @@ function Vehicle(sCB, eCB, url, protocol) this.socketProtocol = "http-only"; /* override the websocket address if parameters are given */ - if(url != undefined) this.socketUrl = url; - if(protocol != undefined) this.socketProtocol = protocol; + if(url !== undefined) this.socketUrl = url; + if(protocol !== undefined) this.socketProtocol = protocol; this.VehicleMethodCall = function(id, name, successCB, errorCB) { @@ -121,7 +121,7 @@ function Vehicle(sCB, eCB, url, protocol) this.start = function() { me.timeout = setTimeout(function(){ - if(me.errorCB != undefined) + if(me.errorCB !== undefined) { me.errorCB("\""+me.name+"\" method timed out after "+self.timeouttime+"ms"); } @@ -130,7 +130,7 @@ function Vehicle(sCB, eCB, url, protocol) } this.finish = function() { - if(me.timeout != undefined) + if(me.timeout !== undefined) { clearTimeout(me.timeout); } @@ -202,7 +202,7 @@ Vehicle.prototype.send = function(obj, successCB, errorCB) { if(!this.connected) { - if(errorCB != undefined) + if(errorCB !== undefined) { errorCB("\""+obj.name+"\" method failed because socket is closed"); } @@ -245,6 +245,30 @@ Vehicle.prototype.get = function(namelist, successCB, errorCB) this.send(obj, successCB, errorCB); } +Vehicle.prototype.getHistory = function(namelist, beginDate, endDate, successCB, errorCB) +{ + if(namelist.length <= 0) + { + return; + } + + var dataobj = { + "property" : namelist, + "timeBegin" : (beginDate.getTime() / 1000).toString(), + "timeEnd" : (endDate.getTime() / 1000).toString(), + "sequenceBegin" : "-1", + "sequenceEnd" : "-1" + } + + var obj = { + "type" : "method", + "name": "getRanged", + "transactionid" : this.generateTransactionId(), + "data" : dataobj + }; + this.send(obj, successCB, errorCB); +} + Vehicle.prototype.set = function(namelist, valuelist, successCB, errorCB) { if((namelist.length != valuelist.length)||(namelist.length <= 0)) @@ -312,8 +336,8 @@ Vehicle.prototype.receive = function(msg) return; } - if((event == undefined)||(event.type == undefined)|| - (event.name == undefined)) + if((event === undefined)||(event.type === undefined)|| + (event.name === undefined)) { self.iErrorCB("BADLY FORMED MESSAGE: "+msg); return;