maxcube-client 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/.rubocop.yml +0 -3
- data/.yardopts +1 -0
- data/README.md +17 -2
- data/bin/maxcube-client +2 -27
- data/doc/MaxCube.html +502 -0
- data/doc/MaxCube/Messages.html +1927 -0
- data/doc/MaxCube/Messages/Handler.html +2912 -0
- data/doc/MaxCube/Messages/InvalidMessage.html +140 -0
- data/doc/MaxCube/Messages/InvalidMessageBody.html +264 -0
- data/doc/MaxCube/Messages/InvalidMessageFormat.html +247 -0
- data/doc/MaxCube/Messages/InvalidMessageLength.html +247 -0
- data/doc/MaxCube/Messages/InvalidMessageType.html +263 -0
- data/doc/MaxCube/Messages/Parser.html +520 -0
- data/doc/MaxCube/Messages/Serializer.html +701 -0
- data/doc/MaxCube/Messages/TCP.html +172 -0
- data/doc/MaxCube/Messages/TCP/Handler.html +1396 -0
- data/doc/MaxCube/Messages/TCP/Parser.html +462 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageA.html +186 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageC.html +1077 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageF.html +206 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageH.html +338 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageL.html +535 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageM.html +510 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageN.html +226 -0
- data/doc/MaxCube/Messages/TCP/Parser/MessageS.html +225 -0
- data/doc/MaxCube/Messages/TCP/Serializer.html +460 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageA.html +186 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageC.html +185 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageF.html +206 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageL.html +185 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageM.html +428 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageN.html +209 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageQ.html +185 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageS.html +1168 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageT.html +240 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageU.html +206 -0
- data/doc/MaxCube/Messages/TCP/Serializer/MessageZ.html +252 -0
- data/doc/MaxCube/Messages/UDP.html +164 -0
- data/doc/MaxCube/Messages/UDP/Handler.html +832 -0
- data/doc/MaxCube/Messages/UDP/Parser.html +609 -0
- data/doc/MaxCube/Messages/UDP/Parser/MessageH.html +218 -0
- data/doc/MaxCube/Messages/UDP/Parser/MessageI.html +215 -0
- data/doc/MaxCube/Messages/UDP/Parser/MessageN.html +226 -0
- data/doc/MaxCube/Messages/UDP/Serializer.html +484 -0
- data/doc/MaxCube/Network.html +167 -0
- data/doc/MaxCube/Network/TCP.html +150 -0
- data/doc/MaxCube/Network/TCP/Client.html +1930 -0
- data/doc/MaxCube/Network/TCP/Client/Commands.html +2457 -0
- data/doc/MaxCube/Network/TCP/SampleServer.html +910 -0
- data/doc/MaxCube/Network/UDP.html +150 -0
- data/doc/MaxCube/Network/UDP/Client.html +518 -0
- data/doc/MaxCube/Network/UDP/SampleSocket.html +628 -0
- data/doc/MaxCube/Runner.html +355 -0
- data/doc/_index.html +518 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +499 -0
- data/doc/file.README.html +140 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +140 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1699 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/maxcube.rb +11 -0
- data/lib/maxcube/messages.rb +85 -8
- data/lib/maxcube/messages/handler.rb +138 -4
- data/lib/maxcube/messages/parser.rb +33 -2
- data/lib/maxcube/messages/serializer.rb +64 -16
- data/lib/maxcube/messages/tcp.rb +11 -7
- data/lib/maxcube/messages/tcp/handler.rb +50 -2
- data/lib/maxcube/messages/tcp/parser.rb +18 -17
- data/lib/maxcube/messages/tcp/serializer.rb +20 -21
- data/lib/maxcube/messages/tcp/type/a.rb +6 -6
- data/lib/maxcube/messages/tcp/type/c.rb +5 -3
- data/lib/maxcube/messages/tcp/type/f.rb +5 -3
- data/lib/maxcube/messages/tcp/type/h.rb +3 -2
- data/lib/maxcube/messages/tcp/type/l.rb +8 -7
- data/lib/maxcube/messages/tcp/type/m.rb +11 -7
- data/lib/maxcube/messages/tcp/type/n.rb +5 -3
- data/lib/maxcube/messages/tcp/type/q.rb +2 -2
- data/lib/maxcube/messages/tcp/type/s.rb +5 -2
- data/lib/maxcube/messages/tcp/type/t.rb +5 -4
- data/lib/maxcube/messages/tcp/type/u.rb +2 -1
- data/lib/maxcube/messages/tcp/type/z.rb +4 -2
- data/lib/maxcube/messages/udp.rb +7 -0
- data/lib/maxcube/messages/udp/handler.rb +28 -0
- data/lib/maxcube/messages/udp/parser.rb +23 -6
- data/lib/maxcube/messages/udp/serializer.rb +17 -1
- data/lib/maxcube/messages/udp/type/h.rb +2 -0
- data/lib/maxcube/messages/udp/type/i.rb +3 -0
- data/lib/maxcube/messages/udp/type/n.rb +3 -0
- data/lib/maxcube/network.rb +5 -1
- data/lib/maxcube/network/tcp.rb +3 -0
- data/lib/maxcube/network/tcp/client.rb +117 -3
- data/lib/maxcube/network/tcp/client/commands.rb +306 -239
- data/lib/maxcube/network/tcp/sample_server.rb +1 -0
- data/lib/maxcube/network/udp.rb +3 -0
- data/lib/maxcube/network/udp/client.rb +2 -0
- data/lib/maxcube/network/udp/sample_socket.rb +1 -0
- data/lib/maxcube/runner.rb +45 -0
- data/lib/maxcube/version.rb +2 -1
- data/maxcube-client.gemspec +2 -0
- metadata +84 -3
@@ -0,0 +1,510 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: MaxCube::Messages::TCP::Parser::MessageM
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "MaxCube::Messages::TCP::Parser::MessageM";
|
19
|
+
relpath = '../../../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../../../_index.html">Index (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../../MaxCube.html" title="MaxCube (module)">MaxCube</a></span></span> » <span class='title'><span class='object_link'><a href="../../../Messages.html" title="MaxCube::Messages (module)">Messages</a></span></span> » <span class='title'><span class='object_link'><a href="../../TCP.html" title="MaxCube::Messages::TCP (module)">TCP</a></span></span> » <span class='title'><span class='object_link'><a href="../Parser.html" title="MaxCube::Messages::TCP::Parser (class)">Parser</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MessageM</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: MaxCube::Messages::TCP::Parser::MessageM
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/maxcube/messages/tcp/type/m.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
|
89
|
+
<p>Metadata message.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
<h2>Constant Summary</h2>
|
99
|
+
<dl class="constants">
|
100
|
+
|
101
|
+
<dt id="LENGTHS-constant" class="">LENGTHS =
|
102
|
+
|
103
|
+
</dt>
|
104
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>2</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
105
|
+
|
106
|
+
<dt id="KEYS-constant" class="">KEYS =
|
107
|
+
<div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Mandatory hash keys.</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
</dt>
|
120
|
+
<dd><pre class="code"><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>index</span><span class='words_sep'> </span><span class='tstring_content'>count</span><span class='words_sep'> </span><span class='tstring_content'>unknown1</span><span class='words_sep'> </span><span class='tstring_content'>unknown2</span><span class='words_sep'>
|
121
|
+
</span><span class='tstring_content'>rooms_count</span><span class='words_sep'> </span><span class='tstring_content'>rooms</span><span class='words_sep'> </span><span class='tstring_content'>devices_count</span><span class='words_sep'> </span><span class='tstring_content'>devices</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
122
|
+
|
123
|
+
</dl>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<h2>
|
133
|
+
Instance Method Summary
|
134
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
135
|
+
</h2>
|
136
|
+
|
137
|
+
<ul class="summary">
|
138
|
+
|
139
|
+
<li class="private ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#parse_tcp_m-instance_method" title="#parse_tcp_m (instance method)">#<strong>parse_tcp_m</strong>(body) ⇒ Object </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<span class="note title private">private</span>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="private ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#parse_tcp_m_devices-instance_method" title="#parse_tcp_m_devices (instance method)">#<strong>parse_tcp_m_devices</strong>(hash) ⇒ Object </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="note title private">private</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="private ">
|
184
|
+
<span class="summary_signature">
|
185
|
+
|
186
|
+
<a href="#parse_tcp_m_rooms-instance_method" title="#parse_tcp_m_rooms (instance method)">#<strong>parse_tcp_m_rooms</strong>(hash) ⇒ Object </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="note title private">private</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
<li class="private ">
|
206
|
+
<span class="summary_signature">
|
207
|
+
|
208
|
+
<a href="#parse_tcp_m_split-instance_method" title="#parse_tcp_m_split (instance method)">#<strong>parse_tcp_m_split</strong>(body) ⇒ Object </a>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="note title private">private</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
</ul>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<div id="instance_method_details" class="method_details_list">
|
233
|
+
<h2>Instance Method Details</h2>
|
234
|
+
|
235
|
+
|
236
|
+
<div class="method_details first">
|
237
|
+
<h3 class="signature first" id="parse_tcp_m-instance_method">
|
238
|
+
|
239
|
+
#<strong>parse_tcp_m</strong>(body) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</h3><table class="source_code">
|
246
|
+
<tr>
|
247
|
+
<td>
|
248
|
+
<pre class="lines">
|
249
|
+
|
250
|
+
|
251
|
+
16
|
252
|
+
17
|
253
|
+
18
|
254
|
+
19
|
255
|
+
20
|
256
|
+
21
|
257
|
+
22
|
258
|
+
23
|
259
|
+
24
|
260
|
+
25
|
261
|
+
26
|
262
|
+
27
|
263
|
+
28
|
264
|
+
29
|
265
|
+
30
|
266
|
+
31
|
267
|
+
32</pre>
|
268
|
+
</td>
|
269
|
+
<td>
|
270
|
+
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/tcp/type/m.rb', line 16</span>
|
271
|
+
|
272
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_tcp_m'>parse_tcp_m</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
273
|
+
<span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_enc_data'>enc_data</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_tcp_m_split'>parse_tcp_m_split</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
274
|
+
|
275
|
+
<span class='ivar'>@io</span> <span class='op'>=</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_decode'>decode</span><span class='lparen'>(</span><span class='id identifier rubyid_enc_data'>enc_data</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
276
|
+
|
277
|
+
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>index:</span> <span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='label'>unknown1:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='rbrace'>}</span>
|
278
|
+
<span class='id identifier rubyid_parse_tcp_m_rooms'>parse_tcp_m_rooms</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
279
|
+
<span class='id identifier rubyid_parse_tcp_m_devices'>parse_tcp_m_devices</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
280
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:unknown2</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
281
|
+
|
282
|
+
<span class='id identifier rubyid_hash'>hash</span>
|
283
|
+
<span class='kw'>rescue</span> <span class='const'>IOError</span>
|
284
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
285
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span>
|
286
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>unexpected EOF reached at unknown parts</span><span class='tstring_end'>'</span></span> \
|
287
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> of decoded message data</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
288
|
+
<span class='kw'>end</span></pre>
|
289
|
+
</td>
|
290
|
+
</tr>
|
291
|
+
</table>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div class="method_details ">
|
295
|
+
<h3 class="signature " id="parse_tcp_m_devices-instance_method">
|
296
|
+
|
297
|
+
#<strong>parse_tcp_m_devices</strong>(hash) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</h3><table class="source_code">
|
304
|
+
<tr>
|
305
|
+
<td>
|
306
|
+
<pre class="lines">
|
307
|
+
|
308
|
+
|
309
|
+
79
|
310
|
+
80
|
311
|
+
81
|
312
|
+
82
|
313
|
+
83
|
314
|
+
84
|
315
|
+
85
|
316
|
+
86
|
317
|
+
87
|
318
|
+
88
|
319
|
+
89
|
320
|
+
90
|
321
|
+
91
|
322
|
+
92
|
323
|
+
93
|
324
|
+
94
|
325
|
+
95
|
326
|
+
96
|
327
|
+
97
|
328
|
+
98
|
329
|
+
99
|
330
|
+
100
|
331
|
+
101
|
332
|
+
102
|
333
|
+
103</pre>
|
334
|
+
</td>
|
335
|
+
<td>
|
336
|
+
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/tcp/type/m.rb', line 79</span>
|
337
|
+
|
338
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_tcp_m_devices'>parse_tcp_m_devices</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
339
|
+
<span class='id identifier rubyid_devices_count'>devices_count</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
340
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:devices_count</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_devices_count'>devices_count</span>
|
341
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:devices</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
342
|
+
<span class='id identifier rubyid_devices_count'>devices_count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span>
|
343
|
+
<span class='id identifier rubyid_device'>device</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
344
|
+
<span class='label'>type:</span> <span class='id identifier rubyid_device_type'>device_type</span><span class='lparen'>(</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span>
|
345
|
+
<span class='label'>rf_address:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='comma'>,</span>
|
346
|
+
<span class='label'>serial_number:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span><span class='comma'>,</span>
|
347
|
+
<span class='rbrace'>}</span>
|
348
|
+
<span class='id identifier rubyid_device_name_length'>device_name_length</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
349
|
+
<span class='id identifier rubyid_device'>device</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span>
|
350
|
+
<span class='label'>name_length:</span> <span class='id identifier rubyid_device_name_length'>device_name_length</span><span class='comma'>,</span>
|
351
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_device_name_length'>device_name_length</span><span class='rparen'>)</span><span class='comma'>,</span>
|
352
|
+
<span class='label'>room_id:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='comma'>,</span>
|
353
|
+
<span class='rparen'>)</span>
|
354
|
+
|
355
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:devices</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_device'>device</span>
|
356
|
+
<span class='kw'>end</span>
|
357
|
+
<span class='kw'>rescue</span> <span class='const'>IOError</span>
|
358
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
359
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span>
|
360
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>unexpected EOF reached at devices data part</span><span class='tstring_end'>'</span></span> \
|
361
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> of decoded message data</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
362
|
+
<span class='kw'>end</span></pre>
|
363
|
+
</td>
|
364
|
+
</tr>
|
365
|
+
</table>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div class="method_details ">
|
369
|
+
<h3 class="signature " id="parse_tcp_m_rooms-instance_method">
|
370
|
+
|
371
|
+
#<strong>parse_tcp_m_rooms</strong>(hash) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</h3><table class="source_code">
|
378
|
+
<tr>
|
379
|
+
<td>
|
380
|
+
<pre class="lines">
|
381
|
+
|
382
|
+
|
383
|
+
55
|
384
|
+
56
|
385
|
+
57
|
386
|
+
58
|
387
|
+
59
|
388
|
+
60
|
389
|
+
61
|
390
|
+
62
|
391
|
+
63
|
392
|
+
64
|
393
|
+
65
|
394
|
+
66
|
395
|
+
67
|
396
|
+
68
|
397
|
+
69
|
398
|
+
70
|
399
|
+
71
|
400
|
+
72
|
401
|
+
73
|
402
|
+
74
|
403
|
+
75
|
404
|
+
76
|
405
|
+
77</pre>
|
406
|
+
</td>
|
407
|
+
<td>
|
408
|
+
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/tcp/type/m.rb', line 55</span>
|
409
|
+
|
410
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_tcp_m_rooms'>parse_tcp_m_rooms</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
411
|
+
<span class='id identifier rubyid_rooms_count'>rooms_count</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
412
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:rooms_count</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_rooms_count'>rooms_count</span>
|
413
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:rooms</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
414
|
+
<span class='id identifier rubyid_rooms_count'>rooms_count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span>
|
415
|
+
<span class='id identifier rubyid_room_id'>room_id</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
416
|
+
<span class='id identifier rubyid_room_name_length'>room_name_length</span> <span class='op'>=</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
417
|
+
<span class='id identifier rubyid_room'>room</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
418
|
+
<span class='label'>id:</span> <span class='id identifier rubyid_room_id'>room_id</span><span class='comma'>,</span>
|
419
|
+
<span class='label'>name_length:</span> <span class='id identifier rubyid_room_name_length'>room_name_length</span><span class='comma'>,</span>
|
420
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_room_name_length'>room_name_length</span><span class='rparen'>)</span><span class='comma'>,</span>
|
421
|
+
<span class='label'>rf_address:</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
422
|
+
<span class='rbrace'>}</span>
|
423
|
+
|
424
|
+
<span class='comment'># hash[:rooms][room_id] = room
|
425
|
+
</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:rooms</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_room'>room</span>
|
426
|
+
<span class='kw'>end</span>
|
427
|
+
<span class='kw'>rescue</span> <span class='const'>IOError</span>
|
428
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
429
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span>
|
430
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>unexpected EOF reached at rooms data part</span><span class='tstring_end'>'</span></span> \
|
431
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> of decoded message data</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
432
|
+
<span class='kw'>end</span></pre>
|
433
|
+
</td>
|
434
|
+
</tr>
|
435
|
+
</table>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
<div class="method_details ">
|
439
|
+
<h3 class="signature " id="parse_tcp_m_split-instance_method">
|
440
|
+
|
441
|
+
#<strong>parse_tcp_m_split</strong>(body) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
</h3><table class="source_code">
|
448
|
+
<tr>
|
449
|
+
<td>
|
450
|
+
<pre class="lines">
|
451
|
+
|
452
|
+
|
453
|
+
36
|
454
|
+
37
|
455
|
+
38
|
456
|
+
39
|
457
|
+
40
|
458
|
+
41
|
459
|
+
42
|
460
|
+
43
|
461
|
+
44
|
462
|
+
45
|
463
|
+
46
|
464
|
+
47
|
465
|
+
48
|
466
|
+
49
|
467
|
+
50
|
468
|
+
51
|
469
|
+
52
|
470
|
+
53</pre>
|
471
|
+
</td>
|
472
|
+
<td>
|
473
|
+
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/tcp/type/m.rb', line 36</span>
|
474
|
+
|
475
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_tcp_m_split'>parse_tcp_m_split</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
476
|
+
<span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_enc_data'>enc_data</span> <span class='op'>=</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
477
|
+
<span class='id identifier rubyid_check_msg_part_lengths'>check_msg_part_lengths</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#LENGTHS-constant" title="MaxCube::Messages::TCP::Parser::MessageM::LENGTHS (constant)">LENGTHS</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
|
478
|
+
<span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='id identifier rubyid_to_ints'>to_ints</span><span class='lparen'>(</span><span class='int'>16</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message index, count</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
479
|
+
<span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
|
480
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_index'>index</span> <span class='op'><</span> <span class='id identifier rubyid_count'>count</span>
|
481
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
482
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span>
|
483
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>index >= count: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_content'> >= </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_count'>count</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
484
|
+
<span class='kw'>end</span>
|
485
|
+
|
486
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_enc_data'>enc_data</span>
|
487
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
488
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message data is missing</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
489
|
+
<span class='kw'>end</span>
|
490
|
+
|
491
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_enc_data'>enc_data</span><span class='rbracket'>]</span>
|
492
|
+
<span class='kw'>end</span></pre>
|
493
|
+
</td>
|
494
|
+
</tr>
|
495
|
+
</table>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
</div>
|
499
|
+
|
500
|
+
</div>
|
501
|
+
|
502
|
+
<div id="footer">
|
503
|
+
Generated on Fri Feb 16 13:44:01 2018 by
|
504
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
505
|
+
0.9.12 (ruby-2.5.0).
|
506
|
+
</div>
|
507
|
+
|
508
|
+
</div>
|
509
|
+
</body>
|
510
|
+
</html>
|