ProcSM.cpp
上传用户:yffx2008
上传日期:2014-10-12
资源大小:12414k
文件大小:36k
- // ProcSM.cpp: implementation of the CProcSM class.
- //
- ///////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "GpsSC.h"
- #include "ProcSM.h"
- #include "Unicode.h"
- #include "Afxcoll.h"
- #include "Afxmt.h"
- #include "SysIniteDlg.h"
- #include "TreeCtrlEx.h"
- #include "VehicleMessageSet.h"
- #include "ClientinfoSet.h"
- #include "MainFrm.h"
- #include "DiverNumberDlg.h"
- #include "UserTypeDlg.h"
- #include "MonitorDlg.h"
- #include "ChooseTimeDlg.h"
- #include "ChangePassWordDlg.h"
- #include "ComUserDlg.h"
- #include "GpsScView.h"
- #include "SMdata.h"
- #include "ctype.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- //the globale data
- CString strToBeWriteToComm; //最终将要发送到串行口的字符串
- CGpsSCDoc* m_pDoc; //the ducument pointor for send message
- CStringList gStringList;
- CCriticalSection m_cMessageDealer; //the critical varaible
- CString strToBeJudge(""); //the string to be process
- //the thread fuction for write somthing to the comm
- UINT WriteThread(LPVOID lparam)
- {
- CProcSM * m_pProcsm = (CProcSM *) lparam;
- while(1) {
- if(strToBeWriteToComm.IsEmpty()) Sleep(10);
- if(m_pDoc->m_bConnected == FALSE) continue;
- if((strToBeWriteToComm.GetLength() != 0) && (m_pDoc != NULL)) {
- m_pProcsm->WriteComPort(strToBeWriteToComm,m_pDoc);
- strToBeWriteToComm.Empty();
- }
- }
- return 1;
- }
- //THE process thread
- UINT ProcessThread(LPVOID lparam)
- {
- CProcSM *pProcsm = (CProcSM*)lparam;
- while(1) {
- Sleep(1000);
- if(gStringList.GetCount() != 0) {
- strToBeJudge.Empty();
- for(int k = 0; k < gStringList.GetCount(); k++) {
- strToBeJudge += gStringList.GetAt(gStringList.FindIndex(k));
- }
- }
- if(!strToBeJudge.IsEmpty()) {
- pProcsm->JudgeReceivedMsg(strToBeJudge);
- }
-
- m_cMessageDealer.Lock();
- if(!strToBeJudge.IsEmpty()) strToBeJudge.Empty();
- m_cMessageDealer.Unlock();
- }
- }
- CProcSM::CProcSM()
- {
- strToBeWriteToComm = ""; //最终将要发送到串行口的字符串
- m_sVehicleNumber = "13751709724";
- m_strDriverNumber = "13751709724";
- strCommonUserPassWord = "123456";
- m_bWaveComInite = TRUE;
- m_nUserType = 0;
- m_bSysTemInit = FALSE;
- m_pView = NULL;
- m_sCurrMonitorCar.Empty();
- m_sGetPositionCar.Empty();
- }
- CProcSM::~CProcSM()
- {
- }
- CString CProcSM::ConstructSendstr(CString strOrder,CString m_sVehicleNumber,CString strSMConttent)
- {
- CString str2Send;
- str2Send.Empty();
- str2Send += strOrder;
- str2Send += """;
- str2Send += m_sVehicleNumber;
- str2Send += ""r";
- str2Send += strSMConttent;
- str2Send += "x1ar";
- return str2Send;
- }
- /********************************************************************/
- //a reload function
- //the software send to the wavecom chip,all the order is command
- //so the mSleepTime only depend on the order not depend on the
- //conttent of the smconttetn ,because the scconttent is the order
- /********************************************************************/
- void CProcSM::SetStr2Send(CString sSendStr)
- {
- if(!m_bWaveComInite) {
- AfxMessageBox("电话系统没有初始化n,请初始化电话系统!");
- return;
- }
-
- if(!sSendStr.IsEmpty()) strToBeWriteToComm = sSendStr;
- }
- void CProcSM::JudgeReceivedMsg(CString strReceived)
- {
- if(strReceived.IsEmpty()) return;
- strReceived.Replace(" ","");
- CString SM_Num,ShortMessage;
- int nFind;
- SM_Num = NewSMIndication(strReceived);
- if(SM_Num != "") {
- nFind = strReceived.Find("CMGR");
- if(nFind == -1) {
- m_cMessageDealer.Lock();
- strToBeWriteToComm = READONESHORTMESSAGE;
- strToBeWriteToComm.Replace("XXX",SM_Num);
- m_cMessageDealer.Unlock();
- return ;
- }
- }
- //读完一条短信息并处理后,立即删除刚读的那一条短信息
- SM_Num = GetNewSMData(strReceived,ShortMessage);
- if(!SM_Num.IsEmpty()) {
- m_cMessageDealer.Lock();
- ProcShortMessage(ShortMessage);
- strToBeWriteToComm = DELONESHORTMESSAGE;
- strToBeWriteToComm.Replace("XXX",SM_Num);
- m_cMessageDealer.Unlock();
- }
- SendMessageResult(strReceived);
- ClearStrList();
- DealSystemMsg(strReceived);
- }
- void CProcSM::ClearStrList()
- {
- m_cMessageDealer.Lock();
- if(!gStringList.IsEmpty()) gStringList.RemoveAll();
- m_cMessageDealer.Unlock();
- }
- void CProcSM::ClearVehicleList()
- {
- m_lCurrMonitorVehicle.RemoveAll();
- }
- void CProcSM::SendMessageResult(CString strReceived)
- {
- if(strReceived.IsEmpty()) return ;
- int nFind1, nFind2;
- nFind1 = strReceived.Find("+CMGS");
- nFind2 = strReceived.Find("OK");
- if((nFind1 != -1) && (nFind2 != -1)) {
- // AfxMessageBox("短信发送成功!");
- }
- nFind1 = strReceived.Find("+CMGS");
- nFind2 = strReceived.Find("ERROR");
- if((nFind1 != -1) && (nFind2 != -1)) {
- // AfxMessageBox("短信发送失败!");
- }
- }
- CString CProcSM::GetNewSMData(CString strReceived,CString &sMessage)
- {
- if(strReceived.IsEmpty()) return "";
- CString SM_Num(""),Data;
- int nFind1, nFind2, i;
- char chr;
- nFind1 = strReceived.Find("AT+CMGR=");
- if(nFind1 != -1) {
- for(i = nFind1 + 8; i < strReceived.GetLength(); i++) {
- chr = strReceived.GetAt(i);
- if(isalnum(chr)) SM_Num += chr;
- else break;
- if((chr == 'r') || (chr == 'n')) break;
- }
- }
- nFind1 = strReceived.Find("READ");
- nFind2 = strReceived.Find("OK");
- if((nFind1 != -1) && (nFind2 != -1)) {
- sMessage = GetSpecialStr(strReceived,nFind1 + 6,nFind2);
- }
- return SM_Num;
- }
- void CProcSM::ProcShortMessage(CString sMessage)
- {
- CVehicleMessageSet messageSet;
- CClientinfoSet clientinfoSet;
- CMainFrame *pMainFrame = NULL;
- CString sTel,sDate,sUnico,sAnsi;
- CString sID,sState,sPos,sGx,sGy,sSpeed,sDriver;
- int nFind1,nFind2,Len;
- sTel.Empty(); sDate.Empty(); sUnico.Empty(); sAnsi.Empty(); sID.Empty();
- sState.Empty(); sPos.Empty(); sGx.Empty(); sGy.Empty(); sSpeed.Empty(); sDriver.Empty();
- sMessage.Replace("r","");
- sMessage.Replace("n","");
- sMessage.Replace(" ","");
- // WriteToFile("Message.txt",sMessage);
- Len = sMessage.GetLength();
- nFind1 = sMessage.Find(""");
- nFind2 = sMessage.Find(""",nFind1 + 1);
- sTel = GetSpecialStr(sMessage,nFind1 + 1, nFind2);
- sTel = sTel.Right(11);
- nFind1 = sMessage.Find(""",nFind2 + 1);
- nFind2 = sMessage.Find(""",nFind1 + 1);
- sDate = GetSpecialStr(sMessage,nFind1 + 1, nFind2);
- sUnico = GetSpecialStr(sMessage,nFind2 + 1,Len);
- sAnsi = UnicodeStr2AnsiStr(sUnico);
- if(sAnsi.Find("指令已经执行") != -1) { //判断是否自动监控
- AfxMessageBox("自动监控指令已经执行!");
- return;
- }
- if(sAnsi.Find("密码错误") != -1) {
- return;
- }
- nFind1 = sAnsi.Find('r');
- if(nFind1 != -1) {
- sID = GetSpecialStr(sAnsi,0,nFind1);
- sAnsi = sAnsi.Mid(nFind1 + 1);
- }
- nFind1 = sID.Find(":");
- if(nFind1 != -1) sID = sID.Mid(nFind1 + 1);
- nFind1 = sAnsi.Find('r');
- if(nFind1 != -1) {
- sState = GetSpecialStr(sAnsi,0,nFind1);
- sAnsi = sAnsi.Mid(nFind1 + 1);
- }
- nFind1 = sState.Find(":");
- if(nFind1 != -1) sState = sState.Mid(nFind1 + 1);
- nFind1 = sAnsi.Find('r');
- if(nFind1 != -1) {
- sPos = GetSpecialStr(sAnsi,0,nFind1);
- sAnsi = sAnsi.Mid(nFind1 + 1);
- }
- nFind1 = sPos.Find(":");
- if(nFind1 != -1) sPos = sPos.Mid(nFind1 + 1);
- nFind1 = sAnsi.Find('r');
- if(nFind1 != -1) {
- sGx = GetSpecialStr(sAnsi,0,nFind1);
- sAnsi = sAnsi.Mid(nFind1 + 1);
- }
- nFind1 = sGx.Find(":");
- if(nFind1 != -1) sGx = sGx.Mid(nFind1 + 1);
- nFind1 = sAnsi.Find('r');
- if(nFind1 != -1) {
- sGy = GetSpecialStr(sAnsi,0,nFind1);
- sAnsi = sAnsi.Mid(nFind1 + 1);
- }
- nFind1 = sGy.Find(":");
- if(nFind1 != -1) sGy = sGy.Mid(nFind1 + 1);
- // nFind1 = sAnsi.Find('r');
- // if(nFind1 != -1) {
- // sSpeed = GetSpecialStr(sAnsi,0,nFind1);
- // }
- sSpeed = sAnsi;
- nFind1 = sSpeed.Find(":");
- if(nFind1 != -1) sSpeed = sSpeed.Mid(nFind1 + 1);
- if(sGx.IsEmpty() || sGy.IsEmpty()) return ;
- clientinfoSet.FindClientinfo(sTel,sDriver,sID);
- ChangLGAndLt(sGx,sGy,sID,sTel);
- messageSet.AddMessage(sTel,sDate,sState,sPos,sGx,sGy,sSpeed);
- pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
- if(pMainFrame != NULL) {
- pMainFrame->Insert2ListCtrl(sID,sDriver,sDate,sSpeed,sGx,sGy,sState,sTel,sPos);
- }
- }
- CString CProcSM::NewSMIndication(CString strReceived)
- {
- if(strReceived.IsEmpty()) return "";
- int nFind1, nFind2, i;
- nFind1 = strReceived.Find("CMTI");
- nFind2 = strReceived.Find("SM");
- if((nFind1 != -1) && (nFind2 != -1)) {
- strReceived = strReceived.Mid(nFind2 + 4);
- CString Str("");
- char chr;
- for(i = 0; i < strReceived.GetLength(); i++) {
- chr = strReceived.GetAt(i);
- if(isalnum(chr)) Str += chr;
- else break;
- if((chr == 'r') || (chr == 'n')) break;
- }
- return Str;
- }
- return "";
- }
- CString CProcSM::GetLenStr(CString DstStr,BYTE pos,BYTE Len)
- {
- CString RetStr("");
- BYTE i;
- for(i = pos; i < pos + Len; i++) {
- RetStr += DstStr.GetAt(i);
- }
- return RetStr;
- }
- CString CProcSM::GetSpecialStr(CString sSrcStr,long pos1,long pos2)
- {
- CString RetStr("");
- long i;
- for(i = pos1; i < pos2; i++) {
- RetStr += sSrcStr.GetAt(i);
- }
- return RetStr;
- }
- /**********************************************/
- /* read the serial port ,the function
- /* return the numbers of the date
- /***********************************************/
- long CProcSM::ReadComPort(WPARAM wParam,CGpsSCDoc *pDoc)
- {
- if(!pDoc->m_bConnected || (wParam&EV_RXCHAR) != EV_RXCHAR) {
- SetEvent(pDoc->m_hPostMsgEvent);
- return 0L;
- }
- CString strMessage;
- char buff[512];
- long nLength;
- nLength = pDoc->ReadComm(buff,512);
- buff[nLength] = 0;
- strMessage = buff;
- // WriteToFile("ReadMsg.txt",strMessage);
- if(nLength != 0) {
- gStringList.AddTail(strMessage);
- }
- SetEvent(pDoc->m_hPostMsgEvent); //允许发送下个 WM_COOMMNOTIFY 消息
- return 0L;
- }
- /****************************************/
- /* write date to the serial port
- /****************************************/
- long CProcSM::WriteComPort(CString str2Write,CGpsSCDoc *pDoc)
- {
- if(str2Write.IsEmpty()) return 0;
- if(!(pDoc->m_bConnected)) {
- AfxMessageBox("串行口没有成功打开,请检查串行口!");
- return 0;
- }
- // WriteToFile("WriteMsg.txt",str2Write);
- COMSTAT ComStat;
- DWORD dwErrorFlags;
- BYTE Buf[512];
- BOOL fState;
- DWORD length = 0,i;
- length = str2Write.GetLength();
- if(length > 512) length = 512;
- for(i = 0; i < length; i++) Buf[i] = str2Write.GetAt(i);
- Buf[i] = 0;
- ClearCommError(pDoc->m_hCom,&dwErrorFlags,&ComStat);
- fState = WriteFile(pDoc->m_hCom,Buf,length,&length,&(pDoc->m_osWrite));
-
- if(!fState) {
- if(GetLastError()==ERROR_IO_PENDING) {
- GetOverlappedResult(pDoc->m_hCom,&(pDoc->m_osWrite),&length,TRUE);
- }
- else {
- length = 0;
- }
- }
- return length;
- }
- /*************************************************/
- //function to deal systemstr
- /*************************************************/
- void CProcSM::DealSystemMsg(CString strReceived)
- {
- // WriteToFile("System.txt",strReceived);
- int Ask;
- strReceived.Replace("r","");
- strReceived.Replace("n","");
- strReceived.Replace(" ","");
- if(strReceived.Find(WAVECOMINITETEXTSUCCESS) != -1) { //Text方式
- AfxMessageBox("监控中心电话初始化成功!");
- }
- else if (strReceived.Find(WAVECOMINITETEXTFAILE) != -1) { //Text方式
- Ask = AfxMessageBox("监控中心电话初始化失败,n是否重新初始化监控中心电话?",MB_YESNO);
- if(Ask == IDYES) SetStr2Send(WAVECOMINITETEXT);
- }
- else if (strReceived .Find(WAVECOMINITEPDUSUCCESS) !=-1) { //PDU方式
- AfxMessageBox("监控中心电话初始化成功!");
- }
- else if (strReceived.Find(WAVECOMINITEPDUFAILE) != -1) { //PDU方式
- Ask = AfxMessageBox("监控中心电话初始化失败,n是否重新初始化监控中心电话?",MB_YESNO);
- if(Ask == IDYES) SetStr2Send(WAVECOMINITEPDU);
- }
- }
- //get gprmc data
- BOOL CProcSM::GetSubData(char * ReceData,CString *strLongitude,CString *strLatitude)
- {
- CString TmpStr1,TmpStr2;
- int DataPos = 0;
- INT strlength = strlen(ReceData);
- if (strlength >= 60)
- {
- TmpStr1 = GetString(ReceData,&DataPos); //用于去掉 "$GPRMC,"等字符
- }
- else
- {
- return false;
- }
- if(TmpStr1 == "$GPRMC")
- {
- TmpStr1 = GetString(ReceData,&DataPos); //获取GPS接收时间
-
- if(!TmpStr1.IsEmpty())
- {
- ;
- }
- else
- {
- return false;
- }
- TmpStr1 = GetString(ReceData,&DataPos); //获取GPS接收状态
-
- TmpStr1 = GetString(ReceData,&DataPos); //获取GPS接收纬度
-
- if(!TmpStr1.IsEmpty())
- {
- *strLatitude = TmpStr1;
- }
- else
- {
- return false;
- }
- TmpStr1 = GetString(ReceData,&DataPos); //获取GPS接收 南北方向
-
- TmpStr1 = GetString(ReceData,&DataPos); //获取GPS接收经度
- if(!TmpStr1.IsEmpty())
- {
- if(TmpStr1.GetLength() >9)
- *strLongitude = TmpStr1;
- }
- else
- {
- return false;
- }
- }
- return true;
- }
- ///get string
- CString CProcSM::GetString(char *pData, int *pos)
- {
- BYTE i = 0;
- char ArrStr[20];
- CString RetStr;
- RetStr = "";
- while (pData[*pos] != ',') {
- ArrStr[i] = pData[*pos];
- i++; (*pos)++;
- if(i == 20){
- return RetStr;
- }
- }
- ArrStr[i] = 0;
- (*pos)++;
- RetStr = ArrStr;
- return RetStr;
- }
- //congstruct the message whitch to be send to the vehicle and then send it to the vehicle;
- void CProcSM::SetMessageType(CString strVehicleNumber, CString strSMConttent)
- {
- CString str2Send("");
- if(!m_bWaveComInite)
- {
- AfxMessageBox("电话系统没有初始化,请初始化电话系统!");
- return;
- }
- str2Send = ConstructSendstr("AT+CMGS=",strVehicleNumber,strSMConttent);
-
- if(str2Send != "")
- {
- strToBeWriteToComm = str2Send ;
- }
- str2Send = "";
- }
- //begin the thread
- void CProcSM::BeginThread()
- {
- ::AfxBeginThread(WriteThread,this);
- ::AfxBeginThread(ProcessThread,this);
- }
- //set the doc prointer
- void CProcSM::SetDocPointer(CGpsSCDoc *pDoc)
- {
- m_pDoc = pDoc;
- }
- void CProcSM::WriteToFile(CString FileName,CString sInfo)
- {
- CFile f;
-
- if(!f.Open(FileName,CFile::modeReadWrite,NULL)) {
- if(!f.Open(FileName,CFile::modeCreate | CFile::modeReadWrite,NULL)) {
- AfxMessageBox("open file error!");
- return;
- }
- }
- f.SeekToEnd();
- CString s;
- s.Format("%s%c%c",sInfo,'r','n');
- f.Write(s,s.GetLength());
- f.Close();
- }
- //simulater the driver
- void CProcSM::SimulatorDriver()
- {
- CDiverNumberDlg numberdlg;
- CString strToSend("");
- numberdlg.m_strDriverNumber = m_strDriverNumber;
- if(numberdlg.DoModal() == IDOK)
- {
- int a =AfxMessageBox("确实要设定车主电话吗?",MB_YESNO);
- if(a = IDYES)
- {
- m_strDriverNumber.Empty();
- m_strDriverNumber = numberdlg.m_strDriverNumber;
- strToSend = SETHOSTTELNO;
- strToSend += m_strDriverNumber;
- strToSend += "#";
- SetMessageType(m_sVehicleNumber,strToSend);
- }
-
- }
- }
- //change the la and lt
- void CProcSM::ChangLGAndLt(CString &strLongitude,CString &strLatitude,CString &strVehicleNO,CString &strTelNumber)
- {
- ((CGpsSCView *)m_pView)->SendGXGY(strLongitude, strLatitude,strVehicleNO,strTelNumber);
- }
- //systerm inite
- BOOL CProcSM::SystermInite(void * pView)
- {
- CRect rect;
- m_pView = (CGpsSCView *)pView;
-
- CSysIniteDlg *pdlg = new CSysIniteDlg();
- pdlg->Create(IDD_SYSINITEDLG,NULL);
- pdlg->ShowWindow(SW_SHOW);
- pdlg->CenterWindow(NULL);
- pdlg->m_strIniteText = "正在初始化系统,可能需要较长时间,请等待......";
- pdlg->UpdateData(FALSE);
- SetStr2Send(WAVECOMINITETEXT);
- SleepEx(1000,TRUE);
- SetStr2Send("AT+CMGD=1r");
- pdlg->m_strIniteText = "还剩余12秒......";
- pdlg->UpdateData(FALSE);
-
- SleepEx(1000,TRUE);
-
- SetStr2Send("AT+CMGD=2r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余11秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=3r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余10秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=4r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余9秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=5r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余8秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=6r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余7秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=7r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余6秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=8r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余5秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=9r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余4秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=10r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余3秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=11r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余2秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=12r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余1秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=13r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余1秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=14r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余1秒......";
- pdlg->UpdateData(FALSE);
- SetStr2Send("AT+CMGD=15r");
- SleepEx(1000,TRUE);
- pdlg->m_strIniteText = "还剩余1秒......";
- pdlg->UpdateData(FALSE);
-
- pdlg->ShowWindow(SW_HIDE);
- pdlg->CloseWindow();
- pdlg->DestroyWindow();
- m_bSysTemInit = TRUE;
- return TRUE;
- }
- void CProcSM::OnGetvehicleposition(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- SetMessageType(m_sVehicleNumber,GETPOSITION);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- SetMessageType(m_sVehicleNumber,GETPOSITION);
- m_sGetPositionCar = m_sVehicleNumber;
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- SetMessageType(m_sVehicleNumber,GETPOSITION);
- m_sGetPositionCar = m_sVehicleNumber;
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += GETPOSITION;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- m_sGetPositionCar = m_sVehicleNumber;
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += GETPOSITION;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- m_sGetPositionCar = m_sVehicleNumber;
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += GETPOSITION;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- m_sGetPositionCar = m_sVehicleNumber;
- }
- }
- }
- //set the lock
- void CProcSM::OnSetlock(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- SetMessageType(m_sVehicleNumber,SETLOCK);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- SetMessageType(m_sVehicleNumber,SETLOCK);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- SetMessageType(m_sVehicleNumber,SETLOCK);
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += SETLOCK;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += SETLOCK;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += SETLOCK;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- }
- //shut down oil
- void CProcSM::OnShutoil(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- SetMessageType(m_sVehicleNumber,SHUTOIL);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- SetMessageType(m_sVehicleNumber,SHUTOIL);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- SetMessageType(m_sVehicleNumber,SHUTOIL);
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += SHUTOIL;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += SHUTOIL;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += SHUTOIL;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- }
- //open the lock
- void CProcSM::OnOpenlock(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- CString Str;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0) {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,OPENLOCK);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,OPENLOCK);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,OPENLOCK);
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += OPENLOCK;
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += OPENLOCK;
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += OPENLOCK;
- Str.Format("确定要对 % s解锁吗?",m_sVehicleNumber);
- if(AfxMessageBox(Str,MB_YESNO) == IDNO) return;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- }
- //as normal user change the normal user password
- void CProcSM::HoseChangePassWord()
- {
- CComUserDlg dlg;
- CString strPassOriginal;
- dlg.m_strPassWordOriginal = "123456";
- dlg.m_strCommUserPassWord = "123456";
- CString m_strToSend = "";
- if(dlg.DoModal() == IDOK)
- {
- strPassOriginal = dlg.m_strPassWordOriginal;
- strCommonUserPassWord.Empty();
- m_sVehicleNumber.Empty();
- m_sVehicleNumber = dlg.m_strVehicleTelno;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- strCommonUserPassWord = dlg.m_strCommUserPassWord;
- int a =AfxMessageBox("普通用户密码设定为:"+ strCommonUserPassWord+ " 确定吗?",MB_YESNO);
- if(a == IDYES)
- {
- m_strToSend = strPassOriginal+USERCHANGEPASS+strCommonUserPassWord+"#";
- SetMessageType(m_sVehicleNumber,m_strToSend);
- }
- }
- }
- void CProcSM::SelectUserType()
- {
- CUserTypeDlg dlg(m_nUserType);
- if(dlg.DoModal() == IDOK) {
- m_nUserType = dlg.m_nUserType;
- }
- }
- //the center auto monitor the vehicle
- void CProcSM::AutoMonitor(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CChooseTimeDlg TimeDlg;
- CMonitorDlg dlg;
- CString strToSend;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- strToSend = AUTOMONITOR;
- strToSend += dlg.m_strMonitorTimeSpan;
- strToSend += '#';
-
- SetMessageType(m_sVehicleNumber,strToSend);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- else {
- if(TimeDlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- strToSend = AUTOMONITOR;
- strToSend += TimeDlg.m_strMonitorTimeSpan;
- strToSend += '#';
-
- SetMessageType(m_sVehicleNumber,strToSend);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- }
- else {
- CClientinfoSet cSet;
- if(TimeDlg.DoModal() == IDCANCEL) return;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- strToSend = AUTOMONITOR;
- strToSend += TimeDlg.m_strMonitorTimeSpan;
- strToSend += '#';
-
- SetMessageType(m_sVehicleNumber,strToSend);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += AUTOMONITOR;
- m_strPassWord += dlg.m_strMonitorTimeSpan;
- m_strPassWord += '#';
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- else {
- if(TimeDlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += AUTOMONITOR;
- m_strPassWord += TimeDlg.m_strMonitorTimeSpan;
- m_strPassWord += '#';
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- }
- else {
- CClientinfoSet cSet;
- if(TimeDlg.DoModal() == IDCANCEL) return;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += AUTOMONITOR;
- m_strPassWord += TimeDlg.m_strMonitorTimeSpan;
- m_strPassWord += '#';
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- if(!m_sCurrMonitorCar.IsEmpty()) {
- m_sCurrMonitorCar = m_sVehicleNumber;
- }
- }
- }
- }
- //取消监控
- void CProcSM::CanceLautoMonitor(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- CString sVehicleNumber;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- SetMessageType(m_sVehicleNumber,CANCELAUTOMONITOR);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- SetMessageType(m_sVehicleNumber,CANCELAUTOMONITOR);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,sVehicleNumber,m_strPassWord);
- SetMessageType(sVehicleNumber,CANCELAUTOMONITOR);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += CANCELAUTOMONITOR;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += CANCELAUTOMONITOR;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,sVehicleNumber,m_strPassWord);
- m_strPassWord += CANCELAUTOMONITOR;
- SetMessageType(sVehicleNumber,m_strPassWord);
- if(m_sCurrMonitorCar == strItemText) {
- m_sCurrMonitorCar.Empty();
- }
- }
- }
- }
- void CProcSM::GetHelp(CString strItemText)
- {
- CMainFrame *pMainFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- CDlgAsCenterDlg dlg;
- bool Flag;
- if(pMainFrame == NULL) return;
- Flag = pMainFrame->m_wndTree1.GetCarPhoneAndPassword();
- if(m_nUserType == 0)
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- SetMessageType(m_sVehicleNumber,GETHELP);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- SetMessageType(m_sVehicleNumber,GETHELP);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- SetMessageType(m_sVehicleNumber,GETHELP);
- }
- }
- else
- {
- if(strItemText.IsEmpty()) {
- if(!Flag) {
- if(dlg.DoModal() == IDCANCEL) return;
- CClientinfoSet cSet;
- m_sVehicleNumber = dlg.m_strVehicleNo;
- m_sVehicleNumber = m_sVehicleNumber.Right(11);
- m_strPassWord = cSet.GetPassword(m_sVehicleNumber);
- m_strPassWord += GETHELP;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- else {
- m_sVehicleNumber = pMainFrame->m_wndTree1.m_strCarPhone;
- m_strPassWord = pMainFrame->m_wndTree1.m_strPassWord;
- m_strPassWord += GETHELP;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- else {
- CClientinfoSet cSet;
- cSet.FindCarPswAndNO(strItemText,m_sVehicleNumber,m_strPassWord);
- m_strPassWord += GETHELP;
- SetMessageType(m_sVehicleNumber,m_strPassWord);
- }
- }
- }
- BOOL CProcSM::CheckMonitorCar()
- {
- if(m_sCurrMonitorCar.IsEmpty()) return TRUE;
- return FALSE;
- }
- void CProcSM::SetMonitorCar(CString VehicleID)
- {
- m_sCurrMonitorCar = VehicleID;
- }
- WORD CProcSM::GetUnicodeFromTable(WORD wGB)
- {
- WORD wUnicode = 0;
- long i;
- for(i = 0; i < UnicodeTable_Len; i++) {
- if(wGB == UnicodeTable[i][0]) {
- wUnicode = UnicodeTable[i][1];
- break;
- }
- }
- return wUnicode;
- }
- WORD CProcSM::GetAnsiFromTable(WORD lTemp)
- {
- WORD wAnsi = 0;
- long i;
- for(i = 0; i < UnicodeTable_Len; i++) {
- if(lTemp == UnicodeTable[i][1]) {
- wAnsi = UnicodeTable[i][0];
- break;
- }
- }
- return wAnsi;
- }
- CString CProcSM::AnsiStr2UnicodeStr(CString sAnsiStr)
- {
- CString sRet(""),Str;
- WORD w;
- BYTE Len,chr,pos = 0;
- Len = sAnsiStr.GetLength();
- while(pos < Len) {
- chr = (BYTE)sAnsiStr.GetAt(pos);
- if(chr < 0x80) { //作ASCII处理
- w = (WORD)chr;
- pos++;
- }
- else { //作汉字处理
- w = (WORD)((chr << 8) + (BYTE)sAnsiStr.GetAt(pos + 1));
- w -= 0x8080;
- w = GetUnicodeFromTable(w);
- pos += 2;
- if(w == 0) {
- continue;
- }
- }
- Str.Format("%04x",w);
- sRet += Str;
- }
- return sRet;
- }
- CString CProcSM::UnicodeStr2AnsiStr(CString UnicodeStr)
- {
- CString sRet(""),Str;
- BYTE Len,i;
- BYTE arr[3];
- WORD lTemp;
- arr[2] = 0;
- Len = UnicodeStr.GetLength();
- for(i = 0; i < Len; i += 4) {
- Str = GetLenStr(UnicodeStr,i,4);
- lTemp = (WORD)LongNEtoLong(Str);
- if(lTemp < 0x80) {
- Str.Format("%c",lTemp);
- }
- else {
- lTemp = GetAnsiFromTable(lTemp);
- lTemp += 0x8080;
- arr[1] = (BYTE)(lTemp & 0x00ff);
- arr[0] = (BYTE)(lTemp >> 8);
- Str = arr;
- }
- sRet += Str;
- }
- return sRet;
- }
- long CProcSM::LongNEtoLong(CString LongNE)
- {
- CString TmpStr;
- BYTE j,Len,tmp,Count = 0;
- long Ret = 0,lTmp;
- char i,chr;
- LongNE = "0x" + LongNE;
- Len = LongNE.GetLength();
- if(Len <= 2) return Ret;
- LongNE = LongNE.Right(Len - 2);
- for(i = Len - 2 - 1; i > -1; i--) {
- chr = LongNE.GetAt(i);
- tmp = CharToNum(chr);
- for(lTmp = 1,j = 0; j < Count; j++){
- lTmp *= 16;
- }
- Ret += (tmp * lTmp);
- Count++;
- }
- return Ret;
- }
- BYTE CProcSM::CharToNum(char chr)
- {
- BYTE Ret = 0;
- switch(chr) {
- case 'A':
- case 'a':
- Ret = 10;
- break;
- case 'B':
- case 'b':
- Ret = 11;
- break;
- case 'C':
- case 'c':
- Ret = 12;
- break;
- case 'D':
- case 'd':
- Ret = 13;
- break;
- case 'E':
- case 'e':
- Ret = 14;
- break;
- case 'F':
- case 'f':
- Ret = 15;
- break;
- default:
- Ret = (BYTE)(chr - '0');
- }
- return Ret;
- }
- void CProcSM::DeleteTheMonitorVehicle(CString sVehicleID)
- {
- POSITION pos,SavePos;
- CString sVehicle;
- pos = m_lCurrMonitorVehicle.GetHeadPosition();
- while(pos != NULL) {
- SavePos = pos;
- sVehicle = m_lCurrMonitorVehicle.GetNext(pos);
- if(sVehicle == sVehicleID) {
- m_lCurrMonitorVehicle.RemoveAt(SavePos);
- // CMainFrame *pMainFrm = (CMainFrame*)AfxGetApp()->m_pMainWnd;
- // pMainFrm->EditTreeItem(sVehicleID,false);
- break;
- }
- }
- }
- void CProcSM::AddTheMonitorVehicle(CString sVehicleID)
- {
- if(sVehicleID.IsEmpty()) return;
- POSITION pos;
- CString sVehicle;
- pos = m_lCurrMonitorVehicle.GetTailPosition();
- while(pos != NULL) {
- sVehicle = m_lCurrMonitorVehicle.GetPrev(pos);
- if(sVehicle == sVehicleID) {
- return;
- }
- }
- m_lCurrMonitorVehicle.AddHead(sVehicleID);
- // CMainFrame *pMainFrm = (CMainFrame*)AfxGetApp()->m_pMainWnd;
- // pMainFrm->EditTreeItem(sVehicleID,true);
- }
- bool CProcSM::CheckVehicleMonitorNow(CString sVehicleID)
- {
- if(m_lCurrMonitorVehicle.GetCount() == 0) {
- AddTheMonitorVehicle(sVehicleID);
- return true;
- }
- POSITION pos;
- CString sVehicle;
- pos = m_lCurrMonitorVehicle.GetHeadPosition();
- while(pos != NULL) {
- sVehicle = m_lCurrMonitorVehicle.GetNext(pos);
- if(sVehicle == sVehicleID) {
- return true;
- }
- }
- return false;
- }