OXYGENHUB
◆ main openmsx / src / serial / RS232Connector.hh
1.1 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef RS232CONNECTOR_HH
2
#define RS232CONNECTOR_HH
3
4
#include "Connector.hh"
5
#include "SerialDataInterface.hh"
6
#include "serialize_meta.hh"
7
8
namespace openmsx {
9
10
class RS232Device;
11
12
class RS232Connector : public Connector, public SerialDataInterface
13
{
14
public:
15
	[[nodiscard]] RS232Device& getPluggedRS232Dev() const;
16
17
	// Connector
18
	[[nodiscard]] zstring_view getDescription() const final;
19
	[[nodiscard]] zstring_view getClass() const final;
20
21
	// input (SerialDataInterface)
22
	void setDataBits(DataBits bits) override = 0;
23
	void setStopBits(StopBits bits) override = 0;
24
	void setParityBit(bool enable, Parity parity) override = 0;
25
	void recvByte(uint8_t value, EmuTime time) override = 0;
26
	[[nodiscard]] virtual bool ready() = 0;
27
	[[nodiscard]] virtual bool acceptsData() = 0;
28
	[[nodiscard]] virtual bool directByteDelivery() const { return false; }
29
30
	template<typename Archive>
31
	void serialize(Archive& ar, unsigned version);
32
33
protected:
34
	RS232Connector(PluggingController& pluggingController,
35
	               std::string name);
36
	~RS232Connector() = default;
37
};
38
39
REGISTER_BASE_CLASS(RS232Connector, "rs232connector");
40
41
} // namespace openmsx
42
43
#endif