From f1a9fbb71e1a365bf93cd6e01983e10c6681ce21 Mon Sep 17 00:00:00 2001 From: fengzero Date: Tue, 6 Sep 2022 09:12:02 +0000 Subject: [PATCH] fix(api): fix double type precision --- plugins/mqtt/command/read_write.c | 1 + plugins/restful/rw_handle.c | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/mqtt/command/read_write.c b/plugins/mqtt/command/read_write.c index fff50787..5e7d70a9 100644 --- a/plugins/mqtt/command/read_write.c +++ b/plugins/mqtt/command/read_write.c @@ -112,6 +112,7 @@ static void wrap_read_response_json(neu_resp_tag_value_t *tags, uint16_t len, case NEU_TYPE_DOUBLE: json->tags[i].t = NEU_JSON_DOUBLE; json->tags[i].value.val_double = tag->value.value.d64; + json->tags[i].precision = tag->value.precision; break; case NEU_TYPE_BOOL: json->tags[i].t = NEU_JSON_BOOL; diff --git a/plugins/restful/rw_handle.c b/plugins/restful/rw_handle.c index eaad7c2f..8fddcffa 100644 --- a/plugins/restful/rw_handle.c +++ b/plugins/restful/rw_handle.c @@ -153,6 +153,7 @@ void handle_read_resp(nng_aio *aio, neu_resp_read_group_t *resp) case NEU_TYPE_DOUBLE: api_res.tags[i].t = NEU_JSON_DOUBLE; api_res.tags[i].value.val_double = resp->tags[i].value.value.d64; + api_res.tags[i].precision = resp->tags[i].value.precision; break; case NEU_TYPE_BIT: api_res.tags[i].t = NEU_JSON_BIT;