-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlircdevice.cpp
More file actions
44 lines (40 loc) · 1.2 KB
/
lircdevice.cpp
File metadata and controls
44 lines (40 loc) · 1.2 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
#include "lircdevice.h"
LircDevice::LircDevice(QString name, Lirc *lirc) :
Device(name)
{
m_timeout = "300";
m_queryPeriod = "10000";
m_lirc = lirc;
foreach (QString command, lirc->GetCommands())
{
addCommand(command);
}
}
QString LircDevice::Save()
{
QString result = QString("protocol %0: socket\n" \
"file: \"/var/run/lirc/lircd\"\n" \
"query-period: %1\n" \
"timeout: %2\n\n").arg(m_name).arg(m_queryPeriod).arg(m_timeout);
foreach (QString commands, m_commands) {
result += commands;
}
return result;
}
void LircDevice::addCommand(QString commandName, QString)
{
QString command = QString(
"command %0\n" \
"{\n" \
" send %1 (\"SEND_START %2 %0\" nl)\n" \
" receive\n"
" {\n" \
" timeout\n" \
" {\n" \
" send %1 (\"SEND_STOP %2 %0\" nl)\n" \
" }\n" \
" }\n" \
"}\n\n"
).arg(commandName).arg(m_name).arg(m_name.toLower());
m_commands.insert(commandName, command);
}