Skip to content

Commit b74d51e

Browse files
authored
Merge pull request #195 from xuliqun25/iot_link
Iot link-del complie macro CONFIG_OC_MQTT_ENABLE
2 parents 8f53c38 + 70453ea commit b74d51e

File tree

12 files changed

+1054
-1132
lines changed

12 files changed

+1054
-1132
lines changed

iot_link/link_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ int link_main(void *args)
202202

203203
#endif
204204

205-
#if CONFIG_AUTOTEST
206-
#include <test_case.h>
207-
autotest_start();
208-
#endif
209-
210205
//////////////////////////// OC LWM2M /////// /////////////////////////////
211206

212207
#if CONFIG_OC_LWM2M_ENABLE
@@ -247,6 +242,11 @@ int link_main(void *args)
247242
standard_app_demo_main();
248243
#endif
249244

245+
#if CONFIG_AUTO_TEST
246+
#include <test_case.h>
247+
autotest_start();
248+
#endif
249+
250250
return 0;
251251
}
252252

iot_link/oc/oc_mqtt/oc_mqtt_al/oc_mqtt_al.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <oc_mqtt_al.h>
3636

3737

38-
#if CONFIG_OC_MQTT_ENABLE
3938

4039
static tag_oc_mqtt_ops *s_oc_mqtt = NULL;
4140

@@ -306,6 +305,3 @@ int oc_mqtt_init()
306305
return 0;
307306
}
308307

309-
310-
#endif
311-

iot_link/oc/oc_mqtt/oc_mqtt_al/oc_mqtt_al.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ typedef struct
139139
fn_oc_mqtt_deconfig deconfig; ///< this function used for the deconfig
140140
}tag_oc_mqtt_ops;
141141

142-
#if CONFIG_OC_MQTT_ENABLE
143142
/**
144143
*@brief the mqtt agent should use this function to register the method for the application
145144
*
@@ -317,19 +316,4 @@ int oc_mqtt_deconfig(void *handle);
317316
*/
318317
int oc_mqtt_init();
319318

320-
321-
#else //not configure the lwm2m agent
322-
323-
#define oc_mqtt_register(opt) -1
324-
325-
#define oc_mqtt_config(param) NULL
326-
#define oc_mqtt_deconfig(handle) -1
327-
#define oc_mqtt_json_fmt_report(report) NULL
328-
#define oc_mqtt_json_fmt_response(response) NULL
329-
330-
#define oc_mqtt_report(handle,report) -1
331-
#define oc_mqtt_init() -1
332-
333-
#endif
334-
335319
#endif /* __OC_MQTT_AL_H */
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ CONFIG_OC_COAP_TYPE := "soft"
126126
#CONFIG_OC_MQTT_ENABLE, we build a oc mqtt abstraction for huawei OceanConnect service,
127127
#which shield the difference of the implement of oc mqtt.
128128
#CONFIG_OC_MQTT_TYPE could be "soft" "ec20_oc" "none"
129-
CONFIG_OC_MQTT_ENABLE := n
129+
CONFIG_OC_MQTT_ENABLE := y
130130
CONFIG_OC_MQTT_TYPE := "soft"
131131

132132
#CONFIG_OC_LWM2M_ENABLE, we build a oc lwm2m abstraction for huawei OceanConnect service,
@@ -166,4 +166,8 @@ CONFIG_DEMO_TYPE := "none"
166166

167167
#########################STANDARD DEMO END######################################
168168
include $(TOP_DIR)/iot_link/iot.mk
169+
TEST_CONFIG_OC_LWM2M_ENABLE := n
170+
TEST_CONFIG_LWM2M_AL_ENABLE := n
171+
TEST_CONFIG_OC_MQTT_ENABLE := y
172+
TEST_CONFIG_MQTT_AL_ENABLE := n
169173
include $(TOP_DIR)/test/c_dependcy/test.mk
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
################################################################################
2+
# this is used for compile the OC_MQTT
3+
# please add the corresponding file to C_SOURCES C_INCLUDES C_DEFS
4+
################################################################################
5+
#NEXT TIME WE SHOULD MOVE THE JSON OUT
6+
7+
ifeq ($(CONFIG_OC_MQTT_ENABLE), y)
8+
9+
OC_MQTT_AL_SRC = ${wildcard $(iot_link_root)/oc/oc_mqtt/oc_mqtt_al/*.c}
10+
C_SOURCES += $(OC_MQTT_AL_SRC)
11+
12+
OC_MQTT_AL_INC = -I $(iot_link_root)/oc/oc_mqtt/oc_mqtt_al
13+
C_INCLUDES += $(OC_MQTT_AL_INC)
14+
15+
oc_mqtt_defs = -D CONFIG_OC_MQTT_ENABLE=0
16+
C_DEFS += $(oc_mqtt_defs)
17+
18+
ifeq ($(CONFIG_OC_MQTT_TYPE),"soft")
19+
include $(iot_link_root)/oc/oc_mqtt/atiny_mqtt/atiny_mqtt.mk
20+
else ifeq ($(CONFIG_OC_MQTT_TYPE),"ec20")
21+
include $(iot_link_root)/oc/oc_mqtt/ec20_oc/ec20_oc.mk
22+
endif
23+
24+
endif

test/c_dependcy/test.mk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
# this is used for compile the test
33
################################################################################
44
test_dependcy = $(SDK_DIR)/test/c_dependcy
5+
test_dependcy_src = $(test_dependcy)/test_main.c
6+
7+
ifeq ($(TEST_CONFIG_OC_MQTT_ENABLE), y)
8+
test_dependcy_src += $(test_dependcy)/test_case_oc_mqtt.c
9+
C_DEFS += -D TEST_CONFIG_OC_MQTT_ENABLE=1
10+
endif
11+
12+
ifeq ($(TEST_CONFIG_MQTT_AL_ENABLE), y)
13+
test_dependcy_src += $(test_dependcy)/test_case_mqtt_al.c
14+
C_DEFS += -D TEST_CONFIG_MQTT_AL_ENABLE=1
15+
endif
516

6-
test_dependcy_src = ${wildcard $(test_dependcy)/*.c}
717
C_SOURCES += $(test_dependcy_src)
818

919
test_dependcy_inc = -I $(test_dependcy)
1020
C_INCLUDES += $(test_dependcy_inc)
1121

22+
C_DEFS += -D CONFIG_AUTO_TEST=1
23+

test/c_dependcy/test_case.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
/*oc mqtt*/
1818
#define TEST_OC_MQTT_INIT ((TEST_SORT_OC_MQTT_AL << 16) | 0)
19-
#define TEST_OC_MQTT_CONNECT ((TEST_SORT_OC_MQTT_AL << 16) | 1)
20-
#define TEST_OC_MQTT_REPORT ((TEST_SORT_OC_MQTT_AL << 16) | 2)
21-
#define TEST_OC_MQTT_SUBCMD ((TEST_SORT_OC_MQTT_AL << 16) | 3)
22-
#define TEST_OC_MQTT_DISCONNECT ((TEST_SORT_OC_MQTT_AL << 16) | 4)
23-
#define TEST_OC_MQTT_DEINIT ((TEST_SORT_OC_MQTT_AL << 16) | 5)
19+
#define TEST_OC_MQTT_REGISTER ((TEST_SORT_OC_MQTT_AL << 16) | 1)
20+
#define TEST_OC_MQTT_CONFIG ((TEST_SORT_OC_MQTT_AL << 16) | 2)
21+
#define TEST_OC_MQTT_JSON_FMT_REQ ((TEST_SORT_OC_MQTT_AL << 16) | 3)
22+
#define TEST_OC_MQTT_JSON_FMT_RES ((TEST_SORT_OC_MQTT_AL << 16) | 4)
23+
#define TEST_OC_MQTT_REPORT ((TEST_SORT_OC_MQTT_AL << 16) | 5)
24+
#define TEST_OC_MQTT_DECONFIG ((TEST_SORT_OC_MQTT_AL << 16) | 6)
25+
#define TEST_OC_MQTT_DEINIT ((TEST_SORT_OC_MQTT_AL << 16) | 7)
2426

2527
/*mqtt al*/
2628
#define TEST_MQTT_AL_INIT ((TEST_SORT_MQTT_AL << 16) | 0)
@@ -42,10 +44,15 @@ typedef int (*test_sort)(int entry_id, char *message, int len);
4244
typedef int (*test_entry)(char *message, int len);
4345

4446
void autotest_start(void);
47+
48+
49+
4550
int ts_sort_oc_lwm2m_al(int entry_id, char *message, int len);
4651
int ts_sort_lwm2m_al(int entry_id, char *message, int len);
4752
int ts_sort_oc_mqtt_al(int entry_id, char *message, int len);
53+
4854
int ts_sort_mqtt_al(int entry_id, char *message, int len);
4955

56+
5057
#endif
5158

0 commit comments

Comments
 (0)