123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
-
- // TCL ToolsDlg.h: 头文件
- //
- #pragma once
- #include "SubLabel.h"
- #include "BtnST.h"
- #include "CritSection.h"
- #define STATUS_DEFAULT_COLOR RGB(128, 64, 64)
- #define STATUS_WARN_COLOR RGB(255, 64, 64)
- #define STATUS_ERROR_COLOR RGB(255, 0, 0)
- #define STATUS_OK_COLOR RGB(34, 177, 76)
- // 默认文本色;
- #define BLACK_TEXT_COLOR RGB(0, 0, 0)
- #define DEFAULT_TEXT_COLOR RGB(0, 0, 0)
- #define NORMAL_TEXT_COLOR RGB(0, 0, 255)
- #define OK_TEXT_COLOR RGB(0, 255, 0)
- #define WARN_TEXT_COLOR RGB(255, 64, 64)
- // 默认背景色;
- #define DEFAULT_BG_COLOR RGB(155, 194, 230)
- // 对话框颜色 ;
- #define DEFAULT_DLG_COLOR RGB(239,228,176)
- // 消息;
- #define WM_GET_ORDERNUM (WM_USER + 1)
- #define WM_GET_BARCODE (WM_USER + 3)
- // 白平衡数据定义
- #define WB_OFFSET 0x100 // 冷暖色温偏移量计算
- enum { R = 0, G, B, WB_MAX }; // R/G/B通道定义
- ////////////////////////////////////////////////////////////////////////
- //enum LOG_ENUM
- //{
- // NORMAL_LOG = 0,
- // ERROR_LOG,
- // OK_LOG,
- // INFO_LOG
- //};
- // CTCLCopyToolDlg 对话框
- class CTCLCopyToolDlg : public CDialogEx
- {
- // 构造
- public:
- CTCLCopyToolDlg(CWnd* pParent = nullptr); // 标准构造函数
- // 对话框数据
- #ifdef AFX_DESIGN_TIME
- enum { IDD = IDD_TCLCOPYTOOL_DIALOG };
- #endif
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
- public:
- BOOL m_bRunning;
- CRect m_rcWind;
- DWORD m_dwTickCount;
- Global::TChassis* m_pCurChassis;
- std::vector<std::string> m_vtCOM;
- void InitCtrl();
- void InitColumn();
- void InitCombobox_port();
- void InitCombobox_baudrate();
- void InitCombobox_Chassis();
- void InitKeyCountLabel();
- void InitWriteStatusLabel();
- void InitReadStatusLabel();
- void InitCheckStatusLabel();
- void RetSetSiacpStatus();
- BOOL IsPortInserted(LPCTSTR lpPort);
- void EnableChassisCheckbox();
- void UpdateKeyCount(BOOL bUseThread = TRUE);
- void SetLabelKeyCount(std::string count, CLabel *pLabel);
- void SetLabelKeyCount(std::string key_type, int mode = 0);
- void UpdateChassisCheckBoxStatus();
- void SaveChange2Config();
- void UpdateAutoOnlineMode();
- void RetSetChassisCheckBox();
- void SetLabelResult(int nStatus = -1, BOOL bWriteLog = FALSE);
- void SetSiacpStatus(CLabel& label, BOOL bOK = TRUE);
- void SetWindowTitle(std::string client_type);
- std::string GetFileCount(std::string key_type);
- BOOL ReadKeyFile(std::string dir, std::string& data);
- BOOL ReadKeyFile(std::string dir, std::string& data, std::string &file);
- // 串口操作;
- BOOL Siacp_MTKInit();
- BOOL Siacp_EnterFactoryMode();
- BOOL Siacp_GetClientType(std::string &client_type);
- BOOL Siacp_GetSofteVersion(std::string &soft_version);
- BOOL Siacp_SetProjectId();
- BOOL Siacp_GetProjectId();
- BOOL Siacp_SetWB();
- BOOL Siacp_SetChannel(std::string &channel);
- BOOL Siacp_GetChannel(std::string channel);
-
- BOOL Siacp_SetOSDLanguage(std::string& language);
- BOOL Siacp_GetOSDLanguage(std::string language);
-
- BOOL Siacp_SetShopLanguage(std::string& language);
- BOOL Siacp_GetShopLanguage(std::string language);
- BOOL Siacp_SetDeviceId(std::string &deviceid);
- BOOL Siacp_CheckDeviceId();
- BOOL Siacp_GetDeviceId(std::string deviceid);
- BOOL Siacp_SetMac(std::string &mac);
- BOOL Siacp_CheckMac();
- BOOL Siacp_GetMac(std::string mac);
- BOOL Siacp_SetHDCP(std::string& hdcp);
- BOOL Siacp_CheckHDCP();
- BOOL Siacp_GetHDCP(std::string hdcp);
- BOOL Siacp_SetHDCP22(std::string& hdcp22);
- BOOL Siacp_CheckHDCP22();
- BOOL Siacp_GetHDCP22(std::string hdcp22);
- BOOL Siacp_SetWidi(std::string& widi);
- BOOL Siacp_CheckWidi();
- BOOL Siacp_GetWidi(std::string widi);
- BOOL Siacp_SetWidevine(std::string& widevine);
- BOOL Siacp_CheckWidevine();
- BOOL Siacp_GetWidevine(std::string widevine);
- BOOL Siacp_SetESN(std::string& esn);
- BOOL Siacp_CheckESN();
- BOOL Siacp_GetESN(std::string esn);
- BOOL Siacp_SetCikey(std::string& cikey);
- BOOL Siacp_CheckCikey();
- BOOL Siacp_GetCikey(std::string cikey);
- std::vector<std::string> m_vt_key_files;
- inline void DeleteKeyFiles()
- {
- for ( auto file:m_vt_key_files)
- {
- DeleteFile(file.c_str());
- }
- m_vt_key_files.clear();
- }
- CHARFORMAT m_cf_normal;
- CHARFORMAT m_cf_error;
- CHARFORMAT m_cf_ok;
- CHARFORMAT m_cf_info;
- void InitLogCharFormat();
- inline void SetOptionLog(CString strLogs, LOG_ENUM logtype = NORMAL_LOG)
- {
- m_edit_log.SetSel(-1, -1);
- if ( logtype == NORMAL_LOG )
- m_edit_log.SetSelectionCharFormat(m_cf_normal);
- else if ( logtype == ERROR_LOG )
- m_edit_log.SetSelectionCharFormat(m_cf_error);
- else if (logtype == OK_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_ok);
- else if (logtype == INFO_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_info);
-
- if (strLogs.GetLength() > 59)
- strLogs = strLogs.Left(59) + _T("...\r");
- m_edit_log.ReplaceSel(strLogs);
- m_edit_log.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
- }
- inline void SetOptionLog(std::string strLogs, LOG_ENUM logtype = NORMAL_LOG)
- {
- m_edit_log.SetSel(-1, -1);
- if (logtype == NORMAL_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_normal);
- else if (logtype == ERROR_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_error);
- else if (logtype == OK_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_ok);
- else if (logtype == INFO_LOG)
- m_edit_log.SetSelectionCharFormat(m_cf_info);
-
- if (strLogs.size() > 59)
- strLogs = strLogs.substr(0, 59) + _T("...\r");
- m_edit_log.ReplaceSel(strLogs.c_str());
- m_edit_log.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
- }
- //////////////////////////////////////////////////////////////////////////
- #if 1
- BOOL m_bAutofocus;
- BOOL m_bGetBarCode;
- BOOL m_bGetOrderNum;
- HANDLE m_hThread;
- DWORD m_dwThreadId;
- static DWORD WINAPI ThreadGetMessage(LPVOID lpParam);
- #endif
- static HHOOK m_hHook;
- static LRESULT WINAPI CBTHookProc(long nCode, WPARAM wparam, LPARAM lparam);
- // 实现
- protected:
- HICON m_hIcon;
- // 生成的消息映射函数
- virtual BOOL OnInitDialog();
- afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
- DECLARE_MESSAGE_MAP()
- public:
- CString m_strLastBid;
- afx_msg void OnTimer(UINT_PTR nIDEvent);
- CComboBox m_cb_com;
- CComboBox m_cb_baudrate;
- CComboBox m_cb_mode;
- CComboBox m_cb_chassis;
- afx_msg void OnBnClickedHide();
- afx_msg void OnCbnSelchangeMode();
- // check box控件;
- CButton m_check_mtk_init;
- CButton m_check_wb_init;
- CButton m_check_pid;
- CButton m_check_channel;
- CButton m_check_osd_lang;
- CButton m_check_shop_lang;
- CButton m_check_did;
- CButton m_check_mac;
- CButton m_check_hdcp;
- CButton m_check_hdcp22;
- CButton m_check_widi;
- CButton m_check_widevine;
- CButton m_check_esn;
- CButton m_check_cikey;
- CButton m_check_wb_write;
- // combobox;
- CComboBox m_cb_channel;
- CComboBox m_cb_osd_lang;
- CComboBox m_cb_shop_lang;
- // 余量显示控件;
- CLabel m_lb_did_count;
- CLabel m_lb_mac_count;
- CLabel m_lb_hdcp_count;
- CLabel m_lb_hdcp22_count;
- CLabel m_lb_widi_count;
- CLabel m_lb_widevine_count;
- CLabel m_lb_esn_count;
- CLabel m_lb_cikey_count;
- // wb init;
- CLabel m_lb_wb_init;
- // 写状态控件;
- CLabel m_lb_wb_write;
- CLabel m_lb_pid_write;
- CLabel m_lb_channel_write;
- CLabel m_lb_osd_lang_write;
- CLabel m_lb_shop_lang_write;
-
- CLabel m_lb_did_write;
- CLabel m_lb_mac_write;
- CLabel m_lb_hdcp_write;
- CLabel m_lb_hdcp22_write;
- CLabel m_lb_widi_write;
- CLabel m_lb_widevine_write;
- CLabel m_lb_esn_write;
- CLabel m_lb_cikey_write;
- // check状态控件;
- CLabel m_lb_pid_check;
- CLabel m_lb_channel_check;
- CLabel m_lb_osd_lang_check;
- CLabel m_lb_shop_lang_check;
- CLabel m_lb_did_check;
- CLabel m_lb_mac_check;
- CLabel m_lb_hdcp_check;
- CLabel m_lb_hdcp22_check;
- CLabel m_lb_widi_check;
- CLabel m_lb_widevine_check;
- CLabel m_lb_esn_check;
- CLabel m_lb_cikey_check;
- // 读状态控件;
- CLabel m_lb_pid_read;
- CLabel m_lb_channel_read;
- CLabel m_lb_osd_lang_read;
- CLabel m_lb_shop_lang_read;
- CLabel m_lb_did_read;
- CLabel m_lb_mac_read;
- CLabel m_lb_hdcp_read;
- CLabel m_lb_hdcp22_read;
- CLabel m_lb_widi_read;
- CLabel m_lb_widevine_read;
- CLabel m_lb_esn_read;
- CLabel m_lb_cikey_read;
- afx_msg void OnCbnSelchangeChassis();
- CString m_str_pid; // 控件关联的pid值;
- afx_msg void OnBnClickedStart();
- CLabel m_lb_enter_factory_mode;
- CLabel m_lb_enter_factory_mode_status;
- // 列标题;
- CLabel m_lb_column_a1;
- CLabel m_lb_column_a2;
- CLabel m_lb_column_a3;
- CLabel m_lb_column_a4;
- CLabel m_lb_column_a5;
-
- CLabel m_lb_column_b1;
- CLabel m_lb_column_b2;
- CLabel m_lb_column_b3;
- CLabel m_lb_column_b4;
- CLabel m_lb_column_b5;
- CLabel m_lb_result;// 结果;
- // 隐藏界面按钮;
- CButtonST m_btn_hide;
- // 条码;
- CString m_str_sn;
- // 批次号;
- CString m_str_bid;
- afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
- afx_msg void OnEnChangeSn();
- // wb内容;
- byte m_chWBNormalBuffer[WB_MAX];
- byte m_chWBWarmBuffer[WB_MAX];
- byte m_chWBCoolBuffer[WB_MAX];
- afx_msg void OnBnClickedWbFile();
- virtual void OnCancel();
- virtual void OnOK();
- afx_msg void OnBnClickedLock();
- afx_msg void OnBnClickedFocus();
- afx_msg void OnEnChangeOrder();
- afx_msg void OnGetKeyCountClicked(UINT id);
- CRichEditCtrl m_edit_log;
- CButton m_check_verify_pid;
- CButton m_check_verify_client_type;
- CButton m_check_verify_soft_version;
- afx_msg void OnBnClickedConfig();
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- afx_msg void OnCbnSelchangeCom();
- afx_msg void OnCbnSelchangeBd();
- CButton m_check_set;
- CButtonST m_btn_cancel;
- CButtonST m_btn_manual_start;
- CButton m_check_focus;
- CButton m_check_lock;
- CLabel m_lb_test_mode;
- afx_msg void OnBnClickedWbWrite();
- };
|