-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
241 lines (235 loc) · 10.2 KB
/
index.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<html lang="en">
<head>
<title>ZigSnake Talk</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="google-code-prettify/prettify.css" rel="stylesheet">
<link href="impress-custom.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<div id="impress" data-transition-duration="1500">
<div class="step" data-x="0">
<h1 class="center">ZigSnake</h1>
</div>
<div class="step" data-x="1500">
<img src="images/portrait-spencer.jpg" width="300" class="center">
<h2>Spencer Russell</h2>
<h3>@ssfrr</h3>
<h3>http://ssfrr.com</h3>
</div>
<div class="step" data-x="3000">
<img src="images/bulogics_pms.png" width="500" class="center">
</div>
<div class="step" data-x="4500">
<h2 class="center">Overview</h2>
</div>
<div class="step" data-x="4500" data-y="100">
<p>ZigBee Overview</p>
</div>
<div class="step" data-x="4500" data-y="200">
<p>unittest</p>
</div>
<div class="step" data-x="4500" data-y="300">
<p>ZigSnake Overview</p>
</div>
<div class="step" data-x="4500" data-y="400">
<p>ZigSnake Internals</p>
</div>
<div class="step" data-x="4500" data-y="500">
<p>Live Demo</p>
</div>
<div class="step" data-x="5300" data-y="100" data-scale="0.05">
<h2 class="center">ZigBee Overview</h2>
</div>
<div class="step" data-x="5400" data-y="100" data-scale="0.05">
<img src="images/zigbee-mesh.png" width="700" class="center">
</div>
<div class="step" data-x="5500" data-y="90" data-scale="0.05">
<h3>ZigBee Cluster Library (ZCL)</h3>
</div>
<div class="step" data-x="5500" data-y="96" data-scale="0.05">
<p>Clusters</p>
</div>
<div class="step" data-x="5500" data-y="100" data-scale="0.05">
<p>Client/Server Model</p>
</div>
<div class="step" data-x="5500" data-y="104" data-scale="0.05">
<p>Commands</p>
</div>
<div class="step" data-x="5500" data-y="108" data-scale="0.05">
<p>Attributes</p>
</div>
<div class="step" data-x="5300" data-y="200" data-scale="0.05">
<h2 class="center">unittest</h2>
</div>
<div class="step" data-x="5400" data-y="197.5" data-scale="0.05">
<p>TestCase Class</p>
</div>
<div class="step" data-x="5400" data-y="202.5" data-scale="0.05">
<p>Assertions</p>
</div>
<!-- TODO: break this code sampele into separately highlightable sections -->
<div class="step" data-x="5500" data-y="200" data-scale="0.05">
<pre class="prettyprint" lang-python>
import unittest
from widget import Widget
class WidgetTestCase(unittest.TestCase):
def setUp(self):
self.widget = Widget('The widget')
def tearDown(self):
self.widget.dispose()
self.widget = None
def test_default_size(self):
self.assertEqual(self.widget.size(), (50,50),
'incorrect default size')
def test_resize(self):
self.widget.resize(100,150)
self.assertEqual(self.widget.size(), (100,150),
'wrong size after resize')
if __name__ == '__main__':
unittest.main()
</pre>
</div>
<div class="step" data-x="5300" data-y="300" data-scale="0.05">
<h2 class="center">ZigSnake Overview</h2>
</div>
<div id="zigsnake-overview-code" class="step" data-x="5400" data-y="300" data-scale="0.05">
<!-- display the full code sample -->
</div>
<div class="step" data-x="5400" data-y="286" data-scale="0.05">
<pre class="prettyprint" lang-python>
from zcl import ZCL
from zigbee import ZBController
import unittest
</pre>
</div>
<div class="step" data-x="5400" data-y="296" data-scale="0.05">
<pre class="prettyprint" lang-python>
class LevelControlTestCase(unittest.TestCase):
def setUp(self):
z = ZCL(['general.xml', 'ha.xml',
'ha12.xml', 'ota.xml'])
con = ZBController()
con.open(192.168.1.134)
con.enable_permit_join()
device_id = con.wait_for_join()
con.disable_permit_join()
</pre>
</div>
<div class="step" data-x="5400" data-y="311" data-scale="0.05">
<pre class="prettyprint" lang-python>
def test_move_to_level_updates_attribute(self):
desired_level = 127
con.send_zcl_command(
device_id,
z.level_control.move_to_level(
desired_level, 0))
level = con.read_attribute(
device_id, z.level_control.current_level)
self.assertEqual(level, desired_level)
</pre>
</div>
<div class="step" data-x="5500" data-y="296" data-scale="0.05">
<pre class="prettyprint" lang-python>
class TestBasicFunctionality(DoorLockTestCase):
def test_unlock(self):
raw_input("Make sure lock is locked. Press Enter")
conn.send_zcl_command(z.door_lock.unlock_door(''))
conn.expect_zcl_command(
z.door_lock.unlock_door_response(success))
self.assertConfirm("Did the bolt unlock?")
</pre>
</div>
<div class="step" data-x="5300" data-y="400" data-scale="0.05">
<h2 class="center">ZigSnake Internals</h2>
</div>
<div id="cluster-xml" class="step" data-x="5400" data-y="400" data-scale="0.05">
</div>
<div class="step" data-x="5400" data-y="394.5" data-scale="0.05">
<pre class="prettyprint" lang-xml>
<cluster>
<name>Level Control</name>
<code>0x0008</code>
</pre>
</div>
<div class="step" data-x="5400" data-y="400" data-scale="0.05">
<pre class="prettyprint" lang-xml>
<attribute side="server" code="0x0000"
type="INT8U">current level</attribute>
<attribute side="server" code="0x0001"
type="INT16U">remaining time</attribute>
</pre>
</div>
<div class="step" data-x="5400" data-y="407" data-scale="0.05">
<pre class="prettyprint" lang-xml>
<command source="client" code="0x00" name="MoveToLevel">
<arg name="level" type="INT8U"/>
<arg name="transitionTime" type="INT16U"/>
</command>
</cluster>
</pre>
</div>
<div class="step" data-x="5500" data-y="400" data-scale="0.05">
<pre class="center" style="font-size:55px">import elementtree.ElementTree</pre>
</div>
<div class="step" data-x="5600" data-y="400" data-scale="0.05">
<pre class="prettyprint">
class ZCL:</pre>
<pre class="prettyprint" style="opacity: 0.3"> def __init__(self, xml_files = None):
if not xml_files:
return
for xml_file in xml_files:
tree = xml.parse(xml_file)
root = tree.getroot()</pre>
<pre class="prettyprint"> for cluster_xml in root.iter('cluster'):
setattr(self, _attr_from_name(
cluster_xml.find('name').text),
ZCLCluster(cluster_xml))</pre>
</div>
<div class="step invisible-unless-active" data-x="5600" data-y="408.5" data-scale="0.001">
<pre class="prettyprint">
class ZCLCluster:
def __init__(self, cluster_xml):
self.name = cluster_xml.find('name').text
self.define = cluster_xml.find('define').text
self.code = int(cluster_xml.find('code').text, 0)
self.add_commands(cluster_xml)
self.add_attributes(cluster_xml)
def add_commands(self, cluster_xml):
for cmd_xml in cluster_xml.findall('command'):
setattr(self,
_attr_from_name(cmd_xml.get('name')),
ZCLCommandPrototype(self.code, cmd_xml))
def add_attributes(self, cluster_xml):
for attr_xml in cluster_xml.findall('attribute'):
setattr(self,
_attr_from_name(attr_xml.text),
ZCLAttribute(self.code, attr_xml))
</pre>
</div>
<div class="step" data-x="5300" data-y="500" data-scale="0.05">
<h2 class="center">Live Demo</h2>
</div>
<div class="step" data-x="5500" data-y="500" data-scale="0.2">
<p>Spencer Russell</p>
<p style="clear: both">github.com/bulogics/zigsnake</p>
<p>
<!-- TODO: this is hacky -->
<span style="margin-left: 0px; margin-right: 40px; float: left">@ssfrr</span>
<span style="margin-left: 0px; margin-right: 40px; float: right">ssfrr.com</span>
<span style="margin-left: 0px; margin-right: 40px; float: left; clear:both">@bulogics</span>
<span style="margin-left: 0px; margin-right: 40px; float: right">bulogics.com</span>
</p>
<br style="clear:both">
<br>
<br>
<img class="center" src="images/a3_logo.png" width="600">
</div>
<div class="step" data-x="2500" data-y="0" data-scale="5">
</div>
</div> <!-- id=impress -->
<script src="impress.js/js/impress.js"></script>
<script type="text/javascript">impress().init();</script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="google-code-prettify/prettify.js"></script>
</body>
</html>