Commit a3533c2f authored by liyuanhong's avatar liyuanhong

地理位置页面与后端对接完成

parent 4ccba252
......@@ -187,40 +187,69 @@ class Location_msg(MessageBase):
def getLocationExtraInfo_GUI(self,extraInfo):
data = ""
# 里程,DWORD,1 / 10km,对应车上里程表读数;不支持OBD时,为基于GPS车速统计的车辆累计行驶总里程。
extra_01 = "01" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(20202020,4)
#油量,WORD,1/10L,对应车上油量表读数
extra_02 = "02" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(5200,2)
#超速报警附加信息
extra_11 = "11" + self.int2hexStringByBytes(int(len(self.getOverSpeedAlarmExtraInfo()) / 2)) + self.getOverSpeedAlarmExtraInfo()
#进出区域/路线报警附加信息见
extra_12 = "12" + self.int2hexStringByBytes(6) + self.getInOutAreaAlarmExtraInfo()
#路段行驶时间不足/过长报警附加信息见
extra_13 = "13" + self.int2hexStringByBytes(7) + self.getDrivingLongOrShortAlarmExtraInfo()
#IO 状态位
extra_2A = "2A" + self.int2hexStringByBytes(2) + self.getStatusBit()
#BYTE,无线通信网络信号强度
extra_30 = "30" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(33)
#BYTE,GNSS 定位卫星数
extra_31 = "31" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(2)
#基础数据项列表
extra_EA = "EA" + self.int2hexStringByBytes(int(len(self.getBaseDataList()) / 2)) + self.getBaseDataList()
#轿车 OBD 数据流
extra_EB = "EB" + self.int2hexStringByBytes(int(len(SaloonCarOBD_data().generateSaloonCarOBDData()) / 2)) + SaloonCarOBD_data().generateSaloonCarOBDData()
#货车 OBD 数据流
extra_EC = "EC" + self.int2hexStringByBytes(int(len(TruckCarOBD_data().generateTruckCarOBD_data()) / 2)) + TruckCarOBD_data().generateTruckCarOBD_data()
#新能源 OBD 数据流
extra_ED = "ED" + self.int2hexStringByBytes(int(len(NewEnergyCar_data().generateNewEnergyCar_data()) / 2)) + NewEnergyCar_data().generateNewEnergyCar_data()
#外设数据项列表
extra_EE = "EE" + self.int2hexStringByBytes(int(len(Circum_data().generateCircum_data()) / 2)) + Circum_data().generateCircum_data()
#报警事件 ID 数据项列表
extra_FA = "FA" + self.int2hexStringByBytes(int(len(AlarmEvent_data().generateAlarmEvent_data()) / 2)) + AlarmEvent_data().generateAlarmEvent_data()
data = extra_11 + extra_31 + extra_EA + extra_EC
# data = extra_01 + extra_02 + extra_11 + extra_12 + extra_13
# data = data + extra_2A + extra_30 + extra_31 + extra_EA + extra_EB
# data = data +extra_FA
if("01" in extraInfo.keys()):
# 里程,DWORD,1 / 10km,对应车上里程表读数;不支持OBD时,为基于GPS车速统计的车辆累计行驶总里程。
extra_01 = "01" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(extraInfo["01"]["extra_01"]),4)
data = data + extra_01
if ("02" in extraInfo.keys()):
#油量,WORD,1/10L,对应车上油量表读数
extra_02 = "02" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(extraInfo["02"]["extra_02"]),2)
data = data + extra_02
if ("11" in extraInfo.keys()):
#超速报警附加信息
overSpeedAlarmExtraInfo = self.getOverSpeedAlarmExtraInfo_GUI(extraInfo["11"])
extra_11 = "11" + self.int2hexStringByBytes(int(len(overSpeedAlarmExtraInfo) / 2))
data = data + extra_11
if ("12" in extraInfo.keys()):
#进出区域/路线报警附加信息见
extra_12 = "12" + self.int2hexStringByBytes(6) + self.getInOutAreaAlarmExtraInfo_GUI(extraInfo["12"])
data = data +extra_12
if ("13" in extraInfo.keys()):
#路段行驶时间不足/过长报警附加信息见
extra_13 = "13" + self.int2hexStringByBytes(7) + self.getDrivingLongOrShortAlarmExtraInfo_GUI(extraInfo["13"])
data = data + extra_13
if ("2A" in extraInfo.keys()):
#IO 状态位
extra_2A = "2A" + self.int2hexStringByBytes(2) + self.getStatusBit_GUI(extraInfo["2A"])
data = data + extra_2A
if ("30" in extraInfo.keys()):
#BYTE,无线通信网络信号强度
extra_30 = "30" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(extraInfo["30"]["extra_30"]))
data = data + extra_30
if ("31" in extraInfo.keys()):
#BYTE,GNSS 定位卫星数
extra_31 = "31" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(extraInfo["31"]["extra_31"]))
data = data + extra_31
if ("EA" in extraInfo.keys()):
#基础数据项列表
baseDataList = self.getBaseDataList_GUI(extraInfo["EA"])
extra_EA = "EA" + self.int2hexStringByBytes(int(len(baseDataList) / 2))
data = data + extra_EA
if ("EB" in extraInfo.keys()):
#轿车 OBD 数据流
saloonCarOBD_data = SaloonCarOBD_data().generateSaloonCarOBDData_GUI(extraInfo["EB"])
extra_EB = "EB" + self.int2hexStringByBytes(int(len(saloonCarOBD_data) / 2))
data = data + extra_EB
if ("EC" in extraInfo.keys()):
#货车 OBD 数据流
truckCarOBD_data = TruckCarOBD_data().generateTruckCarOBD_data()
extra_EC = "EC" + self.int2hexStringByBytes(int(len(truckCarOBD_data) / 2))
data = data + extra_EC
if ("ED" in extraInfo.keys()):
#新能源 OBD 数据流
newEnergyCar_data = NewEnergyCar_data().generateNewEnergyCar_data()
extra_ED = "ED" + self.int2hexStringByBytes(int(len(newEnergyCar_data) / 2))
data = data + extra_ED
if ("EE" in extraInfo.keys()):
#外设数据项列表
circum_data = Circum_data().generateCircum_data()
extra_EE = "EE" + self.int2hexStringByBytes(int(len(circum_data) / 2))
data = data + extra_EE
if ("FA" in extraInfo.keys()):
#报警事件 ID 数据项列表
alarmEvent_data = AlarmEvent_data().generateAlarmEvent_data_GUI(extraInfo["FA"])
extra_FA = "FA" + self.int2hexStringByBytes(int(len(alarmEvent_data) / 2))
data = data + extra_FA
return data
# 获取位置附加信息,数据随机产生
......@@ -297,6 +326,20 @@ class Location_msg(MessageBase):
areaId = self.int2hexStringByBytes(2020,4)
msg = self.int2hexStringByBytes(locationType) + areaId
return msg
def getOverSpeedAlarmExtraInfo_GUI(self,data):
# 0:无特定位置;
# 1:圆形区域;
# 2:矩形区域;
# 3:多边形区域;
# 4:路段
locationType = int(data["locationType_OverSpeed"])
areaId = "" #若位置类型为 0,无该字段
if locationType == 0:
pass
else:
areaId = self.int2hexStringByBytes(int(data["areaId_OverSpeed"]),4)
msg = self.int2hexStringByBytes(locationType) + areaId
return msg
#获取超速报警附加信息,数据随机产生
def getOverSpeedAlarmExtraInfo_random(self):
locationType = self.getRandomNum(intArr=[0,1,2,3,4])
......@@ -324,6 +367,21 @@ class Location_msg(MessageBase):
direction = 0 #0-进,1-出
msg = self.int2hexStringByBytes(locationType) + areaId + self.int2hexStringByBytes(direction)
return msg
def getInOutAreaAlarmExtraInfo_GUI(self,data):
# 0:无特定位置;
# 1:圆形区域;
# 2:矩形区域;
# 3:多边形区域;
# 4:路段
locationType = int(data["locationType_inOut"])
areaId = ""
if locationType == 0:
areaId = "00000000"
else:
areaId = self.int2hexStringByBytes(int(data["areaId_inOut"]), 4)
direction = int(data["direction"]) #0-进,1-出
msg = self.int2hexStringByBytes(locationType) + areaId + self.int2hexStringByBytes(direction)
return msg
#获取进出区域/路线报警附加信息,数据随机参数
def getInOutAreaAlarmExtraInfo_random(self):
locationType = self.getRandomNum(intArr=[0,1,2,3,4])
......@@ -343,6 +401,12 @@ class Location_msg(MessageBase):
result = self.int2hexStringByBytes(0) #结果,0-不足,1-过长
msg = areaId + drivingTime + result
return msg
def getDrivingLongOrShortAlarmExtraInfo_GUI(self,data):
areaId = self.int2hexStringByBytes(int(data["areaId_road"]), 4) #路段Id
drivingTime = self.int2hexStringByBytes(int(data["drivingTime"]),2) #路段行驶时间(单位:秒)
result = self.int2hexStringByBytes(int(data["result"])) #结果,0-不足,1-过长
msg = areaId + drivingTime + result
return msg
#路线行驶时间不足/过长报警附加信息消息,数据随机产生
def getDrivingLongOrShortAlarmExtraInfo_ramdom(self):
areaId = self.int2hexStringByBytes(self.getRandomNum(0,4294967295), 4) #路段Id
......@@ -359,6 +423,13 @@ class Location_msg(MessageBase):
data = deepSleepStatus + sleepStatus + retain
dataHex = self.int2hexStringByBytes(data,2)
return dataHex
def getStatusBit_GUI(self,data):
deepSleepStatus = int(data["deepSleepStatus"]) #1:深度休眠状态
sleepStatus = int(data["sleepStatus"]) #1:休眠状态
retain = 0
data = deepSleepStatus + sleepStatus + retain
dataHex = self.int2hexStringByBytes(data,2)
return dataHex
#获取状态位,数据随机产生
def getStatusBit_random(self):
dataHex = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1,2],mult=2),2)
......@@ -387,6 +458,47 @@ class Location_msg(MessageBase):
data = data + dataId_0006 + dataId_0007 + dataId_0010 + dataId_0011 + dataId_0012
data = data + dataId_0013 + dataId_001D
return data
def getBaseDataList_GUI(self,data):
dataHex = ""
if ("0001" in data.keys()):
dataId_0001 = "0001" + self.int2hexStringByBytes(4) + self.getExpandStatusBit_GUI(data["0001"])
dataHex = dataHex + dataId_0001
if ("0002" in data.keys()):
dataId_0002 = "0002" + self.int2hexStringByBytes(4) + self.getExpandAlarmBit_GUI(data["0002"])
dataHex = dataHex + dataId_0002
if ("0003" in data.keys()):
dataId_0003 = "0003" + self.int2hexStringByBytes(5) + self.getTotalMileage_GUI(data["0003"])
dataHex = dataHex + dataId_0003
if ("0004" in data.keys()):
dataId_0004 = "0004" + self.int2hexStringByBytes(5) + self.getTotalOil_GUI(data["0004"])
dataHex = dataHex + dataId_0004
if ("0005" in data.keys()):
dataId_0005 = "0005" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(data["0005"]["dataId_0005"]),4)
dataHex = dataHex + dataId_0005
if ("0006" in data.keys()):
dataId_0006 = "0006" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(data["0006"]["dataId_0006"]),4)
dataHex = dataHex + dataId_0006
if ("0007" in data.keys()):
dataId_0007 = "0007" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(data["0007"]["dataId_0007"]),4)
dataHex = dataHex + dataId_0007
if ("0010" in data.keys()):
speedupInOneSeconds = self.getSpeedupInOneSeconds_GUI(data["0010"])
dataId_0010 = "0010" + self.int2hexStringByBytes(int(len(speedupInOneSeconds) / 2))
dataHex = dataHex + dataId_0010
if ("0011" in data.keys()):
securityStatusData = CarSafeStatusInfo().generateSecurityStatusData_GUI(data["0011"])
dataId_0011 = "0011" + self.int2hexStringByBytes(int(len(securityStatusData) / 2))
dataHex = dataHex + dataId_0011
if ("0012" in data.keys()):
dataId_0012 = "0012" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["0012"]["dataId_0012"]),2)
dataHex = dataHex + dataId_0012
if ("0013" in data.keys()):
dataId_0013 = "0013" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["0013"]["dataId_0013"]))
dataHex = dataHex + dataId_0013
if ("001D" in data.keys()):
dataId_001D = "001D" + self.int2hexStringByBytes(1) + data["001D"]["dataId_001D"]
dataHex = dataHex + dataId_001D
return dataHex
#基础数据项列表,数据随机产生
def getBaseDataList_random(self):
dataId_0001 = "0001" + self.int2hexStringByBytes(4) + self.getExpandStatusBit_random()
......@@ -433,6 +545,12 @@ class Location_msg(MessageBase):
data = defenseUndefenseRep + retain
dataHex = self.int2hexStringByBytes(data,4)
return dataHex
def getExpandStatusBit_GUI(self,data):
defenseUndefenseRep = int(data["dataId_0001"]) #0:撤防上报;1:设防上报 (1)
retain = 0
data = defenseUndefenseRep + retain
dataHex = self.int2hexStringByBytes(data,4)
return dataHex
def getExpandStatusBit_random(self):
dataHex = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1]),4)
return dataHex
......@@ -461,6 +579,9 @@ class Location_msg(MessageBase):
data = data + RTCTroubleAlarm + retain21_31
dataHex = self.int2hexStringByBytes(data,4)
return dataHex
def getExpandAlarmBit_GUI(self,data):
dataHex = self.int2hexStringByBytes(data["dataId_0002"], 4)
return dataHex
def getExpandAlarmBit_random(self):
data = self.getRandomNum(intArr=[0,1,2,4,8,16,1024,2048, \
4096,8192,16384,131072,262144,524288,1048576],mult=14)
......@@ -472,6 +593,11 @@ class Location_msg(MessageBase):
totalMileage = self.int2hexStringByBytes(128000,4) #行驶总里程(单位米)
data = caculateType + totalMileage
return data
def getTotalMileage_GUI(self,data):
caculateType = data["caculateType"]
totalMileage = self.int2hexStringByBytes(int(data["totalMileage"]),4) #行驶总里程(单位米)
data = caculateType + totalMileage
return data
def getTotalMileage_random(self):
caculateType = self.getRandomNum(intArr=["01","02","03","04","05","06","07","09","0A","0B","0C"],)
totalMileage = self.int2hexStringByBytes(self.getRandomNum(0,4294967295),4) #行驶总里程(单位米)
......@@ -483,6 +609,11 @@ class Location_msg(MessageBase):
totalOil = self.int2hexStringByBytes(120000,4) #总油耗(单位 mL)
data = caculateType + totalOil
return data
def getTotalOil_GUI(self,data):
caculateType = data["caculateType"]
totalOil = self.int2hexStringByBytes(int(data["totalOil"]),4) #总油耗(单位 mL)
data = caculateType + totalOil
return data
def getTotalOil_random(self):
caculateType = self.getRandomNum(intArr=["01","02","03","04","05","0B","0C"],)
totalOil = self.int2hexStringByBytes(self.getRandomNum(0,4294967295),4) #总油耗(单位 mL)
......@@ -499,6 +630,16 @@ class Location_msg(MessageBase):
for i in range(0,pointCount):
data = data + self.int2hexStringByBytes(speedupVal + 10,2)
return data
def getSpeedupInOneSeconds_GUI(self,data):
pointCount = int(data["pointCount"]) #采集的点个数 N
collectIntercal = int(data["collectIntercal"]) #采集间隔(单位 ms),上传值为该采集间隔时间内的加速度均值
data = ""
data = data + self.int2hexStringByBytes(pointCount,2)
data = data + self.int2hexStringByBytes(collectIntercal,2)
speedupVal = 1000 #采集点加速度均值
for i in range(0,pointCount):
data = data + self.int2hexStringByBytes(speedupVal + 10,2)
return data
def getSpeedupInOneSeconds_random(self):
data = ""
pointCount = self.getRandomNum(0,50) #采集的点个数 N
......
......@@ -59,6 +59,98 @@ class AlarmEvent_data(MessageBase):
# data = data + sharpBendAlarm + crashAlarm + rapidChangeLines
return data
def generateAlarmEvent_data_GUI(self,data):
dataHex = ""
if ("ignition" in data.keys()):
ignition = "0001" + self.int2hexStringByBytes(0) #点火上报
dataHex = dataHex + ignition
if ("flameout" in data.keys()):
flameout = "0002" + self.int2hexStringByBytes(0) #熄火上报
dataHex = dataHex + flameout
if ("setUpDefences" in data.keys()):
setUpDefences = "0003" + self.int2hexStringByBytes(0) #设防上报
dataHex = dataHex + setUpDefences
if ("withdrawGarrision" in data.keys()):
withdrawGarrision = "0004" + self.int2hexStringByBytes(0) #撤防上报
dataHex = dataHex + withdrawGarrision
if ("doorOpen" in data.keys()):
doorOpen = "0005" + self.int2hexStringByBytes(0) #车门打开
dataHex = dataHex + doorOpen
if ("doorClose" in data.keys()):
doorClose = "0006" + self.int2hexStringByBytes(0) #车门关闭
dataHex = dataHex + doorClose
if ("systemStart" in data.keys()):
systemStart = "0007" + self.int2hexStringByBytes(0) #系统启动
dataHex = dataHex + systemStart
if ("trailCarAlarm" in data.keys()):
trailCarAlarm = "0101" + self.int2hexStringByBytes(0) #拖车报警
dataHex = dataHex + trailCarAlarm
if ("locationTooLong" in data.keys()):
locationTooLong = "0102" + self.int2hexStringByBytes(0) #定位过长报警
dataHex = dataHex + locationTooLong
if ("terminalPullOut" in data.keys()):
terminalPullOut = "0103" + self.int2hexStringByBytes(0) #终端拔出报警
dataHex = dataHex + terminalPullOut
if ("terminalInsert" in data.keys()):
terminalInsert = "0104" + self.int2hexStringByBytes(0) #终端插入报警
dataHex = dataHex + terminalInsert
if ("lowVoltage" in data.keys()):
lowVoltage = "0105" + self.int2hexStringByBytes(0) #低电压报警
dataHex = dataHex + lowVoltage
if ("idlingSpeedOver" in data.keys()):
#怠速过长报警 附带信息见 表 C6EXT1
idlingSpeedOver = "0106" + self.int2hexStringByBytes(9) + self.getIdlingSpeedOver_GUI(data["idlingSpeedOver"])
dataHex = dataHex + idlingSpeedOver
if ("overspeedAlarm" in data.keys()):
#超速报警 附带信息见 表 C6EXT2
overspeedAlarm = "0107" + self.int2hexStringByBytes(9) + self.getOverspeedAlarm_GUI(data["overspeedAlarm"])
dataHex = dataHex + overspeedAlarm
if ("fatigueDriving" in data.keys()):
#疲劳驾驶报警 附带信息见 表 C6EXT3
fatigueDriving = "0108" + self.int2hexStringByBytes(5) + self.getFatigueDriving_GUI(data["fatigueDriving"])
dataHex = dataHex + fatigueDriving
if ("waterTemperatureAlarm" in data.keys()):
#水温报警 附带信息见 表 C6EXT4
waterTemperatureAlarm = "0109" + self.int2hexStringByBytes(9) + self.getWaterTemperatureAlarm_GUI(data["waterTemperatureAlarm"])
dataHex = dataHex + waterTemperatureAlarm
if ("highSpeedNeutralGear" in data.keys()):
highSpeedNeutralGear = "010A" + self.int2hexStringByBytes(0) #高速空档滑行报警
dataHex = dataHex + highSpeedNeutralGear
if ("oilExpendNotSurport" in data.keys()):
oilExpendNotSurport = "010B" +self.int2hexStringByBytes(0) #油耗不支持报警
dataHex = dataHex + oilExpendNotSurport
if ("OBDNotSurport" in data.keys()):
OBDNotSurport = "010C" + self.int2hexStringByBytes(0) #OBD 不支持报警
dataHex = dataHex + OBDNotSurport
if ("lowWaterTemperatureHighSpeed" in data.keys()):
lowWaterTemperatureHighSpeed = "010D" +self.int2hexStringByBytes(0) #低水温高转速
dataHex = dataHex + lowWaterTemperatureHighSpeed
if ("buslineNotSleep" in data.keys()):
buslineNotSleep = "010E" + self.int2hexStringByBytes(0) #总线不睡眠报警
dataHex = dataHex + buslineNotSleep
if ("illegalOpenDoor" in data.keys()):
illegalOpenDoor = "010f" + self.int2hexStringByBytes(0) #非法开门
dataHex = dataHex + illegalOpenDoor
if ("illegalFire" in data.keys()):
illegalFire = "0110" + self.int2hexStringByBytes(0) #非法点火
dataHex = dataHex + illegalFire
if ("rapidAccelerateAlarm" in data.keys()):
rapidAccelerateAlarm = "0111" + self.int2hexStringByBytes(0) #急加速报警
dataHex = dataHex + rapidAccelerateAlarm
if ("sharpSlowdownAlarm" in data.keys()):
sharpSlowdownAlarm = "0112" + self.int2hexStringByBytes(0) #急减速报警
dataHex = dataHex + sharpSlowdownAlarm
if ("sharpBendAlarm" in data.keys()):
sharpBendAlarm = "0113" + self.int2hexStringByBytes(0) #急拐弯报警
dataHex = dataHex + sharpBendAlarm
if ("crashAlarm" in data.keys()):
crashAlarm = "0114" + self.int2hexStringByBytes(0) #碰撞报警
dataHex = dataHex + crashAlarm
if ("rapidChangeLines" in data.keys()):
rapidChangeLines = "0115" + self.int2hexStringByBytes(0) #急变道报警
dataHex = dataHex + rapidChangeLines
return dataHex
# 创建报警事件数据,数据随机产生
def generateAlarmEvent_data_random(self):
data = ""
......@@ -150,6 +242,19 @@ class AlarmEvent_data(MessageBase):
idlingEngineMinSpeed = self.int2hexStringByBytes(500,2)
data = alarmType + idlingTimeOfDuration + idlingOilExpend + idlingEngineMaxSpeed + idlingEngineMinSpeed
return data
def getIdlingSpeedOver_GUI(self,data):
#报警属性 1:报警触发(无下面的数据内容项)0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(int(data["alarmType"]))
#怠速持续时间 怠速持续的时间(含报警前的预判时间),单位为秒
idlingTimeOfDuration = self.int2hexStringByBytes(int(data["idlingTimeOfDuration"]),2)
#怠速耗油量 单位 mL
idlingOilExpend = self.int2hexStringByBytes(int(data["idlingOilExpend"]),2)
#怠速最高转速 单位 RPM
idlingEngineMaxSpeed = self.int2hexStringByBytes(int(data["idlingEngineMaxSpeed"]),2)
#怠速最低转速 单位 RPM
idlingEngineMinSpeed = self.int2hexStringByBytes(int(data["idlingEngineMinSpeed"]),2)
data = alarmType + idlingTimeOfDuration + idlingOilExpend + idlingEngineMaxSpeed + idlingEngineMinSpeed
return data
def getIdlingSpeedOver_random(self):
#报警属性 1:报警触发(无下面的数据内容项)0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1]))
......@@ -180,6 +285,19 @@ class AlarmEvent_data(MessageBase):
overspeedDistance = self.int2hexStringByBytes(10000,2)
data = alarmType + overspeedTimeOfDuration + maxSpeed + averageSpeed + overspeedDistance
return data
def getOverspeedAlarm_GUI(self,data):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(int(data["alarmType"]))
#超速持续时间 2 WORD 怠速持续的时间(含报警前的预判时间),单位为秒
overspeedTimeOfDuration = self.int2hexStringByBytes(int(data["overspeedTimeOfDuration"]),2)
#最高车速 2 WORD 单位 0.1KM/H
maxSpeed = self.int2hexStringByBytes(int(data["maxSpeed"]),2)
#平均车速 2 WORD 单位 0.1KM/H
averageSpeed = self.int2hexStringByBytes(int(data["averageSpeed"]),2)
#超速行驶距离 2 WORD 单位米
overspeedDistance = self.int2hexStringByBytes(int(data["overspeedDistance"]),2)
data = alarmType + overspeedTimeOfDuration + maxSpeed + averageSpeed + overspeedDistance
return data
def getOverspeedAlarm_random(self):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1]))
......@@ -204,6 +322,13 @@ class AlarmEvent_data(MessageBase):
totalContinueDrivingTime = self.int2hexStringByBytes(21000,4)
data = alarmType + totalContinueDrivingTime
return data
def getFatigueDriving_GUI(self,data):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(int(data["alarmType"]))
#累计持续驾驶时间 4 DWORD 车辆点火行驶到报警解除的累计行驶时间,单位为秒
totalContinueDrivingTime = self.int2hexStringByBytes(int(data["totalContinueDrivingTime"]),4)
data = alarmType + totalContinueDrivingTime
return data
def getFatigueDriving_random(self):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1]))
......@@ -226,6 +351,17 @@ class AlarmEvent_data(MessageBase):
averageTemperature = self.int2hexStringByBytes(55,2)
data = alarmType + timeOfDuration + maxTemperature + averageTemperature
return data
def getWaterTemperatureAlarm_GUI(self,data):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(int(data["alarmType"]))
#持续时长 4 DWORD 单位秒
timeOfDuration = self.int2hexStringByBytes(int(data["timeOfDuration"]),4)
#最高温度 2 WORD 单位 0.1 度
maxTemperature = self.int2hexStringByBytes(int(data["maxTemperature"]),2)
#平均温度 2 WORD 单位 0.1 度
averageTemperature = self.int2hexStringByBytes(int(data["averageTemperature"]),2)
data = alarmType + timeOfDuration + maxTemperature + averageTemperature
return data
def getWaterTemperatureAlarm_random(self):
#报警属性 1 BYTE 1:报警触发(无下面的数据内容项) 0:报警解除(有下面的数据内容项)
alarmType = self.int2hexStringByBytes(self.getRandomNum(intArr=[0,1]))
......
......@@ -31,6 +31,21 @@ class CarSafeStatusInfo(MessageBase):
data = data + statusCode + securityStatus + doorStatus + lockStatus + windowStatus + lightStatus + onoffStatusA + onoffStatusB + retain1 + retain2 + retain3
return data
def generateSecurityStatusData_GUI(self,data):
dataHex = ""
statusCode = data["statusCode"] #状态掩码
securityStatus = self.int2hexStringByBytes(int(data["securityStatus"])) #安全状态
doorStatus = self.int2hexStringByBytes(int(data["doorStatus"])) #门状态
lockStatus = self.int2hexStringByBytes(int(data["lockStatus"])) #锁状态
windowStatus = self.int2hexStringByBytes(int(data["windowStatus"])) #窗户状态
lightStatus = self.int2hexStringByBytes(int(data["lightStatus"])) #灯光状态
onoffStatusA = self.int2hexStringByBytes(int(data["onoffStatusA"])) #开关状态A
onoffStatusB = self.int2hexStringByBytes(int(data["onoffStatusB"])) #开关状态B
retain1 = "00" #预留
retain2 = "00" #预留
retain3 = "00" # 预留
dataHex = dataHex + statusCode + securityStatus + doorStatus + lockStatus + windowStatus + lightStatus + onoffStatusA + onoffStatusB + retain1 + retain2 + retain3
return dataHex
#创建安防状态数据,数据随机产生
def generateSecurityStatusData_random(self):
data = ""
......
......@@ -76,6 +76,67 @@ class SaloonCarOBD_data(MessageBase):
data = data + backBrakeBlockAbrasion + brakeFluidLocation + engineOilLocation + tirePressureAlarm + coolingLiquidLocation
data = data + enduranceMileage
return data
def generateSaloonCarOBDData_GUI(self,data):
dataHex = ""
#发动机转速 , 0 - 8000 rpm
engineSpeed = "60C0" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["engineSpeed"]),2)
#车速 , 0 - 240 Km/h
carSpeed = "60D0" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["carSpeed"]))
#剩余油量 ,剩余油量,单位 L 或%Bit15=0 百分比%,OBD 都为百分比Bit15=1 单位 L,显示值为上传值/10
surplusOil = "62f0" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["surplusOil"]))
#冷却液温度 ,-40.0℃ 到 +210℃,上传值减去 40
coolingLiquidTemperature = "6050" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["coolingLiquidTemperature"]))
#进气口温度 ,-40.0℃ 到 +210℃,上传值减去 40
airInletTemperature = "60F0" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["airInletTemperature"]))
#进气(岐管绝对)压力 , 0 - 250kpa
intakeManifoldPressure = "60B0" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["intakeManifoldPressure"]))
#大气压力 , 0 - 125kpa
atmosphericPressure = "6330" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["atmosphericPressure"]))
#环境温度 , -40.0℃ 到 +210℃,上传值减去 40
envTemperature = "6460" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["envTemperature"]))
#加速踏板位置 , 0% - 100%
acceleratorLocation = "6490" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["acceleratorLocation"]))
#燃油压力 , 0 - 500kpa
oilPressure = "60A0" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["oilPressure"]),2)
#故障码状态 , 发动机故障码状态
troubleCodeStatus = "6014" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["troubleCodeStatus"]))
#故障码个数
troubleCodeNum = "6010" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["troubleCodeNum"]))
#空气流量 , 0.1 实际值为上传值/10 0.1g/s
airFlow = "6100" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["airFlow"]),2)
#绝对气门位置
valveLocation = "6110" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["valveLocation"]),2)
#自发动机启动运行时间 sec
engineRunTime = "61F0" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["engineRunTime"]),2)
#故障行驶里程 , Km
troubleMileage = "6210" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(data["troubleMileage"]),4)
#计算负荷值
calculateLoadValue = "6040" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["calculateLoadValue"]))
#长期燃油修正(气缸列 1 和 3)
fuelTrim = "6070" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["fuelTrim"]),2)
#第一缸点火正时提前角 ,显示值为上传值-64
fireAngle = "60E0" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["fireAngle"]),2)
#前刹车片磨损 , 0 正常/否则,显示对应数据,单位:级
frontBrakeBlockAbrasion = "6701" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["frontBrakeBlockAbrasion"]))
#后刹车片磨损 , 0 正常/否则,显示对应数据,单位:级
backBrakeBlockAbrasion = "6702" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["backBrakeBlockAbrasion"]))
#制动液液位 , 0:不正 1:正常 其他:无法使用
brakeFluidLocation = "6703" + self.int2hexStringByBytes(1) + self.int2hexStringByBytes(int(data["brakeFluidLocation"]))
#机油液位 , 显示值为上传值/1000 单位 毫米
engineOilLocation = "6704" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["engineOilLocation"]),2)
#胎压报警 0:当前无警告 1:存在胎压失压 其他:不可用
tirePressureAlarm = "6705" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["tirePressureAlarm"]),2)
#冷却液液位 , 显示值为上传值-48
coolingLiquidLocation = "6706" + self.int2hexStringByBytes(2) + self.int2hexStringByBytes(int(data["coolingLiquidLocation"]),2)
#续航里程 0.1 km ; 显示值为上传值/10
enduranceMileage = "6707" + self.int2hexStringByBytes(4) + self.int2hexStringByBytes(int(data["enduranceMileage"]),4)
dataHex = dataHex + engineSpeed + carSpeed + surplusOil + coolingLiquidTemperature + airInletTemperature
dataHex = dataHex + intakeManifoldPressure + atmosphericPressure + envTemperature + acceleratorLocation + oilPressure
dataHex = dataHex + troubleCodeStatus + troubleCodeNum + airFlow + valveLocation + engineRunTime
dataHex = dataHex + troubleMileage + calculateLoadValue + fuelTrim + fireAngle + frontBrakeBlockAbrasion
dataHex = dataHex + backBrakeBlockAbrasion + brakeFluidLocation + engineOilLocation + tirePressureAlarm + coolingLiquidLocation
dataHex = dataHex + enduranceMileage
return dataHex
def generateSaloonCarOBDData_random(self):
data = ""
#发动机转速 , 0 - 8000 rpm
......
......@@ -642,10 +642,10 @@
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="terminalPullOut" />终端拔出报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="terminalInsert" />终端插入报警</label> </li>
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="lowVoltage" />低电压报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="idlingSpeedOver" />怠速过长报警</label> </li>
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="overspeedAlarm_AE" />超速报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="fatigueDriving_AE" />疲劳驾驶报警</label> </li>
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="waterTemperatureAlarm_AE" />水温报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="idlingSpeedOver" onclick="alarmEventSelect(this)"/>怠速过长报警</label> </li>
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="overspeedAlarm_AE" onclick="alarmEventSelect(this)"/>超速报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="fatigueDriving_AE" onclick="alarmEventSelect(this)"/>疲劳驾驶报警</label> </li>
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="waterTemperatureAlarm_AE" onclick="alarmEventSelect(this)"/>水温报警</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="highSpeedNeutralGear" />高速空档滑行报警</label> </li>
<li style="width:130px;"><label style="width:120px"><input type="checkbox" id="oilExpendNotSurport" />油耗不支持报警</label> </li>
<li style="width:140px;"><label style="width:130px"><input type="checkbox" id="OBDNotSurport" />OBD 不支持报警</label> </li>
......@@ -660,7 +660,7 @@
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="rapidChangeLines" />急变道报警</label> </li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="alarm_idlingSpeedOver" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>怠速过长报警:</label>
<ul class="protocol_content" style="padding:0px;">
<li><label>报警属性:</label><select style="width:150px;" id="alarmType" class="form-control">
......@@ -672,7 +672,7 @@
<li style="word-break:break-all;font-size:10px;"><label>怠速最低转速:</label><input id="idlingEngineMinSpeed" type="text" class="form-control" value="500"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="alarm_overspeedAlarm_AE" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>超速报警:</label>
<ul class="protocol_content" style="padding:0px;">
<li><label>报警属性:</label><select style="width:150px;" id="alarmType_cs" class="form-control">
......@@ -684,7 +684,7 @@
<li style="word-break:break-all;font-size:10px;"><label>怠速最低转速:</label><input id="overspeedDistance" type="text" class="form-control" value="10000"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="alarm_fatigueDriving_AE" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>超速报警:</label>
<ul class="protocol_content" style="padding:0px;">
<li><label>疲劳驾驶报警:</label><select style="width:150px;" id="alarmType_pljs" class="form-control">
......@@ -693,7 +693,7 @@
<li style="word-break:break-all;font-size:10px;"><label>累计持续驾驶时间,秒:</label><input id="totalContinueDrivingTime" type="text" class="form-control" value="10000"></li>
</ul>
</div>
<div style="width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<div id="alarm_waterTemperatureAlarm_AE" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
<label>水温报警:</label>
<ul class="protocol_content" style="padding:0px;">
<li><label>疲劳驾驶报警:</label><select style="width:150px;" id="alarmType_sw" class="form-control">
......@@ -747,7 +747,6 @@ $("#sendMsgBtn").click(function(){
console.log(data)
/**
var host = window.location.host;
$("#showFeedback").val("");
$.ajax({
......@@ -770,7 +769,6 @@ $("#sendMsgBtn").click(function(){
}
}
});
*/
});
/*******************************************
......@@ -1506,5 +1504,29 @@ function baseInfoSelect(e){
}
}
//报警事件的选择与取消选择
function alarmEventSelect(e){
if($(e).is(':checked')){
if($(e).attr("id") == "idlingSpeedOver"){
$("#alarm_idlingSpeedOver").css("display","block")
}else if($(e).attr("id") == "overspeedAlarm_AE"){
$("#alarm_overspeedAlarm_AE").css("display","block")
}else if($(e).attr("id") == "fatigueDriving_AE"){
$("#alarm_fatigueDriving_AE").css("display","block")
}else if($(e).attr("id") == "waterTemperatureAlarm_AE"){
$("#alarm_waterTemperatureAlarm_AE").css("display","block")
}
}else{
if($(e).attr("id") == "idlingSpeedOver"){
$("#alarm_idlingSpeedOver").css("display","none")
}else if($(e).attr("id") == "overspeedAlarm_AE"){
$("#alarm_overspeedAlarm_AE").css("display","none")
}else if($(e).attr("id") == "fatigueDriving_AE"){
$("#alarm_fatigueDriving_AE").css("display","none")
}else if($(e).attr("id") == "waterTemperatureAlarm_AE"){
$("#alarm_waterTemperatureAlarm_AE").css("display","none")
}
}
}
</script>
{% endblock %}
\ 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