/***************************************************************************** * FUNCTION * SpofSaveData * DESCRIPTION * Save SPOF data to NVRAM * PARAMETERS * None. * RETURNS * None. * GLOBALS AFFECTED * External global *****************************************************************************/ void SpofSaveData(void) { U8 NewHour, NewMin; NewHour = (g_spof_cntx.HourBuf[0]-'0')* 10 + (g_spof_cntx.HourBuf[ENCODING_LENGTH]-'0'); NewMin = (g_spof_cntx.MinBuf[0]-'0')* 10 + (g_spof_cntx.MinBuf[ENCODING_LENGTH]-'0'); if(SpofIsTimeClash(NewHour, NewMin)) { DisplayPopup((PU8) GetString(SPOF_TIME_CONFLICT), IMG_GLOBAL_UNFINISHED, 0, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE); return; } /* if setting changed */ if(g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Hour != NewHour || g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Min != NewMin || g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Type != (U8)g_spof_cntx.CurrHiliteOnOff || g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Status!= g_spof_cntx.CurrHiliteActivation) { /* fill the SPOFList structure depending on the selected values */ g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Status = (U8)g_spof_cntx.CurrHiliteActivation; g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Type = (U8)g_spof_cntx.CurrHiliteOnOff; g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Hour = NewHour; g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Min = NewMin; /*save the alarm in the nvram*/ SpofWritetoNvram(); if(g_spof_cntx.CurrHiliteActivation == SPOF_ENABLE) { if(g_spof_cntx.CurrHiliteOnOff == SPOF_POWERON) { AlmCancelAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPOF_START)); AlmSetAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPON_START)); } else { AlmCancelAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPON_START)); AlmSetAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPOF_START)); } } else { AlmCancelAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPON_START)); AlmCancelAlarm((U8)(g_spof_cntx.CurrItem+ALM_SPOF_START)); } } if(!g_spof_cntx.IsRestoreDefault) { DisplayPopup((PU8)GetString(STR_GLOBAL_DONE) ,IMG_GLOBAL_ACTIVATED, 1,UI_POPUP_NOTIFYDURATION_TIME,SUCCESS_TONE); DeleteUptoScrID(SCR_ID_SPOF_APP); } }
void SetAutoPwrONdata(void) { MYTIME currTime; MYTIME incTime; MYTIME ResultTime; DTGetRTCTime(&currTime); memset(&incTime, 0, sizeof(incTime)); incTime.nMin= 1; incTime.nSec= 20; ResultTime = IncrementTime(currTime,incTime); /* fill the SPOFList structure depending on the selected values */ g_spof_cntx.SPOFList[0].Status = SPOF_ENABLE; g_spof_cntx.SPOFList[0].Type = SPOF_POWERON; g_spof_cntx.SPOFList[0].Hour = ResultTime.nHour; g_spof_cntx.SPOFList[0].Min = ResultTime.nMin; /*save the alarm in the nvram*/ SpofWritetoNvram(); AlmCancelAlarm((U8)(ALM_SPOF_START)); AlmSetAlarm((U8)(ALM_SPON_START)); }
void AlarmSetTrigger (UInt32 alarmTime, UInt32 ref) { UInt16 cardNo; LocalID dbID; DmSearchStateType searchInfo; DmGetNextDatabaseByTypeCreator (true, &searchInfo, sysFileTApplication, sysFileCDatebook, true, &cardNo, &dbID); AlmSetAlarm (cardNo, dbID, ref, alarmTime, true); }