From 49adf2f7d2807f8747ab85e7b410e5af25c5d849 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Wed, 13 Oct 2021 14:32:57 +0800 Subject: [PATCH] chore(gw-lwm2m): set qmode to duration_s type --- apps/emqx_gateway/etc/emqx_gateway.conf.example | 2 +- apps/emqx_gateway/src/emqx_gateway_schema.erl | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/emqx_gateway/etc/emqx_gateway.conf.example b/apps/emqx_gateway/etc/emqx_gateway.conf.example index 184d998dc..fc85bb1e8 100644 --- a/apps/emqx_gateway/etc/emqx_gateway.conf.example +++ b/apps/emqx_gateway/etc/emqx_gateway.conf.example @@ -266,7 +266,7 @@ gateway.lwm2m { lifetime_max = 86400s - qmode_time_window = 22 + qmode_time_window = 22s auto_observe = false diff --git a/apps/emqx_gateway/src/emqx_gateway_schema.erl b/apps/emqx_gateway/src/emqx_gateway_schema.erl index 6570d5346..53f3ad3ba 100644 --- a/apps/emqx_gateway/src/emqx_gateway_schema.erl +++ b/apps/emqx_gateway/src/emqx_gateway_schema.erl @@ -28,16 +28,19 @@ -type ip_port() :: tuple(). -type duration() :: integer(). +-type duration_s() :: integer(). -type bytesize() :: integer(). -type comma_separated_list() :: list(). -typerefl_from_string({ip_port/0, emqx_schema, to_ip_port}). -typerefl_from_string({duration/0, emqx_schema, to_duration}). +-typerefl_from_string({duration_s/0, emqx_schema, to_duration_s}). -typerefl_from_string({bytesize/0, emqx_schema, to_bytesize}). -typerefl_from_string({comma_separated_list/0, emqx_schema, to_comma_separated_list}). -reflect_type([ duration/0 + , duration_s/0 , bytesize/0 , comma_separated_list/0 , ip_port/0 @@ -94,7 +97,7 @@ fields(lwm2m) -> [ {xml_dir, sc(binary(), "etc/lwm2m_xml")} , {lifetime_min, sc(duration(), "1s")} , {lifetime_max, sc(duration(), "86400s")} - , {qmode_time_window, sc(integer(), 22)} + , {qmode_time_window, sc(duration_s(), "22s")} , {auto_observe, sc(boolean(), false)} , {update_msg_publish_condition, sc(hoconsc:union([always, contains_object_list]))} , {translators, sc_meta(ref(translators), #{nullable => false})}