본문 바로가기

API / MFC/Serial Communications

WaitCommEvent Function

지정된 통신 장치의 이벤트가 발생 될때까지 대기
이 함수에 의해 모니터링되는 이벤트들은 디바이스 핸들과 연관된 이벤트 마스크가 포함되어 있음



BOOL WINAPI WaitCommEvent(
  __in   HANDLE hFile,
  __out  LPDWORD lpEvtMask,
  __in   LPOVERLAPPED lpOverlapped
);



hFile [in]
    통신장치의 핸들값, CreateFile 함수에서 리턴된 핸들값


lpEvtMask [out]
    발생되는 이벤트 유형을 나타내는 마스터를 받는 변수의 포인터.
    만약 error가 발생되면, 값은 0 그렇지 않으면,  밑의 값중에 하나
        EV_BREAK(0x0040)   A break was detected on input.
        EV_CTS(0x0008)     The CTS (clear-to-send) signal changed state.
        EV_DSR(0x0010)     The DSR (data-set-ready) signal changed state. 
        EV_ERR(0x0080)     A line-status error occurred. 
                                     Line-status errors are CE_FRAME, CE_OVERRUN, and CE_RXPARITY.
        EV_RING(0x0100)    A ring indicator was detected. 
        EV_RLSD(0x0020)    The RLSD (receive-line-signal-detect) signal changed state.
        EV_RXCHAR(0x0001)  A character was received and placed in the input buffer. 
        EV_RXFLAG(0x0002)  The event character was received and placed in the input buffer. 
                                       The event character is specified in the device's DCB structure,
                                             which is applied to a serial port by using the SetCommState function.
        EV_TXEMPTY(0x0004) The last character in the output buffer was sent.


lpOverlapped [in]
    OVERLAPPED 구조체의 포인터

'API / MFC > Serial Communications' 카테고리의 다른 글

COMMTIMEOUTS Structure  (0) 2010.03.31
DCB Structure  (0) 2010.03.31
GetCommState & SetCommState Function  (0) 2010.03.31
SetupComm & PurgeComm Function  (0) 2010.03.31
SetCommMask & GetCommMask Function  (0) 2010.03.31