MonitorDlg.cpp
上传用户:pumpssky
上传日期:2007-12-07
资源大小:110k
文件大小:3k
- // MonitorDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "gmark.h"
- #include "MonitorDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMonitorDlg dialog
- CMonitorDlg::CMonitorDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMonitorDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CMonitorDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CMonitorDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMonitorDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CMonitorDlg, CDialog)
- //{{AFX_MSG_MAP(CMonitorDlg)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMonitorDlg message handlers
- void CMonitorDlg::UpdateGpsData(GPS_DATA *gpsData)
- {
- TCHAR sTemp[100];
- /************ Longitude ****************************/
- swprintf(sTemp, _T("%f"), gpsData->Longitude);
- SetDlgItemText(IDC_EDIT_LON, sTemp);
- swprintf(sTemp, _T("%d"), gpsData->LonDeg);
- SetDlgItemText(IDC_EDIT_LON_DEG, sTemp);
- swprintf(sTemp, _T("%d"), gpsData->LonMin);
- SetDlgItemText(IDC_EDIT_LON_MIN, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->LonSec);
- SetDlgItemText(IDC_EDIT_LON_SEC, sTemp);
- /************ Latitude ****************************/
- swprintf(sTemp, _T("%f"), gpsData->Latitude);
- SetDlgItemText(IDC_EDIT_LAT, sTemp);
- swprintf(sTemp, _T("%d"), gpsData->LatDeg);
- SetDlgItemText(IDC_EDIT_LAT_DEG, sTemp);
- swprintf(sTemp, _T("%d"), gpsData->LatMin);
- SetDlgItemText(IDC_EDIT_LAT_MIN, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->LatSec);
- SetDlgItemText(IDC_EDIT_LAT_SEC, sTemp);
- /************ number of satellites ***************/
- swprintf(sTemp, _T("%d"), gpsData->SatCount);
- SetDlgItemText(IDC_EDIT_SATNUM, sTemp);
- /************ mode of position *******************/
- swprintf(sTemp, _T("%d"), gpsData->Status);
- SetDlgItemText(IDC_EDIT_STATUS, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->X);
- SetDlgItemText(IDC_EDIT_X, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->Y);
- SetDlgItemText(IDC_EDIT_Y, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->PDOP);
- SetDlgItemText(IDC_EDIT_PDOP, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->HDOP);
- SetDlgItemText(IDC_EDIT_HDOP, sTemp);
- swprintf(sTemp, _T("%f"), gpsData->VDOP);
- SetDlgItemText(IDC_EDIT_VDOP, sTemp);
- }
- void CMonitorDlg::UpdateGpsMsg(const char *msg)
- {
- TCHAR wBuff[GPS_MAX_NEMASIZE+1];
- // Convert from MultiByte to UNICODE
- mbstowcs(wBuff, msg, GPS_MAX_NEMASIZE);
- // Display the received data
- AddText2Edit( IDC_EDIT_GPSMSG, wBuff );
- }
- void CMonitorDlg::UpdateRtcmData(const char *rtcm)
- {
- TCHAR wBuff[GPS_MAX_NEMASIZE+1];
- // Convert from MultiByte to UNICODE
- mbstowcs(wBuff, rtcm, GPS_MAX_NEMASIZE);
- SetDlgItemText( IDC_EDIT_RECV, wBuff );
- }
- void CMonitorDlg::AddText2Edit(int idc, LPCTSTR text)
- {
- CString szText;
- CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT_GPSMSG);
- GetDlgItemText(IDC_EDIT_GPSMSG, szText);
- szText += text;
- SetDlgItemText(IDC_EDIT_GPSMSG, szText);
- int nCount = pEdit->GetLineCount();
- if(nCount>6)
- {
- SetDlgItemText(IDC_EDIT_GPSMSG, text);
- }
- }