1 | /*
|
---|
2 | * TOPPERS/ECNL Prototyping tool
|
---|
3 | *
|
---|
4 | * Copyright (C) 2017 Cores Co., Ltd. Japan
|
---|
5 | *
|
---|
6 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
7 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
8 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
9 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
10 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
11 | * スコード中に含まれていること.
|
---|
12 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
13 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
14 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
15 | * の無保証規定を掲載すること.
|
---|
16 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
17 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
18 | * と.
|
---|
19 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
20 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
21 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
22 | * 報告すること.
|
---|
23 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
24 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
25 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
26 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
27 | * 免責すること.
|
---|
28 | *
|
---|
29 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
30 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
31 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
32 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
33 | * の責任を負わない.
|
---|
34 | *
|
---|
35 | * @(#) $Id: EcnlAPIBlock.cs 287 2017-05-05 14:22:23Z coas-nagasima $
|
---|
36 | */
|
---|
37 | using System;
|
---|
38 | using System.Collections.Generic;
|
---|
39 | using System.Linq;
|
---|
40 | using System.Text;
|
---|
41 | using Bridge;
|
---|
42 | using Bridge.Html5;
|
---|
43 |
|
---|
44 | namespace WebMrbc
|
---|
45 | {
|
---|
46 | public class EcnlPropertyAttributeBlock : Block
|
---|
47 | {
|
---|
48 | public const string type_name = "property_attribute";
|
---|
49 |
|
---|
50 | public EcnlPropertyAttributeBlock()
|
---|
51 | : base(type_name)
|
---|
52 | {
|
---|
53 |
|
---|
54 | }
|
---|
55 |
|
---|
56 | public void init()
|
---|
57 | {
|
---|
58 | this.appendDummyInput()
|
---|
59 | .appendField("プロパティ属性")
|
---|
60 | .appendField(new FieldDropdown(new [] {
|
---|
61 | new [] {"未設定", "EPC_NONE"},
|
---|
62 | new [] {"設定可", "EPC_RULE_SET"},
|
---|
63 | new [] {"取得可", "EPC_RULE_GET"},
|
---|
64 | new [] {"通知有り", "EPC_RULE_ANNO"},
|
---|
65 | new [] {"状態変化時通知", "EPC_ANNOUNCE"},
|
---|
66 | new [] {"可変長データ", "EPC_VARIABLE"}
|
---|
67 | }), "VALUE");
|
---|
68 | this.setOutput(true, "Number");
|
---|
69 | this.setColour(230);
|
---|
70 | this.setTooltip("");
|
---|
71 | this.setHelpUrl("http://www.example.com/");
|
---|
72 | }
|
---|
73 | }
|
---|
74 |
|
---|
75 | public class EcnlServiceCodeBlock : Block
|
---|
76 | {
|
---|
77 | public const string type_name = "service_code";
|
---|
78 |
|
---|
79 | public EcnlServiceCodeBlock()
|
---|
80 | : base(type_name)
|
---|
81 | {
|
---|
82 |
|
---|
83 | }
|
---|
84 |
|
---|
85 | public void init()
|
---|
86 | {
|
---|
87 | this.appendDummyInput()
|
---|
88 | .appendField("サービスコード")
|
---|
89 | .appendField(new FieldDropdown(new [] {
|
---|
90 | new [] {"プロパティ値書き込み要求(応答不要)", "ESV_SET_I"},
|
---|
91 | new [] {"プロパティ値書き込み要求(応答要)", "ESV_SET_C"},
|
---|
92 | new [] {"プロパティ値読み出し要求", "ESV_GET"},
|
---|
93 | new [] {"プロパティ値通知要求", "ESV_INF_REQ"},
|
---|
94 | new [] {"プロパティ値書き込み・読み出し要求", "ESV_SET_GET"},
|
---|
95 | new [] {"プロパティ値書き込み応答", "ESV_SET_RES"},
|
---|
96 | new [] {"プロパティ値読み出し応答", "ESV_GET_RES"},
|
---|
97 | new [] {"プロパティ値通知", "ESV_INF"},
|
---|
98 | new [] {"プロパティ値通知(応答要)", "ESV_INFC"},
|
---|
99 | new [] {"プロパティ値通知応答", "ESV_INFC_RES"},
|
---|
100 | new [] {"プロパティ値書き込み・読み出し応答", "ESV_SET_GET_RES"},
|
---|
101 | new [] {"プロパティ値書き込み要求不可応答", "ESV_SET_I_SNA"},
|
---|
102 | new [] {"プロパティ値書き込み要求不可応答", "ESV_SET_C_SNA"},
|
---|
103 | new [] {"プロパティ値読み出し不可応答", "ESV_GET_SNA"},
|
---|
104 | new [] {"プロパティ値通知不可応答", "ESV_INF_SNA"},
|
---|
105 | new [] {"プロパティ値書き込み・読み出し不可応答", "ESV_SET_GET_SNA"}
|
---|
106 | }), "VALUE");
|
---|
107 | this.setOutput(true, "Number");
|
---|
108 | this.setColour(230);
|
---|
109 | this.setTooltip("");
|
---|
110 | this.setHelpUrl("http://www.example.com/");
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | public class EcnlNodeIDBlock : Block
|
---|
115 | {
|
---|
116 | public const string type_name = "node_id";
|
---|
117 |
|
---|
118 | public EcnlNodeIDBlock()
|
---|
119 | : base(type_name)
|
---|
120 | {
|
---|
121 |
|
---|
122 | }
|
---|
123 |
|
---|
124 | public void init()
|
---|
125 | {
|
---|
126 | this.appendDummyInput()
|
---|
127 | .appendField("ノードID")
|
---|
128 | .appendField(new FieldDropdown(new [] {
|
---|
129 | new [] {"アドレスID登録なし", "ENOD_NOT_MATCH_ID"},
|
---|
130 | new [] {"マルチキャストアドレスID", "ENOD_MULTICAST_ID"},
|
---|
131 | new [] {"自ノードアドレスID", "ENOD_LOCAL_ID"},
|
---|
132 | new [] {"APIアドレスID", "ENOD_API_ID"},
|
---|
133 | new [] {"他ノードID", "ENOD_REMOTE_ID"},
|
---|
134 | }), "VALUE");
|
---|
135 | this.setOutput(true, "Number");
|
---|
136 | this.setColour(230);
|
---|
137 | this.setTooltip("");
|
---|
138 | this.setHelpUrl("http://www.example.com/");
|
---|
139 | }
|
---|
140 | }
|
---|
141 |
|
---|
142 | public class EcnlPropertyLocalBlock : Block
|
---|
143 | {
|
---|
144 | public EcnlPropertyLocalBlock(string type)
|
---|
145 | : base(type)
|
---|
146 | {
|
---|
147 | }
|
---|
148 |
|
---|
149 | public string GetInputName()
|
---|
150 | {
|
---|
151 | var match = false;
|
---|
152 | Block prev, block = this;
|
---|
153 | for (;;) {
|
---|
154 | prev = block;
|
---|
155 | block = prev.getParent();
|
---|
156 | if (block == null)
|
---|
157 | break;
|
---|
158 |
|
---|
159 | if ((block.type == EPropertyVarLenBlock.type_name)
|
---|
160 | || (block.type == EPropertyFixLenBlock.type_name)) {
|
---|
161 | match = true;
|
---|
162 | break;
|
---|
163 | }
|
---|
164 | }
|
---|
165 |
|
---|
166 | if (!match)
|
---|
167 | return "";
|
---|
168 |
|
---|
169 | for (var i = 0; i < block.inputList.Length; i++) {
|
---|
170 | var input = block.inputList[i];
|
---|
171 | if (input.connection == null)
|
---|
172 | continue;
|
---|
173 |
|
---|
174 | var childBlock = input.connection.targetBlock();
|
---|
175 | if (childBlock != null && childBlock.id == prev.id) {
|
---|
176 | return input.name;
|
---|
177 | }
|
---|
178 | }
|
---|
179 |
|
---|
180 | return "";
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | public class EcnlGetPropertyInfoBlock : EcnlPropertyLocalBlock
|
---|
185 | {
|
---|
186 | public const string type_name = "get_property_info";
|
---|
187 |
|
---|
188 | public EcnlGetPropertyInfoBlock()
|
---|
189 | : base(type_name)
|
---|
190 | {
|
---|
191 | }
|
---|
192 |
|
---|
193 | public void init()
|
---|
194 | {
|
---|
195 | this.appendDummyInput()
|
---|
196 | .appendField("プロパティ")
|
---|
197 | .appendField(new FieldDropdown(new [] {
|
---|
198 | new [] {"コード", "pcd"},
|
---|
199 | new [] {"属性", "atr"},
|
---|
200 | new [] {"サイズ", "sz"}
|
---|
201 | }), "MEMBER");
|
---|
202 | this.setOutput(true, "Number");
|
---|
203 | this.setColour(230);
|
---|
204 | this.setTooltip("");
|
---|
205 | this.setHelpUrl("http://www.example.com/");
|
---|
206 | }
|
---|
207 |
|
---|
208 | public void onchange(object ev)
|
---|
209 | {
|
---|
210 | if (!String.IsNullOrEmpty(GetInputName())) {
|
---|
211 | setWarningText(null);
|
---|
212 | }
|
---|
213 | else {
|
---|
214 | setWarningText("プロパティアクセスブロックのみで使用します");
|
---|
215 | }
|
---|
216 | }
|
---|
217 | }
|
---|
218 |
|
---|
219 | public class EcnlSaveReceivedPropertyBlock : EcnlPropertyLocalBlock
|
---|
220 | {
|
---|
221 | public const string type_name = "save_received_property";
|
---|
222 |
|
---|
223 | public EcnlSaveReceivedPropertyBlock()
|
---|
224 | : base(type_name)
|
---|
225 | {
|
---|
226 | }
|
---|
227 |
|
---|
228 | public void init()
|
---|
229 | {
|
---|
230 | this.appendDummyInput()
|
---|
231 | .appendField("受信プロパティを保存")
|
---|
232 | .appendField("", "ITEM");
|
---|
233 | this.setPreviousStatement(true, null);
|
---|
234 | this.setNextStatement(true, null);
|
---|
235 | this.setColour(230);
|
---|
236 | this.setTooltip("");
|
---|
237 | this.setHelpUrl("http://www.example.com/");
|
---|
238 | }
|
---|
239 |
|
---|
240 | public void onchange(object ev)
|
---|
241 | {
|
---|
242 | if (!String.IsNullOrEmpty(GetInputName())) {
|
---|
243 | setWarningText(null);
|
---|
244 | }
|
---|
245 | else {
|
---|
246 | setWarningText("プロパティアクセスブロックのみで使用します");
|
---|
247 | }
|
---|
248 | }
|
---|
249 | }
|
---|
250 |
|
---|
251 | public class EcnlGetSavedPropertyBlock : EcnlPropertyLocalBlock
|
---|
252 | {
|
---|
253 | public const string type_name = "get_saved_property";
|
---|
254 |
|
---|
255 | public EcnlGetSavedPropertyBlock()
|
---|
256 | : base(type_name)
|
---|
257 | {
|
---|
258 | }
|
---|
259 |
|
---|
260 | public void init()
|
---|
261 | {
|
---|
262 | this.appendDummyInput()
|
---|
263 | .appendField("保存してあるプロパティ値")
|
---|
264 | .appendField("", "ITEM");
|
---|
265 | this.setOutput(true, "String");
|
---|
266 | this.setColour(230);
|
---|
267 | this.setTooltip("");
|
---|
268 | this.setHelpUrl("http://www.example.com/");
|
---|
269 | }
|
---|
270 |
|
---|
271 | public void onchange(object ev)
|
---|
272 | {
|
---|
273 | if (!String.IsNullOrEmpty(GetInputName())) {
|
---|
274 | setWarningText(null);
|
---|
275 | }
|
---|
276 | else {
|
---|
277 | setWarningText("プロパティアクセスブロックのみで使用します");
|
---|
278 | }
|
---|
279 | }
|
---|
280 | }
|
---|
281 |
|
---|
282 | public class EcnlSetAnnounceRequestBlock : EcnlPropertyLocalBlock
|
---|
283 | {
|
---|
284 | public const string type_name = "set_announce_request";
|
---|
285 |
|
---|
286 | public EcnlSetAnnounceRequestBlock()
|
---|
287 | : base(type_name)
|
---|
288 | {
|
---|
289 | }
|
---|
290 |
|
---|
291 | public void init()
|
---|
292 | {
|
---|
293 | this.appendValueInput("DATA")
|
---|
294 | .setCheck("String")
|
---|
295 | .appendField("受信データと");
|
---|
296 | this.appendDummyInput()
|
---|
297 | .appendField("を比較し変化がある場合は通知要求");
|
---|
298 | this.setInputsInline(true);
|
---|
299 | this.setPreviousStatement(true, null);
|
---|
300 | this.setNextStatement(true, null);
|
---|
301 | this.setColour(230);
|
---|
302 | this.setTooltip("");
|
---|
303 | this.setHelpUrl("http://www.example.com/");
|
---|
304 | }
|
---|
305 |
|
---|
306 | public void onchange(object ev)
|
---|
307 | {
|
---|
308 | if (GetInputName() == "SET") {
|
---|
309 | setWarningText(null);
|
---|
310 | }
|
---|
311 | else {
|
---|
312 | setWarningText("プロパティ設定ブロックのみで使用します");
|
---|
313 | }
|
---|
314 | }
|
---|
315 | }
|
---|
316 |
|
---|
317 | public class EcnlDataToNumberBlock : EcnlPropertyLocalBlock
|
---|
318 | {
|
---|
319 | public const string type_name = "data_to_number";
|
---|
320 |
|
---|
321 | public EcnlDataToNumberBlock()
|
---|
322 | : base(type_name)
|
---|
323 | {
|
---|
324 | }
|
---|
325 |
|
---|
326 | public void init()
|
---|
327 | {
|
---|
328 | this.appendValueInput("POSITION")
|
---|
329 | .setCheck("Number")
|
---|
330 | .appendField("受信データの");
|
---|
331 | this.appendDummyInput()
|
---|
332 | .appendField("Byte目から")
|
---|
333 | .appendField(new FieldDropdown(new[] {
|
---|
334 | new [] { "1", "BYTE" },
|
---|
335 | new [] { "2", "SHORT" },
|
---|
336 | new [] { "4", "INT" }
|
---|
337 | }), "WIDTH")
|
---|
338 | .appendField("Byte分の数値");
|
---|
339 | this.setInputsInline(true);
|
---|
340 | this.setOutput(true, "Number");
|
---|
341 | this.setColour(230);
|
---|
342 | this.setTooltip("");
|
---|
343 | this.setHelpUrl("http://www.example.com/");
|
---|
344 | }
|
---|
345 |
|
---|
346 | public void onchange(object ev)
|
---|
347 | {
|
---|
348 | if (GetInputName() == "SET") {
|
---|
349 | setWarningText(null);
|
---|
350 | }
|
---|
351 | else {
|
---|
352 | setWarningText("プロパティ設定ブロックのみで使用します");
|
---|
353 | }
|
---|
354 | }
|
---|
355 | }
|
---|
356 |
|
---|
357 | public class EcnlNumberToDataBlock : EcnlPropertyLocalBlock
|
---|
358 | {
|
---|
359 | public const string type_name = "number_to_data";
|
---|
360 |
|
---|
361 | public EcnlNumberToDataBlock()
|
---|
362 | : base(type_name)
|
---|
363 | {
|
---|
364 | }
|
---|
365 |
|
---|
366 | public void init()
|
---|
367 | {
|
---|
368 | this.appendValueInput("POSITION")
|
---|
369 | .setCheck("Number")
|
---|
370 | .appendField("送信データの");
|
---|
371 | this.appendDummyInput()
|
---|
372 | .appendField("Byte目から")
|
---|
373 | .appendField(new FieldDropdown(new[] {
|
---|
374 | new [] { "1", "BYTE" },
|
---|
375 | new [] { "2", "SHORT" },
|
---|
376 | new [] { "4", "INT" }
|
---|
377 | }), "WIDTH")
|
---|
378 | .appendField("Byte分に");
|
---|
379 | this.appendValueInput("VALUE")
|
---|
380 | .setCheck("Number");
|
---|
381 | this.appendDummyInput()
|
---|
382 | .appendField("を書き込み");
|
---|
383 | this.setInputsInline(true);
|
---|
384 | this.setPreviousStatement(true, null);
|
---|
385 | this.setNextStatement(true, null);
|
---|
386 | this.setColour(230);
|
---|
387 | this.setTooltip("");
|
---|
388 | this.setHelpUrl("http://www.example.com/");
|
---|
389 | }
|
---|
390 |
|
---|
391 | public void onchange(object ev)
|
---|
392 | {
|
---|
393 | if (GetInputName() == "GET") {
|
---|
394 | setWarningText(null);
|
---|
395 | }
|
---|
396 | else {
|
---|
397 | setWarningText("プロパティ取得アクセスブロックのみで使用します");
|
---|
398 | }
|
---|
399 | }
|
---|
400 | }
|
---|
401 |
|
---|
402 | public class EcnlNoOpBlock : EcnlPropertyLocalBlock
|
---|
403 | {
|
---|
404 | public const string type_name = "no_op";
|
---|
405 |
|
---|
406 | public EcnlNoOpBlock()
|
---|
407 | : base(type_name)
|
---|
408 | {
|
---|
409 | }
|
---|
410 |
|
---|
411 | public void init()
|
---|
412 | {
|
---|
413 | this.appendDummyInput()
|
---|
414 | .appendField("処理無し");
|
---|
415 | this.setPreviousStatement(true, null);
|
---|
416 | this.setColour(230);
|
---|
417 | this.setTooltip("");
|
---|
418 | this.setHelpUrl("http://www.example.com/");
|
---|
419 | }
|
---|
420 |
|
---|
421 | public void onchange(object ev)
|
---|
422 | {
|
---|
423 | if (!String.IsNullOrEmpty(GetInputName())) {
|
---|
424 | setWarningText(null);
|
---|
425 | }
|
---|
426 | else {
|
---|
427 | setWarningText("プロパティアクセスブロックのみで使用します");
|
---|
428 | }
|
---|
429 | }
|
---|
430 | }
|
---|
431 |
|
---|
432 | public class EcnlReceivedDataBlock : EcnlPropertyLocalBlock
|
---|
433 | {
|
---|
434 | public const string type_name = "received_data";
|
---|
435 |
|
---|
436 | public EcnlReceivedDataBlock()
|
---|
437 | : base(type_name)
|
---|
438 | {
|
---|
439 | }
|
---|
440 |
|
---|
441 | public void init()
|
---|
442 | {
|
---|
443 | this.appendDummyInput()
|
---|
444 | .appendField("受信データ");
|
---|
445 | this.setOutput(true, "String");
|
---|
446 | this.setColour(230);
|
---|
447 | this.setTooltip("");
|
---|
448 | this.setHelpUrl("http://www.example.com/");
|
---|
449 | }
|
---|
450 |
|
---|
451 | public void onchange(object ev)
|
---|
452 | {
|
---|
453 | if (GetInputName() == "SET") {
|
---|
454 | setWarningText(null);
|
---|
455 | }
|
---|
456 | else {
|
---|
457 | setWarningText("プロパティ設定ブロックのみで使用します");
|
---|
458 | }
|
---|
459 | }
|
---|
460 | }
|
---|
461 |
|
---|
462 | public class EcnlReceivedDataSizeBlock : EcnlPropertyLocalBlock
|
---|
463 | {
|
---|
464 | public const string type_name = "received_data_size";
|
---|
465 |
|
---|
466 | public EcnlReceivedDataSizeBlock()
|
---|
467 | : base(type_name)
|
---|
468 | {
|
---|
469 | }
|
---|
470 |
|
---|
471 | public void init()
|
---|
472 | {
|
---|
473 | this.appendDummyInput()
|
---|
474 | .appendField("受信データサイズ");
|
---|
475 | this.setOutput(true, "Number");
|
---|
476 | this.setColour(230);
|
---|
477 | this.setTooltip("");
|
---|
478 | this.setHelpUrl("http://www.example.com/");
|
---|
479 | }
|
---|
480 |
|
---|
481 | public void onchange(object ev)
|
---|
482 | {
|
---|
483 | if (!String.IsNullOrEmpty(GetInputName())) {
|
---|
484 | setWarningText(null);
|
---|
485 | }
|
---|
486 | else {
|
---|
487 | setWarningText("プロパティアクセスブロックのみで使用します");
|
---|
488 | }
|
---|
489 | }
|
---|
490 | }
|
---|
491 |
|
---|
492 | public class DataJoinBlock : Block
|
---|
493 | {
|
---|
494 | public const string type_name = "data_join";
|
---|
495 | internal int itemCount_;
|
---|
496 |
|
---|
497 | public DataJoinBlock()
|
---|
498 | : base(type_name)
|
---|
499 | {
|
---|
500 | }
|
---|
501 |
|
---|
502 | public void init()
|
---|
503 | {
|
---|
504 | this.itemCount_ = 2;
|
---|
505 | this.updateShape_();
|
---|
506 | this.setOutput(true, "String");
|
---|
507 | this.setMutator(new Mutator(new[] { DataCreateJoinItemBlock.type_name }));
|
---|
508 | this.setColour(230);
|
---|
509 | this.setTooltip("");
|
---|
510 | this.setHelpUrl("http://www.example.com/");
|
---|
511 | }
|
---|
512 |
|
---|
513 | public Element mutationToDom()
|
---|
514 | {
|
---|
515 | var container = Document.CreateElement("mutation");
|
---|
516 | container.SetAttribute("items", this.itemCount_.ToString());
|
---|
517 | return container;
|
---|
518 | }
|
---|
519 |
|
---|
520 | public void domToMutation(Element xmlElement)
|
---|
521 | {
|
---|
522 | var count = xmlElement.GetAttribute("items");
|
---|
523 | this.itemCount_ = count == null ? 0 : Script.ParseInt(count, 10);
|
---|
524 | this.updateShape_();
|
---|
525 | }
|
---|
526 |
|
---|
527 | public Block decompose(Workspace workspace)
|
---|
528 | {
|
---|
529 | var containerBlock = workspace.newBlock(DataCreateJoinContainerBlock.type_name);
|
---|
530 | containerBlock.initSvg();
|
---|
531 | var connection = containerBlock.getInput("STACK").connection;
|
---|
532 | for (var i = 0; i < this.itemCount_; i++) {
|
---|
533 | var itemBlock = workspace.newBlock(DataCreateJoinItemBlock.type_name);
|
---|
534 | itemBlock.initSvg();
|
---|
535 | connection.connect(itemBlock.previousConnection);
|
---|
536 | connection = itemBlock.nextConnection;
|
---|
537 | }
|
---|
538 | return containerBlock;
|
---|
539 | }
|
---|
540 |
|
---|
541 | public void compose(Block containerBlock)
|
---|
542 | {
|
---|
543 | var itemBlock = (DataCreateJoinItemBlock)containerBlock.getInputTargetBlock("STACK");
|
---|
544 | var connections = new Connection[0];
|
---|
545 | while (itemBlock != null) {
|
---|
546 | connections.Push(itemBlock.valueConnection_);
|
---|
547 | itemBlock = (itemBlock.nextConnection != null) ?
|
---|
548 | (DataCreateJoinItemBlock)itemBlock.nextConnection.targetBlock() : null;
|
---|
549 | }
|
---|
550 | for (var i = 0; i < this.itemCount_; i++) {
|
---|
551 | var connection = this.getInput("ADD" + i).connection.targetConnection;
|
---|
552 | if (connection != null && Array.IndexOf(connections, connection) == -1) {
|
---|
553 | connection.disconnect();
|
---|
554 | }
|
---|
555 | }
|
---|
556 | this.itemCount_ = connections.Length;
|
---|
557 | this.updateShape_();
|
---|
558 | for (var i = 0; i < this.itemCount_; i++) {
|
---|
559 | Mutator.reconnect(connections[i], this, "ADD" + i);
|
---|
560 | }
|
---|
561 | }
|
---|
562 |
|
---|
563 | public void saveConnections(Block containerBlock)
|
---|
564 | {
|
---|
565 | var itemBlock = (DataCreateJoinItemBlock)containerBlock.getInputTargetBlock("STACK");
|
---|
566 | var i = 0;
|
---|
567 | while (itemBlock != null) {
|
---|
568 | var input = this.getInput("ADD" + i);
|
---|
569 | itemBlock.valueConnection_ = (input != null) ?
|
---|
570 | input.connection.targetConnection : null;
|
---|
571 | i++;
|
---|
572 | itemBlock = (itemBlock.nextConnection != null) ?
|
---|
573 | (DataCreateJoinItemBlock)itemBlock.nextConnection.targetBlock() : null;
|
---|
574 | }
|
---|
575 | }
|
---|
576 |
|
---|
577 | private void updateShape_()
|
---|
578 | {
|
---|
579 | if (this.itemCount_ != 0 && this.getInput("EMPTY") != null) {
|
---|
580 | this.removeInput("EMPTY");
|
---|
581 | }
|
---|
582 | else if (this.itemCount_ == 0 && this.getInput("EMPTY") == null) {
|
---|
583 | this.appendDummyInput("EMPTY")
|
---|
584 | .appendField("空のデータを作ります");
|
---|
585 | }
|
---|
586 | int i;
|
---|
587 | for (i = 0; i < this.itemCount_; i++) {
|
---|
588 | if (this.getInput("ADD" + i) == null) {
|
---|
589 | var input = this.appendValueInput("ADD" + i);
|
---|
590 | if (i == 0) {
|
---|
591 | input.appendField("データを作ります");
|
---|
592 | }
|
---|
593 | }
|
---|
594 | }
|
---|
595 | while (this.getInput("ADD" + i) != null) {
|
---|
596 | this.removeInput("ADD" + i);
|
---|
597 | i++;
|
---|
598 | }
|
---|
599 | }
|
---|
600 | }
|
---|
601 |
|
---|
602 | public class DataCreateJoinContainerBlock : Block
|
---|
603 | {
|
---|
604 | public const string type_name = "data_create_join_container";
|
---|
605 |
|
---|
606 | public DataCreateJoinContainerBlock()
|
---|
607 | : base(type_name)
|
---|
608 | {
|
---|
609 | }
|
---|
610 |
|
---|
611 | public void init()
|
---|
612 | {
|
---|
613 | this.appendDummyInput()
|
---|
614 | .appendField("結合");
|
---|
615 | this.appendStatementInput("STACK");
|
---|
616 | this.setColour(230);
|
---|
617 | this.setTooltip("");
|
---|
618 | this.contextMenu = false;
|
---|
619 | }
|
---|
620 | }
|
---|
621 |
|
---|
622 | [IgnoreCast]
|
---|
623 | public class DataCreateJoinItemBlock : Block
|
---|
624 | {
|
---|
625 | public const string type_name = "data_create_join_item";
|
---|
626 | public Connection valueConnection_;
|
---|
627 |
|
---|
628 | public DataCreateJoinItemBlock()
|
---|
629 | : base(type_name)
|
---|
630 | {
|
---|
631 | }
|
---|
632 |
|
---|
633 | public void init()
|
---|
634 | {
|
---|
635 | this.appendDummyInput()
|
---|
636 | .appendField("項目");
|
---|
637 | this.setPreviousStatement(true);
|
---|
638 | this.setNextStatement(true);
|
---|
639 | this.setColour(230);
|
---|
640 | this.setTooltip("");
|
---|
641 | this.contextMenu = false;
|
---|
642 | }
|
---|
643 | }
|
---|
644 |
|
---|
645 |
|
---|
646 | public class CreateEsvGetBlock : Block
|
---|
647 | {
|
---|
648 | public const string type_name = "create_esv_get";
|
---|
649 |
|
---|
650 | public CreateEsvGetBlock()
|
---|
651 | : base(type_name)
|
---|
652 | {
|
---|
653 | }
|
---|
654 |
|
---|
655 | public void init()
|
---|
656 | {
|
---|
657 | this.jsonInit(new {
|
---|
658 | message0 = "%1 電文の作成 %2 プロパティコード %3",
|
---|
659 | args0 = new object[] {
|
---|
660 | new {
|
---|
661 | type = "field_dropdown",
|
---|
662 | name = "TYPE",
|
---|
663 | options = new [] {
|
---|
664 | new [] { "読み出し要求", "esv_get" },
|
---|
665 | new [] { "通知要求", "esv_inf_req" }
|
---|
666 | }
|
---|
667 | },
|
---|
668 | new {
|
---|
669 | type = "input_dummy"
|
---|
670 | },
|
---|
671 | new {
|
---|
672 | type = "input_value",
|
---|
673 | name = "EPC",
|
---|
674 | check = "Number",
|
---|
675 | align = "RIGHT"
|
---|
676 | }
|
---|
677 | },
|
---|
678 | output = "EData",
|
---|
679 | colour = 230,
|
---|
680 | tooltip = "",
|
---|
681 | helpUrl = "http://www.example.com/"
|
---|
682 | });
|
---|
683 | }
|
---|
684 | }
|
---|
685 |
|
---|
686 | public class CreateEsvSetBlock : Block
|
---|
687 | {
|
---|
688 | public const string type_name = "create_esv_set";
|
---|
689 |
|
---|
690 | public CreateEsvSetBlock()
|
---|
691 | : base(type_name)
|
---|
692 | {
|
---|
693 | }
|
---|
694 |
|
---|
695 | public void init()
|
---|
696 | {
|
---|
697 | this.jsonInit(new {
|
---|
698 | message0 = "%1 電文の作成 %2 プロパティコード %3 プロパティ値 %4",
|
---|
699 | args0 = new object[] {
|
---|
700 | new {
|
---|
701 | type = "field_dropdown",
|
---|
702 | name = "TYPE",
|
---|
703 | options = new [] {
|
---|
704 | new [] { "書き込み要求(応答不要)", "esv_set_i" },
|
---|
705 | new [] { "書き込み要求(応答要)", "esv_set_c" },
|
---|
706 | new [] { "書き込み・読み出し要求", "esv_set_get" },
|
---|
707 | new [] { "通知(応答要)", "esv_infc" }
|
---|
708 | }
|
---|
709 | },
|
---|
710 | new {
|
---|
711 | type = "input_dummy"
|
---|
712 | },
|
---|
713 | new {
|
---|
714 | type = "input_value",
|
---|
715 | name = "EPC",
|
---|
716 | check = "Number",
|
---|
717 | align = "RIGHT"
|
---|
718 | },
|
---|
719 | new {
|
---|
720 | type = "input_value",
|
---|
721 | name = "EDT",
|
---|
722 | check = "String",
|
---|
723 | align = "RIGHT"
|
---|
724 | }
|
---|
725 | },
|
---|
726 | output = "EData",
|
---|
727 | colour = 230,
|
---|
728 | tooltip = "",
|
---|
729 | helpUrl = "http://www.example.com/"
|
---|
730 | });
|
---|
731 | }
|
---|
732 | }
|
---|
733 |
|
---|
734 | public class EsvAddEdtBlock : Block
|
---|
735 | {
|
---|
736 | public const string type_name = "esv_add_edt";
|
---|
737 |
|
---|
738 | public EsvAddEdtBlock()
|
---|
739 | : base(type_name)
|
---|
740 | {
|
---|
741 | }
|
---|
742 |
|
---|
743 | public void init()
|
---|
744 | {
|
---|
745 | this.jsonInit(new {
|
---|
746 | message0 = "%1 に %2 %3 として %4 %5 を追加",
|
---|
747 | args0 = new object[] {
|
---|
748 | new {
|
---|
749 | type = "field_variable",
|
---|
750 | name = "ESV",
|
---|
751 | variable = "item"
|
---|
752 | },
|
---|
753 | new {
|
---|
754 | type = "input_dummy"
|
---|
755 | },
|
---|
756 | new {
|
---|
757 | type = "input_value",
|
---|
758 | name = "EPC",
|
---|
759 | check = "Number"
|
---|
760 | },
|
---|
761 | new {
|
---|
762 | type = "input_dummy"
|
---|
763 | },
|
---|
764 | new {
|
---|
765 | type = "input_value",
|
---|
766 | name = "EDT",
|
---|
767 | check = "String"
|
---|
768 | }
|
---|
769 | },
|
---|
770 | previousStatement = (Union<string, string[]>)null,
|
---|
771 | nextStatement = (Union<string, string[]>)null,
|
---|
772 | colour = 230,
|
---|
773 | tooltip = "",
|
---|
774 | helpUrl = "http://www.example.com/"
|
---|
775 | });
|
---|
776 | }
|
---|
777 | }
|
---|
778 |
|
---|
779 | public class EsvAddEpcBlock : Block
|
---|
780 | {
|
---|
781 | public const string type_name = "esv_add_epc";
|
---|
782 |
|
---|
783 | public EsvAddEpcBlock()
|
---|
784 | : base(type_name)
|
---|
785 | {
|
---|
786 | }
|
---|
787 |
|
---|
788 | public void init()
|
---|
789 | {
|
---|
790 | this.jsonInit(new {
|
---|
791 | message0 = "%1 に %2 %3 を追加",
|
---|
792 | args0 = new object[] {
|
---|
793 | new {
|
---|
794 | type = "field_variable",
|
---|
795 | name = "ESV",
|
---|
796 | variable = "item"
|
---|
797 | },
|
---|
798 | new {
|
---|
799 | type = "input_dummy"
|
---|
800 | },
|
---|
801 | new {
|
---|
802 | type = "input_value",
|
---|
803 | name = "EPC",
|
---|
804 | check = "Number"
|
---|
805 | }
|
---|
806 | },
|
---|
807 | previousStatement = (Union<string, string[]>)null,
|
---|
808 | nextStatement = (Union<string, string[]>)null,
|
---|
809 | colour = 230,
|
---|
810 | tooltip = "",
|
---|
811 | helpUrl = "http://www.example.com/"
|
---|
812 | });
|
---|
813 | }
|
---|
814 | }
|
---|
815 |
|
---|
816 | public class SendEsvBlock : Block
|
---|
817 | {
|
---|
818 | public const string type_name = "send_esv";
|
---|
819 |
|
---|
820 | public SendEsvBlock()
|
---|
821 | : base(type_name)
|
---|
822 | {
|
---|
823 | }
|
---|
824 |
|
---|
825 | public void init()
|
---|
826 | {
|
---|
827 | this.jsonInit(new {
|
---|
828 | message0 = "%1 を送信",
|
---|
829 | args0 = new object[] {
|
---|
830 | new {
|
---|
831 | type = "field_variable",
|
---|
832 | name = "ESV",
|
---|
833 | variable = "item"
|
---|
834 | }
|
---|
835 | },
|
---|
836 | previousStatement = (Union<string, string[]>)null,
|
---|
837 | nextStatement = (Union<string, string[]>)null,
|
---|
838 | colour = 230,
|
---|
839 | tooltip = "",
|
---|
840 | helpUrl = "http://www.example.com/"
|
---|
841 | });
|
---|
842 | }
|
---|
843 | }
|
---|
844 |
|
---|
845 | public class ReleaseEsvBlock : Block
|
---|
846 | {
|
---|
847 | public const string type_name = "release_esv";
|
---|
848 |
|
---|
849 | public ReleaseEsvBlock()
|
---|
850 | : base(type_name)
|
---|
851 | {
|
---|
852 | }
|
---|
853 |
|
---|
854 | public void init()
|
---|
855 | {
|
---|
856 | this.jsonInit(new {
|
---|
857 | message0 = "%1 を破棄",
|
---|
858 | args0 = new object[] {
|
---|
859 | new {
|
---|
860 | type = "field_variable",
|
---|
861 | name = "ESV",
|
---|
862 | variable = "item"
|
---|
863 | }
|
---|
864 | },
|
---|
865 | previousStatement = (Union<string, string[]>)null,
|
---|
866 | nextStatement = (Union<string, string[]>)null,
|
---|
867 | colour = 230,
|
---|
868 | tooltip = "",
|
---|
869 | helpUrl = "http://www.example.com/"
|
---|
870 | });
|
---|
871 | }
|
---|
872 | }
|
---|
873 |
|
---|
874 | public class NotifyInitialEsvBlock : Block
|
---|
875 | {
|
---|
876 | public const string type_name = "notify_initial_esv";
|
---|
877 |
|
---|
878 | public NotifyInitialEsvBlock()
|
---|
879 | : base(type_name)
|
---|
880 | {
|
---|
881 | }
|
---|
882 |
|
---|
883 | public void init()
|
---|
884 | {
|
---|
885 | this.jsonInit(new {
|
---|
886 | message0 = "インスタンスリスト通知の送信",
|
---|
887 | previousStatement = (Union<string, string[]>)null,
|
---|
888 | nextStatement = (Union<string, string[]>)null,
|
---|
889 | colour = 230,
|
---|
890 | tooltip = "",
|
---|
891 | helpUrl = "http://www.example.com/"
|
---|
892 | });
|
---|
893 | }
|
---|
894 | }
|
---|
895 |
|
---|
896 | public class EsvGetEsvBlock : Block
|
---|
897 | {
|
---|
898 | public const string type_name = "esv_get_esv";
|
---|
899 |
|
---|
900 | public EsvGetEsvBlock()
|
---|
901 | : base(type_name)
|
---|
902 | {
|
---|
903 | }
|
---|
904 |
|
---|
905 |
|
---|
906 | public void init()
|
---|
907 | {
|
---|
908 | this.jsonInit(new {
|
---|
909 | message0 = "%1 のサービスコード",
|
---|
910 | args0 = new object[] {
|
---|
911 | new {
|
---|
912 | type = "field_variable",
|
---|
913 | name = "ESV",
|
---|
914 | variable = "item"
|
---|
915 | }
|
---|
916 | },
|
---|
917 | output = "Number",
|
---|
918 | colour = 230,
|
---|
919 | tooltip = "",
|
---|
920 | helpUrl = "http://www.example.com/"
|
---|
921 | });
|
---|
922 | }
|
---|
923 | }
|
---|
924 |
|
---|
925 | public class EsvIterateBlock : Block
|
---|
926 | {
|
---|
927 | public const string type_name = "esv_iterate";
|
---|
928 |
|
---|
929 | public EsvIterateBlock()
|
---|
930 | : base(type_name)
|
---|
931 | {
|
---|
932 | }
|
---|
933 |
|
---|
934 | public void init()
|
---|
935 | {
|
---|
936 | this.jsonInit(new {
|
---|
937 | message0 = "%1 にある要素で繰り返し %2 %3",
|
---|
938 | args0 = new object[] {
|
---|
939 | new {
|
---|
940 | type = "field_variable",
|
---|
941 | name = "ESV",
|
---|
942 | variable = "item"
|
---|
943 | },
|
---|
944 | new {
|
---|
945 | type = "input_dummy"
|
---|
946 | },
|
---|
947 | new {
|
---|
948 | type = "input_statement",
|
---|
949 | name = "DO"
|
---|
950 | }
|
---|
951 | },
|
---|
952 | previousStatement = (Union<string, string[]>)null,
|
---|
953 | nextStatement = (Union<string, string[]>)null,
|
---|
954 | colour = 230,
|
---|
955 | tooltip = "",
|
---|
956 | helpUrl = "http://www.example.com/"
|
---|
957 | });
|
---|
958 | }
|
---|
959 | }
|
---|
960 |
|
---|
961 | public class EsvIteratorBlock : Block
|
---|
962 | {
|
---|
963 | public const string type_name = "esv_iterator";
|
---|
964 |
|
---|
965 | public EsvIteratorBlock()
|
---|
966 | : base(type_name)
|
---|
967 | {
|
---|
968 | }
|
---|
969 |
|
---|
970 | public void init()
|
---|
971 | {
|
---|
972 | this.jsonInit(new {
|
---|
973 | message0 = "%1",
|
---|
974 | args0 = new object[] {
|
---|
975 | new {
|
---|
976 | type = "field_dropdown",
|
---|
977 | name = "ITEM",
|
---|
978 | options = new [] {
|
---|
979 | new [] { "プロパティコード", "epc" },
|
---|
980 | new [] { "プロパティ値", "edt" },
|
---|
981 | new [] { "要素の番号", "state" }
|
---|
982 | }
|
---|
983 | }
|
---|
984 | },
|
---|
985 | output = "Number",
|
---|
986 | colour = 230,
|
---|
987 | tooltip = "",
|
---|
988 | helpUrl = "http://www.example.com/"
|
---|
989 | });
|
---|
990 | }
|
---|
991 | }
|
---|
992 |
|
---|
993 | public class SvctaskSetTimerBlock : Block
|
---|
994 | {
|
---|
995 | public const string type_name = "svctask_set_timer";
|
---|
996 |
|
---|
997 | public SvctaskSetTimerBlock()
|
---|
998 | : base(type_name)
|
---|
999 | {
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | public void init()
|
---|
1003 | {
|
---|
1004 | this.jsonInit(new {
|
---|
1005 | message0 = "%1 %2 のタイマーを %3 [ms]に設定",
|
---|
1006 | args0 = new object[] {
|
---|
1007 | new {
|
---|
1008 | type = "field_variable",
|
---|
1009 | name = "SVC",
|
---|
1010 | variable = "item"
|
---|
1011 | },
|
---|
1012 | new {
|
---|
1013 | type = "input_dummy"
|
---|
1014 | },
|
---|
1015 | new {
|
---|
1016 | type = "input_value",
|
---|
1017 | name = "TIMER",
|
---|
1018 | check = "Number"
|
---|
1019 | }
|
---|
1020 | },
|
---|
1021 | colour = 230,
|
---|
1022 | tooltip = "",
|
---|
1023 | helpUrl = "http://www.example.com/"
|
---|
1024 | });
|
---|
1025 | }
|
---|
1026 | }
|
---|
1027 |
|
---|
1028 | public class SvctaskTimerBlock : Block
|
---|
1029 | {
|
---|
1030 | public const string type_name = "svctask_timer";
|
---|
1031 |
|
---|
1032 | public SvctaskTimerBlock()
|
---|
1033 | : base(type_name)
|
---|
1034 | {
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | public void init()
|
---|
1038 | {
|
---|
1039 | this.jsonInit(new {
|
---|
1040 | message0 = "%1 のタイマー値",
|
---|
1041 | args0 = new object[] {
|
---|
1042 | new {
|
---|
1043 | type = "field_variable",
|
---|
1044 | name = "SVC",
|
---|
1045 | variable = "item"
|
---|
1046 | }
|
---|
1047 | },
|
---|
1048 | output = "Number",
|
---|
1049 | colour = 230,
|
---|
1050 | tooltip = "",
|
---|
1051 | helpUrl = "http://www.example.com/"
|
---|
1052 | });
|
---|
1053 | }
|
---|
1054 | }
|
---|
1055 |
|
---|
1056 | public class SvctaskProgressBlock : Block
|
---|
1057 | {
|
---|
1058 | public const string type_name = "svctask_progress";
|
---|
1059 |
|
---|
1060 | public SvctaskProgressBlock()
|
---|
1061 | : base(type_name)
|
---|
1062 | {
|
---|
1063 | }
|
---|
1064 |
|
---|
1065 | public void init()
|
---|
1066 | {
|
---|
1067 | this.jsonInit(new {
|
---|
1068 | message0 = "%1 %2 の時間を %3 [ms]経過させる",
|
---|
1069 | args0 = new object[] {
|
---|
1070 | new {
|
---|
1071 | type = "field_variable",
|
---|
1072 | name = "SVC",
|
---|
1073 | variable = "item"
|
---|
1074 | },
|
---|
1075 | new {
|
---|
1076 | type = "input_dummy"
|
---|
1077 | },
|
---|
1078 | new {
|
---|
1079 | type = "input_value",
|
---|
1080 | name = "ELAPSE",
|
---|
1081 | check = "Number"
|
---|
1082 | }
|
---|
1083 | },
|
---|
1084 | previousStatement = (Union<string, string[]>)null,
|
---|
1085 | nextStatement = (Union<string, string[]>)null,
|
---|
1086 | colour = 230,
|
---|
1087 | tooltip = "",
|
---|
1088 | helpUrl = "http://www.example.com/"
|
---|
1089 | });
|
---|
1090 | }
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 | public class SvctaskRecvMsgBlock : Block
|
---|
1094 | {
|
---|
1095 | public const string type_name = "svctask_recv_msg";
|
---|
1096 |
|
---|
1097 | public SvctaskRecvMsgBlock()
|
---|
1098 | : base(type_name)
|
---|
1099 | {
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | public void init()
|
---|
1103 | {
|
---|
1104 | this.jsonInit(new {
|
---|
1105 | message0 = "%1 に %2 通信端点 %3 からの %4 データ %5 を渡す",
|
---|
1106 | args0 = new object[] {
|
---|
1107 | new {
|
---|
1108 | type = "field_variable",
|
---|
1109 | name = "SVC",
|
---|
1110 | variable = "item"
|
---|
1111 | },
|
---|
1112 | new {
|
---|
1113 | type = "input_dummy"
|
---|
1114 | },
|
---|
1115 | new {
|
---|
1116 | type = "input_value",
|
---|
1117 | name = "ENDPOINT",
|
---|
1118 | check = "String"
|
---|
1119 | },
|
---|
1120 | new {
|
---|
1121 | type = "input_dummy"
|
---|
1122 | },
|
---|
1123 | new {
|
---|
1124 | type = "input_value",
|
---|
1125 | name = "DATA",
|
---|
1126 | check = "String"
|
---|
1127 | }
|
---|
1128 | },
|
---|
1129 | previousStatement = (Union<string, string[]>)null,
|
---|
1130 | nextStatement = (Union<string, string[]>)null,
|
---|
1131 | colour = 230,
|
---|
1132 | tooltip = "",
|
---|
1133 | helpUrl = "http://www.example.com/"
|
---|
1134 | });
|
---|
1135 | }
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | public class SvctaskCallTimeoutBlock : Block
|
---|
1139 | {
|
---|
1140 | public const string type_name = "svctask_call_timeout";
|
---|
1141 |
|
---|
1142 | public SvctaskCallTimeoutBlock()
|
---|
1143 | : base(type_name)
|
---|
1144 | {
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | public void init()
|
---|
1148 | {
|
---|
1149 | this.jsonInit(new {
|
---|
1150 | message0 = "%1 のタイムアウト処理を行う",
|
---|
1151 | args0 = new object[] {
|
---|
1152 | new {
|
---|
1153 | type = "field_variable",
|
---|
1154 | name = "SVC",
|
---|
1155 | variable = "item"
|
---|
1156 | }
|
---|
1157 | },
|
---|
1158 | previousStatement = (Union<string, string[]>)null,
|
---|
1159 | nextStatement = (Union<string, string[]>)null,
|
---|
1160 | colour = 230,
|
---|
1161 | tooltip = "",
|
---|
1162 | helpUrl = "http://www.example.com/"
|
---|
1163 | });
|
---|
1164 | }
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | public class SvctaskIsMatchBlock : Block
|
---|
1168 | {
|
---|
1169 | public const string type_name = "svctask_is_match";
|
---|
1170 |
|
---|
1171 | public SvctaskIsMatchBlock()
|
---|
1172 | : base(type_name)
|
---|
1173 | {
|
---|
1174 | }
|
---|
1175 |
|
---|
1176 | public void init()
|
---|
1177 | {
|
---|
1178 | this.jsonInit(new {
|
---|
1179 | message0 = "%1 で %2 ノード %3 は %4 通信端点 %5 と %6 電文 %7 に対応している",
|
---|
1180 | args0 = new object[] {
|
---|
1181 | new {
|
---|
1182 | type = "field_variable",
|
---|
1183 | name = "SVC",
|
---|
1184 | variable = "item"
|
---|
1185 | },
|
---|
1186 | new {
|
---|
1187 | type = "input_dummy"
|
---|
1188 | },
|
---|
1189 | new {
|
---|
1190 | type = "input_value",
|
---|
1191 | name = "NODE",
|
---|
1192 | check = "EObject"
|
---|
1193 | },
|
---|
1194 | new {
|
---|
1195 | type = "input_dummy"
|
---|
1196 | },
|
---|
1197 | new {
|
---|
1198 | type = "input_value",
|
---|
1199 | name = "ENDPOINT",
|
---|
1200 | check = "String"
|
---|
1201 | },
|
---|
1202 | new {
|
---|
1203 | type = "input_dummy"
|
---|
1204 | },
|
---|
1205 | new {
|
---|
1206 | type = "input_value",
|
---|
1207 | name = "EDTAT",
|
---|
1208 | check = "String"
|
---|
1209 | }
|
---|
1210 | },
|
---|
1211 | output = "Boolean",
|
---|
1212 | colour = 230,
|
---|
1213 | tooltip = "",
|
---|
1214 | helpUrl = "http://www.example.com/"
|
---|
1215 | });
|
---|
1216 | }
|
---|
1217 | }
|
---|
1218 |
|
---|
1219 | partial class Ruby
|
---|
1220 | {
|
---|
1221 | public node property_attribute(EcnlPropertyAttributeBlock block)
|
---|
1222 | {
|
---|
1223 | var value = block.getFieldValue("VALUE");
|
---|
1224 | var ecnl = new const_node(this, intern("ECNL"));
|
---|
1225 | return new colon2_node(this, ecnl, intern(value));
|
---|
1226 | }
|
---|
1227 |
|
---|
1228 | public node service_code(EcnlServiceCodeBlock block)
|
---|
1229 | {
|
---|
1230 | var value = block.getFieldValue("VALUE");
|
---|
1231 | var ecnl = new const_node(this, intern("ECNL"));
|
---|
1232 | return new colon2_node(this, ecnl, intern(value));
|
---|
1233 | }
|
---|
1234 |
|
---|
1235 | public node node_id(EcnlNodeIDBlock block)
|
---|
1236 | {
|
---|
1237 | var value = block.getFieldValue("VALUE");
|
---|
1238 | var ecnl = new const_node(this, intern("ECNL"));
|
---|
1239 | return new colon2_node(this, ecnl, intern(value));
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | public node get_property_info(EcnlGetPropertyInfoBlock block)
|
---|
1243 | {
|
---|
1244 | var member = block.getFieldValue("MEMBER");
|
---|
1245 | var prop = new lvar_node(this, local_add_f("prop"));
|
---|
1246 | return new call_node(this, prop, intern(member));
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | public node save_received_property(EcnlSaveReceivedPropertyBlock block)
|
---|
1250 | {
|
---|
1251 | var src = new lvar_node(this, local_add_f("src"));
|
---|
1252 | var prop = new lvar_node(this, local_add_f("prop"));
|
---|
1253 | return new call_node(this, prop, intern("set_exinf"), new node[] { src });
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | public node get_saved_property(EcnlGetSavedPropertyBlock block)
|
---|
1257 | {
|
---|
1258 | var prop = new lvar_node(this, local_add_f("prop"));
|
---|
1259 | return new call_node(this, prop, intern("exinf"));
|
---|
1260 | }
|
---|
1261 |
|
---|
1262 | public node set_announce_request(EcnlSetAnnounceRequestBlock block)
|
---|
1263 | {
|
---|
1264 | // if (prop.anno)
|
---|
1265 | // prop.set_anno(data != src)
|
---|
1266 | // end
|
---|
1267 | var prop = new lvar_node(this, local_add_f("prop"));
|
---|
1268 | var cond = new call_node(this, prop, intern("anno"));
|
---|
1269 | var data = valueToCode(block, "DATA");
|
---|
1270 | var src = new lvar_node(this, local_add_f("src"));
|
---|
1271 | var arg = new call_node(this, data, intern("!="), src);
|
---|
1272 | var then = new call_node(this, prop, intern("set_exinf"), new node[] { arg });
|
---|
1273 | return new if_node(this, cond, then, null, false);
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | public node data_to_number(EcnlDataToNumberBlock block)
|
---|
1277 | {
|
---|
1278 | var value_position = valueToCode(block, "POSITION");
|
---|
1279 | var dropdown_width = block.getFieldValue("WIDTH");
|
---|
1280 | var src = new lvar_node(this, local_add_f("src"));
|
---|
1281 |
|
---|
1282 | switch (dropdown_width) {
|
---|
1283 | case "BYTE":
|
---|
1284 | return new call_node(this, src, intern("getbyte"), new node[] { value_position });
|
---|
1285 | case "SHORT":
|
---|
1286 | return new fcall_node(this, intern("ecnl_getshort"), new node[] { src, value_position });
|
---|
1287 | case "INT":
|
---|
1288 | return new fcall_node(this, intern("ecnl_getint"), new node[] { src, value_position });
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | throw new NotImplementedException();
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | public node number_to_data(EcnlNumberToDataBlock block)
|
---|
1295 | {
|
---|
1296 | var value_position = valueToCode(block, "POSITION");
|
---|
1297 | var dropdown_width = block.getFieldValue("WIDTH");
|
---|
1298 | var value_value = valueToCode(block, "VALUE");
|
---|
1299 | var src = new lvar_node(this, local_add_f("src"));
|
---|
1300 |
|
---|
1301 | switch (dropdown_width) {
|
---|
1302 | case "BYTE":
|
---|
1303 | return new call_node(this, src, intern("setbyte"), new node[] { value_position, value_value });
|
---|
1304 | case "SHORT":
|
---|
1305 | return new fcall_node(this, intern("ecnl_setshort"), new node[] { src, value_position, value_value });
|
---|
1306 | case "INT":
|
---|
1307 | return new fcall_node(this, intern("ecnl_setint"), new node[] { src, value_position, value_value });
|
---|
1308 | }
|
---|
1309 |
|
---|
1310 | throw new NotImplementedException();
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | public node no_op(EcnlNoOpBlock block)
|
---|
1314 | {
|
---|
1315 | switch (block.GetInputName()) {
|
---|
1316 | case "SET":
|
---|
1317 | return new return_node(this, new int_node(this, 0));
|
---|
1318 | case "GET":
|
---|
1319 | return new return_node(this, new str_node(this, ""));
|
---|
1320 | }
|
---|
1321 | return new return_node(this, null);
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 | public node received_data(EcnlReceivedDataBlock block)
|
---|
1325 | {
|
---|
1326 | return new lvar_node(this, local_add_f("src"));
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | public node received_data_size(EcnlReceivedDataSizeBlock block)
|
---|
1330 | {
|
---|
1331 | switch (block.GetInputName()) {
|
---|
1332 | case "SET":
|
---|
1333 | case "SET_RET":
|
---|
1334 | var src = new lvar_node(this, local_add_f("src"));
|
---|
1335 | return new call_node(this, src, intern("bytesize"));
|
---|
1336 | case "GET":
|
---|
1337 | return new lvar_node(this, local_add_f("size"));
|
---|
1338 | }
|
---|
1339 | return new int_node(this, 0);
|
---|
1340 | }
|
---|
1341 |
|
---|
1342 | public node data_join(DataJoinBlock block)
|
---|
1343 | {
|
---|
1344 | if (block.itemCount_ == 0) {
|
---|
1345 | return new str_node(this, "");
|
---|
1346 | }
|
---|
1347 | else if (block.itemCount_ == 1) {
|
---|
1348 | var argument0 = valueToCode(block, "ADD0");
|
---|
1349 | if (argument0 == null) argument0 = new str_node(this, "");
|
---|
1350 | return new call_node(this, argument0, intern("chr"));
|
---|
1351 | }
|
---|
1352 | else if (block.itemCount_ == 2) {
|
---|
1353 | var argument0 = valueToCode(block, "ADD0");
|
---|
1354 | if (argument0 == null) argument0 = new str_node(this, "");
|
---|
1355 | argument0 = new call_node(this, argument0, intern("chr"));
|
---|
1356 | var argument1 = valueToCode(block, "ADD1");
|
---|
1357 | if (argument1 == null) argument1 = new str_node(this, "");
|
---|
1358 | argument1 = new call_node(this, argument1, intern("chr"));
|
---|
1359 | return new call_node(this, argument0, intern("+"), new node[] { argument1 });
|
---|
1360 | }
|
---|
1361 | else {
|
---|
1362 | var codes = valueToCode(block, "ADD0");
|
---|
1363 | var argument0 = codes;
|
---|
1364 | if (argument0 == null) argument0 = new str_node(this, "");
|
---|
1365 | argument0 = new call_node(this, argument0, intern("chr"));
|
---|
1366 | for (var n = 1; n < block.itemCount_; n++) {
|
---|
1367 | var argument1 = valueToCode(block, "ADD" + n);
|
---|
1368 | if (argument1 == null) argument1 = new str_node(this, "");
|
---|
1369 | argument1 = new call_node(this, argument1, intern("chr"));
|
---|
1370 | argument0 = new call_node(this, argument0, intern("+"), new node[] { argument1 });
|
---|
1371 | }
|
---|
1372 | return codes;
|
---|
1373 | }
|
---|
1374 | }
|
---|
1375 |
|
---|
1376 | public node create_esv_get(CreateEsvGetBlock block)
|
---|
1377 | {
|
---|
1378 | var dropdown_type = block.getFieldValue("TYPE");
|
---|
1379 | var value_epc = valueToCode(block, "EPC");
|
---|
1380 | var nil = new nil_node(this);
|
---|
1381 | // nilにはリモートノードを指定できる
|
---|
1382 | return new fcall_node(this, intern(dropdown_type), new node[] { nil, value_epc });
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | public node create_esv_set(CreateEsvSetBlock block)
|
---|
1386 | {
|
---|
1387 | var dropdown_type = block.getFieldValue("TYPE");
|
---|
1388 | var value_epc = valueToCode(block, "EPC");
|
---|
1389 | var value_edt = valueToCode(block, "EDT");
|
---|
1390 | var nil = new nil_node(this);
|
---|
1391 | // nilにはリモートノードを指定できる
|
---|
1392 | return new fcall_node(this, intern(dropdown_type), new node[] { nil, value_epc, value_edt });
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | public node esv_add_edt(EsvAddEdtBlock block)
|
---|
1396 | {
|
---|
1397 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1398 | var value_epc = valueToCode(block, "EPC");
|
---|
1399 | var value_edt = valueToCode(block, "EDT");
|
---|
1400 | return new call_node(this, variable_esv, intern("add_edt"), new node[] { value_epc, value_edt });
|
---|
1401 | }
|
---|
1402 |
|
---|
1403 | public node esv_add_epc(EsvAddEpcBlock block)
|
---|
1404 | {
|
---|
1405 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1406 | var value_epc = valueToCode(block, "EPC");
|
---|
1407 | return new call_node(this, variable_esv, intern("add_epc"), new node[] { value_epc });
|
---|
1408 | }
|
---|
1409 |
|
---|
1410 | public node send_esv(SendEsvBlock block)
|
---|
1411 | {
|
---|
1412 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1413 | return new fcall_node(this, intern("snd_esv"), new node[] { variable_esv });
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | public node release_esv(ReleaseEsvBlock block)
|
---|
1417 | {
|
---|
1418 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1419 | return new fcall_node(this, intern("rel_esv"), new node[] { variable_esv });
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | public node notify_initial_esv(NotifyInitialEsvBlock block)
|
---|
1423 | {
|
---|
1424 | return new fcall_node(this, intern("ntf_inl"));
|
---|
1425 | }
|
---|
1426 |
|
---|
1427 | public node esv_get_esv(EsvGetEsvBlock block)
|
---|
1428 | {
|
---|
1429 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1430 | return new call_node(this, variable_esv, intern("esv"));
|
---|
1431 | }
|
---|
1432 |
|
---|
1433 | public node esv_iterate(EsvIterateBlock block)
|
---|
1434 | {
|
---|
1435 | var variable_esv = new_var_node(get_var_name(block.getFieldValue("ESV")));
|
---|
1436 | local_nest();
|
---|
1437 | var statements_do = statementToCode(block, "DO");
|
---|
1438 | var itr = new arg_node(this, local_add_f("itr"));
|
---|
1439 | var proc = new block_node(this, new node[] { itr }, statements_do, false);
|
---|
1440 | local_unnest();
|
---|
1441 | return new fcall_node(this, intern("ecnl_esv_iterate"), new node[] { variable_esv }, proc);
|
---|
1442 | }
|
---|
1443 |
|
---|
1444 | public node esv_iterator(EsvIteratorBlock block)
|
---|
1445 | {
|
---|
1446 | var dropdown_item = block.getFieldValue("ITEM");
|
---|
1447 | var itr = new lvar_node(this, local_add_f("itr"));
|
---|
1448 | return new call_node(this, itr, intern(dropdown_item));
|
---|
1449 | }
|
---|
1450 |
|
---|
1451 | public node svctask_set_timer(SvctaskSetTimerBlock block)
|
---|
1452 | {
|
---|
1453 | var variable_svc = new_var_node(get_var_name(block.getFieldValue("SVC")));
|
---|
1454 | var value_timer = valueToCode(block, "TIMER");
|
---|
1455 | return new call_node(this, variable_svc, intern("set_timer"), new node[] { value_timer });
|
---|
1456 | }
|
---|
1457 |
|
---|
1458 | public node svctask_timer(SvctaskTimerBlock block)
|
---|
1459 | {
|
---|
1460 | var variable_svc = new_var_node(get_var_name(block.getFieldValue("SVC")));
|
---|
1461 | return new call_node(this, variable_svc, intern("timer"));
|
---|
1462 | }
|
---|
1463 |
|
---|
1464 | public node svctask_progress(SvctaskProgressBlock block)
|
---|
1465 | {
|
---|
1466 | var variable_svc = new_var_node(get_var_name(block.getFieldValue("SVC")));
|
---|
1467 | var value_elapse = valueToCode(block, "ELAPSE");
|
---|
1468 | return new call_node(this, variable_svc, intern("progress"), new node[] { value_elapse });
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | public node svctask_recv_msg(SvctaskRecvMsgBlock block)
|
---|
1472 | {
|
---|
1473 | var variable_svc = new_var_node(get_var_name(block.getFieldValue("SVC")));
|
---|
1474 | var value_endpoint = valueToCode(block, "ENDPOINT");
|
---|
1475 | var value_data = valueToCode(block, "DATA");
|
---|
1476 | return new call_node(this, variable_svc, intern("recv_msg"), new node[] { value_endpoint, value_data });
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | public node svctask_call_timeout(SvctaskCallTimeoutBlock block)
|
---|
1480 | {
|
---|
1481 | var variable_svc = new_var_node(get_var_name(block.getFieldValue("SVC")));
|
---|
1482 | return new call_node(this, variable_svc, intern("call_timeout"));
|
---|
1483 | }
|
---|
1484 |
|
---|
1485 | public node svctask_is_match(SvctaskIsMatchBlock block)
|
---|
1486 | {
|
---|
1487 | var value_node = valueToCode(block, "NODE");
|
---|
1488 | var value_edtat = valueToCode(block, "EDTAT");
|
---|
1489 | var value_endpoint = valueToCode(block, "ENDPOINT");
|
---|
1490 | return new fcall_node(this, intern("is_match"), new node[] { value_node, value_edtat, value_endpoint });
|
---|
1491 | }
|
---|
1492 | }
|
---|
1493 | }
|
---|