this.iSuccessCB = sCB;
this.iErrorCB = eCB;
- this.transactionid = 0;
/* variables for call management, supports up to 100 simultaneously */
this.methodIdx = 0;
init();
}
+Vehicle.prototype.generateTransactionId = function()
+{
+ var i, val = [];
+ for(i = 0; i < 8; i++)
+ {
+ var num = Math.floor((Math.random()+1)*65536);
+ val[i] = num.toString(16).substring(1);
+ }
+ var uuid = val[0]+val[1]+"-"+
+ val[2]+"-"+val[3]+"-"+val[4]+"-"+
+ val[5]+val[6]+val[7];
+ return uuid;
+}
+
Vehicle.prototype.send = function(obj, successCB, errorCB)
{
- obj.transactionid = this.transactionid++;
if(!this.connected)
{
if(errorCB != undefined)
"type" : "method",
"name" : "getSupportedEventTypes",
"writeable" : writeable,
- "transactionid" : 0,
+ "transactionid" : this.generateTransactionId(),
"data" : type
};
this.send(obj, successCB, errorCB);
var obj = {
"type" : "method",
"name": "get",
- "transactionid" : 0,
+ "transactionid" : this.generateTransactionId(),
"data" : type
};
this.send(obj, successCB, errorCB);
var obj = {
"type" : "method",
"name": "set",
- "transactionid" : 0,
+ "transactionid" : this.generateTransactionId(),
"data" : {"property" : type, "value" : value}
};
this.send(obj, successCB, errorCB);