positionOperateByVido.js 1.99 KB
//摄像机预置位控制类
function CameraController() {
  //添加预置位
  this.AddPreLocation = function (index) {
      //return ContrlPan("savepreplace", index, 0, 0) == "1";
      //alert("添加预置位");
      //var back = VionVideo.PtzSendCmdEx("V_PRESET_GET", index, "");

      var re = VionVideo.PtzSendCmd("V_PRESET_SET", index, "");
      return result(re);
  }
  //删除预置位 
  this.DeletePreplace = function (index) {
      //return ContrlPan("delpreplace", index, 0, 0) == "1";
      var re = VionVideo.PtzSendCmd("V_PRESET_DEL", index, "");
      return result(re);

  }
  //转到预置位
  this.GoToPreplace = function (index) {
      //index = 17;
      //return ContrlPan("gotopreplace", index, 0, 0) == "1";
      var re = VionVideo.PtzSendCmd("V_PRESET_JMP", index, "");
      return result(re);
  }
  //控制模式相关
  //设置当前窗口控制模式为无状态
  this.setPtzModeNull = function () {
      var re = VionVideo.PtzSendCmd("V_PTZMODE_SET_NULL", 0, "");
      return result(re);
  }
  //设置当前窗口控制模式为3D定位 支持方框 支持点定位	
  this.setPtzMode3dPtz = function () {
      var re = VionVideo.PtzSendCmd("V_PTZMODE_SET_3DPTZ", 0, "");
      return result(re);
  }
  //设置当前窗口控制模式为点击移动 支持鼠标点击 上下左右移动
  this.setPtzModeClick = function () {
      var re = VionVideo.PtzSendCmd("V_PTZMODE_SET_CLICK", 0, "");
      return result(re);
  }

  var baseLocalPath = "D:\\vion-tech\\";

  //删除本地缓存的文件
  this.deleteLocalFile = function (szPath) {
      var re;
      if (szPath == "") {
          var d = new Date();
          szPath = baseLocalPath + d.getFullYear();
          re = VionVideo.FileDelete(szPath, 0);
      }
      else {
          re = VionVideo.FileDelete(szPath, 1);
      }
      
      return result(re);
  }

  function result(re) {
      if (re == 1) {
          return true;
      }
      else {
          return false;
      }
  }

}

export {
  CameraController
}