-
Notifications
You must be signed in to change notification settings - Fork 1
/
z906bt.py
executable file
·81 lines (59 loc) · 2.35 KB
/
z906bt.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /usr/bin/python3
import btclient
import z906client
import logging
import argparse
argparser = argparse.ArgumentParser(description="Logitech Z906 BT translator")
argparser.add_argument('--debug', '-d', dest='debug', help='Enable debugging', default=False, action='store_const', const=True)
argparser.add_argument('--port', '-P', dest='port', help='Z906 serial port', default=z906client.SERIAL_PORT)
argparser.add_argument('--input', '-i', dest='input', help='Z906 input to use (1-6)', default=1, type=int)
class Z906BT():
z906 = None
bt = None
last_input = 1
logger = logging.getLogger("Z906BT")
bt_input = None
def __init__(self, z906_port, z906_input):
self.logger.info("Connecting to Z906 ...")
self.z906 = z906client.Z906Client(z906_port)
self.logger.debug("Connected to Z906")
self.bt = btclient.BTClient(self.evtCallback)
self.bt_input = z906_input