#pragma once // CDialogFactCfg 对话框 class CMTerm2Doc; class CDialogFactCfg : public CDialogEx { DECLARE_DYNAMIC(CDialogFactCfg) public: CDialogFactCfg(CWnd* pParent = nullptr); // 标准构造函数 virtual ~CDialogFactCfg(); // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DIALOG_FACT_CFG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: enum DataItemType { typeINT, typeUINT, typeHEX, typeBIN, typeFLOAT, typeFIX, typeBIT, typeString, typeDATE, typeTIME, typeDATETIME, }; typedef struct tagDataItemDef { int nOffset; int nSize; int nType; CString sName; }stDataItemDef; typedef struct tagFactoryData //工厂量产参数数据。 { USHORT Sign1; USHORT Seq1; USHORT nModelNo; USHORT nModelVer; UCHAR LOT_NO[16]; // UINT nProductDateTime; UINT SN1; unsigned int nProtocalVer; unsigned int nLotNo; unsigned int nDefaultFunc; char ModelStr[16]; char SNStr[16]; unsigned short CRC1; unsigned short EndSign1; }stFactoryData, *pFactoryData; stDataItemDef FactoryDataItems[50]; int nFactoryDataItemsCount = 0; int AddDataItem(int nOffset, int nSize, int nType, CString sName); int InitDataItems(); int Connect(); int Disconnect(); int ReadData(); afx_msg void OnBnClickedButtonConn(); afx_msg void OnBnClickedButtonDisconn(); afx_msg void OnBnClickedButtonWritedata(); afx_msg void OnBnClickedButtonReaddata(); afx_msg void OnBnClickedBtn1(); afx_msg void OnBnClickedBtn3(); afx_msg void OnBnClickedBtn4(); afx_msg void OnBnClickedBtn5(); afx_msg void OnBnClickedBtnClear(); afx_msg void OnBnClickedBtnAdd(); afx_msg void OnBnClickedBtnBackSpace(); int WriteData(); CMTerm2Doc * GetDocument(); int FindIdByName(CString sName); int GetDataByOffset(void * pDataBlock, int nOffset); int GetDataByName(void * pDataBlock, CString sName); CString GetDataStrByName(void * pDataBlock, CString sName); int SetDataByName(void * pDataBlock, CString sName, UINT uValue); int SetDataByName(void * pDataBlock, CString sName, CString sValue); int CharKeyClick(CString sKey); afx_msg void OnBnClickedButton0(); afx_msg void OnBnClickedButton1Dot(); afx_msg void OnBnClickedButtonEq(); };