Cherry Cloud 9

SetupComm, PurgeComm Function 본문

Programming/Serial Comm

SetupComm, PurgeComm Function

체리구름 2017. 3. 7. 00:27
728x90
반응형

SetupComm function

 

 

 

BOOL WINAPI SetupComm(
  _In_ HANDLE hFile,
  _In_ DWORD  dwInQueue,
  _In_ DWORD  dwOutQueue
); 

 

지정된 통신 장치의 통신 파라메타를 초기화

입출력 버퍼의 크기를 정한다.

Parameters

hFile [in]

A handle to the communications device. The CreateFile function returns this handle.

dwInQueue [in]

The recommended size of the device's internal input buffer, in bytes.

dwOutQueue [in]

The recommended size of the device's internal output buffer, in bytes.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

 

 

참조 : https://msdn.microsoft.com/en-us/library/windows/desktop/aa363439(v=vs.85).aspx

 

PurgeComm function

BOOL WINAPI PurgeComm(
  _In_ HANDLE hFile,
  _In_ DWORD  dwFlags
);

 

특정한 통신 자원의 입출력 버퍼의 모든 데이터를 삭제한다.

보류된 입출력 함수의 자원을 종료시킨다.

Parameters

hFile [in]

A handle to the communications resource. The CreateFile function returns this handle.

dwFlags [in]

이 매개변수는 1개 이상 올 수 있음

Value Meaning
PURGE_RXABORT
0x0002

읽기 작업이 완료되지 않았더라도 모든 미해결된 overlapped 읽기 작업을 멈추고 즉시 반환한다

PURGE_RXCLEAR
0x0008

입력 버퍼 클리어

PURGE_TXABORT
0x0001

쓰기 작업이 완료되지 않았더라도 모든 미해결된 overlapped 쓰기 작업을 멈추고 즉시 반환한다.

PURGE_TXCLEAR
0x0004

출력 버퍼 클리어

 

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

 

 

참조 : https://msdn.microsoft.com/en-us/library/windows/desktop/aa363428(v=vs.85).aspx

728x90
반응형

'Programming > Serial Comm' 카테고리의 다른 글

COMMTIMEOUTS structure  (0) 2017.03.06