Garmin Fleet Management Controller  2.19.0
CCdtPingDlg.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * HEADER NAME:
4 * CCdtPingDlg.h
5 *
6 * Copyright 2014 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #pragma once
11 
12 #include "FmiApplicationLayer.h"
13 #include "CWndEventListener.h"
14 #include <afxtempl.h>
15 #include "afxcmn.h"
16 
17 #if( CDT_SUPPORT )
18 
19 //----------------------------------------------------------------------
24 //----------------------------------------------------------------------
25 class CdtPingTestPacket
26 {
27 public:
28  CdtPingTestPacket( UINT payloadSize );
29 
30  virtual ~CdtPingTestPacket();
31 
32  const DWORD GetId() const { return mId; }
33  const uint8 * GetPayload() const { return mPayload; }
34  const uint8 GetPayloadSize() const { return mPayloadSize; }
35 
36  void CompareResponse( DWORD respondedOn, const uint8 rightSize, const uint8 * right );
37  const BOOL IsResponded() const { return mRespondedOn != 0; }
38  const BOOL IsResponseMatched() const { return mResponseMatched; }
39  int GetElapsedTimeMillis();
40 
41 protected:
42  DWORD mId;
43  uint8 mPayloadSize;
44  uint8 mPayload[ 254 ];
45  DWORD mRespondedOn;
46  BOOL mResponseMatched;
47 
48 };
49 
50 // CCdtPingDlg dialog
51 
52 //----------------------------------------------------------------------
55 //----------------------------------------------------------------------
56 class CCdtPingDlg : public CDialog, public CWndEventListener
57 {
58  DECLARE_DYNAMIC(CCdtPingDlg)
59 
60 public:
61  CCdtPingDlg(
62  CWnd* pParent,
63  FmiApplicationLayer & aCom
64  );
65  virtual ~CCdtPingDlg();
66 
67 // Dialog Data
68  enum { IDD = IDD_CDT_PING };
69 
70 protected:
71  virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
72 
73  DECLARE_MESSAGE_MAP()
74 
75  BOOL OnInitDialog();
76 
77  afx_msg void OnTimer( UINT aTimerId );
78 
79  afx_msg LRESULT OnCDTPingReceived( WPARAM, LPARAM );
80 
81  void setStarted( BOOL started );
82 
84  FmiApplicationLayer& mCom;
85 
86  // loop state
87  UINT mTimer;
88  UINT mIteration;
89 
90  // results
91  CArray<CdtPingTestPacket*,CdtPingTestPacket*> mResults;
92 
93  // loop control parameters
94  UINT mInterval;
95  UINT mPayloadSize;
96  UINT mRepeatIterations;
97  afx_msg void OnBnClickedToggleProcess();
98 public:
99  BOOL mRepeatFixed;
100  CListCtrl mResultsView;
101  afx_msg void OnBnClickedClearResults();
102  BOOL mClearOnStart;
103  };
104 
105 #endif
#define IDD_CDT_PING
Definition: resource.h:61
Serial communication controller for Garmin and FMI packets.
EventListener that dispatches a Windows message.
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62