Popup_Scheduler.h 13.9 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9



#ifndef _POPUP_SCHEDULER_H_
#define _POPUP_SCHEDULER_H_

#include "TYW_stdint.h"

/******************************************************************************
hu's avatar
hu committed
10
报警状态定义
hu's avatar
hu committed
11 12 13 14 15 16 17 18 19 20
******************************************************************************/
#define   POPUP_STATUS_OFF                      0x00u
#define   POPUP_STATUS_NEW                      0x01u
#define   POPUP_STATUS_FIRST                    0x02u
#define   POPUP_STATUS_LOOP                     0x03u
#define   POPUP_STATUS_MASKED                   0x04u
#define   POPUP_STATUS_DELETE                   0x05u
#define   POPUP_STATUS_CLEAR                    0x06u

/******************************************************************************
hu's avatar
hu committed
21
报警切换等级
hu's avatar
hu committed
22 23 24 25 26 27 28
******************************************************************************/
#define   POPUP_CUT_NOT                         0x00u
#define   POPUP_CUT_IMMEDIATELY                 0x01u
#define   POPUP_CUT_WAIT_TIME_MIN               0x02u
#define   POPUP_CUT_WAIT_TIME_NORMAL            0x03u

/******************************************************************************
hu's avatar
hu committed
29
报警策略配置
hu's avatar
hu committed
30
******************************************************************************/
hu's avatar
hu committed
31 32 33 34 35 36 37
#define   POPUP_DEFINE_FIRST_DISPLAY            0u      /*首次显示,POPUP_CUT_WAIT_TIME_MIN和POPUP_CUT_WAIT_TIME_NORMAL切换需要等待,否则,立即切换*/
#define   POPUP_SAME_CLASS_CUT_IMMEDIATELY      1u      /*同类型的信息可以立即打断,主要是声音*/
#define   POPUP_HIGH_CUT_LOW_TYPE_IMMEDIATELY   1u      /*类型高立即打断类型低:=1使能,=0不使能*/
#define   POPUP_HINT_CUT_HINT_IMMEDIATELY       1u      /*提示类信息立即打断提示类信息:=1使能,=0不使能*/
#define   POPUP_WARNING_CUT_HINT_MIN            0u      /*报警类可以打断提示类,但需要等待最小时间:=1使能,=0不使能*/
#define   POPUP_CUT_RECOVER                     1u      /*被打断的信息,恢复显示时,继续从此开始显示*/
#define   POPUP_DOOR_OPEN_REAL                  1u      /*门开实时响应,打断其他的信息*/
hu's avatar
hu committed
38
#define   POPUP_DISP_TIME_NORMAL                3u*10u  /*unit = 100ms*/
hu's avatar
hu committed
39 40
#define   POPUP_DISP_TIME_MIN                   0u*10u  /*unit = 100ms*/
#define   POPUP_DISP_TIME_NORMAL_FLAG           9       /*unit = 100ms*/
hu's avatar
hu committed
41
/******************************************************************************
hu's avatar
hu committed
42
查询模式定义
hu's avatar
hu committed
43 44 45 46 47
******************************************************************************/
#define   POPUP_POLLING_FORWARD                 0x00u
#define   POPUP_POLLING_REVERSE                 0x01u

/******************************************************************************
hu's avatar
hu committed
48
最大优先级数
hu's avatar
hu committed
49 50 51 52
******************************************************************************/
#define   POPUP_PRIORITY_NUMBER_MAX     POPUP_PRIORITY_NUMBER_FATAL

/******************************************************************************
hu's avatar
hu committed
53
弹出信息调度结构
hu's avatar
hu committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
******************************************************************************/
typedef struct
{
    uint8_t   Timer;
    uint16_t   NewPopupID;
    uint16_t   PollPopupID;
    uint8_t   CutGrade;
    uint16_t   CurPopupID;
    uint8_t   CurStatus;
    uint8_t   SndReqCode;
    uint16_t   CurMaskedID;
    uint8_t   WarningExist;
} PopupSchedulingStruct;

/******************************************************************************
hu's avatar
hu committed
69
函数声明
hu's avatar
hu committed
70 71 72 73
******************************************************************************/

/**********************************************************************************************************
 *@Function:    Popup_Scheduler_Init
hu's avatar
hu committed
74
 *@Description: 初始化弹出信息调度器
hu's avatar
hu committed
75 76 77 78
 *@Input:             MY_MemInit / CommMemInit
 *@Output:          none.
 *@Calls:           none.
 *@Return:          none.
hu's avatar
hu committed
79
 *@Note:            存在内存管理函数,要求必须在硬件初始化之前,进行初始化操作
hu's avatar
hu committed
80 81 82 83 84
 **********************************************************************************************************/
void Popup_Scheduler_Init ( void );

/**********************************************************************************************************
 *@Function:        Popup_Scheduler_OFF
hu's avatar
hu committed
85
 *@Description:     销毁存在的链表,恢复为初始化状态
hu's avatar
hu committed
86 87 88 89 90 91 92 93 94 95
 *@Input:           MY_MemInit / CommMemInit
 *@Output:          none.
 *@Calls:           none.
 *@Return:          none.
 *@Note:            none.
 **********************************************************************************************************/
void Popup_Scheduler_OFF ( void );

/**********************************************************************************************************
 *@Function:        Popup_Scheduling_Service
hu's avatar
hu committed
96 97 98 99 100
 *@Description:   调度弹出信息,更新当前显示的信息名称,接口函数
 *                        可能发生切换的条件:
 *                        1、当前显示信息被删除/屏蔽
 *                        2、产生优先级高的新消息
 *                        3、显示时间到
hu's avatar
hu committed
101 102 103 104
 *@Input:               CommMemInit
 *@Output:            none.
 *@Calls:             none
 *@Return:            none
hu's avatar
hu committed
105
 *@Note:              该服务函数必须每100ms被调用一次
hu's avatar
hu committed
106 107 108 109 110
 **********************************************************************************************************/
void Popup_Scheduling_Service ( void );

/**********************************************************************************************************
 *@Function:        Popup_Request
hu's avatar
hu committed
111 112
 *@Description:   信息插入请求,包括全部类型,接口函数
 *@Input:               uint8_t PopupID -- 弹出信息的ID.
hu's avatar
hu committed
113 114 115 116 117 118 119 120 121
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
void Popup_Request ( uint16_t PopupID );

/**********************************************************************************************************
 *@Function:        Popup_Mask_Request
hu's avatar
hu committed
122 123
 *@Description:   屏蔽第三类(报警类)信息,只有显示过的才可以被屏蔽
 *                ***********屏蔽全部显示过的***************
hu's avatar
hu committed
124 125 126 127 128 129 130 131 132 133
 *@Input:               none.
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
void Popup_Mask_Request ( void );

/**********************************************************************************************************
 *@Function:    Popup_Del_Masked_Request
hu's avatar
hu committed
134
 *@Description: 在IGN_OFF时,需要将屏蔽过的报警信息显示出来,但不允许再次显示报警声音
hu's avatar
hu committed
135 136 137 138
 *@Input:       none.
 *@Output:      none.
 *@Calls:       none.
 *@Return:      none.
hu's avatar
hu committed
139
 *@Note:        目前将报警信息的状态切换为循环显示状态.
hu's avatar
hu committed
140 141 142 143 144
 **********************************************************************************************************/
void Popup_Del_Masked_Request ( void );

/**********************************************************************************************************
 *@Function:        Popup_Get_Status
hu's avatar
hu committed
145 146
 *@Description:   获取查询信息的状态
 *@Input:               uint8_t PopupID -- 弹出信息的ID
hu's avatar
hu committed
147 148
 *@Output:            none.
 *@Calls:             PopupList_Select
hu's avatar
hu committed
149 150 151 152 153 154
 *@Return:            POPUP_STATUS_OFF -- 此信息不在需要显示
 *                POPUP_STATUS_FIRST -- 此信息第一次显示
 *                POPUP_STATUS_LOOP -- 此信息处于轮询显示中
 *                POPUP_STATUS_MASKED -- 此信息被屏蔽
 *                POPUP_STATUS_DELETE -- 此信息等待被删除
 *                POPUP_STATUS_CLEAR -- 此信息马上被删除
hu's avatar
hu committed
155 156 157 158 159 160
 *@Note:              none.
 **********************************************************************************************************/
uint8_t Popup_Get_Status ( uint16_t PopupID );

/**********************************************************************************************************
 *@Function:        Popup_Get_Current_Message
hu's avatar
hu committed
161
 *@Description:   获取当前信息的文字编号
hu's avatar
hu committed
162 163 164 165 166 167 168 169 170 171
 *@Input:               none.
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
uint16_t Popup_Get_Current_Message ( void );

/**********************************************************************************************************
 *@Function:        Popup_Get_Current_Sound
hu's avatar
hu committed
172
 *@Description:   获取当前信息的声音编号
hu's avatar
hu committed
173 174 175 176
 *@Input:               none.
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
hu's avatar
hu committed
177
 *@Note:              声音请求码影响声音的持续性及是否打断
hu's avatar
hu committed
178 179 180 181 182
 **********************************************************************************************************/
uint8_t Popup_Get_Current_Sound ( void );

/**********************************************************************************************************
 *@Function:        Popup_Get_Current_Sound_Req_Code
hu's avatar
hu committed
183
 *@Description:   获取当前信息的声音请求码
hu's avatar
hu committed
184 185 186 187
 *@Input:               none.
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
hu's avatar
hu committed
188
 *@Note:              声音请求码影响声音的持续性及是否打断
hu's avatar
hu committed
189 190 191 192 193
 **********************************************************************************************************/
uint8_t Popup_Get_Current_Sound_Req_Code ( void );

/**********************************************************************************************************
 *@Function:        Popup_Delete
hu's avatar
hu committed
194 195 196
 *@Description:   清除当前显示信息,如果是第一次显示,要等待Tmin(第二类信息(提示类)除外)
 *@Input:               uint8_t PopupID -- 弹出信息的ID
 *@Output:            FatalListHead/HintListHead/WarningListHead/ExceptionListHead -- 新链表
hu's avatar
hu committed
197 198 199 200 201 202 203 204
 *@Calls:             PopupList_Select / PopupList_Delete
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
void Popup_Delete ( uint16_t PopupID );

/**********************************************************************************************************
 *@Function:        Popup_Clear
hu's avatar
hu committed
205 206 207
 *@Description:   清除当前显示信息,不需要等待Tmin
 *@Input:               uint8_t PopupID -- 弹出信息的ID
 *@Output:            FatalListHead/HintListHead/WarningListHead/ExceptionListHead -- 新链表
hu's avatar
hu committed
208 209 210 211 212 213 214 215
 *@Calls:             PopupList_Select / PopupList_Delete
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
void Popup_Clear ( uint16_t PopupID );

/**********************************************************************************************************
 *@Function:        Popup_Get_Warning_Status
hu's avatar
hu committed
216
 *@Description:   查询是否存在报警类信息/或者是获取显示致命信息下,是否存在报警类信息
hu's avatar
hu committed
217 218 219
 *@Input:               none
 *@Output:            none
 *@Calls:             none
hu's avatar
hu committed
220 221
 *@Return:            TRUE --存在报警类信息
 *                FALSE -- 不存在报警类信息
hu's avatar
hu committed
222 223 224 225 226 227
 *@Note:              none.
 **********************************************************************************************************/
uint8_t Popup_Get_Warning_Status ( void );

/**********************************************************************************************************
 *@Function:        Popup_Get_Masked_Warning_Msg
hu's avatar
hu committed
228
 *@Description:   获取当前显示的屏蔽信息的文字/图片编号
hu's avatar
hu committed
229 230 231
 *@Input:               none
 *@Output:            none
 *@Calls:             none
hu's avatar
hu committed
232
 *@Return:            文字/图片编号
hu's avatar
hu committed
233 234 235 236 237 238
 *@Note:              none.
 **********************************************************************************************************/
uint16_t Popup_Get_Masked_Warning_Msg ( void );

/**********************************************************************************************************
 *@Function:        Popup_Masked_Warning_Polling_Reset
hu's avatar
hu committed
239
 *@Description:   复位屏蔽信息当前显示的指针,向前,则指向最后一个;向后,则指向第一个
hu's avatar
hu committed
240 241 242 243 244 245 246 247 248
 *@Input:               none.
 *@Output:            none.
 *@Calls:             none.
 *@Return:            none.
 *@Note:              none.
 **********************************************************************************************************/
void Popup_Masked_Warning_Polling_Reset ( uint8_t Mode );

/**********************************************************************************************************
hu's avatar
hu committed
249 250
函数名:Popup_Masked_Warning_Polling
功  能:查询已屏蔽的报警
hu's avatar
hu committed
251

hu's avatar
hu committed
252 253 254
        每调用一次此函数,已屏蔽报警指针会按指定方向移动一位,当指针已移指定方向
        上的最后一个报警信息时,再次向同一方向查询,当前的已屏蔽报警信息会变为
        POPUP_NONE 表示报警查询已结束
hu's avatar
hu committed
255

hu's avatar
hu committed
256 257 258 259 260
        例如:当前有已屏蔽报警 A、B、C、D,调用Popup_Masked_Warning_Polling_Reset
        函数,设定方向为 POPUP_POLLING_FORWARD 时,已屏蔽报警指针会指向报警A,而后,
        调用该函数设定方向为 POPUP_POLLING_FORWARD 时已屏蔽报警指针即指向报警B.
        重复调用此函数且方向不变至已屏蔽报警指针指向报警D后,再以相同方向调用此函
        数则返回 POPUP_NONE,表示查询已结束
hu's avatar
hu committed
261

hu's avatar
hu committed
262
        通过调用Popup_Get_Masked_Warning可读出当前已屏蔽报警指针指向的报警
hu's avatar
hu committed
263

hu's avatar
hu committed
264 265 266
参  数:Mode:查询模式 POPUP_POLLING_FORWARD - 正向查找模式
                       POPUP_POLLING_REVERSE - 逆向查找模式
返回值:无
hu's avatar
hu committed
267 268 269 270 271 272
 **********************************************************************************************************/
void Popup_Masked_Warning_Polling ( uint8_t Mode );
void Popup_Hint_Mask_Request ( uint16_t PopupID );
uint16_t Popup_Get_First_Masked_Warning ( void );
uint8_t Popup_WarningRequested ( void );
#endif