Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions iot_link/link_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ int link_main(void *args)

#endif

#if CONFIG_AUTOTEST
#include <test_case.h>
autotest_start();
#endif

//////////////////////////// OC LWM2M /////// /////////////////////////////

#if CONFIG_OC_LWM2M_ENABLE
Expand Down Expand Up @@ -247,6 +242,11 @@ int link_main(void *args)
standard_app_demo_main();
#endif

#if CONFIG_AUTO_TEST
#include <test_case.h>
autotest_start();
#endif

return 0;
}

Expand Down
4 changes: 0 additions & 4 deletions iot_link/oc/oc_mqtt/oc_mqtt_al/oc_mqtt_al.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <oc_mqtt_al.h>


#if CONFIG_OC_MQTT_ENABLE

static tag_oc_mqtt_ops *s_oc_mqtt = NULL;

Expand Down Expand Up @@ -306,6 +305,3 @@ int oc_mqtt_init()
return 0;
}


#endif

16 changes: 0 additions & 16 deletions iot_link/oc/oc_mqtt/oc_mqtt_al/oc_mqtt_al.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ typedef struct
fn_oc_mqtt_deconfig deconfig; ///< this function used for the deconfig
}tag_oc_mqtt_ops;

#if CONFIG_OC_MQTT_ENABLE
/**
*@brief the mqtt agent should use this function to register the method for the application
*
Expand Down Expand Up @@ -317,19 +316,4 @@ int oc_mqtt_deconfig(void *handle);
*/
int oc_mqtt_init();


#else //not configure the lwm2m agent

#define oc_mqtt_register(opt) -1

#define oc_mqtt_config(param) NULL
#define oc_mqtt_deconfig(handle) -1
#define oc_mqtt_json_fmt_report(report) NULL
#define oc_mqtt_json_fmt_response(response) NULL

#define oc_mqtt_report(handle,report) -1
#define oc_mqtt_init() -1

#endif

#endif /* __OC_MQTT_AL_H */
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ CONFIG_OC_COAP_TYPE := "soft"
#CONFIG_OC_MQTT_ENABLE, we build a oc mqtt abstraction for huawei OceanConnect service,
#which shield the difference of the implement of oc mqtt.
#CONFIG_OC_MQTT_TYPE could be "soft" "ec20_oc" "none"
CONFIG_OC_MQTT_ENABLE := n
CONFIG_OC_MQTT_ENABLE := y
CONFIG_OC_MQTT_TYPE := "soft"

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

#########################STANDARD DEMO END######################################
include $(TOP_DIR)/iot_link/iot.mk
TEST_CONFIG_OC_LWM2M_ENABLE := n
TEST_CONFIG_LWM2M_AL_ENABLE := n
TEST_CONFIG_OC_MQTT_ENABLE := y
TEST_CONFIG_MQTT_AL_ENABLE := n
include $(TOP_DIR)/test/c_dependcy/test.mk
24 changes: 24 additions & 0 deletions test/c_config/linux_oc_mqtt/oc_mqtt.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
################################################################################
# this is used for compile the OC_MQTT
# please add the corresponding file to C_SOURCES C_INCLUDES C_DEFS
################################################################################
#NEXT TIME WE SHOULD MOVE THE JSON OUT

ifeq ($(CONFIG_OC_MQTT_ENABLE), y)

OC_MQTT_AL_SRC = ${wildcard $(iot_link_root)/oc/oc_mqtt/oc_mqtt_al/*.c}
C_SOURCES += $(OC_MQTT_AL_SRC)

OC_MQTT_AL_INC = -I $(iot_link_root)/oc/oc_mqtt/oc_mqtt_al
C_INCLUDES += $(OC_MQTT_AL_INC)

oc_mqtt_defs = -D CONFIG_OC_MQTT_ENABLE=0
C_DEFS += $(oc_mqtt_defs)

ifeq ($(CONFIG_OC_MQTT_TYPE),"soft")
include $(iot_link_root)/oc/oc_mqtt/atiny_mqtt/atiny_mqtt.mk
else ifeq ($(CONFIG_OC_MQTT_TYPE),"ec20")
include $(iot_link_root)/oc/oc_mqtt/ec20_oc/ec20_oc.mk
endif

endif
14 changes: 13 additions & 1 deletion test/c_dependcy/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@
# this is used for compile the test
################################################################################
test_dependcy = $(SDK_DIR)/test/c_dependcy
test_dependcy_src = $(test_dependcy)/test_main.c

ifeq ($(TEST_CONFIG_OC_MQTT_ENABLE), y)
test_dependcy_src += $(test_dependcy)/test_case_oc_mqtt.c
C_DEFS += -D TEST_CONFIG_OC_MQTT_ENABLE=1
endif

ifeq ($(TEST_CONFIG_MQTT_AL_ENABLE), y)
test_dependcy_src += $(test_dependcy)/test_case_mqtt_al.c
C_DEFS += -D TEST_CONFIG_MQTT_AL_ENABLE=1
endif

test_dependcy_src = ${wildcard $(test_dependcy)/*.c}
C_SOURCES += $(test_dependcy_src)

test_dependcy_inc = -I $(test_dependcy)
C_INCLUDES += $(test_dependcy_inc)

C_DEFS += -D CONFIG_AUTO_TEST=1

17 changes: 12 additions & 5 deletions test/c_dependcy/test_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

/*oc mqtt*/
#define TEST_OC_MQTT_INIT ((TEST_SORT_OC_MQTT_AL << 16) | 0)
#define TEST_OC_MQTT_CONNECT ((TEST_SORT_OC_MQTT_AL << 16) | 1)
#define TEST_OC_MQTT_REPORT ((TEST_SORT_OC_MQTT_AL << 16) | 2)
#define TEST_OC_MQTT_SUBCMD ((TEST_SORT_OC_MQTT_AL << 16) | 3)
#define TEST_OC_MQTT_DISCONNECT ((TEST_SORT_OC_MQTT_AL << 16) | 4)
#define TEST_OC_MQTT_DEINIT ((TEST_SORT_OC_MQTT_AL << 16) | 5)
#define TEST_OC_MQTT_REGISTER ((TEST_SORT_OC_MQTT_AL << 16) | 1)
#define TEST_OC_MQTT_CONFIG ((TEST_SORT_OC_MQTT_AL << 16) | 2)
#define TEST_OC_MQTT_JSON_FMT_REQ ((TEST_SORT_OC_MQTT_AL << 16) | 3)
#define TEST_OC_MQTT_JSON_FMT_RES ((TEST_SORT_OC_MQTT_AL << 16) | 4)
#define TEST_OC_MQTT_REPORT ((TEST_SORT_OC_MQTT_AL << 16) | 5)
#define TEST_OC_MQTT_DECONFIG ((TEST_SORT_OC_MQTT_AL << 16) | 6)
#define TEST_OC_MQTT_DEINIT ((TEST_SORT_OC_MQTT_AL << 16) | 7)

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

void autotest_start(void);



int ts_sort_oc_lwm2m_al(int entry_id, char *message, int len);
int ts_sort_lwm2m_al(int entry_id, char *message, int len);
int ts_sort_oc_mqtt_al(int entry_id, char *message, int len);

int ts_sort_mqtt_al(int entry_id, char *message, int len);


#endif

Loading