Commit 03819733 authored by liyuanhong's avatar liyuanhong

增加了附加属性的js代码

parent f21d3a19
......@@ -12,12 +12,18 @@ templates:存放网页模板文件 html
views:存放网页端操作的后台处理逻辑,以及页面的展示逻辑
run.py:启动项目图形操作界面主程序,访问:127.0.0.1:5000 即可
requirements.txt:设置项目需要的依赖库
### (二)、安装部署
1、机器上安装了python3 和 pip包管理工具
2、进入项目根目录,编辑requirements.txt, 删除第一行wxPython==4.0.7.post2
3、使用 :pip install -r requirement.txt 安装依赖库
4、python3 run.py 运行项目
5、访问 host:5000 即可进入模拟器页面
### ()、文档目录
### ()、文档目录
[1、lib使用库说明](doc/lib_details.md)
[2、如何使用web图形操作界面](https://www.baidu.com/)
### ()、图形界面展示
### ()、图形界面展示
#### m500操作界面:
![alt text](doc/img/m500_1.png "Title Text")
#### 车安优操作界面:
......
......@@ -18,12 +18,12 @@ class SendMultMsgThread():
self.msg = msg
self.timeOut = 30 #socket超时时间
self.BUF_SIZE = 1024 #接收消息缓存
self.threadCount = 10000 #并发线程数
self.threadCount = 1000 #并发线程数
self.totalTime = 0 #所有线程的运行总和
self.threadArr = {} #保存每个线程的信息
self.failThreadCount = 0 #失败线程数
self.durThreads = [] #持续发送线程数组,当数组为空,表示所有线程已经结束
dt = 1 * 20 * 60
dt = 1 * 10 * 60
self.durTime = dt #线程持续时间
self.connectTimeoutNum = 0 #连接超时线程数
self.sendTimeoutNum = 0 #发送超时线程数
......
......@@ -36,11 +36,10 @@ class Location_msg(MessageBase):
return msg
# 生成一条完整的消息,针对图形界面,可传递参数
def generateMsg_GUI(self,msgID="0200",phoneNum="13146201119",msgWaterCode=1,encryptionType=0,subPkg=0, \
):
def generateMsg_GUI(self,params):
msg = ""
msgHeader = self.getMsgHeader_GUI(msgID,phoneNum,msgWaterCode,encryptionType,subPkg)
msgBody = self.getMsgBody_GUI()
msgHeader = self.getMsgHeader_GUI(params["msgID"],int(params["phoneNum"]),int(params["msgWaterCode"]),int(params["encryptionType"]),int(params["subPkg"]))
msgBody = self.getMsgBody_GUI(params)
checkCode = self.getCheckCode(msgHeader + msgBody)
msg = msg + self.IDENTIFY
info = msgHeader + msgBody + checkCode
......@@ -78,10 +77,14 @@ class Location_msg(MessageBase):
return msg
# 获取消息体,针对图形界面,可传递参数
def getMsgBody_GUI(self,baseInfo,extraInfo):
def getMsgBody_GUI(self,params):
msg = ""
locationBaseInfo = self.getLocationBaseInfo_GUI(baseInfo) #位置基本信息
locationExtraInfo = self.getLocationExtraInfo_GUI(extraInfo) #位置附加信息
locationBaseInfo = self.getLocationBaseInfo_GUI(params["baseInfo"]) #位置基本信息
locationExtraInfo = ""
if params["extraInfo"] == {}:
pass
else:
locationExtraInfo = self.getLocationExtraInfo_GUI(params["extraInfo"]) #位置附加信息
msg = locationBaseInfo + locationExtraInfo
return msg
# 获取消息体,数据随机产生
......@@ -112,13 +115,13 @@ class Location_msg(MessageBase):
# 获取位置基本信息,针对图形界面,可传递参数
def getLocationBaseInfo_GUI(self,baseInfo):
msg = ""
alarmFlag = self.int2hexStringByBytes(baseInfo["alarmFlag"],4) #报警标志
status = self.int2hexStringByBytes(baseInfo["status"],4) #状态
latitude = self.getLatitude(baseInfo["latitude"]) #纬度
longtitude = self.getLongtitude(baseInfo["longtitude"]) #经度
elevation = self.getElevation(baseInfo["elevation"]) #海拔高度
speed = self.getSpeed(baseInfo["speed"]) #速度
directionAngle = self.getDirectionAngle(baseInfo["directionAngle"]) #获取方向角度
alarmFlag = self.int2hexStringByBytes(int(baseInfo["alarmFlag"]),4) #报警标志
status = self.int2hexStringByBytes(int(baseInfo["status"]),4) #状态
latitude = self.getLatitude(float(baseInfo["latitude"])) #纬度
longtitude = self.getLongtitude(float(baseInfo["longtitude"])) #经度
elevation = self.getElevation(int(baseInfo["elevation"])) #海拔高度
speed = self.getSpeed(int(baseInfo["speed"])) #速度
directionAngle = self.getDirectionAngle(int(baseInfo["directionAngle"])) #获取方向角度
infoTime = self.getInfoTime(baseInfo["infoTime"]) #获取时间
msg = alarmFlag + status + latitude + longtitude + elevation + speed + directionAngle + infoTime
return msg
......@@ -182,7 +185,7 @@ class Location_msg(MessageBase):
# data = data +extra_FA
return data
def getLocationExtraInfo_GUI(self):
def getLocationExtraInfo_GUI(self,extraInfo):
data = ""
# 里程,DWORD,1 / 10km,对应车上里程表读数;不支持OBD时,为基于GPS车速统计的车辆累计行驶总里程。
extra_01 = "01" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(20202020,4)
......
......@@ -22,14 +22,14 @@ port = 9001
# msg = MessageBase().generateMsg()
# msg = TerminalCommonMsgRes_msg().generateMsg() #终端通用应答
msg = TerminalHeartbeat_msg().generateMsg() #终端心跳
# msg = TerminalHeartbeat_msg().generateMsg() #终端心跳
# msg = TerminalRegister_msg().generateMsg() #终端注册
# msg = TerminalCancle_msg().generateMsg() #终端注销
# msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
# msg = Location_msg().generateMsg() #位置信息汇报
msg = Location_msg().generateMsg() #位置信息汇报
# msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
......
......@@ -8,7 +8,7 @@ from crcmod import *
import struct
#####################################################
# 定义生成校验字段的函数(自己翻译的函数,简化了很多步骤)
# 定义生成校验字段的函数(自己翻译的函数,简化了很多步骤)
#####################################################
def myCrc16(msg):
msg = str2Ascsii(msg)
......
#coding:utf-8
'''
处理json辅助类
'''
#####################################################
# 判断json中是否有值为空的项
#####################################################
def hasJsonDataIsNone(data):
for key,value in data.items():
if value == None or value == "":
return True
return False
if __name__ == "__main__":
data = {"a":1,"b":"bb","c":"s","d":123}
print(hasJsonDataIsNone(data))
\ No newline at end of file
......@@ -25,7 +25,7 @@ app.register_blueprint(message_process,url_prefix = "/messageTools/message_proce
@app.route('/')
def hello():
return redirect('/tab1/style')
return redirect('/messageTools/message_view/heartBeat_msg_page')
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0')
\ No newline at end of file
......@@ -4,7 +4,7 @@
<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>消息ID:</label><input id="msgID" type="text" class="form-control" disabled="disabled" value="0100" style="width:80px;">
<label>消息ID:</label><input id="msgID" type="text" class="form-control" disabled="disabled" value="0200" style="width:80px;">
<label>终端手机号:</label><input id="phoneNum" type="text" class="form-control" value="13146201119" style="width:150px;">
<label>消息流水号:</label><input id="msgWaterCode" type="text" class="form-control" value="1" style="width:60px;">
<label>是否加密:</label><select style="width:100px;" id="encryptionType" class="form-control">
......@@ -187,30 +187,30 @@
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">
<label>选择附加消息:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li style="width:50px;"><label><input type="checkbox" id="01" />里程 </label> </li>
<li style="width:60px;"><label><input type="checkbox" id="02" />油量 </label> </li>
<li style="width:140px;"><label style="width: 130px;"><input type="checkbox" id="11" />超速报警附加信息 </label> </li>
<li style="width:200px;"><label style="width: 190px;"><input type="checkbox" id="12" />进出区域/路线报警附加信息 </label> </li>
<li style="width:260px;"><label style="width: 250px;"><input type="checkbox" id="13" />路段行驶时间不足/过长报警附加信息 </label> </li>
<li style="width:80px;"><label style="width: 70px;"><input type="checkbox" id="2A" />IO状态位 </label> </li>
<li style="width:170px;"><label style="width: 160px;"><input type="checkbox" id="30" />无线通信网络信号强度 </label> </li>
<li style="width:200px;"><label style="width: 150px;"><input type="checkbox" id="31" />GNSS 定位卫星数 </label> </li>
<li style="width:120px;"><label style="width: 120px;"><input type="checkbox" id="EA" />基础数据项列表 </label> </li>
<li style="width:145px;"><label style="width: 140px;"><input type="checkbox" id="EB" />轿车 OBD 数据流 </label> </li>
<li style="width:200px;"><label style="width: 150px;"><input type="checkbox" id="FA" />报警事件 ID 数据项 </label> </li>
<li style="width:50px;"><label><input type="checkbox" id="01" onclick="extraSelect(this)"/>里程 </label> </li>
<li style="width:60px;"><label><input type="checkbox" id="02" onclick="extraSelect(this)" />油量 </label> </li>
<li style="width:140px;"><label style="width: 130px;"><input type="checkbox" id="11" onclick="extraSelect(this)" />超速报警附加信息 </label> </li>
<li style="width:200px;"><label style="width: 190px;"><input type="checkbox" id="12" onclick="extraSelect(this)" />进出区域/路线报警附加信息 </label> </li>
<li style="width:260px;"><label style="width: 250px;"><input type="checkbox" id="13" onclick="extraSelect(this)" />路段行驶时间不足/过长报警附加信息 </label> </li>
<li style="width:80px;"><label style="width: 70px;"><input type="checkbox" id="2A" onclick="extraSelect(this)" />IO状态位 </label> </li>
<li style="width:170px;"><label style="width: 160px;"><input type="checkbox" id="30" onclick="extraSelect(this)" />无线通信网络信号强度 </label> </li>
<li style="width:200px;"><label style="width: 150px;"><input type="checkbox" id="31" onclick="extraSelect(this)" />GNSS 定位卫星数 </label> </li>
<li style="width:120px;"><label style="width: 120px;"><input type="checkbox" id="EA" onclick="extraSelect(this)" />基础数据项列表 </label> </li>
<li style="width:145px;"><label style="width: 140px;"><input type="checkbox" id="EB" onclick="extraSelect(this)" />轿车 OBD 数据流 </label> </li>
<li style="width:200px;"><label style="width: 150px;"><input type="checkbox" id="FA" onclick="extraSelect(this)" />报警事件 ID 数据项 </label> </li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_01" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label>里程:</label><input id="extra_01" type="text" class="form-control" value="20202020"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_02" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label>油量:</label><input id="extra_02" type="text" class="form-control" value="5200"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_11" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<label>超速报警附加信息:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li><label>位置类型:</label><select id="extra_11" class="form-control">
......@@ -222,7 +222,7 @@
<li><label style="word-break:break-all;font-size:10px;">区域或路段ID:</label><input id="areaId_1" type="text" class="form-control" value="2020"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_12" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<label>进出区域/路线报警附加信息:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li><label>位置类型:</label><select id="extra_12" class="form-control">
......@@ -237,7 +237,7 @@
<option value="1"></option></select></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_13" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<label>路段行驶时间不足/过长报警附加信息:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li><label>路段Id:</label><input id="areaId_3" type="text" class="form-control" value="2020"></li>
......@@ -247,53 +247,53 @@
<option value="1">过长</option></select></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_2A" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<label>状态位:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li style="width:180px;"><select style="width:170px;" id="deepSleepStatus" class="form-control">
<option value="0">深度休眠状态(否)</option>
<option value="1048576">深度休眠状态(是)</option></select></li>
<option value="1">深度休眠状态(是)</option></select></li>
<li style="width:180px;"><select style="width:170px;" id="sleepStatus" class="form-control">
<option value="0">休眠状态(否)</option>
<option value="2097152">休眠状态(是)</option></select></li>
<option value="2">休眠状态(是)</option></select></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_30" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label style="word-break:break-all;font-size:10px;">无线通信网络信号强度:</label><input id="extra_30" type="text" class="form-control" value="33"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_31" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label style="word-break:break-all;font-size:10px;">GNSS定位卫星数:</label><input id="extra_31" type="text" class="form-control" value="2"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;padding-left:10px;padding-right:10px;">
<div id="div_ext_EA" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;padding-left:10px;padding-right:10px;">
<label>基础数据项列表:</label><br>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">
<ul class="protocol_content" style="padding:0px;">
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0001" />扩展状态标志位</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0002" />扩展报警标志位</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0003" />行 驶 总 里 程</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0004" />行 驶 总 油 耗</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0005" />总 运 行 时 长</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0006" />总 熄 火 时 长</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0007" />总 怠 速 时 长</label> </li>
<li style="width:180px;"><label style="width:170px"><input type="checkbox" id="0010" />此刻1秒内的加速度数据</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="0011" />车辆安防状态信息</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0012" />车辆电瓶电压</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="0013" />终端内置电池电压</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="001D" />GPS 定位标志</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0001" onclick="baseInfoSelect(this)"/>扩展状态标志位</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0002" onclick="baseInfoSelect(this)"/>扩展报警标志位</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0003" onclick="baseInfoSelect(this)"/>行 驶 总 里 程</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0004" onclick="baseInfoSelect(this)"/>行 驶 总 油 耗</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0005" onclick="baseInfoSelect(this)"/>总 运 行 时 长</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0006" onclick="baseInfoSelect(this)"/>总 熄 火 时 长</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0007" onclick="baseInfoSelect(this)"/>总 怠 速 时 长</label> </li>
<li style="width:180px;"><label style="width:170px"><input type="checkbox" id="0010" onclick="baseInfoSelect(this)"/>此刻1秒内的加速度数据</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="0011" onclick="baseInfoSelect(this)"/>车辆安防状态信息</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="0012" onclick="baseInfoSelect(this)"/>车辆电瓶电压</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="0013" onclick="baseInfoSelect(this)"/>终端内置电池电压</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="001D" onclick="baseInfoSelect(this)"/>GPS 定位标志</label> </li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0001" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label style="word-break:break-all;font-size:10px;">扩展状态标志位:</label><select style="width:150px;" id="dataId_0001" class="form-control">
<option value="0">撤防上报</option>
<option value="1">设防上报</option></select></li></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0002" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>扩展报警标志位:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li style="width:150px;"><select style="width:140px;" id="waterTemperatureAlarm" class="form-control">
......@@ -340,7 +340,7 @@
<option value="1048576">RTC 模块故障报警(是)</option></select></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0003" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<label>行驶总里程:</label><br>
<li style="width:600px;"><label>统计算法:</label><select style="width:180px;" id="caculateType" class="form-control">
......@@ -361,7 +361,7 @@
</li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0004" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<label>行驶总油耗:</label><br>
<li style="width:600px;"><label>统计算法:</label><select style="width:150px;" id="caculateType_2" class="form-control">
......@@ -377,29 +377,29 @@
</li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0005" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label>总运行时长:</label><input id="dataId_0005" type="text" class="form-control" value="360000"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0006" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label>总熄火时长:</label><input id="dataId_0006" type="text" class="form-control" value="72000"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0007" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li><label>总怠速时长:</label><input id="dataId_0007" type="text" class="form-control" value="480000"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0010" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>此刻 1 秒内的加速度数据:</label>
<ul class="protocol_content" style="padding:0px;">
<li><label style="word-break:break-all;font-size:10px;">采集的点个数:</label><input id="pointCount" type="text" class="form-control" value="4"></li>
<li><label style="word-break:break-all;font-size:10px;">采集间隔(毫秒):</label><input id="collectIntercal" type="text" class="form-control" value="4"><label style="width:50px;"></label></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0011" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>车辆安防状态信息:</label>
<div style="margin-left:20px;">
<ul class="protocol_content" style="padding:0px;">
......@@ -572,17 +572,17 @@
</ul>
</div>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0012" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li style="width:400px;"><label style="width:110px;">车辆电瓶电压:</label><input id="dataId_0012" type="text" class="form-control" value="36"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_0013" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li style="width:400px;"><label style="width:130px;">终端内置电池电压:</label><input id="dataId_0013" type="text" class="form-control" value="6"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="base_001D" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<ul class="protocol_content" style="padding:0px;">
<li style="width:400px;"><label style="width:110px;">GPS定位标志:</label><select style="width:165px;" id="dataId_001D" class="form-control">
<option value="00">不定位</option>
......@@ -591,7 +591,7 @@
</ul>
</div>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<div id="div_ext_EB" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;">
<label>轿车 OBD 数据流:</label><br>
<ul class="protocol_content" style="padding:0px;">
<li><label>发动机转速:</label><input id="engineSpeed" type="text" class="form-control" value="3000"></li>
......@@ -626,7 +626,7 @@
<li><label>续航里程:</label><input id="enduranceMileage" type="text" class="form-control" value="505"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;padding-left:10px;padding-right:10px;">
<div id="div_ext_FA" style="display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;padding-left:10px;padding-right:10px;">
<label>报警事件:</label><br>
<div style="width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">
<ul class="protocol_content" style="padding:0px;">
......@@ -745,12 +745,16 @@ $("#sendMsgBtn").click(function(){
data["baseInfo"] = getBaseInfo();
data["extraInfo"] = getExtraInfo();
console.log(data)
/**
var host = window.location.host;
$("#showFeedback").val("")
$("#showFeedback").val("");
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessTerminalRegisterMsg",
url:"http://" + host + "/messageTools/message_process/porcessLocationMsg",
type:"post",
data:data,
data:JSON.stringify(data),
contentType:"application/json",
dataType:"json",
success:function(data){
if(data.status == 200){
......@@ -759,13 +763,14 @@ $("#sendMsgBtn").click(function(){
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
$("#showFeedback").val(theShow);
}else{
$("#showFeedback").val(data.message)
$("#showFeedback").val(data.message);
alert(data.message);
}
}
});
*/
});
/*******************************************
......@@ -773,35 +778,35 @@ $("#sendMsgBtn").click(function(){
*******************************************/
function getBaseInfo(){
//报警标志信息
var emergencyAlarm = parsenInt($("#emergencyAlarm").val());
var overspeedAlarm = parsenInt($("#overspeedAlarm")).val();
var fatigueDriving = parsenInt($("#fatigueDriving").val());
var dangerAlarm = parsenInt($("#dangerAlarm").val());
var GNSSTrouble = parsenInt($("#GNSSTrouble").val());
var GNSSAntennaeLost = parsenInt($("#GNSSAntennaeLost").val());
var GNSSAntennaeShortOut = parsenInt($("#GNSSAntennaeShortOut").val());
var TerminalMainPowerLackVoltage = parsenInt($("#TerminalMainPowerLackVoltage").val());
var TerminalMainPowerLostConnect = parsenInt($("#TerminalMainPowerLostConnect").val());
var TerMinalLCDTrouble = parsenInt($("#TerMinalLCDTrouble").val());
var TTSTrouble = parsenInt($("#TTSTrouble").val());
var cameraTrouble = parsenInt($("#cameraTrouble").val());
var ICTrouble = parsenInt($("#ICTrouble").val());
var speedEarlyWarning = parsenInt($("#speedEarlyWarning").val());
var fatigueDrivingearlyWarning = parsenInt($("#fatigueDrivingearlyWarning").val());
var drivingOverTime = parsenInt($("#drivingOverTime").val());
var stoppingOverTime = parsenInt($("#stoppingOverTime").val());
var InOutArea = parsenInt($("#InOutArea").val());
var InOutRouting = parsenInt($("#InOutRouting").val());
var drivingLongOrShort = parsenInt($("#drivingLongOrShort").val());
var routingDivergeAlarm = parsenInt($("#routingDivergeAlarm").val());
var VSSTrouble = parsenInt($("#VSSTrouble").val());
var oilException = parsenInt($("#oilException").val());
var carLost = parsenInt($("#carLost").val());
var illegalFire = parsenInt($("#illegalFire").val());
var illegalMoving = parsenInt($("#illegalMoving").val());
var collisionAlarm = parsenInt($("#collisionAlarm").val());
var rollOverAlarm = parsenInt($("#rollOverAlarm").val());
var illegalOpenDoor = parsenInt($("#illegalOpenDoor").val());
var emergencyAlarm = parseInt($("#emergencyAlarm").val());
var overspeedAlarm = parseInt($("#overspeedAlarm").val());
var fatigueDriving = parseInt($("#fatigueDriving").val());
var dangerAlarm = parseInt($("#dangerAlarm").val());
var GNSSTrouble = parseInt($("#GNSSTrouble").val());
var GNSSAntennaeLost = parseInt($("#GNSSAntennaeLost").val());
var GNSSAntennaeShortOut = parseInt($("#GNSSAntennaeShortOut").val());
var TerminalMainPowerLackVoltage = parseInt($("#TerminalMainPowerLackVoltage").val());
var TerminalMainPowerLostConnect = parseInt($("#TerminalMainPowerLostConnect").val());
var TerMinalLCDTrouble = parseInt($("#TerMinalLCDTrouble").val());
var TTSTrouble = parseInt($("#TTSTrouble").val());
var cameraTrouble = parseInt($("#cameraTrouble").val());
var ICTrouble = parseInt($("#ICTrouble").val());
var speedEarlyWarning = parseInt($("#speedEarlyWarning").val());
var fatigueDrivingearlyWarning = parseInt($("#fatigueDrivingearlyWarning").val());
var drivingOverTime = parseInt($("#drivingOverTime").val());
var stoppingOverTime = parseInt($("#stoppingOverTime").val());
var InOutArea = parseInt($("#InOutArea").val());
var InOutRouting = parseInt($("#InOutRouting").val());
var drivingLongOrShort = parseInt($("#drivingLongOrShort").val());
var routingDivergeAlarm = parseInt($("#routingDivergeAlarm").val());
var VSSTrouble = parseInt($("#VSSTrouble").val());
var oilException = parseInt($("#oilException").val());
var carLost = parseInt($("#carLost").val());
var illegalFire = parseInt($("#illegalFire").val());
var illegalMoving = parseInt($("#illegalMoving").val());
var collisionAlarm = parseInt($("#collisionAlarm").val());
var rollOverAlarm = parseInt($("#rollOverAlarm").val());
var illegalOpenDoor = parseInt($("#illegalOpenDoor").val());
var alarmFlag = emergencyAlarm + overspeedAlarm + fatigueDriving + dangerAlarm + GNSSTrouble
alarmFlag = alarmFlag + GNSSAntennaeLost + GNSSAntennaeShortOut + TerminalMainPowerLackVoltage + TerminalMainPowerLostConnect + TerMinalLCDTrouble
alarmFlag = alarmFlag + TTSTrouble + cameraTrouble + ICTrouble + speedEarlyWarning + fatigueDrivingearlyWarning
......@@ -810,36 +815,36 @@ function getBaseInfo(){
alarmFlag = alarmFlag + illegalMoving + collisionAlarm + rollOverAlarm + illegalOpenDoor
//获取状态位
var ACCStatus = parsenInt($("#ACCStatus").val());
var locationStatus = parsenInt($("#locationStatus").val())
var latitudeStatus = parsenInt($("#latitudeStatus").val())
var longitudeStatus = parsenInt($("#longitudeStatus").val())
var runStatus = parsenInt($("#runStatus").val())
var isLocationEncrypt = parsenInt($("#isLocationEncrypt").val())
var isFull = parsenInt($("#isFull").val())
var oilRouteStatus = parsenInt($("#oilRouteStatus").val())
var powerStatus = parsenInt($("#powerStatus").val())
var doorLockStatus = parsenInt($("#ACCStatus").val())
var frontDoor = parsenInt($("#frontDoor").val())
var middleDoor = parsenInt($("#middleDoor").val())
var backDoor = parsenInt($("#backDoor").val())
var drivingDoor = parsenInt($("#drivingDoor").val())
var otherDoor = parsenInt($("#otherDoor").val())
var GPSStatus = parsenInt($("#GPSStatus").val())
var beidouStatus = parsenInt($("#beidouStatus").val())
var GLONSSStatus = parsenInt($("#GLONSSStatus").val())
var GalileoStatus = parsenInt($("#GalileoStatus").val())
var ACCStatus = parseInt($("#ACCStatus").val());
var locationStatus = parseInt($("#locationStatus").val())
var latitudeStatus = parseInt($("#latitudeStatus").val())
var longitudeStatus = parseInt($("#longitudeStatus").val())
var runStatus = parseInt($("#runStatus").val())
var isLocationEncrypt = parseInt($("#isLocationEncrypt").val())
var isFull = parseInt($("#isFull").val())
var oilRouteStatus = parseInt($("#oilRouteStatus").val())
var powerStatus = parseInt($("#powerStatus").val())
var doorLockStatus = parseInt($("#ACCStatus").val())
var frontDoor = parseInt($("#frontDoor").val())
var middleDoor = parseInt($("#middleDoor").val())
var backDoor = parseInt($("#backDoor").val())
var drivingDoor = parseInt($("#drivingDoor").val())
var otherDoor = parseInt($("#otherDoor").val())
var GPSStatus = parseInt($("#GPSStatus").val())
var beidouStatus = parseInt($("#beidouStatus").val())
var GLONSSStatus = parseInt($("#GLONSSStatus").val())
var GalileoStatus = parseInt($("#GalileoStatus").val())
var status = ACCStatus + locationStatus + latitudeStatus + longitudeStatus + runStatus
status = status + isLocationEncrypt + isFull + oilRouteStatus + powerStatus + doorLockStatus
status = status + frontDoor + middleDoor + backDoor + drivingDoor + otherDoor
status = status + GPSStatus + beidouStatus + GLONSSStatus + GalileoStatus
var latitude = parsenInt($("#latitude").val());
var longtitude = parsenInt($("#longtitude").val());
var elevation = parsenInt($("#elevation").val());
var speed = parsenInt($("#speed").val());
var directionAngle = parsenInt($("#directionAngle").val());
var infoTime = parsenInt($("#infoTime").val());
var latitude =parseFloat($("#latitude").val());
var longtitude = parseFloat($("#longtitude").val());
var elevation =$("#elevation").val();
var speed = $("#speed").val();
var directionAngle = $("#directionAngle").val();
var infoTime = $("#infoTime").val();
var data = {};
data["alarmFlag"] = alarmFlag;
......@@ -857,11 +862,229 @@ function getBaseInfo(){
获取地理位置附加信息数据
*******************************************/
function getExtraInfo(){
var extraInfo = {}
if($("#01").is(':checked')){
extraInfo["01"] = getExtra_01();
}
if($("#02").is(':checked')){
extraInfo["02"] = getExtra_02();
}
if($("#11").is(':checked')){
extraInfo["11"] = getExtra_11();
}
if($("#12").is(':checked')){
extraInfo["12"] = getExtra_12();
}
if($("#13").is(':checked')){
extraInfo["13"] = getExtra_13();
}
if($("#2A").is(':checked')){
extraInfo["2A"] = getExtra_2A();
}
if($("#30").is(':checked')){
extraInfo["30"] = getExtra_30();
}
if($("#31").is(':checked')){
extraInfo["31"] = getExtra_31();
}
if($("#EA").is(':checked')){
extraInfo["EA"] = getExtra_EA();
}
if($("#EB").is(':checked')){
extraInfo["EB"] = getExtra_EB();
}
if($("#FA").is(':checked')){
extraInfo["FA"] = getExtra_FA();
}
return extraInfo;
}
//获取附加信息01
function getExtra_01(){
var data = {};
var extra_01 = $("#extra_01").val();
data["extra_01"] = extra_01;
return data;
}
//获取附加信息02
function getExtra_02(){
var data = {};
var extra_02 = $("#extra_02").val();
data["extra_02"] = extra_02;
return data;
}
//获取附加信息11
function getExtra_11(){
var data = {};
var locationType_OverSpeed = $("#extra_11").val();
var areaId_OverSpeed = $("#areaId_1").val();
data["locationType_OverSpeed"] = locationType_OverSpeed;
data["areaId_OverSpeed"] = areaId_OverSpeed;
return data;
}
//获取附加信息12
function getExtra_12(){
var data = {};
var locationType_inOut = $("#extra_12").val();
var areaId_inOut = $("#areaId_2").val();
var direction = $("#direction").val();
data["locationType_inOut"] = locationType_inOut;
data["areaId_inOut"] = areaId_inOut;
data["direction"] = direction;
return data;
}
//获取附加信息13
function getExtra_13(){
var data = {};
var areaId_road = $("#areaId_3").val();
var drivingTime = $("#drivingTime").val();
var result = $("#result").val();
data["areaId_road"] = areaId_road;
data["drivingTime"] = drivingTime;
data["result"] = result;
return data;
}
//获取附加信息2A
function getExtra_2A(){
var data = {};
var deepSleepStatus = $("#deepSleepStatus").val();
var sleepStatus = $("#sleepStatus").val();
data["deepSleepStatus"] = deepSleepStatus;
data["sleepStatus"] = sleepStatus;
return data;
}
//获取附加信息30
function getExtra_30(){
var data = {};
var extra_30 = $("#extra_30").val();
data["extra_30"] = extra_30;
return data;
}
//获取附加信息31
function getExtra_31(){
var data = {};
var extra_31 = $("#extra_31").val();
data["extra_31"] = extra_31;
return data;
}
//获取附加信息EA
function getExtra_EA(){
var data = {};
if($("#0001").is(':checked')){
data["0001"] = getbaseInfo_0001()
}
if($("#0002").is(':checked')){
data["0002"] = getbaseInfo_0002()
}
if($("#0003").is(':checked')){
data["0003"] = getbaseInfo_0003()
}
if($("#0004").is(':checked')){
data["0004"] = getbaseInfo_0004()
}
if($("#0005").is(':checked')){
data["0005"] = getbaseInfo_0005()
}
if($("#0006").is(':checked')){
data["0006"] = getbaseInfo_0006()
}
if($("#0007").is(':checked')){
data["0007"] = getbaseInfo_0007()
}
if($("#0010").is(':checked')){
data["0010"] = getbaseInfo_0010()
}
if($("#0011").is(':checked')){
data["0011"] = getbaseInfo_0011()
}
if($("#0012").is(':checked')){
data["0012"] = getbaseInfo_0012()
}
if($("#0013").is(':checked')){
data["0013"] = getbaseInfo_0013()
}
if($("#001D").is(':checked')){
data["001D"] = getbaseInfo_001D()
}
return data;
}
//获取附加信息基础数据项0001
function getbaseInfo_0001(){
data = {}
data["dataId_0001"] = $("#dataId_0001").val();
return data;
}
//获取附加信息基础数据项0002
function getbaseInfo_0002(){
data = {}
var waterTemperatureAlarm = parseInt($("#waterTemperatureAlarm").val());
var idlingOverlongAlarm = parseInt($("#idlingOverlongAlarm").val());
var rapidlyAccelerateAlarm = parseInt($("#rapidlyAccelerateAlarm").val());
var sharpSlowsownAlarm = parseInt($("#sharpSlowsownAlarm").val());
var sharpCurve = parseInt($("#sharpCurve").val());
var insertAlarm = parseInt($("#insertAlarm").val());
var oilExpenseNotSupportAlarm = parseInt($("#oilExpenseNotSupportAlarm").val());
var OBDNotSupportAlarm = parseInt($("#OBDNotSupportAlarm").val());
var buslineNotSleepAlarm = parseInt($("#buslineNotSleepAlarm").val());
var illegalOpenDoor = parseInt($("#illegalOpenDoor_2").val());
var FLASHTroubleAlarm = parseInt($("#FLASHTroubleAlarm").val());
var CANTroubleAlarm = parseInt($("#CANTroubleAlarm").val());
var D3SensorTroubleAlarm = parseInt($("#D3SensorTroubleAlarm").val());
var RTCTroubleAlarm = parseInt($("#RTCTroubleAlarm").val());
var dataId_0002 = waterTemperatureAlarm + idlingOverlongAlarm + rapidlyAccelerateAlarm + sharpSlowsownAlarm + sharpCurve
dataId_0002 = dataId_0002 + insertAlarm + oilExpenseNotSupportAlarm + OBDNotSupportAlarm + buslineNotSleepAlarm + illegalOpenDoor
dataId_0002 = dataId_0002 + FLASHTroubleAlarm + CANTroubleAlarm + D3SensorTroubleAlarm + RTCTroubleAlarm
data["dataId_0002"] = dataId_0002;
return data;
}
//获取附加信息基础数据项0003
function getbaseInfo_0003(){
data = {}
data["caculateType"] = $("#caculateType").val();
data["totalMileage"] = $("#totalMileage").val();
return data;
}
//获取附加信息基础数据项0004
function getbaseInfo_0004(){
data = {}
data["caculateType"] = $("#caculateType_2").val();
data["totalOil"] = $("#totalOil").val();
return data;
}
//获取附加信息基础数据项0005
function getbaseInfo_0005(){
data = {}
data["dataId_0005"] = $("#dataId_0005").val();
return data;
}
//获取附加信息基础数据项0006
function getbaseInfo_0006(){
data = {}
data["dataId_0006"] = $("#dataId_0006").val();
return data;
}
//获取附加信息基础数据项0007
function getbaseInfo_0007(){
data = {}
data["dataId_0007"] = $("#dataId_0007").val();
return data;
}
//获取附加信息基础数据项0010
function getbaseInfo_0010(){
data = {}
data["pointCount"] = $("#pointCount").val();
data["collectIntercal"] = $("#collectIntercal").val();
return data;
}
//获取附加信息基础数据项0011
function getbaseInfo_0010(){
data = {}
data["pointCount"] = $("#pointCount").val();
data["collectIntercal"] = $("#collectIntercal").val();
return data;
}
function hasSubPkg(){
value = $("#subPkg").val()
var value = $("#subPkg").val()
if(value == "8192"){
$("#subPkg_label").css("color","black")
$("#pkgCounts").removeAttr("disabled")
......@@ -871,5 +1094,120 @@ function hasSubPkg(){
}
}
//设置当前时间到时间输入框
(function(){
var curTime = getCurTime();
$("#infoTime").val(curTime);
})();
//附加信息的选择与取消选择
function extraSelect(e){
if($(e).is(':checked')){
if($(e).attr("id") == "01"){
$("#div_ext_01").css("display","block")
}else if($(e).attr("id") == "02"){
$("#div_ext_02").css("display","block")
}else if($(e).attr("id") == "11"){
$("#div_ext_11").css("display","block")
}else if($(e).attr("id") == "12"){
$("#div_ext_12").css("display","block")
}else if($(e).attr("id") == "13"){
$("#div_ext_13").css("display","block")
}else if($(e).attr("id") == "2A"){
$("#div_ext_2A").css("display","block")
}else if($(e).attr("id") == "30"){
$("#div_ext_30").css("display","block")
}else if($(e).attr("id") == "31"){
$("#div_ext_31").css("display","block")
}else if($(e).attr("id") == "EA"){
$("#div_ext_EA").css("display","block")
}else if($(e).attr("id") == "EB"){
$("#div_ext_EB").css("display","block")
}else if($(e).attr("id") == "FA"){
$("#div_ext_FA").css("display","block")
}
}else{
if($(e).attr("id") == "01"){
$("#div_ext_01").css("display","none")
}else if($(e).attr("id") == "02"){
$("#div_ext_02").css("display","none")
}else if($(e).attr("id") == "11"){
$("#div_ext_11").css("display","none")
}else if($(e).attr("id") == "12"){
$("#div_ext_12").css("display","none")
}else if($(e).attr("id") == "13"){
$("#div_ext_13").css("display","none")
}else if($(e).attr("id") == "2A"){
$("#div_ext_2A").css("display","none")
}else if($(e).attr("id") == "30"){
$("#div_ext_30").css("display","none")
}else if($(e).attr("id") == "31"){
$("#div_ext_31").css("display","none")
}else if($(e).attr("id") == "EA"){
$("#div_ext_EA").css("display","none")
}else if($(e).attr("id") == "EB"){
$("#div_ext_EB").css("display","none")
}else if($(e).attr("id") == "FA"){
$("#div_ext_FA").css("display","none")
}
}
}
//基础数据项的选择与取消选择
function baseInfoSelect(e){
if($(e).is(':checked')){
if($(e).attr("id") == "0001"){
$("#base_0001").css("display","block")
}else if($(e).attr("id") == "0002"){
$("#base_0002").css("display","block")
}else if($(e).attr("id") == "0003"){
$("#base_0003").css("display","block")
}else if($(e).attr("id") == "0004"){
$("#base_0004").css("display","block")
}else if($(e).attr("id") == "0005"){
$("#base_0005").css("display","block")
}else if($(e).attr("id") == "0006"){
$("#base_0006").css("display","block")
}else if($(e).attr("id") == "0007"){
$("#base_0007").css("display","block")
}else if($(e).attr("id") == "0010"){
$("#base_0010").css("display","block")
}else if($(e).attr("id") == "0011"){
$("#base_0011").css("display","block")
}else if($(e).attr("id") == "0012"){
$("#base_0012").css("display","block")
}else if($(e).attr("id") == "0013"){
$("#base_0013").css("display","block")
}else if($(e).attr("id") == "001D"){
$("#base_001D").css("display","block")
}
}else{
if($(e).attr("id") == "0001"){
$("#base_0001").css("display","none")
}else if($(e).attr("id") == "0002"){
$("#base_0002").css("display","none")
}else if($(e).attr("id") == "0003"){
$("#base_0003").css("display","none")
}else if($(e).attr("id") == "0004"){
$("#base_0004").css("display","none")
}else if($(e).attr("id") == "0005"){
$("#base_0005").css("display","none")
}else if($(e).attr("id") == "0006"){
$("#base_0006").css("display","none")
}else if($(e).attr("id") == "0007"){
$("#base_0007").css("display","none")
}else if($(e).attr("id") == "0010"){
$("#base_0010").css("display","none")
}else if($(e).attr("id") == "0011"){
$("#base_0011").css("display","none")
}else if($(e).attr("id") == "0012"){
$("#base_0012").css("display","none")
}else if($(e).attr("id") == "0013"){
$("#base_0013").css("display","none")
}else if($(e).attr("id") == "001D"){
$("#base_001D").css("display","none")
}
}
}
</script>
{% endblock %}
\ No newline at end of file
......@@ -4,6 +4,7 @@ from flask import Blueprint ,Response,request
from configparser import ConfigParser
from lib.protocol.message.DataUpstreamTransport_msg import DataUpstreamTransport_msg
from lib.protocol.message.Location_msg import Location_msg
from lib.protocol.message.TerminalHeartbeat_msg import TerminalHeartbeat_msg
from lib.protocol.message.TerminalRegister_msg import TerminalRegister_msg
from lib.protocol.message.TerminalVersionInfo_msg import TerminalVersionInfo_msg
......@@ -16,6 +17,8 @@ import json
import traceback
import binascii
from lib.util.jsonUtil import hasJsonDataIsNone
message_process = Blueprint('message_process', __name__)
##########################################
......@@ -457,4 +460,61 @@ def porcessDataUpstreamTransportMsg_F4():
traceback.print_exc()
data["status"] = "4003"
data["message"] = "Error: 处理失败!"
return Response(json.dumps(data), mimetype='application/json')
##########################################
# 【接口类型】地理位置上报消息
##########################################
@message_process.route("/porcessLocationMsg",methods=['POST'])
def porcessLocationMsg():
params = request.get_data()
params = json.loads(params.decode("utf-8"))
# msgID = params["msgID"]
# phoneNum = params["phoneNum"]
# msgWaterCode = params["msgWaterCode"]
# encryptionType = params["encryptionType"]
# subPkg = params["subPkg"]
# pkgCounts = params["pkgCounts"]
# ########### 地理位置基础信息 #############
# baseInfo = params["baseInfo"]
# alarmFlag = baseInfo["alarmFlag"]
# status = baseInfo["status"]
# latitude = baseInfo["latitude"]
# longtitude = baseInfo["longtitude"]
# elevation = baseInfo["elevation"]
# speed = baseInfo["speed"]
# directionAngle = baseInfo["directionAngle"]
# infoTime = baseInfo["infoTime"]
# ########### 地理位置附加信息 #############
# extraInfo = params["extraInfo"]
data = {}
if (hasJsonDataIsNone(params)):
data["status"] = "4003"
data["message"] = "Info: 请检查是否传入了空数据!"
return Response(json.dumps(data), mimetype='application/json')
else:
try:
conf_R = ConfigParser()
conf_R.read("config/messageTools/messageTools.conf")
cliSocket = ClientSocket(conf_R.get("socket", "host"),conf_R.getint("socket", "port"))
cliSocket.connect()
obj = Location_msg()
msg = obj.generateMsg_GUI(params)
cliSocket.send(msg)
socRecv_1 = cliSocket.receive()
socRecv_2 = str(socRecv_1)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
data["status"] = "4003"
data["message"] = "Error: 处理失败!"
return Response(json.dumps(data), mimetype='application/json')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment