/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "../tmp/index.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "../src/build/dependency_mgr.js":
/*!**************************************!*\
  !*** ../src/build/dependency_mgr.js ***!
  \**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jSW = {};\r\nvar module_entry = __webpack_require__(/*! ./module-entry */ \"../src/build/module-entry.js\");\r\nvar ProModules = module_entry.ProModules;\r\nvar ProHttpDepends = module_entry.ProHttpDepends;\r\nvar ProOcxDepends = module_entry.ProOcxDepends;\r\nvar ModuleDepends = module_entry.ModuleDepends;\r\n\r\nvar DependencyMgr = new(function () {\r\n    var _that = this,\r\n        DependencyModuleName = \"DependCollection\",\r\n        AfterAsyncLoadHasResult = function (tag) {\r\n            var path = tag.getPath()\r\n            if (path == null) {\r\n                tag.emit();\r\n            } else {\r\n                AsyncLoadJsCss(path, AfterAsyncLoadHasResult, tag);\r\n            }\r\n        },\r\n        AsyncLoadJsCss = function (desUrl, callback, tag) {\r\n            var oEle = null,\r\n                parentEle = null;\r\n            if (desUrl.indexOf(\".js\") > 0) {\r\n                oEle = document.createElement(\"script\");\r\n                oEle.src = desUrl;\r\n                parentEle = DependencyMgr.GetJsEleContainer();\r\n            } else if (desUrl.indexOf(\".css\") > 0) {\r\n                oEle = document.createElement(\"link\");\r\n                oEle.type = \"text/css\";\r\n                oEle.rel = \"stylesheet\";\r\n                oEle.href = desUrl;\r\n                parentEle = document.head;\r\n            }\r\n            if (oEle) {\r\n                oEle.onload = function () {\r\n                    callback(tag);\r\n                    if (oEle.type != \"text/css\") {\r\n                        oEle.parentElement.removeChild(oEle);\r\n                    }\r\n                }\r\n                parentEle.appendChild(oEle);\r\n            }\r\n        },\r\n        LoadJsOrScript = function (depUrls, onLoadHasResult, userTag) {\r\n            var desDUrls = depUrls;\r\n            if (window.XMLHttpRequest) {\r\n                var tag = {\r\n                    szPaths: desDUrls,\r\n                    index: 0,\r\n                    lastIndex: 0,\r\n                    getPath: function () {\r\n                        if (this.index < this.szPaths.length) {\r\n                            this.lastIndex = this.index;\r\n                            this.index++;\r\n                            return this.szPaths[this.lastIndex];\r\n                        }\r\n                        return null;\r\n                    },\r\n                    onResult: onLoadHasResult,\r\n                    emit: function () {\r\n                        if (this.onResult) {\r\n                            this.onResult(this.tag);\r\n                        }\r\n                    },\r\n                    tag: userTag\r\n                };\r\n                AfterAsyncLoadHasResult(tag);\r\n                return true;\r\n            }\r\n            return false;\r\n        },\r\n        ModuleInfo = function (names, checkPromise) {\r\n            this.names = names;\r\n            this.promise = checkPromise;\r\n            this.szNames = null;\r\n        },\r\n        loadGetPaths = function (szDpds, szPromise) {\r\n            var proInfo = new ModuleInfo(szDpds, szPromise);\r\n            return proInfo.GetAbsPath();\r\n        },\r\n        loadDependsProxy = function (szDpds, szPromise, onLoadHasResult, tag) {\r\n            var szDesPath = loadGetPaths(szDpds, szPromise);\r\n            var bResult = LoadJsOrScript(szDesPath, onLoadHasResult, tag);\r\n            return bResult;\r\n        },\r\n        RegModule = function (moduleName, moduleEntity, bNotLog) {\r\n            if (GetDependModuleCollection()[moduleName] == null) {\r\n                SetModuleReged(moduleName, true);\r\n                if (!bNotLog) {\r\n                    ConsoleLogRegModel(moduleName);\r\n                }\r\n                GetDependModuleCollection()[moduleName] = moduleEntity;\r\n            } else {\r\n                console.error(\"load dependency error\");\r\n            }\r\n            return moduleEntity\r\n        },\r\n        ConsoleLogRegModel = function (moduleName) {\r\n            console.log(\"[D] RegModule \" + moduleName);\r\n        },\r\n        GetDependModuleCollection = function () {\r\n            if (typeof _that[DependencyModuleName] == \"undefined\") {\r\n                _that[DependencyModuleName] = {};\r\n            };\r\n            return _that[DependencyModuleName];\r\n        },\r\n        GetModuleInfo = function (moduleName) {\r\n            var moduleInfoName = moduleName + '_info';\r\n            if (typeof GetDependModuleCollection()[moduleInfoName] == 'undefined') {\r\n                GetDependModuleCollection()[moduleInfoName] = {};\r\n            }\r\n            return GetDependModuleCollection()[moduleInfoName];\r\n        },\r\n        SetModuleInfo = function (moduleName, key, value) {\r\n            GetModuleInfo(moduleName)[key] = value;\r\n        },\r\n        InjectModule = function (module, afterInjectHandler) {\r\n            return afterInjectHandler(module);\r\n        },\r\n        SyncGetModule = function (MN) {\r\n            var desModules = _that[DependencyModuleName][MN];\r\n            return desModules;\r\n        },\r\n        GetModuleEntiey = function (DMN, MN) {\r\n            if (typeof _that[DependencyModuleName] == \"undefined\") {\r\n                _that[DependencyModuleName] = {};\r\n            };\r\n            var desModules = _that[DependencyModuleName][MN];\r\n            return desModules;\r\n        },\r\n        CheckModuleReged = function (modeluName) {\r\n            return GetModuleInfo(modeluName)['bloaded'];\r\n        },\r\n        SetModuleReged = function (modeluName, bloaded) {\r\n            SetModuleInfo(modeluName, 'bloaded', bloaded);\r\n        },\r\n\r\n        GetRegedModule = function (modeluName, modulePath, afterInjectHandler) {\r\n            var desModules = GetModuleEntiey(DependencyModuleName, modeluName);\r\n            if (desModules && CheckModuleReged(modeluName)) {\r\n                return InjectModule(desModules, afterInjectHandler);\r\n            } else {\r\n                loadDependsProxy([modulePath], null, function () {\r\n                    var desModules = GetModuleEntiey(DependencyModuleName, modeluName);\r\n                    InjectModule(desModules, afterInjectHandler);\r\n                }, null);\r\n            }\r\n        };\r\n\r\n    //videojs 中依赖这个 \r\n    this.jswGetDependUrl = function (filename) {\r\n        filename = \"thlib/\" + filename;\r\n        var szPath = loadGetPaths([filename]);\r\n        return szPath[0];\r\n    }\r\n\r\n    function onLoadResultProxy(onLoadHasResult, tag) {\r\n        LoadModuleByModeleInfo(LoadModulesInfo, onLoadHasResult, tag);\r\n    }\r\n\r\n    this.GetJsEleContainer = function () {\r\n        return document.body;\r\n    }\r\n\r\n    this.LoadProDepends = function (onLoadHasResult, tag) {\r\n        var ProDepends = ProModules.paths;\r\n        var ProDependsPromise = ProModules.names;\r\n        return loadDependsProxy(ProDepends, ProDependsPromise, onLoadResultProxy(onLoadHasResult, tag), tag);\r\n    }\r\n\r\n    this.LoadHttpDepends = function (onLoadHasResult, tag) {\r\n        var HttpDepends = ProHttpDepends.paths;\r\n        return loadDependsProxy(HttpDepends, ProHttpDepends.promise, onLoadHasResult, tag);\r\n    }\r\n\r\n    this.LoadOcxDepends = function (onLoadHasResult, tag) {\r\n        var OcxDepends = ProOcxDepends.paths;\r\n        return loadDependsProxy(OcxDepends, null, onLoadHasResult, tag);\r\n    }\r\n\r\n    this.loadDependsProxy = loadDependsProxy;\r\n\r\n\r\n    var LoadModulesInfo = {\r\n        data: ModuleDepends.paths,\r\n        iLoadIndex: 0,\r\n        tag: null,\r\n        userData: null\r\n    };\r\n\r\n    function LoadModuleByModeleInfo(szLMInfo, afterCb, userData) {\r\n        if (LoadModulesInfo.iLoadIndex == 0) {\r\n            LoadModulesInfo.tag = afterCb;\r\n            LoadModulesInfo.userData = userData;\r\n        }\r\n        if (LoadModulesInfo.iLoadIndex < LoadModulesInfo.data.length) {\r\n            var moduleInfo = LoadModulesInfo.data[LoadModulesInfo.iLoadIndex++];\r\n            moduleInjectUtil(LoadModuleByModeleInfo, null, moduleInfo[0], moduleInfo.length > 1 ? moduleInfo[1] : null)\r\n        } else {\r\n            LoadModulesInfo.iLoadIndex = 0;\r\n            if (LoadModulesInfo.tag) {\r\n                LoadModulesInfo.tag(LoadModulesInfo.userData);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    this.cmdParseInJect = function (afterInjectHandler, scope) {\r\n        return moduleInjectUtil(afterInjectHandler, scope, \"CmdParse\");\r\n    }\r\n\r\n    this.HandleResponseInJect = function (afterInjectHandler, scope) {\r\n        return moduleInjectUtil(afterInjectHandler, scope, \"HandleResponse\");\r\n    }\r\n\r\n    this.GetEmotionSync = function () {\r\n        return SyncGetModule(\"ImEmotion\");\r\n    }\r\n\r\n    function moduleInjectUtil(afterInjectHandler, scope, moduleName, prePath, bLoaded) {\r\n        if (bLoaded) {\r\n            (scope ? afterInjectHandler.bind(scope) : afterInjectHandler)();\r\n            return result;\r\n        }\r\n        var modulePath = \"modules/\" + (prePath ? prePath : \"\") + moduleName + \".js\";\r\n        var result = GetRegedModule(moduleName, modulePath, scope ? afterInjectHandler.bind(scope) : afterInjectHandler);\r\n        return result;\r\n    }\r\n\r\n\r\n\r\n    var _jSWHostSaved = null;\r\n    this.jSWGetHost = function () {\r\n        if (_jSWHostSaved) {\r\n            return _jSWHostSaved;\r\n        }\r\n        var list = document.getElementsByTagName('script');\r\n        var jsScript = null;\r\n        for (var iIndex in list) {\r\n            if (list[iIndex].src.indexOf(\"jsw.js\") >= 0) {\r\n                jsScript = list[iIndex];\r\n                break;\r\n            }\r\n        }\r\n        if (!jsScript) {\r\n            console.error(\"you can not modify the name of jsw.js, please check\");\r\n            return \"\";\r\n        }\r\n        _jSWHostSaved = jsScript.src.split(\"jsw.js\")[0];\r\n        return _jSWHostSaved;\r\n    };\r\n\r\n    ModuleInfo.prototype = {\r\n        dependencyRelativePath: \"jswlib/\",\r\n        proJswPath: null,\r\n        setProJswPath: function (path) {\r\n            this.proJswPath = path;\r\n        },\r\n        GetAbsPath: function () {\r\n            if (this.szNames == null) {\r\n                this.szNames = [];\r\n                var tempPath = \"\";\r\n                for (var iIndex = 0; iIndex < this.names.length; iIndex++) {\r\n                    if (!this.checkAllPromise(iIndex)) {\r\n                        tempPath = this.proJswPath + this.dependencyRelativePath + this.names[iIndex];\r\n                        this.szNames.push(tempPath);\r\n                    }\r\n                }\r\n            }\r\n            return this.szNames;\r\n        },\r\n        checkAllPromise: function (iIndex) {\r\n            var proExp = \"((typeof (pl) != 'undefined'))\";\r\n            if (!this.promise) {\r\n                return false;\r\n            }\r\n            if (this.promise instanceof Array) {\r\n                proExp = proExp.replace(\"pl\", this.promise[iIndex]);\r\n            } else {\r\n                proExp = proExp.replace(\"pl\", this.promise);\r\n            }\r\n            return eval(proExp);\r\n        }\r\n    }\r\n\r\n    ModuleInfo.prototype.setProJswPath(this.jSWGetHost());\r\n\r\n    //外部依赖\r\n    this.RegModule = RegModule;\r\n    this.CreateModule = function (name) {\r\n        var tmodule = {};\r\n        this.RegModule(name, tmodule, true);\r\n        return tmodule;\r\n    }\r\n\r\n    /**\r\n     * 声明模块，使得可以提前获取到模块，而不等待模块被加载\r\n     * 模块必须使用GetModule获取\r\n     */\r\n    this.ClaimModule = function (name) {\r\n        var tModel = this.GetModule(name);\r\n        if (null == tModel) {\r\n            tModel = this.CreateModule(name);\r\n            SetModuleReged(name, false);\r\n            console.log('[D] Claim Module: ' + name);\r\n        }\r\n        return tModel;\r\n    }\r\n\r\n    this.RegClaimedModuleProxy = function (name, handleProxy) {\r\n        var tModule = this.GetModule(name);\r\n        if (tModule == null) {\r\n            tModule = this.ClaimModule(name);\r\n            //console.error('Module: ' + name);\r\n        }\r\n        if (!CheckModuleReged(name) && handleProxy) {\r\n            handleProxy(tModule);\r\n            SetModuleReged(name, true);\r\n        }\r\n        ConsoleLogRegModel(name);\r\n    }\r\n\r\n    this.RegClaimedModule = function (name, moduleType) {\r\n        var tModule = this.GetModule(name);\r\n        if (tModule == null) {\r\n            tModule = this.ClaimModule(name);\r\n            //console.error('Module: ' + name);\r\n        }\r\n        if (moduleType) {\r\n            moduleType.bind(tModule)();\r\n            tModule.__proto__ = moduleType.prototype;\r\n        }\r\n        SetModuleReged(name, true);\r\n        ConsoleLogRegModel(name);\r\n    }\r\n\r\n    this.GetModule = function (name) {\r\n        return GetModuleEntiey(\"\", name)\r\n    }\r\n})();\r\n\r\njSW.jswGetDependUrl = DependencyMgr.jswGetDependUrl;\r\njSW.DependencyMgr = DependencyMgr;\r\n\r\nmodule.exports = {\r\n    jSW: jSW,\r\n    dMgr: DependencyMgr\r\n}\r\n\r\n// var dependencyMgr = require();\r\n// var jSW = dependencyMgr.jSW\r\n// var dMgr = dependencyMgr.dMgr\n\n//# sourceURL=webpack:///../src/build/dependency_mgr.js?");

/***/ }),

/***/ "../src/build/jsw-core.js":
/*!********************************!*\
  !*** ../src/build/jsw-core.js ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jSW = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\")[\"jSW\"];\r\n\r\n\r\n__webpack_require__(/*! ./jsw-init */ \"../src/build/jsw-init.js\")\r\n\r\n__webpack_require__(/*! ../entity/jsw-session */ \"../src/entity/jsw-session.js\");\r\n\r\n__webpack_require__(/*! ../entity/jsw-user-mgr */ \"../src/entity/jsw-user-mgr.js\");\r\n\r\n__webpack_require__(/*! ../entity/jsw-pu */ \"../src/entity/jsw-pu.js\")\r\n\r\n__webpack_require__(/*! ../channel/jsw-video */ \"../src/channel/jsw-video.js\")\r\n\r\n__webpack_require__(/*! ../dialog/jsw-common */ \"../src/dialog/jsw-common.js\")\r\n\r\n__webpack_require__(/*! ../dialog/jsw-intercom */ \"../src/dialog/jsw-intercom.js\")\r\n\r\n__webpack_require__(/*! ../channel/jsw-gps */ \"../src/channel/jsw-gps.js\")\r\n\r\n__webpack_require__(/*! ../channel/jsw-tsp */ \"../src/channel/jsw-tsp.js\")\r\n\r\nmodule.exports = jSW;\n\n//# sourceURL=webpack:///../src/build/jsw-core.js?");

/***/ }),

/***/ "../src/build/jsw-init.js":
/*!********************************!*\
  !*** ../src/build/jsw-init.js ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\njSW.CallProtoType = {\r\n    AUTO: 0,\r\n    OCX: 1,\r\n    HTTP: 2,\r\n    CheckOcx: function (protoType) {\r\n        return protoType == this.OCX;\r\n    }\r\n};\r\n\r\njSW.OpenDebug = function (isOpen) {\r\n    jSWUtils._IsDebug = isOpen;\r\n}\r\n\r\n/**ocx事件回调函数*/\r\njSW._swOcxOnEvent = function (rc, data) {\r\n    console.log('ocx on event rc:' + rc + ' websocket port: ' + data);\r\n    var port = parseInt(data);\r\n    if (rc != jSW.RcCode.RC_CODE_S_OK || port <= 0) {\r\n        console.error('ocx init fail ' + rc + ' ' + port);\r\n    }\r\n\r\n    if (port <= 0) {\r\n        rc = jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n    }\r\n\r\n    jSWOptions.ocxWebsocketPort = port;\r\n\r\n    if (jSWOptions.init_options.oninit && (typeof jSWOptions.init_options.oninit) === 'function') {\r\n        if (jSWUtils._mMgr.bUseOcx()) {\r\n            setTimeout(jSWOptions.init_options.oninit, 50, rc);\r\n        } else {\r\n            jSWOptions.init_options.oninit(rc);\r\n        }\r\n    }\r\n}\r\n\r\njSW._swOcxPlayerOnEvent = function (iEvent, chanel) {\r\n    try {\r\n        if (iEvent == 0 && chanel) {\r\n            chanel._swOnDivSizeChange(-1);\r\n        }\r\n    } catch (e) {\r\n        // console.log(e);\r\n    }\r\n}\r\n\r\n/**options: {\r\n    url: 'http://192.168.6.100:8080',\r\n    calltype: 0,//jSW.CallProtoType.AUTO,\r\n    oninit: function(rc) { },\r\n    config: {\r\n            bocxws: false,\r\n            bNEGP: false\r\n        }\r\n    }*/\r\n\r\njSW.GetHttpVersion = function (options) {\r\n    setTimeout(function () { \r\n        options.callback(options, {}, {\r\n            szversionid: jSW[\"version\"].ReqOcxVer\r\n        });\r\n    }, 50);\r\n    return 0;\r\n}\r\n\r\n\r\n/**\r\n * options : { config: {}}\r\n */\r\nfunction SetInitConfigParams(options) {\r\n    var config = {\r\n        bocxws: false,\r\n        bNEGP: false,\r\n        bManualLP: false\r\n    };\r\n    if (options && options.config) {\r\n        config.bocxws = options.config.bocxws ? true : false;\r\n        config.bNEGP = options.config.bNEGP ? true : false;\r\n        config.bManualLP = options.config.bManualLP ? true : false;\r\n    }\r\n    jSWUtils._mMgr.setBUseOcxWs(config.bocxws);\r\n    return config;\r\n}\r\n\r\njSW.MessageType = null;\r\njSW.RotateType = null;\r\njSW.EventActions = null;\r\n/**\r\n * call after dependency been loaded\r\n */\r\nfunction SetInitJswConst() {\r\n    if (jSW.MessageType == null) {\r\n        jSW.MessageType = jSWProtocol.RequestHeader.notifys;\r\n    }\r\n    if (jSW.RotateType == null) {\r\n        jSW.RotateType = jSWProtocol.RotateType;\r\n    }\r\n    if (jSW.EventActions == null) {\r\n        jSW.EventActions = jSWProtocol.EVENTACTIONS;\r\n    }\r\n}\r\n\r\nfunction FilterInitOptions(options) {\r\n    var dft_options = {\r\n        url: null,\r\n        calltype: jSW.CallProtoType.AUTO,\r\n        oninit: null,\r\n        home: null\r\n    };\r\n    return jSWUtils.extend({}, dft_options, options || {});\r\n}\r\n\r\nfunction CheckBrowserWsAndCallType(options) {\r\n    if (false == (\"WebSocket\" in window)) {\r\n        alert('not support websocket');\r\n        if (options.oninit && (typeof options.oninit) === 'function') {\r\n            options.oninit(jSW.RcCode.RC_CODE_E_INVALIDARG);\r\n        }\r\n        return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n    }\r\n\r\n    jSWOptions.calltype = options.calltype;\r\n    if (jSW.CallProtoType.AUTO == jSWOptions.calltype) {\r\n        if (jSWUtils.isIE()) {\r\n            jSWOptions.calltype = jSW.CallProtoType.OCX;\r\n        } else {\r\n            jSWOptions.calltype = jSW.CallProtoType.HTTP;\r\n        }\r\n    }\r\n\r\n    if (false == jSWUtils.isIE()) {\r\n        if (jSW.CallProtoType.OCX == jSWOptions.calltype) {\r\n            console.error('only ie support ocx!');\r\n            if (options.oninit && (typeof options.oninit) === 'function') {\r\n                options.oninit(jSW.RcCode.RC_CODE_E_INVALIDARG);\r\n            }\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n    }\r\n\r\n    jSWOptions.init_options = options;\r\n    return jSW.RcCode.RC_CODE_S_OK;\r\n}\r\n\r\nfunction ParseNecessaryAddress(options) {\r\n    var curWWWPath = window.document.location.href;\r\n    var pathName = window.document.location.pathname;\r\n    var pos = curWWWPath.lastIndexOf(pathName);\r\n    var url = curWWWPath.substring(0, pos);\r\n    if (options.url != null && options.url.length > 0) {\r\n        url = options.url;\r\n    }\r\n    if (options.home == null) {\r\n        options.home = url;\r\n    }\r\n    var httpsProto = (url.indexOf(\"https\") == 0) ? \"https://\" : \"http://\";\r\n    jSWOptions.http = url;\r\n    jSWOptions.url = url.replace(httpsProto, \"\") + '/jswapi';\r\n    var szInfo = url.replace(httpsProto, \"\").split(':');\r\n    jSWOptions.ip = szInfo[0];\r\n\r\n    if (jSWOptions.url.indexOf(':') > 0){\r\n        jSWOptions.port = szInfo[1];\r\n    }else{\r\n        jSWOptions.port = -1\r\n    }\r\n}\r\n\r\nfunction bRcFail(rc) {\r\n    return jSW.RcCode.bFaild(rc);\r\n}\r\n\r\nfunction OcxRemoveNecessaryCtrl(){\r\n    // var jsw_ocx = document.getElementById('jsw_ocx');\r\n    // if(jsw_ocx){\r\n    //     document.body.removeChild(jsw_ocx)\r\n    // }\r\n    // jsw_ocx = null\r\n}\r\n\r\nfunction OcxCreateNecessaryCtrl(options) {\r\n    var jsw_ocx = document.getElementById('jsw_ocx');\r\n    if (jsw_ocx == null) {\r\n        try {\r\n            jsw_ocx = document.createElement('object');\r\n            jsw_ocx.id = 'jsw_ocx';\r\n            jsw_ocx.classid = \"clsid:51DF1D91-DA4E-47DA-A5BE-84A96ADD2425\";\r\n            jsw_ocx.width = 1;\r\n            jsw_ocx.height = 1;\r\n            jsw_ocx.style.position = \"absolute\";\r\n            jsw_ocx.style.top = \"0px\";\r\n            jsw_ocx.style.left = \"0px\";\r\n            document.body.appendChild(jsw_ocx);\r\n        } catch (e) {\r\n            console.error('ocx attach exception ' + e);\r\n            var temp = document.getElementById('jsw_ocx')\r\n            if (temp) {\r\n                document.body.removeChild(temp);\r\n            }\r\n            if (jSW.CallProtoType.OCX == jSWOptions.calltype) {\r\n                if (options.oninit && (typeof options.oninit) === 'function') {\r\n                    options.oninit(jSW.RcCode.RC_CODE_E_INVALIDARG);\r\n                }\r\n                return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n            }\r\n            jSWOptions.calltype = jSW.CallProtoType.HTTP;\r\n        }\r\n\r\n        if (null != jsw_ocx) {\r\n            try {\r\n                // 注册事件\r\n                var iintervaltimes = 0;\r\n                var ihandle = setInterval(function () {\r\n                    var idesPort = jsw_ocx.oxGetWebSocketPort();\r\n                    if (idesPort > 0 || iintervaltimes > 20) {\r\n                        clearInterval(ihandle);\r\n                        jSW._swOcxOnEvent(0, idesPort);\r\n                    } else {\r\n                        iintervaltimes++;\r\n                    }\r\n                }, 500);\r\n            } catch (e) {\r\n                var temp = document.getElementById('jsw_ocx')\r\n                if (temp) {\r\n                    document.body.removeChild(temp);\r\n                }\r\n                document.body.removeChild(oScript);\r\n                console.error('ocx add event exception ' + e);\r\n                if (jSW.CallProtoType.OCX == jSWOptions.calltype) {\r\n                    if (options.oninit && (typeof options.oninit) === 'function') {\r\n                        options.oninit(jSW.RcCode.RC_CODE_E_INVALIDARG);\r\n                    }\r\n                    return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n                }\r\n                jSWOptions.calltype = jSW.CallProtoType.HTTP;\r\n            }\r\n\r\n            jSWUtils._mMgr.RegOcxHandle(jsw_ocx);\r\n        }\r\n    } else {\r\n        if (options.oninit && (typeof options.oninit) === 'function') {\r\n            options.oninit(jSW.RcCode.RC_CODE_S_OK);\r\n        }\r\n    }\r\n\r\n    jSW.DependencyMgr.LoadOcxDepends();\r\n}\r\n\r\nfunction HttpLoad(options) {\r\n    jSW.DependencyMgr.LoadHttpDepends(function (options) {\r\n        if (options.oninit && (typeof options.oninit) === 'function') {\r\n            options.oninit(jSW.RcCode.RC_CODE_S_OK);\r\n            jSWUtils.debugLogInfo(\"load video.js ok!\");\r\n        }\r\n    }, options);\r\n}\r\n\r\n\r\njSW.swInit = function (options) {\r\n    // 初始化，交换密钥等\r\n    jSW.DependencyMgr.LoadProDepends(function (options) {\r\n        var config = SetInitConfigParams(options);\r\n        console.log(\"Start Jsw Init\");\r\n        // 检测浏览器是否支持websocket\r\n        options = FilterInitOptions(options);\r\n        if (bRcFail(CheckBrowserWsAndCallType(options))) {\r\n            return;\r\n        }\r\n        SetInitJswConst();\r\n        ParseNecessaryAddress(options);\r\n\r\n        if (jSW.CallProtoType.OCX == jSWOptions.calltype) {\r\n            OcxCreateNecessaryCtrl(options);\r\n        } else if (jSWOptions.calltype == jSW.CallProtoType.HTTP) {\r\n            HttpLoad(options);\r\n        }\r\n        PuLoad.PuLoadInit(config);\r\n    }, options);\r\n    return 0; //jSW.RcCode.RC_CODE_S_OK;定义jSW.RcCode的库还没加载\r\n};\r\n\r\njSW.swDeInit = function () {\r\n    if (jSWOptions.session_list && jSWOptions.session_list.length > 0) {\r\n        for (var i = 0; i < jSWOptions.session_list.length; i++) {\r\n            jSWOptions.session_list[i].swDispose();\r\n            delete jSWOptions.session_list[i];\r\n        }\r\n        jSWOptions.session_list = [];\r\n    }\r\n\r\n    OcxRemoveNecessaryCtrl()\r\n    if (jSW.RcCode) {\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    }\r\n}\r\n\r\njSW.swGetOption = function () {\r\n    var opt = {\r\n        http: jSWOptions.http,\r\n        version: jSWOptions.version,\r\n        calltype: jSWOptions.calltype,\r\n    };\r\n\r\n    return opt;\r\n}\n\n//# sourceURL=webpack:///../src/build/jsw-init.js?");

/***/ }),

/***/ "../src/build/module-entry.js":
/*!************************************!*\
  !*** ../src/build/module-entry.js ***!
  \************************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("\r\nvar ProModules = {\r\n    paths: [\"thlib/jquery-1.8.2.min.js\", \"bv.js\", \"utils/Base64.js\", \"utils/BigInt.js\", \"utils/jn_rsa.js\"],\r\n    names: [\"jQuery\", \"proto\", \"Base64\", \"biFromNumber\", \"jnRSA\"]\r\n}\r\n\r\nvar ProHttpDepends = {\r\n    paths: [\r\n        \"thlib/video.min.js\",\r\n        \"thlib/videojs-contrib-hls.min.js\",\r\n        \"thlib/videojs.zoomrotate.js\",\r\n        \"thlib/video-js.min.css\",\r\n        \"thlib/HttpFlv/codec/libffmpeg_265.js\",\r\n        \"thlib/HttpFlv/render/webgl.js\",\r\n        \"thlib/HttpFlv/flv.min.js\",\r\n        \"thlib/pcm/pcm-player.min.js\"\r\n    ],\r\n    promise: [\r\n        \"videojs\",\r\n        \"videojshls\",\r\n        \"videojszoomrotate\",\r\n        \"videojs\",\r\n        \"Module\",\r\n        \"WebGLPlayer\",\r\n        \"flvjs\",\r\n        \"PCMPlayer\"\r\n    ]\r\n};\r\n\r\n\r\nvar ProOcxDepends = {\r\n    paths: [\"thlib/jquery-playbar.js\", \"thlib/barstyle.css\"]\r\n}\r\n\r\nvar ModuleDepends = {\r\n    paths: [\r\n        [\"jSWProtocol\"],\r\n        [\"jSWUtils\"],\r\n        [\"jswConst\"],\r\n        [\"CmdParse\"],\r\n        [\"ImEmotion\"],\r\n        [\"HandleResponse\"],\r\n        [\"Conference\", \"Conference/\"],\r\n        [\"ImModule\"],\r\n        [\"HttpFlv\"],\r\n        [\"Audio\", \"Audio/\"],\r\n        [\"AudioCapture\", \"Audio/\"],\r\n        [\"AudioMgr\", \"Audio/\"],\r\n        [\"HandleConfSpeak\", \"Conference/\"],\r\n        [\"PuLoad\"],\r\n        [\"HTTPNruFile\"]\r\n    ]\r\n}\r\n\r\nmodule.exports = {\r\n    ProModules: ProModules,\r\n    ProHttpDepends: ProHttpDepends,\r\n    ProOcxDepends: ProOcxDepends,\r\n    ModuleDepends: ModuleDepends\r\n};\r\n\r\n//var {ProModules, ProHttpDepends, ProOcxDepends, ModuleDepends} = require('./module-entry')\r\n//var {ModuleDepends} = require('./module-entry')\n\n//# sourceURL=webpack:///../src/build/module-entry.js?");

/***/ }),

/***/ "../src/channel/jsw-gps.js":
/*!*********************************!*\
  !*** ../src/channel/jsw-gps.js ***!
  \*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\n// ---- SWGPSChanel  GPS通道 ----\r\njSW.SWGPSChanel = function (parent, info) {\r\n    this._parent = parent;\r\n    this._info_chanel = {\r\n        id: info.ichannelindex,\r\n        name: info.szname,\r\n        ptz: info.iptz,\r\n        media: info.imediadir >> 10,\r\n        status: info.imediadir & 0x000003ff\r\n    };\r\n    this._id_chanel = this._info_chanel.id;\r\n    this._name_chanle = this._info_chanel.name;\r\n    this.m_is_open = false;\r\n    this._callback = null;\r\n    this._hDlg = -1;\r\n    this._bDlgOpened = false;\r\n};\r\n\r\njSW.SWGPSChanel.prototype = {\r\n    swClose: function () {\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_PUGPS_CHANNEL_CLOSE,\r\n            target: this._parent._id_pu,\r\n            targetIndex: this._id_chanel,\r\n            tag: options.tag,\r\n            hdlg: this._hDlg\r\n        });\r\n\r\n        this._hDlg = -1;\r\n        this.m_is_open = false;\r\n        this._bDlgOpened = false\r\n\r\n        return rc;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                gps: BVCU_PUCFG_GPSData\r\n            }\r\n        },\r\n        tag: userdata,\r\n        repeat: 3, // 重复次数， -1表示无限\r\n        interval: 5000 // 间隔， 单位毫秒\r\n    };*/\r\n    swOpen: function (options) {\r\n        if (null == this._parent || null == this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if(this.m_is_open){\r\n            return jSW.RcCode.RC_CODE_E_BUSY;\r\n        }\r\n\r\n        this.m_is_open = true;\r\n        this._callback = options.callback;\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_OPEN_PUGPS_CHANNEL,\r\n            target: this._parent._id_pu,\r\n            targetIndex: this._id_chanel,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    _OnOpenGpsHasResult: function(resultCode, hDlg){\r\n        if(jSW.RcCode.bSuccess(resultCode)){\r\n            this._hDlg = hDlg\r\n            this._bDlgOpened = true\r\n        }else{\r\n            this.m_is_open = false;\r\n            this._bDlgOpened = false\r\n            this._hDlg = -1;\r\n        }\r\n    },\r\n\r\n    _tickGpsData: function(gpsData){\r\n        if(this._callback && this._bDlgOpened){\r\n            try{\r\n                this._callback({tag: null}, {gps: gpsData, emms: {code: 0}});\r\n            }catch(e){\r\n\r\n            }\r\n        }\r\n    },\r\n\r\n\r\n    /*\r\n        options = {\r\n            callback: function(options, response, data){\r\n                data = {\r\n                    \r\n                }\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetGpsAttr: function (options) {\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_GPS,\r\n            target: this._parent._id_pu,\r\n            targetIndex: this._id_chanel,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            isenable: Number(0 关闭/ 1 开启),\r\n            callback: function(sender, response, data){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swSetPuGpsAttr: function (options) {\r\n        return this.swGetGpsAttr({\r\n            chanelid: options.chanelid,\r\n            callback: function (sender, response, data) {\r\n                var payload = new proto.BVCU.PUConfig.GPSParam();\r\n                var tag = sender.tag;\r\n                var option = tag.options;\r\n                payload.setBenable(option.isenable);\r\n                payload.setIsetupsatellitesignal(data.isetupsatellitesignal);\r\n                payload.setIreportinterval(data.ireportinterval);\r\n                payload.setIreportdistance(data.ireportdistance);\r\n\r\n                var rc = jSWProtocol.SendRequest({\r\n                    session: tag.session,\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_GPS,\r\n                    target: tag.puid,\r\n                    targetIndex: this._id_chanel,\r\n                    payload: payload,\r\n                    callback: options.callback,\r\n                    tag: tag.options.tag\r\n                });\r\n\r\n                return rc;\r\n            },\r\n            tag: {\r\n                session: this._parent._parent,\r\n                options: options,\r\n                puid: this._parent._id_pu\r\n            }\r\n        });\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/channel/jsw-gps.js?");

/***/ }),

/***/ "../src/channel/jsw-tsp.js":
/*!*********************************!*\
  !*** ../src/channel/jsw-tsp.js ***!
  \*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\n// ---- SWTSPChanel  串口通道----\r\njSW.SWTSPChanel = function (parent, info) {\r\n    this._parent = parent;\r\n    this._info_chanel = {\r\n        id: info.ichannelindex,\r\n        name: info.szname,\r\n        ptz: info.iptz,\r\n        media: info.imediadir >> 10,\r\n        status: info.imediadir & 0x000003ff\r\n    };\r\n    this._id_chanel = this._info_chanel.id;\r\n    this._name_chanle = this._info_chanel.name;\r\n    this._tspDigLog = null;\r\n}\r\n\r\njSW.SWTSPChanel.prototype = {\r\n    _OnTspDialog: function(commonDlg){\r\n        this._tspDigLog = commonDlg;\r\n    },\r\n\r\n    swClose: function () {\r\n        if (null == this._parent || null == this._parent._parent) {\r\n            console.warn('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if(this._tspDigLog == null){\r\n            return jSW.RcCode.RC_CODE_OK;\r\n        }\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var dialog_param = jSWProtocol.BVCU_DialogParam(this._parent._id_pu, this._id_chanel, 0, jSWProtocol.ProtoType.OTHER, 0, 0, this._tspDigLog._hDlg);\r\n        var closechanle_param = jSWProtocol.JsonParamDialog(session._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_CLOSE_CHANLE,\r\n            dialog_param);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.closechanle.cmd,\r\n            session: session,\r\n            request: closechanle_param\r\n        });\r\n\r\n        this._tspDigLog = null\r\n        console.log('close chanel: ' + this._parent._id_pu + ' ' + this._id_chanel);\r\n        return rc;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                gps: BVCU_PUCFG_GPSData\r\n            }\r\n        },\r\n        tag: userdata,\r\n    };*/\r\n    swOpen: function (options) {\r\n        if (null == this._parent || null == this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var dialog_param = jSWProtocol.BVCU_DialogParam(this._parent._id_pu, this._id_chanel, 0, jSWProtocol.ProtoType.OTHER, 0);\r\n        var open_param = jSWProtocol.JsonParamDialog(session._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_OPEN_CHANLE_TSP,\r\n            dialog_param);\r\n\r\n        var dft_options = {\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.openchanletsp.cmd,\r\n            session: session,\r\n            request: open_param,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                gps: BVCU_PUCFG_GPSData\r\n            }\r\n        },\r\n        data: write data,\r\n        tag: user data,\r\n    };*/\r\n    swWrite: function (options) {\r\n        if (null == this._parent || null == this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n        if (options.data == null) {\r\n            console.error('write data is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var dialog_param = new proto.WEBBVCU.Notify_TSP_Data();\r\n        dialog_param.setTargetid(this._parent._id_pu);\r\n        dialog_param.setTargetindex(this._id_chanel);\r\n\r\n        if (options.data instanceof Uint8Array) {} else if (options.data instanceof Array) {\r\n            var desszdata = new Uint8Array(options.data.length);\r\n            var datatemp = null;\r\n            var idatatemp = 0;\r\n            for (iiteindex in options.data) {\r\n                datatemp = options.data[iiteindex];\r\n                datatemp = datatemp.replace(\"0x\", \"\");\r\n                desszdata[iiteindex] += Number(datatemp.charAt(0)) * 16;\r\n                desszdata[iiteindex] += Number(datatemp.charAt(1));\r\n            }\r\n            options.data = desszdata;\r\n        } else {\r\n            options.data = jSWUtils.string2Uint8Array(options.data);\r\n        }\r\n\r\n        dialog_param.setData(options.data);\r\n\r\n        var write_param = jSWProtocol.JsonParamTSPDialog(session._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_WRITE_CHANLE_TSP,\r\n            dialog_param);\r\n        write_param.setHdlg(this._tspDigLog._hDlg);\r\n\r\n        var dft_options = {\r\n            callback: null,\r\n            data: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.writechanletsp.cmd,\r\n            session: session,\r\n            request: write_param,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swKeepLive: function () {\r\n        if (null == this._parent && this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var dialog_param = new jSWProtocol.BVCU_DialogParam(this._parent._id_pu, this._id_chanel, 0, jSWProtocol.ProtoType.OTHER, 0);\r\n        var keeplive_param = new jSWProtocol.JsonParamDialog(session._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_KEEPALIVE,\r\n            dialog_param);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.keeplivechanle.cmd,\r\n            session: session,\r\n            request: keeplive_param\r\n        });\r\n\r\n        console.log('keeplive tsp chanel: ' + dialog_param.getId() + ' ' + dialog_param.getMajor());\r\n        return rc;\r\n    },\r\n\r\n    compare: function (objChanel) {\r\n        if (this._parent.compare(objChanel._parent)) {\r\n            return (this._id_chanel == objChanel._id_chanel);\r\n        }\r\n        return false;\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/channel/jsw-tsp.js?");

/***/ }),

/***/ "../src/channel/jsw-video.js":
/*!***********************************!*\
  !*** ../src/channel/jsw-video.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\n// ---- SWVideoChanel  视频通道----\r\njSW.SWVideoChanel = function (parent, info) {\r\n    this._parent = parent;\r\n    this._info_chanel = {\r\n        id: info.ichannelindex,\r\n        name: info.szname,\r\n        ptz: info.iptz,\r\n        media: info.imediadir >> 10,\r\n        status: info.imediadir & 0x000003ff\r\n    };\r\n    this._id_chanel = this._info_chanel.id;\r\n    this._name_chanle = this._info_chanel.name;\r\n    this._meida_chanel = this._info_chanel.media;\r\n    this._ptz_chanel = this._info_chanel.ptz;\r\n    this._url_channel = null;\r\n    this.m_live_hls = null;\r\n    this.m_live_rtmp = null;\r\n    this._session = this._parent._parent;\r\n    this._commDlgMgr = new jSW.CommonDlgMgr(this._session);\r\n    this.ismuti = false;\r\n    this._open_status = jSW.SWVideoChanel._OpenStatus.NOT_OPEND;\r\n    this._intercom = new jSW.SWVideoChanel.InterCom(this);\r\n    this.m_prototype = 4;\r\n};\r\n\r\njSW.SWVideoChanel._OpenStatus = {\r\n    NOT_OPEND: 0,\r\n    OPENING: 1,\r\n    OPENED: 2\r\n};\r\n\r\njSW.SWVideoChanel._OcxFullScreen = {\r\n    _lastVideoChanel: null,\r\n    _hDlg: -1,\r\n    beforeFullScreen: function (m_chanel, hdlg) {\r\n        this._lastVideoChanel = m_chanel;\r\n        this._hDlg = hdlg;\r\n    },\r\n    onClickEsc: function () {\r\n        if (jSWOptions.CheckOcx()) {\r\n            if (document.msFullscreenElement) {\r\n                document.msExitFullscreen();\r\n            }\r\n        }\r\n    },\r\n    upDateDialog: function () {\r\n        if (this._lastVideoChanel) {\r\n            this._lastVideoChanel._updateDialog(this._hDlg);\r\n        }\r\n        if (!document.msFullscreenElement) {\r\n            this._lastVideoChanel = null;\r\n        }\r\n    },\r\n\r\n    onFullScreenChange: function () {\r\n        setTimeout(jSW.SWVideoChanel._OcxFullScreen.upDateDialog.bind(jSW.SWVideoChanel._OcxFullScreen), 200);\r\n    }\r\n};\r\n\r\njSW.SWVideoChanel._Ocx_PlayObjMgr = {\r\n    GetPlayObj: function (bWindowless) {\r\n        var targetObj = this.TryGetAnPlayObj(bWindowless)\r\n\r\n        if (targetObj == null) {\r\n            targetObj = this.CreatePlayObj(bWindowless);\r\n            targetObj.used = true;\r\n        }\r\n\r\n        return targetObj;\r\n    },\r\n    FreePlayObj: function (PlayObj) {\r\n        if (PlayObj && PlayObj.used) {\r\n            PlayObj.used = false\r\n        }\r\n    },\r\n    _szTargetPlayObj: [],\r\n\r\n    CreatePlayObj: function (bWindowless) {\r\n        var tempTargetObj = document.createElement('object');\r\n        if (bWindowless) {\r\n            tempTargetObj.classid = 'clsid:0c85b239-904a-4adf-8424-f1928b38f12f';\r\n        } else {\r\n            tempTargetObj.classid = \"clsid:CDE6C639-4BA8-4A09-81EB-DCE76A61FE98\";\r\n        }\r\n\r\n        tempTargetObj.style.width = '100%';\r\n        tempTargetObj.style.height = '100%';\r\n        tempTargetObj.style.display = 'block';\r\n        this._szTargetPlayObj.push(tempTargetObj)\r\n        tempTargetObj.used = false;\r\n        tempTargetObj.bWindowless = bWindowless\r\n        return tempTargetObj;\r\n    },\r\n    CheckPlayObjFit: function (PlayObj, bWindowless) {\r\n        if (PlayObj.used == false && PlayObj.bWindowless == bWindowless) {\r\n            return true;\r\n        }\r\n        return false;\r\n    },\r\n    TryGetAnPlayObj: function (bWindowless) {\r\n        var aimPlayObj = null\r\n        for (var ii = 0; ii < this._szTargetPlayObj.length; ii++) {\r\n            if (this.CheckPlayObjFit(this._szTargetPlayObj[ii], bWindowless)) {\r\n                aimPlayObj = this._szTargetPlayObj[ii];\r\n                aimPlayObj.used = true;\r\n                break\r\n            }\r\n        }\r\n        return aimPlayObj\r\n    },\r\n    Free: function () {\r\n        this._szTargetPlayObj = []\r\n    }\r\n};\r\n\r\n///key id 27 esc\r\n(function () {\r\n    document.addEventListener(\"keydown\", function () {\r\n        var event = window.event || arguments[0];\r\n        if (event.keyCode == 27) {\r\n            jSW.SWVideoChanel._OcxFullScreen.onClickEsc();\r\n        }\r\n    });\r\n})();\r\n\r\njSW.SWVideoChanel.prototype = {\r\n    /*\r\n     * options : {\r\n     *    Idelayvssmooth : Number\r\n     * }\r\n     */\r\n    swSetControlParam: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        if (jSWOptions.CheckOcx()) {\r\n            if (typeof options[\"Idelayvssmooth\"] == undefined) {\r\n                return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n            }\r\n            var payload = new proto.WEBBVCU.ParamsDialogControl();\r\n            payload.setIdelayvssmooth(options[\"Idelayvssmooth\"]);\r\n            var rc = this._autoDlgSendProxy(options, function (data) {\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_DIALOG_PARAM,\r\n                    payload: payload\r\n                };\r\n            });\r\n            return rc;\r\n        }\r\n        return rc;\r\n    },\r\n\r\n    /**video source type*/\r\n    swSrcType: function (option) {\r\n        var result = 'unknown';\r\n        this._autoDlgProxy(option, function (commDlg, session, targetid, targetindex, hdlg) {\r\n            if (commDlg._prototype == jSWProtocol.ProtoType.HLS) {\r\n                result = 'hls';\r\n            } else if (commDlg._prototype == jSWProtocol.ProtoType.OCX) {\r\n                result = 'ocx';\r\n            } else if (commDlg._prototype == jSWProtocol.ProtoType.RTMP) {\r\n                result = 'rtmp';\r\n            }\r\n        })\r\n        return result;\r\n    },\r\n\r\n    localRecords: [],\r\n\r\n    _notifyDialogEventStorage: function (msgType, eventStorage) {\r\n        var localRecord = null;\r\n        var isContains = false;\r\n        for (iIndex in this.localRecords) {\r\n            localRecord = this.localRecords[iIndex];\r\n            if (localRecord.szfilename == eventStorage.szfilename) {\r\n                isContains = true;\r\n                break;\r\n            }\r\n        }\r\n\r\n        if (!isContains) {\r\n            localRecord = {\r\n                iresult: jSW.RcCode.RC_CODE_S_OK,\r\n                szfilename: eventStorage.szfilename,\r\n                itimestampbegin: 0,\r\n                itimestampend: 0\r\n            };\r\n            this.localRecords.push(localRecord);\r\n        }\r\n\r\n        switch (msgType) {\r\n            case proto.WEBBVCU.MSGType.WEB_NOTIFY_BVCU_EVENT_STORAGE_FILE_OPEN:\r\n                localRecord.itimestampbegin = eventStorage.itimestamp;\r\n                localRecord.iresult = eventStorage.iresult;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_NOTIFY_BVCU_EVENT_STORAGE_FILE_CLOSE:\r\n                localRecord.itimestampend = eventStorage.itimestamp;\r\n                localRecord.iresult = eventStorage.iresult;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_NOTIFY_BVCU_EVENT_STORAGE_ERROR:\r\n                localRecord.iresult = eventStorage.iresult;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n        if (msgType == proto.WEBBVCU.MSGType.WEB_NOTIFY_BVCU_EVENT_STORAGE_FILE_CLOSE ||\r\n            msgType == proto.WEBBVCU.MSGType.WEB_NOTIFY_BVCU_EVENT_STORAGE_ERROR) {\r\n            if (this._callbackAfterRecordHasResult != null) {\r\n                var data = {\r\n                    channel: this,\r\n                    storage: localRecord\r\n                };\r\n                this._callbackAfterRecordHasResult(data)\r\n            }\r\n        }\r\n    },\r\n\r\n    _callbackAfterRecordHasResult: null,\r\n    _videoPlayer: null,\r\n    _iVideoPlayerRotate: 0,\r\n    _OnNeedSaveVideoPlayer: function (videoplayer) {\r\n        this._videoPlayer = videoplayer;\r\n        this._iVideoPlayerRotate = 0;\r\n    },\r\n\r\n    /**fullscreen: full screen, Esc key exit*/\r\n    swFullScreen: function (opts) {\r\n        var rc = this._autoDlgProxy(opts, function (commDlg, session, targetid, targetindex, hdlg) {\r\n            if (jSWOptions.CheckOcx()) {\r\n                var myDivId = commDlg.getPlayDiv().bv_uuid + '_0077554' + \"tempdiv\";\r\n                var myDiv = document.getElementById(myDivId);\r\n                if (!document.onmsfullscreenchange) {\r\n                    document.onmsfullscreenchange = jSW.SWVideoChanel._OcxFullScreen.onFullScreenChange;\r\n                }\r\n                if (document.msFullscreenElement) {\r\n                    document.msExitFullscreen();\r\n                } else {\r\n                    jSW.SWVideoChanel._OcxFullScreen.beforeFullScreen(this, hdlg);\r\n                    myDiv.msRequestFullscreen();\r\n                }\r\n            } else if (jSWOptions.calltype == jSW.CallProtoType.HTTP) {\r\n                if (document.fullscreenElement) {\r\n                    document.exitFullscreen()\r\n                } else {\r\n                    var myDiv = commDlg.getPlayDiv()\r\n                    if (myDiv) {\r\n                        myDiv.requestFullscreen()\r\n                    }\r\n                }\r\n            }\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    swGetStatisticsInfo: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        if (jSWOptions.CheckNotOcx() && false) {\r\n            rc = this._autoDlgProxy(options, function (CommDlg) {\r\n\r\n            })\r\n            console.log(\"swGetStatisticsInfo Only Run In Ocx\")\r\n        } else {\r\n            rc = this._autoDlgSendProxy(options, function (data) {\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_GET_DIALOG_INFO\r\n                }\r\n            })\r\n        }\r\n        return rc;\r\n    },\r\n\r\n    swGetDialogInfo: function (options) {\r\n        var payload = new proto.BVCU.CMSConfig.CMSCFG_DialogInfo();\r\n        var pbStTarget = new proto.BVCU.CMSConfig.CMSCFG_ChannelInfo();\r\n        pbStTarget.setSzid(this._parent._id_pu);\r\n        payload.setSttarget(pbStTarget);\r\n        payload.setIchannelindex(this._id_chanel);\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            payload: payload,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_GET_CMS_DIALOGINFO,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    /*\r\n        opitons = {\r\n            irotate: jSWProtocol.RotateType ,\r\n            callback: function(Options, Response){\r\n            }\r\n            tag: Object\r\n        }\r\n    */\r\n    swVideoRotate: function (options) {\r\n        var rc = this._autoDlgProxy(options, function (commDlg, session, targetid, targetindex, hdlg) {\r\n            var iRotate = commDlg.getRotate();\r\n            iRotate += options.irotate;\r\n            if (jSWOptions.CheckOcx()) {\r\n                var rc = this._swOnDivSizeChange(iRotate, hdlg, options);\r\n                return rc;\r\n            } else if (jSWOptions.CheckHttp()) {\r\n                if (this._videoPlayer == null) {\r\n                    jSWUtils.debugLogInfo(targetid + \" \" + targetindex + \" video rotate faild, due not playing\");\r\n                    return jSW.RcCode.RC_CODE_E_FAIL;\r\n                }\r\n                this._videoPlayer.zoomrotate({\r\n                    rotate: this._iVideoPlayerRotate,\r\n                    debug: false\r\n                });\r\n                setTimeout(options.callback, 50, {\r\n                    tag: options.tag\r\n                }, {\r\n                    emms: {\r\n                        code: jSW.RcCode.RC_CODE_S_OK\r\n                    }\r\n                });\r\n                return jSW.RcCode.RC_CODE_S_OK;\r\n            }\r\n        });\r\n        return rc;\r\n    },\r\n\r\n\r\n    /**\r\n     * options: {\r\n     *  bStretch: Boolean,\r\n     *  callback: function(){},\r\n     *  tag: object\r\n     * }\r\n     */\r\n    swVideoStretch: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_S_OK\r\n        if (jSWOptions.CheckNotOcx()) {\r\n            rc = this._autoDlgProxy(options, function (CommDlg) {\r\n                if (CommDlg._mdiv && CommDlg._mdiv.getElementsByTagName(\"video\").length > 0) {\r\n                    if (options.bStretch) {\r\n                        $(CommDlg._mdiv.getElementsByTagName(\"video\")[0]).css('object-fit', 'fill')\r\n                    } else {\r\n                        $(CommDlg._mdiv.getElementsByTagName(\"video\")[0]).css('object-fit', 'contain')\r\n                    }\r\n                } else {\r\n                    jSWUtils.debugLogInfo(\"present div not found, stretch video fail\")\r\n                    return jSW.RcCode.RC_CODE_E_NOTFOUND\r\n                }\r\n                return jSW.RcCode.RC_CODE_S_OK\r\n            })\r\n\r\n            if (options.callback) {\r\n                setTimeout(options.callback, 50, {\r\n                    tag: options.tag\r\n                }, {\r\n                    emms: {\r\n                        code: rc\r\n                    }\r\n                });\r\n            }\r\n        } else {\r\n            rc = this._autoDlgSendProxy(options, function (data) {\r\n                var payload = new proto.WEBBVCU.CommonData();\r\n                payload.setIdata1(options.bStretch ? 1 : 0);\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_VIDEO_DIALOG_STRETCH,\r\n                    payload: payload\r\n                }\r\n            })\r\n        }\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * options: {\r\n     *  iQuality: Number Default(100),\r\n     *  szFileName: String\r\n     *  callback: function(){},\r\n     *  tag: object,\r\n     *  hdlg: Number\r\n     * }\r\n     */\r\n    swLocalSnapshot: function (options) {\r\n\r\n        if (jSWOptions.CheckHttp()) {\r\n            var rc = jSW.RC_CODE_E_UNSUPPORTED;\r\n\r\n            rc = this._autoDlgProxy(options, function (CommDlg) {\r\n                var result = null\r\n                if (CommDlg._mdiv) {\r\n                    var videoTag = CommDlg._mdiv.getElementsByTagName('video')\r\n                    if (videoTag.length == 1) {\r\n                        result = jSWUtils.Snapshot(videoTag[0], videoTag[0].videoWidth, videoTag[0].videoHeight)\r\n                    }\r\n                }\r\n\r\n                if (options.callback) {\r\n                    var callbackRc = result ? jSW.RcCode.RC_CODE_S_OK : jSW.RcCode.RC_CODE_E_FAIL\r\n                    setTimeout(options.callback,\r\n                        50, {\r\n                            tag: options.tag\r\n                        }, {\r\n                            emms: {\r\n                                code: callbackRc\r\n                            }\r\n                        },\r\n                        result\r\n                    );\r\n                }\r\n\r\n                return jSW.RC_CODE_S_OK\r\n            });\r\n\r\n            return rc;\r\n\r\n        } else {\r\n            if (!options.szFileName || options.szFileName.length == 0) {\r\n                console.log(\"swLocalSnapshot SzFilePath Is Invalid\");\r\n                return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n            }\r\n            var rc = this._autoDlgSendProxy(options, function (data) {\r\n                var payload = new proto.WEBBVCU.CommonData();\r\n                payload.setIdata1(options.iQuality ? options.iQuality : 100);\r\n                payload.setSzdata(jSWUtils.string2Uint8Array(options.szFileName));\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_LOCAL_SNAPSHOT,\r\n                    payload: payload\r\n                };\r\n            });\r\n            return rc;\r\n        }\r\n    },\r\n\r\n    _updateDialog: function (hDlg) {\r\n        var rc = jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        if (jSWOptions.CheckOcx()) {\r\n            var rc = this._commSendProxy(options, function () {\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_VIDEO_DIALOG_UPDATE,\r\n                    hdlg: hDlg,\r\n                };\r\n            });\r\n            return rc;\r\n        }\r\n        return rc;\r\n    },\r\n\r\n    _swOnDivSizeChange: function (irotate, hdlg, options) {\r\n        var payload = new proto.WEBBVCU.VideoDialogRotate();\r\n        payload.setSzpuid(jSWUtils.string2Uint8Array(this._parent._id_pu));\r\n        payload.setIchannelindex(this._id_chanel);\r\n        payload.setIrotate(irotate);\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            payload: payload,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_VIDEO_DIALOG_ROTATE,\r\n            hdlg: hdlg,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    _onOcxChanelChange: function (isVideo, isOpen, iMedir) {\r\n        if (jSW.CallProtoType.OCX != jSWOptions.calltype) {\r\n            return;\r\n        }\r\n    },\r\n\r\n    //one chanel muti open\r\n    _pushCommDlg: function (commDlg, tprototype) {\r\n        this._commDlgMgr.push(commDlg, tprototype);\r\n    },\r\n\r\n    ismutidhlg: 0,\r\n    _buildHdlg: function (hDlg, protoType) {\r\n        // if (protoType == jSWProtocol.ProtoType.RTMP) {\r\n        //     this.ismutidhlg++;\r\n        //     return this.ismutidhlg;\r\n        // }\r\n        return hDlg;\r\n    },\r\n\r\n    _beginOpen: function () {\r\n        if (!this.ismuti) {\r\n            this._open_status = jSW.SWVideoChanel._OpenStatus.OPENING;\r\n        }\r\n    },\r\n\r\n    _endOpenHasResult: function (bresult) {\r\n        if (!this.ismuti) {\r\n            if (bresult) {\r\n                this._open_status = jSW.SWVideoChanel._OpenStatus.OPENED;\r\n            } else {\r\n                this._open_status = jSW.SWVideoChanel._OpenStatus.NOT_OPEND;\r\n            }\r\n        }\r\n    },\r\n\r\n    _closeHasResult: function (bresult) {\r\n        if (!this.ismuti) {\r\n            if (bresult) {\r\n                this._open_status = jSW.SWVideoChanel._OpenStatus.NOT_OPEND;\r\n            }\r\n        }\r\n    },\r\n\r\n    _checkCanOpen: function (bmuti) {\r\n        this.ismuti = bmuti;\r\n        if (this.ismuti) {\r\n            return true;\r\n        }\r\n        return this._open_status == jSW.SWVideoChanel._OpenStatus.NOT_OPEND;\r\n    },\r\n\r\n    _fillOpenParam: function (bismuti) {\r\n        this.ismuti = bismuti;\r\n    },\r\n\r\n    _autoDlgProxy: function (opts, handle, tag) {\r\n        var hdlg = this._getOptsHdlg(opts);\r\n        if (this.ismuti && (typeof hdlg == \"undefined\" || hdlg == -1)) {\r\n            console.log(\"can't find the dialog from you hdlg\");\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n        var tCommDlg = this.ismuti ? this._commDlgMgr.get(hdlg) : this._commDlgMgr.getDefault();\r\n\r\n        if (tCommDlg == null) {\r\n            console.log(\"can't find the dialog from you hdlg, maybe it's been closed\");\r\n            return jSW.RcCode.RC_CODE_E_NOTFOUND;\r\n        }\r\n\r\n        hdlg = tCommDlg.getHDlg();\r\n\r\n        var rc = this._commProxy(function (session, targetId, targetIndex) {\r\n            return handle.bind(this)(tCommDlg, session, targetId, targetIndex, hdlg, tag);\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    _getOptsHdlg: function (opts) {\r\n        if (opts && typeof opts.hdlg != \"undefined\") {\r\n            return opts.hdlg;\r\n        }\r\n        return -1;\r\n    },\r\n\r\n    _getDesDiv: function (div) {\r\n        if (typeof div == \"string\") {\r\n            return document.getElementById(div);\r\n        }\r\n        return div;\r\n    },\r\n    //\r\n    _commProxy: function (handle) {\r\n        if (null == this._parent || null == this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n        return handle.bind(this)(this._parent._parent, this._parent._id_pu, this._id_chanel);\r\n    },\r\n\r\n    _commSendProxy: function (opts, handleGetData) {\r\n        var rc = this._commProxy(function (session, targetId, targetIndex) {\r\n            var dftData = {\r\n                payload: null,\r\n                msgtype: -1,\r\n                cmd: \"\",\r\n                hdlg: -1,\r\n                callback: opts ? opts.callback : null,\r\n                tag: opts ? opts.tag : null\r\n            };\r\n            var desData = handleGetData.bind(this)();\r\n\r\n            desData = jSWUtils.extend({}, dftData, desData || {});\r\n\r\n            var rc = jSWProtocol.SendRequest({\r\n                session: session,\r\n                target: targetId,\r\n                targetIndex: targetIndex,\r\n                msgtype: desData.msgtype,\r\n                callback: desData.callback,\r\n                payload: desData.payload,\r\n                hdlg: desData.hdlg,\r\n                tag: desData.tag,\r\n                cmd: desData.cmd\r\n            });\r\n\r\n            return rc;\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    _autoDlgSendProxy: function (opts, handleGetData, afterhandle) {\r\n        var rc = this._autoDlgProxy(opts, function (commDlg, session, targetId, targetIndex, hdlg) {\r\n            var dftData = {\r\n                payload: null,\r\n                msgtype: -1,\r\n                cmd: \"\",\r\n                hdlg: -1,\r\n                callback: null,\r\n                tag: null,\r\n                bcancel: false\r\n            };\r\n            if (commDlg == undefined && opts.hdlg == undefined) {\r\n                commDlg = dftData.hdlg;\r\n            }\r\n            var desData = handleGetData.bind(this)(commDlg);\r\n            desData = jSWUtils.extend({}, dftData, desData || {});\r\n\r\n            var rc = jSW.RcCode.RC_CODE_S_OK;\r\n            if (false == desData.bcancel) {\r\n                rc = jSWProtocol.SendRequest({\r\n                    session: session,\r\n                    target: targetId,\r\n                    targetIndex: targetIndex,\r\n                    msgtype: desData.msgtype,\r\n                    callback: opts.callback,\r\n                    payload: desData.payload,\r\n                    hdlg: hdlg,\r\n                    tag: opts.tag,\r\n                    cmd: desData.cmd\r\n                });\r\n            }\r\n            if (afterhandle) {\r\n                afterhandle.bind(this)(commDlg);\r\n            }\r\n            return rc;\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                bovertcp: ,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                url: url\r\n            }\r\n        },\r\n        tag: userdata\r\n    };*/\r\n    swOpen: function (options) {\r\n        var rc = this._commProxy(function (session, targetId, targetIndex) {\r\n            var dft_options = {\r\n                callback: null,\r\n                tag: null,\r\n                prototype: 'auto',\r\n                media: jSW.MEDIADIR.VIDEORECV\r\n            };\r\n            options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n            var ptRet = this._eventHandle.getProtoType(options.prototype, options.useoptions.bHttpFlv);\r\n            if (jSW.RcCode.bFaild(ptRet.rc)) {\r\n                return ptRet.rc;\r\n            }\r\n            var prototype = ptRet.prototype;\r\n            var div = options.tag.div;\r\n            var playObj = null;\r\n            prototype\r\n            var isNeedDelay = false;\r\n\r\n            var bWindowless = options.useoptions.bwindowless;\r\n            var bHttpFlv = options.useoptions.bHttpFlv;\r\n            if (prototype == 2 && ptRet.bHttpFlv) {\r\n                bHttpFlv = ptRet.bHttpFlv;\r\n                options.useoptions.bHttpFlv = ptRet.bHttpFlv;\r\n            }\r\n\r\n            if (null == div) {\r\n                console.warn('no have div ,we will not display the video stream, just throw stream url');\r\n            } else {\r\n\r\n\r\n                var opendivparam = this._eventHandle.beforeOpenPreparePlayDiv(prototype, div, bWindowless, bHttpFlv);\r\n                playObj = opendivparam.playObj;\r\n                isNeedDelay = opendivparam.isNeedDelay;\r\n            }\r\n\r\n            var boverTcp = options.useoptions.bovertcp ? true : false;\r\n            var sendCmd = this._eventHandle.sendOpenChanel;\r\n\r\n            var dialog_param = jSWProtocol.BVCU_DialogParam(targetId, targetIndex, 0, prototype, options.media, 0, 0, boverTcp);\r\n            var bstretch = options.useoptions.bstretch ? true : false;\r\n            if (bstretch) {\r\n                dialog_param.setBstretch(true);\r\n            }\r\n            if (bWindowless) {\r\n                dialog_param.setBwindowless(true);\r\n            }\r\n\r\n            dialog_param.setUsews(options.useoptions[\"usews\"] ? true : false)\r\n\r\n            if (isNeedDelay) {\r\n                setTimeout(function () {\r\n                    sendCmd(session, options, playObj, dialog_param);\r\n                }, 500);\r\n            } else {\r\n                return sendCmd(session, options, playObj, dialog_param);\r\n            }\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        });\r\n        return rc;\r\n    },\r\n    /**var options = {\r\n        div: 'div_id', // div or div id\r\n        prototype: 'auto', //rtmp > hls\r\n        callback: function(options, response) {\r\n            options = options;\r\n            response = {\r\n                emms: emms,\r\n                request: request\r\n            }\r\n        },\r\n        tag: Object,\r\n        ismuti: false,\r\n        bstretch: false,\r\n        bwindowless: false\r\n    };*/\r\n    swOpenEx: function (options) {\r\n        var dft_options = {\r\n            callback: null,\r\n            div: '',\r\n            prototype: 'auto',\r\n            media: jSW.MEDIADIR.VIDEORECV,\r\n            bovertcp: false,\r\n            tag: null,\r\n            ismuti: false,\r\n            bstretch: false,\r\n            bwindowless: false,\r\n            bHttpFlv: false,\r\n            usews: false\r\n        };\r\n\r\n        var uoptions = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        if (jSWOptions.CheckHttp() && uoptions.prototype == \"auto\") {\r\n            uoptions.prototype = \"httpflv\";\r\n        }\r\n\r\n        if (uoptions.prototype == \"httpflv\") {\r\n            uoptions.prototype = \"rtmp\";\r\n            uoptions.bHttpFlv = true;\r\n            uoptions.usews = true\r\n        }\r\n\r\n        if (!this._eventHandle.checkMedia(uoptions.media)) {\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if (!this._checkCanOpen(uoptions.ismuti)) {\r\n            if (!options.ismuti) {\r\n                console.log(\"current open chanel model is mutil open!\");\r\n            }\r\n            var rc = jSW.RcCode.RC_CODE_E_ALREADYEXIST;\r\n            console.log(jSW.RcCode.trans(rc));\r\n            return jSW.RcCode.RC_CODE_E_ALREADYEXIST;\r\n        }\r\n\r\n        this._beginOpen();\r\n\r\n        uoptions.div = this._getDesDiv(uoptions.div);\r\n        if (uoptions.div == null) {\r\n            console.warn('no have div ,we will not display the video stream, just throw stream url');\r\n        }\r\n\r\n        var result = this.swOpen({\r\n            prototype: uoptions.prototype,\r\n            tag: {\r\n                div: uoptions.div,\r\n                channel: this,\r\n                userdata: uoptions.tag\r\n            },\r\n            useoptions: uoptions,\r\n            media: uoptions.media,\r\n            callback: this._eventHandle.onSwOpenExHasResult\r\n        });\r\n\r\n        if (jSW.RcCode.bFaild(result)) {\r\n            this._endOpenHasResult(false);\r\n        }\r\n        return result;\r\n    },\r\n\r\n    _eventHandle: {\r\n        getProtoType: function (optionsPT, bHttpFlv) {\r\n            var ret = {\r\n                rc: jSW.RcCode.RC_CODE_S_OK,\r\n                prototype: -1,\r\n                bHttpFlv: bHttpFlv\r\n            };\r\n            var prototype = -1;\r\n            if (jSWOptions.calltype == jSW.CallProtoType.OCX) {\r\n                prototype = jSWProtocol.ProtoType.OCX;\r\n            } else {\r\n                if ('hls' == optionsPT) {\r\n                    prototype = jSWProtocol.ProtoType.HLS;\r\n                } else if ('rtmp' == optionsPT) {\r\n                    if (bHttpFlv || jSWUtils.supportFlash()) {\r\n                        prototype = jSWProtocol.ProtoType.RTMP;\r\n                    } else {\r\n                        console.error('not supported flash (rtmp)');\r\n                        ret.rc = jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n                    }\r\n                } else if ('auto' == optionsPT) {\r\n                    if (flvjs.getFeatureList().mseLiveFlvPlayback || jSWUtils.supportFlash()) {\r\n                        prototype = jSWProtocol.ProtoType.RTMP;\r\n                        ret.bHttpFlv = true;\r\n                    } else if (bHttpFlv || jSWUtils.supportFlash()) {\r\n                        prototype = jSWProtocol.ProtoType.RTMP;\r\n                    } else {\r\n                        prototype = jSWProtocol.ProtoType.HLS;\r\n                    }\r\n                } else {\r\n                    if (bHttpFlv || jSWUtils.supportFlash()) {\r\n                        prototype = jSWProtocol.ProtoType.RTMP;\r\n                    } else {\r\n                        prototype = jSWProtocol.ProtoType.HLS;\r\n                    }\r\n                }\r\n            }\r\n            ret.prototype = prototype;\r\n            return ret;\r\n        },\r\n        sendOpenChanel: function (p_session, p_options, p_playObject, p_dialog_param) {\r\n            if (p_playObject != null) {\r\n                if (jSWProtocol.ProtoType.OCX == p_dialog_param.getProto()) {\r\n                    p_dialog_param.setHwnd(p_playObject.GetWMHwnd());\r\n\r\n                    p_playObject.style.display = 'block';\r\n                    if (p_dialog_param.getBwindowless()) {\r\n                        p_dialog_param.setHplayhandle(p_playObject.GetWMHwnd());\r\n                    }\r\n                }\r\n            }\r\n\r\n            var open_param = jSWProtocol.JsonParamDialog(p_session._p_emms,\r\n                proto.WEBBVCU.MSGType.WEB_BVCU_OPEN_CHANLE,\r\n                p_dialog_param);\r\n\r\n            var rc = jSWProtocol._internalSend({\r\n                cmd: jSWProtocol.RequestHeader.openchanle.cmd,\r\n                session: p_session,\r\n                request: open_param,\r\n                callback: p_options.callback,\r\n                opt: p_options,\r\n                tag: p_options.tag\r\n            });\r\n            return rc;\r\n        },\r\n        beforeOpenPreparePlayDiv: function (prototype, parentdiv, bWindowless, bHttpFlv) {\r\n            var playObject = null;\r\n            var isNeedDelay = false;\r\n\r\n            /**隐藏播放器div, 防止重叠*/\r\n            {\r\n                if (typeof (parentdiv.bv_uuid) == \"undefined\") {\r\n                    parentdiv.bv_uuid = jSWUtils.generateUUID();\r\n                }\r\n\r\n                var objDivId = parentdiv.bv_uuid + '_0077553'; /**ID附属*/\r\n                var objDiv = document.getElementById(objDivId);\r\n                if (objDiv != null) {\r\n                    objDiv.style.display = 'none';\r\n                }\r\n\r\n                objDivId = parentdiv.bv_uuid + '_0077554'; /**ID附属*/\r\n                objDiv = document.getElementById(objDivId);\r\n                if (objDiv != null) {\r\n                    objDiv.style.display = 'none';\r\n                }\r\n            }\r\n\r\n            if (jSWProtocol.ProtoType.HLS == prototype || jSWProtocol.ProtoType.RTMP == prototype) {\r\n                var playObjectId = parentdiv.bv_uuid + '_0077553'; /**ID附属*/\r\n                playObject = document.getElementById(playObjectId);\r\n                if (playObject == null) {\r\n                    playObject = document.createElement('VIDEO');\r\n                    playObject.setAttribute('id', playObjectId);\r\n                    playObject.setAttribute('class', 'video-js vjs-default-skin vjs-big-play-centered');\r\n                    // playObject.setAttribute('poster', '/js/my_video_poster.png');\r\n                    parentdiv.appendChild(playObject);\r\n                }\r\n                playObject.style.width = '100%';\r\n                playObject.style.height = '100%';\r\n                playObject.style.display = 'block';\r\n            } else if (jSWProtocol.ProtoType.OCX == prototype) {\r\n                var playObjectId = parentdiv.bv_uuid + '_0077554'; /**ID附属*/\r\n                var myTempDivId = playObjectId + \"tempdiv\";\r\n                playObject = document.getElementById(playObjectId);\r\n                if (playObject == null) {\r\n                    var mydiv = document.getElementById(myTempDivId);\r\n                    if (mydiv == null) {\r\n                        mydiv = document.createElement(\"div\");\r\n                        mydiv.id = playObjectId + \"tempdiv\";\r\n                        mydiv.style.width = '100%';\r\n                        mydiv.style.height = '100%';\r\n                    }\r\n                    mydiv.style.display = 'block';\r\n                    parentdiv.appendChild(mydiv);\r\n\r\n                    playObject = jSW.SWVideoChanel._Ocx_PlayObjMgr.GetPlayObj(bWindowless)\r\n\r\n                    playObject.id = playObjectId\r\n                    playObject.tag = this;\r\n                    mydiv.appendChild(playObject);\r\n                    isNeedDelay = true;\r\n\r\n                    var playeventid = playObjectId + \"ocxeventid\"\r\n                    var oScript = document.getElementById(playeventid);\r\n                    if (oScript == null) {\r\n                        oScript = document.createElement(\"script\");\r\n                        oScript.id = playObjectId + \"ocxeventid\";\r\n                        oScript.type = \"text/javascript\";\r\n                        oScript.setAttribute('for', playObjectId);\r\n                        oScript.setAttribute('event', 'OnHwndEvent(hwnd, ieventtype, pParam)');\r\n                        oScript.text = 'jSW._swOcxPlayerOnEvent(ieventtype, this.tag);';\r\n                        document.body.appendChild(oScript);\r\n                    }\r\n                }\r\n            }\r\n            return {\r\n                playObj: playObject,\r\n                isNeedDelay: isNeedDelay\r\n            };\r\n        },\r\n        onSwOpenExHasResult: function (options, response, dlgparam) {\r\n            var payload = response.getPayload();\r\n            var openDialogResponse = proto.WEBBVCU.Open_Dialog_Response.deserializeBinary(payload);\r\n\r\n            var videoChannel = options.tag.channel;\r\n            var userdata = options.tag.userdata;\r\n            var url = '';\r\n            var payloadRequest = options.request.getPayload();\r\n            var requestParam = proto.WEBBVCU.BVCU_DialogParam.deserializeBinary(payloadRequest);\r\n            var hdlg = -1;\r\n            var bSuccess = jSW.RcCode.bSuccess(response.getCode());\r\n            var tprototype = requestParam.getProto();\r\n            var useroptions = options.opt.useoptions;\r\n            var bHttpFlv = options.opt.useoptions.bHttpFlv;\r\n            if (bHttpFlv) {\r\n                var httpFlvHandle = jSW.DependencyMgr.GetModule(\"HttpFlv\");\r\n            }\r\n\r\n            if (openDialogResponse.hasUrl()) {\r\n                url = openDialogResponse.getUrl();\r\n            }\r\n\r\n            var dialogparams = null;\r\n\r\n            if (bSuccess) {\r\n                if (openDialogResponse.hasHdlg()) {\r\n                    hdlg = videoChannel._buildHdlg(openDialogResponse.getHdlg(), tprototype);\r\n\r\n                    dlgparam.setParams(options.tag.div, hdlg, requestParam.getMedia(), tprototype);\r\n                    videoChannel._pushCommDlg(dlgparam, tprototype);\r\n                }\r\n\r\n                if (options.session != null) {\r\n                    var puid = requestParam.getId();\r\n                    var major = requestParam.getMajor();\r\n                    var chanel = videoChannel;\r\n                    if (chanel != null) {\r\n                        var urlCurrent;\r\n                        if (tprototype == jSWProtocol.ProtoType.HLS) {\r\n                            urlCurrent = jSWOptions.http + url;\r\n                        } else if (tprototype == jSWProtocol.ProtoType.RTMP) {\r\n                            if (bHttpFlv) {\r\n                                urlCurrent = httpFlvHandle.buildUrlFromRtmpUrl(jSWOptions.http, url, useroptions[\"usews\"]);\r\n                            } else {\r\n                                urlCurrent = \"rtmp://\" + jSWOptions.ip + url;\r\n                            }\r\n                        }\r\n                        var hdlgoption = {\r\n                            hdlg: hdlg\r\n                        }\r\n                        chanel._url_chanel = {\r\n                            proto: chanel.swSrcType(hdlgoption),\r\n                            url: urlCurrent\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (options.tag.div != null && !bHttpFlv &&\r\n                    (tprototype == jSWProtocol.ProtoType.HLS ||\r\n                        tprototype == jSWProtocol.ProtoType.RTMP)) {\r\n\r\n                    // rtmp、hls 在给定的div中添加播放器div\r\n                    var div = options.tag.div;\r\n                    var playObjectId = div.bv_uuid + '_0077553'; /**ID附属*/\r\n                    if (document.getElementById(playObjectId) == null) {\r\n                        console.error('not have player');\r\n                        return;\r\n                    }\r\n\r\n                    var live_hls = null;\r\n                    var live_rtmp = null;\r\n\r\n                    if (tprototype == jSWProtocol.ProtoType.HLS) {\r\n                        live_hls = jSWOptions.http + url;\r\n                        if (chanel.ismuti) {\r\n                            dialogparams = {\r\n                                hdlg: dlgparam._hDlg\r\n                            };\r\n                        }\r\n                    } else if (tprototype == jSWProtocol.ProtoType.RTMP) {\r\n                        live_rtmp = \"rtmp://\" + jSWOptions.ip + url;\r\n                        if (chanel.ismuti) {\r\n                            dialogparams = {\r\n                                hdlg: dlgparam._hDlg\r\n                            };\r\n                        }\r\n                    }\r\n\r\n                    var player = videojs(playObjectId, {\r\n                        controlBar: false,\r\n                        controls: false\r\n                    }, function () {\r\n                        if (tprototype == jSWProtocol.ProtoType.HLS) {\r\n                            this.src({\r\n                                type: 'application/vnd.apple.mpegurl',\r\n                                src: live_hls\r\n                            });\r\n                        } else if (tprototype == jSWProtocol.ProtoType.RTMP) {\r\n                            this.src({\r\n                                type: \"rtmp/flv\",\r\n                                src: live_rtmp\r\n                            });\r\n                        }\r\n\r\n                        this.play();\r\n                    });\r\n\r\n                    if (videoChannel != null) {\r\n                        videoChannel._OnNeedSaveVideoPlayer(player);\r\n                    }\r\n\r\n                    if (dlgparam) {\r\n                        dlgparam['Player'] = player;\r\n                    }\r\n\r\n                } else if (bHttpFlv) {\r\n                    httpFlvHandle.CreatePlayer(options.tag.div, urlCurrent, dlgparam);\r\n                    dialogparams = {\r\n                        hdlg: dlgparam._hDlg\r\n                    };\r\n                } else if (tprototype == jSWProtocol.ProtoType.OCX) {\r\n                    dialogparams = {\r\n                        hdlg: dlgparam._hDlg\r\n                    };\r\n                }\r\n            } else {}\r\n\r\n            var orgopt = options.opt;\r\n            if (orgopt && orgopt.useoptions) {\r\n                if (typeof orgopt.useoptions.callback === 'function') {\r\n                    orgopt.useoptions.tag = userdata;\r\n                    orgopt.useoptions.callback(orgopt.useoptions, response, dialogparams);\r\n                }\r\n            }\r\n\r\n            if (orgopt && orgopt.useoptions && orgopt.useoptions.chanel) {\r\n                orgopt.useoptions.chanel.m_live_hls = live_hls;\r\n                orgopt.useoptions.chanel.m_live_rtmp = live_rtmp;\r\n                orgopt.useoptions.chanel.m_live_httpflv = urlCurrent;\r\n            }\r\n\r\n            if (videoChannel) {\r\n                videoChannel._endOpenHasResult(bSuccess);\r\n            }\r\n        },\r\n        afterCloseDlgClearResource: function (parentdiv) {\r\n            if (parentdiv) {\r\n                var playObjectId = parentdiv.bv_uuid + '_0077553'; /**ID附属*/\r\n                var myTempDiv = document.getElementById(playObjectId + \"tempdiv\");\r\n                var playObject = document.getElementById(playObjectId);\r\n                if (playObject != null) {\r\n                    playObject.parentNode.removeChild(playObject);\r\n                    if (myTempDiv != null) {\r\n                        myTempDiv.parentNode.removeChild(myTempDiv);\r\n                    }\r\n                }\r\n\r\n                if (typeof videojs != \"undefined\") {\r\n                    try {\r\n                        var player = videojs(playObjectId);\r\n                        if (player) {\r\n                            player.dispose();\r\n                            this._videoPlayer = null;\r\n                        }\r\n                    } catch (e) {\r\n                        //console.warn(e.message);\r\n                    }\r\n                }\r\n\r\n                playObjectId = parentdiv.bv_uuid + '_0077554'; /**ID附属*/\r\n                playObject = document.getElementById(playObjectId);\r\n                myTempDiv = document.getElementById(playObjectId + \"tempdiv\");\r\n                if (playObject != null) {\r\n                    playObject.parentNode.removeChild(playObject);\r\n                    jSW.SWVideoChanel._Ocx_PlayObjMgr.FreePlayObj(playObject)\r\n                }\r\n\r\n                if (myTempDiv != null) {\r\n                    myTempDiv.parentNode.removeChild(myTempDiv);\r\n                }\r\n\r\n                var ocxeventid = playObjectId + \"ocxeventid\";\r\n                var eleocxevent = document.getElementById(ocxeventid);\r\n                if (eleocxevent) {\r\n                    eleocxevent.parentNode.removeChild(eleocxevent);\r\n                }\r\n            }\r\n        },\r\n        _checkMedia: function (srcMedia, szMedia) {\r\n            var iMaskMedia = 0;\r\n            for (var iindex in szMedia) {\r\n                iMaskMedia |= szMedia[iindex];\r\n            }\r\n            if (srcMedia | iMaskMedia == iMaskMedia) {\r\n                return true;\r\n            }\r\n            return false;\r\n        },\r\n        checkMedia: function (srcMedia) {\r\n            var bresult = false;\r\n            if (jSWOptions.CheckOcx()) {\r\n                bresult = this._checkMedia(srcMedia, [jSW.MEDIADIR.VIDEORECV, jSW.MEDIADIR.AUDIORECV]);\r\n            } else {\r\n                bresult = this._checkMedia(srcMedia, [jSW.MEDIADIR.VIDEORECV]);\r\n            }\r\n            if (!bresult) {\r\n                console.log(\"the media dir you want to view is not support\");\r\n            }\r\n            return bresult;\r\n        }\r\n    },\r\n\r\n    /*\r\n        var options = {\r\n            volume: {\r\n                icapture: ,\r\n                iplay: \r\n            },\r\n            callback: function(options, response){\r\n            },\r\n            tag: tag\r\n        }\r\n    */\r\n    swAlterVolume: function (options) {\r\n        var rc = this._intercom._volumeProxy(function (volume, hdlg) {\r\n\r\n            if (options.volume === undefined) {\r\n                return jSW.RcCode.RC_CODE_E_BVCU_INVALIDARG;\r\n            }\r\n\r\n            if (options.volume.icapture < 0 || options.volume.icapture > 100 ||\r\n                options.volume.iplay < 0 || options.volume.iplay > 100) {\r\n                return jSW.RcCode.RC_CODE_E_BVCU_INVALIDARG;\r\n            }\r\n\r\n            var rc;\r\n            if (jSWOptions.CheckOcx()) {\r\n                var payload = new proto.WEBBVCU.BVCU_DialogControlParam_Render();\r\n                payload.setIplackbackvolume(options.volume.iplay);\r\n                payload.setIcapturevolume(options.volume.icapture);\r\n\r\n                rc = this._commSendProxy(options, function () {\r\n                    return {\r\n                        payload: payload,\r\n                        msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_ALTER_VIDEO_VOLUME,\r\n                        cmd: \"swAlterVolume\",\r\n                        hdlg: hdlg,\r\n                    }\r\n                })\r\n            } else {\r\n\r\n                rc = this._autoDlgProxy(options, function (commonDlg) {\r\n                    var videoEle = commonDlg.getVideoElement()\r\n                    if (videoEle) {\r\n                        videoEle.volume = options.volume.iplay / 100\r\n                        return jSW.RcCode.RC_CODE_S_OK\r\n                    }\r\n                    return jSW.RcCode.RC_CODE_E_FAIL\r\n                })\r\n\r\n                if (rc == jSW.RcCode.RC_CODE_E_NOTFOUND) {\r\n                    rc = jSW.RcCode.RC_CODE_S_OK\r\n                }\r\n\r\n                if (rc == jSW.RcCode.RC_CODE_S_OK) {\r\n                    this.onAlterVolumeOk(volume)\r\n                }\r\n\r\n                jSW.SWVideoChanel.InterCom.delayInvoke(options.callback, rc, options.tag);\r\n            }\r\n\r\n            return rc;\r\n        }, this);\r\n\r\n        return rc;\r\n    },\r\n\r\n\r\n    onAlterVolumeOk: function (volume) {\r\n        this._intercom.setVolume(volume);\r\n    },\r\n\r\n    /*\r\n        options: {\r\n            callback: function(options, response, data){\r\n                data:{\r\n                    icapture: 0,\r\n                    iplay: 0\r\n                }\r\n            },\r\n            tag: tag\r\n        }\r\n    */\r\n    swGetVolume: function (options) {\r\n        var _valume = null;\r\n\r\n        var rc = this._intercom._volumeProxy(function (volume, hdlg) {\r\n            _valume = volume;\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        }, this);\r\n\r\n        if (jSW.RcCode.bSuccess(rc)) {\r\n            jSW.SWVideoChanel.InterCom.delayInvoke(options.callback, jSW.RcCode.RC_CODE_S_OK, options.tag, _valume);\r\n        }\r\n        console.log(\"on get volume ok\");\r\n        return rc;\r\n    },\r\n\r\n    onIntercomOpenOk: function (params) {\r\n        SetProxyCaptureAudioResult(params, this)\r\n        return this._intercom.onOpenHasResult(params)\r\n    },\r\n\r\n    onIntercomCloseOK: function (bresult) {\r\n        this._intercom.onCloseHasResult(bresult);\r\n    },\r\n    onAlterMedirDirOk: function (isvideo, imedir, hdlg) {\r\n        if (isvideo) {\r\n            var commDlg = this._commDlgMgr.get(hdlg);\r\n            if (commDlg) {\r\n                commDlg.onMediaChange(imedir);\r\n            }\r\n        } else {\r\n            this._intercom.onAlterHasResult(imedir);\r\n        }\r\n    },\r\n\r\n\r\n    swOpenCommand: function (options) {\r\n        var CommandOptions = {\r\n            isSendAudio: true,\r\n            isRecvAudio: false,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        }\r\n\r\n        return this.swOpenIntercom(CommandOptions);\r\n    },\r\n\r\n    swCloseCommand: function (options) {\r\n        return this.swCloseIntercom(options);\r\n    },\r\n\r\n    /*\r\n        打开音频对讲\r\n        options:\r\n        {\r\n            callback: funtion(options, response)\r\n            {\r\n                \r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swOpenIntercom: function (options) {\r\n        var rc = this._intercom._openProxy(function (imedia) {\r\n            var dft_options = {\r\n                isSendAudio: true,\r\n                isRecvAudio: true,\r\n                callback: null,\r\n                tag: null\r\n            };\r\n            options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n            var medir = (options.isSendAudio ? jSW.MEDIADIR.AUDIOSEND : jSW.MEDIADIR.ALLNULL) +\r\n                (options.isRecvAudio ? jSW.MEDIADIR.AUDIORECV : jSW.MEDIADIR.ALLNULL);\r\n\r\n            var payload = new proto.WEBBVCU.CommonData();\r\n            payload.setIdata1(medir);\r\n\r\n            return this._commSendProxy(options, function () {\r\n                var dftData = {\r\n                    payload: payload,\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_OPEN_INTERCOM,\r\n                    cmd: \"\",\r\n                    hdlg: -1\r\n                };\r\n                return dftData;\r\n            });\r\n\r\n            return rc;\r\n        }, this);\r\n        return rc;\r\n    },\r\n\r\n    swCloseIntercom: function (options) {\r\n        var rc = this._intercom._closeProxy(function (hdlg) {\r\n            return this._commSendProxy(options, function () {\r\n                var dftData = {\r\n                    payload: null,\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_CLOSE_INTERCOM,\r\n                    cmd: \"\",\r\n                    hdlg: hdlg\r\n                };\r\n                return dftData;\r\n            });\r\n        }, this);\r\n        return rc;\r\n    },\r\n\r\n    //修改音媒体流方向\r\n    swAlterAudioDir: function (options) {\r\n        var rc = this._intercom._alterProxy(function (imedia, hdlg) {\r\n\r\n            var dftRecvAudio = (imedia & jSW.MEDIADIR.AUDIORECV) == jSW.MEDIADIR.AUDIORECV;\r\n            var dftSendAudio = (imedia & jSW.MEDIADIR.AUDIOSEND) == jSW.MEDIADIR.AUDIOSEND;\r\n\r\n            var dft_options = {\r\n                isSendAudio: dftSendAudio,\r\n                isRecvAudio: dftRecvAudio,\r\n                callback: null,\r\n                tag: null\r\n            };\r\n\r\n            options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n            if (options.isRecvAudio == dftRecvAudio && options.isSendAudio == dftSendAudio) {\r\n                console.log(\"i dont't think you should alter video dir, current status is you wished!\");\r\n                return jSW.RcCode.RC_CODE_S_OK;\r\n            }\r\n\r\n            var imedir = (options.isRecvAudio ? jSW.MEDIADIR.AUDIORECV : jSW.MEDIADIR.ALLNULL) +\r\n                (options.isSendAudio ? jSW.MEDIADIR.AUDIOSEND : jSW.MEDIADIR.ALLNULL);\r\n            var payload = new proto.WEBBVCU.CommonData();\r\n            payload.setIdata1(imedir);\r\n\r\n            return this._commSendProxy(options, function () {\r\n                var dftData = {\r\n                    payload: payload,\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_ALTER_AUDIO_DIALOG_DIR,\r\n                    cmd: \"\",\r\n                    hdlg: hdlg\r\n                };\r\n                return dftData;\r\n            });\r\n\r\n        }, this);\r\n\r\n        return rc;\r\n    },\r\n\r\n    swBIsIntercomOpened: function () {\r\n        return this._intercom.bIsOpen();\r\n    },\r\n\r\n    //修改视频媒体流方向\r\n    //hdlg  \r\n    swAlterVideoDir: function (options) {\r\n        if (jSW.CallProtoType.OCX != jSWOptions.calltype) {\r\n            console.error(\"only ocx support Alert, right now!\");\r\n            return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        }\r\n\r\n        var rc = this._autoDlgProxy(options, function (commDlg) {\r\n            if (commDlg == null) {\r\n                return jSW.RcCode.RC_CODE_E_NOTFOUND;\r\n            }\r\n            var curMedia = commDlg.getMedia();\r\n\r\n            var dftRecvVideo = (curMedia & jSW.MEDIADIR.VIDEORECV) == jSW.MEDIADIR.VIDEORECV;\r\n            var dftRecvAudio = (curMedia & jSW.MEDIADIR.AUDIORECV) == jSW.MEDIADIR.AUDIORECV;\r\n            var dft_options = {\r\n                isRecvAudio: dftRecvAudio,\r\n                isRecvVideo: dftRecvVideo,\r\n                div: null,\r\n                callback: null,\r\n                tag: null,\r\n                hDlg: -1\r\n            };\r\n\r\n            options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n            if (options.isRecvAudio == dftRecvAudio && options.isRecvVideo == dftRecvVideo) {\r\n                console.log(\"i dont't think you should alter video dir, current status is your wished!\");\r\n                return jSW.RcCode.RC_CODE_S_OK;\r\n            }\r\n\r\n            var medir = (options.isRecvAudio ? jSW.MEDIADIR.AUDIORECV : jSW.MEDIADIR.ALLNULL) +\r\n                (options.isRecvVideo ? jSW.MEDIADIR.VIDEORECV : jSW.MEDIADIR.ALLNULL);\r\n\r\n            var payload = new proto.WEBBVCU.CommonData();\r\n            payload.setIdata1(medir);\r\n\r\n            options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n            var rc = this._autoDlgSendProxy(options, function (data) {\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_ALTER_VIDEO_DIALOG_DIR,\r\n                    payload: payload,\r\n                    cmd: jSWProtocol.RequestHeader.altervideodir.cmd\r\n                };\r\n            });\r\n\r\n            return rc;\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n           options={\r\n               hdlg: hdlg,\r\n               callbakc: function(sender, response, data){\r\n               },\r\n               tag: Object\r\n           }\r\n\r\n           data: {\r\n                szpath:String,\r\n                ifileleninseconds:Number(秒)\r\n           }\r\n       */\r\n    swGetLocalRecord: function (options) {\r\n        if (jSWOptions.CheckNotOcx()) {\r\n            console.error(\"only ocx support local record\");\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        var rc = this._autoDlgSendProxy(options, function () {\r\n            var dftData = {\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_LOCAL_RECORD,\r\n            };\r\n            return dftData;\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options={\r\n            hdlg: hdlg\r\n            szpath:String,\r\n            ifileleninseconds:Number(秒),\r\n            callbak: function(sender, response, data){\r\n            },\r\n            recordCallback: null,\r\n            tag: Object\r\n        }\r\n    */\r\n    swSetLocalRecord: function (options) {\r\n        if (jSWOptions.CheckNotOcx()) {\r\n            console.error(\"only ocx support local record\");\r\n            return RC_CODE_E_FAIL;\r\n        }\r\n\r\n        var dft_options = {\r\n            szpath: \"\",\r\n            ifileleninseconds: -1,\r\n            callbak: null,\r\n            recordCallback: null,\r\n            tag: null\r\n        };\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var payload = new proto.WEBBVCU.LocalStorage();\r\n        payload.setDir(jSWUtils.string2Uint8Array(options.szpath));\r\n        payload.setIfileleninseconds((Number)(options.ifileleninseconds));\r\n        this._callbackAfterRecordHasResult = options.recordCallback;\r\n\r\n        var rc = this._autoDlgSendProxy(options, function () {\r\n            var dftData = {\r\n                payload: payload,\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_LOCAL_RECORD,\r\n            };\r\n            return dftData;\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options={\r\n            istart:Number,\r\n            ilength:Number(秒),\r\n            callback: function(sender, response){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swSetNruRecord: function (options) {\r\n\r\n        var dft_options = {\r\n            istart: 0,\r\n            ilength: -1,\r\n            imediadir: 0,\r\n            callbak: null,\r\n            recordCallback: null,\r\n            tag: null\r\n        };\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var payload = new proto.BVCU.NRUConfig.ManualRecord();\r\n        payload.setSzid(this._parent._id_pu);\r\n        payload.setIchannelindex(this._id_chanel);\r\n        payload.setBstart(options.istart);\r\n        payload.setIlength(options.ilength);\r\n        payload.setImediadir(options.imediadir);\r\n        //this._callbackAfterRecordHasResult = options.recordCallback;\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent._parent,\r\n            payload: payload,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_SUBMETHOD_NRU_MANUALRECORD,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swGetUrl: function () {\r\n        return this._url_chanel;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'snapshot',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                url: url\r\n            }\r\n        },\r\n        tag: userdata\r\n    };*/\r\n    swSnapshot: function (options) {\r\n        var dft_options = {\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = this._autoDlgSendProxy(options, function () {\r\n            return {\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_SNAPSHOT\r\n            };\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'getptzattr',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                url: url\r\n            }\r\n        },\r\n        tag: userdata\r\n    };*/\r\n    swGetPtzAttr: function (options) {\r\n        if (null == this._parent && this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var dft_options = {\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var bvcuCmd = new jSWProtocol.BVCU_Command(this._parent._id_pu, this._id_chanel);\r\n\r\n        var getPtzAttrCmd = jSWProtocol.RequestHeader.getptzattr;\r\n        var getptzattr_param = new jSWProtocol.JsonParamCommand(session._p_emms, getPtzAttrCmd.requestHeader, bvcuCmd);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.getptzattr.cmd,\r\n            session: session,\r\n            cmd: getPtzAttrCmd.cmd,\r\n            request: getptzattr_param,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n\r\n    swSetPtzAttr: function (options) {\r\n\r\n    },\r\n\r\n    /**var options = {\r\n        ptzCtrl:{\r\n            iPTZCommand: 0,\r\n            bStop: 0,\r\n            iParam1: 0,\r\n            iParam2: 0,\r\n            iParam3: 0\r\n        },\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'ptzctrl',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request\r\n            }\r\n        },\r\n        tag: userdata\r\n    };*/\r\n    swPtzCtrl: function (options) {\r\n        if (null == this._parent && this._parent._parent) {\r\n            console.error('internal error, this._parent is null');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n\r\n\r\n        var dft_options = {\r\n            ptzCtrl: {\r\n                iPTZCommand: 0,\r\n                bStop: 1,\r\n                iParam1: 0,\r\n                iParam2: 0,\r\n                iParam3: 0\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var session = this._parent._parent;\r\n\r\n        var ptz = new proto.BVCU.PUConfig.PTZControl();\r\n\r\n        ptz.setIptzcommand(options.ptzCtrl.iPTZCommand);\r\n        ptz.setBstop(options.ptzCtrl.bStop);\r\n        ptz.setIparam1(options.ptzCtrl.iParam1);\r\n        ptz.setIparam2(options.ptzCtrl.iParam2);\r\n        ptz.setIparam3(options.ptzCtrl.iParam3);\r\n\r\n        var bvcuCmd = new jSWProtocol.BVCU_Command(this._parent._id_pu, this._id_chanel, ptz);\r\n\r\n        var ptzCtrl_param = new jSWProtocol.JsonParamCommand(session._p_emms, proto.WEBBVCU.MSGType.WEB_BVCU_SET_PTZ, bvcuCmd);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.ptzctrl.cmd,\r\n            session: session,\r\n            request: ptzCtrl_param,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _swKeepLiveDlg: function (commDlg) {\r\n        var opts = commDlg.getOpts();\r\n        var rc = this._autoDlgSendProxy(opts, function () {\r\n            return {\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_KEEPALIVE,\r\n                payload: null,\r\n                cmd: jSWProtocol.RequestHeader.keeplive.cmd\r\n            };\r\n        });\r\n        console.log('keeplive chanel: ' + commDlg.getInfo());\r\n        return rc;\r\n    },\r\n\r\n    swKeepLive: function () {\r\n        this._commDlgMgr.each(this._swKeepLiveDlg, this);\r\n\r\n        this._intercom._keep_alive(function (hdlg) {\r\n            var opts = {\r\n                hdlg: hdlg\r\n            };\r\n            this._commSendProxy(opts, function () {\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_KEEPALIVE,\r\n                    payload: null,\r\n                    cmd: jSWProtocol.RequestHeader.keeplive.cmd\r\n                };\r\n            });\r\n        }, this);\r\n    },\r\n\r\n    swHide: function (opts) {\r\n        this._autoDlgProxy(opts, function (commDlg, session, targetid, targetindex) {\r\n            var mdiv = commDlg.getPlayDiv();\r\n            var playObjectId = mdiv + '_0077553'; /**ID附属*/\r\n\r\n            try {\r\n                if (videojs && typeof videojs != \"undefined\") {\r\n                    var player = videojs(playObjectId);\r\n                    if (player) {\r\n                        player.dispose();\r\n                    }\r\n                }\r\n            } catch (e) {\r\n                //console.warn(e.message);\r\n            }\r\n\r\n            var playObject = document.getElementById(playObjectId);\r\n            if (playObject != null) {\r\n                playObject.style.display = 'none';\r\n            }\r\n\r\n            // ocx\r\n            playObjectId = mdiv.bv_uuid + '_0077554'; /**ID附属*/\r\n            playObject = document.getElementById(playObjectId);\r\n            if (playObject != null) {\r\n                playObject.style.display = 'none';\r\n            }\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        });\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    swShow: function (opts) {\r\n        this._autoDlgProxy(opts, function (commDlg, session, targetid, targetindex, hdlg) {\r\n            var mdiv = commDlg.getPlayDiv();\r\n            var prototype = commDlg.getProteType();\r\n            if (prototype == jSWProtocol.ProtoType.HLS || prototype == jSWProtocol.ProtoType.RTMP) {\r\n                var playObjectId = mdiv.bv_uuid + '_0077553'; /**ID附属*/\r\n                var playObject = document.getElementById(playObjectId);\r\n                if (playObject != null) {\r\n                    playObject.style.display = 'block';\r\n                } else {\r\n                    playObject = document.createElement('VIDEO');\r\n                    playObject.setAttribute('id', playObjectId);\r\n                    playObject.setAttribute('class', 'video-js vjs-default-skin vjs-big-play-centered');\r\n                    // playObject.setAttribute('poster', '/js/my_video_poster.png');\r\n                    playObject.style.width = '100%';\r\n                    playObject.style.height = '100%';\r\n                    playObject.style.display = 'block';\r\n\r\n                    mdiv.appendChild(playObject);\r\n                }\r\n\r\n\r\n                try {\r\n                    var chanel = this;\r\n                    var player = videojs(playObjectId, {\r\n                        controlBar: false,\r\n                        controls: false\r\n                    }, function () {\r\n                        if (prototype == jSWProtocol.ProtoType.HLS) {\r\n                            this.src({\r\n                                type: 'application/vnd.apple.mpegurl',\r\n                                src: chanel.m_live_hls\r\n                            });\r\n                        } else if (prototype == jSWProtocol.ProtoType.RTMP) {\r\n                            this.src({\r\n                                type: \"rtmp/flv\",\r\n                                src: chanel.m_live_rtmp\r\n                            });\r\n                        }\r\n                        this.play();\r\n                    });\r\n                } catch (e) {\r\n                    console.warn(e.message);\r\n                }\r\n            } else if (prototype == jSWProtocol.ProtoType.OCX) {\r\n                // ocx\r\n                playObjectId = mdiv.bv_uuid + '_0077554'; /**ID附属*/\r\n                playObject = document.getElementById(playObjectId);\r\n                if (playObject != null) {\r\n                    playObject.style.display = 'block';\r\n                }\r\n                setTimeout(this._updateDialog.bind(this), 500, hdlg);\r\n            }\r\n        });\r\n    },\r\n\r\n    _clear: function () {\r\n        if (this.swBIsIntercomOpened()) {\r\n            this.swCloseIntercom();\r\n        }\r\n        this._commDlgMgr.each(function (commdlg, chanel) {\r\n            if (chanel && commdlg) {\r\n                chanel.swClose(commdlg.getHDlg());\r\n            }\r\n        }, this, this);\r\n    },\r\n\r\n    swClose: function (hdlg) {\r\n        var opts = {\r\n            hdlg: hdlg\r\n        };\r\n        var bNeedCancel = !this._commDlgMgr.CanIDoClose();\r\n        bNeedCancel = false;\r\n        var rc = this._autoDlgSendProxy(opts,\r\n            function (commDlg) {\r\n                var dlgparma = commDlg.getDlgParams();\r\n                var httpflvHandle = jSW.DependencyMgr.GetModule(\"HttpFlv\");\r\n                httpflvHandle.ClosePlayer(commDlg);\r\n                return {\r\n                    msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_CLOSE_CHANLE,\r\n                    payload: dlgparma,\r\n                    cmd: jSWProtocol.RequestHeader.closechanle.cmd,\r\n                    bcancel: bNeedCancel\r\n                };\r\n            },\r\n            function (commDlg) {\r\n                var desplaydiv = commDlg.getPlayDiv();\r\n                this._eventHandle.afterCloseDlgClearResource(desplaydiv);\r\n                this._commDlgMgr.free(commDlg.getHDlg());\r\n                this._closeHasResult(true);\r\n                console.log('close chanel: ' + commDlg.getInfo());\r\n            }\r\n        );\r\n        return rc;\r\n    },\r\n\r\n    compare: function (objChanel) {\r\n        if (this._parent.compare(objChanel._parent)) {\r\n            return (this._id_chanel == objChanel._id_chanel);\r\n        }\r\n        return false;\r\n    }\r\n}\r\n\r\n\r\nfunction SetProxyCaptureAudioResult(params, channel) {\r\n    var origalCb = params.cb\r\n    params.cb = function (rc) {\r\n        if (origalCb) {\r\n            origalCb(rc)\r\n        }\r\n        if (jSW.RcCode.RC_CODE_S_OK != rc) {\r\n            channel.swCloseIntercom()\r\n        }\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/channel/jsw-video.js?");

/***/ }),

/***/ "../src/dialog/jsw-common.js":
/*!***********************************!*\
  !*** ../src/dialog/jsw-common.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\njSW.CommonDlgMgr = function (session) {\r\n    this._session = session;\r\n    this._arraydlg = [];\r\n    this.prototype = -1;\r\n}\r\n\r\njSW.CommonDlgMgr.prototype = {\r\n    push: function (commdlg) {\r\n        var deskey = this.buildKey(commdlg.getHDlg());\r\n        if (commdlg != this._arraydlg[deskey]) {\r\n            this._arraydlg[deskey] = commdlg;\r\n            this._arraydlg.length++;\r\n        }\r\n        this.prototype = commdlg._prototype;\r\n    },\r\n    createAndSave: function (chanel, hDlg) {\r\n        var aimDlg = new jSW.CommonDlg(chanel, hDlg);\r\n        this.push(aimDlg, hDlg);\r\n        return aimDlg;\r\n    },\r\n    get: function (key) {\r\n        var hdlgkey = this.buildKey(key);\r\n        return this._arraydlg[hdlgkey];\r\n    },\r\n    getSession: function () {\r\n        return this._session;\r\n    },\r\n    each: function (dlgHandle, scope, tag) {\r\n        for (iindex in this._arraydlg) {\r\n            if (this._arraydlg[iindex]) {\r\n                if (scope) {\r\n                    if (dlgHandle.bind(scope)(this._arraydlg[iindex], tag)) {\r\n                        break;\r\n                    }\r\n                } else {\r\n                    if (dlgHandle(this._arraydlg[iindex], tag)) {\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    },\r\n    free: function (hdlg) {\r\n        if (this._arraydlg[this.buildKey(hdlg)] != null) {\r\n            this._arraydlg.length--;\r\n        }\r\n        // this._arraydlg.length--;\r\n        this._arraydlg[this.buildKey(hdlg)] = null;\r\n    },\r\n    buildKey: function (hdlg) {\r\n        return \"dlg\" + hdlg;\r\n    },\r\n    getDefault: function () {\r\n        var rcCommDlg = null;\r\n        this.each(function (commDlg) {\r\n            if (rcCommDlg == null) {\r\n                rcCommDlg = commDlg;\r\n                return true;\r\n            }\r\n        });\r\n        return rcCommDlg;\r\n    },\r\n    CanIDoClose: function () {\r\n        if (jSWProtocol.ProtoType.RTMP == this.prototype && this._arraydlg.length > 1) {\r\n            return false;\r\n        }\r\n        return true;\r\n    }\r\n}\r\n\r\njSW.CommonDlg = function (channel, hDlg) {\r\n    this._channel = channel;\r\n    this._hDlg = hDlg;\r\n    this._mdiv = null;\r\n    this._dlgParams = null;\r\n    this._media = 0;\r\n    this._rotate = 0;\r\n    this._prototype = -1;\r\n    this._info = \"\";\r\n    this.bh265 = false;\r\n}\r\n\r\njSW.CommonDlg.prototype = {\r\n    getkey: function () {\r\n        return this._hDlg;\r\n    },\r\n    compare: function (dlg) {\r\n        if (this.getkey() == dlg.getkey()) {\r\n            return true;\r\n        }\r\n        return false;\r\n    },\r\n    getHDlg: function () {\r\n        return this._hDlg;\r\n    },\r\n    getDlgParams: function () {\r\n        if (this._dlgParams == null) {\r\n            this._dlgParams = jSWProtocol.BVCU_DialogParam(this._channel._parent._id_pu, this._channel._id_chanel, 0, this._prototype, 0, 0, this._hDlg);\r\n        }\r\n        return this._dlgParams;\r\n    },\r\n    getPlayDiv: function () {\r\n        return this._mdiv;\r\n    },\r\n    setParams: function (div, hdlg, media, prototype) {\r\n        this._mdiv = div;\r\n        this._hDlg = hdlg;\r\n        this._media = media;\r\n        this._prototype = prototype;\r\n    },\r\n    getMedia: function () {\r\n        return this._media;\r\n    },\r\n    getRotate: function () {\r\n        return this._rotate;\r\n    },\r\n    setRotate: function (val) {\r\n        this._rotate = val;\r\n    },\r\n    getProteType: function () {\r\n        return this._prototype;\r\n    },\r\n    getOpts: function (opts) {\r\n        if (!opts) {\r\n            opts = {\r\n                hdl: -1\r\n            };\r\n        }\r\n        opts.hdlg = this._hDlg;\r\n        return opts;\r\n    },\r\n    getInfo: function () {\r\n        if (this._info == \"\") {\r\n            this._info = this._channel._parent._id_pu + ' ' + this._channel._id_chanel + ' ' + this._hDlg;\r\n        }\r\n        return this._info;\r\n    },\r\n    onMediaChange: function (imedia) {\r\n        this._media = imedia;\r\n    },\r\n    _reset: function () {\r\n        this._media = 0;\r\n    },\r\n    setHdlg: function (hDlg) {\r\n        this._hDlg = hDlg;\r\n    },\r\n    getVideoElement: function(){\r\n        if(this._prototype == jSWProtocol.ProtoType.HLS ||\r\n            this._prototype == jSWProtocol.ProtoType.RTMP){\r\n            if(this._dlgParams._mdiv && this._dlgParams._mdiv.getElementsByTagName(\"video\")){\r\n                return this._dlgParams._mdiv.getElementsByTagName(\"video\")[0]\r\n            }\r\n        }\r\n        return null\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/dialog/jsw-common.js?");

/***/ }),

/***/ "../src/dialog/jsw-intercom.js":
/*!*************************************!*\
  !*** ../src/dialog/jsw-intercom.js ***!
  \*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\njSW.SWVideoChanel.InterComStatus = function () {\r\n    this._status = jSW.SWVideoChanel.InterComStatus.Types.INIT;\r\n}\r\n\r\njSW.SWVideoChanel.InterComStatus.Types = {\r\n    INIT: 0,\r\n    DOING: 1,\r\n    DONE: 2\r\n};\r\n\r\njSW.SWVideoChanel.InterComStatus.prototype = {\r\n    reset: function () {\r\n        this._status = jSW.SWVideoChanel.InterComStatus.Types.INIT;\r\n    },\r\n    setDoing: function () {\r\n        this._status = jSW.SWVideoChanel.InterComStatus.Types.DOING;\r\n    },\r\n    setDone: function () {\r\n        this._status = jSW.SWVideoChanel.InterComStatus.Types.DONE;\r\n    },\r\n    bInit: function () {\r\n        if(jSWOptions.CheckHttp()){\r\n            return false\r\n        }\r\n\r\n        return jSW.SWVideoChanel.InterComStatus.Types.INIT == this._status;\r\n    },\r\n    bDoing: function () {\r\n        return jSW.SWVideoChanel.InterComStatus.Types.DOING == this._status;\r\n    },\r\n    bDone: function () {\r\n        return jSW.SWVideoChanel.InterComStatus.Types.DONE == this._status;\r\n    }\r\n}\r\n\r\njSW.SWVideoChanel.InterCom = function (channel) {\r\n    this.status = new jSW.SWVideoChanel.InterComStatus();\r\n    this._commDlg = new jSW.CommonDlg(channel);\r\n    this._channel = channel;\r\n    this._volume = {\r\n        icapture: 50,\r\n        iplay: 50\r\n    };\r\n}\r\n\r\njSW.SWVideoChanel.InterCom.delayInvoke = function (cb, rc, tag, data) {\r\n    var opts = {\r\n        tag: tag\r\n    };\r\n    var response = {\r\n        emms: {\r\n            code: rc\r\n        }\r\n    };\r\n    if (data) {\r\n        setTimeout(cb, 50, opts, response, data);\r\n    } else {\r\n        setTimeout(cb, 50, opts, response);\r\n    }\r\n}\r\n\r\njSW.SWVideoChanel.InterCom.prototype = {\r\n    _getCurMedia: function () {\r\n        return this._commDlg.getMedia();\r\n    },\r\n    _getHdlg: function () {\r\n        return this._commDlg.getHDlg();\r\n    },\r\n    _openProxy: function (handle, scope) {\r\n        // if (!jSWOptions.CheckOcx()) {\r\n        //     console.log(\"only ocx support intercom\");\r\n        //     return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        // }\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL;\r\n        if (this.status.bDone()) {\r\n            console.log(\"intercom has opened, can not be open twice! you can call swAlterAudioDir to change medir dir or close it try again!\");\r\n            return jSW.RcCode.RC_CODE_E_ALREADYEXIST;\r\n        } else if (this.status.bDoing()) {\r\n            return jSW.RcCode.RC_CODE_E_BUSY;\r\n        } else {\r\n            this.status.setDoing();\r\n            rc = handle.bind(scope)(this._getCurMedia());\r\n            if (jSW.RcCode.bFaild(rc)) {\r\n                this.status.reset();\r\n            }\r\n            return rc;\r\n        }\r\n    },\r\n\r\n    _closeProxy: function (handle, scope) {\r\n        // if (!jSWOptions.CheckOcx()) {\r\n        //     console.log(\"only ocx support intercom\");\r\n        //     return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        // }\r\n\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL;\r\n        if (this.status.bInit()) {\r\n            return jSW.RcCode.RC_CODE_E_NOTFOUND;\r\n        } else if (this.status.bDoing()) {\r\n            return jSW.RcCode.RC_CODE_E_BUSY;\r\n        } else {\r\n            this.status.setDoing();\r\n            rc = handle.bind(scope)(this._getHdlg());\r\n            if (jSW.RcCode.bFaild(rc)) {\r\n                this.status.setDone();\r\n            }\r\n            return rc;\r\n        }\r\n    },\r\n    _alterProxy: function (handle, scope) {\r\n        // if (!jSWOptions.CheckOcx()) {\r\n        //     console.log(\"only ocx support intercom\");\r\n        //     return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        // }\r\n\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL;\r\n        if (this.status.bInit()) {\r\n            return jSW.RcCode.RC_CODE_E_NOTFOUND;\r\n        } else if (this.status.bDoing()) {\r\n            return jSW.RcCode.RC_CODE_E_BUSY;\r\n        } else {\r\n            rc = handle.bind(scope)(this._getCurMedia(), this._getHdlg());\r\n            if (jSW.RcCode.bFaild(rc)) {}\r\n            return rc;\r\n        }\r\n    },\r\n    _volumeProxy: function (handle, scope) {\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL;\r\n        if (this.status.bInit()) {\r\n            return jSW.RcCode.RC_CODE_E_NOTFOUND;\r\n        } else if (this.status.bDoing()) {\r\n            return jSW.RcCode.RC_CODE_E_BUSY;\r\n        } else {\r\n            rc = handle.bind(scope)(this.__getVolume(), this._getHdlg());\r\n            if (jSW.RcCode.bFaild(rc)) {}\r\n            return rc;\r\n        }\r\n    },\r\n\r\n    __getVolume: function () {\r\n        var volume = {\r\n            icapture: this._volume.icapture,\r\n            iplay: this._volume.iplay\r\n        };\r\n        return volume;\r\n    },\r\n\r\n    setVolume: function (volume) {\r\n        this._volume = {\r\n            icapture: volume.icapture,\r\n            iplay: volume.iplay\r\n        };\r\n    },\r\n\r\n    _clear: function (handle, scope) {\r\n        if (this.status.bDone()) {\r\n            handle.bind(scope)(this._getHdlg());\r\n            this._reset();\r\n        }\r\n    },\r\n    _keep_alive: function (handle, scope) {\r\n        if (this.status.bDone()) {\r\n            handle.bind(scope)(this._getHdlg());\r\n        }\r\n    },\r\n    _reset: function () {\r\n        this.status.reset();\r\n        this._commDlg._reset();\r\n    },\r\n    _check_media_has_audio_send: function (imedia) {\r\n        return ((imedia & jSW.MEDIADIR.AUDIOSEND) == jSW.MEDIADIR.AUDIOSEND);\r\n    },\r\n    onAlterHasResult: function (imedia) {\r\n        if (this._check_media_has_audio_send(imedia)) {\r\n            AudioMgr.StartAudio();\r\n        } else {\r\n            AudioMgr.StopAudio();\r\n        }\r\n        this._commDlg.onMediaChange(imedia);\r\n        this.status.setDone();\r\n    },\r\n    onOpenHasResult: function (params) {\r\n        var bresult = params.bresult;\r\n        \r\n        if (bresult) {\r\n            var iMedia = params.iMedia, hDlg = params.hDlg\r\n            this._commDlg.onMediaChange(iMedia);\r\n            this._commDlg.setHdlg(hDlg);\r\n            this.status.setDone();\r\n            if (bresult) {\r\n                if (this._check_media_has_audio_send(iMedia)) {\r\n                    AudioMgr.StartAudio(params);\r\n                }\r\n            }\r\n        } else {\r\n            this._reset();\r\n            return jSW.RcCode.RC_CODE_E_FAIL\r\n        }\r\n        return jSW.RcCode.RC_CODE_S_OK\r\n    },\r\n    onCloseHasResult: function (bresult) {\r\n        this._reset();\r\n        if (bresult) {\r\n            AudioMgr.StopAudio();\r\n        }\r\n    },\r\n    bIsOpen: function () {\r\n        return this.status.bDone();\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/dialog/jsw-intercom.js?");

/***/ }),

/***/ "../src/entity/jsw-pu.js":
/*!*******************************!*\
  !*** ../src/entity/jsw-pu.js ***!
  \*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\n// ---- SWPu ----\r\njSW.SWPu = function (parent, puinfo) {\r\n    this._parent = parent;\r\n    this._innerCommUpdata(puinfo);\r\n    jSWUtils.debugLogInfo(this._info_pu.id + \"\" + \"v:\" + this._arr_channel.length + \",g\" + this._arr_gps.length);\r\n};\r\n\r\njSW.SWPu.SATELLITE = {\r\n    GPS: (1 << 0), //美国GPS卫星\r\n    BDS: (1 << 1), //中国北斗卫星\r\n    GLONASS: (1 << 2), //俄罗斯格洛纳斯卫星\r\n    GALILEO: (1 << 3), //欧洲伽利略卫星\r\n    QZSS: (1 << 4) //日本准天顶卫星\r\n};\r\n\r\njSW.SWPu.prototype = {\r\n    swReboot: function () {\r\n        return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            istart: Boolean,\r\n            ilength: Number(存储时间长度，单位秒， -1表示一直录像),\r\n            callback: function(sender, response, data){\r\n            },\r\n            tag: tag\r\n        }\r\n    */\r\n    swSetPuManualrecord: function (options) {\r\n        var payload = new proto.BVCU.PUConfig.ManualRecord();\r\n\r\n        var dft_options = {\r\n            isstart: 1,\r\n            ilength: -1,\r\n            szFileName: \"\",\r\n            callback: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        payload.setBstart(options.isstart);\r\n        payload.setIlength(jSWProtocol.Int2Uint(options.ilength));\r\n        payload.setSzfilename(options.szFileName)\r\n\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_MANUALRECORD,\r\n            target: this._id_pu,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * options = {\r\n     *  callback: function(options, response, data){\r\n     *  },\r\n     *  tag: \r\n     * }\r\n     */\r\n    swGetPuRecordStatus: function(options){\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_RECORDSTATUS,\r\n            target: this._id_pu,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    swPuControl: function (options) {\r\n        var rc = jSWProtocol.CheckOptions(proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_REBOOT_OR_SHUTDOWN, options);\r\n        if (rc != jSW.RcCode.RC_CODE_S_OK) {\r\n            return rc;\r\n        }\r\n\r\n        var payload = new proto.WEBBVCU.PU_CONTROL();\r\n        payload.setIoption(options.ioption);\r\n\r\n        rc = jSWProtocol.SendRequest({\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_REBOOT_OR_SHUTDOWN,\r\n            target: this._id_pu,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            istart: 1-开始抓拍，0-停止抓拍 2-按指定周期数抓拍,\r\n            icyclecount: // 指定的抓拍周期数，当iStart==2 时有意义,\r\n            szftpid: // 抓拍图片上传服务器ID，如果ID为空，表示不需要上传。,\r\n            callback: function(sender, response, data){\r\n            },\r\n            tag: Object\r\n        };\r\n    */\r\n    swSetPuSnapshot: function (options) {\r\n        var payload = new proto.BVCU.PUConfig.Snapshot();\r\n\r\n        var dft_options = {\r\n            istart: 0,\r\n            icyclecount: 0,\r\n            szftpid: null,\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        payload.setBstart(options.istart);\r\n        payload.setIcyclecount(options.icyclecount);\r\n        payload.setSzftpid(options.szftpid);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_SNAPSHOT,\r\n            target: this._id_pu,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swGetChanel: function (chanelId) {\r\n        for (var i = 0; i < this._arr_channel.length; i++) {\r\n            if (this._arr_channel[i]._id_chanel == chanelId) {\r\n                return this._arr_channel[i];\r\n            }\r\n        }\r\n\r\n        for (var i = 0; i < this._arr_gps.length; i++) {\r\n            if (this._arr_gps[i]._id_chanel == chanelId) {\r\n                return this._arr_gps[i];\r\n            }\r\n        }\r\n\r\n        for (var i = 0; i < this._arr_tsp.length; i++) {\r\n            if (this._arr_tsp[i]._id_chanel == chanelId) {\r\n                return this._arr_tsp[i];\r\n            }\r\n        }\r\n\r\n        return null;\r\n    },\r\n\r\n    /**\r\n     * File: https://developer.mozilla.org/en-US/docs/Web/API/File,\r\n     * Remote Path,\r\n     * pcallback: progress,\r\n     * callback: callback\r\n     */\r\n    swUploadFirmware: function (options) {\r\n\r\n        var dft_options = {\r\n            pcallback: null\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n\r\n        var rfp = options.file;\r\n        var rmfp = options.remotepath;\r\n\r\n        if (jSWOptions.calltype == jSW.CallProtoType.OCX) {\r\n            if (rfp) {\r\n\r\n                if (rfp.indexOf(\"C:\\\\fakepath\\\\\") == 0) {\r\n                    console.error(\"file path error\")\r\n                } else {\r\n                    var payload = new proto.WEBBVCU.DownFileFromPu();\r\n                    payload.setSzlocalfilepathname(rfp);\r\n\r\n                    if(rmfp){\r\n                        payload.setSzremotefilepathname(rmfp);\r\n                    }\r\n                    \r\n    \r\n                    rc = jSWProtocol.SendRequest({\r\n                        payload: payload,\r\n                        msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_UPLOAD_FILE_TONRU,\r\n                        session: this._parent,\r\n                        target: this._id_pu,\r\n                        callback: options.callback,\r\n                        callbackrelay: options.pcallback,\r\n                        tag: options.tag\r\n                    })\r\n                }\r\n            }    \r\n        }else{\r\n            rc = HTTPNruFile.UploadToRoot(rfp, function(){\r\n\r\n            }, function(rc, nruid, path, iFileSize, tag){\r\n\r\n                if(path.indexOf('/') == 0){\r\n                    path = path.slice(1)\r\n                }\r\n\r\n\r\n                if(options.pcallback){\r\n                    options.pcallback({tag: options.tag}, {emms:{code: rc}}, {\r\n                        sEvent:{\r\n                            iEvent:  jSW.FileTransEvent.FILE_TRANS_CLOSE,\r\n                            iResult: rc,\r\n                            szRemoteFilePath: path,\r\n                            szLocalFilePath: path,\r\n                            nruid: nruid\r\n                        },\r\n                        sProgressInfo: null\r\n                    })\r\n                }\r\n\r\n                if(options.callback){\r\n                    options.callback({tag: options.tag}, {emms:{code: rc}})\r\n                }\r\n            });\r\n        }\r\n\r\n        return rc;\r\n    },\r\n\r\n    swUpgradeFirmware: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL\r\n\r\n        var dft_options = {\r\n            szNruId: \"\",\r\n            szFilePath: \"\",\r\n            szFileName: \"\",\r\n            bPromptly: true, //是否立即升级\r\n            callback: null,\r\n            tag: null\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var payload = new proto.BVCU.PUConfig.Upgrade()\r\n\r\n        payload.setSzftpid(options.szNruId)\r\n        payload.setSzfilepath(options.szFilePath)\r\n        payload.setSzfilename(options.szFileName)\r\n\r\n        payload.setBpromptly(options.bPromptly ? 1 : 0)\r\n\r\n        rc = jSWProtocol.SendRequest({\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_UPGRADE,\r\n            target: this._id_pu,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        })\r\n\r\n        return rc\r\n    },\r\n\r\n    swGetUpdateStatus: function (options) {\r\n        var rc = jSWProtocol.SendRequest({\r\n            target: this._id_pu,\r\n            session: this._parent,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_UPDATESTATUS,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        })\r\n        return rc\r\n    },\r\n\r\n    _innerCommUpdata: function (puinfo) {\r\n        var chanellist = puinfo.pchannelList;\r\n        this._info_pu = {\r\n            bootduration: puinfo.ibootduration,\r\n            boottime: jSWProtocol.Walltime2Json(puinfo.stboottime),\r\n            chanelcount: chanellist.length,\r\n            chanellist: [],\r\n            id: puinfo.szid,\r\n            lat: puinfo.ilatitude,\r\n            long: puinfo.ilongitude,\r\n            name: puinfo.szpuname,\r\n            onlinestatus: puinfo.ionlinestatus,\r\n            onlinethrough: puinfo.ionlinethrough,\r\n            onlinetime: jSWProtocol.Walltime2Json(puinfo.stonlinetime)\r\n        };\r\n        this._id_pu = this._info_pu.id;\r\n        this._name_pu = this._info_pu.name;\r\n\r\n        this._arr_channel = [];\r\n        this._arr_gps = [];\r\n        this._arr_tsp = [];\r\n\r\n        var chanelRecord = null;\r\n        for (var i = 0; i < chanellist.length; i++) {\r\n            var chanelType = jSWProtocol.ChanelType.getType(chanellist[i].ichannelindex);\r\n            if (chanelType == jSWProtocol.ChanelType.chanel) {\r\n                var chanel = new jSW.SWVideoChanel(this, chanellist[i]);\r\n                this._arr_channel.push(chanel);\r\n                chanelRecord = chanel;\r\n            } else if (chanelType == jSWProtocol.ChanelType.gps) {\r\n                var gps = new jSW.SWGPSChanel(this, chanellist[i]);\r\n                this._arr_gps.push(gps);\r\n                chanelRecord = gps;\r\n            } else if (chanelType == jSWProtocol.ChanelType.tsp) {\r\n                var tsp = new jSW.SWTSPChanel(this, chanellist[i]);\r\n                this._arr_tsp.push(tsp);\r\n                chanelRecord = tsp;\r\n            }\r\n            this._info_pu.chanellist.push(chanelRecord);\r\n        }\r\n\r\n        jSWUtils.debugLogInfo(this._info_pu.id + \"\" + \"v:\" + this._arr_channel.length + \",g\" + this._arr_gps.length);\r\n    },\r\n\r\n    _internalUpdate: function (options) {\r\n\r\n        if (options.ionlinestatus == 0) {\r\n            this._clear();\r\n        }\r\n\r\n        this._innerCommUpdata(options);\r\n    },\r\n\r\n    compare: function (objPu) {\r\n        if (this._parent.compare(objPu._parent)) {\r\n            return (this._id_pu == objPu._id_pu);\r\n        }\r\n\r\n        return false;\r\n    },\r\n\r\n    _clear: function () {\r\n\r\n        for (var i = 0; i < this._arr_channel.length; i++) {\r\n            this._arr_channel[i]._clear();\r\n        }\r\n\r\n        for (var i = 0; i < this._arr_gps.length; i++) {\r\n            if (this._arr_gps[i]._info_chanel.status == 0) {\r\n                this._arr_gps[i].swClose();\r\n            }\r\n        }\r\n\r\n        for (var i = 0; i < this._arr_tsp.length; i++) {\r\n            if (this._arr_tsp[i]._info_chanel.status == 0) {\r\n                this._arr_tsp[i].swClose();\r\n            }\r\n        }\r\n    }\r\n};\n\n//# sourceURL=webpack:///../src/entity/jsw-pu.js?");

/***/ }),

/***/ "../src/entity/jsw-session.js":
/*!************************************!*\
  !*** ../src/entity/jsw-session.js ***!
  \************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\n// ---- SWSession ----\r\n/**options: {\r\n    server: '127.0.0.1',\r\n    port: 9701,\r\n    onopen: null, // function(sess) { }\r\n    onclose: null, // function(sess, evt) { }\r\n   } */\r\njSW.SWSession = function (options) {\r\n\r\n    jSW.swDeInit();\r\n\r\n    var dft_options = {\r\n        server: '127.0.0.1',\r\n        port: 9701,\r\n        onopen: null,\r\n        onclose: null\r\n    };\r\n\r\n    options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n    jSW.SWSession._init(this, options);\r\n\r\n    jSW.SWSession._CreateWs(this, options);\r\n};\r\n\r\njSW.SWSession._GetSessionById = function(sessionId){\r\n    \r\n}\r\n\r\njSW.SWSession._init = function (session, options) {\r\n    session._server = ((jSWOptions.ip != options.server) || jSWUtils.isIE()) ? options.server : \"127.0.0.1\"; //jSWUtils.isIE() ? options.server : \"127.0.0.1\";\r\n    session._port = Number(options.port);\r\n\r\n    session._arr_pu = [];\r\n    session._arr_pu_index = [];\r\n    session._arr_pu_offline = []\r\n    session._arr_pu_online = [],\r\n    session._arr_dialog = [];\r\n    session._arr_record_play = [];\r\n\r\n    session._p_emms = new proto.WEBBVCU.EmmsHeader();\r\n    session._p_emms.setKey(jSWOptions.appkey);\r\n    session._p_emms.setVer(jSWOptions.version);\r\n    session._emms = new jSWProtocol.EmmsHeader(jSWOptions.appkey, jSWOptions.version);\r\n    session._bLogout = false;\r\n\r\n    session._callbackManager = new jSW.SWCallbackManager(session, [\r\n        jSWProtocol.RequestHeader.notifys.notify.cmd,\r\n        jSWProtocol.RequestHeader.login.cmd,\r\n        jSWProtocol.RequestHeader.keeplive.cmd,\r\n        jSWProtocol.RequestHeader.logout.cmd,\r\n        jSWProtocol.RequestHeader.pulist.cmd,\r\n        jSWProtocol.RequestHeader.openchanle.cmd,\r\n        jSWProtocol.RequestHeader.keeplivechanle.cmd,\r\n        jSWProtocol.RequestHeader.closechanle.cmd,\r\n        jSWProtocol.RequestHeader.pugpsdata.cmd,\r\n        jSWProtocol.RequestHeader.lossconnection.cmd\r\n    ]);\r\n\r\n    session._pusModule = new jSW.SWSession._SwPuModule(session);\r\n    session._confManager = new jSW.SwConfManager(session);\r\n    session._immodule = new jSW.SWSession.SwImModule(session, session._confManager, session._pusModule);\r\n    session._userManager = new jSW.SwUserManager(session);\r\n    session._commDlgMgr = new jSW.CommonDlgMgr(session);\r\n}\r\n\r\njSW.SWSession._CreateWs = function (session, options) {\r\n    try {\r\n        jSWUtils._mMgr.loadWebSocket(function (session, options, MyWs) {\r\n            try {\r\n                var url = jSWProtocol.GetWsUrl();\r\n                session._ws = new MyWs(url);\r\n                session._checkWsCreateResult(options);\r\n            } catch (e) {\r\n                session._onWsError(options, e);\r\n            }\r\n        }, session, options);\r\n\r\n    } catch (e) {\r\n        this._onWsError(options, e);\r\n        return;\r\n    }\r\n}\r\n\r\njSW.SWSession._SwPuModule = function (session) {\r\n    this._session = session;\r\n}\r\n\r\njSW.SWSession._SwPuModule.prototype = {\r\n    _onNotifyImMsg: function (imInfo, response) {\r\n        var cmd = jSWProtocol.RequestHeader.confnotify.notifyimmsg.cmd;\r\n        var sender = {\r\n            \"szSourceId\": imInfo.szSourceId,\r\n            \"iSourceId\": imInfo.iSourceId\r\n        };\r\n        data = {\r\n            sender: sender,\r\n            szmsgs: imInfo.szmsg\r\n        }\r\n        this._notifytouser(response, cmd, data);\r\n    },\r\n    _notifytouser: function (response, cmd, data) {\r\n        this._session._callbackManager.dispatchCallback(\"notify\", {\r\n            code: response.getCode(),\r\n            response: response,\r\n            msg: cmd,\r\n            content: data\r\n        })\r\n    }\r\n};\r\n\r\njSW.SWSession.prototype = {\r\n    _OnOpenGpsChannel: function(targetId, targetIndex, resultCode, hDlg){\r\n        var pu = this.swGetPu(targetId)\r\n        if(pu){\r\n            var channel = pu.swGetChanel(targetIndex)\r\n            if(channel){\r\n                channel._OnOpenGpsHasResult(resultCode, hDlg)\r\n            }\r\n        }\r\n    },\r\n\r\n    _OnNotifyGpsData: function(targetId, targetIndex, gpsData){\r\n        var pu = this.swGetPu(targetId)\r\n        if(pu){\r\n            var channel = pu.swGetChanel(targetIndex)\r\n            if(channel){\r\n                channel._tickGpsData(gpsData)\r\n            }\r\n        }\r\n    },\r\n\r\n    _checkWsCreateResult: function (options) {\r\n        if (null == this._ws) {\r\n            console.error('http websoket error null');\r\n            this._onWsError(options, e);\r\n            return;\r\n        } else {\r\n            this._onWsCreateOk(options);\r\n            jSWUtils._mMgr.oWsOpen(this._ws);\r\n        }\r\n    },\r\n\r\n    _onServerDisconnect: function(){\r\n        {\r\n            //this._bLogout = true\r\n\r\n            this._releaseActiveChannel();\r\n            \r\n            this._callbackManager.dispatchCallback(jSWProtocol.RequestHeader.lossconnection.cmd, {\r\n                code: 0,\r\n                response: {},\r\n                msg: jSWProtocol.RequestHeader.lossconnection.cmd,\r\n                content: null\r\n            })\r\n        }\r\n    },\r\n\r\n    _onWsCreateOk: function (options) {\r\n\r\n        if (jSWOptions.session_list.indexOf(this) == -1) {\r\n            jSWOptions.session_list.push(this);\r\n        }\r\n\r\n        var __session = this;\r\n        var __options = options;\r\n        console.log('websoket connect ...');\r\n        this._ws.onopen = function () {\r\n            console.log('http websoket connect success!');\r\n\r\n            if (__options.onopen && (typeof __options.onopen) === 'function') {\r\n                __options.onopen(__session);\r\n            }\r\n        };\r\n        this._ws.onerror = function (e) {\r\n            __session._ws = null;\r\n            __session._onWsError(__options, e);\r\n        };\r\n\r\n        this._ws.onmessage = function (msg) {\r\n            jSWProtocol.txOnResponse(-1, msg.data);\r\n        };\r\n\r\n        this._ws.onclose = function (e) {\r\n            __session._ws = null;\r\n            console.log(\"http websoket connect closed:\" + e.code + ' reason: ' + e.reason);\r\n\r\n            this._doReconnect(function(){\r\n                __session.swLogout()\r\n            })\r\n\r\n            if (__options.onclose && (typeof __options.onclose) === 'function') {\r\n                __options.onclose(__session, e)\r\n            }\r\n        };\r\n\r\n        this._ws._doReconnect = function (afterReconnectFail) {\r\n\r\n            //not log out\r\n            if (__session._bLogout == false) {\r\n                if (__session._emms.session.length > 0) {\r\n                    console.log(\"session stay login\")\r\n                    \r\n                    var timeLast = this._time_last_check()\r\n\r\n                    if (timeLast > 0) {\r\n                        console.log(\"test then should reconnect\")\r\n                        this._doReconnectTimerAction(__session, timeLast, function(tempWs){\r\n                            tempWs._statusReset()\r\n                        })\r\n                    } else {\r\n                        console.log(\"try login spend too much time, endpoint of server maybe released. stop reconnecting and notify caller\")\r\n                        this._statusReset()        \r\n                        afterReconnectFail()\r\n                    }\r\n                }else{\r\n                    console.log(\"session did not login, should not reconnect\")    \r\n                }\r\n            } else {\r\n                console.log(\"session has logout, should not reconnect\")\r\n                this._statusReset()\r\n            }\r\n        }\r\n\r\n        this._ws._time_last_check = function(){\r\n            var maxReConnectTimes = __session._serverConfig.sessionidletime / 1000 \r\n            if(typeof __options._reConnectTimes == \"undefined\"){\r\n                return (maxReConnectTimes + 1)\r\n            }\r\n            var timeLast = (Date.parse(new Date()) / 1000) - __options._reConnectTimes\r\n            return (maxReConnectTimes - timeLast)\r\n        }\r\n\r\n        this._ws._statusReset = function(){\r\n            __options._reConnectTimes = -1;\r\n            if(__options._extendTag){\r\n                __options = __options._extendTag\r\n            }\r\n        }\r\n\r\n        this._ws._doReconnectTimerAction = function(desTempSession, alreadyTimes, openCallback){\r\n\r\n            console.log(\"timer ticked, try to reconnect\");\r\n\r\n            if(__options && typeof __options._bReConnect == \"undefined\"){\r\n\r\n                __options = {\r\n                    _reConnectTimes: -1,\r\n                    _bReConnect: true,\r\n                    _extendTag: __options,\r\n                    onopen: function (_desSession) {\r\n                        console.log(\"connected to ws server, reset connect times\")\r\n                        openCallback(desTempSession._ws)\r\n                        jSWProtocol.SendRequest({\r\n                            session: _desSession,\r\n                            msgtype: proto.WEBBVCU.MSGType.WEB_REREG_WEBSOCKET_COMMAND\r\n                        })\r\n                    }\r\n                }\r\n            }\r\n\r\n            if(__options._reConnectTimes == -1){\r\n                __options._reConnectTimes = Date.parse(new Date()) / 1000;\r\n            }\r\n\r\n            setTimeout(function (tempSession) {\r\n\r\n                jSW.SWSession._CreateWs(tempSession, __options)\r\n\r\n            }, 1000, desTempSession)\r\n            console.log(\"timer reconnect action \" + alreadyTimes)\r\n        }\r\n\r\n        this._ws._doCheckBReconnect = function () {\r\n            if (__options && __options._bReConnect) {\r\n                return true\r\n            }\r\n            return false\r\n        }\r\n    },\r\n\r\n    _onWsError: function (options, e) {\r\n        console.error('http websoket error' + e);\r\n        if (options.onclose && (typeof options.onclose) === 'function') {\r\n            options.onclose(this, e);\r\n        }\r\n    },\r\n\r\n    swSetGlobalControlParam: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n        if (jSWOptions.CheckOcx()) {\r\n            if (typeof options[\"Idelayvssmooth\"] == undefined) {\r\n                return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n            }\r\n            var payload = new proto.WEBBVCU.ParamsDialogControl();\r\n            payload.setIdelayvssmooth(options[\"Idelayvssmooth\"]);\r\n\r\n            var rc = jSWProtocol.SendRequest({\r\n                session: this,\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_GLOBAL_DIALOG_PARAM,\r\n                payload: payload,\r\n                callback: options.callback,\r\n                tag: options.tag\r\n            });\r\n\r\n            return rc;\r\n        }\r\n        return rc;\r\n    },\r\n\r\n    swImSend: function (options) {\r\n        if (options.msgitems) {\r\n\r\n        } else if (options.filepath) {\r\n            if (!options.targetid || options.targetid.indexOf(\"PU\") == -1) {\r\n                console.log(\"target id invalidarg\");\r\n                return jSW.RcCode.RC_CODE_E_BVCU_INVALIDARG;\r\n            }\r\n\r\n            options.msgitems = [{\r\n                nruid: \"NRU_\",\r\n                iType: jSWProtocol.IMMSGTypes.FILE,\r\n                data: options.filepath\r\n            }];\r\n        } else {\r\n            return jSW.RcCode.RC_CODE_E_BVCU_INVALIDARG;\r\n        }\r\n\r\n        var rc = this._immodule._swConfIMSend(options, proto.WEBBVCU.MSGType.WEB_BVCU_CONF_IM_MSG);\r\n        return rc;\r\n    },\r\n\r\n    swImRecv: function (options) {\r\n        if (!options.targetid || options.targetid.indexOf(\"PU\") == -1) {\r\n            console.log(\"target id invalidarg\");\r\n            return jSW.RcCode.RC_CODE_E_BVCU_INVALIDARG;\r\n        }\r\n        options.msgitems = [{\r\n            nruid: options.nruid,\r\n            iType: jSWProtocol.IMMSGTypes.FILE,\r\n            data: options.remotepath\r\n        }];\r\n        var rc = this._immodule._SwConfFileRecv(options);\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * options: {\r\n     *  szFilePath: 文件路径\r\n     * }\r\n     */\r\n    swOpenFileInDir: function (options) {\r\n        if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n            return jSW.RcCode.RC_CODE_E_BVCU_UNSUPPORTED;\r\n        }\r\n\r\n        if (jSW.CallProtoType.OCX != jSWOptions.calltype) {\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n        var payload = options.szFilePath;\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_UTILS_OPEN_FILE_IN_DIR,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _send: function (data) {\r\n        var ws = this._ws;\r\n\r\n        if (ws == null) {\r\n            console.error('websocket is null, current calltype ' + ((jSWOptions.CheckOcx()) ? 'ocx' : 'http'));\r\n            return jSW.RcCode.RC_CODE_E_DISCONNECTED;\r\n        }\r\n\r\n        if (!this._ws.OPEN) {\r\n            this._ws.OPEN = 1;\r\n        }\r\n        if (ws.readyState != this._ws.OPEN) {\r\n            console.warn('websocket not connection');\r\n            return jSW.RcCode.RC_CODE_E_DISCONNECTED;\r\n        }\r\n\r\n        if (this._bLogout) {\r\n            return jSW.RcCode.RC_CODE_E_BVCU_DISCONNECTED;\r\n        }\r\n\r\n        try {\r\n            ws.send(data);\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        } catch (e) {\r\n            return jSW.RcCode.RC_CODE_E_DISCONNECTED;\r\n        }\r\n    },\r\n\r\n    /** 注册回调\r\n    swAddCallBack('login', function (sender, event, json) {\r\n        json.code、 json.request、json.response、json.msg\r\n    })*/\r\n    swAddCallBack: function (event, callback) {\r\n        this._callbackManager.addCallback(event, callback);\r\n\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    /*\r\n    options = {\r\n        callback: function(option, response, data){\r\n        },\r\n        tag: {\r\n        }\r\n    }\r\n    */\r\n    swGetVersion: function (options) {\r\n        if (jSWOptions.CheckHttp()) {\r\n            setTimeout(function () {\r\n                options.callback(options, {}, {\r\n                    szprototype: \"HTTP\",\r\n                    szversionid: jSW[\"version\"].SdkVer\r\n                })\r\n            }, 50)\r\n            return rc;\r\n        } else {\r\n            var request = new proto.WEBBVCU.Request();\r\n            request.setMsgtype(proto.WEBBVCU.MSGType.WEB_GET_VERSION_INFO);\r\n            request.setEmms(this._p_emms);\r\n\r\n            var rc = jSWProtocol._internalSend({\r\n                session: this,\r\n                request: request,\r\n                callback: options.callback,\r\n                enforce: true\r\n            });\r\n            return rc;\r\n        }\r\n    },\r\n\r\n    /**登录*/\r\n    /**options: {\r\n        user: 'admin',\r\n        password: '123456'\r\n       } */\r\n    swLogin: function (poptions) {\r\n        var dft_poptions = {\r\n            user: 'admin',\r\n            password: '123456'\r\n        };\r\n\r\n        poptions = jSWUtils.extend({}, dft_poptions, poptions || {});\r\n        this._user = poptions.user;\r\n\r\n        var pubkeyCallback = function (options, response) {\r\n            var tag = options.tag;\r\n            var url = response.url;\r\n            var request = options.request; {\r\n                var session = options.session;\r\n                session.p_options = options;\r\n                session.p_response = response;\r\n            }\r\n            if (response.getCode() == jSW.RcCode.RC_CODE_S_OK) {\r\n                var payload = response.getPayload();\r\n                var pubkey = proto.WEBBVCU.PublicKey.deserializeBinary(payload);\r\n\r\n                this.pubkey_d = pubkey.getD();\r\n                this.pubkey_n = pubkey.getN();\r\n\r\n                var session = options.session;\r\n\r\n                // 登录\r\n                var request = new proto.WEBBVCU.Request();\r\n                request.setMsgtype(proto.WEBBVCU.MSGType.WEB_BVCU_LOGIN);\r\n                request.setEmms(session._p_emms);\r\n\r\n                var loginParam = new proto.WEBBVCU.BVCU_LOGIN();\r\n                loginParam.setServer(session._server);\r\n                loginParam.setPort(Number(session._port));\r\n                loginParam.setUser(session._user);\r\n                loginParam.setPassword(poptions.password);\r\n                request.setPayload(loginParam.serializeBinary());\r\n\r\n                jSWProtocol._internalSend({\r\n                    cmd: jSWProtocol.RequestHeader.login.cmd,\r\n                    session: session,\r\n                    request: request\r\n                });\r\n\r\n                console.log(\"login info:\" + session._server + \":\" + (session._port) + \"user\" + session._user);\r\n            }\r\n        };\r\n\r\n        // 公钥\r\n\r\n        var request = new proto.WEBBVCU.Request();\r\n        request.setMsgtype(proto.WEBBVCU.MSGType.WEB_BVCU_GET_PUBKEY);\r\n        request.setEmms(this._p_emms);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.pubkey.cmd,\r\n            session: this,\r\n            request: request,\r\n            callback: pubkeyCallback\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /**退出*/\r\n    swLogout: function () {\r\n\r\n        this._releaseActiveChannel();\r\n\r\n        this._arr_pu_index = [];\r\n        this._arr_pu.splice(0, this._arr_pu.length);\r\n        this._arr_dialog.splice(0, this._arr_dialog.length);\r\n\r\n        // 取消session、dialog保活\r\n        if (this._timer_keeplive) {\r\n            clearInterval(this._timer_keeplive);\r\n            this._timer_keeplive = null;\r\n        }\r\n\r\n        var param = new jSWProtocol.JsonParamNoAttach(this._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_LOGOUT);\r\n\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.logout.cmd,\r\n            session: this,\r\n            request: param\r\n        });\r\n\r\n        var sessionList = jSWOptions.session_list;\r\n        var session = null;\r\n        var i = 0;\r\n        for (i = 0; i < sessionList.length; i++) {\r\n            session = sessionList[i];\r\n            if (session == this) {\r\n                jSWOptions.session_list.splice(i, 1);\r\n                this._bLogout = true;\r\n                break;\r\n            }\r\n        }\r\n\r\n        if (this._confManager != null) {\r\n            this._confManager._clear();\r\n            this._confManager = null\r\n        }\r\n\r\n        this._confManager = null;\r\n        this._immodule = null;\r\n        this._pusModule = null;\r\n        this._commDlgMgr = null;\r\n        this._userManager = null;\r\n        //this._callbackManager = null;\r\n\r\n        this._arr_pu = null\r\n        this._arr_pu_index = null\r\n        this._arr_pu_offline = null\r\n        this._arr_pu_online = null\r\n        this._arr_dialog = []\r\n        this._arr_record_play = []\r\n\r\n        this._p_emms = null\r\n        this._emms = null\r\n        this._serverConfig = null\r\n        this.p_options = null\r\n        this.p_response = null\r\n\r\n        this.swDispose()\r\n        return rc;\r\n    },\r\n\r\n    _releaseActiveChannel: function(){\r\n        // 关闭已经打开的视频通道\r\n        for (var i = 0; i < this._arr_dialog.length; i++) {\r\n            this._arr_dialog[i].swClose();\r\n        }\r\n        // 关闭PU需要关闭的资源\r\n        for (var i = 0; i < this._arr_pu.length; i++) {\r\n            this._arr_pu[i]._clear();\r\n        }\r\n    },\r\n\r\n    /**保活*/\r\n    swKeepLive: function () {\r\n        var keepliveCmd = jSWProtocol.RequestHeader.keeplive;\r\n\r\n        var param = new jSWProtocol.JsonParamNoAttach(this._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_KEEPALIVE);\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.keeplive.cmd,\r\n            session: this,\r\n            request: param\r\n        });\r\n\r\n        console.log('keeplive session: ' + this._server + ' ' + this._port);\r\n        return rc;\r\n    },\r\n\r\n    /**获取设备列表*/\r\n    /**var options = {\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'pulist',\r\n                request: param,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                pulist: BVCU_PUCFG_PUChannelInfo[]\r\n            }\r\n        },\r\n        tag: userdata,\r\n        status: 1, // 1: 在线; 2:离线; 3:全部\r\n        pagesize: 0, //每页的数量(0表示全部)\r\n        page: 0 //获取第几页, 从0开始\r\n    };*/\r\n    swGetPuList: function (options) {\r\n        var dft_options = {\r\n            status: 3,\r\n            pagesize: 0,\r\n            page: 0\r\n        };\r\n\r\n        var rc = this._AutoReqSendProxy(options, dft_options, function (opts) {\r\n            var payload = jSWProtocol.ParamPuList(opts.status, opts.pagesize, opts.page);\r\n            return {\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SEARCH_GET_PULIST,\r\n                target: 'CMS_',\r\n                payload: payload,\r\n                cmd: jSWProtocol.RequestHeader.pulist.cmd\r\n            };\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * {\r\n     *  iPostition: 起始位置，\r\n     *  iCount: 数量\r\n     * }\r\n     */\r\n    swSearchPuList: function (options) {\r\n        return PuLoad.SearchGetPulist(options, options.callback, options.tag);\r\n    },\r\n\r\n    /**\r\n     * szpuid: String 设备ID\r\n     */\r\n    _swAsyncGetPu: function (options) {\r\n        if (!options.szpuid || options.szpuid.length == 0) {\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n        var rc = this._AutoReqSendProxy(options, {}, function (opts) {\r\n            return {\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_PUINFO_BY_PUID,\r\n                target: opts.szpuid\r\n            };\r\n        });\r\n        console.log('async get pu list');\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * pGA promise get args\r\n     */\r\n    _AutoReqSendProxy: function (options, dft_opts, pGA) {\r\n        if (!dft_opts) {\r\n            dft_opts = {};\r\n        }\r\n        if (!options) {\r\n            options = {};\r\n        }\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL;\r\n        options = jSWUtils.extend({}, dft_opts, options || {});\r\n        var dft_args = {\r\n            session: this,\r\n            msgtype: -1,\r\n            target: \"\",\r\n            targetIndex: -1,\r\n            payload: null,\r\n            cmd: \"\",\r\n            callback: options.callback ? options.callback : null,\r\n            tag: options.tag ? options.tag : null\r\n        };\r\n        var des_args = pGA.bind(this)(options);\r\n        des_args = jSWUtils.extend({}, dft_args, des_args || {});\r\n        rc = jSWProtocol.SendRequest(des_args);\r\n        return rc;\r\n    },\r\n\r\n    /**查询NRU上的文件*/\r\n    swSearch: function (options) {\r\n        return this._searchFile(options, \"NRU_\");\r\n    },\r\n\r\n    /*\r\n     *   options = {\r\n            szNRUID: NRUID,\r\n            remoteFilePath: 远程文件路径,\r\n            localFilePath: 本地路径,\r\n            callback: function(options, response){\r\n            },\r\n            tag: Object\r\n        }\r\n     */\r\n    swDownFileFromNru: function (options) {\r\n        // if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n        //     alert('Just OCX support!!');\r\n        //     return jSW.RcCode.RC_CODE_E_FAIL;\r\n        // }\r\n\r\n        var dft_options = {\r\n            pcallback: null\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = this._swDownFileSearch({\r\n            szRFP: options.remoteFilePath,\r\n            szLFD: options.localFileDir,\r\n            szTargetId: options.szNRUID,\r\n            msgType: proto.WEBBVCU.MSGType.WEB_BVCU_DOWN_FILE_ONNRU,\r\n            callback: options.callback,\r\n            callbackrelay: options.pcallback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n    var options = {\r\n        stSearchInfo: {\r\n            iType: 1(BVCU_SEARCH_TYPE_FILE),\r\n            iPostition: 0,\r\n            iCount: 50\r\n        },\r\n        stFilter: {\r\n            szPUID: 'PU_00002710',\r\n            iChannelIndex: -1,\r\n            iFileSizeMin: 0,\r\n            iFileSizeMax: 0,\r\n            iRecordType: 0,\r\n            iFileType: 0,   BVCU_STORAGE_FILE_TYPE_ALL = 0(不限定文件类型),\r\n                            BVCU_STORAGE_FILE_TYPE_RECORD = 1 << 0(录像文件)\r\n                            BVCU_STORAGE_FILE_TYPE_CAPTURE = 1 << 1(图片文件)\r\n                            BVCU_STORAGE_FILE_TYPE_GPS = 1 << 2(固件文件)\r\n                            BVCU_STORAGE_FILE_TYPE_AUDIO = 1 << 3(音频文件)\r\n                            BVCU_STORAGE_FILE_TYPE_FIRMWARE = 1 << 8(GPS文件, 暂时不支持)\r\n            iTimeBegin: 0,\r\n            iTimeEnd: 0\r\n        },\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                pulist: BVCU_PUCFG_PUChannelInfo[]\r\n            }\r\n        },\r\n        tag: userdata,\r\n    };*/\r\n    _searchFile: function (options, szTarget) {\r\n        var dft_options = {\r\n            stSearchInfo: {\r\n                iType: 1,\r\n                iPostition: 0,\r\n                iCount: 50\r\n            },\r\n            stFilter: {\r\n                szPUID: '',\r\n                iChannelIndex: -1,\r\n                iFileType: 0,\r\n                iTimeCondition: 0,\r\n                iTimeBegin: 0,\r\n                iTimeEnd: 0,\r\n                iFileSizeMin: 0,\r\n                iFileSizeMax: 0,\r\n                iRecordType: 0,\r\n                szDesc1: \"\",\r\n                szDesc2: \"\"\r\n            },\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n        options.stSearchInfo = jSWUtils.extend({}, dft_options.stSearchInfo, options.stSearchInfo || {});\r\n        options.stFilter = jSWUtils.extend({}, dft_options.stFilter, options.stFilter || {});\r\n\r\n        var payload = jSWProtocol.ParamSearchList(options.stSearchInfo, options.stFilter);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            cmd: jSWProtocol.RequestHeader.searchlist.cmd,\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_SEARCH_LIST,\r\n            target: szTarget,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n\r\n    swDelRecordFileFilter: function (options) {\r\n        var dft_options = {\r\n            stFilter: {\r\n                szPUID: '',\r\n                iChannelIndex: -1,\r\n                iFileType: 0,\r\n                iTimeCondition: 0,\r\n                iTimeBegin: 0,\r\n                iTimeEnd: 0,\r\n                iFileSizeMin: 0,\r\n                iFileSizeMax: 0,\r\n                iRecordType: 0,\r\n                szDesc1: \"\",\r\n                szDesc2: \"\"\r\n            },\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n        options.stFilter = jSWUtils.extend({}, dft_options.stFilter, options.stFilter || {});\r\n\r\n        var fun = function (pstFilter) {\r\n            var search = new proto.BVCU.NRUConfig.DeleteFileReq();\r\n            var filefilter = new proto.BVCU.Search.Search_FileFilter();\r\n\r\n            filefilter.setSzpuid(pstFilter.szPUID);\r\n            filefilter.setIchannelindex(pstFilter.iChannelindex);\r\n            filefilter.setIfiletype(pstFilter.iFileType);\r\n            filefilter.setItimebegin(pstFilter.iTimeBegin);\r\n            filefilter.setItimeend(pstFilter.iTimeEnd);\r\n            filefilter.setIfilesizemin(pstFilter.iFileSizeMin);\r\n            filefilter.setIfilesizemax(pstFilter.iFileSizeMax);\r\n            filefilter.setIrecordtype(pstFilter.iRecordType);\r\n            filefilter.setSzdesc1(pstFilter.szDesc1);\r\n            filefilter.setSzdesc2(pstFilter.szDesc2);\r\n            filefilter.setItimecondition(pstFilter.iTimeCondition);\r\n\r\n            search.setItype(1); /** 1: BVCU_NRU_DELFILE_TYPE_FILES 2: BVCU_NRU_DELFILE_TYPE_FILEIDS */\r\n            search.setIcount(1)\r\n            search.addStfilefilters(filefilter);\r\n            return search;\r\n        }\r\n\r\n        var payload = fun(options.stFilter);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            cmd: jSWProtocol.RequestHeader.recordfile_del.cmd,\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_RECORDFILE_DELETE,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swDelRecordFileFilterId: function (options) {\r\n        var dft_options = {\r\n            stFileIds: [],\r\n            /** [{'nruid': 'xxx', 'recordid': 123}, {'nruid': 'xxx', 'recordid': 124}] */\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n        if (!options.stFileIds) {\r\n            options.stFileIds = [];\r\n        }\r\n\r\n        var fun = function (fileIds) {\r\n            var search = new proto.BVCU.NRUConfig.DeleteFileReq();\r\n            search.setItype(2); /** 1: BVCU_NRU_DELFILE_TYPE_FILES 2: BVCU_NRU_DELFILE_TYPE_FILEIDS */\r\n\r\n            for (var i = 0; i < fileIds.length; i++) {\r\n                var fileid = new proto.BVCU.NRUConfig.FileID();\r\n                fileid.setSzsourceid(fileIds[i].nruid)\r\n                fileid.addIrecordid(fileIds[i].recordid);\r\n\r\n                search.addStfileidfilters(fileid);\r\n            }\r\n\r\n            return search;\r\n        };\r\n\r\n        var payload = fun(options.stFileIds);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            cmd: jSWProtocol.RequestHeader.recordfile_del.cmd,\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_RECORDFILE_DELETE,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n\r\n    /** 检索设备上的文件*/\r\n    swSearchFileOnPu: function (options) {\r\n        if (options == null || options.stFilter == null || options.stFilter.szPUID == null || options.stFilter.szPUID.length == 0) {\r\n            console.warn('bad args, please check!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n        var rc = this._searchFile(options, options.stFilter.szPUID);\r\n        return rc;\r\n    },\r\n\r\n    /** 从设备上下载文件\r\n        options = {\r\n            szPUID: 设备ID,\r\n            remoteFilePath: 远程文件路径,\r\n            localFilePath: 本地路径,\r\n            callback: function(){},\r\n            pcallback: function(){}\r\n            tag: Object\r\n        }\r\n    */\r\n    swDownFileFromPu: function (options) {\r\n        // if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n        //     alert('Just OCX support!!');\r\n        //     return jSW.RcCode.RC_CODE_E_FAIL;\r\n        // }\r\n\r\n        var dft_options = {\r\n            pcallback: null\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var rc = this._swDownFileSearch({\r\n            szRFP: options.remoteFilePath,\r\n            szLFD: options.localFileDir,\r\n            szTargetId: options.szPUID,\r\n            msgType: proto.WEBBVCU.MSGType.WEB_BVCU_DOWN_FILE_ONPU,\r\n            callback: options.callback,\r\n            callbackrelay: options.pcallback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /**\r\n     * ocx下载文件 \r\n     * options: {\r\n     *      szRFP, \r\n     *      szLFD, \r\n     *      szTargetId, \r\n     *      callback,\r\n     *      msgType, \r\n     *      tag\r\n     * }\r\n     */\r\n    _swDownFileSearch: function (options) {\r\n        var rc = jSW.RcCode.RC_CODE_E_FAIL\r\n\r\n        if (jSWOptions.CheckNotOcx()) {\r\n\r\n            rc = HTTPNruFile.DownloadToLocal(options.szTargetId, options.szRFP)\r\n\r\n            if (options.callback) {\r\n                options.callback({\r\n                    tag: options.tag\r\n                }, {\r\n                    emms: {\r\n                        code: rc\r\n                    }\r\n                })\r\n            }\r\n\r\n        } else {\r\n\r\n            if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n                alert('Just OCX support!!');\r\n                return jSW.RcCode.RC_CODE_E_FAIL;\r\n            }\r\n\r\n            if (options == null || options.szTargetId == null || options.szTargetId.length == 0 ||\r\n                options.szRFP == null || options.szRFP.length == 0 || options.szLFD == null || options.szLFD.length == 0) {\r\n                console.warn('bad args, please check!');\r\n                return jSW.RcCode.RC_CODE_E_FAIL;\r\n            }\r\n\r\n            var payload = new proto.WEBBVCU.DownFileFromPu();\r\n\r\n            var rfp = options.szRFP;\r\n            if (options.szTargetId.indexOf(\"NRU\") == 0) {\r\n                rfp = options.szRFP.replace(/\\//g, \"\\\\\");\r\n            }\r\n            payload.setSzremotefilepathname(rfp);\r\n            payload.setSzlocalfilepathname(options.szLFD);\r\n            rc = jSWProtocol.SendRequest({\r\n                session: this,\r\n                msgtype: options.msgType,\r\n                target: options.szTargetId,\r\n                payload: payload,\r\n                callback: options.callback,\r\n                callbackrelay: options.callbackrelay,\r\n                tag: options.tag\r\n            });\r\n        }\r\n        return rc;\r\n    },\r\n\r\n\r\n    /**\r\n     * options: {\r\n     *  stSearchInfo: BVCU_SearchInfo,\r\n     *  iTimeBegin: 录像文件开始时刻，从1970-01-01 00:00:00 +0000 (UTC)开始的秒数,\r\n     *  iTimeEnd:   录像文件结束时刻，从1970-01-01 00:00:00 +0000 (utc)开始的秒数,\r\n     *  szPuid: 设备名称,\r\n     *  callback: functions(options, response, data){\r\n     *      data: OptionsSearchResult\r\n     *  }\r\n     *  tag: Object\r\n     * }\r\n     */\r\n    swSearchGpsV2: function (options) {\r\n        var stFilter = new jSWProtocol.BVCU_Search_FileFilter(options.szPuid, -1, options.iTimeBegin, options.iTimeEnd, 4, 0, 0, 0);\r\n        var rc = this.swSearch({\r\n            stSearchInfo: options.stSearchInfo,\r\n            stFilter: stFilter,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options=\r\n        {\r\n            szNruId: nruid,\r\n            szFilePath: swSearchGps2获取的Gps文件路径,\r\n            callback: function(options, response, data){\r\n                data:{\r\n                    fileinfo:{\r\n                        szFilePath: String,\r\n                        szFileName: String,\r\n                        iTime: Number,\r\n                        iFileSize: Number \r\n                    },\r\n                    data: String GPS文件\r\n                }\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetGpsRecordDataV2: function (options) {\r\n        var rc = this._swGetGpsRecordData(options, proto.WEBBVCU.MSGType.WEB_BVCU_DOWNLOAD_GPS_RECORD_SERVERC);\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options=\r\n        {\r\n            szNruId: nruid,\r\n            iTimeBegin: 录像文件开始时刻，从1970-01-01 00:00:00 +0000 (UTC)开始的微秒数,\r\n            iTimeEnd:   录像文件结束时刻，从1970-01-01 00:00:00 +0000 (utc)开始的微秒数\r\n            szPuid: 设备名称,\r\n            callback: function(options, response, data)\r\n            {\r\n                data:[\r\n                    {\r\n                        szFilePath: String,\r\n                        szFileName: String,\r\n                        iTime: Number,\r\n                        iFileSize: Number \r\n                    },.....\r\n                ]\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swSearchGps: function (options) {\r\n\r\n        if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n            alert('Just OCX support!!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        if (options.szNruId == null || options.szNruId.length == 0) {\r\n            console.warn('nruid should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        if (options.iTimeBegin == null || options.iTimeEnd == null) {\r\n            console.warn('time slice should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        var _pu = this._swGetPu(options.szPuid);\r\n        if (_pu == null || options.szPuid == null || options.szPuid.length == 0) {\r\n            console.warn('puid should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        options.iTimeBegin = (Number)(options.iTimeBegin);\r\n        options.iTimeEnd = (Number)(options.iTimeEnd);\r\n\r\n        if (options.iTimeBegin >= options.iTimeEnd) {\r\n            console.warn('time slice should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        var payload = new proto.WEBBVCU.RecordFileFilter();\r\n        payload.setSzpuid(options.szPuid);\r\n        payload.setItimebegin(options.iTimeBegin);\r\n        payload.setItimeend(options.iTimeEnd);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_GPS_RECORD,\r\n            target: options.szNruId,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options=\r\n        {\r\n            szNruId: nruid,\r\n            szFilePath: swSearchGps获取的Gps文件路径,\r\n            callback: function(options, response, data){\r\n                data:{\r\n                    fileinfo:{\r\n                        szFilePath: String,\r\n                        szFileName: String,\r\n                        iTime: Number,\r\n                        iFileSize: Number \r\n                    },\r\n                    data: String GPS文件\r\n                }\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetGpsRecordData: function (options) {\r\n        var rc = this._swGetGpsRecordData(options, proto.WEBBVCU.MSGType.WEB_BVCU_DOWNLOAD_GPS_RECORD, true);\r\n        return rc;\r\n    },\r\n\r\n    _swGetGpsRecordData: function (options, iMsgType, bOnlyOcx) {\r\n        if (bOnlyOcx && jSWOptions.CheckNotOcx()) {\r\n            alert('Just OCX support!!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n\r\n        if (options.szNruId == null || options.szNruId.length == 0) {\r\n            console.warn('nruid should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        if (options.szFilePath == null || options.szFilePath.length == 0) {\r\n            console.warn('file path should be invalid!');\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        var rc;\r\n\r\n        if (jSWOptions.CheckNotOcx()) {\r\n\r\n            HTTPNruFile.Download(options.szNruId, options.szFilePath, 0, function (iStatus, data, tag) {\r\n                var gpsData = [];\r\n                if (iStatus == 200) {\r\n                    var gpsXmlDoc = (new DOMParser()).parseFromString(jSWProtocol.LargeHexToString(data), \"application/xml\");\r\n                    console.log(gpsXmlDoc)\r\n                    var gpsDataItem = null;\r\n                    var puNode = null\r\n                    var child = gpsXmlDoc.children[0].children\r\n                    var numberTemp = null\r\n                    for (var iiNode = 0; iiNode < child.length; iiNode++) {\r\n                        puNode = child[iiNode]\r\n                        gpsDataItem = {}\r\n\r\n                        if(puNode.attributes.length == 1){\r\n                            continue\r\n                        }\r\n\r\n                        for (var ii = 0; ii < puNode.attributes.length; ii++) {\r\n                            numberTemp = Number(puNode.attributes[ii].nodeValue)\r\n\r\n                            if (Number.isNaN(numberTemp)) {\r\n                                gpsDataItem[puNode.attributes[ii].nodeName] = puNode.attributes[ii].nodeValue\r\n                            } else {\r\n                                gpsDataItem[puNode.attributes[ii].nodeName] = numberTemp\r\n                            }\r\n                        }\r\n                        gpsDataItem[\"long\"] = gpsDataItem.lng\r\n                        gpsData.push(gpsDataItem)\r\n                    }\r\n                }\r\n\r\n                if (options.callback) {\r\n                    var dRc = iStatus == 200 ? jSW.RcCode.RC_CODE_S_OK : jSW.RcCode.RC_CODE_E_FAIL\r\n                    options.callback({\r\n                        tag: options.tag\r\n                    }, {\r\n                        emms: {\r\n                            code: dRc\r\n                        }\r\n                    }, {\r\n                        fileinfo: {},\r\n                        gpsdata:{\r\n                            szgpspoint:gpsData\r\n                        },\r\n                        data: gpsData\r\n                    })\r\n                }\r\n\r\n            }, null)\r\n\r\n        } else {\r\n\r\n            var payload = new proto.WEBBVCU.FTPFileInfo();\r\n            var rgpsPath = options.szFilePath.replace(/\\//g, \"\\\\\");\r\n            payload.setSzfilepath(jSWUtils.string2Uint8Array(rgpsPath));\r\n\r\n            rc = jSWProtocol.SendRequest({\r\n                session: this,\r\n                msgtype: iMsgType,\r\n                target: options.szNruId,\r\n                payload: payload,\r\n                callback: options.callback,\r\n                tag: options.tag\r\n            })\r\n\r\n        }\r\n\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            callback: function(sender, response, data){\r\n                data:{\r\n                    szid: nString,\r\n                    szname: String,\r\n                    istoragemedia: Number,\r\n                    ionlinestatus: Number\r\n                }\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetNruList: function (options) {\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_NRU_LIST,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /** 查询录像回放 */\r\n    swGetRecordPlayer: function (dialogId) {\r\n\r\n        for (var i = 0; i < this._arr_record_play.length; i++) {\r\n            player = this._arr_record_play[i];\r\n            if (player && player._dialog_id == dialogId) {\r\n                return player;\r\n            }\r\n        }\r\n\r\n        console.log('swGetRecordPlayer not found, dialogId: ' + dialogId)\r\n        return null;\r\n    },\r\n\r\n    /** 查询录像回放 */\r\n    _swGetRecordPlayer: function (playerId) {\r\n\r\n        for (var i = 0; i < this._arr_record_play.length; i++) {\r\n            player = this._arr_record_play[i];\r\n            if (player && player._player_id == playerId) {\r\n                return player;\r\n            }\r\n        }\r\n\r\n        console.log('_swGetRecordPlayer not found, playerId: ' + playerId)\r\n        return null;\r\n    },\r\n\r\n    /** 删除 */\r\n    _swDelRecordPlayer: function (dialogId) {\r\n        for (var i = 0; i < this._arr_record_play.length; i++) {\r\n            player = this._arr_record_play[i];\r\n            if (player && player._dialog_id == dialogId) {\r\n                this._arr_record_play[i] = null;\r\n                return true;\r\n            }\r\n        }\r\n\r\n        return false;\r\n    },\r\n\r\n    /**\r\n     * 录像回放控制*/\r\n    swRecordPlayCtrl: function (options) {\r\n        var dft_options = {\r\n            cmdtype: 'PLAY', // \"PLAY\"、\"PAUSE\"、\"TEARDOWN\"、\"STEP\"\r\n            dialogId: 0,\r\n            ntp_begin: -1,\r\n            ntp_end: -1,\r\n            scale: -1,\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        var payload = new proto.WEBBVCU.MSG_WEB_BVCU_RECORD_PLAY_CRTL(); {\r\n            payload.setCmdtype(options.cmdtype);\r\n            payload.setDialogid(options.dialogId);\r\n            payload.setNtpBegin(options.ntp_begin);\r\n            payload.setNtpEnd(options.ntp_end);\r\n            payload.setScale(options.scale);\r\n        }\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_RECORD_PLAY_CRTL,\r\n            cmd: jSWProtocol.RequestHeader.recordplay.play.cmd,\r\n            target: options.dialogId,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n\r\n    },\r\n\r\n    /* 录像回放\r\n        options = {\r\n            url: null,\r\n            nru: null,\r\n            video: true, // 是否播放video\r\n            audio: true, // 是否播放audio\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n    */\r\n    swRecordPlay: function (options) {\r\n        var dft_options = {\r\n            url: null,\r\n            nru: null,\r\n            video: true,\r\n            audio: true,\r\n            callback: null,\r\n            div: null,\r\n            time_begin: -1,\r\n            time_end: -1,\r\n            bWindowless: false\r\n        };\r\n\r\n        if (jSWOptions.calltype != jSW.CallProtoType.OCX) {\r\n            alert('Just support ocx Video!!');\r\n            return jSW.RcCode.RC_CODE_E_BVCU_BADSTATE;\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n        if (options.url == null || options.url.length == 0) {\r\n            console.error('url error: ' + options.url);\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var player_bar = null;\r\n        if (typeof options.div === \"string\") {\r\n            options.div = document.getElementById(options.div);\r\n        }\r\n        var div = options.div;\r\n        if (null == div) {\r\n            console.error('no have div');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if (typeof (div.bv_uuid) == \"undefined\") {\r\n            div.bv_uuid = jSWUtils.generateUUID();\r\n        }\r\n\r\n        // 创建 ocx播放 实例\r\n        var playObject = null\r\n        {\r\n            var playObjectId = div.bv_uuid + '_0077554';\r\n            /**ID附属*/\r\n            var myTempDivId = playObjectId + \"tempdiv\";\r\n            playObject = document.getElementById(playObjectId);\r\n            if (playObject == null) {\r\n                var mydiv = document.getElementById(myTempDivId);\r\n                var bardiv = null;\r\n                if (mydiv == null) {\r\n                    mydiv = document.createElement(\"div\");\r\n                    mydiv.id = playObjectId + \"tempdiv\";\r\n                    mydiv.style.width = '100%';\r\n                    mydiv.style.height = 'calc(100% - 20px)';\r\n\r\n                    bardiv = document.createElement('div');\r\n                    bardiv.id = playObjectId + \"tempdiv_playbar\";\r\n                    bardiv.style.width = '100%';\r\n                    bardiv.style.backgroundColor = '#555';\r\n                    mydiv.databardiv = bardiv;\r\n                }\r\n                mydiv.style.display = 'block';\r\n                bardiv = mydiv.databardiv;\r\n                div.appendChild(mydiv);\r\n                div.appendChild(bardiv); {\r\n                    player_bar = new jQuery.TigerPlayer();\r\n                    player_bar.addBar($('#' + bardiv.id), 1000 * 60, function (player) {\r\n                        player.swPlay();\r\n                    }, function (player) {\r\n                        player.swPause();\r\n                    }, function (player) {\r\n                        player.swClose();\r\n                    }, function (player, offset_ms) {\r\n                        player.swJump({\r\n                            ntp_begin: offset_ms\r\n                        });\r\n                    });\r\n                }\r\n\r\n\r\n                playObject = jSW.SWVideoChanel._Ocx_PlayObjMgr.GetPlayObj(options.bWindowless)\r\n\r\n                playObject.tag = this;\r\n                playObject.id = playObjectId;\r\n                mydiv.appendChild(playObject);\r\n\r\n                isNeedDelay = true;\r\n\r\n                var playBackOScriptId = playObjectId + \"script_handler\"\r\n                var oScript = document.getElementById(playBackOScriptId)\r\n                if (oScript == null) {\r\n                    oScript = document.createElement(\"script\");\r\n                    oScript.id = playBackOScriptId\r\n                    oScript.type = \"text/javascript\";\r\n                    oScript.setAttribute('for', playObjectId);\r\n                    oScript.setAttribute('event', 'OnHwndEvent(hwnd, ieventtype, pParam)');\r\n                    oScript.text = 'jSW._swOcxPlayerOnEvent(ieventtype, this.tag);';\r\n                    document.body.appendChild(oScript);\r\n                    div.bv_playBackOScriptId = playBackOScriptId\r\n                    div.playObjectId = playObjectId\r\n                }\r\n                playObject.data_player_bar = player_bar;\r\n            } else {\r\n                player_bar = playObject.data_player_bar;\r\n                console.warn('have element : ' + playObjectId)\r\n            }\r\n        }\r\n\r\n        function sendCmd(p_session, p_options, p_playObject, parentDiv, p_player_bar) {\r\n            var player_id = jSWUtils.generateUUID();\r\n\r\n            var payload = new proto.WEBBVCU.MSG_WEB_BVCU_RECORD_PLAY();\r\n            payload.setFilepath(p_options.url);\r\n            payload.setNruid(p_options.nru);\r\n            payload.setVideo(p_options.video ? 1 : 0);\r\n            payload.setAudio(p_options.audio ? 1 : 0);\r\n            payload.setBwindowless(p_options.bWindowless);\r\n            payload.setStarttime(0);\r\n            payload.setEndtime(-1);\r\n            payload.setHwnd(0);\r\n            payload.setAutoplay(0);\r\n            payload.setPlayerId(player_id);\r\n\r\n            if (p_playObject != null) {\r\n                payload.setHwnd(p_playObject.GetWMHwnd());\r\n                p_playObject.style.display = 'block';\r\n            } else {\r\n                console.error('p_playObject is null')\r\n            }\r\n\r\n            var rc = jSWProtocol.SendRequest({\r\n                session: p_session,\r\n                payload: payload,\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_RECORD_PLAY,\r\n                callback: p_options.callback,\r\n                tag: p_options.tag\r\n            });\r\n\r\n            if (rc == jSW.RcCode.RC_CODE_S_OK) {\r\n                var player = new jSW.SWPlayer(p_session, {\r\n                    playerId: player_id,\r\n                    nruId: p_options.nru,\r\n                    file: p_options.url,\r\n                    dialogId: -1,\r\n                    parentDiv: parentDiv,\r\n                    time_begin: p_options.time_begin,\r\n                    time_end: p_options.time_end,\r\n                    bar: p_player_bar,\r\n                    callback: p_options.closecallback,\r\n                    tag: p_options.closetag\r\n                });\r\n\r\n                p_session._arr_record_play.push(player)\r\n            }\r\n        }\r\n\r\n        var session = this;\r\n        // ocx创建实例后，要稍等，不然没有句柄\r\n        setTimeout(function () {\r\n            sendCmd(session, options, playObject, div, player_bar);\r\n        }, 500);\r\n\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    /**点播视频*/\r\n    /**\r\n    var options = {\r\n        url: 'video url',\r\n        tag: userdata,\r\n        callback: function(options, response) {\r\n            options = {\r\n                session: session,\r\n                cmd: 'login',\r\n                request: param,\r\n                callback: callback,\r\n                tag: tag\r\n            }\r\n            response = {\r\n                emms: emms,\r\n                request: request,\r\n                pulist: BVCU_PUCFG_PUChannelInfo[]\r\n            }\r\n        },\r\n    };*/\r\n    swVodVideo: function (options) {\r\n        var dft_options = {\r\n            url: null,\r\n            callback: null,\r\n            tag: null,\r\n        };\r\n\r\n        if (jSWOptions.calltype == jSW.CallProtoType.OCX) {\r\n            alert('Just Http support Vod Video!!');\r\n            return jSW.RcCode.RC_CODE_E_BVCU_BADSTATE;\r\n        }\r\n\r\n        options = jSWUtils.extend({}, dft_options, options || {});\r\n        if (options.url == null || options.url.length == 0) {\r\n            console.error('url error: ' + options.url);\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        var div = options.div;\r\n        if(typeof div == \"string\"){\r\n            div = document.getElementById(div)\r\n            console.log(typeof div)\r\n        }\r\n        \r\n        if (null == div) {\r\n            console.error('no have div');\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if (typeof (div.bv_uuid) == \"undefined\") {\r\n            div.bv_uuid = jSWUtils.generateUUID();\r\n        }\r\n\r\n        var playObjectId = div.bv_uuid + '_0077553'; /**ID附属*/\r\n        playObject = document.getElementById(playObjectId);\r\n        if (playObject == null) {\r\n            playObject = document.createElement('VIDEO');\r\n            playObject.setAttribute('id', playObjectId);\r\n            playObject.setAttribute('class', 'video-js vjs-default-skin vjs-big-play-centered');\r\n            // playObject.setAttribute('poster', '/js/my_video_poster.png');\r\n            playObject.style.width = '100%';\r\n            playObject.style.height = '100%';\r\n            playObject.style.display = 'block';\r\n            playObject.src = options.url;\r\n\r\n            div.appendChild(playObject);\r\n        }\r\n\r\n        // var index = options.url.indexOf(jSWOptions.http);\r\n        // if (-1 != index) {\r\n        //     options.url = options.url.substr(jSWOptions.http.length + 1); /** +1 是去除'/' */\r\n        // }\r\n\r\n        // var vodCmd = jSWProtocol.RequestHeader.vod;\r\n\r\n        // var param = new jSWProtocol.JsonParamCommand(this._p_emms,\r\n        //     proto.WEBBVCU.MSGType.WEB_BVCU_SET_VOD,\r\n        //     new jSWProtocol.BVCU_Command('', -1, null));\r\n\r\n        // param.setPayload(jSWUtils.string2Uint8Array(options.url));\r\n\r\n        // var rc = jSWProtocol._internalSend({\r\n        //     session: this,\r\n        //     cmd: vodCmd.cmd,\r\n        //     request: param,\r\n        //     callback: options.callback,\r\n        //     opt: options,\r\n        //     tag: options.tag\r\n        // });\r\n\r\n        if(options.callback){\r\n            setTimeout(options.callback, 50, {tag: options.tag}, {emms: {code: jSW.RcCode.RC_CODE_S_OK}})\r\n        }\r\n\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    /**var options = {\r\n        div: 'div_id', // div or div id\r\n        url: 'video url',\r\n        callback: function(options, response) {\r\n            options = options;\r\n            response = {\r\n                emms: emms,\r\n                request: request\r\n            }\r\n        }\r\n    };*/\r\n    swVodVideoEx: function (options) {\r\n        return jSW.RcCode.RC_CODE_E_UNSUPPORTED;\r\n\r\n        var dft_options = {\r\n            callback: null,\r\n            div: '',\r\n            url: null\r\n        };\r\n\r\n        var uoptions = jSWUtils.extend({}, dft_options, options || {});\r\n\r\n        if (uoptions.url == null || uoptions.url.length == 0) {\r\n            console.error('url error: ' + uoptions.url);\r\n            return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n        }\r\n\r\n        if (typeof uoptions.div === \"string\") {\r\n            uoptions.div = document.getElementById(uoptions.div);\r\n            if (uoptions.div == null) {\r\n                console.error('no have div');\r\n                return jSW.RcCode.RC_CODE_E_INVALIDARG;\r\n            }\r\n        }\r\n\r\n        // var rc = this.swVodVideo({\r\n        //     url: uoptions.url,\r\n        //     tag: uoptions.div,\r\n        //     useoptions: uoptions,\r\n        //     callback: function (options, response) {\r\n        //         var tag = options.tag;\r\n        //         var url = response.url;\r\n        //         var request = options.request;\r\n\r\n        //         if (jSW.RcCode.RC_CODE_S_OK == response.getCode()) {\r\n\r\n        //             var div = tag;\r\n        //             var playObjectId = div.bv_uuid + '_0077553'; /**ID附属*/\r\n        //             if (document.getElementById(playObjectId) == null) {\r\n        //                 console.error('not have player');\r\n        //                 return;\r\n        //             }\r\n\r\n        //             var player = videojs(playObjectId, {\r\n        //                 controlBar: true,\r\n        //                 controls: true\r\n        //             }, function () {\r\n        //                 strArr = url.split('.')\r\n        //                 if (strArr.length == 2) {\r\n        //                     strUrlFileType = strArr[1];\r\n        //                     if (strUrlFileType == 'mp4') {\r\n        //                         this.src({\r\n        //                             type: 'video/mp4',\r\n        //                             src: jSWOptions.http + \"/\" + url\r\n        //                         });\r\n        //                     } else if (strUrlFileType == 'm3u8') {\r\n        //                         this.src({\r\n        //                             type: 'application/vnd.apple.mpegurl',\r\n        //                             src: jSWOptions.http + \"/\" + url\r\n        //                         });\r\n        //                     }\r\n        //                 }\r\n\r\n        //                 this.play();\r\n        //             });\r\n        //         }\r\n\r\n        //         var orgopt = options.opt;\r\n        //         if (orgopt && orgopt.useoptions) {\r\n        //             if (typeof orgopt.useoptions.callback === 'function') {\r\n        //                 orgopt.useoptions.callback(orgopt.useoptions, response);\r\n        //             }\r\n        //         }\r\n        //     }\r\n        // });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swGetConfManager: function () {\r\n        return this._confManager;\r\n    },\r\n\r\n    swGetUserManager: function () {\r\n        return this._userManager;\r\n    },\r\n\r\n    /**查询PU*/\r\n    swGetPu: function (puid) {\r\n        var despu = this._swGetPu(puid);\r\n        if (!despu) {\r\n            this._swAsyncGetPu({\r\n                szpuid: puid\r\n            });\r\n        }\r\n        return despu;\r\n    },\r\n\r\n    _swGetPu: function (puid) {\r\n        var index = this._swGetPuFromArr(puid, this._arr_pu);\r\n        if (index == -1) {\r\n            return null;\r\n        }\r\n        return this._arr_pu[index];\r\n    },\r\n\r\n    _swGetPuFromArr: function (puid, arr) {\r\n        var i = 0;\r\n        for (; i < arr.length; i++) {\r\n            if (arr[i]._id_pu == puid) {\r\n                return i;\r\n            }\r\n        }\r\n        return -1;\r\n    },\r\n    _swCheckPuArr: function (pu) {\r\n        var ioffline = this._swGetPuFromArr(pu._info_pu.id, this._arr_pu_offline);\r\n        var ionline = this._swGetPuFromArr(pu._info_pu.id, this._arr_pu_online);\r\n        if (0 == pu._info_pu.onlinestatus) {\r\n\r\n            if (-1 != ionline) {\r\n                this._arr_pu_online.splice(ionline, 1);\r\n            }\r\n\r\n            if (-1 == ioffline) {\r\n                this._arr_pu_offline.push(pu);\r\n            }\r\n\r\n        } else if (1 == pu._info_pu.onlinestatus) {\r\n            if (-1 == ionline) {\r\n                this._arr_pu_online.push(pu);\r\n            }\r\n\r\n            if (-1 != ioffline) {\r\n                this._arr_pu_offline.splice(ioffline, 1);\r\n            }\r\n        }\r\n    },\r\n\r\n    /**查询通道*/\r\n    swGetPuChanel: function (puid, chanelid) {\r\n        var pu = this._swGetPu(puid);\r\n        if (pu) {\r\n            return pu.swGetChanel(chanelid);\r\n        }\r\n\r\n        return null;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            puid: puid,\r\n            callback: function(sender, response, data){\r\n                data = {\r\n                    szID: 设备ID,\r\n                    szManufacturer: 制造商名字,\r\n                    szProductName: 产品名,\r\n                    szSoftwareVersion: 软件版本,\r\n                    szHardwareVersion: 硬件版本,\r\n                    iPUType: BVCU_PUTYPE_*,\r\n                    languages: 支持的语言列表,\r\n                    languageSelected: 当前使用的语言索引,\r\n                    Ilanguageindex: deviceinfo.getIlanguageindex(),\r\n                    szName: 名字。可写,\r\n                    iWIFICount: WIFI数目,\r\n                    iRadioCount: 无线模块数目,\r\n                    iChannelCount: 音视频通道数,\r\n                    iVideoInCount: 视频输入数,\r\n                    iAudioInCount: 音频输入数,\r\n                    iAudioOutCount: 音频输出数,\r\n                    iPTZCount: PTZ数,\r\n                    iSerialPortCount: 串口数,\r\n                    iAlertInCount:   报警输入数,\r\n                    iAlertOutCount:  报警输出数,\r\n                    iStorageCount:   存储设备数,\r\n                    iGPSCount:       GPS设备数,\r\n                    bSupportSMS:     是否支持手机短信功能。0-不支持，1-支持,\r\n                    iPresetCount: 支持的PTZ预置点数目,\r\n                    iCruiseCount: 支持的PTZ巡航点数目,\r\n                    iAlarmLinkActionCount: 支持的报警联动数目,\r\n                    iLongitude: 经度,东经是正值，西经负值，单位1/10000000度。大于180度或小于-180度表示无效值\r\n                    iLatitude: 纬度,纬度，北纬是正值，南纬是负值，单位1/10000000度。大于180度或小于-180度表示无效值\r\n                    szBluetoothAddr: 设备蓝牙地址，空字符表示设备没有蓝牙模块（不支持蓝牙），格式：ff:ff:ff:ff:ff:ff\r\n                };\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetPuDeviceInfo: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_DEVICEINFO,\r\n            jSWProtocol.RequestHeader.pucfg.getpudeviceinfo.cmd, this, null);\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            puid: puid,\r\n            ilanguage: language index,\r\n            name: pu name,\r\n            callback: function(sender, response, data){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swSetPuDeviceInfo: function (option) {\r\n\r\n        dft_poptions = {\r\n            ilanguage: 1,\r\n            name: \"default name\"\r\n        };\r\n\r\n        option = jSWUtils.extend({}, dft_poptions, option || {});\r\n\r\n        var payload = new proto.BVCU.PUConfig.DeviceInfo();\r\n\r\n        payload.setSzid(option.puid);\r\n        payload.setIlanguageindex(option.ilanguage);\r\n        payload.setSzname(option.name);\r\n        payload.setIputype(0);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_DEVICEINFO,\r\n            cmd: jSWProtocol.RequestHeader.pucfg.getpudeviceinfo.cmd,\r\n            target: option.puid,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swGetPuDeviceTime: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_DEVICETIME,\r\n            jSWProtocol.RequestHeader.pucfg.getpudevicetime.cmd, this, null);\r\n    },\r\n\r\n    swGetPuEthernet: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_ETHERNET,\r\n            jSWProtocol.RequestHeader.pucfg.getpuethernet.cmd, this, null);\r\n    },\r\n\r\n    swGetPuRadioNetwork: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_RADIONETWORK,\r\n            jSWProtocol.RequestHeader.pucfg.getpuradionetwork.cmd, this, null);\r\n    },\r\n\r\n    swGetPuWifi: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_WIFI,\r\n            jSWProtocol.RequestHeader.pucfg.getpuwifi.cmd, this, null);\r\n    },\r\n\r\n    swGetPuPower: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_POWER,\r\n            jSWProtocol.RequestHeader.pucfg.getPuPower.cmd, this, null);\r\n    },\r\n\r\n    swGetPuOnlineControl: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_ONLINECONTROL,\r\n            jSWProtocol.RequestHeader.pucfg.getPuOnlineControl.cmd, this, null);\r\n    },\r\n\r\n    swGetPuUpdateStatus: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_UPDATESTATUS,\r\n            jSWProtocol.RequestHeader.pucfg.getPuUpdateStatus.cmd, this, null);\r\n    },\r\n\r\n    swGetPuLinkactionList: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_LINKACTION_LIST,\r\n            jSWProtocol.RequestHeader.pucfg.getPuLinkactionList.cmd, this, null);\r\n    },\r\n\r\n    swGetLinkActionInfo: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_LINKACTION_LIST,\r\n            jSWProtocol.RequestHeader.pucfg.getPuLinkactionList.cmd, this, options.linkactionbaseinfo);\r\n    },\r\n\r\n    swGetPuCarInfo: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_CARINFO,\r\n            jSWProtocol.RequestHeader.pucfg.getPuCarInfo.cmd, this, null);\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            puid: pu.puid,\r\n            callback: function(sender, response, data){\r\n                data = {\r\n                    szDevModel: 设备型号.  只读,\r\n                    szIMEI_MEID: 设备IMEI/MEID号.  只读,\r\n                    szSerial: 产品序号，不可为空. 可写,\r\n                    szUserNo: 使用者警号，不可为空。可写,\r\n                    szUserName: 使用者姓名。可写,\r\n                    szUserDescribe: 使用者描述（可用于备注职位）。 可写,\r\n                    szUnitNo: 使用者单位编号。 可写,\r\n                    szUnitName: 使用者单位名称。 可写,\r\n                    szDefaultConference: 默认发言会议ID。注意可以通过会议管理对象命令获取会议名称，并显示选择会议列表。 可写,\r\n                    szCurrentConference: 当前发言会议ID。 只读\r\n                };\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swGetPuZfyInfo: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_ZFYINFO,\r\n            jSWProtocol.RequestHeader.pucfg.getPuZfyInfo.cmd, this, null);\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            puid:                 pu.puid,\r\n            serial:              \"default\",\r\n            userno:             \"default\",\r\n            userame:             \"default\",\r\n            description:           \"default\",\r\n            unitno:             \"default\",\r\n            unitname:            \"default\",\r\n            defaultconference: \"\",\r\n            callback: function(sender, response, data){\r\n                response.emms.code == jSW.Rc\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swSetPuZfyInfo: function (options) {\r\n\r\n        dft_poptions = {\r\n            serial: \"default\",\r\n            userno: \"default\",\r\n            userame: \"default\",\r\n            description: \"default\",\r\n            unitno: \"default\",\r\n            unitname: \"default\",\r\n            defaultconference: \"\"\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_poptions, options || {});\r\n\r\n        var payload = new proto.BVCU.PUConfig.ZFYInfo();\r\n\r\n        payload.setSzserial(options.serial);\r\n        payload.setSzuserno(options.userno);\r\n        payload.setSzusername(options.userame);\r\n        payload.setSzuserdescribe(options.description);\r\n        payload.setSzunitno(options.unitno);\r\n        payload.setSzunitname(options.unitname);\r\n        payload.setSzdefaultconference(options.defaultconference);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_PU_ZFYINFO,\r\n            cmd: jSWProtocol.RequestHeader.pucfg.setPuZfyInfo.cmd,\r\n            target: options.puid,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swGetPuServers: function (options) {\r\n        return this._swGetPuOperation(options, proto.WEBBVCU.MSGType.WEB_BVCU_GET_PU_SERVERS,\r\n            jSWProtocol.RequestHeader.pucfg.getPuServers.cmd, this, null);\r\n    },\r\n\r\n    _swGetPuOperation: function (options, msgType, cmd, session, data) {\r\n        var param = jSWProtocol.JsonParamCommand(this._p_emms,\r\n            msgType,\r\n            jSWProtocol.BVCU_Command(options.puid, -1, data));\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: cmd,\r\n            session: session,\r\n            request: param,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swLogQuery: function (options) {\r\n        var rc = jSW.DependencyMgr.cmdParseInJect(function () {\r\n            this._swLogQuery(options);\r\n        }, this);\r\n        return rc;\r\n    },\r\n    /*\r\n        options={\r\n            ipostition: Number,\r\n            icount: Number,\r\n            itimebegin: Number(UTC秒数),\r\n            itimeend: Number(UTC秒数),\r\n            username: String,\r\n            targetid: String,\r\n            itargetindex: Number,\r\n            callback: function(sender, response, data){\r\n                \r\n            },\r\n            tag: tag\r\n        }\r\n    */\r\n    _swLogQuery: function (options) {\r\n        var dft_poptions = {\r\n            ipostition: 0,\r\n            icount: 120,\r\n            itimebegin: 0,\r\n            itimeend: 0,\r\n            username: '',\r\n            targetid: '',\r\n            itargetindex: -1,\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_poptions, options || {});\r\n\r\n        var payload = new proto.BVCU.Search.Search_Request();\r\n        var searchinfo = new proto.BVCU.Search.SearchInfo();\r\n        payload.setStsearchinfo(searchinfo);\r\n        searchinfo.setItype(jSWProtocol.SearchType.OPERATE);\r\n        searchinfo.setIcount(Number(options.icount));\r\n        searchinfo.setIpostition(Number(options.ipostition));\r\n\r\n        var operatelog = new proto.BVCU.Search.Search_OperateLog();\r\n        payload.setStoperatefilter(operatelog);\r\n        operatelog.setSzusername(options.username);\r\n        operatelog.setSztargetid(options.targetid);\r\n\r\n        if (options.itimebegin != 0 && options.itimeend != 0 && options.itimeend < options.itimebegin) {\r\n            console.error(\"get operate log utc time error please check!\");\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        operatelog.setIoperatetime(options.itimebegin);\r\n        operatelog.setItimeend(options.itimeend);\r\n\r\n        var targetindex = Number(options.itargetindex);\r\n        if (targetindex != null && targetindex >= 0) {\r\n            operatelog.setItargetindex(targetindex);\r\n        }\r\n        operatelog.serializeBinary();\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this,\r\n            targetIndex: targetindex,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_SEARCH_OPERATE,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    swDispose: function () {\r\n        if (this._arr_pu_online && this._arr_pu_online.length > 0) {\r\n            this._arr_pu_online.every(function (puitem, index, array) {\r\n                puitem._clear();\r\n            });\r\n            this._arr_pu_online = [];\r\n        }\r\n        if (this._timer_keeplive) {\r\n            clearInterval(this._timer_keeplive);\r\n            this._timer_keeplive = 0;\r\n        }\r\n        if (this._ws) {\r\n            this._ws.onclose = null;\r\n            this._ws.close();\r\n            console.log(\"close ws\");\r\n        }\r\n        if (jSWOptions.CheckNotOcx()) {\r\n            var audio = jSW.DependencyMgr.GetModule(\"Audio\");\r\n            if (audio) {\r\n                audio.DestroyWs();\r\n            }\r\n        }\r\n\r\n        jSW.SWVideoChanel._Ocx_PlayObjMgr.Free()\r\n    },\r\n\r\n    compare: function (objSession) {\r\n        return (this._server == objSession._server &&\r\n            this._port == objSession._port &&\r\n            this._user == objSession._user);\r\n    },\r\n\r\n    /**内部函数， OnResponse Fail*/\r\n    _internalOnResponseFail: function (options, responseText, errMsg) {\r\n        var cmd = options.cmd;\r\n        var param = options.param;\r\n\r\n        //console.error('internal error: ' + cmd + (errMsg));\r\n        if (cmd == jSWProtocol.RequestHeader.pubkey.cmd) {\r\n            cmd = jSWProtocol.RequestHeader.login.cmd;\r\n        }\r\n\r\n        /**调用命令的回调函数\r\n        if (options && ((typeof options.callback) == 'function')) {\r\n            options.callback(options, response);\r\n        }*/\r\n\r\n        /**通知调用者*/\r\n        //this._callbackManager.dispatchCallback(cmd, {\r\n        //    code: jSW.RcCode.RC_CODE_E_FAIL,\r\n        //    request: param,\r\n        //    response: responseText,\r\n        //    msg: errMsg\r\n        //});\r\n    },\r\n\r\n    /**内部函数， OnResponse Success*/\r\n    _internalOnResponseSuccess: function (options, response, status) {\r\n        jSW.DependencyMgr.HandleResponseInJect(function (handleResponse) {\r\n            handleResponse.internalOnResponseSuccess(this, options, response, status);\r\n        }, this);\r\n    },\r\n\r\n    _internalNotify: function (options, response) {\r\n        jSW.DependencyMgr.HandleResponseInJect(function (handleResponse) {\r\n            handleResponse.handleNotify(this, options, response);\r\n        }, this);\r\n    },\r\n\r\n    /**OnResponse 设备列表*/\r\n    _internalOnResponsePulist: function (pulist) {\r\n        var pulistNotify = [];\r\n        if (pulist && typeof pulist.forEach == \"function\") {\r\n            var pu = null;\r\n            var session = this;\r\n            pulist.forEach(function (temppu) {\r\n                pu = session._arr_pu_index[temppu.szid];\r\n                if (pu) {\r\n                    pu._internalUpdate(temppu);\r\n                    session._swCheckPuArr(pu);\r\n                } else {\r\n                    pu = new jSW.SWPu(session, temppu)\r\n                    if (pu._info_pu.onlinestatus == 1) {\r\n                        session._arr_pu_online.push(pu);\r\n                    } else if (0 == pu._info_pu.onlinestatus) {\r\n                        session._arr_pu_offline.push(pu);\r\n                    }\r\n                    session._arr_pu.push(pu);\r\n                    session._arr_pu_index[temppu.szid] = pu;\r\n                }\r\n                pulistNotify.push(pu);\r\n            })\r\n        }\r\n        return pulistNotify;\r\n    },\r\n\r\n    _internalOnResponseConfList: function (conflist) {\r\n        if (this._confManager != null && this._confManager._swFreshConflist) {\r\n            this._confManager._swFreshConflist(conflist);\r\n        }\r\n    },\r\n\r\n    _internalOnConfResponse: function (msgType, data) {\r\n        //console.log(jSWUtils.getJsonString(data));\r\n        switch (msgType) {\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_GET_CONF_LIST:\r\n                if (this._confManager != null && this._confManager._swFreshConflist) {\r\n                    this._confManager._swFreshConflist(data);\r\n                }\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_GET_CONF_INFO:\r\n                return this._confManager._swFreshConfInfo(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_SET_CONF_CREATE:\r\n                var desconf = this._confManager._swFreshConfInfo(data);\r\n                this._confManager._dispatchCallback(desconf, jSWProtocol.RequestHeader.confnotify.notifyconfcreate.cmd, desconf.swGetConfInfo().id);\r\n                return desconf;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_ONLINE:\r\n                this._confManager._swFreshUserOnlielist(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_SET_CONF_DELETE:\r\n                this._confManager._onConfDeletedOk(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_PARTICIPATOR_ADD:\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_PARTICIPATOR_REMOVE:\r\n                this._confManager._onParticularAddResult(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_START:\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_STOP:\r\n                this._confManager._onConfOpertaion(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_PARTICIPATOR_APPLYFOR_STARTSPEAK:\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_PARTICIPATOR_APPLYFOR_ENDSPEAK:\r\n                this._confManager._onApplyForSpeak(data);\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_RETURN:\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_CONF_LEAVE:\r\n                this._confManager._onConfLeaveOrReturn(data);\r\n                break\r\n        }\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/entity/jsw-session.js?");

/***/ }),

/***/ "../src/entity/jsw-user-mgr.js":
/*!*************************************!*\
  !*** ../src/entity/jsw-user-mgr.js ***!
  \*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var jsw_common_module = __webpack_require__(/*! ../jsw-common-module */ \"../src/jsw-common-module.js\");\r\nvar jSW = jsw_common_module[\"jSW\"];\r\nvar jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\nvar jSWUtils = jsw_common_module[\"jSWUtils\"];\r\nvar jSWOptions = jsw_common_module[\"jSWOptions\"];\r\nvar PuLoad = jsw_common_module[\"PuLoad\"];\r\nvar AudioMgr = jsw_common_module[\"AudioMgr\"];\r\nvar HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\r\njSW.SwUserManager = function (session) {\r\n    this._session = session;\r\n}\r\n\r\njSW.SwUserManager.SYSADMIN = {\r\n    NONE: 0, // 没有系统管理权\r\n    GROUP: 1, // 对用户组拥有管理权\r\n    USER: 4, // 对用户拥有管理权\r\n    DEV: 16, // 对设备拥有管理权\r\n    DEVASS: 64, // 对设备拥有分配权\r\n    ALL: 85\r\n};\r\n\r\njSW.SwUserManager.PERMISSIONS = {\r\n    OFF: 0,\r\n    ON: 1\r\n}\r\n\r\njSW.SwUserManager.DEFAULT = {\r\n    GROUP_GOD: \"Admin\",\r\n    USER: \"admin\"\r\n}\r\n\r\njSW.SwUserManager.Buffer = function () {\r\n    this._Buffer_Strack = [];\r\n};\r\n\r\njSW.SwUserManager.Buffer.prototype = {\r\n    _Buffer_Size: 1024,\r\n    _push: function (item) {\r\n        var isExist = this._is_id_exist(item.id);\r\n        if (!isExist) {\r\n            while (this._Buffer_Strack.length > this._Buffer_Size) {\r\n                var item = this._Buffer_Strack.pop();\r\n                item.tag._clearinfo(item.tag);\r\n            }\r\n\r\n            this._Buffer_Strack.unshift(item);\r\n        }\r\n    },\r\n    _is_id_exist: function (id) {\r\n        var item = null;\r\n        for (itemIndex in this._Buffer_Strack) {\r\n            item = this._Buffer_Strack[itemIndex];\r\n            if (item.id == id) {\r\n                return true;\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n};\r\n\r\njSW.SwUserManager.SwUser = function (session, user, group) {\r\n    this._session = session;\r\n    this._user = user;\r\n    this._group = group;\r\n    this._userinfo = null;\r\n}\r\n\r\njSW.SwUserManager.SwUser.prototype = {\r\n    _static_buffer: new jSW.SwUserManager.Buffer(),\r\n\r\n    _clearinfo: function (user) {\r\n        user._userinfo = null;\r\n    },\r\n\r\n    swGetUserInfo: function (options) {\r\n        if (this._static_buffer._is_id_exist(this._user.id)) {\r\n            setTimeout(options.callback, 5, {\r\n                tag: options.tag\r\n            }, {\r\n                emms: {\r\n                    code: 0\r\n                }\r\n            }, this._userinfo);\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        }\r\n        return this._innerGetUserInfo(options);\r\n    },\r\n\r\n    swGetGroup: function () {\r\n        return this._group;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            info:{\r\n                isGroupManager: Boolean,\r\n                isUserManager: Boolean,\r\n                isDevManager: Boolean,\r\n                isDevAssManager: Boolean,\r\n                name: String,\r\n                email: String,\r\n                phone: String,\r\n                groupid: String,\r\n                description: String,\r\n                resources: [\r\n                    {\r\n                        puid: String,\r\n                        permission: {\r\n                            config: false,\r\n                            channels: [\r\n                                {channelindex: channel._id_chanel,\r\n                                iscansee: false}\r\n                            ]\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            callback: funciton,\r\n            tag: Object\r\n        }\r\n    */\r\n    swModUser: function (options) {\r\n        var dft_poptions = {\r\n            info: {\r\n                name: this._user.name,\r\n                email: this._userinfo.email,\r\n                phone: this._userinfo.phone,\r\n                description: this._userinfo.description,\r\n                groupid: this._group._group.id,\r\n                sysadmin: {\r\n                    isGroup: this._userinfo.isGroup,\r\n                    isUser: this._userinfo.isUser,\r\n                    isDev: this._userinfo.isDev,\r\n                    isDevAss: this._userinfo.isDevAss\r\n                },\r\n                resources: this._userinfo.resources,\r\n                iptz: this._userinfo.iptz\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_poptions, options || {});\r\n        options.info.sysadmin = jSWUtils.extend({}, dft_poptions.info.sysadmin, options.info.sysadmin || {});\r\n        var rc = this._mod_user(options);\r\n        return rc;\r\n    },\r\n\r\n    _mod_user: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserInfo();\r\n\r\n        var systemvalue = 0;\r\n\r\n        systemvalue += (option.info.sysadmin.isGroup ? jSW.SwUserManager.SYSADMIN.GROUP : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isUser ? jSW.SwUserManager.SYSADMIN.USER : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isDev ? jSW.SwUserManager.SYSADMIN.DEV : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isDevAss ? jSW.SwUserManager.SYSADMIN.DEVASS : jSW.SwUserManager.SYSADMIN.NONE);\r\n\r\n        payload.setSname(option.info.name);\r\n        payload.setSemail(option.info.email);\r\n        payload.setSphone(option.info.phone);\r\n        payload.setSdescription(option.info.description);\r\n        payload.setIsysadmin(systemvalue);\r\n        payload.setIptz(option.info.iptz);\r\n\r\n        payload.setSid(this._userinfo.id);\r\n        payload.setSallocateid(this._userinfo.allocateId);\r\n        payload.setSgroupid(option.info.groupid);\r\n        jSWProtocol._LocalResource_2Pb(option.info.resources, payload);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_MODUSER,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n\r\n    /*\r\n        options={\r\n            data:{\r\n                password:  用户的原密码,修改他人密码时不用填充此值，但需要管理权限 \r\n                newpassword: 用户的新密码\r\n            },\r\n            callback: function(sender, response, data){\r\n            },\r\n            tag: \r\n        }\r\n    */\r\n    swModPwd: function (options) {\r\n        var dft_poptions = {\r\n            data: {\r\n                password: '',\r\n                newpassword: ''\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_poptions, options || {});\r\n\r\n        var rc = this._mod_pwd(options);\r\n        return rc;\r\n    },\r\n\r\n    _mod_pwd: function (options) {\r\n        var payload = new proto.BVCU.UserConfig.ModPassword();\r\n\r\n        payload.setSid(this._user.id);\r\n        payload.setSpassword(jSWUtils.string2Uint8Array(options.data.password));\r\n        payload.setSnewpassword(jSWUtils.string2Uint8Array(options.data.newpassword));\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_MODPASSWD,\r\n            payload: payload,\r\n            callback: options.callback,\r\n            tag: options.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            callback:function(sender, options, data){\r\n                \r\n            }\r\n        },\r\n        tag: Object\r\n    */\r\n    swDelUser: function (options) {\r\n        return this._del_user(options);\r\n    },\r\n\r\n    _del_user: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.User();\r\n\r\n        payload.setSid(this._user.id);\r\n        payload.setSgroupid(this._user.groupid);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_DELUSER,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _fresh_user_info: function (userinfo) {\r\n        this._userinfo = {\r\n            id: userinfo.sId,\r\n            passwd: userinfo.sPasswd,\r\n            bsetpasswd: userinfo.bSetPasswd,\r\n            sysadmin: {\r\n                isGroup: userinfo.sysadmin.isGroup,\r\n                isUser: userinfo.sysadmin.isUser,\r\n                isDev: userinfo.sysadmin.isDev,\r\n                isDevAss: userinfo.sysadmin.isDevAss\r\n            },\r\n            iptz: userinfo.iPtz,\r\n            serverid: userinfo.sServerId,\r\n            groupid: userinfo.sGroupId,\r\n            imaxsession: userinfo.iMaxSession,\r\n            allocateId: userinfo.sAllocateId,\r\n            name: userinfo.sName,\r\n            phone: userinfo.sPhone,\r\n            email: userinfo.sEmail,\r\n            description: userinfo.sDescription,\r\n            resources: userinfo.Resource.concat()\r\n        }\r\n\r\n        //if (this._group._group.id != jSW.SwUserManager.DEFAULT.GROUP_GOD) {\r\n        //    this._userinfo.allresources = jSWProtocol._GetAllRescources(this._session, this._userinfo.resources);\r\n        //}\r\n\r\n    },\r\n\r\n    _getUserInfo: function (option) {\r\n        var payload = new proto.BVCU.UserConfig.User();\r\n        payload.setSid(option.userid);\r\n        payload.setSgroupid(option.groupid);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_USERINFO,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _innerGetUserInfo: function (options) {\r\n        var rc = this._getUserInfo({\r\n            userid: this._user.id,\r\n            groupid: this._user.groupid,\r\n            callback: this._innerOnGetUserInfo,\r\n            tag: {\r\n                user: this,\r\n                option: options\r\n            }\r\n        });\r\n        return rc;\r\n    },\r\n\r\n    _innerOnGetUserInfo: function (sender, response, data) {\r\n        var tag = sender.tag;\r\n        var user = tag.user;\r\n        var options = tag.option;\r\n\r\n        var rc = user._getGroupInfo({\r\n            callback: user._innerhelpOnGetUserInfo,\r\n            tag: {\r\n                option: options,\r\n                data: data,\r\n                user: user\r\n            }\r\n        });\r\n    },\r\n\r\n    _innerhelpOnGetUserInfo: function (sender, response, data) {\r\n        var tag = sender.tag;\r\n        var user = tag.user;\r\n        var options = tag.option;\r\n        var userdata = tag.data;\r\n\r\n        user._fresh_user_info(userdata);\r\n\r\n        jSW.SwUserManager._InitIUserHelp.iCount -= 1;\r\n\r\n        if (jSW.SwUserManager._InitIUserHelp.iCount <= 0) {\r\n            var userManager = user._session.swGetUserManager();\r\n            userManager._onInitOver();\r\n        }\r\n\r\n        if (options.callback != null && (typeof options.callback === \"function\")) {\r\n            options.callback({\r\n                tag: options.tag\r\n            }, {\r\n                emms: {\r\n                    code: 0\r\n                }\r\n            }, user._userinfo);\r\n        }\r\n        user._static_buffer._push({\r\n            id: user._userinfo.id,\r\n            tag: user\r\n        });\r\n    },\r\n\r\n    _getGroupInfo: function (options) {\r\n        this._group.swGetGroupInfo(options);\r\n    }\r\n};\r\n\r\njSW.SwUserManager._InitIUserHelp = {\r\n    iCount: 0\r\n};\r\n\r\njSW.SwUserManager.SwGroup = function (session, group, groupinfo) {\r\n    this._session = session;\r\n    this._group = group;\r\n    this._userlist = [];\r\n    this.groupinfo = null;\r\n    this._groupinfo = null;\r\n    if (groupinfo != null) {\r\n        this._groupinfo = groupinfo;\r\n        this.groupinfo = groupinfo;\r\n    }\r\n}\r\n\r\njSW.SwUserManager.SwGroup.prototype = {\r\n    _static_groupinfo_buffer: new jSW.SwUserManager.Buffer(),\r\n\r\n    _clearinfo: function (group) {\r\n        group._groupinfo = null;\r\n        group.groupinfo = null;\r\n    },\r\n\r\n    _getGroupInfo: function (options) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserGroup();\r\n        payload.setSid(this._group.id);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_GROUPINFO,\r\n            payload: payload,\r\n            callback: this._onGetGroupInfo,\r\n            tag: {\r\n                group: this,\r\n                option: options\r\n            }\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _resolve: function () {\r\n        this.groupinfo = {\r\n            id: this._group.id,\r\n            name: this._groupinfo.name,\r\n            parentid: this._groupinfo.parentid,\r\n            description: this._groupinfo.description,\r\n            resources: this._groupinfo.resources.concat(),\r\n            allresources: []\r\n        }\r\n\r\n        if (this.groupinfo.id != jSW.SwUserManager.DEFAULT.GROUP_GOD) {\r\n            this.groupinfo.allresources = jSWProtocol._GetAllRescources(this._session, this.groupinfo.resources);\r\n        }\r\n    },\r\n\r\n    _onGetGroupInfo: function (sender, response, data) {\r\n        var tag = sender.tag;\r\n        var group = tag.group;\r\n        group._groupinfo = data;\r\n        group._resolve();\r\n\r\n        var option = tag.option;\r\n        if (option.callback != null && (typeof option.callback === \"function\")) {\r\n            option.callback({\r\n                tag: option.tag\r\n            }, {\r\n                emms: {\r\n                    code: 0\r\n                }\r\n            }, data);\r\n        }\r\n\r\n        group._static_groupinfo_buffer._push({\r\n            id: group._group.id,\r\n            tag: group\r\n        });\r\n    },\r\n\r\n    _groupSetFilter: function () {\r\n        this.groupinfo.id = this._group.id;\r\n        this.groupinfo.parentid = this._group.parentid;\r\n    },\r\n\r\n    _mod_group: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserGroupInfo();\r\n\r\n        payload.setSid(this._group.id);\r\n        payload.setSname(option.info.name);\r\n        payload.setSdescription(option.info.description);\r\n        payload.setSparentid(option.info.parentid);\r\n        jSWProtocol._LocalResource_2Pb(option.info.resources, payload);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_MODGROUP,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _del_group: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserGroup();\r\n\r\n        if (this._userlist == null) {\r\n            console.warn(\"please get group info before delete it!\");\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        if (this._userlist != null && this._userlist.length > 0) {\r\n            console.warn(\"we can't delete the group because it contains more than 1 user!\");\r\n            return jSW.RcCode.RC_CODE_E_FAIL;\r\n        }\r\n\r\n        payload.setSid(this._group.id);\r\n        payload.setSparentid(this._group.parentid);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_DELGROUP,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _add_user: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserInfo();\r\n\r\n        var systemvalue = 0;\r\n\r\n        systemvalue += (option.info.sysadmin.isGroup ? jSW.SwUserManager.SYSADMIN.GROUP : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isUser ? jSW.SwUserManager.SYSADMIN.USER : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isDev ? jSW.SwUserManager.SYSADMIN.DEV : jSW.SwUserManager.SYSADMIN.NONE);\r\n        systemvalue += (option.info.sysadmin.isDevAss ? jSW.SwUserManager.SYSADMIN.DEVASS : jSW.SwUserManager.SYSADMIN.NONE);\r\n\r\n\r\n        payload.setSid(option.info.id);\r\n        if (option.info.passwd.length > 0 && option.info.passwd.length < 64) {\r\n            payload.setSpasswd(jSWUtils.string2Uint8Array(option.info.passwd));\r\n        } else if (option.info.passwd.length > 64) {\r\n            console.log(\"the passwd you seted is out of range\");\r\n        }\r\n        payload.setSname(option.info.name);\r\n        payload.setSemail(option.info.email);\r\n        payload.setSphone(option.info.phone);\r\n        payload.setSdescription(option.info.description);\r\n        payload.setIsysadmin(systemvalue);\r\n        payload.setIptz(option.info.iptz);\r\n        payload.setSallocateid(option.info.allocateId);\r\n\r\n        payload.setSgroupid(this._group.id);\r\n        jSWProtocol._LocalResource_2Pb(option.info.resources, payload);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_ADDUSER,\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _onGetUser: function (user) {\r\n        var localuser = null;\r\n        var isContains = false;\r\n        for (userIndex in this._userlist) {\r\n            localuser = this._userlist[userIndex];\r\n            if (localuser._user.id == user.id) {\r\n                localuser._user = user;\r\n                isContains = true;\r\n                break;\r\n            }\r\n        }\r\n        if (!isContains) {\r\n            localuser = this._local_add_user(user);\r\n        }\r\n        var userManager = this._session.swGetUserManager();\r\n        return localuser;\r\n    },\r\n\r\n    _local_add_user: function (user) {\r\n        var localuser = new jSW.SwUserManager.SwUser(this._session, user, this);\r\n        this._userlist.push(localuser);\r\n        return localuser;\r\n    },\r\n\r\n    _on_notify_mod_user: function (userinfo) {\r\n        var user = null;\r\n        var isExist = false;\r\n        for (userindex in this._userlist) {\r\n            user = this._userlist[userindex];\r\n            if (user._user.id == userinfo.sId) {\r\n                isExist = true;\r\n            }\r\n            break;\r\n        }\r\n\r\n        if (isExist) {\r\n            user._fresh_user_info(userinfo);\r\n        } else {\r\n            var userbaseinfo = {\r\n                id: userinfo.sId,\r\n                groupid: userinfo.sGroupId,\r\n                name: userinfo.sName\r\n            };\r\n            user = new jSW.SwUserManager.SwUser(this._session, userbaseinfo, this);\r\n            user._fresh_user_info(userinfo);\r\n            this._userlist.push(user);\r\n        }\r\n\r\n        return user;\r\n    },\r\n\r\n    _on_notify_del_user: function (user) {\r\n        var userlocal = null;\r\n        for (userindex in this._userlist) {\r\n            userlocal = this._userlist[userindex];\r\n            if (userlocal._user.id == user._user.id) {\r\n                this._userlist.splice(userindex, 1);\r\n                break;\r\n            }\r\n        }\r\n        return userlocal;\r\n    },\r\n\r\n    /*\r\n        options = {\r\n            info:{\r\n                isGroupManager: Boolean,\r\n                isUserManager: Boolean,\r\n                isDevManager: Boolean,\r\n                isDevAssManager: Boolean,\r\n                name: String,\r\n                email: String,\r\n                phone: String,\r\n                groupid: String,\r\n                description: String,\r\n                password: String,\r\n                resources: [\r\n                    {\r\n                        puid: String,\r\n                        permission: {\r\n                            config: false,\r\n                            channels: [\r\n                                {channelindex: channel._id_chanel,\r\n                                iscansee: false}\r\n                            ]\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            callback: function(sender, options, data){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swAddUser: function (options) {\r\n        var dft_poptions = {\r\n            info: {\r\n                id: '',\r\n                passwd: '',\r\n                name: '',\r\n                email: '',\r\n                phone: '',\r\n                description: '',\r\n                groupid: this._group.id,\r\n                sysadmin: {\r\n                    isGroup: false,\r\n                    isUser: false,\r\n                    isDev: false,\r\n                    isDevAss: false\r\n                },\r\n                resources: []\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        options = jSWUtils.extend({}, dft_poptions, options || {});\r\n        options.info = jSWUtils.extend({}, dft_poptions.info, options.info || {});\r\n        var rc = this._add_user(options);\r\n        return rc;\r\n    },\r\n\r\n    swGetUserList: function (options) {\r\n        setTimeout(options.callback, 5, {\r\n            tag: options.tag\r\n        }, {\r\n            emms: {\r\n                code: jSW.RcCode.RC_CODE_S_OK\r\n            }\r\n        }, this._userlist);\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    swGetUserById: function (id) {\r\n        var user = null;\r\n        for (userIndex in this._userlist) {\r\n            user = this._userlist[userIndex];\r\n            if (user._user.id == id) {\r\n                return user;\r\n            }\r\n        }\r\n        return null;\r\n    },\r\n\r\n    swGetGroupInfo: function (options) {\r\n        var isBufferExist = this._static_groupinfo_buffer._is_id_exist(this._group.id);\r\n        if (isBufferExist) {\r\n            setTimeout(options.callback, 5, {\r\n                tag: options.tag\r\n            }, {\r\n                emms: {\r\n                    code: 0\r\n                }\r\n            }, this.groupinfo);\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        } else {\r\n            return this._getGroupInfo(options);\r\n        }\r\n    },\r\n\r\n    /*\r\n        option= {\r\n            info: {\r\n                name: String,\r\n                descriptioin: String,\r\n                parentid: String,\r\n                resources: [\r\n                    {\r\n                        puid: String,\r\n                        permission: {\r\n                            config: false,\r\n                            channels: [\r\n                                {channelindex: channel._id_chanel,\r\n                                iscansee: false}\r\n                            ]\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            callback: function(sender, options, data){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swModGroup: function (option) {\r\n        var dft_poptions = {\r\n            info: {\r\n                name: this._group.name,\r\n                description: this._groupinfo.description,\r\n                parentid: this._groupinfo.parentid,\r\n                resources: this._groupinfo.resources\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        option = jSWUtils.extend({}, dft_poptions, option || {});\r\n        option.info = jSWUtils.extend({}, dft_poptions.info, option.info || {});\r\n        var rc = this._mod_group(option);\r\n        return rc;\r\n    },\r\n\r\n    swDelGroup: function (options) {\r\n        return this._del_group(options);\r\n    }\r\n};\r\n\r\njSW.SwUserManager.prototype = {\r\n    _session: null,\r\n    _grouplist: [],\r\n    _ondatachangedcallback: null,\r\n    _initCallback: null,\r\n    _usertag: null,\r\n    _isInitOver: false,\r\n    _currentUser: null,\r\n    _currentuserid: \"\",\r\n\r\n    _getUserGroupList: function (option) {\r\n        var param = jSWProtocol.JsonParamCommand(this._session._p_emms,\r\n            proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_GROUPLIST,\r\n            jSWProtocol.BVCU_Command('', -1, null));\r\n\r\n        var rc = jSWProtocol._internalSend({\r\n            cmd: jSWProtocol.RequestHeader.usercfg.getgrouplist.cmd,\r\n            session: this._session,\r\n            request: param,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _getUserList: function (option) {\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_USERLIST,\r\n\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _innerGetUserList: function () {\r\n        this._getUserList({\r\n            callback: this._onGetUserList,\r\n            tag: this\r\n        });\r\n    },\r\n\r\n    _onGetUserList: function (sender, response, data) {\r\n        var userManager = sender.tag;\r\n        var user = null;\r\n        var group = null;\r\n        var localuser = null;\r\n        jSW.SwUserManager._InitIUserHelp.iCount = data.length;\r\n        for (userindex in data) {\r\n            user = data[userindex];\r\n            group = userManager._getGroupById(user.groupid);\r\n            if (group != null) {\r\n                localuser = group._onGetUser(user);\r\n                if (localuser._user.id == userManager._currentuserid) {\r\n                    userManager._currentUser = localuser;\r\n                }\r\n            }\r\n        }\r\n\r\n        userManager._onInitOver();\r\n    },\r\n\r\n    _getGroupById: function (id) {\r\n        var group = null;\r\n        for (groupindex in this._grouplist) {\r\n            group = this._grouplist[groupindex];\r\n            if (group._group.id == id) {\r\n                return group;\r\n            }\r\n        }\r\n        return null;\r\n    },\r\n\r\n    _getOnlineUsers: function (option) {\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_ONLINE,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _getOnlineUserInfo: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserOnline();\r\n\r\n        payload.setSzdevid(option.devid);\r\n        payload.setSuserid(option.userid);\r\n        payload.setIapplierid(option.applierid);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_GET_USER_ONLINEINFO,\r\n\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _add_group: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.UserGroupInfo();\r\n\r\n        payload.setSid(option.info.id);\r\n        payload.setSname(option.info.name);\r\n        payload.setSdescription(option.info.description);\r\n        payload.setSparentid(option.info.parentid);\r\n        jSWProtocol._LocalResource_2Pb(option.info.resources, payload);\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_ADDGROUP,\r\n\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _kickout_user: function (option) {\r\n\r\n        var payload = new proto.BVCU.UserConfig.Kickout();\r\n\r\n        var rc = jSWProtocol.SendRequest({\r\n            session: this._session,\r\n            msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SET_USER_KICKOUT,\r\n\r\n            payload: payload,\r\n            callback: option.callback,\r\n            tag: option.tag\r\n        });\r\n\r\n        return rc;\r\n    },\r\n\r\n    _onInitOver: function (bEnforce) {\r\n        if (!this._isInitOver || bEnforce) {\r\n            this._isInitOver = true;\r\n            this._initCallback({\r\n                    tag: this._usertag\r\n                }, {\r\n                    emms: {\r\n                        code: 0\r\n                    }\r\n                },\r\n                null);\r\n        }\r\n    },\r\n\r\n    _add_group_to_local: function (session, group) {\r\n        var groupitem = new jSW.SwUserManager.SwGroup(session, group);\r\n        this._grouplist.push(groupitem);\r\n        //groupitem._getGroupInfo();\r\n    },\r\n    _on_notify_mod_group: function (groupinfo) {\r\n        var isExist = false;\r\n        var group = null;\r\n        for (groupIndex in this._grouplist) {\r\n            group = this._grouplist[groupIndex];\r\n            if (group._group.id == groupinfo.id) {\r\n                isExist = true;\r\n                break;\r\n            }\r\n        }\r\n        if (isExist) {\r\n            group._groupinfo = groupinfo;\r\n            group.groupinfo = groupinfo;\r\n        } else {\r\n            var groupbaseinfo = {\r\n                id: groupinfo.id,\r\n                name: groupinfo.name,\r\n                parentid: groupinfo.parentid\r\n            };\r\n            group = new jSW.SwUserManager.SwGroup(this._session, groupbaseinfo, groupinfo);\r\n            this._grouplist.push(group);\r\n        }\r\n\r\n        return group;\r\n    },\r\n\r\n    _on_notify_del_group: function (usergroup) {\r\n        var group = null;\r\n        var isContain = false;\r\n        for (groupindex in this._grouplist) {\r\n            group = this._grouplist[groupindex];\r\n            if (group._group.id == usergroup.id) {\r\n                this._grouplist.splice(groupindex, 1);\r\n                isContain = true;\r\n                break;\r\n            }\r\n        }\r\n\r\n        if (isContain) {\r\n            return group;\r\n        }\r\n\r\n        return null;\r\n    },\r\n\r\n    _on_notify_mod_user: function (userinfo) {\r\n        var group = null;\r\n        var user = null;\r\n        for (groupIndex in this._grouplist) {\r\n            group = this._grouplist[groupIndex];\r\n            if (group._group.id == userinfo.sGroupId) {\r\n                user = group._on_notify_mod_user(userinfo);\r\n                break;\r\n            }\r\n        }\r\n        return user;\r\n    },\r\n\r\n    _on_notify_del_user: function (userinfo) {\r\n        var user = null;\r\n        user = this._getUserById(userinfo.id);\r\n        if (user != null) {\r\n            user = user._group._on_notify_del_user(user);\r\n        }\r\n        return user;\r\n    },\r\n\r\n    onGetGroupList: function (sender, response, data) {\r\n        var tag = sender.tag;\r\n        var userManager = tag.userManager;\r\n\r\n        var groupgeted = null;\r\n        var grouplocal = null;\r\n        var isContains = false;\r\n\r\n        for (groupindex in data) {\r\n            groupgeted = data[groupindex];\r\n            for (localgroupindex in userManager._grouplist) {\r\n                grouplocal = userManager._grouplist[localgroupindex];\r\n                if (groupgeted.id == grouplocal._group.id) {\r\n                    grouplocal._group = groupgeted;\r\n                    isContains = true;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            if (!isContains) {\r\n                userManager._add_group_to_local(this.session, groupgeted);\r\n            }\r\n\r\n            isContains = false;\r\n        }\r\n\r\n\r\n        userManager._innerGetUserList();\r\n    },\r\n\r\n    _onNotify: function (msgType, response, payload) {\r\n        if (!this._isInitOver) {\r\n            return;\r\n        }\r\n\r\n        var data = null;\r\n        var cmd = \"\";\r\n        var target = null;\r\n        switch (msgType) {\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_ADDGROUP:\r\n                data = proto.BVCU.UserConfig.UserGroupInfo.deserializeBinary(payload);\r\n                data = jSWProtocol.GroupInfoPb_2Json(data, this._session);\r\n                target = this._on_notify_mod_group(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.addgroup.cmd;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_MODGROUP:\r\n                data = proto.BVCU.UserConfig.UserGroupInfo.deserializeBinary(payload);\r\n                data = jSWProtocol.GroupInfoPb_2Json(data, this._session);\r\n                target = this._on_notify_mod_group(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.modgroupinfo.cmd;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_DELGROUP:\r\n                data = proto.BVCU.UserConfig.UserGroup.deserializeBinary(payload);\r\n                data = jSWProtocol.GroupPb_2Json(data);\r\n                target = this._on_notify_del_group(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.delgroup.cmd;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_ADDUSER:\r\n                data = proto.BVCU.UserConfig.UserInfo.deserializeBinary(payload);\r\n                data = jSWProtocol.USER_USERINFO_Pb2Json(data, this._session);\r\n                target = this._on_notify_mod_user(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.adduser.cmd;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_MODUSER:\r\n                data = proto.BVCU.UserConfig.UserInfo.deserializeBinary(payload);\r\n                data = jSWProtocol.USER_USERINFO_Pb2Json(data, this._session);\r\n                target = this._on_notify_mod_user(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.moduserinfo.cmd;\r\n                break;\r\n            case proto.WEBBVCU.MSGType.WEB_BVCU_NOTIFY_USER_DELUSER:\r\n                data = proto.BVCU.UserConfig.User.deserializeBinary(payload);\r\n                data = jSWProtocol.USER_USERPb_2Json(data);\r\n                target = this._on_notify_del_user(data);\r\n                cmd = jSWProtocol.RequestHeader.usercfg.deluser.cmd;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n        if (cmd != \"\") {\r\n            this._ondatachangedcallback(this, {}, {\r\n                cmd: cmd,\r\n                target: target\r\n            });\r\n        }\r\n    },\r\n\r\n    swGetCurrentUser: function () {\r\n        if (!this._isInitOver) {\r\n            console.log('please call get info function after init over!!!!!');\r\n            return null;\r\n        }\r\n\r\n        return this._currentUser;\r\n    },\r\n\r\n    swGetUAInfoByPuid: function(options){\r\n        if(typeof options.targetId != \"string\" || options.targetId.length == 0){\r\n            return jSW.RcCode.RC_CODE_E_FAIL\r\n        }\r\n\r\n        options[\"devidorname\"] = options.targetId\r\n        options[\"useridorname\"] = null\r\n\r\n        return this._SearchUAList(options);\r\n    },\r\n\r\n    swGetUAInfoByUserName: function(options){\r\n        if(typeof options.targetId != \"string\" || options.targetId.length == 0){\r\n            return jSW.RcCode.RC_CODE_E_FAIL\r\n        }\r\n\r\n        options[\"devidorname\"] = null\r\n        options[\"useridorname\"] = options.targetId\r\n\r\n        return this._SearchUAList(options);\r\n    },\r\n\r\n    _SearchUAList: function(options){\r\n        var rc = jSWUtils.CheckOptionsCallback(options, function(){\r\n            var payload = new proto.BVCU.Search.Search_Request();\r\n            var searchinfo = new proto.BVCU.Search.SearchInfo();\r\n            payload.setStsearchinfo(searchinfo);\r\n            searchinfo.setItype(jSWProtocol.SearchType.UALIST);\r\n            searchinfo.setIcount(Number(100));\r\n            searchinfo.setIpostition(Number(0));\r\n\r\n            var ualist = new proto.BVCU.Search.Search_UAListFilter();\r\n            payload.setStualistfilter(ualist);\r\n            if(options.devidorname != null){\r\n                ualist.setSzdevidorname(options.devidorname);\r\n            }\r\n            if(options.useridorname != null){\r\n                ualist.setSzuseridorname(options.useridorname);\r\n            }\r\n\r\n            var rc = jSWProtocol.SendRequest({\r\n                session: this._session,\r\n                msgtype: proto.WEBBVCU.MSGType.WEB_BVCU_SEARCH_UALIST,\r\n                payload: payload,\r\n                callback: options.callback,\r\n                tag: options.tag\r\n            });\r\n    \r\n            return rc;\r\n        }, this)\r\n        return rc\r\n    },\r\n\r\n    /*\r\n    options:{\r\n        callback:function(sender, response, data){\r\n            \r\n        },\r\n\r\n        ondatachanged: function(sender, response, data){\r\n            data:{\r\n                cmd: string,\r\n                target: object\r\n            }\r\n        },\r\n        tag: \r\n    }\r\n    */\r\n    swInit: function (options) {\r\n        if (options == null || options.ondatachanged == null || options.callback == null) {\r\n            console.log(\"options must be fill correctly! please try again\");\r\n            return;\r\n        }\r\n\r\n        this._ondatachangedcallback = options.ondatachanged;\r\n        this._initCallback = options.callback;\r\n        if (this._isInitOver) {\r\n            this._onInitOver(true);\r\n            return jSW.RcCode.RC_CODE_S_OK;\r\n        }\r\n\r\n        this._currentuserid = this._session._user;\r\n        this._isInitOver = false;\r\n        this._usertag = options.tag;\r\n\r\n        return this._getUserGroupList({\r\n            callback: this.onGetGroupList,\r\n            tag: {\r\n                userManager: this,\r\n                isInit: true\r\n            }\r\n        });\r\n    },\r\n\r\n    swGetCurrentUserId: function () {\r\n        return this._currentuserid;\r\n    },\r\n\r\n    swGetGroupList: function (options) {\r\n        if (!this._isInitOver) {\r\n            console.log('please call get info function after init over!!!!!');\r\n            return null;\r\n        }\r\n        setTimeout(options.callback, 5, {\r\n            tag: options.tag\r\n        }, {\r\n            emms: {\r\n                code: jSW.RcCode.RC_CODE_S_OK\r\n            }\r\n        }, this._grouplist);\r\n        return jSW.RcCode.RC_CODE_S_OK;\r\n    },\r\n\r\n    swGetGroupById: function (id) {\r\n        var group = this._getGroupById(id);\r\n        return group;\r\n    },\r\n\r\n    swGetUserById: function (groupid, userid) {\r\n        var group = this.swGetGroupById(groupid);\r\n        if (group == null)\r\n            return null;\r\n        var user = group.swGetUserById(userid);\r\n        return user;\r\n    },\r\n\r\n\r\n    _getUserById: function (userid) {\r\n        var user = null;\r\n        for (groupindex in this._grouplist) {\r\n            group = this._grouplist[groupindex];\r\n            if (group != null) {\r\n                user = group.swGetUserById(userid);\r\n                if (user != null) {\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n        return user;\r\n    },\r\n\r\n    /*\r\n        option= {\r\n            info: {\r\n                name: String,\r\n                description: String,\r\n                parentid: String,\r\n                resources: [\r\n                    {\r\n                        puid: String,\r\n                        permission: {\r\n                            config: false,\r\n                            channels: [\r\n                                {channelindex: channel._id_chanel,\r\n                                iscansee: false}\r\n                            ]\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            callback: function(sender, options, data){\r\n            },\r\n            tag: Object\r\n        }\r\n    */\r\n    swAddGroup: function (option) {\r\n        var dft_poptions = {\r\n            info: {\r\n                name: '',\r\n                description: '',\r\n                parentid: '',\r\n                resources: []\r\n            },\r\n            callback: null,\r\n            tag: null\r\n        };\r\n\r\n        var poptions = jSWUtils.extend({}, dft_poptions, option || {});\r\n        var rc = this._add_group(poptions);\r\n        return rc;\r\n    }\r\n}\n\n//# sourceURL=webpack:///../src/entity/jsw-user-mgr.js?");

/***/ }),

/***/ "../src/jsw-common-module.js":
/*!***********************************!*\
  !*** ../src/jsw-common-module.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var dependencyMgr = __webpack_require__(/*! ./build/dependency_mgr */ \"../src/build/dependency_mgr.js\");\r\nvar jSW = dependencyMgr.jSW;\r\nvar dMgr = dependencyMgr.dMgr;\r\n\r\nvar jSWProtocol = dMgr.ClaimModule(\"jSWProtocol\"); /**通信协议*/\r\nvar jSWUtils = dMgr.ClaimModule(\"jSWUtils\"); /**工具*/\r\nvar jSWOptions = dMgr.ClaimModule(\"jSWOptions\");\r\nvar PuLoad = dMgr.ClaimModule('PuLoad');\r\nvar AudioMgr = dMgr.ClaimModule(\"AudioMgr\");\r\nvar HTTPNruFile = dMgr.ClaimModule(\"HTTPNruFile\");\r\n\r\n\r\nmodule.exports = {\r\n    jSWProtocol: jSWProtocol,\r\n    jSWUtils: jSWUtils,\r\n    jSWOptions: jSWOptions,\r\n    PuLoad: PuLoad,\r\n    AudioMgr: AudioMgr,\r\n    HTTPNruFile: HTTPNruFile,\r\n    jSW: jSW\r\n}\r\n\r\n\r\n//require('./jsw-common-module')\r\n//\r\n\r\n//var jsw_common_module = require('./jsw-common-module');\r\n//var jSW = jsw_common_module[\"jSW\"];\r\n//var jSWProtocol = jsw_common_module[\"jSWProtocol\"];\r\n//var jSWUtils = jsw_common_module[\"jSWUtils\"];\r\n//var jSWOptions = jsw_common_module[\"jSWOptions\"];\r\n//var PuLoad = jsw_common_module[\"PuLoad\"];\r\n//var AudioMgr = jsw_common_module[\"AudioMgr\"];\r\n//var HTTPNruFile = jsw_common_module[\"HTTPNruFile\"];\r\n\n\n//# sourceURL=webpack:///../src/jsw-common-module.js?");

/***/ }),

/***/ "../src/tmp/jsw.1592385417234.js":
/*!***************************************!*\
  !*** ../src/tmp/jsw.1592385417234.js ***!
  \***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("﻿module.exports = __webpack_require__(/*! ./../build/jsw-core */ \"../src/build/jsw-core.js\");\n\n//# sourceURL=webpack:///../src/tmp/jsw.1592385417234.js?");

/***/ }),

/***/ "../tmp/index.js":
/*!***********************!*\
  !*** ../tmp/index.js ***!
  \***********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _src_tmp_jsw_1592385417234_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../src/tmp/jsw.1592385417234.js */ \"../src/tmp/jsw.1592385417234.js\");\n/* harmony import */ var _src_tmp_jsw_1592385417234_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_src_tmp_jsw_1592385417234_js__WEBPACK_IMPORTED_MODULE_0__);\n\r\n\r\n_src_tmp_jsw_1592385417234_js__WEBPACK_IMPORTED_MODULE_0___default.a[\"version\"] = Object({\"SdkVer\":'2020-06-17 17:16:57',\"ReqOcxVer\":'2020-06-17 17:15:39',\"WebSerMidVer\":'2020-06-14 01:04:21'});\r\n\r\nconsole.log(\"\");\r\nconsole.log(\"JSW Version Info, You Can Find That Here: jSW['version']\");\r\nconsole.log(\"                  Sdk \" + '2020-06-17 17:16:57');\r\nconsole.log(\"          Require Ocx \" + '2020-06-17 17:15:39');\r\nconsole.log(\"Web Server Middleware \" + '2020-06-14 01:04:21');\r\nconsole.log(\"\");\r\n\r\nwindow['jSW'] = _src_tmp_jsw_1592385417234_js__WEBPACK_IMPORTED_MODULE_0___default.a;\n\n//# sourceURL=webpack:///../tmp/index.js?");

/***/ })

/******/ });