LIRC libraries
LinuxInfraredRemoteControl
Main Page
Related Pages
Modules
Classes
Files
Examples
simulate.py
1
'''
2
3
Do sommethind like "irsend simulate". Run using
4
LIRC_SOCKET_PATH=... python3 simulate.py <remote> <key> [repeat [code]]
5
6
'''
7
8
import
sys
9
10
import
lirc
11
12
if
len(sys.argv) < 3
or
len(sys.argv) > 5:
13
sys.stderr.write(
"Usage: simulate.py <remote> <key> [repeat [code ]]"
)
14
sys.exit(1)
15
code = sys.argv[4]
if
len(sys.argv) >= 5
else
9
16
repeat = sys.argv[3]
if
len(sys.argv) >= 4
else
1
17
key = sys.argv[2]
18
remote = sys.argv[1]
19
20
with lirc.CommandConnection()
as
conn:
21
reply = lirc.SimulateCommand(conn, remote, key, repeat, code).run()
22
if
not
reply.success:
23
print(reply.data[0])
24
25
# conn.send(command.cmd_string)
26
# while not command.parser.is_completed():
27
# line = conn.readline(0.1)
28
# command.parser.feed(line)
29
# if not command.parser.result == lirc.client.Result.OK:
30
# print("Cannot get version string")
31
# else:
32
# print(command.parser.data[0])
Generated by
1.8.10