Use OS for serial port instead of NI VISA (#1875)

This commit is contained in:
Thad House
2019-09-28 16:49:11 -07:00
committed by Peter Johnson
parent b23baf611a
commit 9f740e5905
10 changed files with 703 additions and 386 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -9,6 +9,7 @@
#include <string>
#include <hal/Types.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include <wpi/deprecated.h>
@@ -73,6 +74,9 @@ class SerialPort : public ErrorBase {
/**
* Create an instance of a Serial Port class.
*
* Prefer to use the constructor that doesn't take a port name, but in some
* cases the automatic detection might not work correctly.
*
* @param baudRate The baud rate to configure the serial port.
* @param port The physical port to use
* @param portName The direct port name to use
@@ -82,15 +86,14 @@ class SerialPort : public ErrorBase {
* @param stopBits The number of stop bits to use as defined by the enum
* StopBits.
*/
WPI_DEPRECATED("Will be removed for 2020")
SerialPort(int baudRate, const wpi::Twine& portName, Port port = kOnboard,
int dataBits = 8, Parity parity = kParity_None,
StopBits stopBits = kStopBits_One);
~SerialPort();
SerialPort(SerialPort&& rhs);
SerialPort& operator=(SerialPort&& rhs);
SerialPort(SerialPort&& rhs) = default;
SerialPort& operator=(SerialPort&& rhs) = default;
/**
* Set the type of flow control to enable on this port.
@@ -214,10 +217,7 @@ class SerialPort : public ErrorBase {
void Reset();
private:
int m_resourceManagerHandle = 0;
int m_portHandle = 0;
bool m_consoleModeEnabled = false;
Port m_port = kOnboard;
hal::Handle<HAL_SerialPortHandle> m_portHandle;
};
} // namespace frc