2008-03-31 00:59:30 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2008-03-31 00:59:30 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2019-01-01 15:05:51 +00:00
|
|
|
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2008-03-31 00:59:30 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2008-03-31 00:59:30 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef SERIALPORT_HXX
|
|
|
|
#define SERIALPORT_HXX
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
|
|
|
|
/**
|
|
|
|
This class provides an interface for a standard serial port.
|
2008-04-11 17:56:35 +00:00
|
|
|
For now, this is used when connecting a real AtariVox device,
|
|
|
|
and as such it always uses 19200, 8n1, no flow control.
|
2008-03-31 00:59:30 +00:00
|
|
|
|
|
|
|
@author Stephen Anthony
|
|
|
|
*/
|
|
|
|
class SerialPort
|
|
|
|
{
|
|
|
|
public:
|
2015-12-30 19:07:11 +00:00
|
|
|
SerialPort() = default;
|
|
|
|
virtual ~SerialPort() = default;
|
2008-03-31 00:59:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Open the given serial port with the specified attributes.
|
|
|
|
|
|
|
|
@param device The name of the port
|
|
|
|
@return False on any errors, else true
|
|
|
|
*/
|
2019-12-22 13:48:03 +00:00
|
|
|
virtual bool openPort(const string& device) { return false; }
|
2008-03-31 00:59:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Read a byte from the serial port.
|
2019-12-22 02:08:01 +00:00
|
|
|
NOTE: This is for potential future use; no class currently uses this.
|
2008-03-31 00:59:30 +00:00
|
|
|
|
|
|
|
@param data Destination for the byte read from the port
|
|
|
|
@return True if a byte was read, else false
|
|
|
|
*/
|
2019-09-28 01:20:24 +00:00
|
|
|
virtual bool readByte(uInt8& data) { return false; }
|
2008-03-31 00:59:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Write a byte to the serial port.
|
|
|
|
|
|
|
|
@param data The byte to write to the port
|
|
|
|
@return True if a byte was written, else false
|
|
|
|
*/
|
2019-12-22 13:48:03 +00:00
|
|
|
virtual bool writeByte(uInt8 data) { return false; }
|
2015-04-26 19:02:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Following constructors and assignment operators not supported
|
|
|
|
SerialPort(const SerialPort&) = delete;
|
|
|
|
SerialPort(SerialPort&&) = delete;
|
|
|
|
SerialPort& operator=(const SerialPort&) = delete;
|
|
|
|
SerialPort& operator=(SerialPort&&) = delete;
|
2008-03-31 00:59:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|