diff --git a/lib/js/lc.js b/lib/js/lc.js index ceff9ca5e708e947c1e3d6545c35f8e4ea8b24d2..4b87362c90357668d8e1201465645110d1682dd8 100644 --- a/lib/js/lc.js +++ b/lib/js/lc.js @@ -118,7 +118,7 @@ LabComm.Buffer.prototype.getString = function() { * @return {Boolean} A boolean */ LabComm.Buffer.prototype.getBoolean = function() { - return new Boolean(this.data_.getUint8(this.offset_++)); + return Boolean(this.data_.getUint8(this.offset_++)); }; /** @@ -258,10 +258,10 @@ LabComm.Decoder.prototype.decodeSignature_ = function(name, json, fb) { switch(type) { case LabComm.Constants.ARRAY: var dim = this.data.getVarint(); + console.log("array"); if(dim === 0) { throw "Array cant have 0 dimensions"; } - console.log("array"); //TODO: implement throw "Array decoding not implemented"; break; @@ -298,7 +298,7 @@ LabComm.Decoder.prototype.decodeSignature_ = function(name, json, fb) { case LabComm.Constants.STRING: return this.buildDecoder_(name, json, fb, "string", "data.getString()"); } - throw "Unknown type found in signature: 0x" + tag.toString(16); + throw "Unknown type found in signature: 0x" + type.toString(16); }; /** @@ -312,6 +312,8 @@ LabComm.Decoder.prototype.decodePackage = function(buffer) { var tag = this.data.getVarint(); var len = this.data.getVarint(); + console.log('0x' + tag.toString(16) + ':' + len); + switch(tag) { case LabComm.Constants.VERSION: var version = this.data.getString();