当前位置: 首页>>代码示例>>C++>>正文


C++ CommLog_Print函数代码示例

本文整理汇总了C++中CommLog_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ CommLog_Print函数的具体用法?C++ CommLog_Print怎么用?C++ CommLog_Print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CommLog_Print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _set_wait_mask

static BOOL _set_wait_mask(WINPR_COMM *pComm, const ULONG *pWaitMask)
{
	ULONG possibleMask;


	/* Stops pending IOCTL_SERIAL_WAIT_ON_MASK
	 * http://msdn.microsoft.com/en-us/library/ff546805%28v=vs.85%29.aspx
	 */

	if (pComm->PendingEvents & SERIAL_EV_FREERDP_WAITING)
	{
		/* FIXME: any doubt on reading PendingEvents out of a critical section? */

		EnterCriticalSection(&pComm->EventsLock);
		pComm->PendingEvents |= SERIAL_EV_FREERDP_STOP;
		LeaveCriticalSection(&pComm->EventsLock);

		/* waiting the end of the pending _wait_on_mask() */
		while (pComm->PendingEvents & SERIAL_EV_FREERDP_WAITING)
			Sleep(10); /* 10ms */
	}

	/* NB: ensure to leave the critical section before to return */
	EnterCriticalSection(&pComm->EventsLock);

	if (*pWaitMask == 0)
	{
		/* clearing pending events */

		if (ioctl(pComm->fd, TIOCGICOUNT, &(pComm->counters)) < 0)
		{
			CommLog_Print(WLOG_WARN, "TIOCGICOUNT ioctl failed, errno=[%d] %s", errno, strerror(errno));
			SetLastError(ERROR_IO_DEVICE);

			LeaveCriticalSection(&pComm->EventsLock);
			return FALSE;
		}

		pComm->PendingEvents = 0;
	}

	possibleMask = *pWaitMask & _SERIAL_SYS_SUPPORTED_EV_MASK;

	if (possibleMask != *pWaitMask)
	{
		CommLog_Print(WLOG_WARN, "Not all wait events supported (Serial.sys), requested events= 0X%lX, possible events= 0X%lX", *pWaitMask, possibleMask);

		/* FIXME: shall we really set the possibleMask and return FALSE? */
		pComm->WaitEventMask = possibleMask;

		LeaveCriticalSection(&pComm->EventsLock);
		return FALSE;
	}

	pComm->WaitEventMask = possibleMask;

	LeaveCriticalSection(&pComm->EventsLock);
	return TRUE;
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:59,代码来源:comm_serial_sys.c

示例2: SetupComm

BOOL SetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue)
{
	WINPR_COMM* pComm = (WINPR_COMM*) hFile;
	SERIAL_QUEUE_SIZE queueSize;
	DWORD bytesReturned = 0;

	if (!CommInitialized())
		return FALSE;

	if (!pComm || pComm->Type != HANDLE_TYPE_COMM || !pComm->fd )
	{
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	queueSize.InSize = dwInQueue;
	queueSize.OutSize = dwOutQueue;

	if (!CommDeviceIoControl(pComm, IOCTL_SERIAL_SET_QUEUE_SIZE, &queueSize, sizeof(SERIAL_QUEUE_SIZE), NULL, 0, &bytesReturned, NULL))
	{
		CommLog_Print(WLOG_WARN, "SetCommTimeouts failure.");
		return FALSE;
	}

	return TRUE;
}
开发者ID:shattars3d,项目名称:FreeRDP-1,代码行数:26,代码来源:comm.c

示例3: _set_queue_size

static BOOL _set_queue_size(WINPR_COMM *pComm, const SERIAL_QUEUE_SIZE *pQueueSize)
{
	if ((pQueueSize->InSize <= N_TTY_BUF_SIZE) && (pQueueSize->OutSize <= N_TTY_BUF_SIZE))
		return TRUE; /* nothing to do */

	/* FIXME: could be implemented on top of N_TTY */

	if (pQueueSize->InSize > N_TTY_BUF_SIZE)
		CommLog_Print(WLOG_WARN, "Requested an incompatible input buffer size: %"PRIu32", keeping on with a %"PRIu32" bytes buffer.", pQueueSize->InSize, N_TTY_BUF_SIZE);

	if (pQueueSize->OutSize > N_TTY_BUF_SIZE)
		CommLog_Print(WLOG_WARN, "Requested an incompatible output buffer size: %"PRIu32", keeping on with a %"PRIu32" bytes buffer.", pQueueSize->OutSize, N_TTY_BUF_SIZE);

	SetLastError(ERROR_CANCELLED);
	return FALSE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:16,代码来源:comm_serial_sys.c

示例4: _get_modemstatus

static BOOL _get_modemstatus(WINPR_COMM *pComm, ULONG *pRegister)
{
	UINT32 lines=0;
	if (ioctl(pComm->fd, TIOCMGET, &lines) < 0)
	{
		CommLog_Print(WLOG_WARN, "TIOCMGET ioctl failed, errno=[%d] %s", errno, strerror(errno));
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	ZeroMemory(pRegister, sizeof(ULONG));

	/* FIXME: Is the last read of the MSR register available or
	 * cached somewhere? Not quite sure we need to return the 4
	 * LSBits anyway. A direct access to the register -- which
	 * would reset the register -- is likely not expected from
	 * this function.
	 */

	/* #define SERIAL_MSR_DCTS     0x01 */
	/* #define SERIAL_MSR_DDSR     0x02 */
	/* #define SERIAL_MSR_TERI     0x04 */
	/* #define SERIAL_MSR_DDCD     0x08 */

	if (lines & TIOCM_CTS)
		*pRegister |= SERIAL_MSR_CTS;
	if (lines & TIOCM_DSR)
		*pRegister |= SERIAL_MSR_DSR;
	if (lines & TIOCM_RI)
		*pRegister |= SERIAL_MSR_RI;
	if (lines & TIOCM_CD)
		*pRegister |= SERIAL_MSR_DCD;

	return TRUE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:35,代码来源:comm_serial_sys.c

示例5: _get_baud_rate

static BOOL _get_baud_rate(WINPR_COMM *pComm, SERIAL_BAUD_RATE *pBaudRate)
{
	int i;
	speed_t currentSpeed;
	struct termios currentState;

	ZeroMemory(&currentState, sizeof(struct termios));
	if (tcgetattr(pComm->fd, &currentState) < 0)
	{
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	currentSpeed = cfgetispeed(&currentState);

	for (i=0; _BAUD_TABLE[i][0]<_BAUD_TABLE_END; i++)
	{
		if (_BAUD_TABLE[i][0] == currentSpeed)
		{
			pBaudRate->BaudRate = _BAUD_TABLE[i][1];
			return TRUE;
		}
	}

	CommLog_Print(WLOG_WARN, "could not find a matching baud rate for the speed 0x%x", currentSpeed);
	SetLastError(ERROR_INVALID_DATA);
	return FALSE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:28,代码来源:comm_serial_sys.c

示例6: SetCommTimeouts

/**
 * ERRORS:
 *   ERROR_INVALID_HANDLE
 */
BOOL SetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts)
{
	WINPR_COMM* pComm = (WINPR_COMM*) hFile;
	DWORD bytesReturned;

	if (!CommInitialized())
		return FALSE;

	if (!pComm || pComm->Type != HANDLE_TYPE_COMM || !pComm->fd)
	{
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	/* as of today, SERIAL_TIMEOUTS and COMMTIMEOUTS structures are identical */

	if (!CommDeviceIoControl(pComm, IOCTL_SERIAL_SET_TIMEOUTS, lpCommTimeouts,
	                         sizeof(COMMTIMEOUTS), NULL, 0, &bytesReturned, NULL))
	{
		CommLog_Print(WLOG_WARN, "SetCommTimeouts failure.");
		return FALSE;
	}

	return TRUE;
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:29,代码来源:comm.c

示例7: SetDefaultCommConfigW

BOOL SetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize)
{
	if (!CommInitialized())
		return FALSE;

	/* TODO: not implemented */
	CommLog_Print(WLOG_ERROR, "%s: Not implemented", __FUNCTION__);
	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
	return FALSE;
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:10,代码来源:comm.c

示例8: CommConfigDialogW

BOOL CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
{
	if (!CommInitialized())
		return FALSE;

	/* TODO: not implemented */
	CommLog_Print(WLOG_ERROR, "%s: Not implemented", __FUNCTION__);
	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
	return FALSE;
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:10,代码来源:comm.c

示例9: BuildCommDCBW

BOOL BuildCommDCBW(LPCWSTR lpDef, LPDCB lpDCB)
{
	if (!CommInitialized())
		return FALSE;

	/* TODO: not implemented */
	CommLog_Print(WLOG_ERROR, "%s: Not implemented", __FUNCTION__);
	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
	return FALSE;
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:10,代码来源:comm.c

示例10: _set_xon

static BOOL _set_xon(WINPR_COMM *pComm)
{
	if (tcflow(pComm->fd, TCION) < 0)
	{
		CommLog_Print(WLOG_WARN, "TCION failure, errno=[%d] %s", errno, strerror(errno));
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	return TRUE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:11,代码来源:comm_serial_sys.c

示例11: _set_break_off

static BOOL _set_break_off(WINPR_COMM *pComm)
{
	if (ioctl(pComm->fd, TIOCCBRK, NULL) < 0)
	{
		CommLog_Print(WLOG_WARN, "TIOCSBRK ioctl failed, errno=[%d] %s", errno, strerror(errno));
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	return TRUE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:11,代码来源:comm_serial_sys.c

示例12: _clear_lines

static BOOL _clear_lines(WINPR_COMM *pComm, UINT32 lines)
{
	if (ioctl(pComm->fd, TIOCMBIC, &lines) < 0)
	{
		CommLog_Print(WLOG_WARN, "TIOCMBIC ioctl failed, lines=0x%"PRIX32", errno=[%d] %s", lines, errno, strerror(errno));
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	return TRUE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:11,代码来源:comm_serial_sys.c

示例13: BuildCommDCBAndTimeoutsA

BOOL BuildCommDCBAndTimeoutsA(LPCSTR lpDef, LPDCB lpDCB,
                              LPCOMMTIMEOUTS lpCommTimeouts)
{
	if (!CommInitialized())
		return FALSE;

	/* TODO: not implemented */
	CommLog_Print(WLOG_ERROR, "%s: Not implemented", __FUNCTION__);
	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
	return FALSE;
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:11,代码来源:comm.c

示例14: _set_timeouts

static BOOL _set_timeouts(WINPR_COMM *pComm, const SERIAL_TIMEOUTS *pTimeouts)
{
	/* NB: timeouts are applied on system during read/write I/O */

	/* http://msdn.microsoft.com/en-us/library/windows/hardware/hh439614%28v=vs.85%29.aspx */
	if ((pTimeouts->ReadIntervalTimeout == MAXULONG) && (pTimeouts->ReadTotalTimeoutConstant == MAXULONG))
	{
		CommLog_Print(WLOG_WARN, "ReadIntervalTimeout and ReadTotalTimeoutConstant cannot be both set to MAXULONG");
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
	}

	pComm->timeouts.ReadIntervalTimeout         = pTimeouts->ReadIntervalTimeout;
	pComm->timeouts.ReadTotalTimeoutMultiplier  = pTimeouts->ReadTotalTimeoutMultiplier;
	pComm->timeouts.ReadTotalTimeoutConstant    = pTimeouts->ReadTotalTimeoutConstant;
	pComm->timeouts.WriteTotalTimeoutMultiplier = pTimeouts->WriteTotalTimeoutMultiplier;
	pComm->timeouts.WriteTotalTimeoutConstant   = pTimeouts->WriteTotalTimeoutConstant;

	CommLog_Print(WLOG_DEBUG, "ReadIntervalTimeout %"PRIu32"", pComm->timeouts.ReadIntervalTimeout);
	CommLog_Print(WLOG_DEBUG, "ReadTotalTimeoutMultiplier %"PRIu32"", pComm->timeouts.ReadTotalTimeoutMultiplier);
	CommLog_Print(WLOG_DEBUG, "ReadTotalTimeoutConstant %"PRIu32"", pComm->timeouts.ReadTotalTimeoutConstant);
	CommLog_Print(WLOG_DEBUG, "WriteTotalTimeoutMultiplier %"PRIu32"", pComm->timeouts.WriteTotalTimeoutMultiplier);
	CommLog_Print(WLOG_DEBUG, "WriteTotalTimeoutConstant %"PRIu32"", pComm->timeouts.WriteTotalTimeoutConstant);

	return TRUE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:26,代码来源:comm_serial_sys.c

示例15: _set_baud_rate

static BOOL _set_baud_rate(WINPR_COMM *pComm, const SERIAL_BAUD_RATE *pBaudRate)
{
	int i;
	speed_t newSpeed;
	struct termios futureState;

	ZeroMemory(&futureState, sizeof(struct termios));
	if (tcgetattr(pComm->fd, &futureState) < 0) /* NB: preserves current settings not directly handled by the Communication Functions */
	{
		SetLastError(ERROR_IO_DEVICE);
		return FALSE;
	}

	for (i=0; _BAUD_TABLE[i][0]<_BAUD_TABLE_END; i++)
	{
		if (_BAUD_TABLE[i][1] == pBaudRate->BaudRate)
		{
			newSpeed = _BAUD_TABLE[i][0];
			if (cfsetspeed(&futureState, newSpeed) < 0)
			{
				CommLog_Print(WLOG_WARN, "failed to set speed 0x%x (%"PRIu32")", newSpeed, pBaudRate->BaudRate);
				return FALSE;
			}

			assert(cfgetispeed(&futureState) == newSpeed);

			if (_comm_ioctl_tcsetattr(pComm->fd, TCSANOW, &futureState) < 0)
			{
				CommLog_Print(WLOG_WARN, "_comm_ioctl_tcsetattr failure: last-error: 0x%"PRIX32"", GetLastError());
				return FALSE;
			}

			return TRUE;
		}
	}

	CommLog_Print(WLOG_WARN, "could not find a matching speed for the baud rate %"PRIu32"", pBaudRate->BaudRate);
	SetLastError(ERROR_INVALID_DATA);
	return FALSE;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:40,代码来源:comm_serial_sys.c


注:本文中的CommLog_Print函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。