summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/dipty.h
blob: c381420a0caead4eab7266afacc1fbc4da09c991 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// license:BSD-3-Clause
// copyright-holders:F.Ulivi
/***************************************************************************

    dipty.h

    Device PTY interface

***************************************************************************/

#pragma once

#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif

#ifndef __DIPTY_H__
#define __DIPTY_H__

class device_pty_interface : public device_interface
{
public:
        // construction/destruction
        device_pty_interface(const machine_config &mconfig, device_t &device);
        virtual ~device_pty_interface();

        bool open(void);
        void close(void);

        bool is_open(void) const;

        ssize_t read(UINT8 *rx_chars , size_t count);
        void write(UINT8 tx_char);

        bool is_slave_connected(void) const;

        const char *slave_name(void) const;

protected:
        osd_file *m_pty_master;
        std::string m_slave_name;
        bool m_opened;
};

// iterator
typedef device_interface_iterator<device_pty_interface> pty_interface_iterator;

#endif  /* __DIPTY_H__ */