267 lines
4.4 KiB
C
267 lines
4.4 KiB
C
|
/**
|
||
|
* WinPR: Windows Portable Runtime
|
||
|
* Serial Communication API
|
||
|
*
|
||
|
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
#ifdef HAVE_CONFIG_H
|
||
|
#include "config.h"
|
||
|
#endif
|
||
|
|
||
|
#include <winpr/crt.h>
|
||
|
#include <winpr/comm.h>
|
||
|
|
||
|
/**
|
||
|
* Communication Resources:
|
||
|
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa363196/
|
||
|
*/
|
||
|
|
||
|
#ifndef _WIN32
|
||
|
|
||
|
#include "comm.h"
|
||
|
|
||
|
BOOL BuildCommDCBA(LPCSTR lpDef, LPDCB lpDCB)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL BuildCommDCBW(LPCWSTR lpDef, LPDCB lpDCB)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL BuildCommDCBAndTimeoutsA(LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL BuildCommDCBAndTimeoutsW(LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hCommDev;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hCommDev;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommMask(HANDLE hFile, PDWORD lpEvtMask)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetCommMask(HANDLE hFile, DWORD dwEvtMask)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommModemStatus(HANDLE hFile, PDWORD lpModemStat)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommProperties(HANDLE hFile, LPCOMMPROP lpCommProp)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommState(HANDLE hFile, LPDCB lpDCB)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetCommState(HANDLE hFile, LPDCB lpDCB)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL GetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetCommBreak(HANDLE hFile)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL ClearCommBreak(HANDLE hFile)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL ClearCommError(HANDLE hFile, PDWORD lpErrors, LPCOMSTAT lpStat)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL PurgeComm(HANDLE hFile, DWORD dwFlags)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL SetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL EscapeCommFunction(HANDLE hFile, DWORD dwFunc)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL TransmitCommChar(HANDLE hFile, char cChar)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
BOOL WaitCommEvent(HANDLE hFile, PDWORD lpEvtMask, LPOVERLAPPED lpOverlapped)
|
||
|
{
|
||
|
WINPR_COMM* pComm = (WINPR_COMM*) hFile;
|
||
|
|
||
|
if (!pComm)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
#endif
|