gpstestview.h
来自「广宇GPS系统」· C头文件 代码 · 共 216 行
H
216 行
// GpsTestView.h : interface of the CGpsTestView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_GPSTESTVIEW_H__5F112388_B2FA_4CC5_A442_A9AF60F9D680__INCLUDED_)
#define AFX_GPSTESTVIEW_H__5F112388_B2FA_4CC5_A442_A9AF60F9D680__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "MapX.h"
#include "motog18.h"
#include "Car.h"
#include "UdpSocket.h"
//-----------------------------------------------
#define TIMER_SENDSMS 1
#define TIMER_FLASH 2
#define TIMER_CHECKCAR 3
#define SHORT_STRING 8
#define MIDDLE_STRING 16
#define LONG_STRING 32
#define WM_RECVDATA WM_USER+500
typedef struct {
long nLatitude; /*纬度*/
long nLongitude; /*经度*/
int nSpeed; /*速度*/
short nCourse; /*角度*/
char strStatus[MIDDLE_STRING]; /*状态*/
}sms_content;
typedef struct {
char header[SHORT_STRING]; /*短消息命令头*/
char smssn[MIDDLE_STRING]; /*短消息序列号*/
char cmdword[SHORT_STRING]; /*短消息命令字*/
char y_m_d[SHORT_STRING]; /*发送日期*/
char h_m_s[SHORT_STRING]; /*发送时间*/
char cmdpara1[MIDDLE_STRING]; /*命令字参数1*/
char cmdpara2[MIDDLE_STRING]; /*命令字参数2*/
}sms_info;
class CGpsTestView : public CView
{
protected: // create from serialization only
CGpsTestView();
DECLARE_DYNCREATE(CGpsTestView)
// Attributes
public:
CGpsTestDoc* GetDocument();
// Operations
public:
CMotoG18 *m_pMotoG18;
void GetCommPort(void);
void SetCenterNum();
void GetCenterNum();
void SetSmsContent();
void GetSmsContent();
void SetAlarmStatus();
void GetAlarmStatus();
int StrtoHex(CString str);
void AnalyseSms(sms_info *smsinfo, LPCTSTR str);
CString GetData(LPCTSTR str, int index);
CArray <sms_content*, sms_content*>m_smsArray;
CArray <sms_content*, sms_content*>m_smsRunArray;
CArray <CCar*, CCar*>m_carArray;
int SendReplaySms(CString strSN, CString strCmdWord, BOOL bAlarm, int nCount=-1, int nInterval=0);
int SendSms();
int CheckStatus(int nPointNum);
int CreatePathLine();
void ErasePathLine();
void EraseFlashPoint();
void PointFlash(int nPointNum);
int CarAlarm();
int GetCarInfo();
int CreateCarArray();
int SendUdpData(char *buf, int len);
int DealWithUdpData(char *cMobileNum, char *cMessage);
int FillUdpPacket(char *destbuff, LPCTSTR strMobileNum, LPCTSTR strMessage);
int SendCarData(CString strMobileNum, CString strMessage);
CString CreateMessage(CCar *car, CString strSN, CString strCmdWord, BOOL bAlarm);
int SendDwData(CCar *car);
BOOL m_bIsRuning;
HANDLE m_hPathThread;
DWORD m_dwPathThread;
static DWORD WINAPI PathRunThreadEntry(LPVOID lpParam);
int PathThreadProc();
int ExitPathThread();
BOOL m_bCarIsRuning;
HANDLE m_hCarThread;
DWORD m_dwCarThread;
static DWORD WINAPI CarRunThreadEntry(LPVOID lpParam);
int CarThreadProc();
int ExitCarThread();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGpsTestView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
protected:
CMapX m_ctrlMapX;
double MapX;
double MapY;
double dFirstX;
double dFirstY;
int nCommPort;
int nCommRate;
BOOL m_bModemSel;
CString m_strCenterNum;
CString m_strStatus;
CString m_strAlarmStatus;
CString m_strAstatus;
BOOL m_bRButtonClick;
BOOL m_bBackSpaceDown;
float fFirstx;
float fFirsty;
int nCurrentPointNum;
int nTimerSendSms;
int nTimerFlash;
int nTimerCheckCar;
BOOL m_bContinue;
BOOL m_bDrowPoint;
BOOL m_bRecvQJ;
DWORD m_dwBStart;
int m_nCarNum;
CString m_strCarPhoneNum;
CString m_strServer;
CString m_strServerPort;
CString m_strLocal;
CString m_strLocalPort;
private:
CString m_strDwSN;
CString m_strCmdWord;
CString m_strDwInterval;
CString m_strDwCount;
CMapXFeature ft;
// CMapXFeature ftr;
CUdpSocket udpSerSocket;
// char cRecvbuf[1024];
int ServerSocket;
CUdpSocket udpCliSocket;
// char cSendbuf[1024];
int ClientSocket;
// Implementation
public:
virtual ~CGpsTestView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CGpsTestView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMapToolArrow();
afx_msg void OnMapToolPan();
afx_msg void OnMapToolZoomin();
afx_msg void OnMapToolZoomout();
afx_msg void OnButtonComset();
afx_msg void OnButtonStart();
afx_msg void OnButtonStop();
afx_msg void OnMapToolPoint();
afx_msg void OnButtonPathrun();
afx_msg void OnButtonPathstop();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnMouseMoveMap(short Button, short Shift, float X, float Y);
afx_msg void OnMouseDownMap(short Button, short Shift, float X, float Y);
afx_msg void OnRecvSmsMotog18ctrl(LPCTSTR SmsSender, LPCTSTR SmsContent, DATE RecvDate);
afx_msg void OnAddFeatureToolUsed(short ToolNum, long Flags, LPDISPATCH Points, BOOL bShift, BOOL bCtrl, BOOL FAR* EnableDefault);
afx_msg void OnKeyDownMap(short FAR* KeyCode, short Shift);
afx_msg void OnClickMap();
afx_msg void OnDblClickMap();
afx_msg void OnButtonCarset();
afx_msg void OnButtonSimulite();
afx_msg void OnButtonUnsimulite();
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
afx_msg int AnalyseUdpData(WPARAM wParam, LPARAM lParam);
};
#ifndef _DEBUG // debug version in GpsTestView.cpp
inline CGpsTestDoc* CGpsTestView::GetDocument()
{ return (CGpsTestDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GPSTESTVIEW_H__5F112388_B2FA_4CC5_A442_A9AF60F9D680__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?