• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mcallegari / qlcplus / 19144422256

06 Nov 2025 05:33PM UTC coverage: 34.256% (-0.1%) from 34.358%
19144422256

push

github

mcallegari
Back to 5.1.0 debug

17718 of 51723 relevant lines covered (34.26%)

19528.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.32
/plugins/velleman/src/velleman.cpp
1
/*
2
  Q Light Controller
3
  velleman.cpp
4

5
  Copyright (c) Matthew Jaggard
6

7
  Licensed under the Apache License, Version 2.0 (the "License");
8
  you may not use this file except in compliance with the License.
9
  You may obtain a copy of the License at
10

11
      http://www.apache.org/licenses/LICENSE-2.0.txt
12

13
  Unless required by applicable law or agreed to in writing, software
14
  distributed under the License is distributed on an "AS IS" BASIS,
15
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
  See the License for the specific language governing permissions and
17
  limitations under the License.
18
*/
19

20
#include <QStringList>
21
#include <stdint.h>
22
#include <QString>
23
#include <QDebug>
24
#include <QFile>
25

26
#if defined(WIN32) || defined(Q_OS_WIN)
27
#   include <windows.h>
28
#endif
29

30
#include "qlcmacros.h"
31
#include "velleman.h"
32

33
/*****************************************************************************
34
 * The Velleman interface for k8062d.dll
35
 *****************************************************************************/
36

37
extern "C"
38
{
39
    void StartDevice();
40
    void StopDevice();
41

42
    void SetChannelCount(int32_t Count);
43
    void SetData(int32_t Channel, int32_t Data);
44
    void SetAllData(int32_t Data[]);
45
}
46

47
/*****************************************************************************
48
 * Initialization
49
 *****************************************************************************/
50

51
Velleman::~Velleman()
4✔
52
{
53
    closeOutput(0, 0);
4✔
54
    delete [] m_values;
4✔
55
}
4✔
56

57
void Velleman::init()
4✔
58
{
59
    m_values = new qint32[512];
4✔
60
    memset(m_values, 0, sizeof(qint32) * 512);
4✔
61
    m_currentlyOpen = false;
4✔
62
}
4✔
63

64
QString Velleman::name()
1✔
65
{
66
    return QString("Velleman");
1✔
67
}
68

69
int Velleman::capabilities() const
×
70
{
71
    return QLCIOPlugin::Output;
×
72
}
73

74
/*****************************************************************************
75
 * Outputs
76
 *****************************************************************************/
77

78
bool Velleman::openOutput(quint32 output, quint32 universe)
6✔
79
{
80
    Q_UNUSED(universe)
81
    if (output != 0)
6✔
82
        return false;
3✔
83

84
    if (m_currentlyOpen == false)
3✔
85
    {
86
        qDebug() << "Velleman: Starting device...";
2✔
87
        StartDevice();
2✔
88

89
        m_currentlyOpen = true;
2✔
90
    }
91
    return true;
3✔
92
}
93

94
void Velleman::closeOutput(quint32 output, quint32 universe)
9✔
95
{
96
    Q_UNUSED(universe)
97
    if (output != 0)
9✔
98
        return;
3✔
99

100
    if (m_currentlyOpen == true)
6✔
101
    {
102
        m_currentlyOpen = false;
2✔
103
        qDebug() << "Velleman: Stopping device...";
2✔
104
        StopDevice();
2✔
105
    }
106
}
107

108
QStringList Velleman::outputs()
1✔
109
{
110
    QStringList list;
1✔
111
    list << QString("Velleman Device");
1✔
112
    return list;
1✔
113
}
×
114

115
QString Velleman::pluginInfo()
×
116
{
117
    QString str;
×
118

119
    str += QString("<HTML>");
×
120
    str += QString("<HEAD>");
×
121
    str += QString("<TITLE>%1</TITLE>").arg(name());
×
122
    str += QString("</HEAD>");
×
123
    str += QString("<BODY>");
×
124

125
    str += QString("<P>");
×
126
    str += QString("<H3>%1</H3>").arg(name());
×
127
    str += tr("This plugin provides DMX output support for the Velleman "
×
128
              "K8062D using the DLL supplied with the product.");
×
129
    str += QString("</P>");
×
130

131
    return str;
×
132
}
×
133

134
QString Velleman::outputInfo(quint32 output)
×
135
{
136
    QString str;
×
137

138
    if (output != QLCIOPlugin::invalidLine() && output == 0)
×
139
    {
140
        str += QString("<H3>%1</H3>").arg(outputs()[output]);
×
141
    }
142

143
    str += QString("</BODY>");
×
144
    str += QString("</HTML>");
×
145

146
    return str;
×
147
}
×
148

149
void Velleman::writeUniverse(quint32 universe, quint32 output, const QByteArray &data, bool dataChanged)
3✔
150
{
151
    Q_UNUSED(universe)
152
    Q_UNUSED(dataChanged)
153

154
    if (output != 0 || m_currentlyOpen == false || data.isEmpty())
3✔
155
        return;
2✔
156

157
    qDebug() << "Sending" << data.size() << "bytes";
1✔
158
    SetChannelCount((qint32)data.size());
1✔
159
    for (int i = 0; i < data.size(); i++)
513✔
160
        m_values[i] = (qint32)(uchar(data.at(i)));
512✔
161

162
    SetAllData(m_values);
1✔
163
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc