fix mqtt topic
This commit is contained in:
parent
84ceab0b5d
commit
c8bf170562
@ -206,7 +206,7 @@ create_postman(Opts) ->
|
|||||||
Port = proplists:get_value(port, Opts),
|
Port = proplists:get_value(port, Opts),
|
||||||
Username = proplists:get_value(username, Opts),
|
Username = proplists:get_value(username, Opts),
|
||||||
Password = proplists:get_value(password, Opts),
|
Password = proplists:get_value(password, Opts),
|
||||||
Topic = proplists:get_value(topic, Opts),
|
Topic0 = proplists:get_value(topic, Opts),
|
||||||
Qos = proplists:get_value(qos, Opts),
|
Qos = proplists:get_value(qos, Opts),
|
||||||
|
|
||||||
Node = atom_to_binary(node()),
|
Node = atom_to_binary(node()),
|
||||||
@ -225,7 +225,7 @@ create_postman(Opts) ->
|
|||||||
{retry_interval, 5000}
|
{retry_interval, 5000}
|
||||||
],
|
],
|
||||||
|
|
||||||
mqtt_postman:start_link(PostmanOpts, Topic, Qos).
|
mqtt_postman:start_link(PostmanOpts, list_to_binary(Topic0), Qos).
|
||||||
|
|
||||||
-spec do_post(PostmanPid :: pid(), NorthData :: #north_data{}) -> no_return().
|
-spec do_post(PostmanPid :: pid(), NorthData :: #north_data{}) -> no_return().
|
||||||
do_post(PostmanPid, #north_data{id = Id, location_code = LocationCode, dynamic_location_code = DynamicLocationCode, fields = Fields, timestamp = Timestamp}) when is_pid(PostmanPid) ->
|
do_post(PostmanPid, #north_data{id = Id, location_code = LocationCode, dynamic_location_code = DynamicLocationCode, fields = Fields, timestamp = Timestamp}) when is_pid(PostmanPid) ->
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
%% @doc Spawns the server and registers the local name (unique)
|
%% @doc Spawns the server and registers the local name (unique)
|
||||||
-spec(start_link(Opts :: list(), Topic :: binary(), Qos :: integer()) ->
|
-spec(start_link(Opts :: list(), Topic :: binary(), Qos :: integer()) ->
|
||||||
{ok, Pid :: pid()} | ignore | {error, Reason :: term()}).
|
{ok, Pid :: pid()} | ignore | {error, Reason :: term()}).
|
||||||
start_link(Opts, Topic, Qos) when is_list(Opts), is_binary(Topic), Qos == 0; Qos == 1; Qos == 2 ->
|
start_link(Opts, Topic, Qos) when is_list(Opts) andalso is_binary(Topic) andalso (Qos == 0 orelse Qos == 1 orelse Qos == 2) ->
|
||||||
gen_server:start_link(?MODULE, [Opts, Topic, Qos], []).
|
gen_server:start_link(?MODULE, [Opts, Topic, Qos], []).
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user