feat:添加里程上传

This commit is contained in:
Surenjun 2024-10-14 09:22:29 +08:00
parent 6536f9532b
commit 91491432d8
11 changed files with 177 additions and 9 deletions

View File

@ -4,13 +4,13 @@
{
"name": "default",
"material": {
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.cer",
"storePassword": "0000001A411B16D84BA448A9AED56C5B7E351A55B8BA7BA0073A2313B214C24C5740A4B49E6E80AD05F0",
"certpath": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.cer",
"storePassword": "0000001BE4BBADDF656A884E7A7BB5FD51F64FBB61DD24A944FEA969482DD693210ED5FF3D29F13642E3A3",
"keyAlias": "debugKey",
"keyPassword": "0000001AD6836BCC5536725F76279FB36A15D9F61E7CE88C2D043642297F81A9662DEB365314D756CB63",
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p7b",
"keyPassword": "0000001BDEFFDC280B45617E7FC447CB21F2D133540301F543454643D3F5E9F6E5ED2A583A7FA92B260433",
"profile": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p12"
"storeFile": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p12"
}
}
],

View File

@ -219,7 +219,7 @@ export default class UdpClientByCenter {
}
sendMsgExt(param, context?) {
console.log('sendMsgExt enterbitbit',JSON.string(param));
console.log('sendMsgExt enterbitbit',JSON.stringify(param));
if (context) {
this.context = context
}

View File

@ -77,7 +77,7 @@ struct UserInfo {
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
@State faceCatchImg: string = ''
@State Param803Str: string = ''
@State Param341: boolean = ''
@State Param341: boolean = false
private title = ''
private type = '2'
// 过程照片拍照

View File

@ -7,8 +7,8 @@ export interface Project {
projectCodeCenter: string
//项目简写
abbreviation?: string
//项目状态:未做 正在做 及格 不及格
type?: '1' | '2' | '3' | '4'
//项目状态:未做 正在做 及格 不及格 有扣分
type?: '1' | '2' | '3' | '4' | '5'
//
isEnd:boolean,
isUpload:boolean

View File

@ -0,0 +1,155 @@
package com.duolun.vehterminal.dl_frontend.port;
import android.text.TextUtils;
import android.util.Log;
import com.duolun.vehterminal.dl_base.config.ExamParam;
import com.duolun.vehterminal.dl_base.log.LogHelper;
import com.duolun.vehterminal.dl_library.SensorCache;
import com.duolun.vehterminal.dl_library.VehicleStatus;
import com.duolun.vehterminal.dl_library.bean.GPSInfo;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
public class GpsPort extends Port{
private final String TAG = "GpsPort";
private StringBuffer gpsData = new StringBuffer();
private long start = System.currentTimeMillis();
public void start() {
super.start();
}
@Override
protected void handleData() {
try {
//client.send("hello!".getBytes());
byte[] msg = client.receive();
if(msg == null) return;
String revMsg = new String(msg, "US-ASCII").trim();
String obdData = SensorCache.getInstance().getObdData();
SensorCache.getInstance().setPlcData(obdData + revMsg);
if(TextUtils.isEmpty(revMsg)) return;
long timeLen = System.currentTimeMillis() - start;
// Log.e(TAG,"----------------revMsg--->"+revMsg);
if(timeLen>100){
if(!TextUtils.isEmpty(gpsData.toString())){
GPSInfo info = getGPSInfo(gpsData.toString());
if (info != null) {
if (info.getMode() == 4) {
VehicleStatus.status[VehicleStatus.GPS] = VehicleStatus.NORMAL;
} else {
VehicleStatus.status[VehicleStatus.GPS] = VehicleStatus.EXCEPTION;
}
SensorCache.getInstance().putGpsInfo(info);
}
}
gpsData = new StringBuffer();
gpsData.append(revMsg);
}else{
gpsData.append(revMsg);
}
start = System.currentTimeMillis();
} catch (Exception e) {
LogHelper.e(TAG,"",e);
}
}
private GPSInfo getGPSInfo(String data) {
LogHelper.i(TAG, "getGPSInfo--->"+data);
GPSInfo info = new GPSInfo();
info.setGpsFrontNum(1);
try {
String[] lines = data.split("\r\n");
for(String line:lines){
if(line.startsWith("$KSXT")){
getGPS(info,line);
}else if(line.startsWith("$GPGST")){
String[] _data = line.split(",");
info.setLatErrorValue(Float.parseFloat(TextUtils.isEmpty(_data[6]) ? "0" : _data[6]));//维度精度因子
info.setLongErrorValue(Float.parseFloat(TextUtils.isEmpty(_data[7]) ? "0" : _data[7]));//经度精度因子
info.setHeightErrorValue(Float.parseFloat(_data[8].split("\\*")[0]));
}else if(line.startsWith("#HEADINGA")){
String[] strs = line.split(",");
BigDecimal b = new BigDecimal(Float.parseFloat(strs[12]));
float azimuthAngle = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
azimuthAngle += 180;
if (azimuthAngle > 360) {
azimuthAngle = azimuthAngle - 360;
}
info.setAzimuthAngle(azimuthAngle);
BigDecimal d = new BigDecimal(Float.parseFloat(strs[13]));
info.setPitchAngle(d.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
info.setAzimuthAngleErrorValue(Float.parseFloat(strs[15]));
info.setPitchAngleErrorValue(Float.parseFloat(strs[16]));
}else if(line.startsWith("$GPGGA")){
String[] gps = line.split(",");
int status = Integer.parseInt(TextUtils.isEmpty(gps[6]) ? "0" : gps[6]);//状态
if (status > 0) info.setStatus(1);
info.setMode(status);
info.setLocationStatus(status + "");
}
}
info.setGpsData(data);
SensorCache.getInstance().putGpsInfo(info);
} catch (Exception e) {
LogHelper.e(TAG, "getGPSInfo->", e);
}
return null;
}
private void getGPS(GPSInfo gpsInfo,String signal) {
try {
String[] gps = signal.split(",");
if (gps.length < 14) {
gpsInfo.setRevTime(System.currentTimeMillis());
SensorCache.getInstance().putGpsInfo(gpsInfo);
LogHelper.i(TAG,signal);
return;
}
gpsInfo.setMsg("#GPS," + signal);
gpsInfo.setRevTime(System.currentTimeMillis());
gpsInfo.setAzimuthStatus(gps[11]);
gpsInfo.setAzimuthNum(gps[12]);
gpsInfo.setGpsFrontNum(Integer.parseInt(TextUtils.isEmpty(gps[13]) ? "0" : gps[13]));//收星数
gpsInfo.setHeight(Float.parseFloat(TextUtils.isEmpty(gps[4]) ? "0" : gps[4]));//海拔高度
gpsInfo.setAge(Float.parseFloat(TextUtils.isEmpty(gps[20]) ? "0" : gps[20]));//龄期
String pitchAngle = gps[6];//俯仰角
gpsInfo.setPitchAngle(Float.parseFloat(TextUtils.isEmpty(pitchAngle) ? "0" : pitchAngle));
gpsInfo.setGpsTime(gps[1]);
gpsInfo.setLatitude(Double.parseDouble(TextUtils.isEmpty(gps[3]) ? "0" : gps[3]));//维度
gpsInfo.setLongitude(Double.parseDouble(TextUtils.isEmpty(gps[2]) ? "0" : gps[2]));//精度
float speed = 0;
if (gps.length>14 && !TextUtils.isEmpty(gps[8])) {
BigDecimal r = new BigDecimal(Float.parseFloat(gps[8]) * 1.852);
speed = r.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
gpsInfo.setVelocity(speed);
}
if ("0".equals(ExamParam.SPEED_TYPE) || TextUtils.isEmpty(ExamParam.SPEED_TYPE))
ExamParam.SPEED = speed + "";
} catch (Exception e) {
LogHelper.i5(TAG, "异常数据:" + signal);
LogHelper.i5(TAG, "异常信息:"+e.getMessage());
gpsInfo.setRevTime(System.currentTimeMillis());
SensorCache.getInstance().putGpsInfo(gpsInfo);
}
}
/**
* 坐标预处理将度分转为度
*
* @return
*/
private double translateLatLon(double a) {
int temp1 = (int) Math.floor(a / 100);
double temp2 = temp1 + (a - temp1 * 100) / 60;
return temp2;
}
}

View File

@ -0,0 +1,9 @@
Find GPGST,Find GPRMC,Find GPGGA,Find PTNL,Find BESTPOSA,Find HEADINGA,Find KSXT,Find BYC,
$GPGST,045215.20,0.03,0.01,0.03,0.0000,0.01,0.01,0.03*60
$GPRMC,045215.20,A,3206.3460589,N,11842.1399062,E,0.022,0.0,081024,0.0,E,D*30
$GPGGA,045215.20,3206.3460589,N,11842.1399062,E,4,42,0.5,1.935,M,0.592,M,3.200,0000*7A
$PTNL,AVR,045215.20,+66.5809,Yaw,-1.1687,Tilt,,,1.288,3,1.2,38*01
$KSXT,20241008045215.20,118.70233177,32.10576765,2.5270,66.58,-1.17,70.35,0.040,,3,3,38,42,-45.675,-21.352,-2.137,0.038,0.013,0.015,3.2,40,*8BA53C1A
#BESTPOSA,COM1,0,87.5,FINESTEERING,2335,190353.200,00000000,0000,782;SOL_COMPUTED,NARROW_INT,32.10576764819,118.70233176936,1.9353,0.5917,WGS84,0.0132,0.0118,0.0253,"0",3.200,0.034,44,42,42,42,00,00,30,37*77b805ad
#HEADINGA,COM1,0,87.5,FINESTEERING,2335,190353.200,00000000,0000,782;SOL_COMPUTED,NARROW_INT,1.287597299,66.580940247,-1.168731809,0.0,0.808748186,0.807274878,"0",44,38,44,26,0,00,30,37*3e44d092
#BYCHECKA,COM1,0,87.5,FINESTEERING,2335,190353.200,00000000,0000,782;1268,2335,190353.200,1,1,1,0,1,1,1,1,1,1,1,1*c786fc2a

View File

@ -22,6 +22,8 @@ export const judgeConfig = {
//gps位数
gpsDigit:6
},
//后置机类型 0=>三代机 1=>一体机 2=>二代机
rearEndUnitsType:0,
// 杭州科目二
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
//TODO 济南临时特殊配置

View File

@ -0,0 +1,2 @@
//

Binary file not shown.

Binary file not shown.

Binary file not shown.