2018-10-30 12:59:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <VirtualFileSystem/CharacterDevice.h>
|
|
|
|
|
|
|
|
class TTY : public CharacterDevice {
|
|
|
|
public:
|
|
|
|
virtual ~TTY() override;
|
|
|
|
|
|
|
|
virtual ssize_t read(byte*, size_t) override;
|
|
|
|
virtual ssize_t write(const byte*, size_t) override;
|
|
|
|
virtual bool hasDataAvailableForRead() const override;
|
|
|
|
|
2018-10-30 14:33:37 +00:00
|
|
|
virtual String ttyName() const = 0;
|
|
|
|
|
2018-10-30 12:59:29 +00:00
|
|
|
protected:
|
2018-10-30 21:03:02 +00:00
|
|
|
virtual bool isTTY() const final { return true; }
|
|
|
|
|
2018-10-30 12:59:29 +00:00
|
|
|
TTY(unsigned major, unsigned minor);
|
2018-10-30 14:33:37 +00:00
|
|
|
void emit(byte);
|
|
|
|
|
|
|
|
virtual void onTTYWrite(byte) = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Vector<byte> m_buffer;
|
2018-10-30 12:59:29 +00:00
|
|
|
};
|
|
|
|
|