/**************************************************************************** Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT be copied by any method or incorporated into another program without the express written consent of Aerospace C.Power. This Information or any portion thereof remains the property of Aerospace C.Power. The Information contained herein is believed to be accurate and Aerospace C.Power assumes no responsibility or liability for its use in any way and conveys no license or title under any patent or copyright and makes no representation or warranty that this Information is free from patent or copyright infringement. ****************************************************************************/ #ifndef _APP_MAIN_TASK_H_ #define _APP_MAIN_TASK_H_ #include "app_common.h" #include "app_types.h" #include "app_config.h" #include "proto_645.h" #ifdef __cplusplus extern "C" { #endif #define APP_ENABLE_DUMP_PKT_INFO (1) #define APP_PLC_CMD_PRIO (3) #define APP_TASK_MSG_PRIO (0) #define APP_MSG_HANDLE_TASK_PRIO (7) #define APP_MSG_TASK_PRIO_QUE (1) #define APP_MSG_PENDING_LIMIT (64) #define APP_LINK_ID (2) /* use for iot_print_config */ #define ENABLE_PLC_LIB_LOG (1) /* unit is ms */ #define APP_PKT_INFO_TIMER_PERIOD (60*1000) /* interval to show signal led state, unit is ms */ #define IOT_PLC_SIGNAL_LED_SHOW_INTVAL (2000) /* interval to check if all stas have joined the network, unit is ms */ #define IOT_PLC_NET_DONE_CHECK_INTVAL (500) /* snr good minimum threshold, below this value is weak */ #define IOT_SNR_GOOD_MIN_THR (5) /* snr strong minimum threshold */ #define IOT_SNR_STRONG_MIN_THR (20) /* message type for main task*/ typedef enum { E_MAIN_MSG_START = 0, /* main task message from plc layer. */ E_MAIN_MSG_FROM_PLCMAC, /* main task message from customer task. */ E_MAIN_MSG_FROM_CUSTASK, /* main task message from main task. */ E_MAIN_MSG_FROM_MAINTASK, /* main task message from timer. */ E_MAIN_MSG_FROM_TIMER, E_MAIN_MSG_END } iot_main_task_msg_e; /* message id for main task */ typedef enum { E_MAIN_MSG_ID_START, /* main task receive data from cli app*/ E_MAIN_MSG_ID_CLIAPP_RECV, /* main task receive data from plc layer */ E_MAIN_MSG_ID_PLCMAC_RECV, /* main task receive dlt645 frame form customer task or plc layer */ E_MAIN_MSG_ID_645PKT_RECV, /* main task send dlt645 frame to plc layer */ E_MAIN_MSG_ID_645PKT_TO_PLC, E_MAIN_MSG_ID_END } iot_main_task_msg_id_e; #define APP_MAIN_MSG_VALID(msg) ((msg)>E_MAIN_MSG_START && (msg)