securityStatus_protocol_page.html 20 KB
Newer Older
李远洪's avatar
李远洪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
{% extends "protocolTools/report/GPS_protocol_page.html" %}
{% block title %}Security_protocol{% endblock %}
{% block content_1 %}
<div id="container3" style="width:100%;min-height:750px;float:left;_background:green;margin-top:10px;_border-top: 1px solid #eee;">
    <div style="width:100%;_background:green;padding:5px;padding-top:0px;">
        <h3 style="border-bottom: 1px solid #eee;">设置协议头:</h3>
        <label>消息流水号:</label><input id="WATER_CODE" type="text" class="form-control" value="0014" style="width:100px;">
        <label style="margin-left:10px;">车机号:</label><input id="DEV_ID" type="text" class="form-control" value="M121501010001">
        <label style="margin-left:10px;">安防状态消息数量:</label><input id="msgCount" type="text" class="form-control" value="1" style="width:100px;">
    </div>
    <H3 style="border-bottom: 1px solid #eee;">设置终端上报安防状态消息内容:</H3>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:320px;"><label>状态掩码:</label><input style="width:220px;" id="statusCode" type="text" class="form-control" value="ffffffffffffffffffff"></li>
        <label style="margin-left:10px;">定位类型:</label><select style="width:120px;" id="locationType" class="form-control">
            <option value="1">GPS包</option>
            <option value="2">基站包</option>
        </select>
    </ul>
    <h4>安全状态:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>ACC状态:</label><select style="width:80px;" id="accStatus" class="form-control">
            <option value="1"></option>
            <option value="0"></option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">设防撤防状态:</label><select style="width:80px;" id="defenseStatus" class="form-control">
            <option value="2">设防</option>
            <option value="0">撤防</option>
        </select></li>
        <li style="width:175px;"><label>脚刹状态:</label><select style="width:80px;" id="brakeStatus" class="form-control">
            <option value="4">踩下</option>
            <option value="0" selected="selected">松开</option>
        </select></li>
        <li style="width:175px;"><label>是否踩油门:</label><select style="width:80px;" id="acceleratorStatus" class="form-control">
            <option value="8">踩下</option>
            <option value="0">松开</option>
        </select></li>
        <li style="width:175px;"><label>手刹状态:</label><select style="width:80px;" id="handBrakeStatus" class="form-control">
            <option value="16">拉起</option>
            <option value="0" selected="selected">松开</option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">主驾驶安全带:</label><select style="width:80px;" id="mainSafetyBelt" class="form-control">
            <option value="32">插入</option>
            <option value="0">松开</option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">副驾驶安全带:</label><select style="width:80px;" id="subSafetyBelt" class="form-control">
            <option value="64">插入</option>
            <option value="0">松开</option>
        </select></li>
    </ul>
    <h4>门状态:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>左前门:</label><select style="width:80px;" id="lfDoorStatus" class="form-control">
            <option value="1"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>右前门:</label><select style="width:80px;" id="rfDoorStatus" class="form-control">
            <option value="2"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>左后门:</label><select style="width:80px;" id="lbDoorStatus" class="form-control">
            <option value="4"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>右后门:</label><select style="width:80px;" id="rbDoorStatus" class="form-control">
            <option value="8"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>后备箱:</label><select style="width:80px;" id="trunk" class="form-control">
            <option value="16"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>发送机盖:</label><select style="width:80px;" id="enginCover" class="form-control">
            <option value="32"></option>
            <option value="0" selected="selected"></option>
        </select></li>
    </ul>
    <h4>锁状态:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">左前门锁状态:</label><select style="width:80px;" id="lfDoorLockStatus" class="form-control">
            <option value="1"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">右前门锁状态:</label><select style="width:80px;" id="rfDoorLockStatus" class="form-control">
            <option value="2"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">左后门锁状态:</label><select style="width:80px;" id="lbDoorLockStatus" class="form-control">
            <option value="4"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label style="word-break:break-all;font-size:12px;">右后门锁状态:</label><select style="width:80px;" id="rbDoorLockStatus" class="form-control">
            <option value="8"></option>
            <option value="0" selected="selected"></option>
        </select></li>
    </ul>
    <h4>窗户状态:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>左前窗:</label><select style="width:80px;" id="lfWindowStatus" class="form-control">
            <option value="1"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>右前窗:</label><select style="width:80px;" id="rfWindowStatus" class="form-control">
            <option value="2"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>左后窗:</label><select style="width:80px;" id="lbWindowStatus" class="form-control">
            <option value="4"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>右后窗:</label><select style="width:80px;" id="rbWindowStatus" class="form-control">
            <option value="8"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>天窗开关:</label><select style="width:80px;" id="topWindowStatus" class="form-control">
            <option value="16"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>左转向灯:</label><select style="width:80px;" id="lTurnLight" class="form-control">
            <option value="32"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>右转向灯:</label><select style="width:80px;" id="rTurnLight" class="form-control">
            <option value="64"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>阅读灯:</label><select style="width:80px;" id="readLight" class="form-control">
            <option value="128"></option>
            <option value="0" selected="selected"></option>
        </select></li>
    </ul>
    <h4>灯光状态:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>近光灯:</label><select style="width:80px;" id="lowHeadlight" class="form-control">
            <option value="1"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>远光灯:</label><select style="width:80px;" id="highHeadlight" class="form-control">
            <option value="2"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>前雾灯:</label><select style="width:80px;" id="ffogLight" class="form-control">
            <option value="4"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>后雾灯:</label><select style="width:80px;" id="bfogLight" class="form-control">
            <option value="8"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>危险灯:</label><select style="width:80px;" id="dangerLight" class="form-control">
            <option value="16"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>倒车灯:</label><select style="width:80px;" id="backCarLight" class="form-control">
            <option value="32"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>auto灯:</label><select style="width:80px;" id="autoLight" class="form-control">
            <option value="64"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>示宽灯:</label><select style="width:80px;" id="widthLight" class="form-control">
            <option value="128"></option>
            <option value="0" selected="selected"></option>
        </select></li>
    </ul>
    <h4>开关状态A:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>机油报警:</label><select style="width:80px;" id="machineOilWarning" class="form-control">
            <option value="1"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>燃油报警:</label><select style="width:80px;" id="oilWarning" class="form-control">
            <option value="2"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>雨刷报警:</label><select style="width:80px;" id="wiperWarning" class="form-control">
            <option value="4"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>喇叭报警:</label><select style="width:80px;" id="loudsspeakerWaring" class="form-control">
            <option value="8"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>空调:</label><select style="width:80px;" id="airConditionerWaring" class="form-control">
            <option value="16"></option>
            <option value="0" selected="selected"></option>
        </select></li>
        <li style="width:175px;"><label>后视镜状态:</label><select style="width:80px;" id="backMirrorWaring" class="form-control">
            <option value="32"></option>
            <option value="0" selected="selected"></option>
        </select></li>
    </ul>
    <h4>开关状态B:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>档位:</label><select style="width:80px;" id="gears" class="form-control">
            <option value="0">P</option>
            <option value="16">R</option>
            <option value="32">N</option>
            <option value="48">D</option>
            <option value="64">1挡</option>
            <option value="80">2挡</option>
            <option value="96">3挡</option>
            <option value="112" selected="selected">4挡</option>
            <option value="128">5挡</option>
            <option value="144">6挡</option>
            <option value="160">M挡</option>
            <option value="176">S挡</option>
        </select></li>
    </ul>
    <h4>数据字节:</h4>
    <ul class="protocol_content" style="padding:0px;">
        <li style="width:175px;"><label>V1N1:</label><select style="width:80px;" id="V1N1" class="form-control">
            <option value="1">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
        <li style="width:175px;"><label>总线总里程:</label><select style="width:80px;" id="busTotalMileage" class="form-control">
            <option value="8">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
        <li style="width:175px;"><label>仪表数据:</label><select style="width:80px;" id="meterData" class="form-control">
            <option value="16">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
        <li style="width:175px;"><label>发送机转速:</label><select style="width:80px;" id="engineSpeed" class="form-control">
            <option value="32">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
        <li style="width:175px;"><label>车辆速度:</label><select style="width:80px;" id="speed" class="form-control">
            <option value="64">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
        <li style="width:175px;"><label>剩余油量:</label><select style="width:80px;" id="surplusOil" class="form-control">
            <option value="128">存在</option>
            <option value="0">不存在</option>n>
        </select></li>
    </ul>
    <H3 style="border-bottom: 1px solid #eee;">控制:</H3>
    <div style="width:100%;padding:5px;margin-top:10px;">
        <button type="button" class="btn btn-primary" id="sendMsgBtn">发送消息</button>
    </div>
    <H3 style="border-bottom: 1px solid #eee;">返回信息:</H3>
    <div style="width:100%;padding:5px;margin-top:10px;">
        <textarea id="showFeedback" style="width:100%;padding:5px;" rows="8"></textarea>
    </div>
</div>


<script>
//发送心跳数据包
$("#sendMsgBtn").click(function(){
    var WATER_CODE = $("#WATER_CODE").val();
    var DEV_ID = $("#DEV_ID").val();
    var msgCount = $("#msgCount").val();

    var statusCode = $("#statusCode").val();
    var locationType = $("#locationType").val();

    var accStatus = parseInt($("#accStatus").val());
    var defenseStatus = parseInt($("#defenseStatus").val());
    var brakeStatus = parseInt($("#brakeStatus").val());
    var acceleratorStatus = parseInt($("#acceleratorStatus").val());
    var handBrakeStatus = parseInt($("#handBrakeStatus").val());
    var mainSafetyBelt = parseInt($("#mainSafetyBelt").val());
    var subSafetyBelt = parseInt($("#subSafetyBelt").val());
    var securityStatus = accStatus + defenseStatus + brakeStatus + acceleratorStatus + handBrakeStatus + mainSafetyBelt + subSafetyBelt

    var lfDoorStatus = parseInt($("#lfDoorStatus").val());
    var rfDoorStatus = parseInt($("#rfDoorStatus").val());
    var lbDoorStatus = parseInt($("#lbDoorStatus").val());
    var rbDoorStatus = parseInt($("#rbDoorStatus").val());
    var trunk = parseInt($("#trunk").val());
    var enginCover = parseInt($("#enginCover").val());
    var doorStatus = lfDoorStatus + rfDoorStatus + lbDoorStatus + rbDoorStatus + trunk + enginCover

    var lfDoorLockStatus = parseInt($("#lfDoorLockStatus").val());
    var rfDoorLockStatus = parseInt($("#rfDoorLockStatus").val());
    var lbDoorLockStatus = parseInt($("#lbDoorLockStatus").val());
    var rbDoorLockStatus = parseInt($("#rbDoorLockStatus").val());
    var lockStatus = lfDoorLockStatus + rfDoorLockStatus + lbDoorLockStatus + rbDoorLockStatus

    var lfWindowStatus = parseInt($("#lfWindowStatus").val());
    var rfWindowStatus = parseInt($("#rfWindowStatus").val());
    var lbWindowStatus = parseInt($("#lbWindowStatus").val());
    var rbWindowStatus = parseInt($("#rbWindowStatus").val());
    var topWindowStatus = parseInt($("#topWindowStatus").val());
    var lTurnLight = parseInt($("#lTurnLight").val());
    var rTurnLight = parseInt($("#rTurnLight").val());
    var readLight = parseInt($("#readLight").val());
    var windowStatus = lfWindowStatus + rfWindowStatus + lbWindowStatus + rbWindowStatus + topWindowStatus + lTurnLight + rTurnLight + readLight

    var lowHeadlight = parseInt($("#lowHeadlight").val());
    var highHeadlight = parseInt($("#highHeadlight").val());
    var ffogLight = parseInt($("#ffogLight").val());
    var bfogLight = parseInt($("#bfogLight").val());
    var dangerLight = parseInt($("#dangerLight").val());
    var backCarLight = parseInt($("#backCarLight").val());
    var autoLight = parseInt($("#autoLight").val());
    var widthLight = parseInt($("#widthLight").val());
    var lightStatus = lowHeadlight + highHeadlight + ffogLight + bfogLight + dangerLight + backCarLight + autoLight + widthLight

    var machineOilWarning = parseInt($("#machineOilWarning").val());
    var oilWarning = parseInt($("#oilWarning").val());
    var wiperWarning = parseInt($("#wiperWarning").val());
    var loudsspeakerWaring = parseInt($("#loudsspeakerWaring").val());
    var airConditionerWaring = parseInt($("#airConditionerWaring").val());
    var backMirrorWaring = parseInt($("#backMirrorWaring").val());
    var onoffStatusA = machineOilWarning + oilWarning + wiperWarning + loudsspeakerWaring + airConditionerWaring + backMirrorWaring + backMirrorWaring

    var gears = parseInt($("#gears").val());
    var onoffStatusB = gears

    var V1N1 = parseInt($("#V1N1").val());
    var busTotalMileage = parseInt($("#busTotalMileage").val());
    var meterData = parseInt($("#meterData").val());
    var engineSpeed = parseInt($("#engineSpeed").val());
    var speed = parseInt($("#speed").val());
    var surplusOil = parseInt($("#surplusOil").val());
    var dataByte = V1N1 + busTotalMileage + meterData + engineSpeed + speed + surplusOil

    var data = {};
    data["WATER_CODE"] = WATER_CODE;
    data["DEV_ID"] = DEV_ID;
    data["msgCount"] = msgCount;
    data["statusCode"] = statusCode
    data["locationType"] = locationType
    data["securityStatus"] = securityStatus
    data["doorStatus"] = doorStatus
    data["lockStatus"] = lockStatus
    data["windowStatus"] = windowStatus
    data["lightStatus"] = lightStatus
    data["onoffStatusA"] = onoffStatusA
    data["onoffStatusB"] = onoffStatusB
    data["dataByte"] = dataByte

    var host = window.location.host;
336
    $("#showFeedback").val("")
李远洪's avatar
李远洪 committed
337 338 339 340 341 342 343 344
    $.ajax({
        url:"http://" + host + "/protocolTools/protocolReport_process/porcessSecurityStatusMsg",
        type:"post",
        data:data,
        dataType:"json",
        success:function(data){
            if(data.status == 200){
                //window.location.reload()
345 346 347
                msg = "发送消息:" + data.msgSend + "\n"
                msg = msg + "收到消息:" + data.result + "\n"
                msg = msg + "收到消息16进制:" + data.rev + "\n"
348
                msg = msg + "收到消息解析结果:" + JSON.stringify(data.orgRev) + "\n"
349
                $("#showFeedback").val(msg)
李远洪's avatar
李远洪 committed
350 351 352 353 354 355 356 357 358 359
            }else{
                $("#showFeedback").val(data.message)
                alert(data.message);
            }
        }
    });
});

</script>
{% endblock %}