fix
This commit is contained in:
parent
d44889aff2
commit
02cf888c32
@ -8,6 +8,7 @@
|
||||
-behaviour(application).
|
||||
|
||||
-export([start/2, stop/1]).
|
||||
-export([start_http_server/0]).
|
||||
|
||||
start(_StartType, _StartArgs) ->
|
||||
io:setopts([{encoding, unicode}]),
|
||||
@ -19,7 +20,7 @@ start(_StartType, _StartArgs) ->
|
||||
%% 加速内存的回收
|
||||
erlang:system_flag(fullsweep_after, 16),
|
||||
|
||||
start_http_server(),
|
||||
%start_http_server(),
|
||||
|
||||
iot_sup:start_link().
|
||||
|
||||
|
||||
@ -48,12 +48,12 @@ start_link() ->
|
||||
{ok, State :: #state{}} | {ok, State :: #state{}, timeout() | hibernate} |
|
||||
{stop, Reason :: term()} | ignore).
|
||||
init([]) ->
|
||||
{ok, ServerOpts} = application:get_env(iot, emqx_server),
|
||||
{ok, ConnPid} = emqtt:start_link([{clientid, iot_emqtt_client}, {owner, self()}|ServerOpts]),
|
||||
{ok, _Props} = emqtt:connect(ConnPid),
|
||||
%{ok, ServerOpts} = application:get_env(iot, emqx_server),
|
||||
%{ok, ConnPid} = emqtt:start_link([{clientid, iot_emqtt_client}, {owner, self()}|ServerOpts]),
|
||||
%{ok, _Props} = emqtt:connect(ConnPid),
|
||||
|
||||
SubOpts = [{qos, 1}],
|
||||
{ok, _Props, _ReasonCodes} = emqtt:subscribe(ConnPid, #{}, [{<<"hello">>, SubOpts}]),
|
||||
%SubOpts = [{qos, 1}],
|
||||
%{ok, _Props, _ReasonCodes} = emqtt:subscribe(ConnPid, #{}, [{<<"hello">>, SubOpts}]),
|
||||
|
||||
{ok, #state{}}.
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ change_status(HostId, Status) when is_binary(HostId), is_integer(Status) ->
|
||||
{error, Reason}
|
||||
end.
|
||||
|
||||
-spec activate(HostId :: binary()) -> ok | {error, Reason}.
|
||||
-spec activate(HostId :: binary()) -> ok | {error, Reason :: any()}.
|
||||
activate(HostId) when is_binary(HostId) ->
|
||||
Fun = fun() ->
|
||||
case mnesia:read(host, HostId) of
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user