Searches for USB serial devices to get the correct VISA object (#363)

Fix was made in LabVIEW, and this matches what was done there.
This commit is contained in:
Thad House
2016-11-22 21:51:47 -08:00
committed by Peter Johnson
parent 9a91ae54d6
commit f3d66e92ec
10 changed files with 453 additions and 109 deletions

View File

@@ -83,6 +83,10 @@
#define HAL_HANDLE_ERROR_MESSAGE \
"HAL: A handle parameter was passed incorrectly"
#define HAL_SERIAL_PORT_NOT_FOUND -1123
#define HAL_SERIAL_PORT_NOT_FOUND_MESSAGE \
"HAL: The specified serial port device was not found";
#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error";
#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object"
#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked"

View File

@@ -9,31 +9,42 @@
#include <stdint.h>
enum HAL_SerialPort : int32_t {
HAL_SerialPort_Onboard = 0,
HAL_SerialPort_MXP = 1,
HAL_SerialPort_USB1 = 2,
HAL_SerialPort_USB2 = 3
};
#ifdef __cplusplus
extern "C" {
#endif
void HAL_InitializeSerialPort(int32_t port, int32_t* status);
void HAL_SetSerialBaudRate(int32_t port, int32_t baud, int32_t* status);
void HAL_SetSerialDataBits(int32_t port, int32_t bits, int32_t* status);
void HAL_SetSerialParity(int32_t port, int32_t parity, int32_t* status);
void HAL_SetSerialStopBits(int32_t port, int32_t stopBits, int32_t* status);
void HAL_SetSerialWriteMode(int32_t port, int32_t mode, int32_t* status);
void HAL_SetSerialFlowControl(int32_t port, int32_t flow, int32_t* status);
void HAL_SetSerialTimeout(int32_t port, double timeout, int32_t* status);
void HAL_EnableSerialTermination(int32_t port, char terminator,
void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status);
void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status);
void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status);
void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status);
void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits,
int32_t* status);
void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode, int32_t* status);
void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow,
int32_t* status);
void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout, int32_t* status);
void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator,
int32_t* status);
void HAL_DisableSerialTermination(int32_t port, int32_t* status);
void HAL_SetSerialReadBufferSize(int32_t port, int32_t size, int32_t* status);
void HAL_SetSerialWriteBufferSize(int32_t port, int32_t size, int32_t* status);
int32_t HAL_GetSerialBytesReceived(int32_t port, int32_t* status);
int32_t HAL_ReadSerial(int32_t port, char* buffer, int32_t count,
void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status);
void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size,
int32_t* status);
void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
int32_t* status);
int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status);
int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count,
int32_t* status);
int32_t HAL_WriteSerial(int32_t port, const char* buffer, int32_t count,
int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count,
int32_t* status);
void HAL_FlushSerial(int32_t port, int32_t* status);
void HAL_ClearSerial(int32_t port, int32_t* status);
void HAL_CloseSerial(int32_t port, int32_t* status);
void HAL_FlushSerial(HAL_SerialPort port, int32_t* status);
void HAL_ClearSerial(HAL_SerialPort port, int32_t* status);
void HAL_CloseSerial(HAL_SerialPort port, int32_t* status);
#ifdef __cplusplus
}
#endif