source: uKadecot/trunk/kadecot/wamp_dealer.h@ 101

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

TOPPERS/uKadecotのソースコードを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 8.5 KB
Line 
1/*
2 * TOPPERS ECHONET Lite Communication Middleware
3 *
4 * Copyright (C) 2015 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: wamp_dealer.h 101 2015-06-02 15:37:23Z coas-nagasima $
40 */
41
42#ifndef WAMP_DEALER_H
43#define WAMP_DEALER_H
44
45typedef enum wamp_dealer_state
46{
47 WAMP_DEALER_STATE_DEVICE_ID,
48 WAMP_DEALER_STATE_DEOJID,
49 WAMP_DEALER_STATE_PROPERTIES,
50 WAMP_DEALER_STATE_PROPERTY_LIST,
51 WAMP_DEALER_STATE_PROPERTY_NAME,
52 WAMP_DEALER_STATE_PROPERTY_CODE,
53 WAMP_DEALER_STATE_PROPERTY_VALUE,
54 WAMP_DEALER_STATE_PIN,
55 WAMP_DEALER_STATE_MODE,
56 WAMP_DEALER_STATE_DIGITAL_VALUE,
57 WAMP_DEALER_STATE_ANALOG_VALUE,
58 WAMP_DEALER_STATE_MAC_ADDR_VALUE,
59} wamp_dealer_state_t;
60
61typedef enum wamp_dealer_procedure
62{
63 WAMP_DEALER_PROCEDURE_NONE,
64 WAMP_DEALER_PROCEDURE_GET_DEVICELIST,
65 WAMP_DEALER_PROCEDURE_KADECOT_GET,
66 WAMP_DEALER_PROCEDURE_KADECOT_SET,
67 WAMP_DEALER_PROCEDURE_GET_DEVICEINFO,
68 WAMP_DEALER_PROCEDURE_ECNL_SET,
69 WAMP_DEALER_PROCEDURE_ECNL_GET,
70 WAMP_DEALER_PROCEDURE_ECNL_SETGET,
71 WAMP_DEALER_PROCEDURE_PIN_MODE,
72 WAMP_DEALER_PROCEDURE_DIGITAL_WRITE,
73 WAMP_DEALER_PROCEDURE_DIGITAL_READ,
74 WAMP_DEALER_PROCEDURE_ANALOG_READ,
75 WAMP_DEALER_PROCEDURE_ANALOG_WRITE,
76 WAMP_DEALER_PROCEDURE_SET_INIT_PARAMS,
77 WAMP_DEALER_PROCEDURE_GET_INIT_PARAMS,
78} wamp_dealer_procedure_t;
79
80typedef enum wamp_dealer_pin_mode
81{
82 WAMP_DEALER_PIN_MODE_NONE,
83 WAMP_DEALER_PIN_MODE_INPUT,
84 WAMP_DEALER_PIN_MODE_OUTPUT,
85 WAMP_DEALER_PIN_MODE_INPUT_PULLUP
86} wamp_dealer_pin_mode_t;
87
88typedef enum wamp_dealer_digital_value
89{
90 WAMP_DEALER_DIGITAL_VALUE_NONE,
91 WAMP_DEALER_DIGITAL_VALUE_HIGH,
92 WAMP_DEALER_DIGITAL_VALUE_LOW,
93} wamp_dealer_digital_value_t;
94
95typedef void (*wamp_dealer_args_parse_t)(struct wamp_dealer *dealer, jsonsl_action_t action,
96 struct jsonsl_state_st *state, const char *buf);
97typedef void (*wamp_dealer_call_close_t)(struct wamp_dealer *dealer);
98
99typedef struct wamp_dealer_params{
100 uint8_t epc;
101 uint8_t pdc;
102 uint8_t edt[256];
103 uint32_t deojid;
104 char prop_name[80];
105} wamp_dealer_params_t;
106
107typedef struct wamp_dealer_arduino_params{
108 int pin;
109 wamp_dealer_pin_mode_t mode;
110 wamp_dealer_digital_value_t digval;
111 int anaval;
112} wamp_dealer_arduino_params_t;
113
114typedef struct wamp_dealer_init_params{
115 int pos;
116 uint8_t mac_addr[32]; /* DATA FLASH‚̃TƒCƒY•ª */
117} wamp_dealer_init_params_t;
118
119typedef struct echonetlite_device
120{
121 int deviceId;
122 int nodeId;
123 int addrId;
124 uint16_t deviceType;
125 uint8_t x3;
126 char deviceTypeStr[32];
127 char description[32];
128 char ip_addr[16];
129 char nickname[32];
130 bool_t status;
131} echonetlite_device_t;
132
133typedef struct wamp_dealer
134{
135 struct wamp_state *s;
136 wamp_dealer_state_t state;
137 wamp_dealer_procedure_t procedure;
138 unsigned int requestId;
139 union{
140 wamp_dealer_params_t params;
141 wamp_dealer_arduino_params_t arduino_params;
142 wamp_dealer_init_params_t init_params;
143 };
144 T_EDATA *ecnl_mag;
145 echonetlite_device_t devices[20];
146 int devices_pos;
147 echonetlite_device_t *current_device;
148 wamp_dealer_args_parse_t args_parse;
149 wamp_dealer_call_close_t call_close;
150 const char *error;
151} wamp_dealer_t;
152
153void wamp_dealer_init(wamp_dealer_t *dealer);
154
155void wamp_dealer_register(wamp_dealer_t *dealer);
156void wamp_dealer_register_request_id(wamp_dealer_t *dealer, const char *value);
157void wamp_dealer_register_options(wamp_dealer_t *dealer, const char *value);
158void wamp_dealer_register_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
159 struct jsonsl_state_st *state, const char *buf);
160void wamp_dealer_register_procedure(wamp_dealer_t *dealer, const char *value);
161void wamp_dealer_register_close(struct wamp_state *s);
162
163void wamp_dealer_unregister(wamp_dealer_t *dealer);
164void wamp_dealer_unregister_request_id(wamp_dealer_t *dealer, const char *value);
165void wamp_dealer_unregister_registration_id(wamp_dealer_t *dealer, const char *value);
166void wamp_dealer_unregister_close(struct wamp_state *s);
167
168void wamp_dealer_call(wamp_dealer_t *dealer);
169void wamp_dealer_call_request_id(wamp_dealer_t *dealer, const char *value);
170void wamp_dealer_call_options(wamp_dealer_t *dealer, const char *value);
171void wamp_dealer_call_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
172 struct jsonsl_state_st *state, const char *buf);
173void wamp_dealer_call_procedure(wamp_dealer_t *dealer, const char *value);
174void wamp_dealer_call_arguments(wamp_dealer_t *dealer, const char *value);
175void wamp_dealer_call_arguments_param(wamp_dealer_t *dealer, jsonsl_action_t action,
176 struct jsonsl_state_st *state, const char *buf);
177void wamp_dealer_call_argumentskw(wamp_dealer_t *dealer, const char *value);
178void wamp_dealer_call_argumentskw_param(wamp_dealer_t *dealer, jsonsl_action_t action,
179 struct jsonsl_state_st *state, const char *buf);
180void wamp_dealer_call_close(struct wamp_state *s);
181
182void wamp_dealer_yield(wamp_dealer_t *dealer);
183void wamp_dealer_yield_request_id(wamp_dealer_t *dealer, const char *value);
184void wamp_dealer_yield_options(wamp_dealer_t *dealer, const char *value);
185void wamp_dealer_yield_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
186 struct jsonsl_state_st *state, const char *buf);
187void wamp_dealer_yield_arguments(wamp_dealer_t *dealer, const char *value);
188void wamp_dealer_yield_arguments_param(wamp_dealer_t *dealer, jsonsl_action_t action,
189 struct jsonsl_state_st *state, const char *buf);
190void wamp_dealer_yield_argumentskw(wamp_dealer_t *dealer, const char *value);
191void wamp_dealer_yield_argumentskw_param(wamp_dealer_t *dealer, jsonsl_action_t action,
192 struct jsonsl_state_st *state, const char *buf);
193void wamp_dealer_yield_close(struct wamp_state *s);
194
195void wamp_dealer_cansel(wamp_dealer_t *dealer);
196void wamp_dealer_cansel_request_id(wamp_dealer_t *dealer, const char *value);
197void wamp_dealer_cansel_options(wamp_dealer_t *dealer, const char *value);
198void wamp_dealer_cansel_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
199 struct jsonsl_state_st *state, const char *buf);
200void wamp_dealer_cansel_close(struct wamp_state *s);
201
202void wamp_dealer_set_devicelist(struct wamp_dealer *dealer, ECN_FBS_ID msg);
203void wamp_dealer_get_devicelist_timeout(struct wamp_dealer *dealer);
204void wamp_dealer_set_ipaddr(struct wamp_dealer *dealer, char *ipaddr);
205void wamp_dealer_get_ipaddr_timeout(struct wamp_dealer *dealer);
206void wamp_dealer_set_deviceinfo(struct wamp_dealer *dealer, int deviceId,
207 uint8_t *pmapSet, uint8_t *pmapGet, uint8_t *pmapAnno);
208void wamp_dealer_get_deviceinfo_timeout(struct wamp_dealer *dealer);
209void wamp_dealer_kadecot_set(struct wamp_dealer *dealer, int deviceId, uint8_t epc);
210void wamp_dealer_kadecot_set_timeout(struct wamp_dealer *dealer);
211void wamp_dealer_kadecot_get(struct wamp_dealer *dealer, int deviceId, uint8_t epc,
212 uint8_t pdc, uint8_t *edt);
213void wamp_dealer_kadecot_get_timeout(struct wamp_dealer *dealer);
214void wamp_dealer_ecnl_set_res(struct wamp_dealer *dealer, T_EDATA *res);
215void wamp_dealer_ecnl_set_timeout(struct wamp_dealer *dealer);
216void wamp_dealer_ecnl_get_res(struct wamp_dealer *dealer, T_EDATA *res);
217void wamp_dealer_ecnl_get_timeout(struct wamp_dealer *dealer);
218void wamp_dealer_ecnl_setget_res(struct wamp_dealer *dealer, T_EDATA *res);
219void wamp_dealer_ecnl_setget_timeout(struct wamp_dealer *dealer);
220
221#endif // WAMP_DEALER_H
Note: See TracBrowser for help on using the repository browser.