diff --git a/dispatch2/.settings/com.zksw.flythings.easyui.prefs b/dispatch2/.settings/com.zksw.flythings.easyui.prefs index 19ba8ad26eddc3ebbd894fca25a3f34cbe85c12e..36b19ac7bd021d1f79d294f4849888a588130e6a 100644 --- a/dispatch2/.settings/com.zksw.flythings.easyui.prefs +++ b/dispatch2/.settings/com.zksw.flythings.easyui.prefs @@ -1,5 +1,5 @@ -easyui.cfg.debug={"baud"\:"115200","defBrightness"\:-1,"languageCode"\:"zh_CN","languagePath"\:"/mnt/extsd/tr/","resPath"\:"/mnt/extsd/ui/","rotateScreen"\:0,"rotateTouch"\:0,"screensaverTimeOut"\:-1,"startupLibPath"\:"/mnt/extsd/lib/libzkgui.so","startupTouchCalib"\:true,"touchDev"\:"/dev/input/event1","uart"\:"ttyS1","zkdebug"\:false} -easyui.cfg.release={"baud"\:"115200","defBrightness"\:-1,"languageCode"\:"zh_CN","languagePath"\:"/res/tr/","resPath"\:"/res/ui/","rotateScreen"\:0,"rotateTouch"\:0,"screensaverTimeOut"\:-1,"startupLibPath"\:"/res/lib/libzkgui.so","startupTouchCalib"\:true,"touchDev"\:"/dev/input/event1","uart"\:"ttyS1","zkdebug"\:false} +easyui.cfg.debug={"baud"\:"115200","defBrightness"\:-1,"languageCode"\:"zh_CN","languagePath"\:"/mnt/extsd/tr/","resPath"\:"/mnt/extsd/ui/","rotateScreen"\:0,"rotateTouch"\:0,"screensaverTimeOut"\:-1,"startupLibPath"\:"/mnt/extsd/lib/libzkgui.so","startupTouchCalib"\:false,"touchDev"\:"/dev/input/event1","uart"\:"ttyS1","zkdebug"\:false} +easyui.cfg.release={"baud"\:"115200","defBrightness"\:-1,"languageCode"\:"zh_CN","languagePath"\:"/res/tr/","resPath"\:"/res/ui/","rotateScreen"\:0,"rotateTouch"\:0,"screensaverTimeOut"\:-1,"startupLibPath"\:"/res/lib/libzkgui.so","startupTouchCalib"\:false,"touchDev"\:"/dev/input/event1","uart"\:"ttyS1","zkdebug"\:false} eclipse.preferences.version=1 platform={"name"\:"T113","cprojectTemplateDir"\:"bundle/cproject/t113","internalCode"\:"t113"} resolution=1024x600 diff --git a/dispatch2/jni/common/common.cpp b/dispatch2/jni/common/common.cpp index ba03edccb14a032527f2288f747bb09620cb8a8c..902818d7892c529c9b4e06891d528ac3b2c91853 100644 --- a/dispatch2/jni/common/common.cpp +++ b/dispatch2/jni/common/common.cpp @@ -633,7 +633,7 @@ int common::strtohex(string strdata, uint8_t *dptr) } string common::ParamsToJson(vector parms) -{ +{ // 组json文件 为 string // string strjson = "'{"; string strjson = "{"; for (int i = 0; i < (int)parms.size(); i++) diff --git a/dispatch2/jni/common/common.h b/dispatch2/jni/common/common.h index bc02b92444f069921a026eae2ce89da46ba80973..411314a3fa249487f792007e4225065cb99883d5 100644 --- a/dispatch2/jni/common/common.h +++ b/dispatch2/jni/common/common.h @@ -66,8 +66,8 @@ #define WEB_SERVER_PORT "iot" #define GPS_SERVER "39.104.14.181" #define GPS_PORT 7000 -//#define MSG_SERVER "uatiot.bdsaas.cc" -//#define MSG_SERVER_PORT 33399 +#define MSG_SERVER "uatiot.bdsaas.cc" +#define MSG_SERVER_PORT 33399 #define MSG_SERVER "192.168.1.13" #define MSG_SERVER_PORT 8080 @@ -87,9 +87,9 @@ //#define OPTION_FILE "/mnt/extsd/Option.ini" #define PROCESSNAME ".log" // 日志文件后缀 #define LOG_PATH "log" -#define RUNDATA_FAILE "/mnt/extsd/Rundata.ini" -#define BINDEB_FAILE "/mnt/extsd/Binded.ini" -#define MSGCACHE_FAILE "/mnt/extsd/MsgCache.json" +#define RUNDATA_FAILE "/mnt/extsd/Rundata.ini" // 存储 绑定状态 +#define BINDEB_FAILE "/mnt/extsd/Binded.ini" // 存储 imei +#define MSGCACHE_FAILE "/mnt/extsd/MsgCache.json" // 存储 消息 #ifndef PARAMETER_FLOW #define PARAMETER_FLOW @@ -169,7 +169,7 @@ struct stumodels struct stuKeyData { - bool bsendunbind; + bool bsendunbind; // 挖装完成按键 bool bkeycanceldown; // bool bkeycanceldownmsg; bool bkeyfaultdown; @@ -191,8 +191,8 @@ struct stuNFCData struct stuDisply { std::string strText; - bool bshow; //导航栏可操作 - bool bReset; // 重置值 清空 + bool bshow; //导航栏可操作 + bool bReset; // 重置值 清空 bool bResetclear; // 重置值 bool bstartThread; }; @@ -289,69 +289,69 @@ struct stuDiggerData { bool bGetLoadQuality; bool bHasBindTruck; - bool bHasUnBindTruck; + bool bHasUnBindTruck; // TTM:MAC-DCON bool bBindStatus; - bool bGetTruckNum; + bool bGetTruckNum; // 收到 MSG:VEHICLECODE bool bGetTruckNum2; - bool bGetTruckNummsg; + bool bGetTruckNummsg; // 收到 MSG:VEHICLECODE bool brecvTruckNum; bool brecvTruckIMEI; bool bGetDriverID; bool bGetDiggerNFC; bool bGetDiggerclock; - bool bbindstatus; + bool bbindstatus; // 收到 TTM:CONN-MAC 或 TTM:STA-123 bool bbindstatus2; - bool bbindstatusmsg; - bool brecvunbind; - bool brecvbindstatus; - bool brecvbindstatusmsg; + bool bbindstatusmsg; // 收到 TTM:CONN-MAC 或 TTM:STA-123 + bool brecvunbind; // 收到 TTM:STA-000000 + bool brecvbindstatus; // 收到 TTM:STA- + bool brecvbindstatusmsg; // 收到 TTM:STA- uint8_t TruckNum; uint8_t loadqualified; char strTruckNum[8]; uint8_t DiggerNFC[4]; uint8_t Diggerclock[4]; uint8_t Diggerid[3]; - bool bGetTruckID; - bool bGetTruckID2; + bool bGetTruckID; // 有扫描到数据 握手1 + bool bGetTruckID2; // 有扫描到数据 握手2 bool bPreBind; bool bGetDiggerID; vector vecScanData; vector vecScanData2; - vector vecErasedid; // 缓存扫描到的不是当前绑定挖机的id - bool blift; + vector vecErasedid; // 缓存扫描到的不是当前绑定挖机的id +// bool blift; bool bliftmsg; int DiggerNum; bool bPreunbind; - bool bGetTruckIMEI; + bool bGetTruckIMEI; // 收到 MSG:IMEI bool bGetTruckIMEI2; - bool bGetTruckIMEImsg; + bool bGetTruckIMEImsg; // 收到 MSG:IMEI char strTruckIMEI[32]; - bool bnomalunbind; - bool bhavescanTruck; - bool bgetdistance; - int truckdistance; + bool bnomalunbind; // 正常解绑 + bool bhavescanTruck; // 收到 dis:----扫描到 + bool bgetdistance; // 收到 The current distance is: + int truckdistance; // 当前距离 int lockindex; - bool bsendrang; + bool bsendrang; // 发送 range 时 true bool bgetrangerp; bool bsendconnect; int isendcount; - bool bgetbinddis; + bool bgetbinddis; // 收到 The current distance is: bool bcangetdis; bool bbindtruck; - int ibindtruckcount; + int ibindtruckcount; // 60s 定时器 加 bool bWaitLoardEnd; bool bFirstDK3; bool bsendconn; int senddiggernum; int sendimei; - bool bconntout; + bool bconntout; // 收到 TTM:CONN-FAIL TTM:NO-DEVICE TTM:CONN-TOUT bool bgeterp; bool bhavebinded; bool bbindtimeout; int ibindtime; - bool bgetunbind; - bool bgetcancel; + bool bgetunbind; // 收到 MSG:UNBIND + bool bgetcancel; // 收到 MSG:BINDERROR }; struct stuTruckData @@ -360,7 +360,7 @@ struct stuTruckData uint8_t Truckid[3]; uint8_t DiggerId[3]; bool bGetDiggerID; - bool bbindstatus; + bool bbindstatus; // 收到 STA-FXXXXXX connected bool brecvbindstatus; bool bGetDiggerNum; bool bGetDiggerNummsg; @@ -374,7 +374,7 @@ struct stuTruckData bool blocking; bool blift; bool brecvdata; - bool brecvunbind; + bool brecvunbind; // 收到 sta-000 或 disconnected // bool bbinded; bool bbinding; char strDiggerNum[8]; @@ -391,8 +391,8 @@ struct stuTruckData bool blocked; bool bunbinddigger; bool bliftpair; - bool bpairing; - bool bSendpairing; + bool bpairing; // 信标配对 + bool bSendpairing; // 信标配对中 bool bPairOK; bool bCheckBLE; }; diff --git a/dispatch2/jni/logic/trunkWindowLogic.cc b/dispatch2/jni/logic/trunkWindowLogic.cc index b6aa9a6bd8dfa1453dca718f0c4481f1089c636a..28671ce6c8780d870b06e8edb52debc36992905c 100644 --- a/dispatch2/jni/logic/trunkWindowLogic.cc +++ b/dispatch2/jni/logic/trunkWindowLogic.cc @@ -12,7 +12,7 @@ mWindow3_2Ptr 自卸车设置初始化界面 == mWindow3_2Ptr 信标配对--影响辅助 举升阈值 mWindow4_1Ptr 自卸车 临停/故障/报修/爆胎 界面 == mWindow4_1Ptr mWindow4_2Ptr 挖机 临停/故障/报修/打黄油 界面 == mWindow4_2Ptr - mWindow4_3Ptr 弹窗 界面 == mWindow4_3Ptr + mWindow4_3Ptr 弹窗提示 界面 == mWindow4_3Ptr mWindow5Ptr 弹出车辆调度信息界面 == mWindow5Ptr mWindow6Ptr 初始化输入车辆编号界面 == mWindow6Ptr mWindow7Ptr 异常弹窗界面 == mWindow7Ptr @@ -277,17 +277,17 @@ static void onProtocolDataUpdate(const SProtocolData &data) { } void ShowWindow(ZKWindow* pMianWinShow, ZKWindow* pWinHide, - ZKWindow* pWinShow) { + ZKWindow* pWinShow) {// 第一个显示 2/3根据 catType显示 挖机显示3 自卸车显示2 if (pMianWinShow != NULL) { pMianWinShow->showWnd(); } - if (carType == 1) { + if (carType == 1) { // 挖机 pWinHide->hideWnd(); pWinShow->showWnd(); - } else if (carType == 2) { + } else if (carType == 2) { // 自卸车 pWinShow->hideWnd(); - pWinHide->showWnd(); //显示 开始运输界面 + pWinHide->showWnd(); } mwindowStatusBarPtr->showWnd(); @@ -465,7 +465,7 @@ static void initWinUI() { if (g_spurtCode != "000" && carType != 0) { showNavibarBtn(true); bMainWindow = true; - g_WinData.loadWinData.iLoadStatus = 1; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 : 等待装载 pCommonData->Disply.bstartThread = true; // BackendThread::CMyThread MyThread; // MyThread.start(NULL); @@ -498,8 +498,11 @@ static void onUI_init() { pCommonData->Disply.bResetclear = false; UIcommon::InitGlobalData(); -// g_vehicleType = 2; -// g_spurtCode = "Y0065"; + g_vehicleType = 2; + g_spurtCode = "Y0065"; + +// g_vehicleType = 1; +// g_spurtCode = "W1001"; carType = g_vehicleType; if (g_spurtCode == "000" && carType == 0) { binit = true;//1 未获取到 需要初始化 @@ -884,13 +887,13 @@ static void UpdateMsgViewText() { strtemp = "系统正在启动,请稍等"; } - if (pCommonData->TruckData.bSendpairing) { + if (pCommonData->TruckData.bSendpairing) {//信标配对中 strtemp = "信标正在配对,请稍等"; showNavibarBtn(true); showSettingsWinBtn(true); if (pCommonData->TruckData.bPairOK) { ShowMessageBox("配对成功"); - showNavibarBtn(false); + showNavibarBtn(false); // 菜单栏按钮设置不可操作 showSettingsWinBtn(false); pCommonData->TruckData.bPairOK = false; pCommonData->TruckData.bSendpairing = false; @@ -1217,7 +1220,7 @@ static bool onButtonClick_buttonError(ZKButton *pButton) { return false; } -static void ShowWaitLoad() { +static void ShowWaitLoad() { // 显示等待装载界面 自卸车显示 mWindow2_1Ptr 挖机显示 mWindow2_5Ptr ShowWindow(mWindow1Ptr, mWindow2_1Ptr, mWindow2_5Ptr); } @@ -1249,19 +1252,19 @@ static bool onButtonClick_Button2_3_1(ZKButton *pButton) { HideAllWindows(); //隐藏窗口容器 ShowWaitLoad(); // 显示等待装载界面 - pCommonData->KeyData.bkeycanceldown = true; + pCommonData->KeyData.bkeycanceldown = true; // 按键发送解绑 重新匹配 return false; } static bool onButtonClick_Button2_3_2(ZKButton *pButton) { LOGD(" ButtonClick Button2_3_2 挖装完成 !!!\n"); - // 挖装完成 + // 挖装完成 -自卸车显示开始运输 挖机成为等待装载 // HideAllWindows(); //隐藏窗口容器 // ShowWindow(mWindow1Ptr, mWindow2_2Ptr, mWindow2_5Ptr); - pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; + pCommonData->KeyData.bsendunbind = true; // 按键发送解绑 挖装完成 +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; return false; diff --git a/dispatch2/jni/thread/CDiggerLockModelMsg.cpp b/dispatch2/jni/thread/CDiggerLockModelMsg.cpp index 6831ca9c1e43248537492aab74b6504466e28041..48cb3fff2bfc4c63014f7b9965fbd4a055d35803 100644 --- a/dispatch2/jni/thread/CDiggerLockModelMsg.cpp +++ b/dispatch2/jni/thread/CDiggerLockModelMsg.cpp @@ -57,7 +57,7 @@ void CDiggerLockModelMsg::run(void *pdata) void CDiggerLockModelMsg::RecvSerialPortMsg(CommonData *pCommonData) { - if (pCommonData->DiggerData.bbindstatusmsg) + if (pCommonData->DiggerData.bbindstatusmsg) // 收到 TTM:CONN-MAC { m_bbindone = true; m_bscandis = true; @@ -117,7 +117,7 @@ void CDiggerLockModelMsg::RecvSerialPortMsg(CommonData *pCommonData) // pCommonData->KeyData.bkeycanceldownmsg = false; // } - if (pCommonData->DiggerData.bliftmsg) + if (pCommonData->DiggerData.bliftmsg) // 挖机按键挖装完成 || 长距离 大于1 按键“挖装完成” || || || || { m_bscandis = false; m_bbegintodis = false; diff --git a/dispatch2/jni/thread/CDiggerModel.cpp b/dispatch2/jni/thread/CDiggerModel.cpp index 51791ca6094992a00a7b7cfda9343423986dd954..d1b5f8717cf0f76f18f84ff27cb4209c7447386e 100644 --- a/dispatch2/jni/thread/CDiggerModel.cpp +++ b/dispatch2/jni/thread/CDiggerModel.cpp @@ -154,7 +154,7 @@ void CDiggerModel::run(void *pdata) pCommonData->DiggerData.brecvTruckNum = false; pCommonData->DiggerData.brecvTruckIMEI = false; pCommonData->DiggerData.bnomalunbind = false; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; pCommonData->DiggerData.bcangetdis = false; pCommonData->DiggerData.bWaitLoardEnd = false; pCommonData->DiggerData.bFirstDK3 = false; @@ -206,7 +206,7 @@ void CDiggerModel::run(void *pdata) while (1) { - if (pCommonData->DiggerData.bHasUnBindTruck) + if (pCommonData->DiggerData.bHasUnBindTruck)//收到TTM:MAC-DCON { m_sendbind = 0; // m_bscan = true; @@ -268,7 +268,7 @@ bool CDiggerModel::findidincache(char *id) } void CDiggerModel::dealscaneddata(CommonData *pCommonData) -{ +{ // 处理扫描数据 cout << "m_vecScandata.size():" << m_vecScandata.size() << endl; cout << "m_vecLastScandata.size():" << m_vecLastScandata.size() << endl; cout << "m_vecCacheScandata.size():" << m_vecCacheScandata.size() << endl; @@ -389,7 +389,7 @@ void CDiggerModel::dealscaneddata(CommonData *pCommonData) } void CDiggerModel::sendbindmsg(CommonData *pCommonData) -{ +{ // 发送绑定 if (m_sendbind == 0) { clearCurrentRecord(); @@ -437,7 +437,7 @@ void CDiggerModel::SendCmdToSerialPort(CommonData *pCommonData) LOGI("m_bcanbind:%d; m_bbind:%d; m_bscan:%d", m_bcanbind, m_bbind, m_bscan); if (m_bscan && !m_bbind) // 开始扫描 扫描 && 未绑定状态 --> 发送扫描指令 { - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; char buf[32]; strcpy(buf, "TTM:SCAN"); @@ -452,7 +452,7 @@ void CDiggerModel::SendCmdToSerialPort(CommonData *pCommonData) dealscaneddata(pCommonData); } - if (m_bcanbind && !m_bbind && !m_sendbindmsg) + if (m_bcanbind && !m_bbind && !m_sendbindmsg)// 绑定要求中 & 未绑定中 & !正在发送绑定消息 { sendbindmsg(pCommonData); } @@ -490,7 +490,7 @@ void CDiggerModel::clearCurrentRecord() } void CDiggerModel::dealliftmsg(CommonData *pCommonData) -{ +{// 处理解绑 按键(挖机/自卸车) // common::WriteLog("---dealliftmsg---\n"); if (pCommonData->NFCData.bclocked) { @@ -552,7 +552,7 @@ void CDiggerModel::dealliftmsg(CommonData *pCommonData) pCommonData->DiggerData.brecvTruckIMEI = false; pCommonData->DiggerData.bGetTruckIMEImsg = false; pCommonData->DiggerData.bGetTruckNummsg = false; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; pCommonData->DiggerData.bsendconnect = false; m_bsendconnnect = false; pCommonData->DiggerData.isendcount = 0; @@ -571,7 +571,7 @@ void CDiggerModel::dealliftmsg(CommonData *pCommonData) // m_pScreenCom->ShowMessageDC("解绑"); // sleep(2); - g_WinData.loadWinData.iLoadStatus = 1; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 : 等待装载 // sleep(5); if (m_bhavebinded) @@ -689,7 +689,7 @@ void CDiggerModel::dealTruckLockmodelID(CommonData *pCommonData) } void CDiggerModel::dealGetTruckNum(CommonData *pCommonData) -{ +{ // 运输状态 :等待装载 if (!m_bspeak) { char text[64] = {0}; @@ -702,7 +702,7 @@ void CDiggerModel::dealGetTruckNum(CommonData *pCommonData) // m_pScreenCom->ShowMessageDE("准备装载"); // sleep(1); - g_WinData.loadWinData.iLoadStatus = 1; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 m_bspeak = true; } @@ -725,7 +725,7 @@ void CDiggerModel::GetTruckIMEI(CommonData *pCommonData) } void CDiggerModel::dealrecvbindstatus(CommonData *pCommonData) -{ +{ // 收到sta-0000 / sta-123 if (pCommonData->DiggerData.bbindstatus || pCommonData->DiggerData.bbindstatus2) { // if (m_waitkeytimes == 0) @@ -767,7 +767,7 @@ void CDiggerModel::dealrecvbindmsg(CommonData *pCommonData) } void CDiggerModel::dealbinded(CommonData *pCommonData) -{ +{// 接收到车牌号 & IMEI号 -> 运输状态: 开始/正在装载 m_bbind = true; m_waitkeytimes = 0; m_bindtimmes = 0; @@ -782,7 +782,7 @@ void CDiggerModel::dealbinded(CommonData *pCommonData) // cout << "ShowMessageDE : " // << "开始装载" << endl; // m_pScreenCom->ShowMessageDE("0开始装载"); - g_WinData.loadWinData.iLoadStatus = 2; + g_WinData.loadWinData.iLoadStatus = 2; // 运输状态: 开始/正在装载 // sleep(2); // pCommonData->TruckData.lockbegintime = common::GetTimeString(); @@ -790,7 +790,7 @@ void CDiggerModel::dealbinded(CommonData *pCommonData) pCommonData->DiggerData.bFirstDK3 = true; pCommonData->TruckData.bBeginLoad = true; pCommonData->DiggerData.bnomalunbind = false; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; pCommonData->DiggerData.bhavebinded = true; pCommonData->DiggerData.bbindtimeout = false; pCommonData->DiggerData.ibindtime = 0; @@ -808,9 +808,8 @@ void CDiggerModel::dealbinded(CommonData *pCommonData) // sleep(2); } -// 处理取消按钮 void CDiggerModel::dealcancel(CommonData *pCommonData) -{ +{ // 重新匹配按钮 || 收到自卸车发来的 MSG:BINDERROR m_bbeginspeak = false; m_sendbindmsg = false; m_bbind = false; @@ -835,7 +834,7 @@ void CDiggerModel::dealcancel(CommonData *pCommonData) pCommonData->DiggerData.brecvTruckIMEI = false; pCommonData->DiggerData.bGetTruckIMEImsg = false; pCommonData->DiggerData.bGetTruckNummsg = false; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; pCommonData->DiggerData.bWaitLoardEnd = false; pCommonData->DiggerData.bFirstDK3 = false; pCommonData->DiggerData.bhavebinded = false; @@ -862,26 +861,27 @@ void CDiggerModel::dealcancel(CommonData *pCommonData) void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) { if ((pCommonData->KeyData.bsendunbind || pCommonData->DiggerData.bgetunbind) && (m_bbind || m_senddatafail)) - { + {// (挖装完成按键 || 收到自卸车发来的MSG:UNBIND)& (绑定-收到imei/车牌 ||发送挖机车牌号 和 挖机 IMEI号 超过5次 ) pCommonData->KeyData.bsendunbind = false; - pCommonData->DiggerData.bnomalunbind = true; + pCommonData->DiggerData.bnomalunbind = true; // 正常解绑 pCommonData->DiggerData.bgetunbind = false; dealliftmsg(pCommonData); } if (pCommonData->KeyData.bkeycanceldown || pCommonData->DiggerData.bgetcancel) - { + {// 重新匹配按钮 || 收到自卸车发来的 MSG:BINDERROR dealcancel(pCommonData); pCommonData->KeyData.bkeycanceldown = false; - pCommonData->DiggerData.bnomalunbind = false; pCommonData->DiggerData.bgetcancel = false; - g_WinData.loadWinData.iLoadStatus = 1; + + pCommonData->DiggerData.bnomalunbind = false; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 } std::cout << "pCommonData->DiggerData.bGetTruckID:" << pCommonData->DiggerData.bGetTruckID << std::endl; std::cout << "pCommonData->DiggerData.bGetTruckID2:" << pCommonData->DiggerData.bGetTruckID2 << std::endl; if (pCommonData->DiggerData.bGetTruckID || pCommonData->DiggerData.bGetTruckID2) - { + {// 有扫描到数据 dealTruckLockmodelID(pCommonData); pCommonData->DiggerData.bGetTruckID = false; pCommonData->DiggerData.bGetTruckID2 = false; @@ -903,7 +903,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.bGetTruckIMEI2 = false; } - if (pCommonData->DiggerData.brecvbindstatus) + if (pCommonData->DiggerData.brecvbindstatus) // 收到sta-0000 / sta-123 { dealrecvbindstatus(pCommonData); pCommonData->DiggerData.brecvbindstatus = false; @@ -911,8 +911,8 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) if (pCommonData->DiggerData.bgetdistance) { - m_currentdis = pCommonData->DiggerData.truckdistance; - pCommonData->DiggerData.bgetdistance = false; + m_currentdis = pCommonData->DiggerData.truckdistance; // 当前距离 + pCommonData->DiggerData.bgetdistance = false; // 收到 The current distance is: m_getdistance = true; } @@ -949,7 +949,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) cout << "m_binddis: " << m_binddis << endl; cout << "m_currentdis - m_binddis: " << m_currentdis - m_binddis << endl; // if ((m_currentdis > 2500) && m_bbind) //(m_binddis + 1000) - if (pCommonData->DiggerData.bgetbinddis) + if (pCommonData->DiggerData.bgetbinddis) // 获取到当前距离 { if (((m_currentdis - m_binddis) > 1500) && m_bbind) { @@ -962,12 +962,12 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.bgetbinddis = false; } - if (m_longdistancecount > 1) + if (m_longdistancecount > 1)// 长距离 大于1 按键“挖装完成” { m_currentdis = 0; m_binddis = 0; pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; cleartempdata(); } @@ -990,7 +990,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.bbindtruck = false; pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; cleartempdata(); } @@ -1013,8 +1013,8 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) cout << "m_brecvTrucknum : " << m_brecvTrucknum << endl; cout << "m_brecvTruckIMEI : " << m_brecvTruckIMEI << endl; // if (m_waitkeytimes >= 2 && !m_bbeginspeak && m_brecvTrucknum && m_brecvTruckIMEI) // scan locked more than 2 times - if (!m_bbeginspeak && m_brecvTrucknum && m_brecvTruckIMEI) // 接收到车牌号+IMEI号 --> 开始装载 - { + if (!m_bbeginspeak && m_brecvTrucknum && m_brecvTruckIMEI) + {// 接收到车牌号 & IMEI号 --> 开始装载 m_senddatafail = false; dealbinded(pCommonData); } @@ -1045,7 +1045,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.bbindtruck = false; pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; m_getrangerpcount = 0; cleartempdata(); @@ -1082,7 +1082,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) cout << "pCommonData->DiggerData.senddiggernum : " << pCommonData->DiggerData.senddiggernum << endl; cout << "pCommonData->DiggerData.sendimei : " << pCommonData->DiggerData.sendimei << endl; cout << "m_bsendconnnect : " << m_bsendconnnect << endl; - // 发送挖机车牌号 和 挖机 IMEI号 超过5次 + // 发送挖机车牌号 或 挖机 IMEI号 超过5次 if ((pCommonData->DiggerData.senddiggernum > MSG_TIMES) || (pCommonData->DiggerData.sendimei > MSG_TIMES)) // m_bsendconnnect && { m_senddatafail = true; @@ -1099,7 +1099,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.ibindtruckcount = 0; pCommonData->DiggerData.bbindtruck = false; pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; pCommonData->DiggerData.senddiggernum = 0; pCommonData->DiggerData.sendimei = 0; @@ -1144,7 +1144,7 @@ void CDiggerModel::RecvSerialPortMsg(CommonData *pCommonData) pCommonData->DiggerData.bbindtruck = false; pCommonData->KeyData.bsendunbind = true; - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->DiggerData.bliftmsg = true; pCommonData->DiggerData.bbindtimeout = false; cleartempdata(); @@ -1286,9 +1286,8 @@ bool CDiggerModel::getTransportTimes() return false; } -// 清空三个vector void CDiggerModel::cleartempdata() -{ +{ // 清空三个vector m_vecScandata.clear(); m_vecLastScandata.clear(); m_vecCacheScandata.clear(); diff --git a/dispatch2/jni/thread/CDiggerModel.h b/dispatch2/jni/thread/CDiggerModel.h index 5adb4e3aa6e2ed03290837e03754a2ee05a2a3ed..9da7be49f4b10f3707fce39e28cef6563a336626 100644 --- a/dispatch2/jni/thread/CDiggerModel.h +++ b/dispatch2/jni/thread/CDiggerModel.h @@ -8,17 +8,15 @@ #ifndef CDIGGERMODEL_H #define CDIGGERMODEL_H +#include #include "../common/common.h" #include "../restclient-cpp/CHttpGet.h" #include "../restclient-cpp/CHttpPost.h" #include "../uart/ClockModelCom.h" #include "../uart/CScreenCom.h" -#include "../common/common.h" -#include "../restclient-cpp/CHttpClient.h" -#include "../restclient-cpp/CHttpGet.h" #include "json/json.h" #include "thread.h" -#include + class CDiggerModel : public util::thread_t { @@ -61,9 +59,9 @@ public: static int m_index; // time_t m_lockedtimebegin; // time_t m_lockedtimeend; - static int m_scandistance; - static int m_binddistance; - static int m_restdistance; + static int m_scandistance; // 扫描距离 + static int m_binddistance; // 绑定距离 + static int m_restdistance; // 移动距离 // int m_scannoresponse; static int m_binddis; @@ -79,7 +77,7 @@ public: static bool m_bsendconnnect; static bool m_bhavebinded; - static bool m_senddatafail; + static bool m_senddatafail; // 发送imei+车牌 多次failed 置为 true static int m_geterpcount; static int m_waitbind; diff --git a/dispatch2/jni/thread/CDiggerRecv485Thread.cpp b/dispatch2/jni/thread/CDiggerRecv485Thread.cpp index ff9468f28a2aa0a2f1b22c59908cbc6be757dccd..3ebb8bcdabcb1c1b902a6e17291c91846e74fecc 100644 --- a/dispatch2/jni/thread/CDiggerRecv485Thread.cpp +++ b/dispatch2/jni/thread/CDiggerRecv485Thread.cpp @@ -60,7 +60,7 @@ void CDiggerRecv485Thread::run(void *pdata) pCommonData->DiggerData.TruckNum = -1; pCommonData->DiggerData.bPreBind = false; pCommonData->devicestatus.lockmodelresponse = true; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; pCommonData->DiggerData.bgetrangerp = false; pCommonData->DiggerData.bconntout = false; pCommonData->DiggerData.bgeterp = false; @@ -155,7 +155,7 @@ void CDiggerRecv485Thread::run(void *pdata) cout << "ScanDistance: " << pCommonData->DiggerData.vecScanData[i]->Distance << endl; } } - pCommonData->DiggerData.bhavescanTruck = true; +// pCommonData->DiggerData.bhavescanTruck = true; pCommonData->DiggerData.bGetTruckID = true; std::cout << "pCommonData->DiggerData.bGetTruckID:" << pCommonData->DiggerData.bGetTruckID << std::endl; } @@ -208,9 +208,9 @@ void CDiggerRecv485Thread::run(void *pdata) // pCommonData->DiggerData.bHasUnBindTruck = true; continue; } - if (!pCommonData->DiggerData.bnomalunbind) + if (!pCommonData->DiggerData.bnomalunbind)// !正常解绑 == !(重新匹配按钮 || 收到自卸车发来的 MSG:BINDERROR) { - pCommonData->DiggerData.blift = true; +// pCommonData->DiggerData.blift = true; pCommonData->KeyData.bsendunbind = true; pCommonData->DiggerData.bbindstatus = false; pCommonData->DiggerData.brecvunbind = true; @@ -221,7 +221,7 @@ void CDiggerRecv485Thread::run(void *pdata) } bool bconntout = common::contains(ret, "TTM:CONN-TOUT"); - bool bconnfail = common::contains(ret, "TTM:CONN-FAIL"); // TTM:CONN-FAIL TTM:NO-DEVICE + bool bconnfail = common::contains(ret, "TTM:CONN-FAIL"); // TTM:CONN-FAIL TTM:NO-DEVICE TTM:CONN-TOUT bool bconnnodevice = common::contains(ret, "TTM:NO-DEVICE"); if (bconntout || bconnfail || bconnnodevice) // TTM:CONN-TOUT { @@ -238,7 +238,7 @@ void CDiggerRecv485Thread::run(void *pdata) common::trimall(strtemp); strtemp.erase(strtemp.size() - 1); float fDistance = atof(strtemp.c_str()); - pCommonData->DiggerData.truckdistance = fDistance * 100; // to cm + pCommonData->DiggerData.truckdistance = fDistance * 100; // 当前距离 cm pCommonData->DiggerData.bgetdistance = true; pCommonData->DiggerData.bgetbinddis = true; pCommonData->DiggerData.bgetrangerp = false; diff --git a/dispatch2/jni/thread/CDiggerRecvLockmodel2.cpp b/dispatch2/jni/thread/CDiggerRecvLockmodel2.cpp index 44fec3ccdc04e6ae6100dbbf79c2c7a99ad010cb..cd3ee25f31627d60db3f2c4ff36f7e0aef90a715 100644 --- a/dispatch2/jni/thread/CDiggerRecvLockmodel2.cpp +++ b/dispatch2/jni/thread/CDiggerRecvLockmodel2.cpp @@ -59,7 +59,7 @@ void CDiggerRecvLockmodel2::run(void *pdata) pCommonData->DiggerData.TruckNum = -1; pCommonData->DiggerData.bPreBind = false; pCommonData->devicestatus.lockmodelresponse = true; - pCommonData->DiggerData.bhavescanTruck = false; +// pCommonData->DiggerData.bhavescanTruck = false; char ret[1024] = {0}; m_pLockModelCom = CLockModelCom::GetInstance2(); @@ -131,7 +131,7 @@ void CDiggerRecvLockmodel2::run(void *pdata) cout << "ScanDistance: " << pCommonData->DiggerData.vecScanData2[i]->Distance << endl; } } - pCommonData->DiggerData.bhavescanTruck = true; +// pCommonData->DiggerData.bhavescanTruck = true; pCommonData->DiggerData.bGetTruckID2 = true; std::cout << "pCommonData->DiggerData.bGetTruckID2:" << pCommonData->DiggerData.bGetTruckID2 << std::endl; } diff --git a/dispatch2/jni/thread/CNFCModel.cpp b/dispatch2/jni/thread/CNFCModel.cpp index e3a13593835ef4b959c32213cc6e08cf1c5cf190..c113b1290d0c2cf41699a01c65e26e5cd2c05581 100644 --- a/dispatch2/jni/thread/CNFCModel.cpp +++ b/dispatch2/jni/thread/CNFCModel.cpp @@ -87,17 +87,17 @@ void CNFCModel::run(void *pdata) memcpy(pCommonData->NFCData.NFCid, ret + 6, 4); pCommonData->NFCData.strNFCid = HexToString(pCommonData->NFCData.NFCid, 4); // g_WinData.carInfoWin1Data.strDriverName = pCommonData->NFCData.strNFCid; //test code - pCommonData->NFCData.bGetNFCID = true; + pCommonData->NFCData.bGetNFCID = true; // 获取到正确的 NFC卡 } } } if (pCommonData->NFCData.bGetNFCID) - { + { // 读到正确的卡 // pCommonData->KeyData.bpoweron = false; m_nickName = "打卡失败"; if (pCommonData->NFCData.strNFCid == "00") - { + { // 获取为00 ---> 打卡失败 //m_pScreenCom->ShowMessageDB("打卡失败"); g_WinData.carInfoWin1Data.strDriverName = m_nickName; sleep(2); @@ -105,7 +105,7 @@ void CNFCModel::run(void *pdata) } m_strNFCID = pCommonData->NFCData.strNFCid; g_RecordData.vehicleDumperDriverIpassId = m_strNFCID; - Attendance(pCommonData); // report clock in data to web + Attendance(pCommonData); // report clock in data to web 上传打卡数据 sleep(1); @@ -116,7 +116,7 @@ void CNFCModel::run(void *pdata) // sleep(1); // m_pScreenCom->ShowMessageDE("等待装载"); - g_WinData.loadWinData.iLoadStatus = 1; //1 等待装载; 2 正在装载; 3 开始运输; 4 正在排土 + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态:等待装载 pCommonData->NFCData.bGetNFCID = false; if (m_LastDiggerNFCID != m_strNFCID) @@ -182,6 +182,7 @@ bool CNFCModel::Attendance(CommonData *pCommonData) url += m_imei; string results; + // g_Server.webserver/g_Server.webserverport/100010/hongyao/m_imei bool ret = attendance.SendPost(url, parms, "", results); if (ret) { @@ -204,7 +205,7 @@ bool CNFCModel::Attendance(CommonData *pCommonData) if (results2.length() == 0) { string strjson = common::ParamsToJson(parms); - m_DriverClockTable.InsertData(strjson); + m_DriverClockTable.InsertData(strjson); // 存入数据库 return false; } } diff --git a/dispatch2/jni/thread/CTruckModel.cpp b/dispatch2/jni/thread/CTruckModel.cpp index 6e62cd56ba109921078a2afcba12a86a3b11fd35..1dc2a45a2d737d859095355fca39b077e14e3c2e 100644 --- a/dispatch2/jni/thread/CTruckModel.cpp +++ b/dispatch2/jni/thread/CTruckModel.cpp @@ -94,7 +94,7 @@ CTruckModel::~CTruckModel() void CTruckModel::run(void *pdata) { CommonData *pCommonData = (CommonData *)pdata; - pCommonData->KeyData.bsendunbind = false; + pCommonData->KeyData.bsendunbind = false; // 按键发送解绑 pCommonData->TruckData.btransportend = false; pCommonData->TruckData.bliftup = false; pCommonData->TruckData.bbinding = false; @@ -149,7 +149,7 @@ void CTruckModel::SendCmdToSerialPort(CommonData *pCommonData) cout << "m_sendbindmsg:" << m_sendbindmsg << endl; cout << "m_bscanbind:" << m_bscanbind << endl; - if (m_bscanbind) // 设备扫描状态 + if (m_bscanbind) { char bufstatus[32]; strcpy(bufstatus, "TTM:STA?"); @@ -190,11 +190,11 @@ void CTruckModel::dealbtransportend(CommonData *pCommonData) pCommonData->TruckData.btransportend = false; //m_pScreenCom->ShowMessageDE("4运输结束"); -// g_WinData.loadWinData.iLoadStatus = 4; +// g_WinData.loadWinData.iLoadStatus = 4; // 运输状态 :运输结束/正在排土 // pCommonData->TruckData.bliftpair = true; // wyb - setrundata("isbinded", "0"); // 设置未绑定到 配置文件中 + setrundata("isbinded", "0"); // 存储绑定状态(未绑定) //common::setrundata("isbinded", "0"); // sleep(2); @@ -223,7 +223,7 @@ void CTruckModel::dealbtransportend(CommonData *pCommonData) // } m_bhavebinded = false; -// g_WinData.loadWinData.iLoadStatus = 1; +// g_WinData.loadWinData.iLoadStatus = 1;//等待装载 // pCommonData->TruckData.bliftpair = false; // } @@ -277,8 +277,8 @@ void CTruckModel::dealGetDiggerIMEI(CommonData *pCommonData) } void CTruckModel::dealLoading(CommonData *pCommonData) -{ // 处理绑定 - setrundata("isbinded", "1"); // 处理配置文件 设置为绑定状态 +{ // 处理绑定 + setrundata("isbinded", "1"); // 存储绑定状态(绑定) //common::setrundata("isbinded", "1"); m_lockedtimebegin = common::getcurrenttime(); m_waitkeytimes = 0; @@ -288,7 +288,7 @@ void CTruckModel::dealLoading(CommonData *pCommonData) m_bhavebinded = false; //m_pScreenCom->ShowMessageDE("0开始装载"); - g_WinData.loadWinData.iLoadStatus = 2; + g_WinData.loadWinData.iLoadStatus = 2; // 运输状态 开始/正在装载 pCommonData->TruckData.bliftpair = false; pCommonData->TruckData.bCheckBLE = true; //sleep(2); @@ -303,7 +303,7 @@ void CTruckModel::dealLoading(CommonData *pCommonData) m_bbeginspeak = true; } -void CTruckModel::dealLoadend(CommonData *pCommonData) +void CTruckModel::dealLoadend(CommonData *pCommonData) // 开始运输 { m_sendbindmsg = false; m_bbind = false; @@ -327,7 +327,7 @@ void CTruckModel::dealLoadend(CommonData *pCommonData) SetLoadEndRecord(pCommonData); if (g_strIMEI.length() > 3) { - setbinddata("bindedimei", g_strIMEI); + setbinddata("bindedimei", g_strIMEI); // 存入imei到 Binded.ini //common::setrundata("bindedimei", g_strIMEI); } @@ -342,7 +342,7 @@ void CTruckModel::dealLoadend(CommonData *pCommonData) // sleep(5); //m_pScreenCom->ShowMessageDE("3开始运输"); - g_WinData.loadWinData.iLoadStatus = 3; + g_WinData.loadWinData.iLoadStatus = 3; // 运输状态 : 开始运输 pCommonData->TruckData.bliftpair = true; pCommonData->TruckData.bCheckBLE = false; //sleep(2); @@ -415,7 +415,7 @@ void CTruckModel::dealLoadend(CommonData *pCommonData) } m_lastavermin = iRssi; //iRssi; - setrundata("isbinded", "0"); + setrundata("isbinded", "0"); // 存储绑定状态(未绑定) //common::setrundata("isbinded", "0"); } @@ -465,7 +465,7 @@ void CTruckModel::dealCancel(CommonData *pCommonData) sleep(1); pCommonData->TruckData.blocked = false; - setrundata("isbinded", "0"); + setrundata("isbinded", "0"); // 存储绑定状态(未绑定) //common::setrundata("isbinded", "0"); } @@ -503,19 +503,19 @@ void CTruckModel::dealbinddonemsg(CommonData *pCommonData) void CTruckModel::dealunbindmsg(CommonData *pCommonData) { cout << "dealunbindmsg pCommonData->TruckData.brecvunbind : " << pCommonData->TruckData.brecvunbind << endl; - if (pCommonData->TruckData.brecvunbind) + if (pCommonData->TruckData.brecvunbind) // 收到 STA-000000000000 或 disconnected { unbindcount++; pCommonData->TruckData.brecvunbind = false; } - if (pCommonData->TruckData.bbindstatus) + if (pCommonData->TruckData.bbindstatus) // 收到 STA-FXXXXXX 或 connected { unbindcount = 0; pCommonData->TruckData.bbindstatus = false; } - if (pCommonData->TruckData.bCancelKey) + if (pCommonData->TruckData.bCancelKey) // 收到 MSG:CANCELED { pCommonData->TruckData.bCancelKey = false; dealCancel(pCommonData); @@ -525,7 +525,7 @@ void CTruckModel::dealunbindmsg(CommonData *pCommonData) cout << "m_bbind : " << m_bbind << endl; // common::WriteLog("m_bbind: %d", m_bbind); if (unbindcount > 0 && m_bbind) //&& pCommonData->TruckData.bPreunbind - { + {// dealLoadend(pCommonData); } // common::WriteLog("m_bbind222: %d", m_bbind); @@ -537,7 +537,7 @@ void CTruckModel::dealunbindmsg(CommonData *pCommonData) m_unbindtimes = 0; } - if (pCommonData->TruckData.blift) + if (pCommonData->TruckData.blift) // 运输状态 : 开始运输 { m_sendbindmsg = false; pCommonData->TruckData.blift = false; @@ -590,7 +590,7 @@ void CTruckModel::RecvSerialPortMsg(CommonData *pCommonData) } if (m_bGetDiggerNum && m_bGetDiggerIMEI) - { + { // 绑定 m_bscanbind = true; m_bGetDiggerNum = false; m_bGetDiggerIMEI = false; @@ -611,22 +611,22 @@ void CTruckModel::RecvSerialPortMsg(CommonData *pCommonData) cout << "m_waitkeytimes : " << m_waitkeytimes << endl; cout << "m_bbeginspeak : " << m_bbeginspeak << endl; if (m_bbind && m_waitkeytimes > 0 && !m_bbeginspeak) // scan locked more than 2 times && m_waitkeytimes > 1 - { // 处理绑定 + { // & & !正在装载 // 处理绑定 dealLoading(pCommonData); } - if (pCommonData->KeyData.bsendunbind) + if (pCommonData->KeyData.bsendunbind) // 按钮发送解绑 挖装完成 { - // send unbind message sendunbindmsg(pCommonData); pCommonData->KeyData.bsendunbind = false; } - if (pCommonData->KeyData.bkeycanceldown) + if (pCommonData->KeyData.bkeycanceldown) // 按键发送解绑 重新匹配 { + pCommonData->KeyData.bkeycanceldown = false; + sendcancelmsg(pCommonData); - pCommonData->KeyData.bkeycanceldown = false; - g_WinData.loadWinData.iLoadStatus = 1; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 } dealunbindmsg(pCommonData); diff --git a/dispatch2/jni/thread/CTruckModel.h b/dispatch2/jni/thread/CTruckModel.h index ad91263e83fcf24859fbe84fd4045f7175be013a..01349ba46cb23a9620ce936871179d4626ce2a12 100644 --- a/dispatch2/jni/thread/CTruckModel.h +++ b/dispatch2/jni/thread/CTruckModel.h @@ -19,8 +19,8 @@ class CTruckModel : public util::thread_t { public: static string m_strcurrentID; - static bool m_bscan; - static bool m_bbind; + static bool m_bscan; // 是否查询设备状态 + static bool m_bbind; // 是否绑定 收到 imei和 车牌号后 置 true static int m_waitkeytimes; static string m_LoadQuality; static bool m_bbindone; @@ -29,19 +29,19 @@ public: static int m_unbindtimes; static uint8_t m_currentID[3]; - static int unbindcount; + static int unbindcount; // 收到 sta-000 或 disconnected static bool m_bbeginspeak; static CLockModelCom *m_pLockModelCom; static CScreenCom *m_pScreenCom; static CIOCom *m_pIOCom; static string m_strimei; static int m_TransportTimes; - static bool m_bscanbind; + static bool m_bscanbind; // 查询设备状态 static bool m_bGetDiggerNum; static bool m_bGetDiggerIMEI; - static time_t m_lockedtimebegin; + static time_t m_lockedtimebegin; // 绑定时间 static time_t m_lockedtimeend; // static int m_ilocaltimes; diff --git a/dispatch2/jni/thread/nvrio.cpp b/dispatch2/jni/thread/nvrio.cpp index fe9f6295aa4f2dbd18c5a0ca0f5869975f1c6460..add199bd0e9f4870b08d5264a97d90a810862448 100644 --- a/dispatch2/jni/thread/nvrio.cpp +++ b/dispatch2/jni/thread/nvrio.cpp @@ -285,7 +285,7 @@ void nvrio::setconveyanceendRecord(CommonData *pCommonData) g_RecordData.endTime = common::GetTimeString(); // 运输结束时间 - g_RecordData.endmileage = pCommonData->OBD.total_Mileage; + g_RecordData.endmileage = pCommonData->OBD.total_Mileage; // 计算运输里程 memset(szTemp, 0, sizeof(szTemp)); if ((g_RecordData.endmileage - g_RecordData.beginmileage) > 0) // if OBD can get data @@ -293,7 +293,7 @@ void nvrio::setconveyanceendRecord(CommonData *pCommonData) sprintf(szTemp, "%.1f", (g_RecordData.endmileage - g_RecordData.beginmileage)); g_RecordData.transportDistance = szTemp; // 如果 OBD可以获取数据 运输里程 == 结束里程 - 开始里程 } - else // if OBD can not get data, use gnss data + else // if OBD can not get data, use gps data { double lat1 = g_RecordData.dstartLatitude; // 如果 OBD无法获取数据 使用运输结束 和 运输开始 的经纬度 计算 运输里程 double lng1 = g_RecordData.dstartLongitude; @@ -355,11 +355,11 @@ void nvrio::run(void *pdata) { LOGI("nvrio recv %d data, real data is : %s\n", n, Dst); - if(pCommonData->TruckData.bSendpairing) + if(pCommonData->TruckData.bSendpairing)//配对中时 { bool bOK = common::contains(Dst, "RSSI"); if(bOK) - { + {// 如果 查找到 RSSI 在 Dst 中 配对成功 pCommonData->TruckData.bPairOK = true; // pCommonData->TruckData.bSendpairing = false; continue; @@ -392,7 +392,7 @@ void nvrio::run(void *pdata) // blast = bopen; // // pCommonData->TruckData.bliftpair = false; // pCommonData->devicestatus.liftmodelresponse = true; -//// g_WinData.loadWinData.iLoadStatus = 1; +//// g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 // } // bool bSTAunpair = common::contains(Dst, "TTM:STA-UNPAIR"); @@ -439,10 +439,11 @@ void nvrio::run(void *pdata) if (blast != bopen) // Lifting sensor is open { printf("Lift Sensor is Opened!!!\n"); - g_WinData.loadWinData.iLoadStatus = 4; - setconveyanceendRecord(pCommonData); + g_WinData.loadWinData.iLoadStatus = 4; // 运输状态 : 正在排土 + setconveyanceendRecord(pCommonData); // 计算运输里程 和 结束时的一些值 + + string strbindedimei = getbinddata("bindedimei"); // 从 Binded.ini文件 获取 imei - string strbindedimei = getbinddata("bindedimei"); common::WriteLog("strbindedimei : %s \n", strbindedimei.c_str()); common::WriteLog("strbindedimei.length() : %d \n", strbindedimei.length()); LOGI("strbindedimei : %s \n", strbindedimei.c_str()); @@ -451,7 +452,7 @@ void nvrio::run(void *pdata) if (strbindedimei.length() > 3) { g_RecordData.lockModelId = strbindedimei; - reportRecord(pCommonData); // report Loading and transportation records to web + reportRecord(pCommonData); // report Loading and transportation records to web 上传数据 } clearCurrentRecord(); // clean temporary data removebinddata("bindedimei"); @@ -470,7 +471,7 @@ void nvrio::run(void *pdata) bopen = false; if(blast != bopen) { - g_WinData.loadWinData.iLoadStatus = 1; + g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 // 设备结束休眠 char send1[32]; @@ -484,7 +485,7 @@ void nvrio::run(void *pdata) blast = bopen; // pCommonData->TruckData.bliftpair = false; pCommonData->devicestatus.liftmodelresponse = true; -// g_WinData.loadWinData.iLoadStatus = 1; +// g_WinData.loadWinData.iLoadStatus = 1; // 运输状态 :等待装载 } } // } @@ -527,6 +528,5 @@ string nvrio::getbinddata(string key) { // common::WriteLog("getrundata"); string ret = ioutil::ReadFile(BINDEB_FAILE); - return ret; } diff --git a/dispatch2/jni/thread/sendtoio.cpp b/dispatch2/jni/thread/sendtoio.cpp index cf1ce9be9dfa2df45d72dc8c8d6b321f3ec4348d..de76e2c19d20424f1bd5a77822fac60a04b61e1b 100644 --- a/dispatch2/jni/thread/sendtoio.cpp +++ b/dispatch2/jni/thread/sendtoio.cpp @@ -20,20 +20,20 @@ void CSendtoio::run(void *pdata) LOGI("+++pCommonData->TruckData.bliftpair = : %d \n", pCommonData->TruckData.bliftpair); if(pCommonData->TruckData.bliftpair || (pCommonData->TruckData.bCheckBLE && !pCommonData->TruckData.bpairing && !pCommonData->TruckData.bSendpairing)) - { + {// 或 ( 且 未发送配对指令的时候) char bufstatus[32]; strcpy(bufstatus, "TTM:INFO"); printf("sendtoIO %d data, real data is : %s\n", strlen(bufstatus), bufstatus); m_pIOCom->sendtoIO(bufstatus, strlen(bufstatus)); } - if(pCommonData->TruckData.bpairing) + if(pCommonData->TruckData.bpairing) // 信标配对 发送 pair给信标 收到button点击之后 进行配对 { char buf[32]; strcpy(buf, "TTM:PAIR"); m_pIOCom->sendtoIO(buf, strlen(buf)); pCommonData->TruckData.bpairing = false; - pCommonData->TruckData.bSendpairing = true; + pCommonData->TruckData.bSendpairing = true; // 配对中 } sleep(1); diff --git a/dispatch2/ui/trunkWindow.ftu b/dispatch2/ui/trunkWindow.ftu index 5463dea00f1b57857cc304094325e57078e88a2b..615f9d445cdbf763d5919ffd81e0fb2ba43d3d46 100644 Binary files a/dispatch2/ui/trunkWindow.ftu and b/dispatch2/ui/trunkWindow.ftu differ