Lines Matching refs:fd
193 static int init_object_name_parameters(struct json_out_formatter_data *fd, in init_object_name_parameters() argument
199 if (fd->writer_flags & WRITER_RESOURCE_INSTANCE) { in init_object_name_parameters()
200 ret = snprintk(fd->name_string, sizeof(fd->name_string), "%u/%u", path->res_id, in init_object_name_parameters()
203 ret = snprintk(fd->name_string, sizeof(fd->name_string), "%u", path->res_id); in init_object_name_parameters()
246 static int json_add_separator(struct lwm2m_output_context *out, struct json_out_formatter_data *fd) in json_add_separator() argument
250 if (fd->writer_flags & WRITER_OUTPUT_VALUE) { in json_add_separator()
263 static void json_postprefix(struct json_out_formatter_data *fd) in json_postprefix() argument
265 fd->writer_flags |= WRITER_OUTPUT_VALUE; in json_postprefix()
269 struct json_out_formatter_data *fd, int float_string_length) in json_float_object_write() argument
277 len = json_add_separator(out, fd); in json_float_object_write()
284 obj_payload = &fd->json.obj.float_obj; in json_float_object_write()
285 fd->json.obj.float_obj.name = fd->name_string; in json_float_object_write()
286 fd->json.obj.float_obj.val_float.start = pt_buffer; in json_float_object_write()
287 fd->json.obj.float_obj.val_float.length = float_string_length; in json_float_object_write()
304 json_postprefix(fd); in json_float_object_write()
309 struct json_out_formatter_data *fd, char *buf) in json_string_object_write() argument
317 len = json_add_separator(out, fd); in json_string_object_write()
324 obj_payload = &fd->json.obj.string_obj; in json_string_object_write()
325 fd->json.obj.string_obj.name = fd->name_string; in json_string_object_write()
326 fd->json.obj.string_obj.val_string = buf; in json_string_object_write()
343 json_postprefix(fd); in json_string_object_write()
348 struct json_out_formatter_data *fd, bool value) in json_boolean_object_write() argument
356 len = json_add_separator(out, fd); in json_boolean_object_write()
363 obj_payload = &fd->json.obj.boolean_obj; in json_boolean_object_write()
364 fd->json.obj.boolean_obj.name = fd->name_string; in json_boolean_object_write()
365 fd->json.obj.boolean_obj.val_bool = value; in json_boolean_object_write()
382 json_postprefix(fd); in json_boolean_object_write()
387 struct json_out_formatter_data *fd) in json_objlnk_object_write() argument
395 len = json_add_separator(out, fd); in json_objlnk_object_write()
402 obj_payload = &fd->json.obj.string_obj; in json_objlnk_object_write()
403 fd->json.obj.string_obj.name = fd->name_string; in json_objlnk_object_write()
404 fd->json.obj.string_obj.val_string = pt_buffer; in json_objlnk_object_write()
421 json_postprefix(fd); in json_objlnk_object_write()
468 struct json_out_formatter_data *fd; in put_begin_ri() local
470 fd = engine_get_out_user_data(out); in put_begin_ri()
471 if (!fd) { in put_begin_ri()
475 fd->writer_flags |= WRITER_RESOURCE_INSTANCE; in put_begin_ri()
482 struct json_out_formatter_data *fd; in put_end_ri() local
484 fd = engine_get_out_user_data(out); in put_end_ri()
485 if (!fd) { in put_end_ri()
489 fd->writer_flags &= ~WRITER_RESOURCE_INSTANCE; in put_end_ri()
495 struct json_out_formatter_data *fd; in put_s32() local
498 fd = engine_get_out_user_data(out); in put_s32()
500 if (!out->out_cpkt || !fd) { in put_s32()
504 if (init_object_name_parameters(fd, path)) { in put_s32()
513 return json_float_object_write(out, fd, len); in put_s32()
531 struct json_out_formatter_data *fd; in put_s64() local
534 fd = engine_get_out_user_data(out); in put_s64()
536 if (!out->out_cpkt || !fd) { in put_s64()
540 if (init_object_name_parameters(fd, path)) { in put_s64()
549 return json_float_object_write(out, fd, len); in put_s64()
560 struct json_out_formatter_data *fd; in put_string() local
562 fd = engine_get_out_user_data(out); in put_string()
564 if (!out->out_cpkt || !fd) { in put_string()
568 if (init_object_name_parameters(fd, path)) { in put_string()
572 return json_string_object_write(out, fd, buf); in put_string()
578 struct json_out_formatter_data *fd; in put_float() local
581 fd = engine_get_out_user_data(out); in put_float()
583 if (!out->out_cpkt || !fd) { in put_float()
587 if (init_object_name_parameters(fd, path)) { in put_float()
596 return json_float_object_write(out, fd, len); in put_float()
602 struct json_out_formatter_data *fd; in put_bool() local
604 fd = engine_get_out_user_data(out); in put_bool()
606 if (!out->out_cpkt || !fd) { in put_bool()
610 if (init_object_name_parameters(fd, path)) { in put_bool()
614 return json_boolean_object_write(out, fd, value); in put_bool()
620 struct json_out_formatter_data *fd; in put_objlnk() local
622 fd = engine_get_out_user_data(out); in put_objlnk()
624 if (!out->out_cpkt || !fd) { in put_objlnk()
628 if (init_object_name_parameters(fd, path)) { in put_objlnk()
636 return json_objlnk_object_write(out, fd); in put_objlnk()
642 struct json_in_formatter_data *fd; in read_int() local
651 fd = engine_get_in_user_data(in); in read_int()
652 if (!fd || (fd->object_bit_field & JSON_V_TYPE) == 0) { in read_int()
656 if (fd->array_object.val_float.length == 0) { in read_int()
660 buf = fd->array_object.val_float.start; in read_int()
661 while (*(buf + i) && i < fd->array_object.val_float.length) { in read_int()
713 struct json_in_formatter_data *fd; in get_string() local
716 fd = engine_get_in_user_data(in); in get_string()
717 if (!fd || (fd->object_bit_field & JSON_SV_TYPE) == 0) { in get_string()
721 string_length = strlen(fd->array_object.val_string); in get_string()
727 memcpy(buf, fd->array_object.val_string, string_length); in get_string()
737 struct json_in_formatter_data *fd; in get_float() local
744 fd = engine_get_in_user_data(in); in get_float()
745 if (!fd || (fd->object_bit_field & JSON_V_TYPE) == 0) { in get_float()
749 size_t value_length = fd->array_object.val_float.length; in get_float()
755 json_buf = fd->array_object.val_float.start; in get_float()
790 struct json_in_formatter_data *fd; in get_bool() local
792 fd = engine_get_in_user_data(in); in get_bool()
793 if (!fd || (fd->object_bit_field & JSON_BV_TYPE) == 0) { in get_bool()
797 *value = fd->array_object.val_bool; in get_bool()
815 struct json_in_formatter_data *fd; in get_objlnk() local
818 fd = engine_get_in_user_data(in); in get_objlnk()
819 if (!fd || (fd->object_bit_field & JSON_OV_TYPE) == 0) { in get_objlnk()
823 demiliter_pos = strchr(fd->array_object.val_object_link, ':'); in get_objlnk()
828 fd->object_bit_field |= JSON_V_TYPE; in get_objlnk()
829 fd->array_object.val_float.start = fd->array_object.val_object_link; in get_objlnk()
830 fd->array_object.val_float.length = strlen(fd->array_object.val_object_link); in get_objlnk()
845 fd->array_object.val_float.start = demiliter_pos; in get_objlnk()
846 fd->array_object.val_float.length = strlen(demiliter_pos); in get_objlnk()
888 struct json_out_formatter_data fd; in do_read_op_json() local
891 (void)memset(&fd, 0, sizeof(fd)); in do_read_op_json()
892 engine_set_out_user_data(&msg->out, &fd); in do_read_op_json()
906 struct json_in_formatter_data fd; in do_write_op_json() local
918 (void)memset(&fd, 0, sizeof(fd)); in do_write_op_json()
920 engine_set_in_user_data(&msg->in, &fd); in do_write_op_json()
948 (void)memset(&fd.array_object, 0, sizeof(fd.array_object)); in do_write_op_json()
949 fd.object_bit_field = json_arr_separate_parse_object( in do_write_op_json()
950 &json_object, json_obj_descr, ARRAY_SIZE(json_obj_descr), &fd.array_object); in do_write_op_json()
951 if (fd.object_bit_field == 0) { in do_write_op_json()
954 } else if (fd.object_bit_field < 0 || in do_write_op_json()
955 ((fd.object_bit_field & JSON_VAL_MASK) == 0)) { in do_write_op_json()
956 LOG_ERR("Json Write Parse object fail %d", fd.object_bit_field); in do_write_op_json()
963 if (fd.object_bit_field & JSON_N_TYPE) { in do_write_op_json()
965 fd.array_object.name); in do_write_op_json()
970 if ((fd.object_bit_field & JSON_N_TYPE) == 0) { in do_write_op_json()
974 ret = snprintk(full_name, sizeof(full_name), "%s", fd.array_object.name); in do_write_op_json()