Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
UartWidget.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * UartWidget.h
17 * This class is based on QLCFTDI class from
18 *
19 * Q Light Controller
20 * qlcftdi.h
21 *
22 * Copyright (C) Heikki Junnila
23 *
24 * Only standard CPP conversion was changed and function name changed
25 * to follow OLA coding standards.
26 *
27 * by Rui Barreiros
28 * Copyright (C) 2014 Richard Ash
29 */
30
31#ifndef PLUGINS_UARTDMX_UARTWIDGET_H_
32#define PLUGINS_UARTDMX_UARTWIDGET_H_
33
34#include <string>
35#include <vector>
36#include "ola/base/Macro.h"
37#include "ola/DmxBuffer.h"
38
39namespace ola {
40namespace plugin {
41namespace uartdmx {
42
47 public:
52 explicit UartWidget(const std::string &path);
53
55 virtual ~UartWidget();
56
58 std::string Name() const { return m_path; }
59 std::string Description() const { return m_path; }
60
62 bool Open();
63
65 bool Close();
66
68 bool IsOpen() const;
69
71 bool SetBreak(bool on);
72
74 bool Write(const ola::DmxBuffer &data);
75
77 bool Read(unsigned char* buff, int size);
78
80 bool SetupOutput();
81
82 private:
83 const std::string m_path;
84
89 int m_fd;
90
94 static const int NOT_OPEN = -2;
95
99 static const int FAILED_OPEN = -1;
100
101 UartWidget(const UartWidget &) = delete;
102 const UartWidget &operator=(const UartWidget &) = delete;
103};
104} // namespace uartdmx
105} // namespace plugin
106} // namespace ola
107#endif // PLUGINS_UARTDMX_UARTWIDGET_H_
A class used to hold a single universe of DMX data.
Helper macros.
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
Definition UartWidget.h:46
std::string Name() const
Definition UartWidget.h:58
bool Read(unsigned char *buff, int size)
Definition UartWidget.cpp:136
bool Open()
Definition UartWidget.cpp:69
UartWidget(const std::string &path)
Definition UartWidget.cpp:57
virtual ~UartWidget()
Definition UartWidget.cpp:62
bool SetupOutput()
Definition UartWidget.cpp:151
bool IsOpen() const
Definition UartWidget.cpp:96
bool Write(const ola::DmxBuffer &data)
Definition UartWidget.cpp:119
bool SetBreak(bool on)
Definition UartWidget.cpp:100
bool Close()
Definition UartWidget.cpp:81
The namespace containing all OLA symbols.
Definition Credentials.cpp:44