Mercurial > ~darius > hgwebdir.cgi > EG-ZigBee
annotate __init__.py @ 0:c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
At the moment it is not very configurable and only listens for evens from
remote modules set up to send IO events.
author | darius@inchoate.localdomain |
---|---|
date | Sun, 28 Oct 2007 11:08:38 +1030 |
parents | |
children | 1e65aca0f39c |
rev | line source |
---|---|
0
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
1 import eg |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
2 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
3 class PluginInfo(eg.PluginInfo): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
4 name = "ZigBee" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
5 author = "Darius" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
6 version = "1.0.0" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
7 description = "Listen for data from a Max Stream ZigBee module" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
8 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
9 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
10 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
11 class Text: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
12 port = "Port:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
13 baudrate = "Baudrate:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
14 bytesize = "Number of bits:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
15 parity = "Parity:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
16 parities = ['No parity', 'Odd', 'Even'] #, 'Mark', 'Space'] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
17 stopbits = "Stopbits:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
18 flowcontrol = "Flow control:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
19 handshakes = ['None', 'Xon / Xoff', 'Hardware'] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
20 generateEvents = "Generate events on incoming data" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
21 eventPrefix = "Event prefix:" |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
22 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
23 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
24 import wx |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
25 import threading |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
26 import win32event |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
27 import win32file |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
28 import struct |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
29 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
30 class Serial(eg.RawReceiverPlugin): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
31 canMultiLoad = True |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
32 text = Text |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
33 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
34 def __init__(self): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
35 eg.RawReceiverPlugin.__init__(self) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
36 self.serial = None |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
37 self.buffer = [] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
38 self.state = 'init' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
39 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
40 def __start__( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
41 self, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
42 port, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
43 baudrate, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
44 bytesize=8, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
45 parity=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
46 stopbits=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
47 handshake=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
48 generateEvents=False, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
49 prefix="Serial", |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
50 ): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
51 xonxoff = 0 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
52 rtscts = 0 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
53 if handshake == 1: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
54 xonxoff = 1 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
55 elif handshake == 2: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
56 rtscts = 1 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
57 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
58 try: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
59 self.serial = eg.SerialPort( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
60 port, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
61 baudrate=baudrate, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
62 bytesize=(5, 6, 7, 8)[bytesize], |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
63 stopbits=(1, 2)[stopbits], |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
64 parity=('N', 'O', 'E')[parity], |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
65 xonxoff=xonxoff, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
66 rtscts=rtscts, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
67 ) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
68 except: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
69 self.serial = None |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
70 raise eg.Exception("Can't open COM port.") |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
71 self.serial.timeout = 1.0 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
72 self.serial.setRTS() |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
73 self.info.eventPrefix = prefix |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
74 self.stopEvent = win32event.CreateEvent(None, 1, 0, None) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
75 self.receiveThread = threading.Thread(target=self.ReceiveThread) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
76 self.receiveThread.start() |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
77 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
78 def __stop__(self): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
79 if self.serial is not None: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
80 if self.receiveThread: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
81 win32event.SetEvent(self.stopEvent) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
82 self.receiveThread.join(1.0) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
83 self.serial.close() |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
84 self.serial = None |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
85 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
86 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
87 def HandleChar(self, ch): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
88 if (self.state == 'init'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
89 if (ch != '\x7e'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
90 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
91 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
92 self.state = 'sizemsb' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
93 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
94 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
95 elif (self.state == 'sizemsb'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
96 self.bufszmsb = struct.unpack('B', ch)[0] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
97 self.state = 'sizelsb' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
98 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
99 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
100 elif (self.state == 'sizelsb'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
101 self.bufszlsb = struct.unpack('B', ch)[0] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
102 self.dataleft = self.bufszmsb << 8 | self.bufszlsb |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
103 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
104 self.state = 'data' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
105 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
106 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
107 elif (self.state == 'data'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
108 self.buffer.append(struct.unpack('B', ch)[0]) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
109 self.dataleft = self.dataleft - 1 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
110 if (self.dataleft == 0): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
111 self.state = 'cksum' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
112 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
113 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
114 elif (self.state == 'cksum'): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
115 cksum = reduce(lambda x, y: x + y, self.buffer) & 0xff |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
116 rxcksum = struct.unpack('B', ch)[0] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
117 if (cksum + rxcksum != 0xff): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
118 self.PrintError("Bad checksum, got 0x%02x, expected 0x%02x" % |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
119 cksum, 0xff - cksum) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
120 else: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
121 self.PrintError("Triggered event: " + str(self.buffer)) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
122 self.TriggerEvent(str(self.buffer)) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
123 self.buffer = [] |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
124 self.state = 'init' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
125 return |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
126 else: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
127 self.PrintError("Internal error: bad state: " + str(self.state)) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
128 self.state = 'init' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
129 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
130 def ReceiveThread(self): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
131 from win32event import ( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
132 ResetEvent, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
133 MsgWaitForMultipleObjects, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
134 QS_ALLINPUT, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
135 WAIT_OBJECT_0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
136 WAIT_TIMEOUT, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
137 ) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
138 from win32file import ReadFile, AllocateReadBuffer, GetOverlappedResult |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
139 from win32api import GetLastError |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
140 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
141 continueLoop = True |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
142 overlapped = self.serial._overlappedRead |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
143 hComPort = self.serial.hComPort |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
144 hEvent = overlapped.hEvent |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
145 stopEvent = self.stopEvent |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
146 n = 1 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
147 waitingOnRead = False |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
148 buf = AllocateReadBuffer(n) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
149 while continueLoop: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
150 if not waitingOnRead: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
151 ResetEvent(hEvent) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
152 hr, _ = ReadFile(hComPort, buf, overlapped) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
153 if hr == 997: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
154 waitingOnRead = True |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
155 elif hr == 0: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
156 pass |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
157 #n = GetOverlappedResult(hComPort, overlapped, 1) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
158 #self.HandleChar(str(buf)) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
159 else: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
160 self.PrintError("error") |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
161 raise |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
162 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
163 rc = MsgWaitForMultipleObjects( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
164 (hEvent, stopEvent), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
165 0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
166 1000, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
167 QS_ALLINPUT |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
168 ) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
169 if rc == WAIT_OBJECT_0: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
170 n = GetOverlappedResult(hComPort, overlapped, 1) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
171 if n: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
172 self.HandleChar(str(buf)) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
173 #else: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
174 # print "WAIT_OBJECT_0", n, str(buf[:n]) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
175 waitingOnRead = False |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
176 elif rc == WAIT_OBJECT_0+1: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
177 continueLoop = False |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
178 elif rc == WAIT_TIMEOUT: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
179 pass |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
180 else: |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
181 self.PrintError("unknown message") |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
182 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
183 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
184 def Configure( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
185 self, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
186 port=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
187 baudrate=9600, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
188 bytesize=8, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
189 parity=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
190 stopbits=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
191 handshake=0, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
192 generateEvents=False, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
193 prefix="Serial", |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
194 ): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
195 text = self.text |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
196 dialog = eg.ConfigurationDialog(self) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
197 portCtrl = eg.SerialPortChoice(dialog, value=port) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
198 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
199 baudrateCtrl = wx.ComboBox( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
200 dialog, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
201 value=str(baudrate), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
202 choices=[ |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
203 '110', '300', '600', '1200', '2400', '4800', '9600', |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
204 '14400', '19200', '38400', '57600', '115200', |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
205 '128000', '256000' |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
206 ], |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
207 style=wx.CB_DROPDOWN, |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
208 validator=eg.DigitOnlyValidator() |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
209 ) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
210 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
211 bytesizeCtrl = wx.Choice(dialog, choices=['5', '6', '7', '8']) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
212 bytesizeCtrl.SetSelection(8 - 5) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
213 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
214 parityCtrl = wx.Choice(dialog, choices=text.parities) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
215 parityCtrl.SetSelection(parity) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
216 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
217 stopbitsCtrl = wx.Choice(dialog, choices=['1', '2']) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
218 stopbitsCtrl.SetSelection(stopbits) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
219 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
220 handshakeCtrl = wx.Choice(dialog, choices=text.handshakes) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
221 handshakeCtrl.SetSelection(handshake) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
222 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
223 generateEventsCtrl = wx.CheckBox(dialog, label=text.generateEvents) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
224 generateEventsCtrl.SetValue(generateEvents) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
225 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
226 prefixCtrl = wx.TextCtrl(dialog) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
227 prefixCtrl.SetValue(prefix) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
228 prefixCtrl.Enable(generateEvents) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
229 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
230 def OnCheckBox(event): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
231 flag = generateEventsCtrl.GetValue() |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
232 prefixCtrl.Enable(flag) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
233 generateEventsCtrl.Bind(wx.EVT_CHECKBOX, OnCheckBox) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
234 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
235 flags = wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
236 mySizer = wx.GridBagSizer(5, 5) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
237 Add = mySizer.Add |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
238 Add(wx.StaticText(dialog, -1, text.port), (0, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
239 Add(portCtrl, (0, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
240 Add(wx.StaticText(dialog, -1, text.baudrate), (1, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
241 Add(baudrateCtrl, (1, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
242 Add(wx.StaticText(dialog, -1, text.bytesize), (2, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
243 Add(bytesizeCtrl, (2, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
244 Add(wx.StaticText(dialog, -1, text.parity), (3, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
245 Add(parityCtrl, (3, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
246 Add(wx.StaticText(dialog, -1, text.stopbits), (4, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
247 Add(stopbitsCtrl, (4, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
248 Add(wx.StaticText(dialog, -1, text.flowcontrol), (5, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
249 Add(handshakeCtrl, (5, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
250 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
251 Add((5, 5), (6, 0), (1, 2), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
252 Add(generateEventsCtrl, (7, 0), (1, 2), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
253 Add(wx.StaticText(dialog, -1, text.eventPrefix), (9, 0), flag=flags) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
254 Add(prefixCtrl, (9, 1), flag=wx.EXPAND) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
255 dialog.sizer.Add(mySizer) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
256 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
257 if dialog.AffirmedShowModal(): |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
258 return ( |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
259 portCtrl.GetValue(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
260 int(baudrateCtrl.GetValue()), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
261 bytesizeCtrl.GetSelection(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
262 parityCtrl.GetSelection(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
263 stopbitsCtrl.GetSelection(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
264 handshakeCtrl.GetSelection(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
265 generateEventsCtrl.GetValue(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
266 prefixCtrl.GetValue(), |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
267 ) |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
268 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
269 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
270 |
c978dbb7e4b8
Commit first version of plugin to parse events from MaxStream ZigBee modules.
darius@inchoate.localdomain
parents:
diff
changeset
|
271 |