Files
kunlun/app/smart_grid/inc/internal/iot_sg_msg.h
2024-09-28 14:24:04 +08:00

171 lines
6.9 KiB
C
Executable File

/****************************************************************************
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 IOT_SG_MSG_H
#define IOT_SG_MSG_H
/* os shim includes */
#include "os_types_api.h"
/* common includes */
#include "iot_task_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/* define the sg message queue count and priorities, the higer the priority
* the lower the queue number.
*/
#define IOT_SG_MSG_QUEUE_HP 0
#define IOT_SG_MSG_QUEUE_LP 1
#define IOT_SG_MSG_QUEUE_MAX_PRIO 2
/* message type definition */
#define IOT_SG_MSG_TYPE_UART 1 /* messages from UART */
#define IOT_SG_MSG_TYPE_PLC 2 /* messages from PLC */
#define IOT_SG_MSG_TYPE_CLI 3 /* messages from CLI */
#define IOT_SG_MSG_TYPE_TIMER 4 /* messages from smart grid timer */
#define IOT_SG_MSG_TYPE_INTERNAL 5 /* messages from smart grid internal */
#define IOT_SG_MSG_TYPE_DRV 6 /* messages from device driver */
#define IOT_SG_MSG_TYPE_APP_PROTO 7 /* messages from app, send by CCTT */
#define IOT_SG_MSG_TYPE_APP_CLI 8 /* messages from app, send by CLI */
#define IOT_SG_MSG_TYPE_SWC 9 /* messages from SWC */
#define IOT_SG_MSG_TYPE_COMMAND 10 /* messages type of command. */
#define IOT_SG_MSG_TYPE_BRM 11 /* messages from BRM */
#define IOT_SG_MSG_TYPE_SUNSOLAR 12 /* messages from SUNSOLAR */
/* UART type message id definition */
#define IOT_SG_MSG_ID_UART_DATA 1 /* data delivered from UART */
#define IOT_SG_MSG_ID_UART_TSFM_DATA 2 /* data delivered from TSFM */
#define IOT_SG_MSG_ID_UART_ACM_CMD_DATA 3 /* data delivered from ACM */
/* PLC type message id definition */
#define IOT_SG_MSG_ID_PLC_MSG 1 /* message delivered from PLC */
/* CLI type message id definition */
#define IOT_SG_MSG_ID_CLI_MSG 1 /* message delivered from CLI */
/* TIMER type message id definition */
#define IOT_SG_MSG_ID_TIMER_DETECT 1 /* device detect timeout */
#define IOT_SG_MSG_ID_TIMER_EVENT_RPT 2 /* event report timeout */
#define IOT_SG_MSG_ID_TIMER_UPGRADE 3 /* upgrade window timeout */
#define IOT_SG_MSG_ID_TIMER_CCO_PERIOD 4 /* sec node reg tick timer */
/* driver requested timer 1 timeout for cco device */
#define IOT_SG_MSG_ID_TIMER1_CCO_DRIVER 5
/* driver requested timer 2 timeout for cco device */
#define IOT_SG_MSG_ID_TIMER2_CCO_DRIVER 6
/* driver requested timer 3 timeout for cco device */
#define IOT_SG_MSG_ID_TIMER3_CCO_DRIVER 7
/* driver requested timer timeout for sta device */
#define IOT_SG_MSG_ID_TIMER_STA_DRIVER 8
/* timer timeout for update whitelist to PIB */
#define IOT_SG_MSG_ID_TIMER_WL 9
/* timer for network formation done checking */
#define IOT_SG_MSG_ID_TIMER_CCO_NW_FMT_DONE 10
/* timer for sta device regular refresh timeout */
#define IOT_SG_MSG_ID_TIMER_STA_REFRESH 11
/* internal requested report power off event to cco */
#define IOT_SG_MSG_ID_TIMER_POWER_OFF 12
/* internal requested report power on event to cco */
#define IOT_SG_MSG_ID_TIMER_POWER_ON 13
/* timer timeout for read tsfm info */
#define IOT_SG_MSG_ID_TIMER_READ_TSFM 14
/* router meter reading timeout */
#define IOT_SG_MSG_ID_TIMER_RT_MR_TIMEOUT 15
/* timer timeout for STA collect feature data */
#define IOT_SG_MSG_ID_TIMER_CF_TIMEOUT 16
/* driver requested timer timeout for cco device */
#define IOT_SG_MSG_ID_TIMER4_CCO_DRIVER 17
/* timer timeout for removing delay delete whitelist */
#define IOT_SG_MSG_ID_TIMER_RM_DELAY_DEL_WL 18
/* driver requested timer 5 timeout for cco device */
#define IOT_SG_MSG_ID_TIMER5_CCO_DRIVER 19
/* timer for update data to pib */
#define IOT_SG_MSG_ID_TIMER_CCO_UPDATE_PIB 20
/* timer for low power meter search */
#define IOT_SG_MSG_ID_TIMER_LP_METER_SEARCH 21
/* timer for sm done event check and report */
#define IOT_SG_MSG_ID_TIMER_SM_DONE_CHK 22
/* timer for STA-PIN output */
#define IOT_SG_MSG_ID_TIMER_PIN_STA_OUTPUT 23
/* driver requested timer 6 timeout for cco device */
#define IOT_SG_MSG_ID_TIMER6_CCO_DRIVER 24
/* timer for node join after network formation done */
#define IOT_SG_MSG_ID_TIMER_NODE_JOIN 25
/* timer for gw collect data report */
#define IOT_SG_MSG_ID_TIMER_GW_RPT_DELAY 26
/* timer message for upgrade external device */
#define IOT_SG_MSG_ID_TIMER_EXT_DEV_UPGRADE 27
/* INTERNAL type message id definition */
#define IOT_SG_MSG_ID_INTERN_START 1 /* start message */
/* internal requested power off event init */
#define IOT_SG_MSG_ID_INTERN_POWER_OFF_INIT 2
/* recv hw_tsfm info */
#define IOT_SG_MSG_ID_INTERN_HW_TSFM_INFO 3
/* internal requested start extend function state machine */
#define IOT_SG_MSG_ID_INTERN_EXT_SM 4
/* recv hw_tsfm_topo info */
#define IOT_SG_MSG_ID_INTERN_HW_TOPO_INFO 5
/* internal gw collect data report send done */
#define IOT_SG_MSG_ID_INTERN_RPT_SEND_DONE 6
/* DRIVER type message id definition */
#define IOT_SG_MSG_ID_DRV_METER_R_DONE 1 /* meter read done */
#define IOT_SG_MSG_ID_DRV_DETECT_DONE 2 /* driver detect done */
#define IOT_SG_MSG_ID_DRV_PRIVATE_CALL_REQ 3 /* request private call */
#define IOT_SG_MSG_ID_DRV_CHECK_PM_DONE 4 /* pm check done */
#define IOT_SG_MSG_ID_DRV_START_NODE_REG 5 /* start node reg by drv */
#define IOT_SG_MSG_ID_DRV_START_GET_TIME 6 /* start get time by drv */
/* ID for IOT_SG_MSG_TYPE_COMMAND */
#define IOT_SG_MSG_ID_COMMAND_CUS 1 /* command from cus-app */
#define IOT_SG_MSG_ID_MSDU_CUS 2 /* msdu from cus-app */
/* sg message */
typedef struct _iot_sg_msg {
/* iot task message */
iot_task_msg_t task_msg;
/* pointer to message data */
void *data;
/* another data field */
uint32_t data2;
#if PLC_SUPPORT_CCO_ROLE
/* another data field */
uint32_t data3;
#endif
} iot_sg_msg_t;
/*
* function callback to handle msg executing case
* @msg: pointer to message to be executed
*/
typedef void (*iot_sg_msg_execute_func_t)(iot_sg_msg_t *msg);
/*
* function callback to handle msg canceling case
* @msg: pointer to message to be canceled
*/
typedef void (*iot_sg_msg_cancel_func_t)(iot_sg_msg_t *msg);
#ifdef __cplusplus
}
#endif
#endif /* IOT_SG_MSG_H */