// this function is called when your application is starting up boolean lizard_InitAppData(lizard* pMe) { // Get the device information for this handset. // Reference all the data by looking at the pMe->DeviceInfo structure // Check the API reference guide for all the handy device info you can get pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo); SETAEERECT( &pMe->m_rScreenRect, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen); IGlobalVariable_New(pMe->a.m_pIShell, pMe->a.m_pIDisplay, &(pMe->DeviceInfo), (void **) &(pMe->glbVar)); pMe->glbVar->ClsId = pMe->a.clsID; pMe->glbVar->appState = APP_STATE_INIT; IMainUI_New( pMe->glbVar, 0, (void **)&(pMe->pMainUI)); IPositionThread_New(pMe->glbVar, 0, (void**)&(pMe->pPosThread),&( pMe->pMainUI->pPosUI)); // if there have been no failures up to this point then return success return TRUE; }
/*=========================================================================== ===========================================================================*/ static void xDisplay( AEEApplet *pMe, int nLine, int nCol, AEEFont fnt, uint32 dwFlags, const char *psz) { AEEDeviceInfo di; AEERect rc; int nMaxLines; ISHELL_GetDeviceInfo(pMe->m_pIShell,&di); nMaxLines = (di.cyScreen / LINEHEIGHT) - 2; if (nMaxLines < 1) nMaxLines = 1; rc.x = nCol; rc.dx = di.cxScreen - nCol; rc.y = nLine * LINEHEIGHT; if( dwFlags & IDF_ALIGNVERT_MASK ) { rc.dy = di.cyScreen - rc.y; } else { rc.dy = LINEHEIGHT; } xDrawTextA(pMe->m_pIDisplay, fnt, psz, -1, rc.x, rc.y, &rc, dwFlags); IDISPLAY_Update(pMe->m_pIDisplay); }
/*=========================================================================== FUNCTION: BuildMainMenu DESCRIPTION This function constructs the menu control that allows the user to select a usage example to execute. The command ID for each menu item is passed to the usage example function above when the user selects the menu item for that example. PROTOTYPE: static void BuildMainMenu(ISmsApp * pMe) PARAMETERS: pMe: [in]: Contains a pointer to the usage app data structure. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ static void BuildMainMenu(ISmsApp *pMe) { AEERect qrc; AEEDeviceInfo di; AECHAR * szBuf; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->m_pIMenu == NULL) return; if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) return; // Set Title STR_TO_WSTR("ISMS & ISMSMsg Example", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_SetTitle(pMe->m_pIMenu, NULL, 0, szBuf); //Set the Rectangle for the Menu ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); qrc.x = 0; qrc.y = 0; qrc.dx = di.cxScreen; qrc.dy = di.cyScreen; IMENUCTL_SetRect(pMe->m_pIMenu, &qrc); //Add individual entries to the Menu // Add SMS Sending to menu STR_TO_WSTR("1. SMS Tx ASCII", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_TX_ASCII, szBuf, 0); STR_TO_WSTR("2. SMS Tx UNICODE", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_TX_UNICODE, szBuf, 0); STR_TO_WSTR("3. SMS Tx UTF-8", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_TX_UTF8, szBuf, 0); // Add SMS Receive in TAPI method to menu STR_TO_WSTR("4. Rx SMS in method TAPI ", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_RX_TAPI_METHOD, szBuf, 0); // Add SMS Receive in ISMS method to menu STR_TO_WSTR("5. Rx SMS in method ISMSNotifier", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_RX_ISMS_METHOD, szBuf, 0); // SMS storage status STR_TO_WSTR("6. SMS storage status", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_STORE_STATUS, szBuf, 0); // read SMS from store STR_TO_WSTR("7. SMS store read", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_SMS_STORE_ENUM_READ, szBuf, 0); // Activate menu IMENUCTL_SetActive(pMe->m_pIMenu,TRUE); FREE(szBuf); }
/*=========================================================================== FUNCTION: BuildMainMenu DESCRIPTION This function constructs the menu control that allows the user to select a usage example to execute. The command ID for each menu item is passed to the usage example function above when the user selects the menu item for that example. PROTOTYPE: static void BuildMainMenu(CallDemoApp * pMe) PARAMETERS: pMe: [in]: Contains a pointer to the usage app data structure. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ static void BuildMainMenu(CallDemoApp *pMe) { AEERect qrc; AEEDeviceInfo di; AECHAR * szBuf; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->m_pIMenu == NULL) { return; } if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) { return; } // Set Title STR_TO_WSTR("CALLDEMO & CALLDEMOMsg Example", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_SetTitle(pMe->m_pIMenu, NULL, 0, szBuf); //Set the Rectangle for the Menu ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); qrc.x = 0; qrc.y = 0; qrc.dx = di.cxScreen; qrc.dy = di.cyScreen; IMENUCTL_SetRect(pMe->m_pIMenu, &qrc); //Add individual entries to the Menu // Add originate call to menu STR_TO_WSTR("1. Originate Call", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_ORIG, szBuf, 0); STR_TO_WSTR("2. End OutGoing Call", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_OUTGOING_END, szBuf, 0); STR_TO_WSTR("3. End Incoming Call", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_INCOMING_END, szBuf, 0); STR_TO_WSTR("4. Call and DTMF", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_DTMF, szBuf, 0); STR_TO_WSTR("5. Call Party", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_PARTY3, szBuf, 0); STR_TO_WSTR("6. Call answer", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_ANSWER, szBuf, 0); STR_TO_WSTR("7. Call redirect", szBuf, TEXT_BUFFER_SIZE); IMENUCTL_AddItem(pMe->m_pIMenu, 0, 0, USAGE_CALL_REDIRECT, szBuf, 0); // Activate menu IMENUCTL_SetActive(pMe->m_pIMenu,TRUE); FREE(szBuf); }
boolean ExNet_InitAppData(ExNet* pMe) { pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo); pMe->pIDisplay = pMe->a.m_pIDisplay; pMe->pIShell = pMe->a.m_pIShell; pMe->m_iPort = 10200; return TRUE; }
// this function is called when your application is starting up boolean PocketRocketForBrew_InitAppData(PocketRocketForBrew* pMe) { AECHAR os[] = {'B','r','e','w','\0'}; char resx[5]; char resy[5]; AECHAR wresx[5]; AECHAR wresy[5]; AECHAR url[512]; char curl[512]; AECHAR fchunk[] = {'?','O','S','=','B','r','e','w','&','H','E','I','G','H','T','=','\0'}; AECHAR schunk[] = {'&','W','I','D','T','H','=','\0'}; AECHAR tchunk[] = {'&','I','D','=','1','\0'}; // Get the device information for this handset. // Reference all the data by looking at the pMe->DeviceInfo structure // Check the API reference guide for all the handy device info you can get pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo); // std::string a; STRCPY(url,XID_URL); // str itoa((int)pMe->DeviceInfo.cyScreen,resx,10); itoa((int)pMe->DeviceInfo.cxScreen,resy,10); STRTOWSTR(wresx,resx,strlen(resx)); STRTOWSTR(wresy,resy,strlen(resy)); //strcp STRCAT(url,fchunk); STRCAT(url,wresy); STRCAT(url,schunk); STRCAT(url,wresx); STRCAT(url,tchunk); WSTRTOSTR(curl,url,strlen(curl)); printf(url); //strcat( // Insert your code here for initializing or allocating resources... //XOsApplication *xosApplication = new XOsApplication("Testing"); // if there have been no failures up to this point then return success return TRUE; }
// this function is called when your application is starting up boolean MemChecker_InitAppData(MemChecker* pMe) { // Get the device information for this handset. // Reference all the data by looking at the pMe->DeviceInfo structure // Check the API reference guide for all the handy device info you can get pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo); // if there have been no failures up to this point then return success return TRUE; }
void COMMON_Init(Common* common, IDisplay* display, IShell* shell, int buffer_size) { AEEDeviceInfo devinfo; common->display = display; common->size = buffer_size; common->start_line = 0; common->lines = 0; common->message = (AECHAR*)MALLOC(buffer_size * sizeof(AECHAR)); common->message[0] = 0; common->message[buffer_size - 1] = 0; // 画面サイズを取得 ISHELL_GetDeviceInfo(shell, &devinfo); common->width = devinfo.cxScreen; common->height = devinfo.cyScreen; // フォント情報を取得 common->font_height = IDISPLAY_GetFontMetrics(common->display, AEE_FONT_NORMAL, NULL, NULL); return; }
static boolean radioList_HandleEvent(void *po, AEEEvent evt, uint16 wParam, uint32 dwParam) { CSettings* pMe = (CSettings*) po; AECHAR* a_uname=NULL; char* state=NULL; user *pUser=NULL; AECHAR* sstr=NULL; AECHAR* title=NULL; int nLen=0; int i=0; if(evt == EVT_WDG_GETPROPERTY && wParam == FID_PREFRECT) { //catch FID_PREFRECT and set preferred extent of menu AEERect rc; ISHELL_GetDeviceInfo(pMe->pIShell, &pMe->DeviceInfo); rc.x = -pMe->DeviceInfo.cxScreen*2/10; rc.y = pMe->DeviceInfo.cyScreen*9/20; rc.dx = pMe->DeviceInfo.cxScreen*3; rc.dy = pMe->DeviceInfo.cyScreen/2; *(AEERect*) dwParam = rc; if (GetUserData(pMe->pIShell, &pUser)) { state=pUser->roomingState; } if ( 0==STRCMP("ON", pUser->roomingState)) IVALUEMODEL_SetBool(pMe->valueModel1,TRUE); if ( 0==STRCMP("OFF", pUser->roomingState)) IVALUEMODEL_SetBool(pMe->valueModel2,TRUE); FREEIF(pUser) return TRUE; }
// this function is called when your application is starting up boolean ExRSA_InitAppData(ExRSA* pMe) { // Get the device information for this handset. // Reference all the data by looking at the pMe->DeviceInfo structure // Check the API reference guide for all the handy device info you can get pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo); // The display and shell interfaces are always created by // default, so we'll asign them so that you can access // them via the standard "pMe->" without the "a." pMe->pIDisplay = pMe->a.m_pIDisplay; pMe->pIShell = pMe->a.m_pIShell; // Insert your code here for initializing or allocating resources... //ISHELL_CreateInstance(pMe->pIShell,AEECLSID_RSA,(void**)&pMe->pIRSA); //ISHELL_CreateInstance(pMe->pIShell,AEECLSID_ARC4,(void **)&pMe->pICipher); // if there have been no failures up to this point then return success return TRUE; }
// ================================================================================ // FUNCTION : CSettings_OptionsEventHandler // DESCRIPTION : HANDLE EVENT FROM CSettingsMenu MENU // ================================================================================ static boolean CSettings_OptionsEventHandler(void *po, AEEEvent evt, uint16 wParam, uint32 dwParam) { CSettings* pMe = (CSettings*) po; if(evt == EVT_WDG_GETPROPERTY && wParam == FID_PREFRECT) { //catch FID_PREFRECT and set preferred extent of menu AEERect rc; ISHELL_GetDeviceInfo(pMe->pIShell, &pMe->DeviceInfo); rc.x = 0; rc.y = pMe->DeviceInfo.cyScreen*8/10; rc.dx = pMe->DeviceInfo.cxScreen; rc.dy = pMe->DeviceInfo.cyScreen/8; *(AEERect*) dwParam = rc; return TRUE; } if(evt == EVT_KEY && wParam == AVK_SOFT1) { DBGPRINTF("TESTing"); } if(evt == EVT_KEY && (wParam == AVK_CLR || wParam == AVK_SOFT2)) { IROOTFORM_PopForm(pMe->rootForm); if(pMe->menu) { IPOPUPMENU_Release(pMe->menu); pMe->menu=NULL; return TRUE; } } //the default form handler is swapped with the AppForm handler // calling this allows the default form handler to handle the event return HANDLERDESC_Call(&pMe->menuHandler, evt, wParam, dwParam); }
boolean BrewApp::Init(BrewApp* pApp) { pApp->deviceInfo.wStructSize = sizeof(pApp->deviceInfo); ISHELL_GetDeviceInfo(pApp->m_pIShell,&pApp->deviceInfo); return TRUE; }
/*=========================================================================== FUNCTION ISmsApp_InitAppData DESCRIPTION This function initializes app specific data. PROTOTYPE: static boolean ISmsApp_InitAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE TRUE: If the app has app data is allocated and initialized successfully FALSE: Either app data could not be allocated or initialized SIDE EFFECTS None. ===========================================================================*/ static boolean ISmsApp_InitAppData(IApplet* pi) { ISmsApp * pMe = (ISmsApp*)pi; int charHeight, pnAscent, pnDescent; AEEDeviceInfo di; int nErr; int i; AECHAR szwStr[32]; char szNumber[32]; #define MAX_ENC 32 uint32 *EncodingMoSms; uint32 nSize; IModel * pIModel = NULL; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL) return FALSE; pMe->m_pIMenu = NULL; pMe->m_pISMSMsg = NULL; pMe->m_pISMS = NULL; pMe->m_pISMSStorage = NULL; // Determine the amount of available screen space ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); // Determine the height of a line of text charHeight = IDISPLAY_GetFontMetrics (pMe->a.m_pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); // Number of available lines equals the available screen // space divided by the height of a line, minus 3 for the // lines we always print at the top and bottom of the screen pMe->m_cMaxLine = (di.cyScreen / charHeight) - 3; nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMS, (void **)&pMe->m_pISMS); DBGPRINTF("CreateInstance of AEECLSID_SMS ret %d", nErr); if(nErr != AEE_SUCCESS) { return FALSE; } if ((ISMS_GetEncodingsAvailableForMOSMS(pMe->m_pISMS, NULL, (uint32*)&nSize) == SUCCESS) && ((EncodingMoSms = (uint32*)MALLOC(nSize)) != NULL) && (ISMS_GetEncodingsAvailableForMOSMS(pMe->m_pISMS, EncodingMoSms, (uint32*)&nSize) == SUCCESS)) { nSize = nSize/sizeof(uint32); DBGPRINTF("ISMS_GetEncodingsAvailableForMOSMS"); DBGPRINTF("size Encode ret:%d", nSize); for(i=0; i<nSize; i++) { DBGPRINTF("en[%d]=%x", i, EncodingMoSms[i]); } } if ((nErr = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE, (void**)&pMe->m_pISMSStorage)) != SUCCESS) { DBGPRINTF("CreateInstance SMSSTORAGE ret %d", nErr); return FALSE; } if (pMe->m_pISMSStorage && (SUCCESS == ISMSSTORAGE_QueryInterface(pMe->m_pISMSStorage, AEEIID_MODEL, (void**)&pIModel))) { IMODEL_AddListenerEx(pIModel, &pMe->m_SMSStorageModelListener, (PFNLISTENER)OATSMSStorage_ModelListener, pMe); IMODEL_Release(pIModel); pIModel = NULL; } ISHELL_LoadResString(pMe->a.m_pIShell, ISMS_RES_FILE, IDS_SMS_TAG, szwStr, sizeof(szwStr)); WSTRTOSTR(szwStr, szNumber, sizeof(szNumber)); pMe->m_tag = STRTOUL(szNumber, NULL, 10); ISHELL_LoadResString(pMe->a.m_pIShell, ISMS_RES_FILE, IDS_SMS_MT, szwStr, sizeof(szwStr)); WSTRTOSTR(szwStr, szNumber, sizeof(szNumber)); pMe->m_mt = STRTOUL(szNumber, NULL, 10); return TRUE; }
/*=========================================================================== FUNCTION: DisplayEvent DESCRIPTION This function prints a heading at the top of the screen to indicate which usage example was selected by the user, It also prints a message on the bottom two lines of the screen instructing the user to press the UP or DOWN key to return to the main menu to execute another example. PROTOTYPE: static void DisplayEvent(ISmsApp * pMe, uint16 wParam) PARAMETERS: pMe: [in]: Contains a pointer to the usage app data structure. wParam: [in]: Identifier of the selected example (example IDs are specified when the main usage app menu is created). If the value USAGE_ERASE_SCREEN is supplied instead, this function clears the screen. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ static void DisplayEvent (ISmsApp *pMe, uint16 wParam) { AEERect qrc; AEEDeviceInfo di; // Device Info AECHAR * szBuf; AEERect rc; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->a.m_pIDisplay == NULL) return; if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) return; ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); qrc.x = 0; qrc.y = 0; qrc.dx = di.cxScreen; qrc.dy = di.cyScreen; rc.x = 5; rc.y = 5; rc.dx = di.cxScreen - 5; rc.dy = di.cyScreen - 5; // Specify text for heading based on example the user has selected switch (wParam) { case USAGE_ERASE_SCREEN: IDISPLAY_EraseRect(pMe->a.m_pIDisplay,&qrc); //Clear the display FREE(szBuf); return; case USAGE_SMS_TX_ASCII: STR_TO_WSTR("SMS TX ASCII", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_TX_UNICODE: STR_TO_WSTR("SMS TX UNICODE", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_TX_UTF8: STR_TO_WSTR("SMS TX UTF-8", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_RX_TAPI_METHOD: STR_TO_WSTR("SMS RX in TAPI method", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_RX_ISMS_METHOD: STR_TO_WSTR("SMS RX in ISMS method", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_STORE_STATUS: STR_TO_WSTR("SMS Store Status", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_SMS_STORE_ENUM_READ: STR_TO_WSTR("SMS Store Read", szBuf, TEXT_BUFFER_SIZE); break; default: STR_TO_WSTR("Unsupported fn", szBuf, TEXT_BUFFER_SIZE); } // Print the heading at the top of the screen IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, 5, &rc, IDF_ALIGN_NONE| IDF_TEXT_TRANSPARENT); // Print a message at the bottom of the screen telling the user // how to return to the main app menu STR_TO_WSTR("Press Up/Down", szBuf, TEXT_BUFFER_SIZE); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, qrc.dy - 25, &rc, IDF_ALIGN_NONE | IDF_TEXT_TRANSPARENT); STR_TO_WSTR("keys to continue..", szBuf, TEXT_BUFFER_SIZE); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, qrc.dy - 15, &rc, IDF_ALIGN_NONE | IDF_TEXT_TRANSPARENT); IDISPLAY_UpdateEx(pMe->a.m_pIDisplay,TRUE); FREE(szBuf); }
/*=========================================================================== FUNCTION: DisplayEvent DESCRIPTION This function prints a heading at the top of the screen to indicate which usage example was selected by the user, It also prints a message on the bottom two lines of the screen instructing the user to press the UP or DOWN key to return to the main menu to execute another example. PROTOTYPE: static void DisplayEvent(CallDemoApp * pMe, uint16 wParam) PARAMETERS: pMe: [in]: Contains a pointer to the usage app data structure. wParam: [in]: Identifier of the selected example (example IDs are specified when the main usage app menu is created). If the value USAGE_ERASE_SCREEN is supplied instead, this function clears the screen. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ static void DisplayEvent (CallDemoApp *pMe, uint16 wParam) { AEERect qrc; AEEDeviceInfo di; // Device Info AECHAR * szBuf; AEERect rc; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->a.m_pIDisplay == NULL) { return; } if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) { return; } ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); qrc.x = 0; qrc.y = 0; qrc.dx = di.cxScreen; qrc.dy = di.cyScreen; rc.x = 5; rc.y = 5; rc.dx = di.cxScreen - 5; rc.dy = di.cyScreen - 5; // Specify text for heading based on example the user has selected switch (wParam) { case USAGE_ERASE_SCREEN: IDISPLAY_EraseRect(pMe->a.m_pIDisplay,&qrc); //Clear the display FREE(szBuf); return; case USAGE_CALL_ORIG: STR_TO_WSTR("CALL ORIG", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_OUTGOING_END: STR_TO_WSTR("End OutGoing Call", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_INCOMING_END: STR_TO_WSTR("End Incoming Call", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_DTMF: STR_TO_WSTR("Call and DTMF", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_PARTY3: STR_TO_WSTR("Call Party 3", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_ANSWER: STR_TO_WSTR("Answer incoming call", szBuf, TEXT_BUFFER_SIZE); break; case USAGE_CALL_REDIRECT: STR_TO_WSTR("Redirect incoming call", szBuf, TEXT_BUFFER_SIZE); break; default: STR_TO_WSTR("Unsupported fn", szBuf, TEXT_BUFFER_SIZE); } // Print the heading at the top of the screen IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, 5, &rc, IDF_ALIGN_NONE| IDF_TEXT_TRANSPARENT); // Print a message at the bottom of the screen telling the user // how to return to the main app menu STR_TO_WSTR("Press Up/Down", szBuf, TEXT_BUFFER_SIZE); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, qrc.dy - 25, &rc, IDF_ALIGN_NONE | IDF_TEXT_TRANSPARENT); STR_TO_WSTR("keys to continue..", szBuf, TEXT_BUFFER_SIZE); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, szBuf, -1,10, qrc.dy - 15, &rc, IDF_ALIGN_NONE | IDF_TEXT_TRANSPARENT); IDISPLAY_UpdateEx(pMe->a.m_pIDisplay,TRUE); FREE(szBuf); }
/*=========================================================================== FUNCTION CallDemoApp_InitAppData DESCRIPTION This function initializes app specific data. PROTOTYPE: static boolean CallDemoApp_InitAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE TRUE: If the app has app data is allocated and initialized successfully FALSE: Either app data could not be allocated or initialized SIDE EFFECTS None. ===========================================================================*/ static boolean CallDemoApp_InitAppData(IApplet* pi) { CallDemoApp * pMe = (CallDemoApp*)pi; int charHeight, pnAscent, pnDescent; AEEDeviceInfo di; int nErr; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL) return FALSE; pMe->m_pIMenu = NULL; // Determine the amount of available screen space ZEROAT(&di); di.wStructSize = sizeof(di); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); pMe->m_rc.dx = di.cxScreen; pMe->m_rc.dy = di.cyScreen; // Determine the height of a line of text charHeight = IDISPLAY_GetFontMetrics (pMe->a.m_pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); // Number of available lines equals the available screen // space divided by the height of a line, minus 3 for the // lines we always print at the top and bottom of the screen pMe->m_cMaxLine = (di.cyScreen / charHeight) - 3; pMe->m_pCallMgr = NULL; pMe->m_pOutgoingCall = NULL; pMe->m_pIncomingCall = NULL; nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_CALLMGR, (void**) &pMe->m_pCallMgr); DBGPRINTF("CreateInst AEECLSID_CALLMGR ret %d", nErr); if(nErr != AEE_SUCCESS) { return FALSE; } if(SUCCESS != ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TELEPHONE, (void **) &pMe->m_pTelephone)) { return FALSE; } if(SUCCESS != ITELEPHONE_QueryInterface(pMe->m_pTelephone, AEEIID_MODEL, (void **) &pMe->m_pModel)) { return FALSE; } LISTENER_Init((ModelListener *)&pMe->m_lisPhone, MyPhoneListener, (void *) pMe); IMODEL_AddListener(pMe->m_pModel, (ModelListener *) &pMe->m_lisPhone); #ifdef EVENT_AUTO_GET pMe->m_UserAnswerEvent = ISHELL_RegisterEvent(pMe->a.m_pIShell, "user anwser event", NULL ); pMe->m_UserRedirectEvent = ISHELL_RegisterEvent(pMe->a.m_pIShell, "user redirect event", NULL ); #endif pMe->m_isDTMFItem = FALSE; pMe->m_isParty3Item= FALSE; pMe->m_isRedirectItem = FALSE; return TRUE; }
/*=========================================================================== FUNCTION: DisplayOutput DESCRIPTION This function displays an output string at a given line number on the screen. If the nline parameter is a negative value (-1) the string is displayed in the middle of the screen. If the "nline" value is larger than or equal to zero the "nline" value is multiplied by 15 and the resulting value in pixels is set to the y-coordinate of the start of the string display on the screen. If the string does not fit on one line the string wraps around to the next line (spaced rougly 10-15 pixels apart). By default 5 is used as the starting the x-coordinate of a displayed string. How many characters that fit on one line is calculated for each line that is wrapped around to the next line. Note: depending on the phone screen size and the fonts used for characters the output might differ on different handsets (devices). Where some handsets will have a smaller screen and large default fonts which will cause partial overlapping of lines. This function does not try to address these issues (this is meant as a simple display function). PROTOTYPE: int DisplayOutput(IShell *pIShell, IDisplay *pDisplay, int nline, char *pszStr, AECHAR *pszwStr, boolean isWideChar) PARAMETERS: pIShell: [in]: Contains a pointer to the IShell interface. pIDisplay: [in]: Contains a pointer to the IDisplay interface. nline: [in]: Contains the line number to start displaying the text. The line numbers are by default spaced 15 pixels apart along the y-axis. pszStr: [in]: The character string to be displayed on the screen. DEPENDENCIES None RETURN VALUE Number of lines written to the screen. SIDE EFFECTS None ===========================================================================*/ static int DisplayOutput(IShell *pIShell, IDisplay *pIDisplay, int nline, char *pszStr, AECHAR *pszwStr, boolean isWideChar) { AEEDeviceInfo di; // Device Info AECHAR * szBuf; // a buffer that supports 200 char string AECHAR * psz = NULL; int charHeight = 0; // Stores the char height in pixels for given font int pnAscent = 0; // Stores the ascent in number of pixels int pnDescent = 0; // Stores the descent in number of pixels int pixelWidth; AEEFont font = AEE_FONT_NORMAL; int pnFits = 0, dy; int totalCh = 0; int numLinesPrinted = 0; // Make sure the pointers we'll be using are valid if (pIShell == NULL || pIDisplay == NULL) { return 0; } if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) { return 0; } // Get device information ISHELL_GetDeviceInfo(pIShell,&di); // Get the font metrics info charHeight = IDISPLAY_GetFontMetrics (pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); if(isWideChar) { WSTRCPY(szBuf,pszwStr); } else { // Convert to wide string (unicode) STR_TO_WSTR ((char *)pszStr, szBuf, TEXT_BUFFER_SIZE); } // If nlines is zero then print this string starting around the middle of // the screen. Or else multiply nlines by charheight to decide the y coordinate of // the start of the string. if (nline < 0) { dy = di.cyScreen*2/5; } else{ dy = nline * charHeight + 5; } // psz keeps track of the point from which to write from the string buffer // in case the string does not fit one line and needs to wrap around in the // next line. psz = szBuf; // Need to calculate the lotal string length to decide if any wrapping // around is needed. if(isWideChar) { totalCh = 2*WSTRLEN (pszwStr); } else { totalCh = STRLEN ((char *)pszStr); } // Keep displaying text string on multiple lines if the string can't be displayed // on one single line. Lines are spaced 15 pixels apart. while ((totalCh > 0) && (*psz != NULL)) { // Get information on how many characters will fit in a line. // Give the pointer to the buffer to be displayed, and the number of // pixels along the x axis you want to display the string in (max number) // pnFits will have the max number of chars that will fit in the maxWidth // number of pixels (given string can't fit in one line), or the number of // chars in the string (if it does fit in one line). pnWidth gives the // number of pixels that will be used to display pnFits number of chars. pixelWidth = IDISPLAY_MeasureTextEx(pIDisplay, font, (AECHAR *) psz, // Start of the buffer to display, -1, di.cxScreen - 5, // maxWidth &pnFits); // Number of chars that will fit a line // If pnFits is zero there is something wrong in the input to above function. // Normally this scenario should not occur. But, have the check anyway. if (pnFits == 0) { FREE(szBuf); return 0; } IDISPLAY_DrawText(pIDisplay, AEE_FONT_NORMAL, psz, pnFits, 5 /*start dx*/, dy, 0 /* use default rectangle coordinates */, 0); psz += pnFits; // move pointer to the next segment to be displayed totalCh -= pnFits; // reduce the total number of characters to still display dy += charHeight; // Place next line charHeight pixels below the // previous line. ++numLinesPrinted; IDISPLAY_Update(pIDisplay); //, TRUE); if (totalCh < pnFits) pnFits = totalCh; // if total number is less than pnFits, adjust pnFits } FREE(szBuf); return numLinesPrinted; } // End of DisplayOutput
int CSettings_PopulateMainContainer(CSettings* pMe) { int result = 0; ImageStaticWidget* imageWidget = NULL; IMenuModel * iMenuModal = NULL; IWidget* wItemList; IWidget* containerWidget = NULL; IWidget* pScrollBar = NULL; WExtent we; WidgetProp wp; IFont *piFont = 0; result = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_IMAGESTATICWIDGET, (void**)&imageWidget); result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_MENUMODEL, (void**)&iMenuModal); result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_LISTWIDGET, (void**)&wItemList); result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_SCROLLBARWIDGET, (void**)&pScrollBar); result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FONTSYSBOLD, (void**)&piFont); ISHELL_GetDeviceInfo(pMe->pIShell, &pMe->DeviceInfo); //load the strings pMe->str1 = (AECHAR*) MALLOC(20); pMe->str2 = (AECHAR*) MALLOC(20); result += ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_RANGE, pMe->str1, 20); result += ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_SHEDULER, pMe->str2, 20); //load the images pMe->imageInfo1.pwText = (AECHAR*)pMe->str1; pMe->imageInfo2.pwText = (AECHAR*)pMe->str2; IMENUMODEL_Add(iMenuModal,&pMe->imageInfo1,1,MMF_ENABLED); IMENUMODEL_Add(iMenuModal,&pMe->imageInfo2,2,MMF_ENABLED); //set the vidget to act as a menu modal vidget IWIDGET_SetModel(wItemList, IMENUMODEL_TO_IMODEL(iMenuModal)); //set the picklist widget properties IWIDGET_SetBorderWidth(wItemList, 0); IWIDGET_SetItemHeight(wItemList, 30); IWIDGET_SetItemWidth(wItemList, pMe->DeviceInfo.cxScreen); IWIDGET_SetHintCols(wItemList, 5); IWIDGET_GetPreferredExtent(wItemList, &we); IWIDGET_SetExtent(wItemList, &we); IWIDGET_SetFont((IWidget *)imageWidget, piFont); IWIDGET_SetSelectedShadowOffset((IWidget *)imageWidget,2); IWIDGET_SetShadowColor((IWidget *)imageWidget,MAKE_RGB(122,122,122)); IWIDGET_SetSelectedActiveBGColor((IWidget*)imageWidget, MAKE_RGB(128,128,255)); IWIDGET_SetProperty(pScrollBar, PROP_ACTIVE_SCROLLCOLOR, MAKE_RGB(128,128,255)); IDECORATOR_SetWidget((IDecorator*)pScrollBar, (IWidget *)wItemList); IDECORATOR_SetWidget((IDecorator*)wItemList, (IWidget *)imageWidget); // get the view model of the wItemList and register a listener // in order to to pick up operator selection { IModel* pickListViewModel = NULL; IWIDGET_GetViewModel(wItemList, &pickListViewModel); IMODEL_AddListenerEx(pickListViewModel, &pMe->menuListener, (PFNLISTENER)MenuModal_EventHandler, pMe); IMODEL_Release(pickListViewModel); } wp.bVisible = TRUE; wp.prop = 1; IPROPCONTAINER_Insert(pMe->mainContainer, pScrollBar, WIDGET_ZNORMAL, &wp); //set WID_FORM to the container result = IPROPCONTAINER_QueryInterface(pMe->mainContainer, AEEIID_WIDGET, (void**)&pMe->containerWidget); HANDLERDESC_Init(&pMe->settingsMenuHandler, CSettings_HandleEvent, pMe, CSettings_Delete); IFORM_SetHandler((IForm*)pMe->csettings, &pMe->settingsMenuHandler); if(result ==0) { IFORM_SetWidget((IForm*)pMe->csettings, WID_FORM, pMe->containerWidget); IWIDGET_MoveFocus(pMe->containerWidget, wItemList); } IWIDGET_Release((IWidget*)imageWidget); IMENUMODEL_Release(iMenuModal); IWIDGET_Release(wItemList); IWIDGET_Release(pScrollBar); if (pMe->containerWidget) IWIDGET_Release(pMe->containerWidget); RELEASEIF(piFont); if(result != 0) return EFAILED; return result; }
static boolean CSettings_Dialog_HandleEvent(void *po, AEEEvent evt, uint16 wParam, uint32 dwParam) { CSettings* pMe = (CSettings*) po; user *pUser=NULL; AECHAR *rangetext=NULL; char* charrangetext=NULL; unsigned long time=0; if(evt == EVT_WDG_GETPROPERTY && wParam == FID_PREFRECT) { //catch FID_PREFRECT and set preferred extent of menu AEERect rc; ISHELL_GetDeviceInfo(pMe->pIShell, &pMe->DeviceInfo); if(pMe->isRoomimgDialog==1){ pMe->isRoomimgDialog=0; rc.x = pMe->DeviceInfo.cxScreen/10; rc.y = pMe->DeviceInfo.cyScreen/2; rc.dx = pMe->DeviceInfo.cxScreen*5/6; rc.dy = pMe->DeviceInfo.cyScreen-pMe->DeviceInfo.cyScreen*3/5; *(AEERect*) dwParam = rc; }else{ rc.x = 0; rc.y = pMe->DeviceInfo.cyScreen/4; rc.dx = pMe->DeviceInfo.cxScreen; rc.dy = pMe->DeviceInfo.cyScreen-pMe->DeviceInfo.cyScreen*19/56; *(AEERect*) dwParam = rc; } return TRUE; } if(evt == EVT_KEY && (wParam == AVK_CLR || wParam == AVK_SOFT2)) { IROOTFORM_PopForm(pMe->rootForm); deleteDialog(pMe); deleteShdulerForm(pMe); if(pMe->dialog) { IDIALOG_Release(pMe->dialog); pMe->dialog=NULL; } return TRUE; } if(evt == EVT_KEY && wParam == AVK_SOFT1) { if ( GetUserData(pMe->pIShell, &pUser)) { if(pMe->dialogEvent==1) { STRCPY(pUser->roomingState,"ON"); }if(pMe->dialogEvent==2) { STRCPY(pUser->roomingState,"OFF"); } if(pMe->dialogEvent==3) { IWIDGET_GetTextWidgetText(pMe->rangeCreateTextWidget,&rangetext); charrangetext=MALLOC(30); WSTRTOSTR(rangetext,charrangetext,30); if(IVALUEMODEL_GetBool(pMe->valueModel3)) { STRCPY(pUser->sheduler,"h"); if(STRTOUL(charrangetext, NULL, 10)>1000) time=500*3600000; else time = STRTOUL(charrangetext, NULL, 10)*3600000; } if(IVALUEMODEL_GetBool(pMe->valueModel4)) { STRCPY(pUser->sheduler,"m"); time = STRTOUL(charrangetext, NULL, 10)*60000; } if(IVALUEMODEL_GetBool(pMe->valueModel5)) { STRCPY(pUser->sheduler,"s"); time = STRTOUL(charrangetext, NULL, 10)*1000; } pUser->shedulePeriod=time; } SetUserData(pMe->pIShell, pUser); pMe->dialogEvent=0; FREEIF(charrangetext); FREEIF(pUser); } IROOTFORM_PopForm(pMe->rootForm); deleteDialog(pMe); deleteShdulerForm(pMe); if(pMe->dialog) { IDIALOG_Release(pMe->dialog); pMe->dialog=NULL; } return TRUE; } //the default form handler is swapped with the AppForm handler // calling this allows the default form handler to handle the event return HANDLERDESC_Call(&pMe->dlgHandler, evt, wParam, dwParam); }
/*============================================================================= FUNCTION c_SampleCameraApp_InitAppData DESCRIPTION This function is called when your application is starting up. It will check for device info and then initialize different values accordingly. PROTOTYPE: boolean c_SampleCameraApp_InitAppData(SampleCameraApp* pMe) PARAMETERS: pMe: Pointer to the applet data stucture DEPENDENCIES none RETURN VALUE TRUE: If everything is initialized correctly FALSE: If the function is unable to initialize the application data SIDE EFFECTS none =============================================================================*/ boolean c_samplecamera_InitAppData(c_samplecamera* pMe) { // Get the device information for this handset. // Reference all the data by looking at the pMe->DeviceInfo structure // Check the API reference guide for all the handy device info you can get pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo); ISHELL_GetDeviceInfo(pMe->Applet.m_pIShell,&pMe->DeviceInfo); pMe->pIDisplay = pMe->Applet.m_pIDisplay; pMe->pIShell = pMe->Applet.m_pIShell; pMe->nWidth = pMe->DeviceInfo.cxScreen; // Cache width of device screen pMe->nHeight = pMe->DeviceInfo.cyScreen; // Cache height of device screen // Insert your code here for initializing or allocating resources... if (&pMe->DeviceInfo.cxScreen > &pMe->DeviceInfo.cyScreen) { DBGPRINTF("ERROR: Landscape screen - Not yet supported by Application"); return FALSE; } else { //portrait screen if (pMe->DeviceInfo.cxScreen >= SQCIF_X && pMe->DeviceInfo.cyScreen >= SQCIF_Y) { pMe->ImageSize.cx = SQCIF_X; pMe->ImageSize.cy = SQCIF_Y; } // Organize the screen into several text boxes. These text boxes will // display status as well as which keys control which functions pMe->Status1TextRect.x = 0; pMe->Status1TextRect.y = SQCIF_Y ; pMe->Status1TextRect.dx = pMe->DeviceInfo.cxScreen; pMe->Status1TextRect.dy = TEXT_HEIGHT; pMe->ZoomStatusTextRect.x = 0; pMe->ZoomStatusTextRect.y = SQCIF_Y + TEXT_HEIGHT; pMe->ZoomStatusTextRect.dx = pMe->DeviceInfo.cxScreen; pMe->ZoomStatusTextRect.dy = TEXT_HEIGHT; pMe->Status2TextRect.x = 0; pMe->Status2TextRect.y = SQCIF_Y + TEXT_HEIGHT * 2; pMe->Status2TextRect.dx = pMe->DeviceInfo.cxScreen; pMe->Status2TextRect.dy = TEXT_HEIGHT; pMe->SoftKey1TextRect.x = 0; pMe->SoftKey1TextRect.y = pMe->DeviceInfo.cyScreen - TEXT_HEIGHT; pMe->SoftKey1TextRect.dx = pMe->DeviceInfo.cxScreen*2/3; pMe->SoftKey1TextRect.dy = TEXT_HEIGHT; pMe->SoftKey2TextRect.x = pMe->DeviceInfo.cxScreen/3; pMe->SoftKey2TextRect.y = pMe->DeviceInfo.cyScreen - TEXT_HEIGHT; pMe->SoftKey2TextRect.dx = pMe->DeviceInfo.cxScreen*2/3; pMe->SoftKey2TextRect.dy = TEXT_HEIGHT; pMe->ZoomTextRect.x = pMe->DeviceInfo.cxScreen/4; pMe->ZoomTextRect.y = pMe->DeviceInfo.cyScreen - TEXT_HEIGHT * 2; pMe->ZoomTextRect.dx = pMe->DeviceInfo.cxScreen*3/4; pMe->ZoomTextRect.dy = TEXT_HEIGHT; } pMe->bCommandToExecute = FALSE; pMe->nCommandToExecute = NO_COMMAND; pMe->bAdjustedPreviewRotate = FALSE; // If there have been no failures up to this point then return success return (TRUE); }