Documentation
¶
Index ¶
Constants ¶
View Source
const ( //Parity enable Parity Parity = 1 //NoParity disable Parity NoParity = 0 )
Variables ¶
This section is empty.
Functions ¶
func GetDeviceTTYs ¶
GetDeviceTTYs return a list of paths to serial devices
Types ¶
type SerialDevice ¶
type SerialDevice struct {
sync.Mutex
Options *SerialDeviceOptions
DeviceName string `json:"device_name"`
DeviceID string `json:"device_id"`
Reader chan []byte
ErrChan chan error
// contains filtered or unexported fields
}
SerialDevice container to represent the location of a serial device and return an io port to it
func AutoDiscoverDevices ¶
func AutoDiscoverDevices() ([]*SerialDevice, error)
AutoDiscoverDevices iterate through a list of serial devices and initialize them
func New ¶
func New(options *SerialDeviceOptions) (*SerialDevice, error)
New creates new device, sets up sane defaults for connection
func (*SerialDevice) Close ¶
func (device *SerialDevice) Close() error
Close the connection to the device
func (*SerialDevice) ConnectDevice ¶
func (device *SerialDevice) ConnectDevice() error
ConnectDevice manually connects device bypassing auto discovery
func (*SerialDevice) Reset ¶
func (device *SerialDevice) Reset() error
Reset and reinitialize the connection
func (*SerialDevice) Write ¶
func (device *SerialDevice) Write(message []byte) error
TODO: Rethink this, it's slow Write thread-safe function that takes in data and writes it to port
Click to show internal directories.
Click to hide internal directories.