File tree 2 files changed +28
-20
lines changed
2 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -1372,9 +1372,11 @@ typedef struct neu_req_scan_tags {
1372
1372
} neu_req_scan_tags_t ;
1373
1373
1374
1374
typedef struct {
1375
- char name [NEU_TAG_NAME_LEN ];
1376
- char id [5 + 1 + NEU_TAG_ADDRESS_LEN ]; // ns + ! + address
1377
- uint8_t tag ;
1375
+ char name [NEU_TAG_NAME_LEN ];
1376
+ char id [5 + 1 + NEU_TAG_ADDRESS_LEN ]; // ns + ! + address
1377
+ uint8_t tag ;
1378
+ bool is_last_layer ;
1379
+ neu_type_e type ;
1378
1380
} neu_scan_tag_t ;
1379
1381
1380
1382
typedef struct {
Original file line number Diff line number Diff line change @@ -107,26 +107,32 @@ int neu_json_encode_scan_tags_resp(void *json_object, void *param)
107
107
utarray_foreach (resp -> scan_tags , neu_scan_tag_t * , p_tag )
108
108
{
109
109
if (NULL != p_tag ) {
110
- neu_json_elem_t tag_elems [] = {
111
- {
112
- .name = "name" ,
113
- .t = NEU_JSON_STR ,
114
- .v .val_str = p_tag -> name ,
115
- },
116
- {
117
- .name = "id" ,
118
- .t = NEU_JSON_STR ,
119
- .v .val_str = p_tag -> id ,
120
- },
121
- {
122
- .name = "tag" ,
123
- .t = NEU_JSON_INT ,
124
- .v .val_int = p_tag -> tag ,
125
- },
110
+ neu_json_elem_t tag_elems [4 ];
111
+ tag_elems [0 ] = (neu_json_elem_t ) {
112
+ .name = "name" ,
113
+ .t = NEU_JSON_STR ,
114
+ .v .val_str = p_tag -> name ,
115
+ };
116
+ tag_elems [1 ] = (neu_json_elem_t ) {
117
+ .name = "id" ,
118
+ .t = NEU_JSON_STR ,
119
+ .v .val_str = p_tag -> id ,
126
120
};
121
+ tag_elems [2 ] = (neu_json_elem_t ) {
122
+ .name = "tag" ,
123
+ .t = NEU_JSON_INT ,
124
+ .v .val_int = p_tag -> tag ,
125
+ };
126
+ if (p_tag -> is_last_layer ) {
127
+ tag_elems [3 ] = (neu_json_elem_t ) {
128
+ .name = "tag_type" ,
129
+ .t = NEU_JSON_INT ,
130
+ .v .val_int = p_tag -> type ,
131
+ };
132
+ }
127
133
128
134
neu_json_encode_array (tag_array , tag_elems ,
129
- NEU_JSON_ELEM_SIZE ( tag_elems ) );
135
+ p_tag -> is_last_layer ? 4 : 3 );
130
136
}
131
137
}
132
138
You can’t perform that action at this time.
0 commit comments