2017-06-05 13:01:34 +00:00
|
|
|
|
/*************************************************************************/
|
2017-05-31 12:35:32 +00:00
|
|
|
|
/** Copyright. **/
|
2017-10-11 10:59:56 +00:00
|
|
|
|
/** FileName: RTCNotice.c **/
|
2017-05-31 12:35:32 +00:00
|
|
|
|
/** Author: Polarix **/
|
|
|
|
|
/** Version: 1.0.0.0 **/
|
2017-06-07 13:50:51 +00:00
|
|
|
|
/** Description: HMI demo for notice box interface and refresh screen. **/
|
2017-05-31 12:35:32 +00:00
|
|
|
|
/*************************************************************************/
|
|
|
|
|
//=======================================================================//
|
|
|
|
|
//= Include files. =//
|
|
|
|
|
//=======================================================================//
|
2017-10-08 16:03:05 +00:00
|
|
|
|
#include "DemoProc.h"
|
|
|
|
|
#include "HMI_Engine.h"
|
2017-08-02 14:24:26 +00:00
|
|
|
|
#include "SGUI_Notice.h"
|
|
|
|
|
#include "SGUI_Common.h"
|
2017-10-11 10:59:56 +00:00
|
|
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
|
//= User Macro definition. =//
|
|
|
|
|
//=======================================================================//
|
|
|
|
|
#define NOTICE_RTC_BUFFER_SIZE (64)
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
|
//= Static function declaration. =//
|
|
|
|
|
//=======================================================================//
|
2017-10-11 10:59:56 +00:00
|
|
|
|
static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(void);
|
|
|
|
|
static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(const void* pstParameters);
|
|
|
|
|
static HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(const void* pstParameters);
|
|
|
|
|
static HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent);
|
|
|
|
|
static HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_INT iActionResult);
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
|
//= Static variable declaration. =//
|
|
|
|
|
//=======================================================================//
|
2017-10-11 10:59:56 +00:00
|
|
|
|
static char s_szRTCNoticeText[NOTICE_RTC_BUFFER_SIZE+1] = {0x00};
|
|
|
|
|
HMI_SCREEN_ACTION s_stDemoRTCNoticeActions = { HMI_DemoRTCNotice_Initialize,
|
|
|
|
|
HMI_DemoRTCNotice_Prepare,
|
|
|
|
|
HMI_DemoRTCNotice_RefreshScreen,
|
|
|
|
|
HMI_DemoRTCNotice_ProcessEvent,
|
|
|
|
|
HMI_DemoRTCNotice_PostProcess
|
|
|
|
|
};
|
2017-05-31 12:35:32 +00:00
|
|
|
|
//=======================================================================//
|
|
|
|
|
//= Global variable declaration. =//
|
|
|
|
|
//=======================================================================//
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_SCREEN_OBJECT g_stHMIDemo_RTCNotice = { HMI_SCREEN_ID_DEMO_RTC_NOTICE,
|
|
|
|
|
&s_stDemoRTCNoticeActions
|
2017-06-02 12:33:13 +00:00
|
|
|
|
};
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
|
|
//=======================================================================//
|
2017-12-27 12:03:30 +00:00
|
|
|
|
//= Function define. =//
|
2017-05-31 12:35:32 +00:00
|
|
|
|
//=======================================================================//
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(void)
|
2017-05-31 12:35:32 +00:00
|
|
|
|
{
|
2017-10-11 10:59:56 +00:00
|
|
|
|
SGUI_Common_MemorySet(s_szRTCNoticeText, 0x00, sizeof(SGUI_CHAR)*(NOTICE_RTC_BUFFER_SIZE+1));
|
2017-10-08 16:03:05 +00:00
|
|
|
|
return HMI_RET_NORMAL;
|
2017-06-07 13:50:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(const void* pstParameters)
|
2017-06-07 13:50:51 +00:00
|
|
|
|
{
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_DemoRTCNotice_RefreshScreen(NULL);
|
2017-10-08 16:03:05 +00:00
|
|
|
|
return HMI_RET_NORMAL;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(const void* pstParameters)
|
2017-06-02 12:33:13 +00:00
|
|
|
|
{
|
2017-07-31 13:29:09 +00:00
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
/* Variable Declaration */
|
|
|
|
|
/*----------------------------------*/
|
2017-08-02 14:24:26 +00:00
|
|
|
|
SGUI_TIME stRTCTime;
|
2017-07-31 13:29:09 +00:00
|
|
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
/* Process */
|
|
|
|
|
/*----------------------------------*/
|
2017-08-02 14:24:26 +00:00
|
|
|
|
SGUI_Common_GetNowTime(&stRTCTime);
|
2018-01-15 15:46:46 +00:00
|
|
|
|
sprintf(s_szRTCNoticeText, DEMO_RTC_NOTICE_TEXT_FMT,
|
2017-07-31 13:29:09 +00:00
|
|
|
|
stRTCTime.Year, stRTCTime.Month, stRTCTime.Day,
|
|
|
|
|
stRTCTime.Hour, stRTCTime.Minute, stRTCTime.Second);
|
2018-08-15 14:51:24 +00:00
|
|
|
|
SGUI_Notice_Refresh(s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION);
|
2017-10-08 16:03:05 +00:00
|
|
|
|
return HMI_RET_NORMAL;
|
2017-06-02 12:33:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent)
|
2017-05-31 12:35:32 +00:00
|
|
|
|
{
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
/* Variable Declaration */
|
|
|
|
|
/*----------------------------------*/
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT eProcessResult;
|
|
|
|
|
SGUI_UINT16* parrKeyValue;
|
|
|
|
|
SGUI_TIME* pstRTCTime;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
/* Initialize */
|
|
|
|
|
/*----------------------------------*/
|
2017-10-11 10:59:56 +00:00
|
|
|
|
eProcessResult = HMI_RET_NORMAL;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
/* Process */
|
|
|
|
|
/*----------------------------------*/
|
2017-10-11 10:59:56 +00:00
|
|
|
|
if(NULL != pstEvent)
|
2017-06-02 12:33:13 +00:00
|
|
|
|
{
|
2017-10-11 10:59:56 +00:00
|
|
|
|
if(eEventType == HMI_ENGINE_EVENT_ACTION)
|
|
|
|
|
{
|
|
|
|
|
parrKeyValue = (SGUI_UINT16*)pstEvent->Data;
|
|
|
|
|
if(NULL != parrKeyValue)
|
|
|
|
|
{
|
|
|
|
|
switch(*(parrKeyValue+1))
|
|
|
|
|
{
|
|
|
|
|
case KEY_VALUE_ENTER:
|
|
|
|
|
case KEY_VALUE_ESC:
|
|
|
|
|
{
|
|
|
|
|
eProcessResult = HMI_RET_CANCEL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(eEventType == HMI_ENGINE_EVENT_DATA)
|
|
|
|
|
{
|
|
|
|
|
if(HMI_ENGINE_ACTION_ON_TIMER_RTC == pstEvent->Action)
|
|
|
|
|
{
|
|
|
|
|
pstRTCTime = (SGUI_TIME*)pstEvent->Data;
|
|
|
|
|
if(NULL != pstRTCTime)
|
|
|
|
|
{
|
2018-01-15 15:46:46 +00:00
|
|
|
|
sprintf(s_szRTCNoticeText, DEMO_RTC_NOTICE_TEXT_FMT,
|
2018-01-19 15:05:38 +00:00
|
|
|
|
pstRTCTime->Year, pstRTCTime->Month, pstRTCTime->Day,
|
2017-10-11 10:59:56 +00:00
|
|
|
|
pstRTCTime->Hour, pstRTCTime->Minute, pstRTCTime->Second);
|
2018-08-15 14:51:24 +00:00
|
|
|
|
SGUI_Notice_Refresh(s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION);
|
2017-10-11 10:59:56 +00:00
|
|
|
|
eProcessResult = HMI_RET_NOACTION;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-02 12:33:13 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-10-11 10:59:56 +00:00
|
|
|
|
eProcessResult = HMI_RET_NOACTION;
|
2017-06-02 12:33:13 +00:00
|
|
|
|
}
|
2017-10-11 10:59:56 +00:00
|
|
|
|
|
|
|
|
|
return eProcessResult;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_INT iActionResult)
|
2017-05-31 12:35:32 +00:00
|
|
|
|
{
|
2017-10-08 16:03:05 +00:00
|
|
|
|
if(HMI_RET_CANCEL == iActionResult)
|
2017-06-02 12:33:13 +00:00
|
|
|
|
{
|
2017-10-11 10:59:56 +00:00
|
|
|
|
HMI_GoBack(NULL);
|
2017-06-02 12:33:13 +00:00
|
|
|
|
}
|
2017-10-08 16:03:05 +00:00
|
|
|
|
return HMI_RET_NORMAL;
|
2017-05-31 12:35:32 +00:00
|
|
|
|
}
|
|
|
|
|
|