source: UsbWattMeter/trunk/ecnl_lwip/echonet.tf@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 20.2 KB
Line 
1$ =====================================================================
2$
3$ TOPPERS ECHONET Lite Communication Middleware
4$
5$ Copyright (C) 2014-2016 Cores Co., Ltd. Japan
6$
7$ ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
8$ ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
9$ •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
10$ (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
11$ Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
12$ ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
13$ (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
14$ —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
15ƒƒ“ƒgi—˜—p
16$ ŽÒƒ}ƒjƒ…
17ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
18$ ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
19$ (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20$ —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
21$ ‚ƁD
22$ (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
24ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
25$ ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
26$ (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
27$ •ñ‚·‚邱‚ƁD
28$ (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
29$ ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
30$ ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
31$ —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
32$ –Ɛӂ·‚邱‚ƁD
33$
34$ –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
35$ ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
36$ ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
37$ ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
38$ ‚̐ӔC‚𕉂í‚È‚¢D
39$
40$ @(#) $Id: echonet.tf 164 2016-03-07 11:33:50Z coas-nagasima $
41$
42$ =====================================================================
43
44$ =====================================================================
45$ echonet_cfg.h‚̐¶¬
46$ =====================================================================
47
48$FILE "echonet_cfg.h"$
49/* echonet_cfg.h */$NL$
50#ifndef TOPPERS_ECHONET_CFG_H$NL$
51#define TOPPERS_ECHONET_CFG_H$NL$
52$NL$
53
54#include "echonet_app_config.h"$NL$
55$NL$
56
57$ ƒm[ƒhƒŠƒXƒg‚̍쐬
58$ENOD.LIST = {}$
59$LOCAL_NODE = {}$
60$REMOTE_NODE = {}$
61
62$FOREACH eobjid EOBJ.ORDER_LIST$
63$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹ƒIƒuƒWƒFƒNƒg‚̏ꍇ
64 $IF (EOBJ.EOBJATR[eobjid] & EOBJ_LOCAL_NODE) != 0$
65 $LOCAL_NODE = APPEND(LOCAL_NODE, eobjid)$
66$ // ‹@ŠíƒIƒuƒWƒFƒNƒg‚̏ꍇ
67 $ELIF (EOBJ.EOBJATR[eobjid] & (EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
68 $REMOTE_NODE = APPEND(REMOTE_NODE, eobjid)$
69 $END$
70$END$
71
72$ // ƒ[ƒJƒ‹‚̃m[ƒhƒvƒƒtƒ@ƒCƒ‹‚Í‚P‚‚¾‚¯
73$IF LENGTH(LOCAL_NODE) != 1$
74 $ERROR$Local node must be only one.$END$
75$END$
76
77$ENOD.LIST = APPEND(LOCAL_NODE, REMOTE_NODE)$
78
79#define TNUM_ENODID $LENGTH(ENOD.LIST)$$NL$
80$NL$
81
82#define TNUM_EOBJID $LENGTH(EOBJ.ID_LIST)$$NL$
83$NL$
84$FOREACH id EOBJ.ID_LIST$
85 #define $id$ $+id$$NL$
86$END$
87$NL$
88
89$FOREACH eobjid EOBJ.ID_LIST$
90 $eprp_list = {}$
91 $prp_map_cnt = 3$
92$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹‚̏ꍇ
93 $IF (EOBJ.EOBJATR[eobjid] & (EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
94 $prp_map_cnt = prp_map_cnt + 5$
95 $END$
96
97 $FOREACH eprpno EPRP.ID_LIST$
98 $IF EQ(EPRP.EOBJID[eprpno], eobjid)$
99 $eprp_list = APPEND(eprp_list, eprpno)$
100 $END$
101
102 $IF (EPRP.EPRPCD[eprpno] == 0x9D) || (EPRP.EPRPCD[eprpno] == 0x9E) || (EPRP.EPRPCD[eprpno] == 0x9F)$
103 $prp_map_cnt = prp_map_cnt - 1$
104 $END$
105
106$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹‚̏ꍇ
107 $IF (EOBJ.EOBJATR[eobjid] & (EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
108 $IF (EPRP.EPRPCD[eprpno] >= 0xD3) && (EPRP.EPRPCD[eprpno] <= 0xD7)$
109 $prp_map_cnt = prp_map_cnt - 1$
110 $END$
111 $END$
112 $END$
113
114 #define TNUM_$EOBJ.EOBJID[eobjid]$_EPRPNO $LENGTH(eprp_list) + prp_map_cnt$$NL$
115$END$$NL$
116
117$FOREACH enodid ENOD.LIST$
118 $eobj_count = 0$
119
120 $FOREACH eobjid EOBJ.ID_LIST$
121 $IF EQ(EOBJ.ENODID[eobjid], enodid)$
122 $eobj_count = eobj_count + 1$
123 $END$
124 $END$
125
126 #define TNUM_$EOBJ.EOBJID[enodid]$_EOBJNO $eobj_count$$NL$
127$END$$NL$
128
129#ifndef TNUM_ENODADR$NL$
130#define TNUM_ENODADR 100$NL$
131#endif$NL$
132$NL$
133
134#endif /* TOPPERS_ECHONET_CFG_H */$NL$
135
136$ =====================================================================
137$ echonet_cfg.c‚̐¶¬
138$ =====================================================================
139
140$FILE "echonet_cfg.c"$
141/* echonet_cfg.c */$NL$
142#include "echonet.h"$NL$
143#include "echonet_cfg.h"$NL$
144$NL$
145
146$
147$ ƒCƒ“ƒNƒ‹[ƒhƒfƒBƒŒƒNƒeƒBƒui#includej
148$
149/*$NL$
150$SPC$* Include Directives (#include)$NL$
151$SPC$*/$NL$
152$NL$
153$INCLUDES$
154$NL$
155
156$
157$ ƒIƒuƒWƒFƒNƒg‚ÌID”ԍ†‚ð•ÛŽ‚·‚é•Ï”
158$
159$IF USE_EXTERNAL_ID$
160 /*$NL$
161 $SPC$* Variables for Object ID$NL$
162 $SPC$*/$NL$
163 $NL$
164 $FOREACH id EOBJ.ID_LIST$
165 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
166 $END$
167$END$
168
169$
170$ ECHONET LiteƒvƒƒpƒeƒB
171$
172/*$NL$
173$SPC$* ECHONET Lite Property Functions$NL$
174$SPC$*/$NL$
175$NL$
176
177$INCLUDE "echonet_chk.tf"$
178
179$ ECHONET LiteƒvƒƒpƒeƒB‰Šú‰»ƒuƒƒbƒN‚̐¶¬
180$IF LENGTH(EOBJ.ID_LIST) && LENGTH(EPRP.ID_LIST)$
181 $FOREACH enodid ENOD.LIST$
182 $INST_LIST = {}$
183 $CLASS_LIST = {}$
184
185 $FOREACH eobjid EOBJ.ID_LIST$
186 $IF EQ(EOBJ.ENODID[eobjid], enodid)$
187 $INST_LIST = APPEND(INST_LIST, eobjid)$
188
189 $M = -1$
190 $FOREACH id CLASS_LIST$
191 $IF (EOBJ.EOJX1[eobjid] == EOBJ.EOJX1[id]) && (EOBJ.EOJX2[eobjid] == EOBJ.EOJX2[id])$
192 $M = id$
193 $END$
194 $END$
195 $IF M == -1$
196 $CLASS_LIST = APPEND(CLASS_LIST, eobjid)$
197 $END$
198 $END$
199 $END$
200
201 /*$NL$
202 $SPC$* ƒCƒ“ƒXƒ^ƒ“ƒX”$NL$
203 $SPC$*/$NL$
204 $inst_list_len = LENGTH(INST_LIST)$
205 const uint8_t _echonet_$EOBJ.EOBJID[enodid]$_inst_count[] = {$NL$
206 $TAB$$FORMAT("0x%1$x, 0x%2$x, 0x%3$x", (inst_list_len & 0xFF0000) >> 16, (inst_list_len & 0xFF00) >> 8, inst_list_len & 0xFF)$$NL$
207 };$NL$
208 $NL$
209
210 /*$NL$
211 $SPC$* ƒNƒ‰ƒX”$NL$
212 $SPC$*/$NL$
213$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹‚àŠÜ‚ß‚éi + 1j
214 $class_list_len = LENGTH(CLASS_LIST) + 1$
215 const uint8_t _echonet_$EOBJ.EOBJID[enodid]$_class_count[] = {$NL$
216 $TAB$$FORMAT("0x%1$x, 0x%2$x", (class_list_len & 0xFF00) >> 8, class_list_len & 0xFF)$$NL$
217 };$NL$
218 $NL$
219
220 /*$NL$
221 $SPC$* ƒCƒ“ƒXƒ^ƒ“ƒXƒŠƒXƒg$NL$
222 $SPC$*/$NL$
223 $pos = 0$
224 $IF inst_list_len > 84$
225 $ERROR EPRP.TEXT_LINE[eprpno]$E_PAR: $FORMAT(_("instance list count overflow, %1% %2% > 84"), enodid, inst_list_len)$$END$
226 $END$
227 const uint8_t _echonet_$EOBJ.EOBJID[enodid]$_inst_list[] = {$NL$
228 $IF inst_list_len > 0xFE$
229 $TAB$0xFF,
230 $ELSE$
231 $TAB$$FORMAT("0x%1$x, ", inst_list_len)$
232 $END$
233 $JOINEACH id INST_LIST ", "$
234 $FORMAT("0x%1$x, 0x%2$x, 0x%3$x", +EOBJ.EOJX1[id], +EOBJ.EOJX2[id], +EOBJ.EOJX3[id])$
235 $END$$NL$
236 };$NL$
237 $NL$
238
239 /*$NL$
240 $SPC$* ƒNƒ‰ƒXƒŠƒXƒg$NL$
241 $SPC$*/$NL$
242 $pos = 0$
243 $class_list_len = LENGTH(CLASS_LIST)$
244 $IF class_list_len > 84$
245 $ERROR EPRP.TEXT_LINE[eprpno]$E_PAR: $FORMAT(_("class list count overflow, %1% %2% > 84"), enodid, class_list_len)$$END$
246 $END$
247 const uint8_t _echonet_$EOBJ.EOBJID[enodid]$_class_list[] = {$NL$
248 $IF class_list_len > 0xFE$
249 $TAB$0xFF,
250 $ELSE$
251 $TAB$$FORMAT("0x%1$x, ", class_list_len)$
252 $END$
253 $JOINEACH id CLASS_LIST ", "$
254 $FORMAT("0x%1$x, 0x%2$x", +EOBJ.EOJX1[id], +EOBJ.EOJX2[id])$
255 $END$$NL$
256 };$NL$
257 $NL$
258 $END$
259
260 $FOREACH eobjid EOBJ.ID_LIST$
261 $eprp_list = {}$
262 $anno_list = {}$
263 $set_list = {}$
264 $get_list = { 0x9D, 0x9E, 0x9F }$
265 $FOREACH i { 0 , 1 , ... , 15 }$
266 $anno_map[i] = 0x00$
267 $set_map[i] = 0x00$
268 $get_map[i] = 0x00$
269 $END$
270$ // 0x9DA0x9EA0x9F‚ÍON‚É‚µ‚Ä‚¨‚­
271 $FOREACH i { 13 , 14 , 15 }$
272 $anno_map[i] = anno_map[i] | 0x02$
273 $get_map[i] = get_map[i] | 0x02$
274 $END$
275$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹‚̏ꍇ
276 $IF (EOBJ.EOBJATR[eobjid] & (EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
277 $anno_map[5] = anno_map[5] | 0x20$
278 $anno_list = APPEND(anno_list, { 0xD5 })$
279 $FOREACH i { 3 , 4 , 6 , 7 }$
280 $get_map[i] = get_map[i] | 0x20$
281 $END$
282 $get_list = APPEND(get_list, { 0xD3, 0xD4, 0xD6, 0xD7 })$
283 $END$
284
285 $FOREACH eprpno EPRP.ID_LIST$
286 $IF EQ(EPRP.EOBJID[eprpno], eobjid)$
287$ // (0x80 <= eprpcd && eprpcd <= 0xFF)‚Å‚È‚¢ê‡iE_PARj
288 $IF !(0x80 <= EPRP.EPRPCD[eprpno] && EPRP.EPRPCD[eprpno] <= 0xFF)$
289 $ERROR EPRP.TEXT_LINE[eprpno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eprpcd", EPRP.EPRPCD[eprpno], eprpno, "ECN_DEF_EPRP")$$END$
290 $END$
291
292$ // eprpatr‚ªimEPC_RULE_SET] | [EPC_RULE_GET] | [EPC_RULE_ANNO] | [EPC_ANNOUNCEn| [EPC_VARIABLE]j‚Å‚È‚¢ê‡iE_RSATRj
293 $IF (EPRP.EPRPATR[eprpno] & ~(EPC_RULE_SET|EPC_RULE_GET|EPC_RULE_ANNO|EPC_ANNOUNCE|EPC_VARIABLE)) != 0$
294 $ERROR EPRP.TEXT_LINE[eprpno]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eprpatr", EPRP.EPRPATR[eprpno], eprpno, "ECN_DEF_EPRP")$$END$
295 $END$
296
297$ // (0 <= eprpsz && eprpsz <= 255)‚Å‚È‚¢ê‡iE_PARj
298 $IF !(0 <= EPRP.EPRPSZ[eprpno] && EPRP.EPRPSZ[eprpno] <= 255)$
299 $ERROR EPRP.TEXT_LINE[eprpno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eprpsz", EPRP.EPRPSZ[eprpno], eprpno, "ECN_DEF_EPRP")$$END$
300 $END$
301
302$ // ƒvƒƒpƒeƒBƒ}ƒbƒv‚ɐݒè
303 $pos = EPRP.EPRPCD[eprpno] & 0xF$
304 $bit = (EPRP.EPRPCD[eprpno] >> 4) - 8$
305 $IF (EPRP.EPRPATR[eprpno] & EPC_ANNOUNCE) != 0$
306 $anno_list = APPEND(anno_list, EPRP.EPRPCD[eprpno])$
307 $anno_map[pos] = anno_map[pos] | (1 << bit)$
308 $END$
309 $IF (EPRP.EPRPATR[eprpno] & EPC_RULE_SET) != 0$
310 $set_list = APPEND(set_list, EPRP.EPRPCD[eprpno])$
311 $set_map[pos] = set_map[pos] | (1 << bit)$
312 $END$
313 $IF (EPRP.EPRPATR[eprpno] & EPC_RULE_GET) != 0$
314 $get_list = APPEND(get_list, EPRP.EPRPCD[eprpno])$
315 $get_map[pos] = get_map[pos] | (1 << bit)$
316 $END$
317
318 $eprp_list = APPEND(eprp_list, eprpno)$
319 $END$
320 $END$
321
322$ // •K{ƒAƒiƒEƒ“ƒXƒvƒƒpƒeƒB‚ª‚ ‚é‚©ƒ`ƒFƒbƒN
323 $must_anno_map = GetPropertyInfo(EOBJ.EOJX1[eobjid], EOBJ.EOJX2[eobjid], EPC_ANNOUNCE)$
324 $i = 0$
325 $WHILE i < LENGTH(ResultOfGetPropertyInfo)$
326 $j = FIND(anno_list, +AT(ResultOfGetPropertyInfo, i))$
327 $IF !LENGTH(j)$
328 $ERROR$$FORMAT("Required announce property (0x%1$x) of %2% is not defined.", +AT(ResultOfGetPropertyInfo, i), eobjid)$$END$
329 $END$
330 $i = i + 1$
331 $END$
332
333$ // •K{SETƒvƒƒpƒeƒB‚ª‚ ‚é‚©ƒ`ƒFƒbƒN
334 $must_set_map = GetPropertyInfo(EOBJ.EOJX1[eobjid], EOBJ.EOJX2[eobjid], EPC_RULE_SET)$
335 $i = 0$
336 $WHILE i < LENGTH(ResultOfGetPropertyInfo)$
337 $j = FIND(set_list, +AT(ResultOfGetPropertyInfo, i))$
338 $IF !LENGTH(j)$
339 $ERROR$$FORMAT("Required set property (0x%1$x) of %2% is not defined.", +AT(ResultOfGetPropertyInfo, i), eobjid)$$END$
340 $END$
341 $i = i + 1$
342 $END$
343
344$ // •K{GETƒvƒƒpƒeƒB‚ª‚ ‚é‚©ƒ`ƒFƒbƒN
345 $must_get_map = GetPropertyInfo(EOBJ.EOJX1[eobjid], EOBJ.EOJX2[eobjid], EPC_RULE_GET)$
346 $i = 0$
347 $WHILE i < LENGTH(ResultOfGetPropertyInfo)$
348 $j = FIND(get_list, +AT(ResultOfGetPropertyInfo, i))$
349 $IF !LENGTH(j)$
350 $ERROR$$FORMAT("Required get property (0x%1$x) of %2% is not defined.", +AT(ResultOfGetPropertyInfo, i), eobjid)$$END$
351 $END$
352 $i = i + 1$
353 $END$
354
355 /*$NL$
356 $SPC$* ƒAƒiƒEƒ“ƒXƒvƒƒpƒeƒBƒ}ƒbƒv$NL$
357 $SPC$*/$NL$
358 $anno_list = LSORT(anno_list, "compare")$
359 $anno_len = LENGTH(anno_list)$
360 const uint8_t _echonet_$EOBJ.EOBJID[eobjid]$_anno_prpmap[] = {$NL$
361 $TAB$$FORMAT("0x%1$x" , +anno_len)$,
362 $IF anno_len < 16$
363 $JOINEACH eprpcd anno_list ", "$
364 $FORMAT("0x%1$x" , +eprpcd)$
365 $END$$NL$
366 $anno_len = anno_len + 1$
367 $ELSE$
368 $JOINEACH i anno_map ", "$
369 $FORMAT("0x%1$x" , +anno_map[i])$
370 $END$$NL$
371 $anno_len = 17$
372 $END$
373 };$NL$
374 $NL$
375
376 /*$NL$
377 $SPC$* SETƒvƒƒpƒeƒBƒ}ƒbƒv$NL$
378 $SPC$*/$NL$
379 $set_list = LSORT(set_list, "compare")$
380 $set_len = LENGTH(set_list)$
381 const uint8_t _echonet_$EOBJ.EOBJID[eobjid]$_set_prpmap[] = {$NL$
382 $TAB$$FORMAT("0x%1$x" , +set_len)$,
383 $IF set_len < 16$
384 $JOINEACH eprpcd set_list ", "$
385 $FORMAT("0x%1$x" , +eprpcd)$
386 $END$$NL$
387 $set_len = set_len + 1$
388 $ELSE$
389 $JOINEACH i set_map ", "$
390 $FORMAT("0x%1$x" , +set_map[i])$
391 $END$$NL$
392 $set_len = 17$
393 $END$
394 };$NL$
395 $NL$
396
397 /*$NL$
398 $SPC$* GETƒvƒƒpƒeƒBƒ}ƒbƒv$NL$
399 $SPC$*/$NL$
400 $get_list = LSORT(get_list, "compare")$
401 $get_len = LENGTH(get_list)$
402 const uint8_t _echonet_$EOBJ.EOBJID[eobjid]$_get_prpmap[] = {$NL$
403 $TAB$$FORMAT("0x%1$x" , +get_len)$,
404 $IF get_len < 16$
405 $JOINEACH eprpcd get_list ", "$
406 $FORMAT("0x%1$x" , +eprpcd)$
407 $END$$NL$
408 $get_len = get_len + 1$
409 $ELSE$
410 $JOINEACH i { 0 , 1 , ... , 15 } ", "$
411 $FORMAT("0x%1$x" , +get_map[i])$
412 $END$$NL$
413 $get_len = 17$
414 $END$
415 };$NL$
416 $NL$
417
418 /*$NL$
419 $SPC$* ƒvƒƒpƒeƒB’è‹`$NL$
420 $SPC$*/$NL$
421 const EPRPINIB _echonet_$EOBJ.EOBJID[eobjid]$_eprpinib_table[TNUM_$EOBJ.EOBJID[eobjid]$_EPRPNO] = {$NL$
422 $FOREACH eprpno eprp_list$
423$ // ECHONET LiteƒvƒƒpƒeƒB‰Šú‰»ƒuƒƒbƒN
424 $TAB${ ($EPRP.EPRPCD[eprpno]$), ($EPRP.EPRPATR[eprpno]$), ($EPRP.EPRPSZ[eprpno]$), ($EPRP.EXINF[eprpno]$), ($EPRP.EPRPSET[eprpno]$), ($EPRP.EPRPGET[eprpno]$) },$NL$
425 $END$
426$ // ó‘ÔƒAƒiƒEƒ“ƒXƒvƒƒpƒeƒBƒ}ƒbƒv
427 $TAB${ (0x9D), (EPC_RULE_GET), $FORMAT("0x%1$x" , +anno_len)$, (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_anno_prpmap, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
428$ // SetƒvƒƒpƒeƒBƒ}ƒbƒv
429 $TAB${ (0x9E), (EPC_RULE_GET), $FORMAT("0x%1$x" , +set_len)$, (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_set_prpmap, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
430$ // GetƒvƒƒpƒeƒBƒ}ƒbƒv
431 $TAB${ (0x9F), (EPC_RULE_GET), $FORMAT("0x%1$x" , +get_len)$, (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_get_prpmap, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) }
432$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹‚̏ꍇ
433 $IF (EOBJ.EOBJATR[eobjid] & (EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
434 ,$NL$
435$ // ƒCƒ“ƒXƒ^ƒ“ƒX”
436 $TAB${ (0xD3), (EPC_RULE_GET), (3), (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_inst_count, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
437$ // ƒNƒ‰ƒX”
438 $TAB${ (0xD4), (EPC_RULE_GET), (2), (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_class_count, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
439$ // ƒCƒ“ƒXƒ^ƒ“ƒXƒŠƒXƒg’Ê’m
440 $TAB${ (0xD5), (EPC_RULE_ANNO), sizeof(_echonet_$EOBJ.EOBJID[eobjid]$_inst_list), (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_inst_list, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
441$ // ƒCƒ“ƒXƒ^ƒ“ƒXƒŠƒXƒgS
442 $TAB${ (0xD6), (EPC_RULE_GET), sizeof(_echonet_$EOBJ.EOBJID[eobjid]$_inst_list), (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_inst_list, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) },$NL$
443$ // ƒNƒ‰ƒXƒŠƒXƒgS
444 $TAB${ (0xD7), (EPC_RULE_GET), sizeof(_echonet_$EOBJ.EOBJID[eobjid]$_class_list), (intptr_t)_echonet_$EOBJ.EOBJID[eobjid]$_class_list, ((EPRP_SETTER *)NULL), ((EPRP_GETTER *)ecn_data_prop_get) }$NL$
445 $ELSE$
446 $NL$
447 $END$
448 };$NL$
449 $NL$
450 $END$$NL$
451
452$ELSE$
453 TOPPERS_EMPTY_LABEL(const EPRPINIB, _echonet_eprpinib_table);$NL$
454$END$
455
456$
457$ ECHONET LiteƒIƒuƒWƒFƒNƒg
458$
459/*$NL$
460$SPC$* ECHONET Lite Object Functions$NL$
461$SPC$*/$NL$
462$NL$
463
464$ ECHONET LiteƒIƒuƒWƒFƒNƒgID”ԍ†‚̍őå’l
465const ID _echonet_tmax_eobjid = (TMIN_EOBJID + TNUM_EOBJID - 1);$NL$
466$NL$
467
468$ ECHONET LiteƒIƒuƒWƒFƒNƒg‰Šú‰»ƒuƒƒbƒN‚̐¶¬
469$IF LENGTH(EOBJ.ID_LIST)$
470 const EOBJINIB _echonet_eobjinib_table[TNUM_EOBJID] = {$NL$
471 $JOINEACH eobjid EOBJ.ID_LIST ",\n"$
472$ // eobjatr‚ªimEOBJ_LOCAL_NODE] | [EOBJ_SYNC_REMOTE_NODE] | [EOBJ_ASYNC_REMOTE_NODE] | [EOBJ_DEVICEnj‚Å‚È‚¢ê‡iE_RSATRj
473 $IF (EOBJ.EOBJATR[eobjid] & ~(EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE|EOBJ_DEVICE)) != 0$
474 $ERROR EOBJ.TEXT_LINE[eobjid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eobjatr", EOBJ.EOBJATR[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
475 $END$
476
477$ // ƒm[ƒhƒvƒƒtƒ@ƒCƒ‹ƒIƒuƒWƒFƒNƒg‚̏ꍇ
478 $IF (EOBJ.EOBJATR[eobjid] & (EOBJ_LOCAL_NODE|EOBJ_SYNC_REMOTE_NODE|EOBJ_ASYNC_REMOTE_NODE)) != 0$
479$ // (enodid == EOBJ_NULL)‚Å‚È‚¢ê‡iE_PARj
480 $IF !EQ(EOBJ.ENODID[eobjid], EOBJ_NULL)$
481 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "enodid", EOBJ.ENODID[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
482 $END$
483
484$ // (eojx1 == EOJ_X1_PROFILE)‚Å‚È‚¢ê‡iE_PARj
485 $IF EOBJ.EOJX1[eobjid] != EOJ_X1_PROFILE$
486 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx1", EOBJ.EOJX1[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
487 $END$
488
489$ // (eojx2 == EOJ_X2_NODE_PROFILE)‚Å‚È‚¢ê‡iE_PARj
490 $IF EOBJ.EOJX2[eobjid] != EOJ_X2_NODE_PROFILE$
491 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx2", EOBJ.EOJX2[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
492 $END$
493
494$ // (1 <= eojx3 && eojx3 <= 2)‚Å‚È‚¢ê‡iE_PARj
495 $IF !(1 <= EOBJ.EOJX3[eobjid] && EOBJ.EOJX3[eobjid] <= 2)$
496 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx3", EOBJ.EOJX3[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
497 $END$
498$ // ‹@ŠíƒIƒuƒWƒFƒNƒg‚̏ꍇ
499 $ELSE$
500$ // (enodid != EOBJ_NULL)‚Å‚È‚¢ê‡iE_PARj
501 $IF EQ(EOBJ.ENODID[eobjid], EOBJ_NULL)$
502 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "enodid", EOBJ.ENODID[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
503 $END$
504
505$ // (0 <= eojx1 && eojx1 <= 255)‚Å‚È‚¢ê‡iE_PARj
506 $IF !(0 <= EOBJ.EOJX1[eobjid] && EOBJ.EOJX1[eobjid] <= 255)$
507 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx1", EOBJ.EOJX1[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
508 $END$
509
510$ // (0 <= eojx2 && eojx2 <= 255)‚Å‚È‚¢ê‡iE_PARj
511 $IF !(0 <= EOBJ.EOJX2[eobjid] && EOBJ.EOJX2[eobjid] <= 255)$
512 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx2", EOBJ.EOJX2[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
513 $END$
514
515$ // (0 <= eojx3 && eojx3 <= 255)‚Å‚È‚¢ê‡iE_PARj
516 $IF !(0 <= EOBJ.EOJX3[eobjid] && EOBJ.EOJX3[eobjid] <= 255)$
517 $ERROR EOBJ.TEXT_LINE[eobjid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "eojx3", EOBJ.EOJX3[eobjid], eobjid, "ECN_CRE_EOBJ")$$END$
518 $END$
519 $END$
520
521$ // ECHONET LiteƒIƒuƒWƒFƒNƒg‰Šú‰»ƒuƒƒbƒN
522 $TAB${ ($EOBJ.EOBJATR[eobjid]$), ($EOBJ.ENODID[eobjid]$), ($EOBJ.EXINF[eobjid]$), ($EOBJ.EOJX1[eobjid]$), ($EOBJ.EOJX2[eobjid]$), ($EOBJ.EOJX3[eobjid]$), _echonet_$EOBJ.EOBJID[eobjid]$_eprpinib_table, TNUM_$EOBJ.EOBJID[eobjid]$_EPRPNO }
523 $END$$NL$
524 };$NL$
525 $NL$
526$ELSE$
527 TOPPERS_EMPTY_LABEL(const EOBJINIB, _echonet_eobjinib_table);$NL$
528$END$
529$NL$
530
531$ ECHONET Liteƒm[ƒhŠÇ—ƒuƒƒbƒN‚̐”
532const int _echonet_tnum_enodid = TNUM_ENODID;$NL$
533$NL$
534
535$
536$ ECHONET Liteƒm[ƒhŠÇ—ƒuƒƒbƒN
537$
538/*$NL$
539$SPC$* ECHONET Lite Node Functions$NL$
540$SPC$*/$NL$
541$NL$
542$ ECHONET Liteƒm[ƒh‚ÆIPƒAƒhƒŒƒX‚̑Ήžî•ñƒuƒƒbƒN‚̐¶¬
543$FOREACH enodid ENOD.LIST$
544 $eobj_list = {}$
545 $FOREACH eobjid EOBJ.ID_LIST$
546 $IF EQ(EOBJ.ENODID[eobjid], enodid)$
547 $eobj_list = APPEND(eobj_list, eobjid)$
548 $END$
549 $END$
550 /*$NL$
551 $SPC$* ƒm[ƒh‚ɏŠ‘®‚·‚é‹@ŠíƒIƒuƒWƒFƒNƒg‚̈ꗗ$NL$
552 $SPC$*/$NL$
553 const EOBJINIB *_echonet_$EOBJ.EOBJID[enodid]$_eobjinib_table[TNUM_$EOBJ.EOBJID[enodid]$_EOBJNO] = {$NL$
554 $JOINEACH eobjid eobj_list ",\n"$
555 $TAB${ &_echonet_eobjinib_table[$eobjid$ - 1] }
556 $END$$NL$
557 };$NL$
558$END$$NL$
559
560$IF LENGTH(ENOD.LIST)$
561 /*$NL$
562 $SPC$* ECHONET Liteƒm[ƒhŠÇ—ƒuƒƒbƒN$NL$
563 $SPC$*/$NL$
564 EOBJCB _echonet_eobjcb_table[TNUM_ENODID] = {$NL$
565 $JOINEACH enodid ENOD.LIST ",\n"$
566 $TAB${ &_echonet_eobjinib_table[$enodid$ - 1], _echonet_$EOBJ.EOBJID[enodid]$_eobjinib_table, TNUM_$EOBJ.EOBJID[enodid]$_EOBJNO }
567 $END$$NL$
568 };$NL$
569$ELSE$
570 TOPPERS_EMPTY_LABEL(EOBJCB, _echonet_eobjcb_table);$NL$
571$END$
572$NL$
573
574$ ECHONET Liteƒm[ƒh‚ÆIPƒAƒhƒŒƒX‚̑Ήžî•ñ‚̐”
575const int _echonet_tnum_enodadr = TNUM_ENODADR;$NL$
576$NL$
577
578$
579$ ECHONET Liteƒm[ƒh‚ÆIPƒAƒhƒŒƒX‚̑Ήžî•ñ
580$
581/*$NL$
582$SPC$* ECHONET Lite Node Functions$NL$
583$SPC$*/$NL$
584$NL$
585$ ECHONET Liteƒm[ƒh‚ÆIPƒAƒhƒŒƒX‚̑Ήžî•ñƒuƒƒbƒN‚̐¶¬
586$IF LENGTH(EOBJ.ID_LIST)$
587 ENODADRB _echonet_enodadrb_table[TNUM_ENODADR] = {$NL$
588 $JOINEACH enodid ENOD.LIST ",\n"$
589 $IF enodid == 1$
590 $TAB$/* ENOD_MULTICAST_ID $TAB$*/ { true, ECHONET_MULTICAST_ADDR },$NL$
591 $TAB$/* ENOD_LOCAL_ID $TAB$*/ { true, },$NL$
592 $TAB$/* ENOD_API_ID $TAB$*/ { true, }
593 $ELSE$
594 $TAB$/* ENOD_REMOTE_ID + $enodid - 4$$TAB$*/ { true, }
595 $END$
596 $END$$NL$
597 };$NL$
598$ELSE$
599 TOPPERS_EMPTY_LABEL(ENODADRB, _echonet_enodadrb_table);$NL$
600$END$
601$NL$
602
603$NL$
604#include "kernel_cfg.h"$NL$
605$NL$
606
607$
608$ ECHONET Lite ƒJ[ƒlƒ‹ƒIƒuƒWƒFƒNƒgID
609$
610const ID _echonet_ecn_svc_taskid = ECHONET_SVC_TASK;$NL$
611const ID _echonet_ecn_udp_taskid = ECHONET_UDP_TASK;$NL$
612const ID _echonet_ecn_api_mailboxid = ECHONET_API_MAILBOX;$NL$
613const ID _echonet_ecn_svc_mailboxid = ECHONET_SVC_MAILBOX;$NL$
614const ID _echonet_ecn_udp_mailboxid = ECHONET_UDP_MAILBOX;$NL$
615const ID _echonet_ecn_mem_semid = ECHONET_MEM_SEMAPHORE;$NL$
616$NL$
617
Note: See TracBrowser for help on using the repository browser.