-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpjlinkdevice.cpp
More file actions
63 lines (55 loc) · 1.52 KB
/
pjlinkdevice.cpp
File metadata and controls
63 lines (55 loc) · 1.52 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "pjlinkdevice.h"
const QString PJLinkDevice::DEFAULT_PORT = "4352";
PJLinkDevice::PJLinkDevice(QString deviceName, QString ip, QString port) :
Device(deviceName)
{
m_ip = ip;
m_caseSensitive = "false";
if (port.isEmpty())
{
m_port = DEFAULT_PORT;
addCommand("poweron", "\"%1POWR 1\" cr");
addCommand("poweroff", "\"%1POWR 0\" cr");
addCommand("muteon", "\"%1AVMT 31\" cr");
addCommand("muteoff", "\"%1AVMT 30\" cr");
}
else
m_port = port;
}
QString PJLinkDevice::Save()
{
QString result = QString("protocol %0: tcp-ip\n" \
"target-ip: \"%1:%2\"\n" \
"query-period: %3\n" \
"timeout: %4\n" \
"case-sensitive: %5\n" \
"\n\n").arg(m_name).arg(m_ip).arg(m_port).arg(m_queryPeriod).arg(m_timeout).arg(m_caseSensitive);
foreach (QString commands, m_commands) {
result += commands;
}
result += QString(
"query\n"\
"{\n\tsend " + m_name +" (\"%1POWR ?\" cr) \n" \
"\treceive\n"\
"\t{\n"\
"\t\t(\"%1POWR=1\" cr)\n"\
"\t\t{\n"\
"\t\t\tset state enabled\n"\
"\t\t}\n"\
"\t\t(\"%1POWR=0\" cr)\n"\
"\t\t{\n"\
"\t\t\tset state disabled\n"\
"\t\t}\n"\
"\t\t(\"%1POWR=ERR\" N:8 cr)\n"\
"\t\t{\n"\
"\t\t\tset state error\n"\
"\t\t}\n"\
"\t\ttimeout\n"\
"\t\t{\n"\
"\t\t\tset state unknown\n"\
"\t\t}\n"\
"\t}\n"\
"}\n"\
);
return result;
}