Skip to content

Commit 8035f0c

Browse files
committedNov 9, 2021
Update certification template.
1 parent 0868688 commit 8035f0c

File tree

3 files changed

+1022
-1137
lines changed

3 files changed

+1022
-1137
lines changed
 

Diff for: ‎LLSync标准蓝牙认证模版/ble_qiot_template.c

100644100755
+313-562
Large diffs are not rendered by default.

Diff for: ‎LLSync标准蓝牙认证模版/ble_qiot_template.h

100644100755
+225-168
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
2-
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
3-
* Licensed under the MIT License (the "License"); you may not use this file except in
4-
* compliance with the License. You may obtain a copy of the License at
5-
* http://opensource.org/licenses/MIT
6-
* Unless required by applicable law or agreed to in writing, software distributed under the License is
7-
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
8-
* either express or implied. See the License for the specific language governing permissions and
9-
* limitations under the License.
10-
*
11-
*/
2+
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Licensed under the MIT License (the "License"); you may not use this file except in
4+
* compliance with the License. You may obtain a copy of the License at
5+
* http://opensource.org/licenses/MIT
6+
* Unless required by applicable law or agreed to in writing, software distributed under the License is
7+
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
8+
* either express or implied. See the License for the specific language governing permissions and
9+
* limitations under the License.
10+
*
11+
*/
1212
#ifndef BLE_QIOT_TEMPLATE_H_
1313
#define BLE_QIOT_TEMPLATE_H_
1414
#ifdef __cplusplus
@@ -18,7 +18,6 @@ extern "C"{
1818
#include <stdint.h>
1919
#include <stdbool.h>
2020

21-
2221
// data type in template, corresponding to type in json file
2322
enum {
2423
BLE_QIOT_DATA_TYPE_BOOL = 0,
@@ -28,9 +27,14 @@ enum {
2827
BLE_QIOT_DATA_TYPE_ENUM,
2928
BLE_QIOT_DATA_TYPE_TIME,
3029
BLE_QIOT_DATA_TYPE_STRUCT,
30+
BLE_QIOT_DATA_TYPE_ARRAY,
3131
BLE_QIOT_DATA_TYPE_BUTT,
3232
};
3333

34+
#define BLE_QIOT_ARRAY_INT_BIT_MASK (1 << 4)
35+
#define BLE_QIOT_ARRAY_STRING_BIT_MASK (1 << 5)
36+
#define BLE_QIOT_ARRAY_FLOAT_BIT_MASK (1 << 6)
37+
#define BLE_QIOT_ARRAY_STRUCT_BIT_MASK (1 << 7)
3438
// message type, reference data template
3539
enum {
3640
BLE_QIOT_PROPERTY_AUTH_RW = 0,
@@ -44,127 +48,192 @@ enum {
4448
BLE_QIOT_EFFECT_REPLY,
4549
BLE_QIOT_EFFECT_BUTT,
4650
};
47-
#define BLE_QIOT_PACKAGE_MSG_HEAD(_TYPE, _REPLY, _ID) (((_TYPE) << 6) | (((_REPLY) == BLE_QIOT_EFFECT_REPLY) << 5) | ((_ID) & 0X1F))
48-
#define BLE_QIOT_PACKAGE_TLV_HEAD(_TYPE, _ID) (((_TYPE) << 5) | ((_ID) & 0X1F))
4951

52+
#define BLE_QIOT_PACKAGE_MSG_HEAD(_TYPE, _REPLY, _ID) (((_TYPE) << 6) | (((_REPLY) == BLE_QIOT_EFFECT_REPLY) << 5) | ((_ID) & 0X1F))
53+
#define BLE_QIOT_PACKAGE_TLV_HEAD(_TYPE, _ID) (((_TYPE) << 5) | ((_ID) & 0X1F))
5054

5155
// define tlv struct
52-
typedef struct{
53-
uint8_t type;
56+
typedef struct{ uint8_t type;
5457
uint8_t id;
5558
uint16_t len;
5659
char *val;
5760
}e_ble_tlv;
58-
#define BLE_QIOT_INCLUDE_PROPERTY
61+
62+
63+
#define BLE_QIOT_INCLUDE_PROPERTY
5964

6065
// define property id
6166
enum {
62-
BLE_QIOT_PROPERTY_ID_PROPERTY_BOOL = 0,
63-
BLE_QIOT_PROPERTY_ID_PROPERTY_INT,
64-
BLE_QIOT_PROPERTY_ID_PROPERTY_STRING,
65-
BLE_QIOT_PROPERTY_ID_PROPERTY_FLOAT,
66-
BLE_QIOT_PROPERTY_ID_PROPERTY_ENUM,
67-
BLE_QIOT_PROPERTY_ID_PROPERTY_TIME,
68-
BLE_QIOT_PROPERTY_ID_PROPERTY_STRUCT,
67+
BLE_QIOT_PROPERTY_ID_T_BOOL,
68+
BLE_QIOT_PROPERTY_ID_T_INT,
69+
BLE_QIOT_PROPERTY_ID_T_STRING,
70+
BLE_QIOT_PROPERTY_ID_T_FLOAT,
71+
BLE_QIOT_PROPERTY_ID_T_ENUM,
72+
BLE_QIOT_PROPERTY_ID_T_TIME,
73+
BLE_QIOT_PROPERTY_ID_T_STRUCT,
74+
BLE_QIOT_PROPERTY_ID_T_ARRAY_INT,
75+
BLE_QIOT_PROPERTY_ID_T_ARRAY_STRING,
76+
BLE_QIOT_PROPERTY_ID_T_ARRAY_FLOAT,
77+
BLE_QIOT_PROPERTY_ID_T_ARRAY_STRUCT,
6978
BLE_QIOT_PROPERTY_ID_BUTT,
7079
};
7180

72-
// define property_int attributes
73-
#define BLE_QIOT_PROPERTY_PROPERTY_INT_MIN (-100000)
74-
#define BLE_QIOT_PROPERTY_PROPERTY_INT_MAX (100000)
75-
#define BLE_QIOT_PROPERTY_PROPERTY_INT_START (0)
76-
#define BLE_QIOT_PROPERTY_PROPERTY_INT_STEP (1)
77-
78-
// define property_string length limit
79-
#define BLE_QIOT_PROPERTY_PROPERTY_STRING_LEN_MIN (0)
80-
#define BLE_QIOT_PROPERTY_PROPERTY_STRING_LEN_MAX (128)
81-
82-
// define property_float attributes
83-
#define BLE_QIOT_PROPERTY_PROPERTY_FLOAT_MIN (-100)
84-
#define BLE_QIOT_PROPERTY_PROPERTY_FLOAT_MAX (100)
85-
#define BLE_QIOT_PROPERTY_PROPERTY_FLOAT_START (0)
86-
#define BLE_QIOT_PROPERTY_PROPERTY_FLOAT_STEP (0.001)
87-
88-
// define property property_enum enum
81+
// define t_int attributes
82+
#define BLE_QIOT_PROPERTY_T_INT_MIN (-100000)
83+
#define BLE_QIOT_PROPERTY_T_INT_MAX (100000)
84+
#define BLE_QIOT_PROPERTY_T_INT_START (0)
85+
#define BLE_QIOT_PROPERTY_T_INT_STEP (1)
86+
// define t_string length limit
87+
#define BLE_QIOT_PROPERTY_T_STRING_LEN_MIN (0)
88+
#define BLE_QIOT_PROPERTY_T_STRING_LEN_MAX (128)
89+
// define t_float attributes
90+
#define BLE_QIOT_PROPERTY_T_FLOAT_MIN (-100)
91+
#define BLE_QIOT_PROPERTY_T_FLOAT_MAX (100)
92+
#define BLE_QIOT_PROPERTY_T_FLOAT_START (0)
93+
#define BLE_QIOT_PROPERTY_T_FLOAT_STEP (0.001)
94+
// define t_enum enum
8995
enum {
90-
BLE_QIOT_PROPERTY_PROPERTY_ENUM_ENUM0 = 0,
91-
BLE_QIOT_PROPERTY_PROPERTY_ENUM_ENUM1 = 1,
92-
BLE_QIOT_PROPERTY_PROPERTY_ENUM_ENUM2 = 2,
93-
BLE_QIOT_PROPERTY_PROPERTY_ENUM_ENUM3 = 3,
94-
BLE_QIOT_PROPERTY_PROPERTY_ENUM_BUTT = 4,
96+
BLE_QIOT_PROPERTY_T_ENUM_ENUM0 = 0,
97+
BLE_QIOT_PROPERTY_T_ENUM_ENUM1 = 1,
98+
BLE_QIOT_PROPERTY_T_ENUM_ENUM2 = 2,
99+
BLE_QIOT_PROPERTY_T_ENUM_ENUM3 = 3,
100+
BLE_QIOT_PROPERTY_T_ENUM_BUTT,
95101
};
96102

97-
// define property id
103+
// define t_struct s_int attributes
104+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_INT_MIN (-10000)
105+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_INT_MAX (10000)
106+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_INT_START (0)
107+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_INT_STEP (1)
108+
// define t_structs_string length limit
109+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_STRING_LEN_MIN (0)
110+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_STRING_LEN_MAX (128)
111+
// define t_struct s_float attributes
112+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_FLOAT_MIN (-100)
113+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_FLOAT_MAX (100)
114+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_FLOAT_START (0)
115+
#define BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_FLOAT_STEP (0.001)
116+
// define t_struct s_enum enum
98117
enum {
99-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_BOOL = 0,
100-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_INT,
101-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_STRING,
102-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_FLOAT,
103-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_ENUM,
104-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_MEM_TIME,
105-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_ID_BUTT,
118+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_ENUM_MEM_ENUM0 = 0,
119+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_ENUM_MEM_ENUM1 = 1,
120+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_ENUM_MEM_ENUM2 = 2,
121+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_S_ENUM_BUTT,
106122
};
107123

108-
// define mem_int attributes
109-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_INT_MIN (-10000)
110-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_INT_MAX (10000)
111-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_INT_START (0)
112-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_INT_STEP (1)
113-
114-
// define mem_string length limit
115-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_STRING_LEN_MIN (0)
116-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_STRING_LEN_MAX (128)
124+
// define t_struct property id
125+
enum {
126+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_BOOL,
127+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_INT,
128+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_STRING,
129+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_FLOAT,
130+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_ENUM,
131+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_S_TIME,
132+
BLE_QIOT_STRUCT_T_STRUCT_PROPERTY_ID_BUTT,
133+
};
117134

118-
// define mem_float attributes
119-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_FLOAT_MIN (-100)
120-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_FLOAT_MAX (100)
121-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_FLOAT_START (0)
122-
#define BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_FLOAT_STEP (0.001)
135+
typedef struct{
136+
bool m_s_bool;
137+
int32_t m_s_int;
138+
char m_s_str[128];
139+
float m_s_float;
140+
uint16_t m_s_enum;
141+
uint32_t m_s_time;
142+
}struct_property_t_struct;
143+
144+
// define t_array_int attributes
145+
#define BLE_QIOT_PROPERTY_T_ARRAY_INT_MIN (0)
146+
#define BLE_QIOT_PROPERTY_T_ARRAY_INT_MAX (100)
147+
#define BLE_QIOT_PROPERTY_T_ARRAY_INT_START (0)
148+
#define BLE_QIOT_PROPERTY_T_ARRAY_INT_STEP (1)
149+
//define the actual size of array
150+
#define BLE_QIOT_PROPERTY_T_ARRAY_INT_SIZE_MAX (0)
151+
#if BLE_QIOT_PROPERTY_T_ARRAY_INT_SIZE_MAX == 0
152+
#error "please define t_array_int array size first"
153+
#endif
154+
typedef struct{
155+
int32_t m_int_arr[BLE_QIOT_PROPERTY_T_ARRAY_INT_SIZE_MAX];
156+
uint16_t m_arr_size;
157+
}array_struct_t_array_int;
158+
159+
// define t_array_string length limit
160+
#define BLE_QIOT_PROPERTY_T_ARRAY_STRING_LEN_MIN (0)
161+
#define BLE_QIOT_PROPERTY_T_ARRAY_STRING_LEN_MAX (2048)
162+
//define the actual size of array
163+
#define BLE_QIOT_PROPERTY_T_ARRAY_STRING_SIZE_MAX (0)
164+
#if BLE_QIOT_PROPERTY_T_ARRAY_STRING_SIZE_MAX == 0
165+
#error "please define t_array_string array size first"
166+
#endif
167+
typedef struct{
168+
char m_str_arr[BLE_QIOT_PROPERTY_T_ARRAY_STRING_SIZE_MAX][2048];
169+
uint16_t m_arr_size;
170+
}array_struct_t_array_string;
171+
172+
// define t_array_float attributes
173+
#define BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_MIN (0)
174+
#define BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_MAX (100)
175+
#define BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_START (0)
176+
#define BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_STEP (1)
177+
//define the actual size of array
178+
#define BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_SIZE_MAX (0)
179+
#if BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_SIZE_MAX == 0
180+
#error "please define t_array_float array size first"
181+
#endif
182+
typedef struct{
183+
float m_float_arr[BLE_QIOT_PROPERTY_T_ARRAY_FLOAT_SIZE_MAX];
184+
uint16_t m_arr_size;
185+
}array_struct_t_array_float;
123186

124-
// define property mem_enum enum
187+
// define t_array_struct property id
125188
enum {
126-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_ENUM_MEM_ENUM0 = 0,
127-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_ENUM_MEM_ENUM1 = 1,
128-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_ENUM_MEM_ENUM2 = 2,
129-
BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_ENUM_BUTT = 3,
189+
BLE_QIOT_STRUCT_T_ARRAY_STRUCT_PROPERTY_ID_ARRAY_S_BOOL,
190+
BLE_QIOT_STRUCT_T_ARRAY_STRUCT_PROPERTY_ID_BUTT,
130191
};
131192

132193
typedef struct{
133-
bool m_mem_bool;
134-
int32_t m_mem_int;
135-
char m_mem_string[BLE_QIOT_STRUCT_PROPERTY_STRUCT_PROPERTY_MEM_STRING_LEN_MAX];
136-
float m_mem_float;
137-
uint16_t m_mem_enum;
138-
uint32_t m_mem_time;
139-
}struct_property_property_struct;
194+
bool m_array_s_bool;
195+
}struct_property_t_array_struct;
196+
197+
//define the actual size of array
198+
#define BLE_QIOT_PROPERTY_T_ARRAY_STRUCT_SIZE_MAX (0)
199+
#if BLE_QIOT_PROPERTY_T_ARRAY_STRUCT_SIZE_MAX == 0
200+
#error "please define t_array_struct array size first"
201+
#endif
202+
typedef struct{
203+
struct_property_t_array_struct m_struct_arr[BLE_QIOT_PROPERTY_T_ARRAY_STRUCT_SIZE_MAX];
204+
uint16_t m_arr_size;
205+
}array_struct_t_array_struct;
140206

141207
// define property set handle return 0 if success, other is error
142208
// sdk call the function that inform the server data to the device
143209
typedef int (*property_set_cb)(const char *data, uint16_t len);
144-
145210
// define property get handle. return the data length obtained, -1 is error, 0 is no data
146211
// sdk call the function fetch user data and send to the server, the data should wrapped by user adn skd just transmit
147212
typedef int (*property_get_cb)(char *buf, uint16_t buf_len);
148-
149213
// each property have a struct ble_property_t, make up a array named sg_ble_property_array
150214
typedef struct{
151215
property_set_cb set_cb; //set callback
152216
property_get_cb get_cb; //get callback
153217
uint8_t authority; //property authority
154218
uint8_t type; //data type
219+
uint16_t elem_num;
155220
}ble_property_t;
156-
#define BLE_QIOT_INCLUDE_EVENT
221+
typedef int (*property_array_set_cb)(const char *data, uint16_t len, uint16_t index);
222+
typedef int (*property_array_get_cb)(char *buf, uint16_t buf_len, uint16_t index);
223+
224+
225+
#define BLE_QIOT_INCLUDE_EVENT
157226

158227
// define event id
159228
enum {
160-
BLE_QIOT_EVENT_ID_EVENT_WARNNING = 0,
229+
BLE_QIOT_EVENT_ID_EVENT_WARNNING,
161230
BLE_QIOT_EVENT_ID_EVENT_ERROR,
162231
BLE_QIOT_EVENT_ID_BUTT,
163232
};
164233

165-
// define param id for event event_warnning
234+
// define event event_warnning param id
166235
enum {
167-
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_PARAM_BOOL = 0,
236+
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_PARAM_BOOL,
168237
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_PARAM_INT,
169238
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_PARAM_STRING,
170239
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_PARAM_FLOAT,
@@ -173,67 +242,63 @@ enum {
173242
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ID_BUTT,
174243
};
175244

176-
// define param param_int attributes
177-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_MIN (-100000)
178-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_MAX (1000000)
179-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_START (0)
180-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_STEP (1)
181-
182-
// define range for param param_string
183-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_STRING_LEN_MIN (0)
184-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_STRING_LEN_MAX (128)
185-
186-
// define param param_float attributes
187-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_MIN (0)
188-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_MAX (100)
189-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_START (0)
190-
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_STEP (0.001)
191-
192-
// define enum for param param_enum
245+
// define event_warnning param_int attributes
246+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_MIN (-100000)
247+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_MAX (1000000)
248+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_START (0)
249+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_INT_STEP (1)
250+
// define event_warnningparam_string length limit
251+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_STRING_LEN_MIN (0)
252+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_STRING_LEN_MAX (128)
253+
// define event_warnning param_float attributes
254+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_MIN (0)
255+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_MAX (100)
256+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_START (0)
257+
#define BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_FLOAT_STEP (0.001)
258+
// define event_warnning param_enum enum
193259
enum {
194260
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ENUM_PARAM_ENUM0 = 0,
195261
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ENUM_PARAM_ENUM1 = 1,
196262
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ENUM_PARAM_ENUM2 = 2,
197-
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ENUM_BUTT = 3,
263+
BLE_QIOT_EVENT_EVENT_WARNNING_PARAM_ENUM_BUTT,
198264
};
199265

200-
// define param id for event event_error
266+
// define event event_error param id
201267
enum {
202-
BLE_QIOT_EVENT_EVENT_ERROR_PARAM_ID_PARAM_BOOL = 0,
268+
BLE_QIOT_EVENT_EVENT_ERROR_PARAM_ID_PARAM_BOOL,
203269
BLE_QIOT_EVENT_EVENT_ERROR_PARAM_ID_PARAM_STRING,
204270
BLE_QIOT_EVENT_EVENT_ERROR_PARAM_ID_BUTT,
205271
};
206272

207-
// define range for param param_string
208-
#define BLE_QIOT_EVENT_EVENT_ERROR_PARAM_STRING_LEN_MIN (0)
209-
#define BLE_QIOT_EVENT_EVENT_ERROR_PARAM_STRING_LEN_MAX (128)
210-
273+
// define event_errorparam_string length limit
274+
#define BLE_QIOT_EVENT_EVENT_ERROR_PARAM_STRING_LEN_MIN (0)
275+
#define BLE_QIOT_EVENT_EVENT_ERROR_PARAM_STRING_LEN_MAX (128)
211276
// define event get handle. return the data length obtained, -1 is error, 0 is no data
212277
// sdk call the function fetch user data and send to the server, the data should wrapped by user adn skd just transmit
213278
typedef int (*event_get_cb)(char *buf, uint16_t buf_len);
214-
215279
// each param have a struct ble_event_param, make up a array for the event
216280
typedef struct{
217281
event_get_cb get_cb; //get param data callback
218282
uint8_t type; //param type
219283
}ble_event_param;
220-
221284
// a array named sg_ble_event_array is composed by all the event array
222285
typedef struct{
223286
ble_event_param *event_array; //array of params data
224287
uint8_t array_size; //array size
225288
}ble_event_t;
226-
#define BLE_QIOT_INCLUDE_ACTION
289+
290+
291+
#define BLE_QIOT_INCLUDE_ACTION
227292

228293
// define action id
229294
enum {
230-
BLE_QIOT_ACTION_ID_ACTION_TEST = 0,
295+
BLE_QIOT_ACTION_ID_ACTION_TEST,
231296
BLE_QIOT_ACTION_ID_BUTT,
232297
};
233298

234-
// define input id for action action_test
299+
// define action action_test input id
235300
enum {
236-
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_BOOL_INPUT = 0,
301+
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_BOOL_INPUT,
237302
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_INT_INPUT,
238303
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_STRING_INPUT,
239304
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_FLOAT_INPUT,
@@ -242,75 +307,69 @@ enum {
242307
BLE_QIOT_ACTION_ACTION_TEST_INPUT_ID_BUTT,
243308
};
244309

245-
// define output id for action action_test
310+
// define action_test int_input attributes
311+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_MIN (-100000)
312+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_MAX (100000)
313+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_START (0)
314+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_STEP (1)
315+
// define action_teststring_input length limit
316+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_STRING_INPUT_LEN_MIN (0)
317+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_STRING_INPUT_LEN_MAX (128)
318+
// define action_test float_input attributes
319+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_MIN (-100)
320+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_MAX (100)
321+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_START (0)
322+
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_STEP (1)
323+
// define action_test enum_input enum
324+
enum {
325+
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM0 = 0,
326+
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM1 = 1,
327+
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM2 = 2,
328+
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_BUTT,
329+
};
330+
331+
// define action action_test output id
246332
enum {
247-
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_BOOL_OUTPUT = 0,
333+
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_BOOL_OUTPUT,
248334
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_INT_OUTPUT,
249335
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_STRING_OUTPUT,
250336
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_FLOAT_OUTPUT,
251337
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_ENUM_OUTPUT,
252338
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_TIME_OUTPUT,
253339
BLE_QIOT_ACTION_ACTION_TEST_OUTPUT_ID_BUTT,
254340
};
255-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_MIN (-100000)
256-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_MAX (100000)
257-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_START (0)
258-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_INT_INPUT_STEP (1)
259-
260-
// define input id string_input attributes
261-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_INPUT_LEN_MIN (0)
262-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_INPUT_LEN_MAX (128)
263-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_MIN (-100)
264-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_MAX (100)
265-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_START (0)
266-
#define BLE_QIOT_ACTION_INPUT_ACTION_TEST_FLOAT_INPUT_STEP (1)
267-
268-
// define enum for input id enum_input
269-
enum {
270-
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM0 = 0,
271-
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM1 = 1,
272-
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_INPUT_ENUM2 = 2,
273-
BLE_QIOT_ACTION_INPUT_ACTION_TEST_ENUM_INPUT_BUTT = 3,
274-
};
275-
276-
// define output id int_output attributes
277-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_MIN (-100000)
278-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_MAX (1000000)
279-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_START (0)
280-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_STEP (1)
281341

282-
// define output id string_output attributes
283-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_OUTPUT_LEN_MIN (0)
284-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_OUTPUT_LEN_MAX (128)
285-
286-
// define output id float_output attributes
287-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_MIN (-100)
288-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_MAX (100)
289-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_START (0)
290-
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_STEP (1)
291-
292-
// define enum for output id enum_output
342+
// define action_test int_output attributes
343+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_MIN (-100000)
344+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_MAX (1000000)
345+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_START (0)
346+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_INT_OUTPUT_STEP (1)
347+
// define action_teststring_output length limit
348+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_OUTPUT_LEN_MIN (0)
349+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_STRING_OUTPUT_LEN_MAX (128)
350+
// define action_test float_output attributes
351+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_MIN (-100)
352+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_MAX (100)
353+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_START (0)
354+
#define BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_FLOAT_OUTPUT_STEP (1)
355+
// define action_test enum_output enum
293356
enum {
294357
BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_ENUM_OUTPUT_OUTPUT_ENUM0 = 0,
295358
BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_ENUM_OUTPUT_OUTPUT_ENUM1 = 1,
296359
BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_ENUM_OUTPUT_OUTPUT_ENUM2 = 2,
297-
BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_ENUM_OUTPUT_BUTT = 3,
360+
BLE_QIOT_ACTION_OUTPUT_ACTION_TEST_ENUM_OUTPUT_BUTT,
298361
};
299362

300-
// define max input id and output id in all of input id and output id above
301-
#define BLE_QIOT_ACTION_INPUT_ID_BUTT 6
302-
#define BLE_QIOT_ACTION_OUTPUT_ID_BUTT 6
303-
363+
#define BLE_QIOT_ACTION_INPUT_ID_BUTT 6
364+
#define BLE_QIOT_ACTION_OUTPUT_ID_BUTT 6
304365
// define action input handle, return 0 is success, other is error.
305366
// input_param_array carry the data from server, include input id, data length ,data val
306367
// input_array_size means how many input id
307368
// output_id_array filling with output id numbers that need obtained, sdk will traverse it and call the action_output_handle to obtained data
308369
typedef int (*action_input_handle)(e_ble_tlv *input_param_array, uint8_t input_array_size, uint8_t *output_id_array);
309-
310370
// define action output handle, return length of the data, 0 is no data, -1 is error
311371
// output_id means which id data should be obtained
312372
typedef int (*action_output_handle)(uint8_t output_id, char *buf, uint16_t buf_len);
313-
314373
// each action have a struct ble_action_t, make up a array named sg_ble_action_array
315374
typedef struct{
316375
action_input_handle input_cb; //handle input data
@@ -320,39 +379,37 @@ typedef struct{
320379
uint8_t input_id_size; //numbers of input id
321380
uint8_t output_id_size; //numbers of output id
322381
}ble_action_t;
382+
323383
// property module
324384
#ifdef BLE_QIOT_INCLUDE_PROPERTY
325385
uint8_t ble_get_property_type_by_id(uint8_t id);
326-
327386
int ble_user_property_set_data(const e_ble_tlv *tlv);
328387
int ble_user_property_get_data_by_id(uint8_t id, char *buf, uint16_t buf_len);
329388
int ble_user_property_report_reply_handle(uint8_t result);
330389
int ble_lldata_parse_tlv(const char *buf, int buf_len, e_ble_tlv *tlv);
331390
int ble_user_property_struct_handle(const char *in_buf, uint16_t buf_len, ble_property_t *struct_arr, uint8_t arr_size);
332391
int ble_user_property_struct_get_data(char *in_buf, uint16_t buf_len, ble_property_t *struct_arr, uint8_t arr_size);
392+
int ble_user_property_struct_array_set(uint8_t id, const char *in_buf, uint16_t buf_len, ble_property_t struct_arr[], uint8_t arr_size);
393+
int ble_user_property_struct_array_get(uint8_t id, char *in_buf, uint16_t buf_len, ble_property_t struct_arr[], uint8_t arr_size);
333394
#endif
334-
335395
// event module
336396
#ifdef BLE_QIOT_INCLUDE_EVENT
337397
int ble_event_get_id_array_size(uint8_t event_id);
338398
uint8_t ble_event_get_param_id_type(uint8_t event_id, uint8_t param_id);
339399
int ble_event_get_data_by_id(uint8_t event_id, uint8_t param_id, char *out_buf, uint16_t buf_len);
340400
int ble_user_event_reply_handle(uint8_t event_id, uint8_t result);
341401
#endif
342-
343402
// action module
344403
#ifdef BLE_QIOT_INCLUDE_ACTION
345404
uint8_t ble_action_get_intput_type_by_id(uint8_t action_id, uint8_t input_id);
346405
uint8_t ble_action_get_output_type_by_id(uint8_t action_id, uint8_t output_id);
347406
int ble_action_get_input_id_size(uint8_t action_id);
348407
int ble_action_get_output_id_size(uint8_t action_id);
349-
int ble_action_user_handle_input_param(uint8_t action_id, e_ble_tlv *input_param_array, uint8_t input_array_size,
350-
uint8_t *output_id_array);
408+
int ble_action_user_handle_input_param(uint8_t action_id, e_ble_tlv *input_param_array, uint8_t input_array_size, uint8_t *output_id_array);
351409
int ble_action_user_handle_output_param(uint8_t action_id, uint8_t output_id, char *buf, uint16_t buf_len);
352410
#endif
353411

354-
355412
#ifdef __cplusplus
356413
}
357414
#endif
358-
#endif //BLE_QIOT_TEMPLATE_H_
415+
#endif //BLE_QIOT_TEMPLATE_H_
Original file line numberDiff line numberDiff line change
@@ -1,407 +1,484 @@
1-
{
2-
"version": "1.0",
3-
"properties": [
4-
{
5-
"id": "property_bool",
6-
"name": "布尔型属性",
7-
"desc": "",
8-
"mode": "rw",
9-
"define": {
10-
"type": "bool",
11-
"mapping": {
12-
"0": "",
13-
"1": ""
14-
}
15-
},
16-
"required": false
17-
},
18-
{
19-
"id": "property_int",
20-
"name": "整数型属性",
21-
"desc": "",
22-
"mode": "rw",
23-
"define": {
24-
"type": "int",
25-
"min": "-100000",
26-
"max": "100000",
27-
"start": "0",
28-
"step": "1",
29-
"unit": ""
30-
},
31-
"required": false
32-
},
33-
{
34-
"id": "property_string",
35-
"name": "字符串属性",
36-
"desc": "",
37-
"mode": "rw",
38-
"define": {
39-
"type": "string",
40-
"min": "0",
41-
"max": "128"
42-
},
43-
"required": false
44-
},
45-
{
46-
"id": "property_float",
47-
"name": "浮点型属性",
48-
"desc": "",
49-
"mode": "rw",
50-
"define": {
51-
"type": "float",
52-
"min": "-100",
53-
"max": "100",
54-
"start": "0",
55-
"step": "0.001",
56-
"unit": ""
57-
},
58-
"required": false
59-
},
60-
{
61-
"id": "property_enum",
62-
"name": "枚举型属性",
63-
"desc": "",
64-
"mode": "rw",
65-
"define": {
66-
"type": "enum",
67-
"mapping": {
68-
"0": "ENUM0",
69-
"1": "ENUM1",
70-
"2": "ENUM2",
71-
"3": "ENUM3"
72-
}
73-
},
74-
"required": false
75-
},
76-
{
77-
"id": "property_time",
78-
"name": "时间型属性",
79-
"desc": "",
80-
"mode": "rw",
81-
"define": {
82-
"type": "timestamp"
83-
},
84-
"required": false
85-
},
86-
{
87-
"id": "property_struct",
88-
"name": "结构体属性",
89-
"desc": "",
90-
"mode": "rw",
91-
"define": {
92-
"type": "struct",
93-
"specs": [
94-
{
95-
"id": "mem_bool",
96-
"name": "布尔成员",
97-
"dataType": {
98-
"type": "bool",
99-
"mapping": {
100-
"0": "",
101-
"1": ""
102-
}
103-
}
104-
},
105-
{
106-
"id": "mem_int",
107-
"name": "整数成员",
108-
"dataType": {
109-
"type": "int",
110-
"min": "-10000",
111-
"max": "10000",
112-
"start": "0",
113-
"step": "1",
114-
"unit": ""
115-
}
116-
},
117-
{
118-
"id": "mem_string",
119-
"name": "字符串成员",
120-
"dataType": {
121-
"type": "string",
122-
"min": "0",
123-
"max": "128"
124-
}
125-
},
126-
{
127-
"id": "mem_float",
128-
"name": "浮点成员",
129-
"dataType": {
130-
"type": "float",
131-
"min": "-100",
132-
"max": "100",
133-
"start": "0",
134-
"step": "0.001",
135-
"unit": ""
136-
}
137-
},
138-
{
139-
"id": "mem_enum",
140-
"name": "枚举成员",
141-
"dataType": {
142-
"type": "enum",
143-
"mapping": {
144-
"0": "MEM_ENUM0",
145-
"1": "MEM_ENUM1",
146-
"2": "MEM_ENUM2"
147-
}
148-
}
149-
},
150-
{
151-
"id": "mem_time",
152-
"name": "时间成员",
153-
"dataType": {
154-
"type": "timestamp"
155-
}
156-
}
157-
]
158-
},
159-
"required": false
160-
}
161-
],
162-
"events": [
163-
{
164-
"id": "event_warnning",
165-
"name": "告警事件",
166-
"desc": "",
167-
"type": "alert",
168-
"params": [
169-
{
170-
"id": "param_bool",
171-
"name": "布尔参数",
172-
"define": {
173-
"type": "bool",
174-
"mapping": {
175-
"0": "",
176-
"1": ""
177-
}
178-
}
179-
},
180-
{
181-
"id": "param_int",
182-
"name": "整数参数",
183-
"define": {
184-
"type": "int",
185-
"min": "-100000",
186-
"max": "1000000",
187-
"start": "0",
188-
"step": "1",
189-
"unit": ""
190-
}
191-
},
192-
{
193-
"id": "param_string",
194-
"name": "字符串参数",
195-
"define": {
196-
"type": "string",
197-
"min": "0",
198-
"max": "128"
199-
}
200-
},
201-
{
202-
"id": "param_float",
203-
"name": "浮点参数",
204-
"define": {
205-
"type": "float",
206-
"min": "0",
207-
"max": "100",
208-
"start": "0",
209-
"step": "0.001",
210-
"unit": ""
211-
}
212-
},
213-
{
214-
"id": "param_enum",
215-
"name": "枚举参数",
216-
"define": {
217-
"type": "enum",
218-
"mapping": {
219-
"0": "PARAM_ENUM0",
220-
"1": "PARAM_ENUM1",
221-
"2": "PARAM_ENUM2"
222-
}
223-
}
224-
},
225-
{
226-
"id": "param_time",
227-
"name": "时间参数",
228-
"define": {
229-
"type": "timestamp"
230-
}
231-
}
232-
],
233-
"required": false
234-
},
235-
{
236-
"id": "event_error",
237-
"name": "故障事件",
238-
"desc": "",
239-
"type": "fault",
240-
"params": [
241-
{
242-
"id": "param_bool",
243-
"name": "布尔参数",
244-
"define": {
245-
"type": "bool",
246-
"mapping": {
247-
"0": "",
248-
"1": ""
249-
}
250-
}
251-
},
252-
{
253-
"id": "param_string",
254-
"name": "字符串参数",
255-
"define": {
256-
"type": "string",
257-
"min": "0",
258-
"max": "128"
259-
}
260-
}
261-
],
262-
"required": false
263-
}
264-
],
265-
"actions": [
266-
{
267-
"id": "action_test",
268-
"name": "测试行为",
269-
"desc": "",
270-
"input": [
271-
{
272-
"id": "bool_input",
273-
"name": "布尔输入",
274-
"define": {
275-
"type": "bool",
276-
"mapping": {
277-
"0": "",
278-
"1": ""
279-
}
280-
}
281-
},
282-
{
283-
"id": "int_input",
284-
"name": "整数输入",
285-
"define": {
286-
"type": "int",
287-
"min": "-100000",
288-
"max": "100000",
289-
"start": "0",
290-
"step": "1",
291-
"unit": ""
292-
}
293-
},
294-
{
295-
"id": "string_input",
296-
"name": "字符串输入",
297-
"define": {
298-
"type": "string",
299-
"min": "0",
300-
"max": "128"
301-
}
302-
},
303-
{
304-
"id": "float_input",
305-
"name": "浮点输入",
306-
"define": {
307-
"type": "float",
308-
"min": "-100",
309-
"max": "100",
310-
"start": "0",
311-
"step": "1",
312-
"unit": ""
313-
}
314-
},
315-
{
316-
"id": "enum_input",
317-
"name": "枚举输入",
318-
"define": {
319-
"type": "enum",
320-
"mapping": {
321-
"0": "INPUT_ENUM0",
322-
"1": "INPUT_ENUM1",
323-
"2": "INPUT_ENUM2"
324-
}
325-
}
326-
},
327-
{
328-
"id": "time_input",
329-
"name": "时间输入",
330-
"define": {
331-
"type": "timestamp"
332-
}
333-
}
334-
],
335-
"output": [
336-
{
337-
"id": "bool_output",
338-
"name": "布尔输出",
339-
"define": {
340-
"type": "bool",
341-
"mapping": {
342-
"0": "",
343-
"1": ""
344-
}
345-
}
346-
},
347-
{
348-
"id": "int_output",
349-
"name": "整数输出",
350-
"define": {
351-
"type": "int",
352-
"min": "-100000",
353-
"max": "1000000",
354-
"start": "0",
355-
"step": "1",
356-
"unit": ""
357-
}
358-
},
359-
{
360-
"id": "string_output",
361-
"name": "字符串输出",
362-
"define": {
363-
"type": "string",
364-
"min": "0",
365-
"max": "128"
366-
}
367-
},
368-
{
369-
"id": "float_output",
370-
"name": "浮点输出",
371-
"define": {
372-
"type": "float",
373-
"min": "-100",
374-
"max": "100",
375-
"start": "0",
376-
"step": "1",
377-
"unit": ""
378-
}
379-
},
380-
{
381-
"id": "enum_output",
382-
"name": "枚举输出",
383-
"define": {
384-
"type": "enum",
385-
"mapping": {
386-
"0": "OUTPUT_ENUM0",
387-
"1": "OUTPUT_ENUM1",
388-
"2": "OUTPUT_ENUM2"
389-
}
390-
}
391-
},
392-
{
393-
"id": "time_output",
394-
"name": "时间输出",
395-
"define": {
396-
"type": "timestamp"
397-
}
398-
}
399-
],
400-
"required": false
401-
}
402-
],
403-
"profile": {
404-
"ProductId": "97P6GPE1QW",
405-
"CategoryId": "1"
406-
}
407-
}
1+
{
2+
"version": "1.0",
3+
"properties": [
4+
{
5+
"id": "t_bool",
6+
"name": "布尔型属性",
7+
"desc": "",
8+
"mode": "rw",
9+
"define": {
10+
"type": "bool",
11+
"mapping": {
12+
"0": "",
13+
"1": ""
14+
}
15+
},
16+
"required": false
17+
},
18+
{
19+
"id": "t_int",
20+
"name": "整数型属性",
21+
"desc": "",
22+
"mode": "rw",
23+
"define": {
24+
"type": "int",
25+
"min": "-100000",
26+
"max": "100000",
27+
"start": "0",
28+
"step": "1",
29+
"unit": ""
30+
},
31+
"required": false
32+
},
33+
{
34+
"id": "t_string",
35+
"name": "字符串属性",
36+
"desc": "",
37+
"mode": "rw",
38+
"define": {
39+
"type": "string",
40+
"min": "0",
41+
"max": "128"
42+
},
43+
"required": false
44+
},
45+
{
46+
"id": "t_float",
47+
"name": "浮点型属性",
48+
"desc": "",
49+
"mode": "rw",
50+
"define": {
51+
"type": "float",
52+
"min": "-100",
53+
"max": "100",
54+
"start": "0",
55+
"step": "0.001",
56+
"unit": ""
57+
},
58+
"required": false
59+
},
60+
{
61+
"id": "t_enum",
62+
"name": "枚举型属性",
63+
"desc": "",
64+
"mode": "rw",
65+
"define": {
66+
"type": "enum",
67+
"mapping": {
68+
"0": "ENUM0",
69+
"1": "ENUM1",
70+
"2": "ENUM2",
71+
"3": "ENUM3"
72+
}
73+
},
74+
"required": false
75+
},
76+
{
77+
"id": "t_time",
78+
"name": "时间型属性",
79+
"desc": "",
80+
"mode": "rw",
81+
"define": {
82+
"type": "timestamp"
83+
},
84+
"required": false
85+
},
86+
{
87+
"id": "t_struct",
88+
"name": "结构体属性",
89+
"desc": "",
90+
"mode": "rw",
91+
"define": {
92+
"type": "struct",
93+
"specs": [
94+
{
95+
"id": "s_bool",
96+
"name": "布尔成员",
97+
"dataType": {
98+
"type": "bool",
99+
"mapping": {
100+
"0": "",
101+
"1": ""
102+
}
103+
}
104+
},
105+
{
106+
"id": "s_int",
107+
"name": "整数成员",
108+
"dataType": {
109+
"type": "int",
110+
"min": "-10000",
111+
"max": "10000",
112+
"start": "0",
113+
"step": "1",
114+
"unit": ""
115+
}
116+
},
117+
{
118+
"id": "s_string",
119+
"name": "字符串成员",
120+
"dataType": {
121+
"type": "string",
122+
"min": "0",
123+
"max": "128"
124+
}
125+
},
126+
{
127+
"id": "s_float",
128+
"name": "浮点成员",
129+
"dataType": {
130+
"type": "float",
131+
"min": "-100",
132+
"max": "100",
133+
"start": "0",
134+
"step": "0.001",
135+
"unit": ""
136+
}
137+
},
138+
{
139+
"id": "s_enum",
140+
"name": "枚举成员",
141+
"dataType": {
142+
"type": "enum",
143+
"mapping": {
144+
"0": "MEM_ENUM0",
145+
"1": "MEM_ENUM1",
146+
"2": "MEM_ENUM2"
147+
}
148+
}
149+
},
150+
{
151+
"id": "s_time",
152+
"name": "时间成员",
153+
"dataType": {
154+
"type": "timestamp"
155+
}
156+
}
157+
]
158+
},
159+
"required": false
160+
},
161+
{
162+
"id": "t_array_int",
163+
"name": "数组型整数属性",
164+
"desc": "",
165+
"mode": "rw",
166+
"define": {
167+
"arrayInfo": {
168+
"type": "int",
169+
"min": "0",
170+
"max": "100",
171+
"start": "0",
172+
"step": "1",
173+
"unit": ""
174+
},
175+
"type": "array"
176+
},
177+
"required": false
178+
},
179+
{
180+
"id": "t_array_string",
181+
"name": "数组型字符串属性",
182+
"desc": "",
183+
"mode": "rw",
184+
"define": {
185+
"arrayInfo": {
186+
"type": "string",
187+
"min": "0",
188+
"max": "2048"
189+
},
190+
"type": "array"
191+
},
192+
"required": false
193+
},
194+
{
195+
"id": "t_array_float",
196+
"name": "数组型浮点属性",
197+
"desc": "",
198+
"mode": "rw",
199+
"define": {
200+
"arrayInfo": {
201+
"type": "float",
202+
"min": "0",
203+
"max": "100",
204+
"start": "0",
205+
"step": "1",
206+
"unit": ""
207+
},
208+
"type": "array"
209+
},
210+
"required": false
211+
},
212+
{
213+
"id": "t_array_struct",
214+
"name": "数组型结构体属性",
215+
"desc": "",
216+
"mode": "rw",
217+
"define": {
218+
"arrayInfo": {
219+
"type": "struct",
220+
"specs": [
221+
{
222+
"id": "array_s_bool",
223+
"name": "结构体数组布尔",
224+
"dataType": {
225+
"type": "bool",
226+
"mapping": {
227+
"0": "",
228+
"1": ""
229+
}
230+
}
231+
}
232+
]
233+
},
234+
"type": "array"
235+
},
236+
"required": false
237+
}
238+
],
239+
"events": [
240+
{
241+
"id": "event_warnning",
242+
"name": "告警事件",
243+
"desc": "",
244+
"type": "alert",
245+
"params": [
246+
{
247+
"id": "param_bool",
248+
"name": "布尔参数",
249+
"define": {
250+
"type": "bool",
251+
"mapping": {
252+
"0": "",
253+
"1": ""
254+
}
255+
}
256+
},
257+
{
258+
"id": "param_int",
259+
"name": "整数参数",
260+
"define": {
261+
"type": "int",
262+
"min": "-100000",
263+
"max": "1000000",
264+
"start": "0",
265+
"step": "1",
266+
"unit": ""
267+
}
268+
},
269+
{
270+
"id": "param_string",
271+
"name": "字符串参数",
272+
"define": {
273+
"type": "string",
274+
"min": "0",
275+
"max": "128"
276+
}
277+
},
278+
{
279+
"id": "param_float",
280+
"name": "浮点参数",
281+
"define": {
282+
"type": "float",
283+
"min": "0",
284+
"max": "100",
285+
"start": "0",
286+
"step": "0.001",
287+
"unit": ""
288+
}
289+
},
290+
{
291+
"id": "param_enum",
292+
"name": "枚举参数",
293+
"define": {
294+
"type": "enum",
295+
"mapping": {
296+
"0": "PARAM_ENUM0",
297+
"1": "PARAM_ENUM1",
298+
"2": "PARAM_ENUM2"
299+
}
300+
}
301+
},
302+
{
303+
"id": "param_time",
304+
"name": "时间参数",
305+
"define": {
306+
"type": "timestamp"
307+
}
308+
}
309+
],
310+
"required": false
311+
},
312+
{
313+
"id": "event_error",
314+
"name": "故障事件",
315+
"desc": "",
316+
"type": "fault",
317+
"params": [
318+
{
319+
"id": "param_bool",
320+
"name": "布尔参数",
321+
"define": {
322+
"type": "bool",
323+
"mapping": {
324+
"0": "",
325+
"1": ""
326+
}
327+
}
328+
},
329+
{
330+
"id": "param_string",
331+
"name": "字符串参数",
332+
"define": {
333+
"type": "string",
334+
"min": "0",
335+
"max": "128"
336+
}
337+
}
338+
],
339+
"required": false
340+
}
341+
],
342+
"actions": [
343+
{
344+
"id": "action_test",
345+
"name": "测试行为",
346+
"desc": "",
347+
"input": [
348+
{
349+
"id": "bool_input",
350+
"name": "布尔输入",
351+
"define": {
352+
"type": "bool",
353+
"mapping": {
354+
"0": "",
355+
"1": ""
356+
}
357+
}
358+
},
359+
{
360+
"id": "int_input",
361+
"name": "整数输入",
362+
"define": {
363+
"type": "int",
364+
"min": "-100000",
365+
"max": "100000",
366+
"start": "0",
367+
"step": "1",
368+
"unit": ""
369+
}
370+
},
371+
{
372+
"id": "string_input",
373+
"name": "字符串输入",
374+
"define": {
375+
"type": "string",
376+
"min": "0",
377+
"max": "128"
378+
}
379+
},
380+
{
381+
"id": "float_input",
382+
"name": "浮点输入",
383+
"define": {
384+
"type": "float",
385+
"min": "-100",
386+
"max": "100",
387+
"start": "0",
388+
"step": "1",
389+
"unit": ""
390+
}
391+
},
392+
{
393+
"id": "enum_input",
394+
"name": "枚举输入",
395+
"define": {
396+
"type": "enum",
397+
"mapping": {
398+
"0": "INPUT_ENUM0",
399+
"1": "INPUT_ENUM1",
400+
"2": "INPUT_ENUM2"
401+
}
402+
}
403+
},
404+
{
405+
"id": "time_input",
406+
"name": "时间输入",
407+
"define": {
408+
"type": "timestamp"
409+
}
410+
}
411+
],
412+
"output": [
413+
{
414+
"id": "bool_output",
415+
"name": "布尔输出",
416+
"define": {
417+
"type": "bool",
418+
"mapping": {
419+
"0": "",
420+
"1": ""
421+
}
422+
}
423+
},
424+
{
425+
"id": "int_output",
426+
"name": "整数输出",
427+
"define": {
428+
"type": "int",
429+
"min": "-100000",
430+
"max": "1000000",
431+
"start": "0",
432+
"step": "1",
433+
"unit": ""
434+
}
435+
},
436+
{
437+
"id": "string_output",
438+
"name": "字符串输出",
439+
"define": {
440+
"type": "string",
441+
"min": "0",
442+
"max": "128"
443+
}
444+
},
445+
{
446+
"id": "float_output",
447+
"name": "浮点输出",
448+
"define": {
449+
"type": "float",
450+
"min": "-100",
451+
"max": "100",
452+
"start": "0",
453+
"step": "1",
454+
"unit": ""
455+
}
456+
},
457+
{
458+
"id": "enum_output",
459+
"name": "枚举输出",
460+
"define": {
461+
"type": "enum",
462+
"mapping": {
463+
"0": "OUTPUT_ENUM0",
464+
"1": "OUTPUT_ENUM1",
465+
"2": "OUTPUT_ENUM2"
466+
}
467+
}
468+
},
469+
{
470+
"id": "time_output",
471+
"name": "时间输出",
472+
"define": {
473+
"type": "timestamp"
474+
}
475+
}
476+
],
477+
"required": false
478+
}
479+
],
480+
"profile": {
481+
"ProductId": "W3XW6B49BM",
482+
"CategoryId": "1"
483+
}
484+
}

0 commit comments

Comments
 (0)
Please sign in to comment.