2017-05-31 12:35:32 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/** Copyright. **/
|
2017-06-07 13:50:51 +00:00
|
|
|
/** FileName: HMI_Demo03_Notice2.c **/
|
2017-05-31 12:35:32 +00:00
|
|
|
/** Author: Polarix **/
|
|
|
|
/** Version: 1.0.0.0 **/
|
|
|
|
/** Description: HMI demo for notice box interface. **/
|
|
|
|
/*************************************************************************/
|
|
|
|
//=======================================================================//
|
|
|
|
//= Include files. =//
|
|
|
|
//=======================================================================//
|
2017-10-08 16:03:05 +00:00
|
|
|
#include "DemoProc.h"
|
|
|
|
#include "SGUI_Notice.h"
|
2017-06-07 13:50:51 +00:00
|
|
|
#include "string.h"
|
2017-06-02 12:33:13 +00:00
|
|
|
|
2017-06-07 13:50:51 +00:00
|
|
|
//=======================================================================//
|
|
|
|
//= User Macro definition. =//
|
|
|
|
//=======================================================================//
|
|
|
|
#define NOTICE_TEXT_BUFFER_SIZE (64)
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
//= Static function declaration. =//
|
|
|
|
//=======================================================================//
|
2017-10-08 16:03:05 +00:00
|
|
|
static SGUI_INT HMI_DemoNotice_Initialize(void);
|
|
|
|
static SGUI_INT HMI_DemoNotice_PreProcess(const void* pstParameters);
|
|
|
|
static SGUI_INT HMI_DemoNotice_RefreshScreen(void);
|
|
|
|
static SGUI_INT HMI_DemoNotice_OnInternalEvent(SGUI_INT uiScreenID, const void* pstParameters);
|
|
|
|
static SGUI_INT HMI_DemoNotice_OnExternalEvent(SGUI_INT uiScreenID, const void* pstParameters);
|
|
|
|
static SGUI_INT HMI_DemoNotice_PostProcess(SGUI_INT iActionResult);
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
//= Static variable declaration. =//
|
|
|
|
//=======================================================================//
|
2017-06-07 13:50:51 +00:00
|
|
|
static char szDemoNoticeText[NOTICE_TEXT_BUFFER_SIZE+1] = {0x00};
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
//= Global variable declaration. =//
|
|
|
|
//=======================================================================//
|
2017-06-02 12:33:13 +00:00
|
|
|
HMI_SCREEN_ACTION stHMI_DemoTextNoticeActions = { HMI_DemoNotice_Initialize,
|
|
|
|
HMI_DemoNotice_PreProcess,
|
2017-06-07 13:50:51 +00:00
|
|
|
HMI_DemoNotice_RefreshScreen,
|
2017-06-05 13:01:34 +00:00
|
|
|
HMI_DemoNotice_OnInternalEvent,
|
|
|
|
HMI_DemoNotice_OnExternalEvent,
|
2017-06-02 12:33:13 +00:00
|
|
|
HMI_DemoNotice_PostProcess,
|
|
|
|
};
|
2017-10-08 16:03:05 +00:00
|
|
|
HMI_SCREEN_OBJECT g_stHMI_DemoTextNotice = { HMI_SCREEN_ID_ANY,
|
2017-06-02 12:33:13 +00:00
|
|
|
&stHMI_DemoTextNoticeActions
|
|
|
|
};
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
//= Function implementation. =//
|
|
|
|
//=======================================================================//
|
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_Initialize(void)
|
2017-05-31 12:35:32 +00:00
|
|
|
{
|
2017-08-02 14:24:26 +00:00
|
|
|
SGUI_Notice_RefreshNotice(szDemoNoticeText, 0, SGUI_ICON_INFORMATION);
|
2017-10-08 16:03:05 +00:00
|
|
|
return HMI_RET_NORMAL;
|
2017-05-31 12:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_PreProcess(const void* pstParameters)
|
2017-05-31 12:35:32 +00:00
|
|
|
{
|
|
|
|
/*----------------------------------*/
|
2017-06-07 13:50:51 +00:00
|
|
|
/* Process */
|
2017-05-31 12:35:32 +00:00
|
|
|
/*----------------------------------*/
|
|
|
|
if(NULL == pstParameters)
|
|
|
|
{
|
2017-08-02 14:24:26 +00:00
|
|
|
SGUI_Common_StringCopy(szDemoNoticeText, "无参数。");
|
2017-05-31 12:35:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-02 14:24:26 +00:00
|
|
|
strncpy(szDemoNoticeText, (SGUI_PSZSTR)pstParameters, NOTICE_TEXT_BUFFER_SIZE);
|
2017-06-07 13:50:51 +00:00
|
|
|
szDemoNoticeText[NOTICE_TEXT_BUFFER_SIZE] = '\0';
|
2017-05-31 12:35:32 +00:00
|
|
|
}
|
2017-08-02 14:24:26 +00:00
|
|
|
SGUI_Notice_RefreshNotice(szDemoNoticeText, 0, SGUI_ICON_INFORMATION);
|
2017-10-08 16:03:05 +00:00
|
|
|
return HMI_RET_NORMAL;
|
2017-06-07 13:50:51 +00:00
|
|
|
}
|
2017-05-31 12:35:32 +00:00
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_RefreshScreen(void)
|
2017-06-07 13:50:51 +00:00
|
|
|
{
|
2017-10-08 16:03:05 +00:00
|
|
|
return HMI_RET_NORMAL;
|
2017-05-31 12:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_OnInternalEvent(SGUI_INT uiScreenID, const void* pstParameters)
|
2017-05-31 12:35:32 +00:00
|
|
|
{
|
2017-06-02 12:33:13 +00:00
|
|
|
/*----------------------------------*/
|
|
|
|
/* Variable Declaration */
|
|
|
|
/*----------------------------------*/
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT iProcessResult;
|
2017-06-02 12:33:13 +00:00
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Process */
|
|
|
|
/*----------------------------------*/
|
2017-10-08 16:03:05 +00:00
|
|
|
iProcessResult = HMI_RET_NOACTION;
|
2017-06-02 12:33:13 +00:00
|
|
|
return iProcessResult;
|
2017-05-31 12:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_OnExternalEvent(SGUI_INT uiScreenID, const void* pstParameters)
|
2017-05-31 12:35:32 +00:00
|
|
|
{
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Variable Declaration */
|
|
|
|
/*----------------------------------*/
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT iProcessResult;
|
2017-06-05 13:01:34 +00:00
|
|
|
USER_ACT_KEYPRESS* pstUserEvent;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Initialize */
|
|
|
|
/*----------------------------------*/
|
2017-10-08 16:03:05 +00:00
|
|
|
iProcessResult = HMI_RET_NORMAL;
|
2017-06-05 13:01:34 +00:00
|
|
|
pstUserEvent = (USER_ACT_KEYPRESS*)pstParameters;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Process */
|
|
|
|
/*----------------------------------*/
|
2017-06-07 13:50:51 +00:00
|
|
|
if(KEY_VALUE_ENTER == pstUserEvent->KeyValue[0])
|
2017-06-02 12:33:13 +00:00
|
|
|
{
|
2017-10-08 16:03:05 +00:00
|
|
|
iProcessResult = HMI_RET_CONFIRM;
|
2017-06-02 12:33:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-08 16:03:05 +00:00
|
|
|
iProcessResult = HMI_RET_NOACTION;
|
2017-06-02 12:33:13 +00:00
|
|
|
}
|
2017-05-31 12:35:32 +00:00
|
|
|
return iProcessResult;
|
|
|
|
}
|
|
|
|
|
2017-10-08 16:03:05 +00:00
|
|
|
SGUI_INT HMI_DemoNotice_PostProcess(SGUI_INT iActionResult)
|
2017-05-31 12:35:32 +00:00
|
|
|
{
|
2017-06-05 13:01:34 +00:00
|
|
|
/*----------------------------------*/
|
|
|
|
/* Process */
|
|
|
|
/*----------------------------------*/
|
2017-10-08 16:03:05 +00:00
|
|
|
if(HMI_RET_CONFIRM == iActionResult)
|
2017-06-05 13:01:34 +00:00
|
|
|
{
|
|
|
|
HMI_Action_GoBack();
|
|
|
|
}
|
2017-05-31 12:35:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|