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_broker.h 152 2016-01-14 04:17:21Z coas-nagasima $
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef WAMP_BROKER_H
|
---|
39 | #define WAMP_BROKER_H
|
---|
40 |
|
---|
41 | typedef enum wamp_subscription_kind
|
---|
42 | {
|
---|
43 | WAMP_SUBSCRIPTION_KIND_NONE,
|
---|
44 | WAMP_SUBSCRIPTION_KIND_ECHONETLITE,
|
---|
45 | WAMP_SUBSCRIPTION_KIND_ARDUINO,
|
---|
46 | } wamp_subscription_kind_t;
|
---|
47 |
|
---|
48 | typedef struct wamp_echonetlite_subscription
|
---|
49 | {
|
---|
50 | char deviceName[40];
|
---|
51 | char *proprtyName;
|
---|
52 | uint16_t devType;
|
---|
53 | uint8_t epc;
|
---|
54 | } wamp_echonetlite_subscription_t;
|
---|
55 |
|
---|
56 | typedef struct wamp_arduino_subscription
|
---|
57 | {
|
---|
58 | uint8_t pinno;
|
---|
59 | uint16_t threshold;
|
---|
60 | } wamp_arduino_subscription_t;
|
---|
61 |
|
---|
62 | typedef struct wamp_subscription
|
---|
63 | {
|
---|
64 | struct wamp_state *s;
|
---|
65 | unsigned int requestId;
|
---|
66 | int subscriptionId;
|
---|
67 | wamp_subscription_kind_t kind;
|
---|
68 | union{
|
---|
69 | wamp_echonetlite_subscription_t echonetlite;
|
---|
70 | wamp_arduino_subscription_t arduino;
|
---|
71 | };
|
---|
72 | } wamp_subscription_t;
|
---|
73 |
|
---|
74 | typedef struct wamp_broker
|
---|
75 | {
|
---|
76 | struct wamp_state *s;
|
---|
77 | unsigned int requestId;
|
---|
78 | int subscriptionId;
|
---|
79 | wamp_subscription_t subscriptions[30];
|
---|
80 | wamp_subscription_t *current_subscription;
|
---|
81 | const char *error;
|
---|
82 | } wamp_broker_t;
|
---|
83 |
|
---|
84 | void wamp_broker_subscribe(wamp_broker_t *broker);
|
---|
85 | void wamp_broker_subscribe_request_id(wamp_broker_t *broker, const char *value);
|
---|
86 | void wamp_broker_subscribe_options_param(wamp_broker_t *broker, jsonsl_action_t action,
|
---|
87 | struct jsonsl_state_st *state, const char *buf);
|
---|
88 | void wamp_broker_subscribe_options(wamp_broker_t *broker);
|
---|
89 | void wamp_broker_subscribe_topic(wamp_broker_t *broker, const char *value);
|
---|
90 | void wamp_broker_subscribe_echonetlite_topic(wamp_broker_t *broker, const char *value, int pos);
|
---|
91 | void wamp_broker_subscribe_arduino_topic(wamp_broker_t *broker, const char *value, int pos);
|
---|
92 | void wamp_broker_subscribe_close(struct wamp_state *s);
|
---|
93 |
|
---|
94 | void wamp_broker_unsubscribe(wamp_broker_t *broker);
|
---|
95 | void wamp_broker_unsubscribe_request_id(wamp_broker_t *broker, const char *value);
|
---|
96 | void wamp_broker_unsubscribe_subscription_id(wamp_broker_t *broker, const char *value);
|
---|
97 | void wamp_broker_unsubscribe_close(struct wamp_state *s);
|
---|
98 |
|
---|
99 | void wamp_broker_publish(wamp_broker_t *broker);
|
---|
100 | void wamp_broker_publish_request_id(wamp_broker_t *s, const char *value);
|
---|
101 | void wamp_broker_publish_options(wamp_broker_t *s, const char *value);
|
---|
102 | void wamp_broker_publish_options_param(wamp_broker_t *s, jsonsl_action_t action,
|
---|
103 | struct jsonsl_state_st *state, const char *buf);
|
---|
104 | void wamp_broker_publish_topic(wamp_broker_t *s, const char *value);
|
---|
105 | void wamp_broker_publish_arguments(wamp_broker_t *s, const char *value);
|
---|
106 | void wamp_broker_publish_arguments_param(wamp_broker_t *s, jsonsl_action_t action,
|
---|
107 | struct jsonsl_state_st *state, const char *buf);
|
---|
108 | void wamp_broker_publish_argumentskw(wamp_broker_t *s, const char *value);
|
---|
109 | void wamp_broker_publish_argumentskw_param(wamp_broker_t *s, jsonsl_action_t action,
|
---|
110 | struct jsonsl_state_st *state, const char *buf);
|
---|
111 | void wamp_broker_publish_close(struct wamp_state *s);
|
---|
112 |
|
---|
113 | void wamp_broker_publish_inf(wamp_broker_t *broker, uint16_t pubId, int deviceId,
|
---|
114 | uint16_t devType, uint8_t epc, uint8_t pdc, uint8_t *p_edt);
|
---|
115 | void wamp_broker_publish_pin(wamp_broker_t *broker, uint16_t pubId, int deviceId,
|
---|
116 | int pinno, uint16_t value);
|
---|
117 |
|
---|
118 | #endif // WAMP_BROKER_H
|
---|