Exemple #1
0
/**
 * Read raw bytes out of the buffer.
 * 
 * @param buffer Pointer to the buffer to store the bytes in.
 * @param count The maximum number of bytes to read.
 * @return The number of bytes actually read into the buffer.
 */
UINT32 SerialPort::Read(char *buffer, INT32 count)
{
    UINT32 retCount = 0;
    ViStatus status = viBufRead(m_portHandle, (ViPBuf) buffer, count,
                                (ViPUInt32) & retCount);
    switch (status)
    {
    case VI_SUCCESS_TERM_CHAR:
    case VI_SUCCESS_MAX_CNT:
        break;
    default:
        wpi_assertCleanStatus(status);
    }
    return retCount;
}
/**
 * Read raw bytes out of the buffer.
 * 
 * @param buffer Pointer to the buffer to store the bytes in.
 * @param count The maximum number of bytes to read.
 * @return The number of bytes actually read into the buffer.
 */ 
UINT32 SerialPort::Read(char *buffer, INT32 count)
{
	UINT32 retCount = 0;
	if (!m_consoleModeEnabled)
	{
		ViStatus status = viBufRead(m_portHandle, (ViPBuf)buffer, count, (ViPUInt32)&retCount);
		switch (status)
		{
		case VI_SUCCESS_TERM_CHAR:
		case VI_SUCCESS_MAX_CNT:
		case VI_ERROR_TMO: // Timeout
			break;
		default:
			wpi_assertCleanStatus(status);
		}
	}
	return retCount;
}
Exemple #3
0
/**
 * Read raw bytes out of the buffer.
 * 
 * @param buffer Pointer to the buffer to store the bytes in.
 * @param count The maximum number of bytes to read.
 * @return The number of bytes actually read into the buffer.
 */ 
uint32_t SerialPort::Read(char *buffer, int32_t count)
{
	uint32_t retCount = 0;
	if (!m_consoleModeEnabled)
	{
		ViStatus localStatus = viBufRead(m_portHandle, (ViPBuf)buffer, count, (ViPUInt32)&retCount);
		switch (localStatus)
		{
		case VI_SUCCESS_TERM_CHAR:
		case VI_SUCCESS_MAX_CNT:
		case VI_ERROR_TMO: // Timeout
			break;
		default:
			wpi_setError(localStatus);
		}
	}
	return retCount;
}