1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef SERIALPORT_HXX
19#define SERIALPORT_HXX
20
21#include "bspf.hxx"
22
23/**
24 This class provides an interface for a standard serial port.
25 For now, this is used when connecting a real AtariVox device,
26 and as such it always uses 19200, 8n1, no flow control.
27
28 @author Stephen Anthony
29*/
30class SerialPort
31{
32 public:
33 SerialPort() = default;
34 virtual ~SerialPort() = default;
35
36 /**
37 Open the given serial port with the specified attributes.
38
39 @param device The name of the port
40 @return False on any errors, else true
41 */
42 virtual bool openPort(const string& device) { return false; }
43
44 /**
45 Read a byte from the serial port.
46
47 @param data Destination for the byte read from the port
48 @return True if a byte was read, else false
49 */
50 virtual bool readByte(uInt8& data) { return false; }
51
52 /**
53 Write a byte to the serial port.
54
55 @param data The byte to write to the port
56 @return True if a byte was written, else false
57 */
58 virtual bool writeByte(uInt8 data) { return false; }
59
60 private:
61 /**
62 Close a previously opened serial port.
63 */
64 virtual void closePort() { }
65
66 private:
67 // Following constructors and assignment operators not supported
68 SerialPort(const SerialPort&) = delete;
69 SerialPort(SerialPort&&) = delete;
70 SerialPort& operator=(const SerialPort&) = delete;
71 SerialPort& operator=(SerialPort&&) = delete;
72};
73
74#endif
75