⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comportcmd.h

📁 PW芯片方案Flash ROM烧写程序
💻 H
字号:
//---------------------------------------------------------------------------
// Pixelworks Inc. Company Confidential Strictly Private
//
// $Archive: $
// $Revision: 1.1.1.1 $
// $Author: KevinM $
// $Date: 2003/09/29 18:19:04 $
//
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Copyright 1997-2003 (c) Pixelworks Inc.
//
// Pixelworks owns the sole copyright to this software. Under international 
// copyright laws you (1) may not make a copy of this software except for 
// the purposes of maintaining a single archive copy, (2) may not derive
// works herefrom, (3) may not distribute this work to others. These rights 
// are provided for information clarification, other restrictions of rights 
// may apply as well.
//
// This is an unpublished work.
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>> WARRANTEE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Pixelworks Inc. MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THE USE OF
// THIS SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
// PURPOSE.
// --------------------------------------------------------------------------
//
#ifndef __COMPORTCMD_H__
#define __COMPORTCMD_H__

#include "ComPortBase.h"
#include "MakeSafe.h"

#ifdef BUILD_USB_CONFIG
#include "PWUsbFlash.h"
#endif

typedef enum
{
    scOK,
    scERROR,
    scCANCEL
} eSENDCMDRETVAL;

//----------------------------------------------------------------------------
// Default maximum # of seconds we wait for incoming serial data.
//----------------------------------------------------------------------------
#define DEFAULT_TIMEOUT     (5)

class CComPortCmd : public CComPortBase
{
public:
	CComPortCmd();
	virtual ~CComPortCmd();

    int Create(CWnd *pParent);
    eSENDCMDRETVAL SendCommand(LPCSTR lpszCmd, CString& cstrRet, HANDLE hCancelEvent);

    BOOL SendData(LPCSTR lpszData);
    BOOL SendData(BYTE cData);
    BOOL SendData(BYTE *pData, int nSize);

    eSENDCMDRETVAL GetData(CString& rstrRet,
                           HANDLE hCancelEvent,
                           int nTimeoutSec = DEFAULT_TIMEOUT,
                           int nDelayMs = 0,
                           BOOL bStopOnEOL = FALSE);

    eSENDCMDRETVAL GetData(CByteArray& ref_byteArray,
                           HANDLE hCancelEvent,
                           int nSize = 0,
                           int nTimeoutSec = DEFAULT_TIMEOUT,
                           int nDelayMs = 0,
                           BOOL bStopOnEOL = FALSE);

    BOOL FlushBuffer();     // Overridden function (must call base class too).

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CComPortCmd)
	//}}AFX_VIRTUAL

	// Generated message map functions
protected:
	//{{AFX_MSG(CComPortCmd)
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:

    CWnd        *m_pParent;

    HANDLE      m_hDataEvent;
    HANDLE      m_hTimer;

    CByteArray  m_ReceivedDataArray;

    CSafe       m_Safe;

    // Overridden pure virtual function declared in base class.
    void ReceivedData(CByteArray& ref_byteArray);

    void ProcessMessages();
    void TrimString(CString& ref_strText);
    int FindEOLChar();
};

/////////////////////////////////////////////////////////////////////////////
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -