//Decoder request.
var kInitDecoderReq = 0;
var kOpenDecoderReq = 1;
var kCloseDecoderReq = 2;


//Decoder response.
var kInitDecoderRsp = 0;
var kCloseDecoderRsp = 2;

var kVideoFrame = 5;
var kAudioFrame = 6;
var kRequestDataEvt = 7;

//downloader  request
var kGetwasmReq = 0;
var kGetwasmReqenvent = 1;
var kcreateDevReq = 2;
var kcrdevliveReq = 3;
var kcrdevrecordReq = 5;
var kcrdevsnapshotReq = 6;
var kdevCloseReq = 7;
var kdevSetcloseReq = 10;
// var kdevcloseliveReq = 11;
var kdevreconstructionReq=14;
var kdevreconsglobalCtrlReq=15;


//downloader  response
var kGetwasmRsp = 0;
var kGetwasmRspenvent = 1;
var kcreateDevRsp = 2;
var kcrdevliveRsp = 3;
var kcrdevrecordRsp = 5;
var kcrdevsnapshotRsp = 6;
var kdevCloseRsp = 7;
var kdevSetcloseRsp = 10;
// var kdevcloseliveRsp = 11;
var kserverPushRsp = 13;
var kdevreconstructionRsp=14;
var kdevreconsglobalCtrlRsp=15;


function Logger(module) {
    this.module = module;
}

Logger.prototype.log = function(line) {
    console.log("[" + this.currentTimeStr() + "][" + this.module + "]" + line);
};

Logger.prototype.logError = function(line) {
    console.log("[" + this.currentTimeStr() + "][" + this.module + "][ER] " + line);
};

Logger.prototype.logInfo = function(line) {
    console.log("[" + this.currentTimeStr() + "][" + this.module + "][IF] " + line);
};

Logger.prototype.logDebug = function(line) {
    console.log("[" + this.currentTimeStr() + "][" + this.module + "][DT] " + line);
};

Logger.prototype.currentTimeStr = function() {
    var now = new Date(Date.now());
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var day = now.getDate();
    var hour = now.getHours();
    var min = now.getMinutes();
    var sec = now.getSeconds();
    var ms = now.getMilliseconds();
    return year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec + ":" + ms;
};
