uint32 IMainUI_Release(IMainUI* pUI){ IMAINUI_ClosePosUI(pUI); IMENUCTL_Reset(pUI->pMenu); IMENUCTL_Release(pUI->pMenu); IMENUCTL_Reset(pUI->pSK); IMENUCTL_Release(pUI->pSK); FREEIF(pUI->pvt); FREEIF(pUI); return AEE_SUCCESS; }
/*=========================================================================== FUNCTION ISmsApp_FreeAppData DESCRIPTION Frees any data and interfaces used by this app. PROTOTYPE: static void ISmsApp_FreeAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE None. SIDE EFFECTS None. ===========================================================================*/ static void ISmsApp_FreeAppData(IApplet* pi) { ISmsApp * pMe = (ISmsApp*)pi; CALLBACK_Cancel(&pMe->m_cb); if(pMe->m_pIMenu != NULL) { IMENUCTL_Release(pMe->m_pIMenu); pMe->m_pIMenu = NULL; } if(pMe->m_pISMSMsg != NULL) { ISMSMSG_Release(pMe->m_pISMSMsg); pMe->m_pISMSMsg = NULL; } if(pMe->m_pISMS != NULL) { ISMS_Release(pMe->m_pISMS); pMe->m_pISMS = NULL; } }
/*======================================================================= Function: SamplePosDet_OptimSettings_HandleEvent() Description: Event handler function for the optimization mode settings menu. Prototype: boolean SamplePosDet_OptimSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) Parameters: pMe: [in]. CSamplePosDet instance. eCode: [in]. Event code. wParam: [in]. Event wParam. dwParam: [in]. Event dwParam. Return Value: TRUE - If the event was handled by this menu. FALSE - If the event was not handled. Comments: None Side Effects: None See Also: None =======================================================================*/ boolean SamplePosDet_OptimSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) { boolean bHandled = FALSE; IMenuCtl *pMenuCtl = SamplePosDet_GetScreenData( pMe ); switch( eCode ) { case EVT_SCREEN: if( wParam == SCREEN_PARAM_INIT ) { if( pMenuCtl ) { /* This is not expected to happen */ SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } else { if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_MENUCTL, (void **)&pMenuCtl ) == SUCCESS ) { //IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_NONE, // AEEGPS_OPT_NONE, NULL, (uint32)pMenuCtl ); IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_SPEED, AEEGPS_OPT_SPEED, NULL, (uint32)pMenuCtl ); IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_ACCURACY, AEEGPS_OPT_ACCURACY, NULL, (uint32)pMenuCtl ); //IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_PAYLOAD, // AEEGPS_OPT_PAYLOAD, NULL, (uint32)pMenuCtl ); IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_DEFAULT, AEEGPS_OPT_DEFAULT, NULL, (uint32)pMenuCtl ); IMENUCTL_SetTitle( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_OPT_SETTINGS_TITLE, NULL ); SamplePosDet_SetScreenData( pMe, (void *)pMenuCtl ); SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } } } else if( wParam == SCREEN_PARAM_CLOSE ) { IMENUCTL_Release( pMenuCtl ); SamplePosDet_SetScreenData( pMe, 0 ); pMe->currentHandler = 0; bHandled = TRUE; } else if( wParam == SCREEN_PARAM_PAINT ) { if( IMENUCTL_IsActive( pMenuCtl ) ) { IMENUCTL_Redraw( pMenuCtl ); } else { IMENUCTL_SetActive( pMenuCtl, TRUE ); /* Also causes a menu draw */ } } break; case EVT_KEY: if( wParam == AVK_CLR ) { SamplePosDet_GotoScreen( pMe, SCREENID_CONFIG, 0 ); bHandled = TRUE; break; } case EVT_KEY_PRESS: case EVT_KEY_RELEASE: bHandled = IMENUCTL_HandleEvent( pMenuCtl, eCode, wParam, dwParam ); break; case EVT_COMMAND: if( dwParam == (uint32)pMenuCtl ) { switch( wParam ) { case AEEGPS_OPT_SPEED: case AEEGPS_OPT_ACCURACY: // Set the optimization mode and save the settings pMe->gpsSettings.optim = (AEEGPSOpt)wParam; SamplePosDet_SaveGPSSettings(pMe); SamplePosDet_GotoScreen( pMe, SCREENID_CONFIG, 0 ); bHandled = TRUE; break; default: break; } } break; } return bHandled; }
/*======================================================================= Function: SamplePosDet_QosSettings_HandleEvent() Description: Event handler function for the QoS settings menu. Prototype: boolean SamplePosDet_QosSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) Parameters: pMe: [in]. CSamplePosDet instance. eCode: [in]. Event code. wParam: [in]. Event wParam. dwParam: [in]. Event dwParam. Return Value: TRUE - If the event was handled by this menu. FALSE - If the event was not handled. Comments: None Side Effects: None See Also: None =======================================================================*/ boolean SamplePosDet_QosSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) { boolean bHandled = FALSE; CTextCtlData *ptcd = SamplePosDet_GetScreenData( pMe ); ITextCtl *pTextCtl = NULL; IMenuCtl *pSoftKeyMenu = NULL; char * pszStr; AECHAR * pQos; uint32 nResult; if (ptcd) { pSoftKeyMenu = ptcd->pSoftKey; pTextCtl = ptcd->pTextCtl; } switch( eCode ) { case EVT_SCREEN: if( wParam == SCREEN_PARAM_INIT ) { if( pTextCtl ) { /* This is not expected to happen */ SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } else { if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_TEXTCTL, (void **)&pTextCtl ) == SUCCESS ) { if (ISHELL_CreateInstance(pMe->theApp.m_pIShell, AEECLSID_SOFTKEYCTL, (void **)&pSoftKeyMenu) == SUCCESS) { IMENUCTL_AddItem( pSoftKeyMenu, SAMPLEPOSDET_RES_FILE, IDS_SOFTKEY_SAVE, IDS_SOFTKEY_SAVE, NULL, (uint32)pSoftKeyMenu ); ITEXTCTL_SetSoftKeyMenu( pTextCtl, pSoftKeyMenu ); ITEXTCTL_SetTitle( pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_QOS_SETTINGS_TITLE, NULL ); ITEXTCTL_SetInputMode( pTextCtl, AEE_TM_NUMBERS ); // Load the current QoS value, if it exists pszStr = MALLOC(50); pQos = MALLOC(100); SPRINTF(pszStr, "%d", pMe->gpsSettings.qos); STRTOWSTR(pszStr, pQos, 100); ITEXTCTL_SetText(pTextCtl, pQos, -1); FREE(pszStr); FREE(pQos); ptcd = MALLOC( sizeof(CTextCtlData) ); ptcd->pSoftKey = pSoftKeyMenu; ptcd->pTextCtl = pTextCtl; SamplePosDet_SetScreenData( pMe, (void *)ptcd ); SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } } } } else if( wParam == SCREEN_PARAM_CLOSE ) { ITEXTCTL_Release( pTextCtl ); IMENUCTL_Release( pSoftKeyMenu ); FREE( ptcd ); SamplePosDet_SetScreenData( pMe, 0 ); pMe->currentHandler = 0; bHandled = TRUE; } else if( wParam == SCREEN_PARAM_PAINT ) { if( ITEXTCTL_IsActive( pTextCtl ) ) { ITEXTCTL_Redraw( pTextCtl ); } else { ITEXTCTL_SetActive( pTextCtl, TRUE ); /* Also causes a menu draw */ } } break; case EVT_KEY: case EVT_KEY_PRESS: case EVT_KEY_RELEASE: bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam ); if (!bHandled) { bHandled = IMENUCTL_HandleEvent( pSoftKeyMenu, eCode, wParam, dwParam ); if(!bHandled && wParam == AVK_CLR && eCode == EVT_KEY) { SamplePosDet_GotoScreen( pMe, SCREENID_CONFIG, 0 ); bHandled = TRUE; } } break; case EVT_COMMAND: bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam ); if (!bHandled) { if (IDS_SOFTKEY_SAVE == wParam) { // Need to validate and save the Port settings here pQos = ITEXTCTL_GetTextPtr(pTextCtl); pszStr = MALLOC(50); WSTRTOSTR(pQos, pszStr, 50); nResult = STRTOUL(pszStr, NULL, 10); if (nResult >= 0 && nResult <= 255) { pMe->gpsSettings.qos = (AEEGPSQos)nResult; SamplePosDet_SaveGPSSettings(pMe); SamplePosDet_GotoScreen(pMe, SCREENID_CONFIG, 0); } else { ITEXTCTL_SetTitle(pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_QOS_SETTINGS_INVALID, NULL); ITEXTCTL_Redraw(pTextCtl); } FREE(pszStr); bHandled = TRUE; } } break; } return bHandled; }
/*======================================================================= Function: SamplePosDet_ConfigMenu_HandleEvent() Description: Event handler function for the configuration menu. Prototype: boolean SamplePosDet_ConfigMenu_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) Parameters: pMe: [in]. CSamplePosDet instance. eCode: [in]. Event code. wParam: [in]. Event wParam. dwParam: [in]. Event dwParam. Return Value: TRUE - If the event was handled by this menu. FALSE - If the event was not handled. Comments: None Side Effects: None See Also: None =======================================================================*/ boolean SamplePosDet_ConfigMenu_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) { boolean bHandled = FALSE; IMenuCtl *pMenuCtl = SamplePosDet_GetScreenData( pMe ); switch( eCode ) { case EVT_SCREEN: if( wParam == SCREEN_PARAM_INIT ) { if( pMenuCtl ) { /* This is not expected to happen */ SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } else { if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_MENUCTL, (void **)&pMenuCtl ) == SUCCESS ) { IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_CONFIG_SERVER, IDS_CONFIG_SERVER, NULL, (uint32)pMenuCtl ); IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_CONFIG_QOS, IDS_CONFIG_QOS, NULL, (uint32)pMenuCtl ); IMENUCTL_AddItem( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_CONFIG_OPT, IDS_CONFIG_OPT, NULL, (uint32)pMenuCtl ); IMENUCTL_SetTitle( pMenuCtl, SAMPLEPOSDET_RES_FILE, IDS_CONFIG_TITLE, NULL ); SamplePosDet_SetScreenData( pMe, (void *)pMenuCtl ); SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } } } else if( wParam == SCREEN_PARAM_CLOSE ) { IMENUCTL_Release( pMenuCtl ); SamplePosDet_SetScreenData( pMe, 0 ); pMe->currentHandler = 0; bHandled = TRUE; } else if( wParam == SCREEN_PARAM_PAINT ) { if( IMENUCTL_IsActive( pMenuCtl ) ) { IMENUCTL_Redraw( pMenuCtl ); } else { IMENUCTL_SetActive( pMenuCtl, TRUE ); /* Also causes a menu draw */ } } break; case EVT_KEY: if( wParam == AVK_CLR ) { SamplePosDet_GotoScreen( pMe, SCREENID_MAINMENU, 0 ); bHandled = TRUE; break; } case EVT_KEY_PRESS: case EVT_KEY_RELEASE: bHandled = IMENUCTL_HandleEvent( pMenuCtl, eCode, wParam, dwParam ); break; case EVT_COMMAND: if( dwParam == (uint32)pMenuCtl ) { switch( wParam ) { case IDS_CONFIG_SERVER: SamplePosDet_GotoScreen( pMe, SCREENID_SERVER_SETTINGS, 0 ); bHandled = TRUE; break; case IDS_CONFIG_QOS: SamplePosDet_GotoScreen( pMe, SCREENID_QOS_SETTINGS, 0 ); bHandled = TRUE; break; case IDS_CONFIG_OPT: SamplePosDet_GotoScreen( pMe, SCREENID_OPTIM_SETTINGS, 0 ); default: break; } } break; } return bHandled; }
/*======================================================================= Function: SamplePosDet_PDESettings_HandleEvent() Description: Event handler function for the PDE settings menu. Prototype: boolean SamplePosDet_PDESettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) Parameters: pMe: [in]. CSamplePosDet instance. eCode: [in]. Event code. wParam: [in]. Event wParam. dwParam: [in]. Event dwParam. Return Value: TRUE - If the event was handled by this menu. FALSE - If the event was not handled. Comments: None Side Effects: None See Also: None =======================================================================*/ boolean SamplePosDet_PDESettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) { AECHAR * pServer; uint32 nResult; boolean bHandled = FALSE; CTextCtlData *ptcd = SamplePosDet_GetScreenData( pMe ); ITextCtl *pTextCtl = NULL; IMenuCtl *pSoftKeyMenu = NULL; char * pszStr; if (ptcd) { pSoftKeyMenu = ptcd->pSoftKey; pTextCtl = ptcd->pTextCtl; } switch( eCode ) { case EVT_SCREEN: if( wParam == SCREEN_PARAM_INIT ) { if( pTextCtl ) { /* This is not expected to happen */ SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } else { if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_TEXTCTL, (void **)&pTextCtl ) == SUCCESS ) { if (ISHELL_CreateInstance(pMe->theApp.m_pIShell, AEECLSID_SOFTKEYCTL, (void **)&pSoftKeyMenu) == SUCCESS) { IMENUCTL_AddItem( pSoftKeyMenu, SAMPLEPOSDET_RES_FILE, IDS_SOFTKEY_SAVE, IDS_SOFTKEY_SAVE, NULL, (uint32)pSoftKeyMenu ); ITEXTCTL_SetSoftKeyMenu( pTextCtl, pSoftKeyMenu ); ITEXTCTL_SetTitle( pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_PDE_SETTINGS_TITLE, NULL ); ITEXTCTL_SetInputMode( pTextCtl, AEE_TM_NUMBERS ); // Load the current IP address, if it exists if (AEEGPS_SERVER_IP == pMe->gpsSettings.server.svrType) { pszStr = MALLOC(50); INET_NTOA(pMe->gpsSettings.server.svr.ipsvr.addr, pszStr, 50); pServer = MALLOC(100); STRTOWSTR(pszStr, pServer, 100); ITEXTCTL_SetText(pTextCtl, pServer, -1); FREE(pszStr); FREE(pServer); } ptcd = MALLOC( sizeof(CTextCtlData) ); ptcd->pSoftKey = pSoftKeyMenu; ptcd->pTextCtl = pTextCtl; SamplePosDet_SetScreenData( pMe, (void *)ptcd ); SamplePosDet_DrawScreen( pMe, 0 ); bHandled = TRUE; } } } } else if( wParam == SCREEN_PARAM_CLOSE ) { ITEXTCTL_Release( pTextCtl ); IMENUCTL_Release( pSoftKeyMenu ); FREE( ptcd ); SamplePosDet_SetScreenData( pMe, 0 ); pMe->currentHandler = 0; bHandled = TRUE; } else if( wParam == SCREEN_PARAM_PAINT ) { if( ITEXTCTL_IsActive( pTextCtl ) ) { ITEXTCTL_Redraw( pTextCtl ); } else { ITEXTCTL_SetActive( pTextCtl, TRUE ); /* Also causes a menu draw */ } } break; case EVT_KEY: case EVT_KEY_PRESS: case EVT_KEY_RELEASE: bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam ); if (!bHandled) { bHandled = IMENUCTL_HandleEvent( pSoftKeyMenu, eCode, wParam, dwParam ); if(!bHandled && wParam == AVK_CLR && eCode == EVT_KEY) { SamplePosDet_GotoScreen( pMe, SCREENID_SERVER_SETTINGS, 0 ); bHandled = TRUE; } } break; case EVT_COMMAND: bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam ); if (!bHandled) { if (IDS_SOFTKEY_SAVE == wParam) { // Save the new IP address pServer = ITEXTCTL_GetTextPtr(pTextCtl); pszStr = MALLOC(50); WSTRTOSTR(pServer, pszStr, 50); if (INET_ATON(pszStr, &nResult)) { pMe->gpsSettings.server.svrType = AEEGPS_SERVER_IP; pMe->gpsSettings.server.svr.ipsvr.addr = nResult; SamplePosDet_SaveGPSSettings(pMe); SamplePosDet_GotoScreen(pMe, SCREENID_PORT_SETTINGS, 0); } else { ITEXTCTL_SetTitle(pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_PDE_SETTINGS_INVALID, NULL); ITEXTCTL_Redraw(pTextCtl); } FREE(pszStr); // add code to save the new PDE IP address bHandled = TRUE; } } break; } return bHandled; }