From b68e1489ddeb17b3a8be449f1532b6b80c4d491b Mon Sep 17 00:00:00 2001 From: anlicheng Date: Thu, 15 Jun 2023 13:06:45 +0800 Subject: [PATCH] fix --- apps/iot/src/iot_host.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index fb5422d..3f36fc0 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -102,7 +102,7 @@ make_assoc(Pid) when is_pid(Pid) -> %% 激活主机, true 表示激活; false表示关闭激活 -spec activate(Pid :: pid(), Auth :: boolean()) -> ok. -activate(Pid, Auth) when is_pid(Pid), is_binary(Auth) -> +activate(Pid, Auth) when is_pid(Pid), is_boolean(Auth) -> gen_server:call(Pid, {activate, Auth}). -spec get_metric(Pid :: pid()) -> {ok, MetricInfo :: map()}. @@ -152,8 +152,10 @@ init([UUID]) -> {noreply, NewState :: #state{}, timeout() | hibernate} | {stop, Reason :: term(), Reply :: term(), NewState :: #state{}} | {stop, Reason :: term(), NewState :: #state{}}). -handle_call(get_metric, _From, State = #state{metrics = Metrics}) -> +handle_call(get_metric, _From, State = #state{metrics = Metrics, has_session = true}) -> {reply, {ok, Metrics}, State}; +handle_call(get_metric, _From, State) -> + {reply, {ok, #{}}, State}; handle_call(get_aes, _From, State = #state{aes = Aes}) -> {reply, {ok, Aes}, State};