Skip to content

Commit aa32abb

Browse files
HJianBoturtleDeng
authored andcommitted
Compability to emqxv4.0 (#129)
* Compability to emqxv4.0 * Rename proto to channel * Remove test_mqtt_broker module
1 parent 55458b0 commit aa32abb

12 files changed

+401
-812
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ rebar3.crashdump
2121
*.swp
2222
erlang.mk
2323
.rebar3/
24+
etc/emqx_coap.conf.rendered

TODO

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
1. Remove the test/test_mqtt_broker and use emqx-ct-helpers
1+
1. Remove the test/test_mqtt_broker and use emqx-ct-helpers -> Done!
2+
- Enhance all test case
3+
24
2. Remove the mqtt adaptor
35
3. Remove the emqx_coap_ps_topics.erl
46

rebar.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
{profiles,
66
[{test, [{deps,
7-
[ {er_coap_client, {git, "https://github.com/emqx/er_coap_client", {tag, "v1.0"}}}
7+
[
8+
{er_coap_client, {git, "https://github.com/emqx/er_coap_client", {tag, "v1.0"}}},
9+
{emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {branch, "develop"}}}
810
]}]}
911
]}.
1012

rebar.config.script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
%%-*- mode: erlang -*-
2+
13
CONFIG1 = case os:getenv("TRAVIS") of
24
"true" ->
35
JobId = os:getenv("TRAVIS_JOB_ID"),

src/emqx_coap_mqtt_adapter.erl

Lines changed: 168 additions & 159 deletions
Large diffs are not rendered by default.

src/emqx_coap_ps_resource.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
-include_lib("gen_coap/include/coap.hrl").
2121
-include_lib("emqx/include/emqx.hrl").
2222
-include_lib("emqx/include/emqx_mqtt.hrl").
23+
-include_lib("emqx/include/logger.hrl").
24+
25+
-logger_header("[CoAP-PS-RES]").
2326

2427
-export([ coap_discover/2
2528
, coap_get/5
@@ -38,9 +41,6 @@
3841

3942
-define(PS_PREFIX, [<<"ps">>]).
4043

41-
-define(LOG(Level, Format, Args),
42-
logger:Level("CoAP-PS-RES: " ++ Format, Args)).
43-
4444
%%--------------------------------------------------------------------
4545
%% Resource Callbacks
4646
%%--------------------------------------------------------------------
@@ -314,4 +314,4 @@ topic([Path | TopicPath]) ->
314314
<<>> -> Path;
315315
RemTopic ->
316316
<<Path/binary, $/, RemTopic/binary>>
317-
end.
317+
end.

src/emqx_coap_ps_topics.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
-include("emqx_coap.hrl").
2020
-include_lib("emqx/include/emqx.hrl").
2121
-include_lib("emqx/include/emqx_mqtt.hrl").
22+
-include_lib("emqx/include/logger.hrl").
23+
24+
-logger_header("[CoAP-PS-TOPICS]").
2225

2326
-export([ start_link/0
2427
, stop/1
@@ -47,9 +50,6 @@
4750

4851
-record(state, {}).
4952

50-
-define(LOG(Level, Format, Args),
51-
emqx_logger:Level("CoAP-PS-TOPICS: " ++ Format, Args)).
52-
5353
-define(COAP_TOPIC_TABLE, coap_topic).
5454

5555
%%--------------------------------------------------------------------

src/emqx_coap_registry.erl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
-author("Feng Lee <[email protected]>").
1818

1919
-include("emqx_coap.hrl").
20+
-include_lib("emqx/include/logger.hrl").
21+
22+
-logger_header("[CoAP-Registry]").
2023

2124
-behaviour(gen_server).
2225

@@ -43,10 +46,6 @@
4346
-define(RESPONSE_TAB, coap_response_process).
4447
-define(RESPONSE_REF_TAB, coap_response_process_ref).
4548

46-
-define(LOG(Level, Format, Args),
47-
logger:Level("CoAP-REG: " ++ Format, Args)).
48-
49-
5049
%% ------------------------------------------------------------------
5150
%% API Function Definitions
5251
%% ------------------------------------------------------------------

src/emqx_coap_resource.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919
-include("emqx_coap.hrl").
2020
-include_lib("emqx/include/emqx.hrl").
21+
-include_lib("emqx/include/logger.hrl").
2122
-include_lib("emqx/include/emqx_mqtt.hrl").
2223
-include_lib("gen_coap/include/coap.hrl").
2324

25+
-logger_header("[CoAP-RES]").
26+
2427
-export([ coap_discover/2
2528
, coap_get/5
2629
, coap_post/4
@@ -38,9 +41,6 @@
3841

3942
-define(MQTT_PREFIX, [<<"mqtt">>]).
4043

41-
-define(LOG(Level, Format, Args),
42-
logger:Level("CoAP-RES: " ++ Format, Args)).
43-
4444
% resource operations
4545
coap_discover(_Prefix, _Args) ->
4646
[{absolute, [<<"mqtt">>], []}].

0 commit comments

Comments
 (0)