commit
50ad22e8ad
|
@ -110,8 +110,8 @@ endif ()
|
|||
|
||||
if (ENABLE_FEATURE_UPLOAD_FILE)
|
||||
message("ENABLE_FEATURE_UPLOAD_FILE = y")
|
||||
AUX_SOURCE_DIRECTORY(src/http FILE_UPLOAD_SRC)
|
||||
set(src_iot_sdk ${src_iot_sdk} ${FILE_UPLOAD_SRC})
|
||||
AUX_SOURCE_DIRECTORY(src/upload_file UPLOAD_FILE_SRC)
|
||||
set(src_iot_sdk ${src_iot_sdk} ${UPLOAD_FILE_SRC})
|
||||
else ()
|
||||
message("ENABLE_FEATURE_UPLOAD_FILE = n")
|
||||
endif ()
|
||||
|
|
2
Makefile
2
Makefile
|
@ -17,7 +17,7 @@ $(call CompLib_Map, OTA_ENABLED, src/ota/src)
|
|||
|
||||
$(call CompLib_Map, DEVICE_MODEL_ENABLED, src/dev_model/src)
|
||||
|
||||
$(call CompLib_Map, FILE_UPLOAD_ENABLED, src/http)
|
||||
$(call CompLib_Map, FILE_UPLOAD_ENABLED, src/upload_file)
|
||||
|
||||
IOTSDK_SRC_FILES := \
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ if (ENABLE_FEATURE_AUTH_MODE_DYNAMIC)
|
|||
endif ()
|
||||
|
||||
if (ENABLE_FEATURE_UPLOAD_FILE)
|
||||
add_executable(http_download http/http_download.c)
|
||||
add_dependencies(http_download iot_sdk iot_platform)
|
||||
add_executable(download_file_sample upload_file/download_file_sample.c)
|
||||
add_dependencies(download_file_sample iot_sdk iot_platform)
|
||||
|
||||
add_executable(http_upload http/http_upload.c)
|
||||
add_dependencies(http_upload iot_sdk iot_platform)
|
||||
add_executable(upload_file_sample upload_file/upload_file_sample.c)
|
||||
add_dependencies(upload_file_sample iot_sdk iot_platform)
|
||||
endif ()
|
|
@ -32,9 +32,6 @@
|
|||
|
||||
static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg)
|
||||
{
|
||||
uintptr_t packet_id = 0;
|
||||
packet_id = (uintptr_t)msg->msg;
|
||||
|
||||
switch(msg->event_type) {
|
||||
case MQTT_EVENT_UNDEF:
|
||||
LOG_INFO("undefined event occur.\n");
|
||||
|
@ -49,27 +46,27 @@ static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg
|
|||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_SUCCESS:
|
||||
LOG_INFO("subscribe success, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe success.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_TIMEOUT:
|
||||
LOG_INFO("subscribe wait ack timeout, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe wait ack timeout.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_NACK:
|
||||
LOG_INFO("subscribe nack, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe nack.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_SUCCESS:
|
||||
LOG_INFO("publish success, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish success.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_TIMEOUT:
|
||||
LOG_INFO("publish timeout, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish timeout.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_NACK:
|
||||
LOG_INFO("publish nack, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish nack.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
|
||||
static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg)
|
||||
{
|
||||
uintptr_t packet_id = 0;
|
||||
packet_id = (uintptr_t)msg->msg;
|
||||
|
||||
switch(msg->event_type) {
|
||||
case MQTT_EVENT_UNDEF:
|
||||
LOG_INFO("undefined event occur.\n");
|
||||
|
@ -50,27 +47,27 @@ static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg
|
|||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_SUCCESS:
|
||||
LOG_INFO("subscribe success, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe success.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_TIMEOUT:
|
||||
LOG_INFO("subscribe wait ack timeout, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe wait ack timeout.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_SUBSCRIBE_NACK:
|
||||
LOG_INFO("subscribe nack, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("subscribe nack.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_SUCCESS:
|
||||
LOG_INFO("publish success, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish success.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_TIMEOUT:
|
||||
LOG_INFO("publish timeout, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish timeout.\n");
|
||||
break;
|
||||
|
||||
case MQTT_EVENT_PUBLISH_NACK:
|
||||
LOG_INFO("publish nack, packet-id=%u.\n", (unsigned int)packet_id);
|
||||
LOG_INFO("publish nack.\n");
|
||||
break;
|
||||
default:
|
||||
LOG_INFO("Should NOT arrive here.\n");
|
||||
|
|
|
@ -65,16 +65,16 @@ dev_model_sample:
|
|||
endif
|
||||
|
||||
ifneq (,$(filter -DFILE_UPLOAD_ENABLED,$(CFLAGS)))
|
||||
http_download:
|
||||
download_file_sample:
|
||||
$(TOP_Q) \
|
||||
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/http/$@.c $(LDFLAGS) -o $@
|
||||
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/upload_file/$@.c $(LDFLAGS) -o $@
|
||||
|
||||
$(TOP_Q) \
|
||||
mv $@ $(FINAL_DIR)/bin
|
||||
|
||||
http_upload:
|
||||
upload_file_sample:
|
||||
$(TOP_Q) \
|
||||
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/http/$@.c $(LDFLAGS) -o $@
|
||||
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/upload_file/$@.c $(LDFLAGS) -o $@
|
||||
|
||||
$(TOP_Q) \
|
||||
mv $@ $(FINAL_DIR)/bin
|
||||
|
|
|
@ -16,6 +16,6 @@ endif
|
|||
$(TOP_Q) \
|
||||
rm -rf ${TEMP_DIR}
|
||||
|
||||
.PHONY: mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample
|
||||
.PHONY: mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample download_file_sample upload_file_sample
|
||||
|
||||
final : mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample
|
||||
final : mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample download_file_sample upload_file_sample
|
Loading…
Reference in New Issue