5 * Copyright (C) Bob 2009
7 * boblight is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * boblight is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "os-dependent.h"
25 #include "../AdapterCommunication.h"
26 #include "../platform/threads.h"
31 #include "../util/buffer.h"
44 virtual ~CSerialPort();
46 bool Open(std::string name
, uint32_t baudrate
, uint8_t databits
= 8, uint8_t stopbits
= 1, uint8_t parity
= PAR_NONE
);
50 int8_t Write(CCECAdapterMessagePtr data
);
51 int32_t Read(uint8_t* data
, uint32_t len
, uint64_t iTimeoutMs
= 0);
53 std::string
GetError() { return m_error
; }
54 std::string
GetName() { return m_name
; }
57 bool SetBaudRate(uint32_t baudrate
);
64 bool SetTimeouts(bool bBlocking
);
73 CecBuffer
<uint8_t> m_buffer
;
76 struct termios m_options
;