You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
411 lines
15 KiB
411 lines
15 KiB
|
2 years ago
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
|
||
|
|
<head>
|
||
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
|
|
<title>缉查报警对讲组</title>
|
||
|
|
<style>
|
||
|
|
body {
|
||
|
|
margin: 0px;
|
||
|
|
overflow: hidden
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
<script type="text/javascript">
|
||
|
|
var MAXMEMBERS = 6; // 对讲组成员上限, 最多支持12个
|
||
|
|
var PTTLINE = MAXMEMBERS; // 对讲组线路
|
||
|
|
var currentGroup = {}; //当前对讲组对象
|
||
|
|
// 初始化线路状态
|
||
|
|
if (MAXMEMBERS > 12) {
|
||
|
|
alert('对讲组成员上限最多支持12个');
|
||
|
|
}
|
||
|
|
var lineArr = [];
|
||
|
|
for (var i = 0; i < MAXMEMBERS; i++) {
|
||
|
|
lineArr[i] = { policeid: '' };
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 创建线路号
|
||
|
|
* @returns {Number}, 线路号,失败返回-1
|
||
|
|
*/
|
||
|
|
function genLineNum(policeid) {
|
||
|
|
//如果当前警员正在占用一条线路,返回该线路
|
||
|
|
var linenum = getPoliceLineNum(policeid);
|
||
|
|
if (linenum != -1) {
|
||
|
|
return linenum;
|
||
|
|
}
|
||
|
|
//否则返回一条空线路
|
||
|
|
for (var i = 0; i < MAXMEMBERS; i++) {
|
||
|
|
var a = IPDispatcherCtrl.GetLineState(i);
|
||
|
|
if (a == 0 && lineArr[i].policeid == '') {
|
||
|
|
lineArr[i].policeid = policeid;
|
||
|
|
return i;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**获取警员占用的线路号,没有返回-1*/
|
||
|
|
function getPoliceLineNum(policeid) {
|
||
|
|
for (var i = 0; i < MAXMEMBERS; i++) {
|
||
|
|
if (lineArr[i].policeid == policeid) {
|
||
|
|
return i;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
function isOpen() {
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 获取url参数
|
||
|
|
*/
|
||
|
|
function GetUrlParam(paraName) {
|
||
|
|
var url = window.document.location.href.toString();
|
||
|
|
var arrObj = url.split("?");
|
||
|
|
if (arrObj.length > 1) {
|
||
|
|
var arrPara = arrObj[1].split("&");
|
||
|
|
var arr;
|
||
|
|
for (var i = 0; i < arrPara.length; i++) {
|
||
|
|
arr = arrPara[i].split("=");
|
||
|
|
if (arr != null && arr[0] == paraName) {
|
||
|
|
return arr[1];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return "";
|
||
|
|
} else {
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面初始化方法
|
||
|
|
*/
|
||
|
|
function initMDSParam() {
|
||
|
|
closeIPDispatcher();
|
||
|
|
initVideoCtrl();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 初始化调度台
|
||
|
|
*/
|
||
|
|
function initVideoCtrl() {
|
||
|
|
// for test start
|
||
|
|
try {
|
||
|
|
IPDispatcherCtrl.strName = '100041';
|
||
|
|
IPDispatcherCtrl.strPassword = '100041';
|
||
|
|
IPDispatcherCtrl.strServer = '119.167.113.90';
|
||
|
|
IPDispatcherCtrl.strLocal = '10.16.5.22';
|
||
|
|
IPDispatcherCtrl.strLicense = '49425E54DE5743AEA6750B28E7A70202';
|
||
|
|
var bresult = IPDispatcherCtrl.IsInitialize();
|
||
|
|
IPDispatcherCtrl.Initialize();
|
||
|
|
bresult = IPDispatcherCtrl.IsInitialize();
|
||
|
|
if (bresult == 0) {
|
||
|
|
alert("调度台没有初始化!");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
IPDispatcherCtrl.Logout();
|
||
|
|
var ret = IPDispatcherCtrl.Login(10);
|
||
|
|
}
|
||
|
|
catch (e) {
|
||
|
|
alert('服务异常!');
|
||
|
|
}
|
||
|
|
// for test end
|
||
|
|
// var url = "/HiatmpPro/scs/mds/initMdsConf";
|
||
|
|
// $.ajax({
|
||
|
|
// url: url,
|
||
|
|
// type: 'get',
|
||
|
|
// dataType: 'json',
|
||
|
|
// cache: false,
|
||
|
|
// success: function (data) {
|
||
|
|
// if (data.result == false) {
|
||
|
|
// alert("初始化调度台失败!");
|
||
|
|
// } else {
|
||
|
|
// var result = data.params;
|
||
|
|
// if (result == null || typeof (result) == "undefined") {
|
||
|
|
// alert("初始化调度台失败!");
|
||
|
|
// return;
|
||
|
|
// }
|
||
|
|
// try {
|
||
|
|
// IPDispatcherCtrl.strName = result.username;
|
||
|
|
// IPDispatcherCtrl.strPassword = result.password;
|
||
|
|
// IPDispatcherCtrl.strServer = result.serverip;
|
||
|
|
// IPDispatcherCtrl.strLocal = result.localip;
|
||
|
|
// IPDispatcherCtrl.strLicense = result.license;
|
||
|
|
// var bresult = IPDispatcherCtrl.IsInitialize();
|
||
|
|
// IPDispatcherCtrl.Initialize();
|
||
|
|
// bresult = IPDispatcherCtrl.IsInitialize();
|
||
|
|
// var timeout = 0;
|
||
|
|
// if (bresult == 0) {
|
||
|
|
// alert("调度台没有初始化!");
|
||
|
|
// return;
|
||
|
|
// }
|
||
|
|
// IPDispatcherCtrl.Logout();
|
||
|
|
// var ret = IPDispatcherCtrl.Login(10);
|
||
|
|
// }
|
||
|
|
// catch (e) {
|
||
|
|
// alert('服务异常!');
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// });
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 注销调度台控件
|
||
|
|
*/
|
||
|
|
function closeIPDispatcher() {
|
||
|
|
var voiceCtrl = document.getElementById("IPDispatcherCtrl");
|
||
|
|
if (null == voiceCtrl || "undefined" == voiceCtrl) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var isInit = IPDispatcherCtrl.IsInitialize();
|
||
|
|
var isLog = IPDispatcherCtrl.IsLogin();
|
||
|
|
if (isInit == 1 && isLog == 1)//登录
|
||
|
|
{
|
||
|
|
IPDispatcherCtrl.Logout();
|
||
|
|
}
|
||
|
|
IPDispatcherCtrl.OnCloseIPDispatcher();
|
||
|
|
IPDispatcherCtrl.DestroyInstance();
|
||
|
|
var isInit = IPDispatcherCtrl.IsInitialize();
|
||
|
|
if (isInit == 1) {
|
||
|
|
IPDispatcherCtrl.OnCloseIPDispatcher();
|
||
|
|
setCtrlUnUsed();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**解散对讲组*/
|
||
|
|
function destoryCustomPttGroup() {
|
||
|
|
var a = IPDispatcherCtrl.HangupCall(PTTLINE);
|
||
|
|
console.log('解散对讲组:' + currentGroup.GroupNum);
|
||
|
|
IPDispatcherCtrl.DestoryCustomPttGroup(currentGroup.GroupNum, currentGroup.GroupCreatorName);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**创建对讲组*/
|
||
|
|
function createCustomPttGroup() {
|
||
|
|
var bstrMembersList = '2:' + IPDispatcherCtrl.strName + ',';
|
||
|
|
var policeid = GetUrlParam('policeid');
|
||
|
|
// for test start
|
||
|
|
policeid = '017003';
|
||
|
|
// for test end
|
||
|
|
if (policeid) {
|
||
|
|
bstrMembersList += policeid + ',';
|
||
|
|
}
|
||
|
|
var groupid = IPDispatcherCtrl.CreateCustomPttGroup('缉查报警' + new Date().getTime(), '20,120,120,2,5,1800,', bstrMembersList);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 对讲抢话
|
||
|
|
*/
|
||
|
|
function pttSnatch() {
|
||
|
|
var a = IPDispatcherCtrl.MakeCall(PTTLINE, currentGroup.GroupNum, 1);
|
||
|
|
console.log(a, 'pttSnatch-----', currentGroup.GroupNum);
|
||
|
|
setTimeout(function () {
|
||
|
|
IPDispatcherCtrl.PttSnatch(PTTLINE);
|
||
|
|
}, 1000);
|
||
|
|
}
|
||
|
|
/**释放话权*/
|
||
|
|
function pttFree() {
|
||
|
|
IPDispatcherCtrl.PttFree(PTTLINE);
|
||
|
|
}
|
||
|
|
/**添加对讲组成员*/
|
||
|
|
function addMember(policeid) {
|
||
|
|
IPDispatcherCtrl.AddCustomPttGroupMember(currentGroup.GroupNum, currentGroup.GroupName, '1:' + policeid + ',');
|
||
|
|
}
|
||
|
|
/**删除对讲组成员*/
|
||
|
|
function delMember(policeid) {
|
||
|
|
IPDispatcherCtrl.DelCustomPttGroupMember(currentGroup.GroupNum, currentGroup.GroupName, '1:' + policeid + ',');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**调起组内所有成员的视频*/
|
||
|
|
function groupVideoMonitor() {
|
||
|
|
var groupMembers = currentGroup.CustomPttGroupMember;
|
||
|
|
for (var i = 0; i < groupMembers.length; i += 1) {
|
||
|
|
var police = groupMembers[i];
|
||
|
|
var linenum = getPoliceLineNum(police.Number);
|
||
|
|
if (police.Number != IPDispatcherCtrl.strName && police.Status != 0 && linenum == -1) {
|
||
|
|
videoMonitor(police.Number);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**挂断对讲组内所有成员的视频*/
|
||
|
|
function groupVideoHangup() {
|
||
|
|
var groupMembers = currentGroup.CustomPttGroupMember;
|
||
|
|
for (var i = 0; i < groupMembers.length; i += 1) {
|
||
|
|
var police = groupMembers[i];
|
||
|
|
if (police.Number != IPDispatcherCtrl.strName) {
|
||
|
|
videoHangup(police.Number);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**挂断退出对讲组成员的视频*/
|
||
|
|
function offMemberVideoHangup() {
|
||
|
|
var groupMembers = currentGroup.CustomPttGroupMember;
|
||
|
|
for (var m = 0; m < lineArr.length; m += 1) {
|
||
|
|
var policeid = lineArr[m].policeid;
|
||
|
|
if (policeid == '') {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
var isoffline = true;
|
||
|
|
for (var n = 0; n < groupMembers.length; n += 1) {
|
||
|
|
var police = groupMembers[n];
|
||
|
|
if (police.Number == policeid) {
|
||
|
|
isoffline = false;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (isoffline) {
|
||
|
|
videoHangup(policeid);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**视频监控*/
|
||
|
|
function videoMonitor(policeid) {
|
||
|
|
var linenum = genLineNum(policeid);
|
||
|
|
if (linenum == -1) {
|
||
|
|
alert('没有空余线路!');
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
console.log('线路号:' + linenum);
|
||
|
|
IPDispatcherCtrl.VideoMonitor(linenum, policeid);
|
||
|
|
}
|
||
|
|
/**视频挂断*/
|
||
|
|
function videoHangup(policeid) {
|
||
|
|
var linenum = getPoliceLineNum(policeid);
|
||
|
|
if (linenum != -1) {
|
||
|
|
IPDispatcherCtrl.HangupCall(linenum);
|
||
|
|
lineArr[linenum].policeid = '';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**注销*/
|
||
|
|
window.onbeforeunload = function () {
|
||
|
|
IPDispatcherCtrl.OnCloseIPDispatcher();
|
||
|
|
destoryCustomPttGroup();
|
||
|
|
}
|
||
|
|
|
||
|
|
</script>
|
||
|
|
|
||
|
|
|
||
|
|
<!--登录成功事件-->
|
||
|
|
<script type="text/javascript" FOR="IPDispatcherCtrl" EVENT="OnPhoneStateEvent(nState)">
|
||
|
|
console.log(nState + '--------------init');
|
||
|
|
|
||
|
|
// 创建对讲组
|
||
|
|
if (nState == 2) {
|
||
|
|
// createCustomPttGroup();
|
||
|
|
// 绑定视频控件与线路号关系
|
||
|
|
// for (var i = 0; i < MAXMEMBERS; i += 1) {
|
||
|
|
// var videoWin = document.getElementById('VideoWindow' + i);
|
||
|
|
// IPDispatcherCtrl.SetVideoWindow(i, videoWin.GetWindow());
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<script type="text/javascript" for="IPDispatcherCtrl" event="OnPhoneLineStateEvent(nLine,nState,nMediaType)">
|
||
|
|
if (nState == 4) {
|
||
|
|
for (var i = 0; i < MAXMEMBERS; i += 1) {
|
||
|
|
var videoWin = document.getElementById('VideoWindow' + i);
|
||
|
|
IPDispatcherCtrl.SetVideoWindow(i, videoWin.GetWindow());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
console.log('OnPhoneLineStateEvent---', nLine, nState);
|
||
|
|
var videoWin = document.getElementById('VideoWindow' + nLine);
|
||
|
|
if (videoWin) {
|
||
|
|
videoWin.RefreshWindow();
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<!--对讲组通知事件-->
|
||
|
|
<script type="text/javascript" FOR="IPDispatcherCtrl" EVENT="OnCustomGroupNotify(nError,bstrMessage)">
|
||
|
|
console.log(bstrMessage + '--------------OnCustomGroupNotify');
|
||
|
|
|
||
|
|
try {
|
||
|
|
currentGroup = JSON.parse(bstrMessage);
|
||
|
|
// console.log(currentGroup);
|
||
|
|
if (currentGroup.Type == 'create') { //对讲组创建成功事件
|
||
|
|
// groupVideoMonitor();
|
||
|
|
var lineState = IPDispatcherCtrl.GetLineState(PTTLINE);
|
||
|
|
if (lineState == 0) {
|
||
|
|
var a = IPDispatcherCtrl.MakeCall(PTTLINE, currentGroup.GroupNum, 1);
|
||
|
|
console.log(a, 'MakeCall-----', currentGroup.GroupNum);
|
||
|
|
}
|
||
|
|
} else if (currentGroup.Type == 'update') { //对讲组更新成功事件,初次创建成功时也会回调这个
|
||
|
|
var lineState = IPDispatcherCtrl.GetLineState(PTTLINE);
|
||
|
|
if (lineState == 0) {
|
||
|
|
var a = IPDispatcherCtrl.MakeCall(PTTLINE, currentGroup.GroupNum, 1);
|
||
|
|
console.log(a, 'OnCustomGroupNotify,MakeCall-----', currentGroup.GroupNum);
|
||
|
|
}
|
||
|
|
} else if (currentGroup.Type == 'add') { //添加成员事件
|
||
|
|
groupVideoMonitor();
|
||
|
|
} else if (currentGroup.Type == 'del') { //删除成员事件
|
||
|
|
offMemberVideoHangup();
|
||
|
|
}
|
||
|
|
} catch (exception) {
|
||
|
|
alert(exception);
|
||
|
|
}
|
||
|
|
// IPDispatcherCtrl.GetCustomPttGroupMembers(currentGroup.GroupNum);
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<script type="text/javascript" for="IPDispatcherCtrl" event="OnCustomGroupResult(nError,bstrMessage)">
|
||
|
|
{
|
||
|
|
var cade = "自建对讲组操作结果事件,";
|
||
|
|
console.log(cade + 'nError:' + nError + ',bstrMessage:' + bstrMessage);
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
</head>
|
||
|
|
|
||
|
|
<body scroll="no">
|
||
|
|
<OBJECT ID='IPDispatcherCtrl' CLASSID='CLSID:A1347CC2-E5A5-4717-A8DA-CD0AA97A68D9' CODEBASE='IPDispatcherCOM.cab#version=1,0,0,1'
|
||
|
|
width='0' height='0'></OBJECT>
|
||
|
|
<div style='height:100%;width:100%;'>
|
||
|
|
<!--<script type="text/javascript">-->
|
||
|
|
<!--for (var i = 0; i < MAXMEMBERS; i += 1) {-->
|
||
|
|
<!--document.writeln('<object id="VideoWindow"' + i + ' classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>');-->
|
||
|
|
<!--}-->
|
||
|
|
<!--</script>-->
|
||
|
|
<object id="VideoWindow0" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
<object id="VideoWindow1" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
<object id="VideoWindow2" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
<object id="VideoWindow3" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
<object id="VideoWindow4" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
<object id="VideoWindow5" classid="CLSID:FD968A91-02A5-4596-AA56-4368ED02DDD2" width="200px" height="200px"></object>
|
||
|
|
</div>
|
||
|
|
<button type="button" value="登录" onclick="initMDSParam()">登录</button>
|
||
|
|
<button type="button" value="注销" onclick="closeIPDispatcher()">注销</button><br /><br/>
|
||
|
|
<button type="button" value="创建对讲组" onclick="createCustomPttGroup()">创建对讲组</button>
|
||
|
|
<button type="button" value="解散对讲组" onclick="destoryCustomPttGroup()">解散对讲组</button>
|
||
|
|
<button type="button" value="申请话权" onclick="pttSnatch()">申请话权</button>
|
||
|
|
<button type="button" value="释放话权" onclick="pttFree()">释放话权</button><br />
|
||
|
|
<button type="button" onclick="addMember('114399')">添加对讲组成员114399</button>
|
||
|
|
<button type="button" onclick="addMember('252005')">添加对讲组成员252005</button>
|
||
|
|
<button type="button" onclick="addMember('928018')">添加对讲组成员928018</button>
|
||
|
|
<button type="button" onclick="addMember('20172064')">添加对讲组成员20172064</button>
|
||
|
|
<button type="button" onclick="addMember('20171474')">添加对讲组成员20171474</button>
|
||
|
|
<button type="button" onclick="addMember('017003')">添加对讲组成员017003</button><br/>
|
||
|
|
<button type="button" onclick="delMember('114399')">删除对讲组成员114399</button>
|
||
|
|
<button type="button" onclick="delMember('252005')">删除对讲组成员252005</button>
|
||
|
|
<button type="button" onclick="delMember('928018')">删除对讲组成员928018</button>
|
||
|
|
<button type="button" onclick="delMember('20172064')">删除对讲组成员20172064</button>
|
||
|
|
<button type="button" onclick="delMember('20171474')">删除对讲组成员20171474</button>
|
||
|
|
<button type="button" onclick="delMember('017003')">删除对讲组成员017003</button><br/><br/>
|
||
|
|
|
||
|
|
<button type="button" onclick="videoMonitor('017003')">视频监视017003</button>
|
||
|
|
<button type="button" onclick="videoMonitor('114399')">视频监视114399</button>
|
||
|
|
<button type="button" onclick="videoMonitor('252005')">视频监视252005</button>
|
||
|
|
<button type="button" onclick="videoMonitor('928018')">视频监视928018</button>
|
||
|
|
<button type="button" onclick="videoMonitor('20172064')">视频监视20172064</button>
|
||
|
|
<button type="button" onclick="videoMonitor('20171474')">视频监视20171474</button></br>
|
||
|
|
<button type="button" onclick="videoHangup('017003')">挂断视频017003</button>
|
||
|
|
<button type="button" onclick="videoHangup('114399')">挂断视频114399</button>
|
||
|
|
<button type="button" onclick="videoHangup('252005')">挂断视频252005</button>
|
||
|
|
<button type="button" onclick="videoHangup('928018')">挂断视频928018</button>
|
||
|
|
<button type="button" onclick="videoHangup('20172064')">挂断视频20172064</button>
|
||
|
|
<button type="button" onclick="videoHangup('20171474')">挂断视频20171474</button></br>
|
||
|
|
|
||
|
|
<script type="text/javascript">
|
||
|
|
// initMDSParam();
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
|
||
|
|
</html>
|