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

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

KadecotAPIの文字列確認の方法を変更

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr; charset=SHIFT_JIS
File size: 8.7 KB
Line 
1/*
2 * TOPPERS ECHONET Lite Communication Middleware
3 *
4 * Copyright (C) 2015 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: wamp_dealer.h 264 2016-11-18 06:02:07Z coas-nagasima $
36 */
37
38#ifndef WAMP_DEALER_H
39#define WAMP_DEALER_H
40
41typedef enum wamp_dealer_state
42{
43 WAMP_DEALER_STATE_DEVICE_ID,
44 WAMP_DEALER_STATE_DEOJID,
45 WAMP_DEALER_STATE_PROPERTIES,
46 WAMP_DEALER_STATE_PROPERTY_LIST,
47 WAMP_DEALER_STATE_PROPERTY_NAME,
48 WAMP_DEALER_STATE_PROPERTY_CODE,
49 WAMP_DEALER_STATE_PROPERTY_VALUE,
50 WAMP_DEALER_STATE_PIN,
51 WAMP_DEALER_STATE_MODE,
52 WAMP_DEALER_STATE_DIGITAL_VALUE,
53 WAMP_DEALER_STATE_ANALOG_VALUE,
54 WAMP_DEALER_STATE_MAC_ADDR_VALUE,
55 WAMP_DEALER_STATE_DHCP_ENABLE_VALUE,
56 WAMP_DEALER_STATE_IP_ADDR_VALUE,
57 WAMP_DEALER_STATE_NETMASK_VALUE,
58 WAMP_DEALER_STATE_GATEWAY_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[6];
117 bool_t dhcp_enable;
118 uint8_t ip_addr[4];
119 uint8_t netmask[4];
120 uint8_t gateway[4];
121} wamp_dealer_init_params_t;
122
123typedef struct echonetlite_device
124{
125 int deviceId;
126 int nodeId;
127 int addrId;
128 uint16_t deviceType;
129 uint8_t x3;
130 char deviceTypeStr[32];
131 char description[32];
132 char ip_addr[16];
133 char nickname[32];
134 bool_t status;
135} echonetlite_device_t;
136
137typedef struct wamp_dealer
138{
139 struct wamp_state *s;
140 wamp_dealer_state_t state;
141 wamp_dealer_procedure_t procedure;
142 unsigned int requestId;
143 union{
144 wamp_dealer_params_t params;
145 wamp_dealer_arduino_params_t arduino_params;
146 wamp_dealer_init_params_t init_params;
147 };
148 T_EDATA *ecnl_mag;
149 echonetlite_device_t devices[20];
150 int devices_pos;
151 echonetlite_device_t *current_device;
152 wamp_dealer_args_parse_t args_parse;
153 wamp_dealer_call_close_t call_close;
154 const char *error;
155} wamp_dealer_t;
156
157void wamp_dealer_init(wamp_dealer_t *dealer);
158
159void wamp_dealer_register(wamp_dealer_t *dealer);
160void wamp_dealer_register_request_id(wamp_dealer_t *dealer, const char *value);
161void wamp_dealer_register_options(wamp_dealer_t *dealer, const char *value);
162void wamp_dealer_register_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
163 struct jsonsl_state_st *state, const char *buf);
164void wamp_dealer_register_procedure(wamp_dealer_t *dealer, const char *value);
165void wamp_dealer_register_close(struct wamp_state *s);
166
167void wamp_dealer_unregister(wamp_dealer_t *dealer);
168void wamp_dealer_unregister_request_id(wamp_dealer_t *dealer, const char *value);
169void wamp_dealer_unregister_registration_id(wamp_dealer_t *dealer, const char *value);
170void wamp_dealer_unregister_close(struct wamp_state *s);
171
172void wamp_dealer_call(wamp_dealer_t *dealer);
173void wamp_dealer_call_request_id(wamp_dealer_t *dealer, const char *value);
174void wamp_dealer_call_options(wamp_dealer_t *dealer, const char *value);
175void wamp_dealer_call_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
176 struct jsonsl_state_st *state, const char *buf);
177void wamp_dealer_call_procedure(wamp_dealer_t *dealer, const char *value, int length);
178void wamp_dealer_call_arguments(wamp_dealer_t *dealer, const char *value);
179void wamp_dealer_call_arguments_param(wamp_dealer_t *dealer, jsonsl_action_t action,
180 struct jsonsl_state_st *state, const char *buf);
181void wamp_dealer_call_argumentskw(wamp_dealer_t *dealer, const char *value);
182void wamp_dealer_call_argumentskw_param(wamp_dealer_t *dealer, jsonsl_action_t action,
183 struct jsonsl_state_st *state, const char *buf);
184void wamp_dealer_call_close(struct wamp_state *s);
185
186void wamp_dealer_yield(wamp_dealer_t *dealer);
187void wamp_dealer_yield_request_id(wamp_dealer_t *dealer, const char *value);
188void wamp_dealer_yield_options(wamp_dealer_t *dealer, const char *value);
189void wamp_dealer_yield_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
190 struct jsonsl_state_st *state, const char *buf);
191void wamp_dealer_yield_arguments(wamp_dealer_t *dealer, const char *value);
192void wamp_dealer_yield_arguments_param(wamp_dealer_t *dealer, jsonsl_action_t action,
193 struct jsonsl_state_st *state, const char *buf);
194void wamp_dealer_yield_argumentskw(wamp_dealer_t *dealer, const char *value);
195void wamp_dealer_yield_argumentskw_param(wamp_dealer_t *dealer, jsonsl_action_t action,
196 struct jsonsl_state_st *state, const char *buf);
197void wamp_dealer_yield_close(struct wamp_state *s);
198
199void wamp_dealer_cansel(wamp_dealer_t *dealer);
200void wamp_dealer_cansel_request_id(wamp_dealer_t *dealer, const char *value);
201void wamp_dealer_cansel_options(wamp_dealer_t *dealer, const char *value);
202void wamp_dealer_cansel_options_param(wamp_dealer_t *dealer, jsonsl_action_t action,
203 struct jsonsl_state_st *state, const char *buf);
204void wamp_dealer_cansel_close(struct wamp_state *s);
205
206void wamp_dealer_set_devicelist(struct wamp_dealer *dealer, ECN_FBS_ID msg);
207void wamp_dealer_get_devicelist_timeout(struct wamp_dealer *dealer);
208void wamp_dealer_set_ipaddr(struct wamp_dealer *dealer, char *ipaddr);
209void wamp_dealer_get_ipaddr_timeout(struct wamp_dealer *dealer);
210void wamp_dealer_set_deviceinfo(struct wamp_dealer *dealer, int deviceId,
211 uint8_t *pmapSet, uint8_t *pmapGet, uint8_t *pmapAnno);
212void wamp_dealer_get_deviceinfo_timeout(struct wamp_dealer *dealer);
213void wamp_dealer_kadecot_set(struct wamp_dealer *dealer, int deviceId, uint8_t epc);
214void wamp_dealer_kadecot_set_timeout(struct wamp_dealer *dealer);
215void wamp_dealer_kadecot_get(struct wamp_dealer *dealer, int deviceId, uint8_t epc,
216 uint8_t pdc, uint8_t *edt);
217void wamp_dealer_kadecot_get_timeout(struct wamp_dealer *dealer);
218void wamp_dealer_ecnl_set_res(struct wamp_dealer *dealer, T_EDATA *res);
219void wamp_dealer_ecnl_set_timeout(struct wamp_dealer *dealer);
220void wamp_dealer_ecnl_get_res(struct wamp_dealer *dealer, T_EDATA *res);
221void wamp_dealer_ecnl_get_timeout(struct wamp_dealer *dealer);
222void wamp_dealer_ecnl_setget_res(struct wamp_dealer *dealer, T_EDATA *res);
223void wamp_dealer_ecnl_setget_timeout(struct wamp_dealer *dealer);
224
225#endif // WAMP_DEALER_H
Note: See TracBrowser for help on using the repository browser.