/* * Copyright (C) 2015-2018 Alibaba Group Holding Limited */ #ifndef _IOTX_DM_INTERNAL_H_ #define _IOTX_DM_INTERNAL_H_ #include #include #include #include "linkkit/infra/infra_compat.h" #include "linkkit/infra/infra_config.h" #include "linkkit/infra/infra_types.h" #include "linkkit/infra/infra_defs.h" #include "linkkit/infra/infra_list.h" #include "linkkit/infra/infra_cjson.h" #include "linkkit/infra/infra_report.h" #include "linkkit/infra/infra_string.h" #if defined(DEVICE_MODEL_GATEWAY) #include "linkkit/infra/infra_sha256.h" #endif #ifndef _IN_ #define _IN_ #endif #ifndef _OU_ #define _OU_ #endif #ifndef DM_READ_ONLY #define DM_READ_ONLY #endif #include #if defined(OTA_ENABLED) && !defined(BUILD_AOS) #include "iotx_ota.h" #include "ota_api.h" #endif /* CM Header File */ #include "iotx_cm.h" /* ALCS Header File */ #ifdef ALCS_ENABLED #include "CoAPExport.h" #include "iotx_alcs.h" #include "dm_server_adapter.h" #include "dm_server.h" #endif /* DM Header File */ #include "linkkit/wrappers/wrappers.h" #include "iotx_dm_config.h" #include "iotx_dm.h" #include "dm_utils.h" #include "dm_shadow.h" #include "dm_tsl_alink.h" #include "dm_message_cache.h" #include "dm_opt.h" #include "dm_ota.h" #include "dm_cota.h" #include "dm_fota.h" #include "dm_ipc.h" #include "dm_message.h" #include "dm_msg_process.h" #include "dm_manager.h" #include "dm_client_adapter.h" #include "dm_client.h" #include "dm_intf.h" #ifdef INFRA_MEM_STATS #include "linkkit/infra/infra_mem_stats.h" #define DM_malloc(size) LITE_malloc(size, MEM_MAGIC, "dm") #define DM_free(ptr) LITE_free(ptr) #else #define DM_malloc(size) HAL_Malloc(size) #define DM_free(ptr) \ { \ HAL_Free((void *)ptr); \ ptr = NULL; \ } #endif #if defined(COAP_COMM_ENABLED) && !defined(MQTT_COMM_ENABLED) #define DM_URI_OFFSET 1 #else #define DM_URI_OFFSET 0 #endif #ifdef INFRA_LOG #include "linkkit/infra/infra_log.h" #define dm_log_emerg(...) log_emerg("DM", __VA_ARGS__) #define dm_log_crit(...) log_crit("DM", __VA_ARGS__) #define dm_log_err(...) log_err("DM", __VA_ARGS__) #define dm_log_warning(...) log_warning("DM", __VA_ARGS__) #define dm_log_info(...) log_info("DM", __VA_ARGS__) #define dm_log_debug(...) log_debug("DM", __VA_ARGS__) #else #define dm_log_emerg(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define dm_log_crit(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define dm_log_err(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define dm_log_warning(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define dm_log_info(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define dm_log_debug(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define HEXDUMP_INFO(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #define HEXDUMP_DEBUG(...) \ do { \ HAL_Printf(__VA_ARGS__); \ HAL_Printf("\r\n"); \ } while (0) #endif #ifdef LOG_REPORT_TO_CLOUD #define LOG_POLL_SIZE (CONFIG_MQTT_TX_MAXLEN - 174) #define REPORT_LEN (LOG_POLL_SIZE - 110) #define OVERFLOW_LEN (LOG_POLL_SIZE - 10) typedef enum { READY, RUNNING, DONE } REPORT_STATE; unsigned int add_tail(); int reset_log_poll(); int remove_log_poll(); unsigned int push_log(const char *perform_data, int perform_data_size); #endif #if !defined(DEVICE_MODEL_RAWDATA_SOLO) void iotx_linkkit_service_list_overtime_handle(void); #endif #endif