diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 699c01a..4a45341 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -15,7 +15,7 @@ %% API -export([start_link/2, get_name/1, get_pid/1, handle/2, reload/1, activate/2]). -export([get_metric/1, publish_message/4, get_aes/1]). --export([has_session/1, create_session/2, attach_channel/2]). +-export([create_session/2, attach_channel/2]). %% gen_statem callbacks -export([init/1, format_status/2, handle_event/4, terminate/3, code_change/4, callback_mode/0]). @@ -71,10 +71,6 @@ activate(Pid, Auth) when is_pid(Pid), is_boolean(Auth) -> get_metric(Pid) when is_pid(Pid) -> gen_statem:call(Pid, get_metric). --spec has_session(Pid :: pid()) -> boolean(). -has_session(Pid) when is_pid(Pid) -> - gen_statem:call(Pid, has_session). - -spec attach_channel(pid(), pid()) -> ok. attach_channel(Pid, ChannelPid) when is_pid(Pid), is_pid(ChannelPid) -> gen_statem:call(Pid, {attach_channel, ChannelPid}). @@ -160,10 +156,6 @@ handle_event({call, From}, get_metric, _, State) -> handle_event({call, From}, get_aes, _, State = #state{aes = Aes}) -> {keep_state, State, [{reply, From, {ok, Aes}}]}; -handle_event({call, From}, has_session, StateName, State) -> - HasSession = (StateName =:= session) orelse false, - {keep_state, State, [{reply, From, HasSession}]}; - %% 发送普通格式的消息, 激活的时候,会话时创建不成功的; 发送aes类型的命令的时候,必须要求session是存在的 handle_event({call, From}, {publish_message, ReceiverPid, CommandType, {aes, Command0}}, session, State = #state{aes = AES, channel_pid = ChannelPid}) -> Command = iot_cipher_aes:encrypt(AES, Command0),