<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<title>Setting</title>
|
<link href="../../../bootstrap/css/button.css" type="text/css" rel="stylesheet">
|
<link href="../css/video.css" type="text/css" rel="stylesheet">
|
<script type="text/javascript" src="../../js/jquery.min.js"></script>
|
<script type="text/javascript" src="../../../js/public.js"></script>
|
<script type="text/javascript">
|
$(function(){
|
|
});
|
|
//获取视频配置
|
function videoGetting() {
|
setting(10000, function(data) {
|
$('#videoSettingCallbak').val(JSON.stringify(data));
|
});
|
}
|
|
//设置视频配置
|
function videoSetting() {
|
var param = {};
|
param.resolution = $('#resolution').val();
|
setting(10001, function(data) {
|
$('#videoSettingCallbak').val(JSON.stringify(data));
|
}, param);
|
}
|
|
//获取电子围栏配置
|
function mapFenceGetting() {
|
setting(10002, function(data) {
|
$('#mapFenceSettingCallbak').val(JSON.stringify(data));
|
});
|
}
|
|
//设置电子围栏配置
|
function mapFenceSetting() {
|
var param = {};
|
param.fenceId = $('#mapFenceId').val();
|
param.areaId = $('#areaId').val();
|
param.areaType = $('#mapFenceType').val();
|
param.videoTime = $('#videoTime').val();
|
param.videoChn = $('#videoChn').val();
|
setting(10003, function(data) {
|
$('#mapFenceSettingCallbak').val(JSON.stringify(data));
|
}, param);
|
}
|
|
var isSetting = false;
|
/**
|
* type 类型
|
* param 参数
|
**/
|
function setting(type, callback, param){
|
if (isSetting) {
|
alert("setting please wait");
|
return ;
|
}
|
|
//1、参数配置的html文件放在cmsserver服务器的web服务器的目录下 示例 C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\10\setting.html
|
// C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\ 为固定的目录 表示设备参数配置的目录
|
// 10 表示厂家类型,不同厂家类型 TTXNET_SetDeviceInfo(4, 1, "SZ88888", TTX_DISK_TYPE_HDD, TTX_FACTORY_TYPE_18, TTX_FACTORY_TYPE_18, "V2014 0414");
|
// 如果 TTXNET_SetDeviceInfo接口传的参数为 TTX_FACTORY_TYPE_18为厂家类型,则为 C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\18\
|
// setting.html 页面必须配置为 setting.html
|
// 手机客户端会根据这个规则去调用不同厂家设备的参数配置界面
|
|
//2、会话信息和设备信息,通过url参数获取
|
// jsession和devIdno_会通过url传参进来,如setting.html?DevIDNO=10101&jsession=12341234678
|
// 需要将jsession和devIdno_再传给服务器
|
var jsession = getUrlParameter("jsession");
|
var devIdno_ = getUrlParameter("DevIDNO");
|
|
//3、参数配置设备sdk对应接口
|
// virtual bool DoTransparentConfig(int nType, const LPTTXConfigData_S pInConfig, LPTTXConfigData_S pOutConfig);
|
|
//4、界面请求参数传递
|
// type和param参数为上层自定义,param要求必须为json格式的数据,必须为 {}格式的,不能为数组格式[] 示例 var param = {};为对象格式, var param = []; 为数组格式
|
//var type = 1; //与设备DoTransparentConfig的int nType匹配上,这边配置为1,则sdk调用接口时nType=1
|
//var param = {}; //param 与 pInConfig 匹配上,格式为json格式
|
//param.request = $('.request').val();
|
// 示例: param.request = "1234567" 则pInConfig->cBuffer值为 {"request":"1234567"}
|
// param.name = "test"; param.value = "12345"; 则pInConfig->cBuffer值为 {"name":"test","value":"12345"}
|
|
//5、设备回复参数
|
// 设备上回复的数据通过 pOutConfig 返回,格式要求必须为json格式,示例: {"response":"123456"} //第一个字符必须为 { 最后 一个字符必须为 }
|
// 测试时,建议在设备的DoTransparentConfig接口内直接返回web界面的请求参数,如下示例
|
// memcpy(pOutConfig->cBuffer, pInConfig->cBuffer, pInConfig->nLength);
|
// pOutConfig->nLength = pInConfig->nLength;
|
|
//6、服务器回复参数 示例:{"cmsserver":"1","result":"0","request":"1234567"}
|
// "result":"0" 表示执行的结束,此参数一定返回
|
// "cmsserver":"1", 表示是否为c++服务器返回,如果存在并且为1,则为c++服务器返回的,此参数不一定会返回
|
// "request":"1234567" 为设备返回的参数
|
// 相当于服务器会在设备回复的参数基础上增加 "result":"0" 和 "cmsserver":"1 "参数
|
|
isSetting = true;
|
//url: 'http://'+ ip_ +':' + port_+'/2/46/callback=getData?Type=1&jsession=' + jsession + '&DevIDNO=' + devIdno_,
|
$.ajax({type: 'post',
|
url: 'StandardApiAction_deviceSetting.action?Type=' + type + '&jsession=' + jsession + '&DevIDNO=' + devIdno_,
|
data: {json:JSON.stringify(param)},
|
cache: false,
|
dataType:"json",
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
alert("setting error");
|
isSetting = false;
|
},
|
complete: function(XMLHttpRequest, textStatus) {
|
//alert("setting complete");
|
isSetting = false;
|
},
|
success: function (data) {
|
isSetting = false;
|
callback(data);
|
if(data.result == 0){
|
// $('.response').val(data);
|
alert("setting success");
|
} else {
|
if (typeof data.cmsserver != "undefined") {
|
// result 3参数错误
|
// result 21表示设备不存在
|
// result 22表示设备不在线
|
// result 23表示设备无响应
|
} else {
|
// result 1表示出现异常
|
// result 7 表示参数错误
|
}
|
alert("setting failed! result:" + data.result);
|
}
|
}
|
});
|
}
|
</script>
|
</head>
|
<body>
|
<div id="operateExample" style="position:absolute;min-width: 800px;margin-left:10px;">
|
<!-- 终端视频参数设置开始 -->
|
<div class="videoSetting">
|
<p>终端视频参数</p>
|
<div class="player-params">
|
<div class="player-param">
|
<a class="title">分辨率:</a>
|
<select style="width: 150px;" id="resolution">
|
<option value="1">480P</option>
|
<option value="2">720P</option>
|
<option value="3">1080P</option>
|
</select>
|
</div>
|
<div class="player-param">
|
<a class="title">返回:</a>
|
<textarea style="width: 400px;height:100px;" id="videoSettingCallbak"></textarea>
|
</div>
|
<div class="player-param">
|
<a id="videoGettingBtn" class="button button-primary button-rounded button-small" onclick="videoGetting()">获取</a>
|
<a id="videoSettingBtn" class="button button-primary button-rounded button-small" onclick="videoSetting()">配置</a>
|
</div>
|
</div>
|
</div>
|
<!-- 围栏设置开始 -->
|
<div class="mapFenceSetting">
|
<p>电子围栏参数</p>
|
<div class="player-params">
|
<div class="player-param">
|
<a class="title">围栏ID:</a>
|
<input style="width: 200px;" id="mapFenceId" value="30">
|
<a style="padding-left: 20px;" class="title">区域ID:</a>
|
<input style="width: 150px;" id="areaId" value="30">
|
</div>
|
<div class="player-param">
|
<a class="title">围栏类型:</a>
|
<select style="width: 150px;" id="mapFenceType">
|
<option value="1">禁入</option>
|
<option value="2">禁出</option>
|
</select>
|
<a style="padding-left: 20px;" class="title">录像时长(秒):</a>
|
<input style="width: 150px;" id="videoTime" value="30">
|
</div>
|
<div class="player-param">
|
<a class="title">录像通道:</a>
|
<input style="width: 150px;" id="videoChn" value="11">
|
<span>按位解析,例如1表示通道1、通道2和通道4</span>
|
<!-- <input type="checkbox" class="videoChn" id="CH1" value="1">
|
<label for="CH1">CH1</label>
|
<input type="checkbox" class="videoChn" id="CH2" value="1">
|
<label for="CH2">CH2</label>
|
<input type="checkbox" class="videoChn" id="CH3" value="1">
|
<label for="CH3">CH3</label>
|
<input type="checkbox" class="videoChn" id="CH4" value="1">
|
<label for="CH4">CH4</label>
|
<input type="checkbox" class="videoChn" id="CH5" value="1">
|
<label for="CH5">CH5</label>
|
<input type="checkbox" class="videoChn" id="CH6" value="1">
|
<label for="CH6">CH6</label>
|
<input type="checkbox" class="videoChn" id="CH7" value="1">
|
<label for="CH7">CH7</label>
|
<input type="checkbox" class="videoChn" id="CH8" value="1">
|
<label for="CH8">CH8</label>
|
<input type="checkbox" class="videoChn" id="CH9" value="1">
|
<label for="CH9">CH9</label>
|
<input type="checkbox" class="videoChn" id="CH10" value="1">
|
<label for="CH10">CH10</label>
|
<input type="checkbox" class="videoChn" id="CH11" value="1">
|
<label for="CH11">CH11</label>
|
<input type="checkbox" class="videoChn" id="CH12" value="1">
|
<label for="CH12">CH12</label> -->
|
</div>
|
<div class="player-param">
|
<a class="title">返回:</a>
|
<textarea style="width: 400px;height:100px;" id="mapFenceSettingCallbak"></textarea>
|
</div>
|
<div class="player-param">
|
<a id="mapFenceGettingBtn" class="button button-primary button-rounded button-small" onclick="mapFenceGetting()">获取</a>
|
<a id="mapFenceSettingBtn" class="button button-primary button-rounded button-small" onclick="mapFenceSetting()">配置</a>
|
</div>
|
</div>
|
</div>
|
</div>
|
</body>
|
</html>
|