]> git.tdb.fi Git - libs/core.git/blob - source/serial.h
Drop copyright and license notices from files
[libs/core.git] / source / serial.h
1 #ifndef MSP_IO_SERIAL_H_
2 #define MSP_IO_SERIAL_H_
3
4 #include "base.h"
5
6 namespace Msp {
7 namespace IO {
8
9 class Serial: public Base
10 {
11 public:
12         enum Parity
13         {
14                 NONE,
15                 EVEN,
16                 ODD
17         };
18
19 private:
20         Handle handle;
21
22 public:
23         Serial(const std::string &);
24         virtual ~Serial();
25
26         virtual void set_block(bool);
27
28         void set_baud_rate(unsigned);
29         void set_data_bits(unsigned);
30         void set_parity(Parity);
31         void set_stop_bits(unsigned);
32         void set_parameters(const std::string &);
33
34         virtual Handle get_event_handle();
35
36 private:
37         void close();
38         virtual unsigned do_write(const char *, unsigned);
39         virtual unsigned do_read(char *, unsigned);
40 };
41
42 } // namespace IO
43 } // namespace Msp
44
45 #endif