diff --git a/entry/src/main/cpp/sdk/common/HSystem.h b/entry/src/main/cpp/sdk/common/HSystem.h index c622ff38..18a7ef58 100644 --- a/entry/src/main/cpp/sdk/common/HSystem.h +++ b/entry/src/main/cpp/sdk/common/HSystem.h @@ -107,7 +107,6 @@ *** JUDGE_USE_MEMORY //是否启用内存操作检查 *** JUDGE_USE_POOL //是否启用内存池调试信息 *** JUDGE_USE_ASSERT //是否启用断言提示 - *** JUDGE_USE_NICE //是否启用调试测试代码 *** JUDGE_USE_PERF //是否启用CPU性能分析 *** JUDGE_USE_LEAK //是否启用内存泄露检测 *** JUDGE_USE_TCMALLOC //是否启用tcmalloc优化内存使用操作 @@ -120,26 +119,20 @@ #define JUDGE_USE_LOG /* - * 是否启用外壳APP侧传入参数严格检查 + * 是否启用一些调试用的信息,开发用 */ #if defined(JUDGE_OS_OHOS) || defined(JUDGE_OS_ANDROID) || defined(JUDGE_DEBUG__) - #define JUDGE_USE_STRICT + + #define JUDGE_USE_STRICT //是否启用外壳APP侧传入参数严格检查 + #endif -/* - * 是否启用系统在返回错误码的时候输出日志 - */ -#define JUDGE_USE_CODE +#define JUDGE_USE_CODE //是否启用系统在返回错误码的时候输出日志 -/* - * 是否启用函数执行耗时检测 - * 是否启用内存操作检查 - * 是否启用内存池调试信息 - */ #if 0 - #define JUDGE_USE_COST - #define JUDGE_USE_MEMORY - #define JUDGE_USE_POOL + #define JUDGE_USE_COST //是否启用函数执行耗时检测 + #define JUDGE_USE_MEMORY //是否启用内存操作检查 + #define JUDGE_USE_POOL //是否启用内存池调试信息 #endif /* @@ -150,11 +143,6 @@ #define JUDGE_USE_ASSERT //是否启用断言提示 #endif -/* - * 是否启用测试调试代码 - */ -#define JUDGE_USE_NICE - /* * 是否启用CPU性能分析和内存泄露检测 * 注意:目前只在linux系统并且在编译测试工程时前提下条件下才能开启 @@ -171,7 +159,6 @@ //#define JUDGE_USE_TCMALLOC //是否启用tcmalloc优化内存使用操作 #endif - /* * 是否启用无锡科研所送检模式 * 作者: 杨海洋 @@ -202,14 +189,12 @@ * 7.下一次再去无锡所检测,左转弯要用原始的ret2000 * * + * */ -//#define JUDGE_USE_INSPECT +//#define JUDGE_USE_INSPECT -//********************************以上是预编译定义*************************************** - - /* * 基础整数类型定义 * diff --git a/entry/src/main/cpp/sdk/database/sysparm/SysParmTable.h b/entry/src/main/cpp/sdk/database/sysparm/SysParmTable.h index 67b0414b..4a9438c4 100644 --- a/entry/src/main/cpp/sdk/database/sysparm/SysParmTable.h +++ b/entry/src/main/cpp/sdk/database/sysparm/SysParmTable.h @@ -3,11 +3,6 @@ * * 作者: 杨海洋 * 日期: 2024-01-03 - * - ****************************************************************************** - * 1、免考项目参数设置:systemparm表: NO1=1并且TXT3=1的是免考的,NO2是项目代码 - * - * */ #ifndef SYSPARMTABLE_H diff --git a/entry/src/main/cpp/sdk/database/sysset/SysSetTable.h b/entry/src/main/cpp/sdk/database/sysset/SysSetTable.h index 500b7e03..5a623ec9 100644 --- a/entry/src/main/cpp/sdk/database/sysset/SysSetTable.h +++ b/entry/src/main/cpp/sdk/database/sysset/SysSetTable.h @@ -147,7 +147,7 @@ class JUDGE_API SysSetTable : public IDBTable SYSSET_DECLARE(19, type_array, ":"); //夜间考试考试时间 SYSSET_DECLARE(211); //考试地点参数 - SYSSET_DECLARE(301, type_array, "^"); //条件1:档位,车速,持续时间,结束标志(0-不结束,1红闪,2黑闪),距离,^条件2:档位,车速,持续时间,0,距离,^评判时间(0-最后评判,1-里程达到就评判)^ //示例:4,35,3,0,1,^5,50,3,0,1,^ + SYSSET_DECLARE(301, type_array2, "^", ","); //条件1:档位,车速,持续时间,结束标志(0-不结束,1红闪,2黑闪),距离,^条件2:档位,车速,持续时间,0,距离,^评判时间(0-最后评判,1-里程达到就评判)^ //示例:4,35,3,0,1,^5,50,3,0,1,^ SYSSET_DECLARE(303); //行驶距离限制(米) //3000 SYSSET_DECLARE(306); //直行键(0-直行,1-加速行驶) //1 SYSSET_DECLARE(307); //只考一次的项目 //5,15,16 diff --git a/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp b/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp index 1b15c653..7edc1b28 100644 --- a/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp @@ -59,7 +59,6 @@ ErrorCode ExamCarSub2::examGoonExam() { if(m_stuInfo.ddxk) { - m_disForward = m_stuInfo.yklc; for(size_t i = 0; i < m_stuInfo.ykxm.size(); i++) { int itemNo = m_stuInfo.ykxm[i]; @@ -366,7 +365,7 @@ ISub2JudgeItem* ExamCarSub2::readEnterItem() //必须是前进状态进项目 if(historyMoveState() != moveForward) { - //logdebug("not moveForward move=%d", m_cg->move); + logdebug("not moveForward move=%d", m_cg->move); return nullptr; } for(auto k = m_itemsAll.begin(); k != m_itemsAll.end(); k++) @@ -390,7 +389,7 @@ ISub2JudgeItem* ExamCarSub2::readEnterItem() if(examItem->isFlagEnd()) { //已经考过,略过 - //logdebug("exam already itemNo=%d.", itemEnter->itemNo()); + logdebug("exam already itemNo=%d.", itemEnter->itemNo()); continue; } #endif diff --git a/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp b/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp index 98ce83f5..3a959e59 100644 --- a/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp @@ -38,7 +38,6 @@ ErrorCode ExamCarSub3::examBeginExam() // loginfo("exam-item xmdm=%d", item.xmdm); //} - m_disOffset = false; m_pub = TPubKM3(); std::string sError; if(!Init_KM3_Global(sError)) @@ -74,7 +73,6 @@ ErrorCode ExamCarSub3::examGoonExam() if(m_stuInfo.ddxk) { - m_disForward = m_stuInfo.yklc; //1、项目更改颜色 for(size_t i = 0; i < m_stuInfo.ykxm.size(); i++) { @@ -598,7 +596,9 @@ bool ExamCarSub3::Init_KM3_Global(std::string& sError) const TSystemparm* parm6 = TableSysParm->findParm6(itemNo); examItem->Item_Code = (parm6 != nullptr ? parm6->TXT2 : ""); examItem->Item_Color = itemStateWk; - examItem->NoID = (parm1->TXT3 == "1" ? true : false); //20180508 免考 //systemparm表: NO1=1并且TXT3=1的是免考的 20240731 + examItem->NoID = (parm1->TXT3 != "" ? true : false); //20180508 免考 + + //logdebug("ItemNo=%d,NoID=%s,TXT3=%s", examItem->ItemNo, examItem->NoID ? "true":"false", parm1->TXT3.c_str()); //加减挡免考 if(ksdd != siteof::chongqingkm3 && ksdd != siteof::jilinsongyuan && itemNo == Sub3ItemType14Jjdw) @@ -1183,15 +1183,37 @@ void ExamCarSub3::Deal_KM3_Judge() } } - dealOffset(); + m_pub.m_KsLjLc = m_stuInfo.yklc/100 + m_cg->ai_ljjl; + m_cg->tkCnt = GetCurrentTick2(); + m_cg->RTKKM3.CrossPointNo = lastCrossPtNo(); //ToDo1:执行通用评判 m_commItem->dealJudgeItem(); - m_curItem = nullptr; + //(*2024-03-06*) + //ExamItemCode mitemno = m_cg->real.sensor.mitemno; + //if(mitemno != 0) + //{ + // CallRenGongEnterItem(mitemno); + //} - dealItemNoIDEnd14Jjdw(); //必须放这里 - dealItemNoIDEndItem(); //必须放这里 + //240710 + //if(m_cg->real.sensor.rmndg == SYES) + //{ + // TKM3Item* item = findExamItem(Sub3ItemType41Mndg); + // if(item && item->TestPro == ItemProFlagIdle) + // { + // item->Item_Color = itemStateZk; + // item->TestPro = ItemProFlagInit; + // item->FinishFlag = false; + // //item->StartTime = GetCurrentTime2(); + // //item->EndTime = 0; + // //item->MsgData = ""; + // //createEventEnterItem({item->ItemNo, ""}); + // } + //} + + m_curItem = nullptr; //执行具体的专项评判 std::string msg; for(auto it = m_sub3Items.begin(); it != m_sub3Items.end(); it++) @@ -1314,17 +1336,6 @@ void ExamCarSub3::ClearRecord() RTKKM3.Wheel_RB_ToRightEdge = 0; RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr0; - - - //20240801 - RTKKM3.TouchLineDirCS = TRTKResult::TouchDir0; - RTKKM3.BackPointLaneNo = 0; - RTKKM3.BackPointLaneCount = 0; - RTKKM3.Body_RF_ToBaseLine = 0; - RTKKM3.Body_RB_ToBaseLine = 0; - - RTKKM3.DirInverse = 0; - RTKKM3.ShapeNoWheel = 0; } void ExamCarSub3::GetMeshIndex() @@ -1497,54 +1508,27 @@ bool ExamCarSub3::RTKLane() if(i > roadSize - 1) break; const TMapRoadRec* road = FactoryRoads->getRoad(i); - const Pointi& pt = m_cg->body.points_b[II(1)]; //CarStatus.Body_24_RealTimePt[0]; - const Pointi& ptBack = m_cg->body.points_b[II(13)]; + const Pointi& pt = m_cg->body.points_b[0]; //CarStatus.Body_24_RealTimePt[0]; for(int j = 0; j < road->LaneCount; j++) { const TModelPolygon& poly = road->Lanes[j]; if(poly.Pts.size() >= 5) { - bool flag = false; if(GpsMath::IsPtInArcLane(pt, poly)) { RTKKM3.FrontPointLaneNo = std::atoi(poly.LaneNo.c_str()); //共有几股车道 RTKKM3.FrontPointLaneCount = road->LaneCount; - flag = true; //break; - } - - if(GpsMath::IsPtInArcLane(ptBack, poly)) //20240801 yhy add - { - RTKKM3.BackPointLaneNo = std::atoi(poly.LaneNo.c_str()); - //共有几股车道 - RTKKM3.BackPointLaneCount = road->LaneCount; - flag = true; //break; - } - if(flag) - { break; } } else { - bool flag = false; if(GpsMath::IsPtInPoly(pt.x, pt.y, poly.Pts)) { RTKKM3.FrontPointLaneNo = std::atoi(poly.LaneNo.c_str()); //共有几股车道 RTKKM3.FrontPointLaneCount = road->LaneCount; - flag = true; //break; - } - - if(GpsMath::IsPtInPoly(ptBack.x, ptBack.y, poly.Pts)) //20240801 yhy add - { - RTKKM3.BackPointLaneNo = std::atoi(poly.LaneNo.c_str()); - //共有几股车道 - RTKKM3.BackPointLaneCount = road->LaneCount; - flag = true; //break; - } - if(flag) - { break; } } @@ -1554,7 +1538,7 @@ bool ExamCarSub3::RTKLane() //判断车轮压线类型 RTKKM3.TouchLineType = LineTag0; //2019-4-22 - RTKKM3.TouchDir = TRTKResult::TouchDir0; + RTKKM3.TouchDir = 0; for(int p = curRoadIndex - 1; p <= curRoadIndex + 1; p++) { if(p < 0 || p > roadSize - 1) continue; @@ -1867,7 +1851,6 @@ void ExamCarSub3::Calc_LaneDistance() const TMeshDefine* curMesh = FactoryMesh->getMesh(m_meshIndex); TASSERT_VOID(curMesh != nullptr, ""); - const TModelLine* laneDriving = nullptr; for(int p = 1; p <= 4; p++) { for(int i = curRoadIndex - 2; i <= curRoadIndex + 2; i++) @@ -1904,7 +1887,6 @@ void ExamCarSub3::Calc_LaneDistance() { if(p == 1) //1、车轮与本车道右侧距离 { - laneDriving = &road->BorderLines[0]; for(int k = 1; k <= 4; k++) { Pointi pt; @@ -1939,7 +1921,7 @@ void ExamCarSub3::Calc_LaneDistance() } else if(p == 2) //2:车轮与最右侧车道右侧距离 { - for(int k = 1; k <= 6; k++) + for(int k = 1; k <= 4; k++) { Pointi pt; switch(k) @@ -1948,8 +1930,6 @@ void ExamCarSub3::Calc_LaneDistance() case 2: pt = body.YQ_W_b; break; //CarStatus.CheLun_Wai_YQ_RealTime; case 3: pt = body.ZH_W_b; break; //CarStatus.CheLun_Wai_ZH_RealTime; case 4: pt = body.YH_W_b; break; //CarStatus.CheLun_Wai_YH_RealTime; - case 5: pt = body.points_b[RightBody1]; break; //20240801 - case 6: pt = body.points_b[RightBody2]; break; //20240801 default: break; } line.PtBegin = body.b1_b; // CarStatus.BasePoint1_RealTime; @@ -1968,8 +1948,6 @@ void ExamCarSub3::Calc_LaneDistance() case 2: RTKKM3.Wheel_RF_ToBaseLine = distance; break; case 3: RTKKM3.Wheel_LB_ToBaseLine = distance; break; case 4: RTKKM3.Wheel_RB_ToBaseLine = distance; break; - case 5: RTKKM3.Body_RF_ToBaseLine = distance; break; //20240801 - case 6: RTKKM3.Body_RB_ToBaseLine = distance; break; //20240801 default: break; } } @@ -2040,7 +2018,6 @@ void ExamCarSub3::Calc_LaneDistance() { if(p == 1) //1、车轮与本车道右侧距离 { - laneDriving = &road->BorderLines[0]; for(int k = 1; k <= 4; k++) { Pointi pt; @@ -2078,7 +2055,7 @@ void ExamCarSub3::Calc_LaneDistance() } else if(p == 2) //2:车轮与最右侧车道右侧距离 { - for(int k = 1; k <= 6; k++) + for(int k = 1; k <= 4; k++) { Pointi pt; switch(k) @@ -2087,8 +2064,6 @@ void ExamCarSub3::Calc_LaneDistance() case 2: pt = body.YQ_W_b; break; //CarStatus.CheLun_Wai_YQ_RealTime; case 3: pt = body.ZH_W_b; break; //CarStatus.CheLun_Wai_ZH_RealTime; case 4: pt = body.YH_W_b; break; //CarStatus.CheLun_Wai_YH_RealTime; - case 5: pt = body.points_b[RightBody1]; break; //20240801 - case 6: pt = body.points_b[RightBody2]; break; //20240801 default: break; } line.PtBegin = body.b1_b; @@ -2110,8 +2085,6 @@ void ExamCarSub3::Calc_LaneDistance() case 2: RTKKM3.Wheel_RF_ToBaseLine = distance; break; case 3: RTKKM3.Wheel_LB_ToBaseLine = distance; break; case 4: RTKKM3.Wheel_RB_ToBaseLine = distance; break; - case 5: RTKKM3.Body_RF_ToBaseLine = distance; break; //20240801 - case 6: RTKKM3.Body_RB_ToBaseLine = distance; break; //20240801 default: break; } } @@ -2182,22 +2155,17 @@ void ExamCarSub3::Calc_LaneDistance() } } } - } + } ///////////////////////////////////////////////////////////////////////// } } } } - - //计算是否逆向行驶1正向行驶 -1逆向行驶 - RTKKM3.DirInverse = driveDirection(laneDriving); - } //计算车身压线 void ExamCarSub3::Calc_CheShenYaXian() { TRTKResult& RTKKM3 = m_cg->RTKKM3; - int curLaneIndex = RTKKM3.LaneIndex; RTKKM3.TouchLineTypeCS = LineTag0; if(RTKKM3.MapRoadIndex == INVALID_INDEX) return; if(RTKKM3.LaneIndex == INVALID_INDEX) return; @@ -2210,7 +2178,7 @@ void ExamCarSub3::Calc_CheShenYaXian() poly.Pts[i] = ps[i]; } const TMapRoadRec* road = FactoryRoads->getRoad(RTKKM3.MapRoadIndex); - for(int i = curLaneIndex; i <= curLaneIndex + 1; i++) + for(int i = RTKKM3.LaneIndex; i <= RTKKM3.LaneIndex + 1; i++) { const TModelLine& line = road->BorderLines[i]; if(line.Radius == 0) @@ -2218,7 +2186,6 @@ void ExamCarSub3::Calc_CheShenYaXian() if(GpsMath::IsLineCrossPoly(line, poly)) { RTKKM3.TouchLineTypeCS = line.tag1; - RTKKM3.TouchLineDirCS = (i == curLaneIndex ? TRTKResult::TouchDir1 : TRTKResult::TouchDir_1); //20240801 yhy add break; } } @@ -2227,7 +2194,6 @@ void ExamCarSub3::Calc_CheShenYaXian() if(GpsMath::IsPolyCrossArc(poly, line)) { RTKKM3.TouchLineTypeCS = line.tag1; - RTKKM3.TouchLineDirCS = (i == curLaneIndex ? TRTKResult::TouchDir1 : TRTKResult::TouchDir_1); //20240801 yhy add break; } } @@ -2289,43 +2255,24 @@ void ExamCarSub3::RTKJudge_SubItem() if(curMesh->MapSubItemKeyLen == 0) return; TChuanGan* his = historyChuanGan(1); + //TASSERT_VOID(his != nullptr, ""); if(his == nullptr) return; + //if(CarStatus.Body_24_RealTimePt_LS[0].X = 0) and (CarStatus.Body_24_RealTimePt_LS[0].Y = 0) then Exit; TModelLine line; - line.PtBegin = m_cg->body.points_b[II(1)]; - line.PtEnd = his->body.points_b[II(1)]; - - //20240801 begin - TModelLine lineWF; - lineWF.PtBegin = GpsMath::calcCenterPoint(m_cg->body.ZQ_W_b, m_cg->body.YQ_W_b); - lineWF.PtEnd = GpsMath::calcCenterPoint(his->body.ZQ_W_b, his->body.YQ_W_b); - - //TModelLine lineWB; - //lineWB.PtBegin = GpsMath::calcCenterPoint(m_cg->body.ZH_W_b, m_cg->body.YH_W_b); - //lineWB.PtEnd = GpsMath::calcCenterPoint(his->body.ZH_W_b, his->body.YH_W_b); - - //TModelLine lineWZ; - //lineWZ.PtBegin = GpsMath::calcCenterPoint(m_cg->body.ZQ_W_b, m_cg->body.YQ_W_b); - //lineWZ.PtEnd = GpsMath::calcCenterPoint(m_cg->body.ZH_W_b, m_cg->body.YH_W_b); - - TModelPolygon polyW; - polyW.Pts.resize(4); - polyW.Pts[0] = m_cg->body.ZQ_W_b; - polyW.Pts[1] = m_cg->body.YQ_W_b; - polyW.Pts[2] = m_cg->body.YH_W_b; - polyW.Pts[3] = m_cg->body.ZH_W_b; - //20240801 end + line.PtBegin = m_cg->body.points_b[0]; //CarStatus.Body_24_RealTimePt[0].X; + line.PtEnd = his->body.points_b[0]; //CarStatus.Body_24_RealTimePt_LS[0].X; //车身24点 TModelPolygon poly1; - poly1.Pts.resize(24); - for(int i = 0; i < 24; i++) + poly1.Pts.resize(24); //SetLength(TempPolygon1.Pts, 24); + for(int I = 0; I < 24; I++) { - poly1.Pts[i] = m_cg->body.points_b[i]; + poly1.Pts[I] = m_cg->body.points_b[I]; } - for(int i = 0; i < curMesh->MapSubItemKeyLen; i++) + for(int I = 0; I < curMesh->MapSubItemKeyLen; I++) { //CrossLineAttr //0-未越线 1-停车线 2-中心点右侧线 3-等待控制线 20150119 - int idx = curMesh->MapSubItem_Keys[i]; + int idx = curMesh->MapSubItem_Keys[I]; const TMapSubItemRec* subItem = FactorySharps->getSharp(idx); SubNameTag subName = (SubNameTag)std::atoi(subItem->SubName.c_str()); int SNO = subItem->SNO; @@ -2336,83 +2283,65 @@ void ExamCarSub3::RTKJudge_SubItem() //如果subName=4 2个点关联的路口环岛线,外面几乎用不到,用于路口项目,不能读到这个路口环岛线,否则压扣分(Mark(5,'5'); if(subName == SubNameTag0) { - bool flag = false; if(GpsMath::IsCross(line, subItem->Line1)) { //0-未越线 1-停车线 2-中心点右侧线 3-等待控制线 20150119 RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr1; RTKKM3.ShapeNo = SNO; + //RTKKM3.LS_ShapeNo = 0; m_pub.m_SNO = 0; - flag = true; //break; - } - //20240801 - if(GpsMath::IsCross(lineWF, subItem->Line1)) - { - RTKKM3.ShapeNoWheel = SNO; - flag = true; //break; - } - if(flag) - { - break; + break; } } else if(subName == SubNameTag1) //3个点关联 { - bool flag = false; if(GpsMath::IsCross(line, subItem->Line1)) { //0-未越线 1-停车线 2-中心点右侧线 3-等待控制线 20150119 RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr1; RTKKM3.ShapeNo = SNO; + //RTKKM3.LS_ShapeNo = SNO; m_pub.m_SNO = SNO; RTKKM3.CrossPoint = subItem->Point2; + const Pointi& p1 = subItem->Line3.PtBegin; const Pointi& p2 = subItem->Line3.PtEnd; + // Result := Round(SQRT(SQR(pt2.X - pt1.X) + SQR(pt2.Y - pt1.Y))); int x = p1.x - p2.x; int y = p1.y - p2.y; RTKKM3.CrossShapeLength = std::round(std::sqrt(x*x + y*y)); - flag = true; //break; + break; } - //20240801 - if(GpsMath::IsCross(lineWF, subItem->Line1)) - { - RTKKM3.ShapeNoWheel = SNO; - flag = true; //break; - } - if(m_pub.m_SNO == SNO) //RTKKM3.LS_ShapeNo == SNO { if(GpsMath::IsCross(line, subItem->Line3)) { RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr2; //中心点右侧 RTKKM3.ShapeNo = SNO; + //RTKKM3.LS_ShapeNo = 0; m_pub.m_SNO = 0; } else if(GpsMath::IsCross(line, subItem->Line2)) { + //RTKKM3.LS_ShapeNo = 0; m_pub.m_SNO = 0; } const Pointi& p1 = RTKKM3.CrossPoint; - const Pointi& p2 = m_cg->body.b1_b; + const Pointi& p2 = m_cg->body.b1_b; //CarStatus.BasePoint1_RealTime; int x = p1.x - p2.x; int y = p1.y - p2.y; - int dis = std::round(std::sqrt(x*x + y*y)); + int dis = std::round(std::sqrt(x*x + y*y)); //TempDis = Round(SQRT(SQR(TempPt1.X - TempPt2.X) + SQR(TempPt1.Y - TempPt2.Y))); if(dis > RTKKM3.CrossShapeLength * 3) //3--6 20170924 { + //RTKKM3.LS_ShapeNo = 0; m_pub.m_SNO = 0; } } - - if(flag) - { - break; - } } else if(subName == SubNameTag2) //4个点关联 { - bool flag = false; //SubName=2,4个点关联的,比如:斑马线、公交站台 //ItemNo:6 斑马线,4个点关联 (需要减速、不能停车、夜考的时候,需要远近光灯交替) //ItemNo:53 黄色网格线(类似公交站台),禁止停车 - const Pointi& p = m_cg->body.b1_b; + const Pointi& p = m_cg->body.b1_b; // CarStatus.BasePoint1_RealTime; const TModelPolygon& poly2 = subItem->Polygon; if(GpsMath::IsIntersect(poly1, poly2) || GpsMath::IsPtInPoly(p.x, p.y, poly2.Pts)) { @@ -2421,55 +2350,32 @@ void ExamCarSub3::RTKJudge_SubItem() { RTKKM3.InShapeAttr = TRTKResult::InShapeAttr1; //0-不在形状里 1-在人行道内 2-在网格线内 RTKKM3.ShapeNo = SNO; + //RTKKM3.LS_ShapeNo = 0; } else if(itemNo == ItemNoTag53) //黄色网格线 { RTKKM3.InShapeAttr = TRTKResult::InShapeAttr2; RTKKM3.ShapeNo = SNO; + //RTKKM3.LS_ShapeNo = 0; } - flag = true; //break; - } - - //20240801 - if(GpsMath::IsIntersect(polyW, poly2) - || GpsMath::IsPtInPoly(polyW.Pts[0], poly2.Pts) - || GpsMath::IsPtInPoly(polyW.Pts[1], poly2.Pts) - || GpsMath::IsPtInPoly(polyW.Pts[2], poly2.Pts) - || GpsMath::IsPtInPoly(polyW.Pts[3], poly2.Pts)) - { - RTKKM3.ShapeNoWheel = SNO; - flag = true; //break; - } - if(flag) - { - break; + break; } } - else if(subName == SubNameTag3) //2个点关联的等待控制线 (深圳,在这个线上,处理特殊的等待业务) + else if(subName == SubNameTag3) //2个点关联的等待控制线 { RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr3; RTKKM3.ShapeNo = SNO; - RTKKM3.ShapeNoWheel = SNO; //20240801 + //RTKKM3.LS_ShapeNo = 0; break; } else if(subName == SubNameTag4) //2个点关联的路口环岛线,外面几乎用不到,用于路口项目,不能读到这个路口环岛线,否则压扣分(Mark(5,'5'); { - bool flag = false; if(GpsMath::IsLineCrossPoly(subItem->Line1, poly1)) { RTKKM3.CrossLineAttr = TRTKResult::CrossLineAttr4; RTKKM3.ShapeNo = SNO; - flag = true; //break; - } - //20240801 - if(GpsMath::IsLineCrossPoly(subItem->Line1, polyW)) - { - RTKKM3.ShapeNoWheel = SNO; - flag = true; //break; - } - if(flag) - { - break; + //RTKKM3.LS_ShapeNo = 0; + break; } } } @@ -3445,13 +3351,10 @@ void ExamCarSub3::ReadItemByPoint(int crossPointNo) const std::string& s319 = TableSysSet->get319(); //SysSet[319]: 1:必须达到里程,才能进入靠边停车 //SysSet[319]: 2:必须达到里程,并且完成必考项目。才能进入靠边停车 - if(s319 == "1") - { - if(!isMileage()) return; - } + if(s319 == "1" && m_pub.m_KsLjLc < m_car.XSJL) return; if(s319 == "2") { - if(!isMileage()) return; + if(m_pub.m_KsLjLc < m_car.XSJL) return; bool unfinished = false; for(auto it = m_sub3Items.begin(); it != m_sub3Items.end(); it++) { @@ -3474,7 +3377,6 @@ void ExamCarSub3::ReadItemByPoint(int crossPointNo) if(item->Item_Color == itemStateZk) { unfinished = true; - break; } } } @@ -3844,7 +3746,8 @@ bool ExamCarSub3::KM3AllPass() //里程不够 if(isQualified()) //当前是合格的 { - if(!isMileage()) //里程不够 + int s336 = TableSysSet->asInt336(); + if(m_pub.m_KsLjLc + s336 < m_car.XSJL) { return false; } @@ -3864,7 +3767,7 @@ bool ExamCarSub3::KM3AllPass() } //科目三项目结束,免考项目处理 //重要流程 - if(item->NoID == true) //20240731 + if(item->NoID == true) { if(item->FinishFlag == false) { @@ -4077,7 +3980,7 @@ bool ExamCarSub3::examMarkItem(int itemNo, const std::string& serial, bool once, (itemNo == Sub3ItemType04Bgcd && serial == "43") ) { if(m_cg->ai_ljjl < 500) return result; - if(isMileage()) return result; + if(m_pub.m_KsLjLc + TableSysSet->asInt336() >= m_car.XSJL) return result; } } @@ -4593,96 +4496,3 @@ bool ExamCarSub3::itemsSomeExaming2(ExamItemCode itemno) const TKM3Item* item = findExamItem(itemno); return item && (item->TestPro == ItemProFlagInit || item->TestPro == ItemProFlagJudge); } - -bool ExamCarSub3::isMileage() const -{ - return m_pub.m_KsLjLc > m_car.XSJL; -} - -void ExamCarSub3::dealOffset() -{ - m_pub.m_KsLjLc = m_cg->ai_ljjl; - m_cg->tkCnt = GetCurrentTick2(); - m_cg->RTKKM3.CrossPointNo = lastCrossPtNo(); - - int s336 = TableSysSet->asInt336(); - if(m_disOffset == false && s336 > 0 && m_pub.m_KsLjLc + s336 >= m_car.XSJL) - { - m_disOffset = true; - m_disForward += (s336*100); //基础里程设置补偿 - m_cg->ai_ljjl_cm = m_disForward; - m_cg->ai_ljjl = m_disForward/100.0; - m_pub.m_KsLjLc = m_cg->ai_ljjl; - } -} - -void ExamCarSub3::dealItemNoIDEndItem() -{ - if(isMileage()) - { - for(auto it = m_sub3Items.begin(); it != m_sub3Items.end(); it++) - { - TKM3Item* item = it->second->getExamItem(); - if(item->NoID == true && item->ItemNo != Sub3ItemType14Jjdw) //20240731 - { - if(item->FinishFlag == false) - { - KM3EndItem(item->ItemNo); - } - } - } - } -} - -void ExamCarSub3::dealItemNoIDEnd14Jjdw() -{ - TKM3Item* item14 = findExamItem(Sub3ItemType14Jjdw); //20240731 - if(item14 && item14->NoID == true) //免考加减挡的 即:全程加减档 - { - if(item14->Item_Color == itemStateWk) - { - TTestCtl* ctl = getTTestCtl(); - if(ctl->dw_kf_sj == 1) //301 第3个^参数 1:达到行驶里程 非1靠边停车开始前 - { - if(isMileage()) - { - //ToDo1:生成 全程加减挡 进项目事件 - //createEventEnterItem({item14->ItemNo, ""}); - KM3EndItem(item14->ItemNo); - } - } - else - { - TKM3Item* item = findExamItem(Sub3ItemType11Kbtc); - if(item && item->TestPro == ItemProFlagInit) - { - //ToDo1:生成 全程加减挡 进项目事件 - //createEventEnterItem({item14->ItemNo, ""}); - KM3EndItem(item14->ItemNo); - } - } - } - } -} - -DriveDirType ExamCarSub3::driveDirection(const TModelLine* lane) -{ - //ptBegin 车道线起始点 - //ptEnd 车道线起终点点 - //double angle1 = GpsMath::getAngle(lane->PtBegin, lane->PtEnd); - //double angle2 = GpsMath::getAngle(m_cg->body.points_b[II(13)], m_cg->body.points_b[II(1)]); - double a1 = GpsMath::GetAngle_HQ(lane->PtBegin, lane->PtEnd, -1); - double a2 = GpsMath::GetAngle_HQ(m_cg->body.points_b[II(13)], m_cg->body.points_b[II(1)], -1); - - DriveDirType dir = DriveDirX; - int angle = ((int)std::round(a1 - a2) + 360) % 360; - if(angle < 60 || angle > 300) - { - dir = DriveDirY; - } - else if(angle < 240 && angle > 120) - { - dir = DriveDirN; - } - return dir; -} diff --git a/entry/src/main/cpp/sdk/exam/ExamCarSub3.h b/entry/src/main/cpp/sdk/exam/ExamCarSub3.h index 924cc3a3..b96a6e99 100644 --- a/entry/src/main/cpp/sdk/exam/ExamCarSub3.h +++ b/entry/src/main/cpp/sdk/exam/ExamCarSub3.h @@ -49,9 +49,6 @@ public: //for IExamCarSub3 override virtual bool isExamAlready(ExamItemCode ItemNo) const override { return m_ctl.PassedItem.find(ItemNo) != m_ctl.PassedItem.end();}; - virtual bool isMileage() const override; - - virtual TCar* getTCar() override { return &m_car; } virtual TTestCtl* getTTestCtl() override { return &m_ctl; } @@ -76,14 +73,6 @@ public: //for IExamCarSub3 override virtual bool getyjdg_road_code_kf() const override { return m_pub.yjdg_road_code_kf; } protected: - void dealOffset(); //行驶距离补偿 - - void dealItemNoIDEndItem(); - void dealItemNoIDEnd14Jjdw(); - - //行驶方向,1正向行驶,-1逆向行驶 - DriveDirType driveDirection(const TModelLine* lane); - bool Init_KM3_Global(std::string& sError); void UpdateCarParmWithSystemParm(); bool Init_KM3_Special(); @@ -171,7 +160,6 @@ private: int E_1Deg2Cm = 0; //经度1度=多少厘米 const int N_1Deg2Cm = 11110792; //北纬1度=X cm - bool m_disOffset = false; //TCarStatus m_carStatus; //int64 m_ContinuedStartTime = 0; //续考的上次开始考试时间 20150205 diff --git a/entry/src/main/cpp/sdk/exam/ExamSensor.cpp b/entry/src/main/cpp/sdk/exam/ExamSensor.cpp index 6639c599..a1f50659 100644 --- a/entry/src/main/cpp/sdk/exam/ExamSensor.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamSensor.cpp @@ -175,15 +175,6 @@ bool ExamSensor::convertDatas(TChuanGan* cg) TGpsInfo& gps = cg->real.gps; gps.errorFlag = true; - - //测试是否逆向行驶 - //static int s_count = 0; - //int ny = s_count++ % 10; - //if(ny < 5) - //{ - // gps.hxj += 180.0; - //} - //航向角(默认是按诺瓦泰的数据格式定义的,所以要加上180度) 1:天宝(北云)/C1 2:诺瓦泰 if(gps.bklx == boardTypeTB) { @@ -299,16 +290,15 @@ bool ExamSensor::calcCarBody(TChuanGan* cg) int x = 0, y = 0; GpsMath::calcEastAndNorthDistanceCM(m_basePoint, ps[II(33)], m_basePoint.gc, x, y); - TGpsInfo& gps = cg->real.gps; - if(gps.rtkEnabled && gps.jd > 1 && gps.wd > 1) + if(cg->real.gps.rtkEnabled) { - gps.ai_gps = Pointi(x, y); + cg->real.gps.ai_gps = Pointi(x, y); } else { if(m_car->historyCount() > 0) { - gps.ai_gps = m_car->historyAiGps(); //20240702 yhy + cg->real.gps.ai_gps = m_car->historyAiGps(); //20240702 yhy //return false; //这里不能返回false 第一帧数据就是非差分状态?如果做模拟灯光的时候一直没差分进不了项目了 } } diff --git a/entry/src/main/cpp/sdk/exam/ExamService.cpp b/entry/src/main/cpp/sdk/exam/ExamService.cpp index 3b17cfd1..4e58164b 100644 --- a/entry/src/main/cpp/sdk/exam/ExamService.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamService.cpp @@ -45,8 +45,7 @@ int ExamService::examJudgeInit(const char* data, int len) //logdebug("MemorySpace [spaceTotal=%lld MB] [spaceFree=%lld MB], [spaceAvailable=%lld MB], [spaceSelf=%lld MB]", // space.spaceTotal, space.spaceFree, space.spaceAvailable, space.spaceSelf); - //logdebug("call examJudgeInit."); - logtrace("exam-init version=%s.", JUDGE_VERSION_INFO); + logdebug("call examJudgeInit."); if(m_init) { //已经初始化过了,不能重复初始化 @@ -106,7 +105,7 @@ int ExamService::examJudgeInit(const char* data, int len) return QE(code); } m_init = true; - logtrace("exam-init success kchp=%s,kchm=%d,kscx=%s.", m_initInfo->kchp.c_str(), m_initInfo->kchm, m_initInfo->kscx.c_str()); + loginfo("exam-init success version=%s.", JUDGE_VERSION_INFO); return QE(codeSuccess); } diff --git a/entry/src/main/cpp/sdk/exam/IExamCar.cpp b/entry/src/main/cpp/sdk/exam/IExamCar.cpp index 9176dc27..99718481 100644 --- a/entry/src/main/cpp/sdk/exam/IExamCar.cpp +++ b/entry/src/main/cpp/sdk/exam/IExamCar.cpp @@ -43,7 +43,6 @@ int IExamCar::examJudgeBeginExam(const char* data, int len) { HELP_COST_TIME(""); IAutoLock(m_mtx); - logtrace("begin-exam version=%s", JUDGE_VERSION_INFO); if(m_examState != examStateEnd) { logerror("error begin exam not end."); @@ -490,17 +489,17 @@ void IExamCar::doExamDatagram(Package* pkg) } -int IExamCar::calcDistance() +void IExamCar::calcDistance() { if(m_history->size() <= 1) { - return 0; + return; } const Pointi& h = historyAiGps(1); const Pointi& c = historyAiGps(); if( (c.x == 0 && c.y == 0) || (h.x == 0 && h.y == 0) ) { - return 0; + return; } double x = h.x - c.x; double y = h.y - c.y; @@ -518,12 +517,11 @@ int IExamCar::calcDistance() if(m_cg->move == moveForward) { - int gear = m_cg->real.sensor.dw; //只有科三用到 + int gear = m_cg->real.sensor.dw; m_disGears[gear] += a; } //logdebug("move=%d,dis=%dCM", state, a); - return a; } int64 IExamCar::GetCurrentTime2() const diff --git a/entry/src/main/cpp/sdk/exam/IExamCar.h b/entry/src/main/cpp/sdk/exam/IExamCar.h index 6b24df0f..5cf63449 100644 --- a/entry/src/main/cpp/sdk/exam/IExamCar.h +++ b/entry/src/main/cpp/sdk/exam/IExamCar.h @@ -127,7 +127,7 @@ public: //执行处理每一帧的GPS传感数据 virtual void doExamDatagram(Package* pkg); //前进 后退 距离计算 - virtual int calcDistance(); + virtual void calcDistance(); //当前系统时间(回放取的事GPS时间) virtual int64 GetCurrentTime2() const; @@ -219,8 +219,6 @@ public: virtual bool itemsSomeExaming2(ExamItemCode itemno) const = 0; //是否已考 virtual bool isExamAlready(ExamItemCode ItemNo) const = 0; - //里程是否满足 - virtual bool isMileage() const = 0; //获取TCar diff --git a/entry/src/main/cpp/sdk/graphic/GraphicImage.h b/entry/src/main/cpp/sdk/graphic/GraphicImage.h index 33a579c2..ebb1ae16 100644 --- a/entry/src/main/cpp/sdk/graphic/GraphicImage.h +++ b/entry/src/main/cpp/sdk/graphic/GraphicImage.h @@ -70,7 +70,7 @@ private: const int m_channel = 4; const unsigned char m_default = 255; //默认底色 白色 bool m_showVersion = true; - bool m_showTime = true; + bool m_showTime = false; }; diff --git a/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.cpp b/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.cpp index 6799163b..c967a8b9 100644 --- a/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.cpp +++ b/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.cpp @@ -33,40 +33,6 @@ void Sub2Judge00Dcrk::dealDrawItem() drawGpsSign(m_model->F8(), "F8", false); drawGpsSign(m_model->F9(), "F9", false); -#ifdef JUDGE_USE_NICE - - if(pureCarPointInItemArea(II(33))) - { - TChuanGan* cg = m_car->historyChuanGan(); - nice(cg->body.b1_a, cg->body.b2_a, RGB_RED); - nice(cg->body.points_a[II(8)], cg->body.points_a[II(18)], RGB_RED); - - TGPSPoint z1 = GpsMath::GetChuiZhu(cg->body.b1_a, cg->body.points_a[II(6)], cg->body.points_a[II(8)]); - nice(cg->body.b1_a, z1, RGB_PURPLE); - - TGPSPoint z2 = GpsMath::GetChuiZhu(cg->body.points_a[II(25)], m_model->P3(),m_model->P4()); - nice(cg->body.points_a[II(25)], z2, RGB_RED); - - TGPSPoint z3 = GpsMath::GetChuiZhu(cg->body.points_a[II(27)], m_model->P3(),m_model->P4()); - nice(cg->body.points_a[II(27)], z3, RGB_RED); - - nice(cg->body.points_a[II(1)], cg->body.points_a[II(13)], RGB_GREEN); - TGPSPoint z4 = GpsMath::GetChuiZhu(cg->body.points_a[II(13)], m_model->P4(), m_model->P5()); - nice(cg->body.points_a[II(13)], z4, RGB_RED); - } - -#endif - -} - -void Sub2Judge00Dcrk::nice(const TGPSPoint& p1, const TGPSPoint& p2, const RgbColor& color) -{ - int cm = GpsMath::calcGpsDistanceCM(p1,p2); - TGPSPoint c = GpsMath::calcCenterPoint(p1,p2); - char buf[32] = {0}; - SafeSprintf(buf, sizeof(buf), "%dcm", cm); - drawGpsLine(p1, p2, false, color, 16); - drawGpsText(c, buf, color, 16); } void Sub2Judge00Dcrk::dealJudgeItem() diff --git a/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.h b/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.h index 8fa604ae..d3cc4d5a 100644 --- a/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.h +++ b/entry/src/main/cpp/sdk/judge/sub2/Sub2Judge00Dcrk.h @@ -38,8 +38,6 @@ private: //判断考试用时是否超时 bool examTimeout(); - void nice(const TGPSPoint& p1, const TGPSPoint& p2, const RgbColor& color); - private: enum{L1=1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11}; int64 m_dcrkTime = 0; //开始时间(从倒库开始计时) diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp index 1c0e79e4..9bcda5fe 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp @@ -38,7 +38,7 @@ bool Sub3Judge01Sczb::dealJudgeEnter() const std::vector& s512 = TableSysSet->asArray512(); std::string Temp512_9 = s512.size() > 8 && s512[8] != "" ? s512[8].c_str() : ""; - const std::vector s512_9 = Tools::split(Temp512_9, "^"); + const std::vector& s512_9 = Tools::split(Temp512_9, "^"); m_itemv.newtype = s512_9.size() > 0 && s512_9[0] != "" ? std::atoi(s512_9[0].c_str()) : 0; m_itemv.time_tishi = s512_9.size() > 1 && s512_9[1] != "" ? std::atoi(s512_9[1].c_str()) : 0; m_itemv.time_raoche = s512_9.size() > 2 && s512_9[2] != "" ? std::atoi(s512_9[2].c_str()) : 0; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp index e611a271..470556b6 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp @@ -20,7 +20,7 @@ bool Sub3Judge02Qbxx::dealJudgeEnter() //10s内未起步只评判第一次^第一次起步以打左方向灯开始计时^ const std::vector& s502 = TableSysSet->asArray502(); std::string str = s502.size() > 7 ? s502[7] : ""; - const std::vector ss = Tools::split(str, "^"); + const std::vector& ss = Tools::split(str, "^"); m_itemv.sys502_8_1 = ss.size() > 0 && ss[0] != "" ? std::atoi(ss[0].c_str()) : 0; m_itemv.sys502_8_2 = ss.size() > 1 && ss[1] != "" ? std::atoi(ss[1].c_str()) : 0; //StrToIntDef(GetDotStr(2, tempstr + '^', '^'), 0); diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp index f04e4427..e829813f 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp @@ -712,8 +712,8 @@ void Sub3Judge11Kbtc::DoStatus_3() //特殊地点业务翻译 TTestCtl* ctl = m_car->getTTestCtl(); - const std::vector& s301 = TableSysSet->asArray301(); - const std::vector s301_1 = s301.size() > 0 ? Tools::split(s301[0], ",") : std::vector(); + const std::vector>& s301 = TableSysSet->asArray2_301(); + const std::vector& s301_1 = s301.size() > 0 ? s301[0] : std::vector(); const std::string s301_1_3 = s301_1.size() > 3 && s301_1[3] != "" ? s301_1[3] : ""; if(!ctl->Dw_Cs_Ok1 && s301_1_3 != "0" && ctl->dw_kf_sj == 0 && ksdd == siteof::zjwz) { @@ -1295,24 +1295,24 @@ void Sub3Judge11Kbtc::Judge_KBTC_YaXian() const std::string& s411 = TableSysSet->get411(); if(s411 != "1") { - RightJL0_RF = RTKKM3_0.Body_RF_ToBaseLine; - RightJL1_RF = RTKKM3_1.Body_RF_ToBaseLine; - RightJL2_RF = RTKKM3_2.Body_RF_ToBaseLine; + RightJL0_RF = RTKKM3_0.Body_RF_ToRightEdge; + RightJL1_RF = RTKKM3_1.Body_RF_ToRightEdge; + RightJL2_RF = RTKKM3_2.Body_RF_ToRightEdge; - RightJL0_RB = RTKKM3_0.Body_RB_ToBaseLine; - RightJL1_RB = RTKKM3_1.Body_RB_ToBaseLine; - RightJL2_RB = RTKKM3_2.Body_RB_ToBaseLine; + RightJL0_RB = RTKKM3_0.Body_RB_ToRightEdge; + RightJL1_RB = RTKKM3_1.Body_RB_ToRightEdge; + RightJL2_RB = RTKKM3_2.Body_RB_ToRightEdge; } else { - RightJL0_RF = RTKKM3_0.Wheel_RF_ToBaseLine; - RightJL1_RF = RTKKM3_1.Wheel_RF_ToBaseLine; - RightJL2_RF = RTKKM3_2.Wheel_RF_ToBaseLine; + RightJL0_RF = RTKKM3_0.Wheel_RF_ToRightEdge; + RightJL1_RF = RTKKM3_1.Wheel_RF_ToRightEdge; + RightJL2_RF = RTKKM3_2.Wheel_RF_ToRightEdge; - RightJL0_RB = RTKKM3_0.Wheel_RB_ToBaseLine; - RightJL1_RB = RTKKM3_1.Wheel_RB_ToBaseLine; - RightJL2_RB = RTKKM3_2.Wheel_RB_ToBaseLine; + RightJL0_RB = RTKKM3_0.Wheel_RB_ToRightEdge; + RightJL1_RB = RTKKM3_1.Wheel_RB_ToRightEdge; + RightJL2_RB = RTKKM3_2.Wheel_RB_ToRightEdge; } //ZXD_JL0 := (RightJL0_RF + RightJL0_RB) div 2; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp index 3c0de3d7..36b83a91 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp @@ -256,7 +256,7 @@ void Sub3Judge14Jjdw::CSH_Itmv14() std::string str2 = Str.size() > 1 ? Str[1] : ""; //GetDotStr(2, Str + ':', ':'); int dw = std::atoi(str1.c_str()); - const std::vector stmp = Tools::split(str2, "-"); + const std::vector& stmp = Tools::split(str2, "-"); m_itemv.DwCs_Range[dw].Low_Cs = stmp.size() > 0 ? std::atoi(stmp[0].c_str()) : 0; m_itemv.DwCs_Range[dw].High_Cs = stmp.size() > 1 ? std::atoi(stmp[1].c_str()) : 0; } diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp index ab1531ba..b4de8cc7 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp @@ -159,21 +159,22 @@ void Sub3Judge20Comm::Init_ZongHe() //自动靠边停车参数 //SysSet[319]:里程不够不报靠边停车(0-否 1-是 2-必考项目完成,并且里程满足要求) //SysSet[415]:自动报靠边停车(启用标记^全部结束n米报^)启用标记:0-否 1-是 319参数为2有效 + const std::string& s319 = TableSysSet->get319(); if(s319 == "2") { const std::vector& s415 = TableSysSet->asArray415(); m_itemvCJH.bZdKbTc = s415.size() > 0 && s415[0] == "1"; //getdotstr(1, sysset[415] + '^', '^') = '1'); - m_itemvCJH.ZdKbTcJl = s415.size() > 1 && s415[1] != "" ? std::atoi(s415[1].c_str()) : 1; //strtointdef(getdotstr(2, sysset[415] + '^', '^'), 1); + m_itemvCJH.ZdKbTcJl = s415.size() > 1 && s415[1] != "" ? std::atoi(s415[1].c_str()) : 1; //strtointdef(getdotstr(2, sysset[415] + '^', '^'), 1); m_itemvCJH.KbTcJl = -1; } else { m_itemvCJH.bZdKbTc = false; m_itemvCJH.ZdKbTcJl = 1; - m_itemvCJH.KbTcJl = -1; } //溜车变量初始化 + //SysSet[529]:模拟灯光是否需要人脸验证 //说明:这个参数目前我没有实际的用到 m_sfyz_state = 0; @@ -212,7 +213,7 @@ void Sub3Judge20Comm::Init_ZongHe() if(str2 == "") continue; int dw = std::atoi(str1.c_str()); - const std::vector stmp = Tools::split(str2, "-"); + const std::vector& stmp = Tools::split(str2, "-"); itemv14->DwCs_Range[dw].Low_Cs = stmp.size() > 0 ? std::atoi(stmp[0].c_str()) : 0; itemv14->DwCs_Range[dw].High_Cs = stmp.size() > 1 ? std::atoi(stmp[1].c_str()) : 100; } @@ -242,7 +243,7 @@ void Sub3Judge20Comm::Init_ZongHe() //评判半联动用的,比如:前进状态下,离合器连续30秒 const std::vector& s500 = TableSysSet->asArray500(); std::string s500_1 = s500.size() > 0 ? s500[0] : ""; - const std::vector ss500_1 = Tools::split(s500_1, "^"); + const std::vector& ss500_1 = Tools::split(s500_1, "^"); m_itemvCJH.lhqxs = ss500_1.size() > 0 && ss500_1[0] != "" ? std::atoi(ss500_1[0].c_str()) : 30; //离合器距离 @@ -259,14 +260,14 @@ void Sub3Judge20Comm::Init_ZongHe() m_itemvCJH.DWKF_SJ = (s500.size() > 3 && s500[3] != "" ? std::atoi(s500[3].c_str()) : 20) * SECOND; //加速发动机转速阀值^加速发动机变化倍数^ std::string Str = s500.size() > 4 && s500[4] != "" ? s500[4] : ""; - const std::vector s500_4 = Tools::split(Str, "^"); + const std::vector& s500_4 = Tools::split(Str, "^"); m_itemvCJH.KongYouMen_FDJ_YZ = s500_4.size() > 0 && s500_4[0] != "" ? std::atoi(s500_4[0].c_str()) : 3000; //变化倍数 m_itemvCJH.KonbYouMen_FDJ_BS = s500_4.size() > 1 && s500_4[1] != "" ? std::atoi(s500_4[1].c_str()) : 3; //转向灯不关闭距离^项目结束后不关闭时间 Str = s500.size() > 5 && s500[5] != "" ? s500[5] : ""; - const std::vector s500_5 = Tools::split(Str, "^"); + const std::vector& s500_5 = Tools::split(Str, "^"); m_itemvCJH.ZXD_BGB_JL = s500_5.size() > 0 && s500_5[0] != "" ? std::atoi(s500_5[0].c_str()) : 3000; m_itemvCJH.ZXD_BGB_SJ = s500_5.size() > 1 && s500_5[1] != "" ? std::atoi(s500_5[1].c_str()) : 0; @@ -340,8 +341,8 @@ void Sub3Judge20Comm::Init_ZongHe() //条件1:档位,车速,持续时间,结束标志(0-不结束,1红闪,2黑闪),距离,^ //条件2:档位,车速,持续时间,0,距离,^评判时间(0-最后评判,1-里程达到就评判)^ - const std::vector& s301 = TableSysSet->asArray301(); - const std::vector s301_1 = s301.size() > 0 ? Tools::split(s301[0], ",") : std::vector(); + const std::vector>& s301 = TableSysSet->asArray2_301(); + const std::vector& s301_1 = s301.size() > 0 ? s301[0] : std::vector(); if(!s301_1.empty()) { m_itemvCJH.dw_cs_dw1 = s301_1.size() > 0 && s301_1[0] != "" ? std::atoi(s301_1[0].c_str()) : 1; @@ -357,7 +358,7 @@ void Sub3Judge20Comm::Init_ZongHe() m_itemvCJH.dw_cs_sl1 = 0; } - const std::vector& s301_2 = s301.size() > 1 ? Tools::split(s301[1], ",") : std::vector(); + const std::vector& s301_2 = s301.size() > 1 ? s301[1] : std::vector(); if(!s301_2.empty()) { m_itemvCJH.dw_cs_dw2 = s301_2.size() > 0 && s301_2[0] != "" ? std::atoi(s301_2[0].c_str()) : 1; @@ -374,9 +375,9 @@ void Sub3Judge20Comm::Init_ZongHe() m_itemvCJH.dw_cs_sl2 = 0; } - std::string s301_3 = s301.size() > 2 ? s301[2] : ""; + std::vector s301_3 = s301.size() > 2 ? s301[2] : std::vector(); //301评判时间,0-结束考试时评判,1-里程达标就评判 100-表示已评判过 20140630 //yhyflag - ctl->dw_kf_sj = s301_3 != "" ? std::atoi(s301_3.c_str()) : 0; // StrToIntdef(GetDotStr(3, Sysset[301] + '^', '^'), 1); + ctl->dw_kf_sj = s301_3.size() > 0 && s301_3[0] != "" ? std::atoi(s301_3[0].c_str()) : 1; // StrToIntdef(GetDotStr(3, Sysset[301] + '^', '^'), 1); //SysSet[530]:环境感知相关参数(原封不动翻译即可,前期用不到,赞不考虑) const std::vector& s530 = TableSysSet->asArray530(); @@ -384,7 +385,7 @@ void Sub3Judge20Comm::Init_ZongHe() m_itemvCJH.sslkfxp_sj = s530.size() > 0 && s530[0] != "" ? std::atoi(s530[0].c_str()) : 15; //StrToIntdef(GetDotStr(1, Sysset[530] + '^', '^'), 15); //单手离开方向盘时间秒,右边距离偏差cm const std::string& ss530 = s530.size() > 1 && s530[1] != "" ? s530[1] : ""; - const std::vector s530_2 = Tools::split(ss530, ","); + const std::vector& s530_2 = Tools::split(ss530, ","); m_itemvCJH.dslkfxp_sj = s530_2.size() > 0 && s530_2[0] != "" ? std::atoi(s530_2[0].c_str()) : 60; m_itemvCJH.dslkfxp_jlpc = s530_2.size() > 1 && s530_2[1] != "" ? std::atoi(s530_2[1].c_str()) : 30; @@ -566,7 +567,7 @@ void Sub3Judge20Comm::Init_ZongHe() std::string str2 = s394i.size() > 1 ? s394i[1] : ""; //GetDotStr(2, Str + ':', ':'); int dw = std::atoi(str1.c_str()); - const std::vector stmp = Tools::split(str2, "-"); + const std::vector& stmp = Tools::split(str2, "-"); m_itemvCJH.DwCs_Range[dw].Low_Cs = stmp.size() > 0 ? std::atoi(stmp[0].c_str()) : 0; m_itemvCJH.DwCs_Range[dw].High_Cs = stmp.size() > 1 ? std::atoi(stmp[1].c_str()) : 0; } @@ -2463,7 +2464,7 @@ void Sub3Judge20Comm::Judge_LianXuBianDao() //获取连续变道超车参数 std::string Temp = s512.size() > 1 && s512[1] != "" ? s512[1] : ""; - const std::vector ss = Tools::split(Temp, "^"); + const std::vector& ss = Tools::split(Temp, "^"); //0:abc 1:aba和abc都判 ctl->LianXuBianDaoKind = ss.size() > 0 && ss[0] != "" ? std::atoi(ss[0].c_str()) : 0; @@ -4601,11 +4602,8 @@ void Sub3Judge20Comm::Judge_DangWei_CS_ZS() const TChuanGan* his6 = m_car->historyChuanGan(6); //旧规则评判 int TempCS = std::round(gps.sd); - - const std::vector& s507 = TableSysSet->asArray507(); - std::string lhq = s507.size() > 9 ? s507[9] : ""; //507第10个参数 设置为1不管踩没踩离合器都判,否则踩离合器不判 /////////////////////////////////////////////////////////////////////////// - if((lhq != "1" && sor.lhq == SYES) || Tools::less(std::round(gps.sd), 5) || + if(sor.lhq == SYES || Tools::less(std::round(gps.sd), 5) || (ksdd != siteof::nj && (cg->move != moveForward || his1->move != moveForward || his2->move != moveForward || his3->move != moveForward || his4->move != moveForward || his5->move != moveForward || his6->move != moveForward))) @@ -4801,27 +4799,7 @@ void Sub3Judge20Comm::Judge_DangWei_CS_ZS() //24、全程次高挡评判 void Sub3Judge20Comm::Judge_CiGaoDang() { - //按照军华说的 在行驶距离达到的实际判断全程次高档 20240731 - //301 第3个^参数 1:达到行驶里程 非1靠边停车开始前 20240805 - bool timing = false; //次高档时机 - TTestCtl* ctl = m_car->getTTestCtl(); - if(ctl->dw_kf_sj == 1) //301 第3个^参数 1:达到行驶里程 非1靠边停车开始前 - { - if(m_car->isMileage()) - { - timing = true; - } - } - else - { - TKM3Item* item = m_car->findExamItem(Sub3ItemType11Kbtc); - if(item && item->TestPro == ItemProFlagInit) - { - timing = true; - } - } - - if(timing) + if(m_car->allItemFinish() && m_car->isQualified()) //全程次高挡评判 KM3AllPass() { if(m_itemvXLG.CGD_Nums == 0) { @@ -4837,43 +4815,79 @@ void Sub3Judge20Comm::Judge_CiGaoDang() //25、自动靠边停车(重点) void Sub3Judge20Comm::Call_Auto_KBTC() { - //SysSet[319]:里程不够不报靠边停车(0-否 1-是 2-必考项目完成,并且里程满足要求) - //SysSet[415]:自动报靠边停车(启用标记^全部结束n米报^)启用标记:0-否 1-是 319参数为2有效 const std::string& s319 = TableSysSet->get319(); + TCar* tcar = m_car->getTCar(); + const std::map& all = m_car->allExamItem(); //自动靠边停车 - if(s319 == "1") + if(s319 == "1" && m_car->getKsLjLc() < tcar->XSJL) { - if(!m_car->isMileage()) return; + return; } if(s319 == "2") { - if(!m_car->isMileage()) return; - - //自动靠边停车计算 - //自动靠边停车 - if(m_itemvCJH.bZdKbTc) + if(m_car->getKsLjLc() < tcar->XSJL) return; + bool ErrorFlag = false; + for(auto it = all.begin(); it != all.end(); it++) { - const std::map& all = m_car->allExamItem(); - //必考项目未完成 - for(auto it = all.begin(); it != all.end(); it++) + TKM3Item* item = it->second->getExamItem(); + if(item->NoID == true) { - TKM3Item* item = it->second->getExamItem(); - if(item->ItemNo == Sub3ItemType11Kbtc) + if(item->FinishFlag == false) { - if(item->Item_Color != itemStateWk) - { - return; - } - } - else - { - if(item->NoID == false && (item->Item_Color == itemStateWk || item->Item_Color == itemStateZk)) - { - return; - } + m_car->KM3EndItem(item->ItemNo); + ErrorFlag = true; } } + } + + if(ErrorFlag == true) + { + return; + } + + for(auto it = all.begin(); it != all.end(); it++) + { + TKM3Item* item = it->second->getExamItem(); + if(item->ItemNo == Sub3ItemType11Kbtc) continue; + if(item->FinishFlag == false) + { + return; + } + } + + } + //自动靠边停车计算 + //自动靠边停车 + if(m_itemvCJH.bZdKbTc) + { + //必考项目未完成 + for(auto it = all.begin(); it != all.end(); it++) + { + TKM3Item* item = it->second->getExamItem(); + if(item->ItemNo == Sub3ItemType11Kbtc) + { + if(item->Item_Color != itemStateWk) + { + return; + } + } + else + { + if(item->NoID == false && (item->Item_Color == itemStateWk || item->Item_Color == itemStateZk)) + { + return; + } + } + } + + //SysSet[319]:里程不够不报靠边停车(0-否 1-是 2-必考项目完成,并且里程满足要求) + //SysSet[415]:自动报靠边停车(启用标记^全部结束n米报^)启用标记:0-否 1-是 319参数为2有效 + const std::string& s319 = TableSysSet->get319(); + const std::string& ksdd = TableSysSet->get211(); + if(s319 == "2") + { const TChuanGan* cg = m_car->historyChuanGan(); + if(m_itemvCJH.KbTcJl == -1) { m_itemvCJH.KbTcJl = cg->ai_ljjl; @@ -4881,7 +4895,6 @@ void Sub3Judge20Comm::Call_Auto_KBTC() if(cg->ai_ljjl - m_itemvCJH.KbTcJl >= m_itemvCJH.ZdKbTcJl) { //20171008 - const std::string& ksdd = TableSysSet->get211(); if(ksdd == siteof::changzhoukm3) { if(cg->RTKKM3.BaseLaneCount > 0) @@ -4939,7 +4952,6 @@ void Sub3Judge20Comm::Judge_Extra() //m_car->createEventEnterItem({item13->ItemNo, ""}); } - /* //自动触发加减挡位 bool FindSCZB = false; bool FindMNDG = false; @@ -4978,18 +4990,21 @@ void Sub3Judge20Comm::Judge_Extra() if((SCZBFinishFlag == true || FindSCZB == false) && (MNDGFinishFlag == true || FindMNDG == false)) { - TKM3Item* item14 = m_car->findExamItem(Sub3ItemType14Jjdw); //20240731 + TKM3Item* item14 = m_car->findExamItem(Sub3ItemType14Jjdw); if(item14 && item14->NoID == true) //免考加减挡的 { if(item14->Item_Color == itemStateWk) { //ToDo1:生成 全程加减挡 进项目事件 + //item14->Item_Color = itemStateZk; + //item14->TestPro = ItemProFlagInit; + //item14->FinishFlag = false; + m_car->createEventEnterItem({item14->ItemNo, ""}); m_car->KM3EndItem(item14->ItemNo); } } } - */ m_DiaoTou_ID = 0; std::string CurrentRoadData = cg->MapPoint_Road_Code; diff --git a/entry/src/main/cpp/sdk/utility/GpsMath.cpp b/entry/src/main/cpp/sdk/utility/GpsMath.cpp index 960e607e..32bc8171 100644 --- a/entry/src/main/cpp/sdk/utility/GpsMath.cpp +++ b/entry/src/main/cpp/sdk/utility/GpsMath.cpp @@ -566,59 +566,27 @@ inline void GpsMath::getDimensionalCoordinate(const double& E1, const double& N1 ///以下是科目三的函数 2024-01-12 /////////////////////////////////////////////////// -/* -double GpsMath::getAngle(const Pointi& p1, const Pointi& p2) -{ - double angle = 0; - //修改坐标系 - if(p1.x == p2.x) - { - if(p1.y < p2.y) - { - angle = PI / 2; - } - else if(p1.y >= p2.y) - { - angle = PI * 3 / 2; - } - } - else - { - angle = std::atan2(p2.y - p1.y, p2.x - p1.x); - } - - if(angle < 0) - { - angle = angle + 2 * PI; - } - angle = angle / PI * 180; - return angle; -} -*/ - //1、获得点1指向点2的角度0-360度,该角度是X轴正方向顺时针旋转到有向线段(由点1指向点2所确定)的角度,例如:正东=0度,正北=270 double GpsMath::GetAngle_HQ(const Pointi& p1, const Pointi& p2, int MinusY) { - double angle = 0; + int result = 0; if(p1.x == p2.x) { if(p1.y * MinusY < p2.y * MinusY) - angle = PI * 3 / 2; + result = PI * 3 / 2; else if (p1.y * MinusY > p2.y * MinusY) - angle = PI / 2; + result = PI / 2; else - angle = 0; + result = 0; } else - { - angle = std::atan2(p1.y * MinusY - p2.y * MinusY, p2.x - p1.x); - } + result = std::atan2(p1.y * MinusY - p2.y * MinusY, p2.x - p1.x); //???yhyflag - if(angle < 0) - angle = angle + 2 * PI; + if(result < 0) + result = result + 2 * PI; - angle = angle / PI * 180; - return angle; + result = result / PI * 180; + return result; } diff --git a/entry/src/main/cpp/sdk/utility/GpsMath.h b/entry/src/main/cpp/sdk/utility/GpsMath.h index 374d77b3..c4e73478 100644 --- a/entry/src/main/cpp/sdk/utility/GpsMath.h +++ b/entry/src/main/cpp/sdk/utility/GpsMath.h @@ -137,10 +137,7 @@ private: public: //科目三 - //计算角度 逆时针 - //static double getAngle(const Pointi& point1, const Pointi& point2); //1、获得点1指向点2的角度0-360度,该角度是X轴正方向顺时针旋转到有向线段(由点1指向点2所确定)的角度,例如:正东=0度,正北=270 - //MinusY= 1顺时针, -1逆时针 static double GetAngle_HQ(const Pointi& p1, const Pointi& p2, int MinusY = 1); //计算两点距离 static int PointDistance(const Pointi& p1, const Pointi& p2); diff --git a/entry/src/main/cpp/sdk/utility/HBean.h b/entry/src/main/cpp/sdk/utility/HBean.h index 8b292ab1..88d5683b 100644 --- a/entry/src/main/cpp/sdk/utility/HBean.h +++ b/entry/src/main/cpp/sdk/utility/HBean.h @@ -148,14 +148,6 @@ enum PlaySoundType PlaySoundEndNotify = 1, //1:表示是模拟灯光项目的语音,语音播报结束需要调用examJudgeSoundEnd通知评判。 }; -//行驶方向,***注意:枚举不能变,和外壳有对应关系 -enum DriveDirType -{ - DriveDirN = -1, //-1:逆向行驶 - DriveDirX = 0, //0:未知 - DriveDirY = 1, //1:正向行驶 -}; - //Tag1=0-无标线 //Tag1=1-中心线(黄色实线) diff --git a/entry/src/main/cpp/sdk/utility/HTypes.h b/entry/src/main/cpp/sdk/utility/HTypes.h index 489a5d83..79606121 100644 --- a/entry/src/main/cpp/sdk/utility/HTypes.h +++ b/entry/src/main/cpp/sdk/utility/HTypes.h @@ -334,7 +334,7 @@ struct TStuInfo int64 ddkssj = 0; //考试中断那次考试开始考试时间 1970年到现在的毫秒数 std::vector ykxm = {}; //已考项目 "1,3" 对应枚举 ExamItemCode DuanDian_FinishItems std::vector kfxm = {}; //扣分项目 "20,01;" 对应枚举 ExamItemCode DuanDian_Marks - int32 yklc = 0; //已考里程,单位厘米 + int32 yklc = 0; //已考里程,单位米 int8 sczb = 0; //CS_Finish_SCZB_Flag:Boolan; //yhy22 初始完成上车准备标志(外壳传递的)Boolan std::vector sczbkf = {}; //SCZBKouFenData:String[200]; //格式: ItemNo,MarkSerial; ItemNo,MarkSerial; @@ -850,14 +850,15 @@ struct TRTKResult int CrossPointNo = 0; //穿越点 - //20240801 新增 还没计算 - int TouchLineDirCS = TouchDir0; //车身碰线 车身碰线方向 + + //20240730 新增 还没计算 + int TouchLineDirCS = 0; //车身碰线 车身碰线方向 int BackPointLaneNo = 0; //后点车道 后点所在车道号 int BackPointLaneCount = 0; //后点车道 后点天线共有几股车道 int Body_RF_ToBaseLine = 0; //右前车身边线 指车身离右侧路边缘线距离 int Body_RB_ToBaseLine = 0; //右后车身边线 指车身离右侧路边缘线距离 - int DirInverse = 0; //车道属性 是否逆向行驶 对应DriveDirType枚举 + int DirInverse = 0; //车道属性 是否逆向行驶 int ShapeNoWheel = 0; //形状 车轮相交的形状线号 #ifdef JUDGE_USE_INSPECT diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index b827041c..6818a8e4 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -153,7 +153,7 @@ export async function getSingleCenterTable(param) { // }) console.log('联网更新失败,请检查网络后重新更新') promptAction.showToast({ - message: `联网更新失败,请检查网络后重新更新`, + message: `联网更新表数据失败,请重新更新`, duration: 3000 }); reslove(false) @@ -229,7 +229,6 @@ export async function takePhotoFn(context) { if (param[key1]) { param.pztd = param[`td${Number(i) + 1}`] takePhoto(param, context, 'jt/', 0, (data) => { - consoele.log('getPhtogetPhto',data) if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) { console.log('getPhtot0000') diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 18d4b3e4..20a9016c 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -167,7 +167,6 @@ export async function getDataBaseTable(params, reqParam) { export async function upDateTableByArray(tableName, arr) { return new Promise(async (reslove,reject)=>{ const data =await sqlInsertCommonFn(tableName, arr) - console.log('sqlsqlinsertsqlsqlinsertkkk',data) reslove(data) }) } diff --git a/entry/src/main/ets/common/service/terminalService.ts b/entry/src/main/ets/common/service/terminalService.ts index c9826ca9..f1f06a9d 100644 --- a/entry/src/main/ets/common/service/terminalService.ts +++ b/entry/src/main/ets/common/service/terminalService.ts @@ -2,6 +2,7 @@ import { obtainCarExamInfo } from '../../api/index' import { dateFormat } from '../utils/tools' import router from '@ohos.router' +import promptAction from '@ohos.promptAction' import { getSyncData } from '../../common/service/initable' import { GlobalConfig } from '../../config/index' import FileUtil from '../../common/utils/File' @@ -13,11 +14,16 @@ export async function getDeviceInfo(context) { // globalThis.deviceNo = '1649018001275'; //洛阳科目三设备 // globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489 // globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备 - + globalThis.deviceNo = 'MAC-B2A3A8FD'; //杭州科目二设备 + return return new Promise(async (resolve, reject) => { const fileUtil = new FileUtil(context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); if (data === '' || data === undefined) { + promptAction.showToast({ + message: `请先进行设备注册`, + duration: 3000 + }); router.pushUrl({ url: 'pages/Register', }, router.RouterMode.Single); diff --git a/entry/src/main/ets/common/service/videoService.ts b/entry/src/main/ets/common/service/videoService.ts index caa3e4ca..3b5c1322 100644 --- a/entry/src/main/ets/common/service/videoService.ts +++ b/entry/src/main/ets/common/service/videoService.ts @@ -99,7 +99,7 @@ export async function takePhoto(param, context,dir,flag=1,callback?) { const num = Math.floor(Math.random() * 10000) const fileName = `picture_record${num}.jpg` - +console.log('baoyihubaoyihu',video_uri,flag) console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName:` + fileName); // @ts-ignore @@ -112,8 +112,10 @@ export async function takePhoto(param, context,dir,flag=1,callback?) { } else{ + console.log('baoyihubaoyihu1',video_uri,flag) return new Promise((resolve,reject)=>{ rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ + console.log('baoyihubaoyihu',video_uri,flag,JSON.stringify(snapResult)) console.log('getPhtot',JSON.stringify(snapResult)) resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) }); diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index cf5545d6..5cf440f1 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -1,10 +1,71 @@ import TcpClient from './TcpClient'; import { getSyncData } from '../service/initable'; import hilog from '@ohos.hilog'; - +import FileUtil from '../../common/utils/File' +import { GlobalConfig } from '../../config/index' export async function getTCP() { + const fileUtil = new FileUtil(globalThis.context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + if (data === '' || data === undefined) { + globalThis.TcpClient = {} + globalThis.TcpClient.onMessage = () => { + } + }else{ + const result=JSON.parse(data) + if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) { + globalThis.TcpClient.closeTcp(async () => { + // const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) + // globalThis.TcpClient = tcpClient + setTimeout(async () => { + await globalThis.TcpClient.rebindTcp(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort) + await globalThis.TcpClient.connectTcp() + await globalThis.TcpClient.sendMsg('1002') //1002 + globalThis.TcpClient.onError((val) => { + setTimeout(() => { + getTCP() + }, 1000) + }) + await globalThis.TcpClient.onMessage((val) => { + setTimeout(() => { + globalThis.TcpClient.sendMsg('1002') //1002 + if (val) { + // const msg=val.substring(5,val.length-1) + console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus()) + globalThis.udpClient?.sendMsg(val) + } + }, 1000) + }) + }, 2000) + }) + + } + else { + const tcpClient: TcpClient = new TcpClient(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort) + globalThis.TcpClient = tcpClient + await globalThis.TcpClient.bindTcp() + await globalThis.TcpClient.connectTcp() + await globalThis.TcpClient.sendMsg('1002') //1002 + globalThis.TcpClient.onError((val) => { + setTimeout(() => { + getTCP() + }, 1000) + }) + await globalThis.TcpClient.onMessage((val) => { + hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val)); + setTimeout(() => { + globalThis.TcpClient.sendMsg('1002') //1002 + if (val && globalThis.udpClient?.sendMsg) { + globalThis.udpClient?.sendMsg(val) + } + }, 1000) + + }) + } + } + return getSyncData('IpConfigTable').then(async (result: Array) => { + console.log('result222', JSON.stringify(result)) if (result.length) { if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) { @@ -34,7 +95,8 @@ export async function getTCP() { }, 2000) }) - } else { + } + else { const tcpClient: TcpClient = new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort, result[0].tcpOppositeIp, result[0].tcpOppositePort) globalThis.TcpClient = tcpClient await globalThis.TcpClient.bindTcp() diff --git a/entry/src/main/ets/common/utils/GlobalUdp.ts b/entry/src/main/ets/common/utils/GlobalUdp.ts index 0370a16a..a1342b01 100644 --- a/entry/src/main/ets/common/utils/GlobalUdp.ts +++ b/entry/src/main/ets/common/utils/GlobalUdp.ts @@ -2,13 +2,72 @@ import UdpClientByCenter from './UdpClientByCenter'; import { getSyncData } from '../service/initable' import { getChuankouFn } from '../../common/service/indexService' +import FileUtil from '../../common/utils/File' +import { GlobalConfig } from '../../config/index' export async function sendMsg(val) { // globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val) } -export async function getUDP(errorFlag?) { - return new Promise((reslove,reject)=>{ +export async function getUDP(context,errorFlag?) { + return new Promise(async (reslove,reject)=>{ + const fileUtil = new FileUtil(context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + if (data === '' || data === undefined) { + console.log(` getUDP has no IPConfigTable `); + globalThis.udpClient = {} + globalThis.host = '' + reslove('') + } else { + const result=JSON.parse(data) + console.log(` getUDP has IPConfigTable `); + if (globalThis.udpClient && globalThis.udpClient.closeUdp) { + console.log(` getUDP has udclent close and rebind `); + globalThis.udpClient.closeUdp(() => { + setTimeout(() => { + globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort) + globalThis.udpClient.sendMsg('111', null) + globalThis.host = `http://${result.centerIp}:${result.centerPort}` + globalThis.udpClient.onError_Callback(()=>{ + console.log('getUDPgetUDPgetUDP') + getUDP(context,true) + if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ + globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 + } + }) + reslove(`http://${result.centerIp}:${result.centerPort}`) + + // globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) + }, 1000) + }) + + } + else { + // 未绑定 + console.log(` getUDP has no udclent and bind `); + const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort) + udpClient.bindUdp() + udpClient.sendMsg('111') + globalThis.host = `http://${result.centerIp}:${result.centerPort}` + globalThis.udpClient = udpClient + + globalThis.udpClient.onMessage_1(()=>{ + console.log('getUDPonMessage_1msgmsgByGloalUdp') + + }) + globalThis.udpClient.onError_Callback(()=>{ + getUDP(context,true) + if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ + globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 + } + }) + getChuankouFn() + reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) + + } + + } + return getSyncData('IpConfigTable').then((result: Array) => { if (result.length) { console.log(` getUDP has IPConfigTable `); @@ -21,7 +80,7 @@ export async function getUDP(errorFlag?) { globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` globalThis.udpClient.onError_Callback(()=>{ console.log('getUDPgetUDPgetUDP') - getUDP(true) + getUDP(true,context) if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 } @@ -47,7 +106,7 @@ export async function getUDP(errorFlag?) { }) globalThis.udpClient.onError_Callback(()=>{ - getUDP(true) + getUDP(true,context) if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 } @@ -77,7 +136,68 @@ export async function getUDP(errorFlag?) { } -export async function getUDP2(errorFlag?) { +export async function getUDP2(context,errorFlag?) { + const fileUtil = new FileUtil(context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + if (data === '' || data === undefined) { + globalThis.udpClient2 = {} + globalThis.udpClient2.setMsgCallBack = () => { + } + }else{ + const result=JSON.parse(data) + console.log(` getUDP2 has IPConfigTable `); + if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) { + console.log(` getUDP2 has udclent ,close and rebind `); + globalThis.udpClient2.closeUdp(async () => { + setTimeout(() => { + globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) + globalThis.udpClient2.onError_Callback(()=>{ + getUDP2(context,true); + if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){ + globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2 + } + }) + }, 1000) + }) + } + else { + // 未绑定 + console.log(` getUDP2 has no udclent and bind `); + const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) + await udpClient2.bindUdp() + await udpClient2.onError_Callback(()=>{ + getUDP2(context,true); + if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){ + globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2 + } + }) + if(!errorFlag){ + await udpClient2.onMessage_2((val) => { + console.log('getUDPOnmessageByGlobalUDP2Message') + if (val.id == '32') { + globalThis.signNum = val.body[1] + + } else if (val.id == '46') { + let tmpList = [] + const str = globalThis.lsh + for (let i = 0; i < str.length; i++) { + tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) + } + const param = { + id: 47, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId + } + globalThis.udpClient2.send(param) + } + }) + } + globalThis.udpClient2 = udpClient2 + + } + } + return console.log(` getUDP2 enter`); getSyncData('IpConfigTable').then(async (result: Array) => { if (result.length) { @@ -140,9 +260,13 @@ export async function getUDP2(errorFlag?) { } export async function setTopLineUdp() { - const config = await getSyncData('IpConfigTable'); - if (config && config[0] && config[0].udplocalIp) { - const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0]; + const fileUtil = new FileUtil(globalThis.context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + const config = JSON.parse(data) + + // const config = await getSyncData('IpConfigTable'); + if (config && config.udplocalIp) { + const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config; const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort) udpClient.bindUdp() @@ -156,8 +280,12 @@ export async function setTopLineUdp() { // export async function setJudgeUdp() { - const config = await getSyncData('IpConfigTable'); + const fileUtil = new FileUtil(globalThis.context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + const config = JSON.parse(data) + // + // const config = await getSyncData('IpConfigTable'); let udpIndex = 0; let currentUdpIndex = 0; let judgeUdpTimer @@ -166,11 +294,11 @@ export async function setJudgeUdp() { udpIndex += 1; }, 1000); - if (config && config[0] && config[0].udplocalIp) { - const {udplocalIp} = config[0]; + if (config && config.udplocalIp) { + const {udplocalIp} = config; const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) await udpClientbyCenter.bindUdp() - await udpClientbyCenter.onMessage_1((val) => { + await udpClientbyCenter.onMessage_2((val) => { console.log('valval', val) }) diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index 1a5a398e..96f9e90f 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -9,6 +9,7 @@ export default class TcpClient { private localIpPort: string = '' private oppositeIp: string = '' private oppositeIpPort: string = '' + private num: number = 0//重连次数 private tcp: any = null @@ -120,8 +121,12 @@ export default class TcpClient { resolve(true) }).catch(err => { globalThis.getCloseTcp = true + this.num++ + if(this.num>3){ + return + } setTimeout(() => { - this.connectTcp() + getTCP() resolve(false) }, 2000) console.log('testTagconnect,error') diff --git a/entry/src/main/ets/common/utils/UdpJudge.ts b/entry/src/main/ets/common/utils/UdpJudge.ts index d4dbc772..1832c3c6 100644 --- a/entry/src/main/ets/common/utils/UdpJudge.ts +++ b/entry/src/main/ets/common/utils/UdpJudge.ts @@ -4,6 +4,8 @@ import { testKm2Items,testKm3Items } from '../../pages/judgeSDK/dataTest/index' import { judgeConfig } from '../../pages/judgeSDK/utils/judgeConfig'; import { setJudgeUdp, setTopLineUdp } from './GlobalUdp'; import { convertGpsCoord2 } from '../utils/tools'; +import common from '@ohos.app.ability.common'; + export const initJudgeUdp = async () => { globalThis.serialIndex = 0; diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 571792a7..76234af4 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -24,6 +24,7 @@ struct Index { @State version: string = '' @State url: string = '' @State hasAuth: boolean = false; + @State dialogVisiable: boolean = false; @State isSingle: boolean = false; @State deviceId: string = ''; @State angle: number = 0 @@ -38,6 +39,15 @@ struct Index { private workerInstance = null; private context = getContext(this) as common.UIAbilityContext; + @Styles + commStyle(){ + .width(220 * this.ratio) + .height(69 * this.ratio) + .backgroundImage($r('app.media.button_nor')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ bottom: 12 * this.ratio }) + } + build() { Column() { Column() { @@ -55,6 +65,8 @@ struct Index { }) Image($r('app.media.btn_back')).width('14.4%').height('12.2%') .onClick(() => { + this.dialogVisiable=true + return promptAction.showDialog({ title: '提示', message: '确认是否退出应用', @@ -87,7 +99,7 @@ struct Index { Column() { Row() { if (!this.isSingle) { - Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(async () => { + Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:10 * globalThis.ratio}).onClick(async () => { if (this.loading) { return } @@ -98,10 +110,11 @@ struct Index { this.angle = 0 if (!globalThis.timeInfo) { promptAction.showToast({ - message: `网络连接失败`, + message: `时间同步接口连接失败`, duration: 3000 }); this.loading = false + return } this.testXMLToJSONInWorker() @@ -109,7 +122,7 @@ struct Index { }) } if (this.isSingle) { - Image($r('app.media.index_dj')).width('30.5%').height('74%').onClick(() => { + Image($r('app.media.index_dj')).width('30.5%').height('74%').margin({left:10 * globalThis.ratio}).onClick(() => { if (this.loading) { return } @@ -117,12 +130,9 @@ struct Index { url: 'pages/UserInfo', params: { judge: true } }, router.RouterMode.Single); - // router.pushUrl({ - // url: 'pages/UserInfo', - // }, router.RouterMode.Single); }) } - Image($r('app.media.index_zj')).width('30.5%').height('74%').onClick(() => { + Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:10* globalThis.ratio}).onClick(() => { if (this.loading) { return } @@ -172,6 +182,36 @@ struct Index { } // + if (this.dialogVisiable) { + Flex({justifyContent:FlexAlign.Center}) { + Text('确认是否退出应用') + .fontSize(28 * this.ratio) + .margin({top:100*this.ratio}) + Row() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text(' 取 消 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) + } + .commStyle() + .onClick(() => { + this.dialogVisiable = false + }) + + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) + } + .commStyle() + .onClick(() => { + router.back() + }) + }.position({ y: 265 * this.ratio, x: 115 * this.ratio }) + + } + .width(660 * this.ratio) + .height(360 * this.ratio) + .position({ x: 150 * this.ratio, y: 98 * this.ratio }) + .backgroundColor('#E6E3DF') + .borderRadius(19 * this.ratio) + } if (this.loading) { Column() { Image($r('app.media.open_loading')) @@ -212,6 +252,7 @@ struct Index { } aboutToAppear() { + this.dialogVisiable=false this.angle = 0 this.loading = false this.vocObj = new voiceService(async (status, val, next) => { @@ -271,11 +312,11 @@ struct Index { async onPageShow() { this.loading = false - this.createAlbum() - await getUDP() - await getUDP2() - this.num=0 this.userAuth(); + this.createAlbum() + await getUDP(this.context,false) + await getUDP2(this.context,false) + this.num=0 clearInterval(this.interval) this.interval = setInterval(() => { this.num++ diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index dcf04b53..b8a73366 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -4,6 +4,8 @@ import ethernet from '@ohos.net.ethernet'; import prompt from '@ohos.prompt' import { upDateTableByArray} from '../common/service/initable' import { getSyncData} from '../common/service/initable' +import FileUtil from '../common/utils/File'; +import common from '@ohos.app.ability.common'; @Entry @@ -19,14 +21,13 @@ struct Index { // @State inputTextList2: string[] = ['192.168.7.124','20022'] // @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] - @State inputTextList1: string[] = ['192.168.1.144','18782','192.168.1.144','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] + @State inputTextList1: string[] = ['192.168.1.146','18782','192.168.1.146','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] // @State inputTextList2: string[] = [] // 112.80.35.83 11052 // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] // @State inputTextList2: string[] = ['192.168.36.139','20022'] - - - + private fileUtil: FileUtil + private context = getContext(this) as common.UIAbilityContext; @State @Watch('outClick') outFlag: boolean = false; private vocObj = null; scroller: Scroller = new Scroller() @@ -78,8 +79,12 @@ struct Index { .height('80%') .borderRadius('25px') Column() { - Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{ - upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}]) + Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async ()=>{ + const fileUtil = new FileUtil(this.context) + const folderPath = await fileUtil.initFolder(`/config`); + const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]} + fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param)) + // upDateTableByArray('IpConfigTable',[]) ethernet.setIfaceConfig("eth0", { mode: 0, ipAddr:this.inputTextList1[9], diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index eff162d5..e04a2779 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -105,11 +105,13 @@ struct UserInfo { new WebRTCVoice(this.context); //初始化数据 this.initData() + //身份证读卡器初始化 // this.openDeviceByIDCard() // 如果是单机模式则模拟假数据 //获取sysset表数据 this.initSysset() + //心跳处理 this.heartMsg() this.isExamStart = false @@ -162,7 +164,6 @@ struct UserInfo { return } - this.showFaceCompare = true this.pageIndex = Math.floor(index / 4) } }) @@ -309,10 +310,10 @@ struct UserInfo { that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' - const faceParam = syssetParams.filter(sys => sys.v_no === '2413') + const faceParam = syssetParams.filter(sys => sys.v_no == '2413') that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' - that.FaceOpenStatue = '0' - console.log('that.FaceOpenStatue', that.FaceOpenStatue) + that.FaceOpenStatue = '0' + // that.FaceOpenStatue = '0' // faceParam?.[0]?.v_value || // 1身份证读卡器 2指纹 3人脸 this.faceFlag = faceParam?.[0]?.v_value || '0' @@ -358,13 +359,6 @@ struct UserInfo { } this.pageIndex++; this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) - this.dataList.forEach(listData => { - for (let i in listData) { - listData[i] = decodeURI(listData[i]) - } - listData.kszp = this.photo + listData.kszp - listData.ksmjzp = this.photo + listData.ksmjzp - }) } prevClick() { @@ -373,13 +367,6 @@ struct UserInfo { } this.pageIndex--; this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) - this.dataList.forEach(listData => { - for (let i in listData) { - listData[i] = decodeURI(listData[i]) - } - listData.kszp = this.photo + listData.kszp - listData.ksmjzp = this.photo + listData.ksmjzp - }) } //获取下载考生 @@ -388,7 +375,7 @@ struct UserInfo { return } const param = `${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}${globalThis.carInfo.carId}${globalThis.carInfo.examinationRoomId}${globalThis.username}` - getExaminationStudentInfo(param).then(res => { + getExaminationStudentInfo(param).then(async(res) => { setTimeout(() => { this.updateTimeLimit = true }, 30000) @@ -415,14 +402,15 @@ struct UserInfo { } this.list = JSON.parse(JSON.stringify(dataList)) - dataList = dataList.length > 4 ? dataList.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : dataList; - dataList.forEach(listData => { + this.list.forEach(listData => { for (let i in listData) { listData[i] = decodeURI(listData[i]) } listData.kszp = this.photo + listData.kszp listData.ksmjzp = this.photo + listData.ksmjzp }) + dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; + this.dataList = dataList if (this.dataList.length) { this.currentUser = this.dataList[0] @@ -435,6 +423,12 @@ struct UserInfo { globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm console.log('this.currentUse3' + JSON.stringify(this.currentUser)) this.pageIndex = 0 + getSyncData('USER').then(data=>{ + if(data?.[0]){ + this.getCurrentStudent(data[0].sfzmhm) + + } + }) }).catch((error) => { console.log('error12error' + error) }) @@ -659,6 +653,9 @@ struct UserInfo { .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { + if(this.isExamStart){ + return + } this.currentUser = item }) }) @@ -774,6 +771,7 @@ struct UserInfo { this.stopDeviceById() return } + console.log('this.FaceOpenStatue',this.FaceOpenStatue) if (this.FaceOpenStatue != '0') { this.showFaceCompare = true } else { diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index 33f9f505..8a05b977 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -12,6 +12,7 @@ import { VideoConfigData } from '../../mock'; @Component export default struct FaceCompare { @State imageBase64: string = 'data:image/jpeg;base64,' + @State base64: string = '' @Prop sfzh: string; @Prop lsh: string; @Prop firstImage: string; @@ -68,7 +69,7 @@ export default struct FaceCompare { Row() { - Image(this.firstImage) + Image(this.base64) .width('100%') .height('100%') .backgroundColor(Color.Black) @@ -176,16 +177,19 @@ export default struct FaceCompare { } async faceComparFn() { - console.log('mmmmm0', 1) + console.log('mmmmm0', 2) - takePhoto(this.param, this.context, 'jt/', 0, ({base64}) => { - faceCompare({ - sfzh: this.sfzh, - firstImage: this.firstImage.substr(22), - secondImage: base64, - type: 2, - verifyType: 1 - }).then(res => { + const data=await takePhoto(this.param, this.context, 'jt/', 1,) + this.base64=this.imageBase64 + data.base64 + console.log('mmmmt',this.base64) + faceCompare({ + sfzh: this.sfzh, + firstImage: this.firstImage.substr(22), + secondImage: data.base64, + type: 2, + verifyType: 1 + }) + .then(res => { console.log('mmmmm8', res) if (res) { @@ -208,7 +212,6 @@ export default struct FaceCompare { } }) - }) console.log('mmmmm8', 9) diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index b1a3ea80..4e85bf27 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -2,7 +2,7 @@ import router from '@ohos.router'; import UdpClient from '../../common/utils/UdpClient'; import FileLog from '../judgeSDK/utils/fileLog'; import RealTime from '../compontents/judge/RealTime'; -import { GPSData, SignalData, RoadData } from '../../mock'; +import { GPSData, SignalData } from '../../mock'; import { SignalDataType } from '../../model'; @Component @@ -159,7 +159,7 @@ export default struct SignDisplayCom { .fontSize(14 * this.ratio) .width('30%') .textAlign(TextAlign.Start) - Text("改正数数据长度*数据长度-基准站RTCM改正数类型:" + this.signArr[62] || '0') + Text("改正数次数/改正数大小:" + this.signArr[58] || '0') .fontColor('#FFF5E5') .fontSize(14 * this.ratio) .textAlign(TextAlign.Start) @@ -169,12 +169,11 @@ export default struct SignDisplayCom { Text("本机IP:" + this.signArr[53] || '0') .fontColor('#FFF5E5') .fontSize(14 * this.ratio) - .width('30%') + .width('25%') .textAlign(TextAlign.Start) - Text("改正数次数/改正数大小:" + this.signArr[58] || '0') + Text("改正数数据长度*数据长度-基准站RTCM改正数类型:" + this.signArr[62] || '0') .fontColor('#FFF5E5') .fontSize(14 * this.ratio) - .width('30%') .textAlign(TextAlign.Start) }.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio }) } @@ -223,9 +222,9 @@ export default struct SignDisplayCom { Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) } .backgroundColor('#1A1A1A') - .width(138 * this.ratio) + .width(170 * this.ratio) .height(300 * this.ratio) - .position({ y: 0 * this.ratio, x: 750 * this.ratio }) + .position({ y: 0 * this.ratio, x: 720 * this.ratio }) }.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio }) } .width(936 * this.ratio) @@ -328,8 +327,8 @@ export default struct SignDisplayCom { if (showBack) { this.ratio = 1.4 - globalThis.udpClient.onMessage_1((msg) => { - console.log('msgmsg', msg) + globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => { + console.log('getUDPonMessage_1bysignDisplay0', msg) if (msg) { getSignal(msg) } @@ -353,7 +352,9 @@ export default struct SignDisplayCom { const that = this const showBack = this.showBack; if (showBack) { - globalThis.udpClient.onMessage_1((msg) => { + globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => { + console.log('getUDPonMessage_1bysignDisplay2', msg) + getSignal(msg) }) } else {