Skip to content

Commit 855aec8

Browse files
committed
Update JS API bindings
1 parent b79b151 commit 855aec8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/mgos_bt_js.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static const struct mjs_c_struct_member gattc_discovery_result_arg_def[] = {
118118
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
119119
{"prop", offsetof(struct mgos_bt_gattc_discovery_result_arg, prop),
120120
MJS_STRUCT_FIELD_TYPE_UINT8, NULL},
121-
{NULL, 0, MJS_STRUCT_FIELD_TYPE_INVALID, NULL},
121+
{NULL},
122122
};
123123

124124
const struct mjs_c_struct_member *mgos_bt_gattc_js_get_discovery_result_arg_def(
@@ -133,7 +133,7 @@ static const struct mjs_c_struct_member gattc_read_result_def[] = {
133133
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
134134
{"data", offsetof(struct mgos_bt_gattc_read_result, data),
135135
MJS_STRUCT_FIELD_TYPE_MG_STR, NULL},
136-
{NULL, 0, MJS_STRUCT_FIELD_TYPE_INVALID, NULL},
136+
{NULL},
137137
};
138138

139139
const struct mjs_c_struct_member *mgos_bt_gattc_js_get_read_result_def(void) {
@@ -149,23 +149,27 @@ static const struct mjs_c_struct_member gatts_read_arg_def[] = {
149149
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
150150
{"char_uuid", offsetof(struct mgos_bt_gatts_read_arg, char_uuid),
151151
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
152+
{"desc_uuid", offsetof(struct mgos_bt_gatts_read_arg, desc_uuid),
153+
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
152154
{"handle", offsetof(struct mgos_bt_gatts_read_arg, handle),
153155
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
154156
{"transId", offsetof(struct mgos_bt_gatts_read_arg, trans_id),
155157
MJS_STRUCT_FIELD_TYPE_INT, NULL},
156158
{"offset", offsetof(struct mgos_bt_gatts_read_arg, offset),
157159
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
158-
{NULL, 0, MJS_STRUCT_FIELD_TYPE_INVALID, NULL},
160+
{NULL},
159161
};
160162

161163
const struct mjs_c_struct_member *mgos_bt_gatts_js_get_read_arg_def(void) {
162164
return gatts_read_arg_def;
163165
}
164166

165167
static const struct mjs_c_struct_member gatts_write_arg_def[] = {
166-
{"svc_uuid", offsetof(struct mgos_bt_gatts_read_arg, svc_uuid),
168+
{"svc_uuid", offsetof(struct mgos_bt_gatts_write_arg, svc_uuid),
167169
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
168-
{"char_uuid", offsetof(struct mgos_bt_gatts_read_arg, char_uuid),
170+
{"char_uuid", offsetof(struct mgos_bt_gatts_write_arg, char_uuid),
171+
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
172+
{"desc_uuid", offsetof(struct mgos_bt_gatts_write_arg, desc_uuid),
169173
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
170174
{"handle", offsetof(struct mgos_bt_gatts_write_arg, handle),
171175
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
@@ -175,7 +179,7 @@ static const struct mjs_c_struct_member gatts_write_arg_def[] = {
175179
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
176180
{"data", offsetof(struct mgos_bt_gatts_write_arg, data),
177181
MJS_STRUCT_FIELD_TYPE_MG_STR, NULL},
178-
{NULL, 0, MJS_STRUCT_FIELD_TYPE_INVALID, NULL},
182+
{NULL},
179183
};
180184

181185
const struct mjs_c_struct_member *mgos_bt_gatts_js_get_write_arg_def(void) {
@@ -189,15 +193,15 @@ static mjs_val_t nm_to_int(struct mjs *mjs, void *ap) {
189193
}
190194

191195
static const struct mjs_c_struct_member gatts_notify_mode_arg_def[] = {
192-
{"svc_uuid", offsetof(struct mgos_bt_gatts_read_arg, svc_uuid),
196+
{"svc_uuid", offsetof(struct mgos_bt_gatts_notify_mode_arg, svc_uuid),
193197
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
194-
{"char_uuid", offsetof(struct mgos_bt_gatts_read_arg, char_uuid),
198+
{"char_uuid", offsetof(struct mgos_bt_gatts_notify_mode_arg, char_uuid),
195199
MJS_STRUCT_FIELD_TYPE_CUSTOM, bt_uuid_to_str},
196200
{"handle", offsetof(struct mgos_bt_gatts_notify_mode_arg, handle),
197201
MJS_STRUCT_FIELD_TYPE_UINT16, NULL},
198202
{"mode", offsetof(struct mgos_bt_gatts_notify_mode_arg, mode),
199203
MJS_STRUCT_FIELD_TYPE_CUSTOM, nm_to_int},
200-
{NULL, 0, MJS_STRUCT_FIELD_TYPE_INVALID, NULL},
204+
{NULL},
201205
};
202206

203207
const struct mjs_c_struct_member *mgos_bt_gatts_js_get_notify_mode_arg_def(

0 commit comments

Comments
 (0)