fix(gw_gbt32960): mountpoint should not with `/` suffix
This commit is contained in:
parent
867d5aaea6
commit
20bf9ed26d
|
@ -75,3 +75,6 @@
|
||||||
% 0x0A~0x2F: Customized data for Platform Exchange Protocol
|
% 0x0A~0x2F: Customized data for Platform Exchange Protocol
|
||||||
% 0x30~0x7F: Reserved
|
% 0x30~0x7F: Reserved
|
||||||
% 0x80~0xFE: Customized by user
|
% 0x80~0xFE: Customized by user
|
||||||
|
|
||||||
|
-define(DEFAULT_MOUNTPOINT, <<"gbt32960/${clientid}/">>).
|
||||||
|
-define(DEFAULT_DOWNLINK_TOPIC, <<"dnstream">>).
|
||||||
|
|
|
@ -74,8 +74,6 @@
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-define(INFO_KEYS, [conninfo, conn_state, clientinfo, session, will_msg]).
|
-define(INFO_KEYS, [conninfo, conn_state, clientinfo, session, will_msg]).
|
||||||
-define(DEFAULT_MOUNTPOINT, <<"gbt32960/${clientid}">>).
|
|
||||||
-define(DEFAULT_DOWNLINK_TOPIC, <<"/dnstream">>).
|
|
||||||
|
|
||||||
-dialyzer({nowarn_function, init/2}).
|
-dialyzer({nowarn_function, init/2}).
|
||||||
|
|
||||||
|
@ -702,14 +700,14 @@ upstreaming(
|
||||||
transform(Frame = ?CMD(Cmd), Mountpoint) ->
|
transform(Frame = ?CMD(Cmd), Mountpoint) ->
|
||||||
Suffix =
|
Suffix =
|
||||||
case Cmd of
|
case Cmd of
|
||||||
?CMD_VIHECLE_LOGIN -> <<"/upstream/vlogin">>;
|
?CMD_VIHECLE_LOGIN -> <<"upstream/vlogin">>;
|
||||||
?CMD_INFO_REPORT -> <<"/upstream/info">>;
|
?CMD_INFO_REPORT -> <<"upstream/info">>;
|
||||||
?CMD_INFO_RE_REPORT -> <<"/upstream/reinfo">>;
|
?CMD_INFO_RE_REPORT -> <<"upstream/reinfo">>;
|
||||||
?CMD_VIHECLE_LOGOUT -> <<"/upstream/vlogout">>;
|
?CMD_VIHECLE_LOGOUT -> <<"upstream/vlogout">>;
|
||||||
?CMD_PLATFORM_LOGIN -> <<"/upstream/plogin">>;
|
?CMD_PLATFORM_LOGIN -> <<"upstream/plogin">>;
|
||||||
?CMD_PLATFORM_LOGOUT -> <<"/upstream/plogout">>;
|
?CMD_PLATFORM_LOGOUT -> <<"upstream/plogout">>;
|
||||||
%CMD_HEARTBEAT, CMD_SCHOOL_TIME ...
|
%CMD_HEARTBEAT, CMD_SCHOOL_TIME ...
|
||||||
_ -> <<"/upstream/transparent">>
|
_ -> <<"upstream/transparent">>
|
||||||
end,
|
end,
|
||||||
Topic = emqx_mountpoint:mount(Mountpoint, Suffix),
|
Topic = emqx_mountpoint:mount(Mountpoint, Suffix),
|
||||||
Payload = to_json(Frame),
|
Payload = to_json(Frame),
|
||||||
|
@ -717,7 +715,7 @@ transform(Frame = ?CMD(Cmd), Mountpoint) ->
|
||||||
transform(Frame = #frame{ack = Ack}, Mountpoint) when
|
transform(Frame = #frame{ack = Ack}, Mountpoint) when
|
||||||
?IS_ACK_CODE(Ack)
|
?IS_ACK_CODE(Ack)
|
||||||
->
|
->
|
||||||
Topic = emqx_mountpoint:mount(Mountpoint, <<"/upstream/response">>),
|
Topic = emqx_mountpoint:mount(Mountpoint, <<"upstream/response">>),
|
||||||
Payload = to_json(Frame),
|
Payload = to_json(Frame),
|
||||||
{Topic, Payload}.
|
{Topic, Payload}.
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
|
|
||||||
-module(emqx_gbt32960_schema).
|
-module(emqx_gbt32960_schema).
|
||||||
|
|
||||||
|
-include("emqx_gbt32960.hrl").
|
||||||
-include_lib("hocon/include/hoconsc.hrl").
|
-include_lib("hocon/include/hoconsc.hrl").
|
||||||
-include_lib("typerefl/include/types.hrl").
|
-include_lib("typerefl/include/types.hrl").
|
||||||
|
|
||||||
-define(DEFAULT_MOUNTPOINT, <<"gbt32960/${clientid}">>).
|
|
||||||
|
|
||||||
%% config schema provides
|
%% config schema provides
|
||||||
-export([fields/1, desc/1]).
|
-export([fields/1, desc/1]).
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
"}\n"
|
"}\n"
|
||||||
>>).
|
>>).
|
||||||
|
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() ->
|
||||||
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
application:load(emqx_gateway_gbt32960),
|
application:load(emqx_gateway_gbt32960),
|
||||||
|
|
Loading…
Reference in New Issue