source: UsbWattMeter/trunk/ecnl_lwip/echonet_dbg.c@ 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/x-csrc
File size: 13.0 KB
Line 
1/*
2 * TOPPERS ECHONET Lite Communication Middleware
3 *
4 * Copyright (C) 2014-2016 Cores Co., Ltd. Japan
5 *
6 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
7 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
8 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
9 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
10 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
11 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
12 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
13 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
14ƒƒ“ƒgi—˜—p
15 * ŽÒƒ}ƒjƒ…
16ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
17 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
18 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
19 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
20 * ‚ƁD
21 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
22ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
23ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
24 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
25 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
26 * •ñ‚·‚邱‚ƁD
27 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
28 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
29 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
30 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
31 * –Ɛӂ·‚邱‚ƁD
32 *
33 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
34 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
35 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
36 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
37 * ‚̐ӔC‚𕉂í‚È‚¢D
38 *
39 * @(#) $Id: echonet_dbg.c 164 2016-03-07 11:33:50Z coas-nagasima $
40 */
41
42/*
43 * ECHONET Lite ƒ^ƒXƒN ƒfƒoƒbƒOo—Í
44 */
45
46#include <kernel.h>
47#include <stdio.h>
48#include <stdlib.h>
49#include <stdarg.h>
50#include <string.h>
51#include <t_syslog.h>
52#include <t_stdlib.h>
53#include <sil.h>
54#include <ctype.h>
55
56#include "syssvc/serial.h"
57#include "syssvc/syslog.h"
58
59#include "echonet.h"
60#include "echonet_dbg.h"
61#include "echonet_fbs.h"
62#include "echonet_task.h"
63
64#ifdef ECN_DBG_WAI_ENA
65#define _ECN_DBG_WAI_SYSLOG _ecn_dbg_wai_syslog()
66#else
67#define _ECN_DBG_WAI_SYSLOG
68#endif
69
70#if defined(ECN_DBG_PUT_ENA) || defined(ECN_CAP_PUT_ENA)
71#if defined(ECN_DBG_WAI_ENA)
72static ER _ecn_dbg_wai_syslog(void);
73/*
74 * syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â
75 */
76static ER _ecn_dbg_wai_syslog(void)
77{
78 T_SYSLOG_RLOG a_rlog;
79 ER a_ret;
80 int a_ct = 0;
81#ifndef ECN_DBG_WAI_SYSLOG_RETRY
82 #ifdef LOGTASK
83 #define ECN_DBG_WAI_SYSLOG_RETRY 10
84 #else
85 #define ECN_DBG_WAI_SYSLOG_RETRY 0
86 #endif
87#endif
88
89 for (;;) {
90 a_ret = syslog_ref_log(&a_rlog);
91 if (a_ret < 0)
92 return a_ret;
93 if (1 <= a_rlog.count) {
94 a_ct = 0;
95 } else
96#if (defined ECN_DBG_WAI_SYSLOG_RETRY) && (0 < ECN_DBG_WAI_SYSLOG_RETRY)
97 if (ECN_DBG_WAI_SYSLOG_RETRY <= ++a_ct)
98#endif
99 {
100/* a_ret = dly_tsk(100);
101 if (a_ret < 0 && a_ret != E_RLWAI)
102 return a_ret; // */
103 break;
104 }
105
106 a_ret = dly_tsk(1);
107 if (a_ret < 0 && a_ret != E_RLWAI)
108 return a_ret;
109 }
110 return 0;
111}
112#endif /* #if defined(ECN_DBG_WAI_ENA) */
113
114/*
115 * ƒfƒoƒbƒOo—Í
116 * —áF ECN_DBG_PUT( "task start" );
117 */
118int _ecn_dbg_dbgput(const char *fp_srcloc, const char *fp_form, ...)
119{
120 va_list v;
121 unsigned char p_buf[256];
122 ID tskid;
123#ifndef ECN_DBG_PUT_BUF_MAX
124 #define ECN_DBG_PUT_BUF_MAX 255
125#endif
126
127 get_tid(&tskid);
128
129 if (!fp_srcloc)
130 fp_srcloc = "(null)";
131
132#ifdef SEM_ECN_DBG_PUT
133 syscall(wai_sem(SEM_ECN_DBG_PUT));
134#endif
135
136 va_start(v, fp_form);
137
138#ifdef _MSC_VER
139 vsnprintf_s(p_buf, ECN_DBG_PUT_BUF_MAX, ECN_DBG_PUT_BUF_MAX, fp_form, v);
140#else
141 vsprintf(p_buf, fp_form, v);
142#endif
143
144 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
145
146#ifdef SEM_ECN_DBG_PUT
147 syscall(sig_sem(SEM_ECN_DBG_PUT));
148#endif
149
150 syslog(LOG_NOTICE, "%s[%d]: %s", fp_srcloc, (int)tskid, p_buf);
151
152 va_end(v);
153
154 return 0;
155}
156
157/* ECN_ENOD_ID‚Ì•¶Žš—ñ•ÏŠ· */
158const char *_ecn_dbg_enod2str(ECN_ENOD_ID fa_enod_id)
159{
160/* #define _ECN_FBS_DBG_ENOD2STR_BUF_MAX_BIT (4)
161/* */
162#ifdef _ECN_FBS_DBG_ENOD2STR_BUF_MAX_BIT
163 static volatile uint8_t a_idx_vol = 0;
164 static char a_buf[1 << _ECN_FBS_DBG_ENOD2STR_BUF_MAX_BIT][sizeof("ENOD_REMOTE_ID()")+5];
165 uint8_t a_idx;
166#endif
167
168 if (fa_enod_id == ENOD_NOT_MATCH_ID)
169 return "ENOD_NOT_MATCH_ID";
170 if (fa_enod_id == ENOD_MULTICAST_ID)
171 return "ENOD_MULTICAST_ID";
172 if (fa_enod_id == ENOD_LOCAL_ID)
173 return "ENOD_LOCAL_ID";
174 if (fa_enod_id == ENOD_API_ID)
175 return "ENOD_API_ID";
176 if (fa_enod_id == ENOD_REMOTE_ID)
177 return "ENOD_REMOTE_ID(0)";
178 if (fa_enod_id == ((ENOD_REMOTE_ID) + 1))
179 return "ENOD_REMOTE_ID(1)";
180 if (fa_enod_id == ((ENOD_REMOTE_ID) + 2))
181 return "ENOD_REMOTE_ID(2)";
182 if (fa_enod_id == ((ENOD_REMOTE_ID) + 3))
183 return "ENOD_REMOTE_ID(3)";
184 if (fa_enod_id == ((ENOD_REMOTE_ID) + 4))
185 return "ENOD_REMOTE_ID(4)";
186 if (fa_enod_id == ((ENOD_REMOTE_ID) + 5))
187 return "ENOD_REMOTE_ID(5)";
188#ifdef _ECN_FBS_DBG_ENOD2STR_BUF_MAX_BIT
189 if (ENOD_REMOTE_ID <= fa_enod_id) {
190 /* return "ENOD_REMOTE_ID"; */
191 a_idx = (++a_idx_vol) & ((1 << _ECN_FBS_DBG_ENOD2STR_BUF_MAX_BIT) - 1);
192#ifdef _MSC_VER
193 sprintf_s(a_buf[a_idx], sizeof(*a_buf), "ENOD_REMOTE_ID(%d)", fa_enod_id - ENOD_REMOTE_ID);
194#else
195 sprintf(a_buf[a_idx], "ENOD_REMOTE_ID(%d)", fa_enod_id - ENOD_REMOTE_ID);
196#endif
197 return a_buf[a_idx];
198 }
199#endif
200
201 return "?";
202}
203
204/*
205 * ƒoƒCƒiƒŠƒ_ƒ“ƒvo—Í
206 */
207void _ecn_dbg_bindmp(const T_ECN_FST_BLK *buffer, size_t len)
208{
209 /* static—̈æ‚̃oƒbƒtƒ@‚ðØ‚è‘Ö‚¦‚éŒÂ”(2^n) */
210 #define _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT (4)
211/* */
212#ifdef SEM_ECN_DBG_BINDMP
213 #ifdef _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT
214 #undef _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT
215 /* ƒZƒ}ƒtƒH(SEM_ECN_DBG_BINDMP)‚ª’è‹`‚³‚ê‚Ä‚¢‚éê‡Aƒoƒbƒtƒ@Ø‚è‘Ö‚¦‚Í•s—v‚È‚Ì‚Åundef */
216 #endif
217#endif
218#ifndef _ECN_FBS_DBG_BINDMP_BUFLEN
219 /* ƒoƒbƒtƒ@ƒTƒCƒY(bindmp’†‚Ì1s‚ªŽû‚Ü‚éƒTƒCƒY) */
220 #define _ECN_FBS_DBG_BINDMP_BUFLEN (80)
221#endif
222#ifdef _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT
223 /* static—̈æ‚̃oƒbƒtƒ@‚ðØ‚è‘Ö‚¦‚邽‚ß‚ÌŠÇ——p•Ï” */
224 static volatile uint8_t a_idx_vol = 0;
225 /* static—̈æ‚̃oƒbƒtƒ@Ø‚è‘Ö‚¦—̈æ */
226 static char a_buf_area[1 << _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT][_ECN_FBS_DBG_BINDMP_BUFLEN];
227 uint8_t a_idx;
228 char *a_buf;
229#else
230 /* static—̈æ‚̃oƒbƒtƒ@—̈æ */
231 static char a_buf[_ECN_FBS_DBG_BINDMP_BUFLEN];
232#endif
233 const uint8_t *p = buffer; /* “Ç‚ÝŽæ‚èƒ|ƒCƒ“ƒ^ */
234 int i, a_blk, a_blk_max, a_pos = 0;
235 const T_ECN_EDT_HDR *p_req_esv;
236 const T_ECN_INTERNAL_MSG *p_im;
237
238#ifdef SEM_ECN_DBG_BINDMP
239 syscall(wai_sem(SEM_ECN_DBG_BINDMP));
240#endif
241
242 if (len != 256) {
243 a_blk_max = 1;
244 } else {
245 a_blk_max = buffer->hdr.wr ? 1 : 0;
246 if (!a_blk_max)
247 a_blk_max = 1;
248 }
249 #ifndef ECN_DBG_BINDMP_MAXLEN
250 /* bindmpo—͂̍őåƒTƒCƒY */
251 #define ECN_DBG_BINDMP_MAXLEN 1600
252 #endif
253 if (ECN_DBG_BINDMP_MAXLEN < len) {
254 len = ECN_DBG_BINDMP_MAXLEN;
255 }
256
257#ifdef _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT
258 a_idx = (++a_idx_vol) & ((1 << _ECN_FBS_DBG_BINDMP_BUF_MAX_BIT) - 1);
259 a_buf = a_buf_area[a_idx];
260 /* #define a_buf (a_buf_area[a_idx]) */
261#endif
262
263 for (a_blk = 0; p && a_blk < a_blk_max; p = buffer->lnk.p_sub[a_blk++]->payload) {
264 if (0 < a_blk) {
265 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
266 syslog(LOG_NOTICE, "p_sub[%d] (0x%08X)", a_blk - 1, p);
267 }
268 memset(a_buf, 0, _ECN_FBS_DBG_BINDMP_BUFLEN);
269 for (i = 0; i < (int)len; i++) {
270 if (i % 16 == 0) {
271 if (a_buf[0]) {
272 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
273 syslog(LOG_NOTICE, "%s", a_buf);
274 }
275#ifdef _MSC_VER
276 sprintf_s(a_buf, _ECN_FBS_DBG_BINDMP_BUFLEN, "[%08X]:", i);
277#else
278 sprintf(a_buf, "[%08X]:", i);
279#endif
280 a_pos = strlen(a_buf);
281 } else {
282 a_buf[a_pos++] = (i % 16 == 8 ? '-':' ');
283 }
284#ifdef _MSC_VER
285 sprintf_s(a_buf + a_pos, _ECN_FBS_DBG_BINDMP_BUFLEN - a_pos, "%02X", p[i]);
286#else
287 sprintf(a_buf + a_pos, "%02X", p[i]);
288#endif
289 a_pos += 2;
290 }
291 if (a_buf[0]) {
292 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
293 syslog(LOG_NOTICE, "%s", a_buf);
294 }
295 if (a_blk_max == 1)
296 break;
297 }
298
299 if (len == 256) {
300 switch (buffer->hdr.type) {
301 case ECN_MSG_ECHONET:
302 p_req_esv = &((T_EDATA *)buffer)->hdr;
303 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
304 syslog(LOG_NOTICE, " sender: %d %s, target: %d %s",
305 buffer->hdr.sender.id, _ecn_dbg_enod2str(buffer->hdr.sender.id),
306 buffer->hdr.target.id, _ecn_dbg_enod2str(buffer->hdr.target.id));
307 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
308 syslog(LOG_NOTICE, " ecn_hdr: 0x%02X 0x%02X 0x%04X", p_req_esv->ecn_hdr.ehd1, p_req_esv->ecn_hdr.ehd2, p_req_esv->ecn_hdr.tid);
309 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
310 syslog(LOG_NOTICE, " edata: 0x%06X 0x%06X 0x%02X 0x%02X (%s)",
311 p_req_esv->edata.seoj.eojx1 << 16 | p_req_esv->edata.seoj.eojx2 << 8 | p_req_esv->edata.seoj.eojx3,
312 p_req_esv->edata.deoj.eojx1 << 16 | p_req_esv->edata.deoj.eojx2 << 8 | p_req_esv->edata.deoj.eojx3,
313 p_req_esv->edata.esv, p_req_esv->edata.opc, _ecn_dbg_esv2str(p_req_esv->edata.esv));
314 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
315 syslog(LOG_NOTICE, " ecn_prp: 0x%02X 0x%02X", p_req_esv->ecn_prp.epc, p_req_esv->ecn_prp.pdc);
316 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
317 syslog(LOG_NOTICE, " cur(blk/pos): wr %d, rd %d",
318 (int)buffer->hdr.wr,
319 (int)buffer->hdr.rd);
320 break;
321 case ECN_MSG_INTERNAL:
322 p_im = (const T_ECN_INTERNAL_MSG *)&buffer->payload[0];
323 syslog(LOG_NOTICE, " a_im.command: %d:%s", p_im->command,
324 (p_im->command == ECN_INM_NOTIFY_INSTANCELIST ? "ECN_INM_NOTIFY_INSTANCELIST" :
325 (p_im->command == ECN_INM_GET_DEVICE_LIST_REQ ? "ECN_INM_GET_DEVICE_LIST_REQ" :
326 (p_im->command == ECN_INM_GET_DEVICE_LIST_RES ? "ECN_INM_GET_DEVICE_LIST_RES" :
327 (p_im->command == ECN_INM_GET_DEVICE_INFO_REQ ? "ECN_INM_GET_DEVICE_INFO_REQ" :
328 (p_im->command == ECN_INM_GET_DEVICE_INFO_RES ? "ECN_INM_GET_DEVICE_INFO_RES" :
329 (p_im->command == ECN_UDP_MSG_GET_IPADDR_REQ ? "ECN_UDP_MSG_GET_IPADDR_REQ" :
330 (p_im->command == ECN_UDP_MSG_GET_IPADDR_RES ? "ECN_UDP_MSG_GET_IPADDR_RES" :
331 (p_im->command == ECN_UDP_MSG_GET_IPADDR_ERROR ? "ECN_UDP_MSG_GET_IPADDR_ERROR" : "?")))))))));
332 memset(a_buf, 0, _ECN_FBS_DBG_BINDMP_BUFLEN);
333 a_blk_max = buffer->hdr.wr;
334 if (0 < a_blk_max) {
335 if (64 < a_blk_max)
336 a_blk_max = 64;
337 if (_ECN_FBS_DBG_BINDMP_BUFLEN < a_blk_max)
338 a_blk_max = _ECN_FBS_DBG_BINDMP_BUFLEN;
339 for (i = offsetof(T_ECN_INTERNAL_MSG, data); i < a_blk_max; i++) {
340 a_blk = buffer->payload[i];
341 if (!isprint(a_blk) || !isascii(a_blk))
342 a_blk = '.';
343 a_buf[i - 1] = a_blk;
344 }
345 syslog(LOG_NOTICE, " a_im.data: [%s]", &a_buf[offsetof(T_ECN_INTERNAL_MSG, data) - 1]);
346 }
347 break;
348 default:
349 syslog(LOG_NOTICE, " invalid type: %d", buffer->hdr.type);
350 }
351 }
352 else if (8 <= len
353 && buffer->payload[0] == 0x10
354 && buffer->payload[1] == 0x81) {
355 p_req_esv = (const T_ECN_EDT_HDR *)&buffer->payload[0];
356 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
357 syslog(LOG_NOTICE, " ecn_hdr: 0x%02X 0x%02X 0x%04X", p_req_esv->ecn_hdr.ehd1, p_req_esv->ecn_hdr.ehd2, p_req_esv->ecn_hdr.tid);
358 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
359 syslog(LOG_NOTICE, " edata: 0x%06X 0x%06X 0x%02X 0x%02X (%s)",
360 p_req_esv->edata.seoj.eojx1 << 16 | p_req_esv->edata.seoj.eojx2 << 8 | p_req_esv->edata.seoj.eojx3,
361 p_req_esv->edata.deoj.eojx1 << 16 | p_req_esv->edata.deoj.eojx2 << 8 | p_req_esv->edata.deoj.eojx3,
362 p_req_esv->edata.esv, p_req_esv->edata.opc, _ecn_dbg_esv2str(p_req_esv->edata.esv));
363 _ECN_DBG_WAI_SYSLOG; /* syslog()ƒoƒbƒtƒ@‚É—]—T‚ª‚Å‚«‚é‚Ü‚Å‘Ò‚Â */
364 syslog(LOG_NOTICE, " ecn_prp: 0x%02X 0x%02X", p_req_esv->ecn_prp.epc, p_req_esv->ecn_prp.pdc);
365 }
366#ifdef SEM_ECN_DBG_BINDMP
367 syscall(sig_sem(SEM_ECN_DBG_BINDMP));
368#endif
369}
370
371/*
372 * ECHONET LiteƒT[ƒrƒXƒR[ƒh•¶Žš—ñ•ÏŠ·
373 */
374const char *_ecn_dbg_esv2str(uint8_t fa_esv)
375{
376 switch (fa_esv) {
377 case ESV_SET_I_SNA: return "ƒvƒƒpƒeƒB’l‘‚«ž‚Ý—v‹•s‰Â‰ž“š"; /* 0x50 */
378 case ESV_SET_C_SNA: return "ƒvƒƒpƒeƒB’l‘‚«ž‚Ý—v‹•s‰Â‰ž“š"; /* 0x51 */
379 case ESV_GET_SNA: return "ƒvƒƒpƒeƒB’l“ǂݏo‚µ•s‰Â‰ž“š"; /* 0x52 */
380 case ESV_INF_SNA: return "ƒvƒƒpƒeƒB’l’Ê’m•s‰Â‰ž“š"; /* 0x53 */
381 case ESV_SET_GET_SNA: return "ƒvƒƒpƒeƒB’l‘‚«ž‚݁E“ǂݏo‚µ•s‰Â‰ž“š"; /* 0x5E */
382 case ESV_SET_I: return "ƒvƒƒpƒeƒB’l‘‚«ž‚Ý—v‹i‰ž“š•s—vj"; /* 0x60 */
383 case ESV_SET_C: return "ƒvƒƒpƒeƒB’l‘‚«ž‚Ý—v‹i‰ž“š—vj"; /* 0x61 */
384 case ESV_GET: return "ƒvƒƒpƒeƒB’l“ǂݏo‚µ—v‹"; /* 0x62 */
385 case ESV_INF_REQ: return "ƒvƒƒpƒeƒB’l’Ê’m—v‹"; /* 0x63 */
386 case ESV_SET_GET: return "ƒvƒƒpƒeƒB’l‘‚«ž‚݁E“ǂݏo‚µ—v‹"; /* 0x6E */
387 case ESV_SET_RES: return "ƒvƒƒpƒeƒB’l‘‚«ž‚݉ž“š"; /* 0x71 */
388 case ESV_GET_RES: return "ƒvƒƒpƒeƒB’l“ǂݏo‚µ‰ž“š"; /* 0x72 */
389 case ESV_INF: return "ƒvƒƒpƒeƒB’l’Ê’m"; /* 0x73 */
390 case ESV_INFC: return "ƒvƒƒpƒeƒB’l’Ê’mi‰ž“š—vj"; /* 0x74 */
391 case ESV_SET_GET_RES: return "ƒvƒƒpƒeƒB’l‘‚«ž‚݁E“ǂݏo‚µ‰ž“š"; /* 0x7E */
392 case ESV_INFC_RES: return "ƒvƒƒpƒeƒB’l’Ê’m‰ž“š"; /* 0x7A */
393 default:
394 return "(unknown)";
395 }
396}
397#endif /* #if defined(ECN_DBG_PUT_ENA) || defined(ECN_CAP_PUT_ENA) */
Note: See TracBrowser for help on using the repository browser.