提交 | 用户 | age
|
418cb3
|
1 |
#pragma once
|
Q |
2 |
|
|
3 |
|
|
4 |
// CDialogFactCfg 对话框
|
|
5 |
class CMTerm1Doc;
|
|
6 |
|
|
7 |
class CDialogFactCfg : public CDialogEx
|
|
8 |
{
|
|
9 |
DECLARE_DYNAMIC(CDialogFactCfg)
|
|
10 |
|
|
11 |
public:
|
|
12 |
CDialogFactCfg(CWnd* pParent = nullptr); // 标准构造函数
|
|
13 |
virtual ~CDialogFactCfg();
|
|
14 |
|
|
15 |
// 对话框数据
|
|
16 |
#ifdef AFX_DESIGN_TIME
|
|
17 |
enum { IDD = IDD_DIALOG_FACT_CFG };
|
|
18 |
#endif
|
|
19 |
|
|
20 |
protected:
|
|
21 |
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
22 |
|
|
23 |
DECLARE_MESSAGE_MAP()
|
|
24 |
public:
|
|
25 |
enum DataItemType
|
|
26 |
{
|
|
27 |
typeINT,
|
|
28 |
typeUINT,
|
|
29 |
typeHEX,
|
|
30 |
typeBIN,
|
|
31 |
typeFLOAT,
|
|
32 |
typeFIX,
|
|
33 |
typeBIT,
|
|
34 |
typeString,
|
|
35 |
typeDATE,
|
|
36 |
typeTIME,
|
|
37 |
typeDATETIME,
|
|
38 |
|
|
39 |
};
|
|
40 |
typedef struct tagDataItemDef
|
|
41 |
{
|
|
42 |
int nOffset;
|
|
43 |
int nSize;
|
|
44 |
int nType;
|
|
45 |
CString sName;
|
|
46 |
}stDataItemDef;
|
|
47 |
|
|
48 |
typedef struct tagFactoryData //工厂量产参数数据。
|
|
49 |
{
|
|
50 |
USHORT Sign1;
|
|
51 |
USHORT Seq1;
|
|
52 |
USHORT nModelNo;
|
|
53 |
USHORT nModelVer;
|
|
54 |
UCHAR LOT_NO[16]; //
|
|
55 |
UINT nProductDateTime;
|
|
56 |
UINT SN1;
|
|
57 |
unsigned int nProtocalVer;
|
|
58 |
unsigned int nLotNo;
|
|
59 |
unsigned int nDefaultFunc;
|
|
60 |
char ModelStr[16];
|
|
61 |
char SNStr[16];
|
|
62 |
unsigned short CRC1;
|
|
63 |
unsigned short EndSign1;
|
|
64 |
|
|
65 |
}stFactoryData, *pFactoryData;
|
|
66 |
|
|
67 |
stDataItemDef FactoryDataItems[50];
|
|
68 |
int nFactoryDataItemsCount = 0;
|
|
69 |
|
|
70 |
int AddDataItem(int nOffset, int nSize, int nType, CString sName);
|
|
71 |
|
|
72 |
int InitDataItems();
|
|
73 |
|
|
74 |
int Connect();
|
|
75 |
int Disconnect();
|
|
76 |
int ReadData();
|
|
77 |
afx_msg void OnBnClickedButtonConn();
|
|
78 |
afx_msg void OnBnClickedButtonDisconn();
|
|
79 |
afx_msg void OnBnClickedButtonWritedata();
|
|
80 |
afx_msg void OnBnClickedButtonReaddata();
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
int WriteData();
|
|
86 |
CMTerm1Doc * GetDocument();
|
|
87 |
|
|
88 |
int FindIdByName(CString sName);
|
|
89 |
|
|
90 |
int GetDataByOffset(void * pDataBlock, int nOffset);
|
|
91 |
int GetDataByName(void * pDataBlock, CString sName);
|
|
92 |
|
|
93 |
CString GetDataStrByName(void * pDataBlock, CString sName);
|
|
94 |
|
|
95 |
int SetDataByName(void * pDataBlock, CString sName, UINT uValue);
|
|
96 |
int SetDataByName(void * pDataBlock, CString sName, CString sValue);
|
|
97 |
|
|
98 |
};
|