Пример #1
0
void TS_SetSoftButtonText(CTopSoupApp * pme,uint16 wTextLeftID, uint16 wTextRightID,uint16 wTextMidID)
{
	MEMSET(pme->m_pLeftSoftText,0,sizeof(pme->m_pLeftSoftText));
	MEMSET(pme->m_pRightSoftText,0,sizeof(pme->m_pRightSoftText));
	MEMSET(pme->m_pMidSoftText,0,sizeof(pme->m_pMidSoftText));
	if(wTextLeftID)
		ISHELL_LoadResString(pme->a.m_pIShell,NAVIGATE_RES_FILE,wTextLeftID,pme->m_pLeftSoftText,sizeof(pme->m_pLeftSoftText));
	if(wTextRightID)
		ISHELL_LoadResString(pme->a.m_pIShell,NAVIGATE_RES_FILE,wTextRightID,pme->m_pRightSoftText,sizeof(pme->m_pRightSoftText));
	if(wTextMidID)
		ISHELL_LoadResString(pme->a.m_pIShell,NAVIGATE_RES_FILE,wTextMidID,pme->m_pMidSoftText,sizeof(pme->m_pMidSoftText));
}
Пример #2
0
/*
*	函数名称: 
		 PicBrowser::Init()
*  功能介绍:
		该函数为PicBrowser类的初始化函数,载入必要的资源。
*  输入参数:   
		N/A
*  输出参数:  
		N/A
*  返回值:   
		返回是否初始化成功
*	可能出现的意外:
		N/A
*/ 
boolean PicBrowser::Init()
{
	AEEImageInfo mi;
	int nByteLoad=0;
	m_pwszTitle=(AECHAR *)MALLOC(MAX_STRING_LEN+1);  //申请字符串资源空间
	if(m_pwszTitle!=NULL)
	{
		nByteLoad=ISHELL_LoadResString(m_pIShell,FK_RES_FILE,IDS_TITLE,m_pwszTitle,MAX_STRING_LEN); //载入字符串
	}

	m_pImage=ISHELL_LoadResImage(m_pIShell,FK_RES_FILE,IDB_PIC); //载入图片
	
	if(m_pImage==NULL || nByteLoad==0)
	{
		m_bInitSuccess=FALSE;  //资源装载失败
	}
	else
	{
		m_nRed=255;  //颜色值的R值初始化为255

		//取图片信息
		IIMAGE_GetInfo(m_pImage,&mi);
		m_nWidth=(int)mi.cx;
		m_nHeight=(int)mi.cy;

		//设置剪切矩形和图片初始位置
		SETAEERECT(&m_rctImage,0,pApp->nNoarmalFontH,pApp->lcdW,pApp->lcdH-pApp->nNoarmalFontH);
		m_nImageDrawX=m_rctImage.x+(m_rctImage.dx-m_nWidth)/2;
		m_nImageDrawY=m_rctImage.y+(m_rctImage.dy-m_nHeight)/2;
		
		m_bInitSuccess=TRUE;//装载成功
	}

	return m_bInitSuccess;
}
Пример #3
0
void BrewApp::DrawScreen() {

    AECHAR szBuf[64] = {0};
    int nStrLen = 0;
    RGBVAL oldTextColor;

    IDISPLAY_ClearScreen(this->m_pIDisplay); // Erase whole screen.

    // Load the string resource into a buffer:
    nStrLen = ISHELL_LoadResString(this->m_pIShell, 
                                   BREWAPP_RES_FILE,
                                   IDS_STRING_1001, szBuf, sizeof(szBuf));

    // If the text was successfully loaded from resource file into buffer:
    if (0 <  nStrLen) {
        // Set user-text color to black:
        oldTextColor = IDisplay_SetColor(this->m_pIDisplay, 
                                         CLR_USER_TEXT, 
                                         RGB_BLACK);

        IDisplay_DrawText(this->m_pIDisplay, // Display instance.
                        AEE_FONT_BOLD, // Use Bold font.
                        szBuf,         // String buffer containing text.
                        -1,     // Automatically compute string length.
                        0,      // x-coordinate ignored since IDF_ALIGN_CENTER.
                        0,      // y-coordinate ignored since IDF_ALIGN_MIDDLE.
                        NULL,   // No clipping.
                        IDF_ALIGN_CENTER | // Center-align horizontally.
                        IDF_ALIGN_MIDDLE); // Middle-align vertically.
    }

    // Restore previous color:
    IDisplay_SetColor(this->m_pIDisplay, CLR_USER_TEXT, oldTextColor);
    IDisplay_Update (this->m_pIDisplay);
}
Пример #4
0
// ================================================================================
// FUNCTION		: CSettings_OptionSelectionHandler
// DESCRIPTION	: HANDLE OPTION SFROM CSettingsMenu MENU
// ================================================================================
static void CSettings_OptionSelectionHandler(CSettings* pMe, int idOption) 
{
       
   	AECHAR* sstr=NULL;
	AECHAR* title=NULL;
    
	IROOTFORM_PopForm(pMe->rootForm);
	if(pMe->menu)
	{
		IPOPUPMENU_Release(pMe->menu);
		pMe->menu=NULL;
	}
	
	switch(pMe->selectedItem)//pMe->selectedItem
	{
	case 0:
			sstr = (AECHAR*)MALLOC(10);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_NON,sstr , 10);
			title=(AECHAR*)MALLOC(20);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_ROOMING,title , 20);
			pMe->isRoomimgDialog=1;
			CSettings_Dialog(pMe,sstr,title);
			FREEIF(sstr);
			FREEIF(title);
			CSettingsRadioList(pMe); 
			break;
	
	case 1:
			sstr = (AECHAR*)MALLOC(10);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_NON,sstr , 10);
			title=(AECHAR*)MALLOC(20);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_SHEDULER,title , 20);
			CSettings_Dialog(pMe,sstr,title);
			FREEIF(sstr);
			FREEIF(title);
			CSettingsRadioListForSheduler(pMe);			
			break;
	case 2:
		
		break;
	
	}
	

}
Пример #5
0
// ================================================================================
// FUNCTION		: MenuModal_EventHandler
// DESCRIPTION	: LISTEN FOR CHANGES ON MAIN FORM
// ================================================================================
static void MenuModal_EventHandler(CSettings *pMe, ModelEvent *pev) 
{
	
	if(pev->evCode == EVT_MDL_FOCUS_SELECT)
	{ 
		if(pev->dwParam == 0)
		{
			pMe->text = (AECHAR*)MALLOC(10);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_NON,pMe->text , 10);
			pMe->title=(AECHAR*)MALLOC(30);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_ROOMING,pMe->title , 30);
			pMe->isRoomimgDialog=1;
			CSettings_Dialog(pMe,pMe->text,pMe->title);
			FREEIF(pMe->text);
			FREEIF(pMe->title);
			CSettingsRadioList(pMe); 
			
		}
		if(pev->dwParam == 1)
		{
	
			pMe->text = (AECHAR*)MALLOC(10);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_NON,pMe->text , 10);
			pMe->title=(AECHAR*)MALLOC(30);
			ISHELL_LoadResString(pMe->pIShell, RIPPLEVAULT_RES_FILE, IDS_SHEDULER,pMe->title , 20);
			CSettings_Dialog(pMe,pMe->text,pMe->title);
			FREEIF(pMe->text);
			FREEIF(pMe->title);
			CSettingsRadioListForSheduler(pMe);
		
		}
	}
	if (pev->evCode == EVT_MDL_FOCUS_CHANGE)
		pMe->selectedItem = (int)pev->dwParam;

}
Пример #6
0
/*=============================================================================
FUNCTION: CDialerApp_SetupRecallDlg_Init

DESCRIPTION: Initializes the controls for Calling dialog

PARAMETERS:
*pMe: CDialerApp object pointer

RETURN VALUE:
boolean: Returns TRUE if successful

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
boolean CDialerApp_SetupRecallDlg_Init(CDialerApp *pMe)
{
#if defined(FEATURE_WCDMA) || defined(FEATURE_GSM)
    IDialog *pActiveDlg;
    IStatic *pIStatic;
    IMenuCtl *pISoftKeyMenu;
    AEERect StaticRect;
    AEERect MenuRect;
    AECHAR *pszRecall = NULL;

    PRINT_FUNCTION_NAME();
    // error checking
    if(pMe == NULL)
    {
        return FALSE;
    }

    pActiveDlg = CDialerApp_GetActiveDlg(pMe);

    // error checking
    if (pActiveDlg == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    // Get controls in dialog
    pIStatic = (IStatic*) IDIALOG_GetControl(pActiveDlg, IDC_STATIC_SETUP_RECALL);
    pISoftKeyMenu = (IMenuCtl*)IDIALOG_GetControl(pActiveDlg,
                    IDC_SK_SETUP_RECALL);
    if((pIStatic == NULL) || (pISoftKeyMenu == NULL))
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE; // error
    }

    // init buffer
    pszRecall = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if(pszRecall == NULL)
    {
        DIALER_ERR("No memory", 0,0,0);
        return FALSE;
    }

    // Update the softkey menu
    (void) IMENUCTL_DeleteAll(pISoftKeyMenu);
    (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_OK,
                            IDL_SK_SETUP_RECALL, NULL, 0);
    (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_CANCEL,
                            IDL_SK_SETUP_RECALL_CANCEL, NULL, 0);
    SetDefaultSoftkeyLook(pMe->a.m_pIShell, pISoftKeyMenu);

    // Set Static control size
    ISTATIC_GetRect(pIStatic, &StaticRect);
    IMENUCTL_GetRect(pISoftKeyMenu, &MenuRect);
    SETAEERECT(&StaticRect, 10, 10, pMe->m_rc.dx-20, pMe->m_rc.dy-MenuRect.dy-20);

    // Static Info Properties
    ISTATIC_SetRect(pIStatic, &StaticRect);
    ISTATIC_SetActive(pIStatic, FALSE);
    ISTATIC_SetProperties(pIStatic, ST_MIDDLETEXT | ST_CENTERTEXT | ST_NOSCROLL);

    (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE,
                                IDS_SETUP_RECALL, pszRecall,
                                ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
    (void) ISTATIC_SetText(pIStatic, pszRecall, NULL, AEE_FONT_BOLD,
                           AEE_FONT_NORMAL);

    (void) IDIALOG_SetFocus(pActiveDlg, IDC_SK_SETUP_RECALL);

    FREEIF(pszRecall);

    return TRUE;
#else
    return FALSE;
#endif // defined(FEATURE_WCDMA) || defined(FEATURE_GSM)
}
Пример #7
0
/*=============================================================================
FUNCTION: CDialerApp_CallingDlg_DisplayRefresh

DESCRIPTION: Refreshes the calling dialog display

PARAMETERS:
  *pMe: CDialerApp object pointer

RETURN VALUE:
  boolean: Returns TRUE if successful

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
boolean CDialerApp_CallingDlg_DisplayRefresh(void *pUser)
{
    CDialerApp *pMe = (CDialerApp*) pUser;
    IDialog *pActiveDlg;
    IStatic *pIStatic;
    AECHAR szCUGFormat[] = {'%','s',':',' ','%','u','\0'};
    AECHAR *pszCUGBuf = NULL;
    AECHAR *pszName = NULL;

    PRINT_FUNCTION_NAME();
    // error checking
    if(pMe == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    pActiveDlg = CDialerApp_GetActiveDlg(pMe);

    // error checking
    if (pActiveDlg == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    if(CDialerApp_GetActiveDlgID(pMe) != IDD_CALLING)
    {
        DIALER_ERR("Calling Dialog is not active", 0,0,0);
        return FALSE;
    }

    // Get controls in dialog
    pIStatic = (IStatic*) IDIALOG_GetControl(pActiveDlg,
               IDC_STATIC_CALLING);
    if(pIStatic == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE; // error
    }

    // init buffer
    pszName = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    pszCUGBuf = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if((pszName== NULL) || (pszCUGBuf == NULL))
    {
        DIALER_ERR("No memory", 0,0,0);
        FREEIF(pszName);
        FREEIF(pszCUGBuf);
        return FALSE;
    }

    // display all of the needed info to the screen
    if(CheckAEEReturnStatus(ICM_GetCallInfo(pMe->m_pICM, pMe->m_byCurrOrigCall, &(pMe->m_CallInfo), sizeof(AEECMCallInfo))) == FALSE)
    {
        DIALER_ERR("ICM_GetCallInfo FAILED", 0, 0, 0);
        FREEIF(pszName);
        FREEIF(pszCUGBuf);
        return TRUE;
    }

    // display the other party number and name if any in contacts
    CDialerApp_FormatNumberDisplayString(pMe, &(pMe->m_CallInfo), pszName, DIALERAPP_MAX_STR_SIZE, pMe->m_bNVAutoHyphen);
    (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszName, NULL, FALSE);
    if(WSTRLEN(pMe->m_CallInfo.other_party_no) != 0)
    {
        if(pMe->m_bNVAutoHyphen == TRUE)
        {
            AECHAR *pszHyphen = CDialerApp_HyphenateNumberString(pMe->m_CallInfo.other_party_no);
            if(WSTRCMP(pszHyphen, pszName) != 0)
            {
                // want the phone number if it is not null and already being displayed
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszHyphen, NULL, TRUE);
            }
            FREEIF(pszHyphen);
        }
        else
        {
            if(WSTRCMP(pMe->m_CallInfo.other_party_no, pszName) != 0)
            {
                // want the phone number if it is not null and already being displayed
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) pMe->m_CallInfo.other_party_no, NULL, TRUE);
            }
        }
    }

    // check for CUG info
    if(pMe->m_CallInfo.forward_cug_info.cm_cug_index.present == TRUE)
    {
        // display CUG info
        (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_USERGROUP,
                                    pszName, ((DIALERAPP_MAX_STR_SIZE) * sizeof(AECHAR)));
        WSPRINTF(pszCUGBuf, (DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR), szCUGFormat, pszName,
                 ((uint16)((pMe->m_CallInfo.forward_cug_info.cm_cug_index.msb << 8)|(pMe->m_CallInfo.forward_cug_info.cm_cug_index.lsb))));
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszCUGBuf, NULL, TRUE);
    }

    // check for alpha
    if(WSTRLEN(pMe->m_CallInfo.alpha) > 0)
    {
        // display alpha
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
        (void) ISTATIC_SetTextEx(pIStatic, (byte*) pMe->m_CallInfo.alpha, NULL, TRUE);
    }

    if(pMe->m_CallInfo.call_type == AEECM_CALL_TYPE_EMERGENCY)
    {
        AEECMSSInfo SSInfo;

        // reset the timer
        (void) ISHELL_SetTimer(pMe->a.m_pIShell, 1000,
                               (PFNNOTIFY) CDialerApp_CallingDlg_DisplayRefresh, (void*) pMe);

        if(CheckAEEReturnStatus(ICM_GetSSInfo(pMe->m_pICM, &SSInfo, sizeof(AEECMSSInfo))) == TRUE)
        {
            if(SSInfo.srv_status == AEECM_SRV_STATUS_NO_SRV)
            {
                // we want to display looking for service
                (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_LOOKINGFOREMERGENCY, pszName, (DIALERAPP_MAX_STR_SIZE * sizeof(AECHAR)));
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszName, NULL, TRUE);
            }
        }
    }

    IDIALOG_Redraw(pActiveDlg);

    // free memory
    FREE(pszName);
    FREE(pszCUGBuf);

    return TRUE;
}
Пример #8
0
/*=============================================================================
FUNCTION: CDialerApp_RecallDlg_Init

DESCRIPTION: Initializes the controls for Calling dialog

PARAMETERS:
  *pMe: CDialerApp object pointer

RETURN VALUE:
  boolean: Returns TRUE if successful

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
boolean CDialerApp_RecallDlg_Init(CDialerApp *pMe)
{
#if defined(FEATURE_WCDMA) || defined(FEATURE_GSM)
    IDialog *pActiveDlg;
    IStatic *pIStatic;
    IMenuCtl *pISoftKeyMenu;
    AEERect StaticRect;
    AEERect MenuRect;
    AECHAR *pszRecall = NULL;
    AECHAR *pszName = NULL;
    CRecallDlgInfo *pDlgInfo = NULL;

    PRINT_FUNCTION_NAME();
    // error checking
    if(pMe == NULL)
    {
        return FALSE;
    }

    pActiveDlg = CDialerApp_GetActiveDlg(pMe);

    // error checking
    if (pActiveDlg == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    pDlgInfo = (CRecallDlgInfo*) CDialerApp_GetActiveDlgInfo(pMe);

    // Get controls in dialog
    pIStatic = (IStatic*) IDIALOG_GetControl(pActiveDlg, IDC_STATIC_RECALL);
    pISoftKeyMenu = (IMenuCtl*)IDIALOG_GetControl(pActiveDlg, IDC_SK_RECALL);
    if((pIStatic == NULL) || (pISoftKeyMenu == NULL))
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE; // error
    }

    // init buffer
    pszRecall = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if(pszRecall == NULL)
    {
        DIALER_ERR("No memory", 0,0,0);
        return FALSE;
    }

    pszName = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if(pszName == NULL)
    {
        DIALER_ERR("No memory", 0,0,0);
        FREEIF(pszRecall);
        return FALSE;
    }

    // Update the softkey menu
    (void) IMENUCTL_DeleteAll(pISoftKeyMenu);

    if(AEECM_IS_VOICECALL_CONNECTED(pMe->m_pICM))
    {
        (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE,
                                IDS_HOLD_N_ACCEPT, IDL_RECALL_SK_HOLD_N_ACCEPT,
                                NULL, 0);
        (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_REL_N_ACCEPT,
                                IDL_RECALL_SK_REL_N_ACCEPT, NULL, 0);
    }
    else
    {
        (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_CALL,
                                IDL_RECALL_SK_CALL, NULL, 0);
    }

    (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_CANCEL,
                            IDL_RECALL_SK_CANCEL, NULL, 0);
    SetDefaultSoftkeyLook(pMe->a.m_pIShell, pISoftKeyMenu);

    // Set Static control size
    ISTATIC_GetRect(pIStatic, &StaticRect);
    IMENUCTL_GetRect(pISoftKeyMenu, &MenuRect);
    SETAEERECT(&StaticRect, 10, 10, pMe->m_rc.dx-20, pMe->m_rc.dy-MenuRect.dy-20);

    // Static Info Properties
    ISTATIC_SetRect(pIStatic, &StaticRect);
    ISTATIC_SetActive(pIStatic, FALSE);
    ISTATIC_SetProperties(pIStatic, ST_MIDDLETEXT | ST_CENTERTEXT | ST_NOSCROLL);

    // Display name or number
    if(CheckAEEReturnStatus(ICM_GetCallInfo(pMe->m_pICM,pDlgInfo->callID,
                                            &(pMe->m_CallInfo), sizeof(AEECMCallInfo))) == TRUE)
    {
        CDialerApp_FormatNumberDisplayString(pMe, &(pMe->m_CallInfo), pszName,
                                             DIALERAPP_MAX_STR_SIZE,
                                             pMe->m_bNVAutoHyphen);
        (void) ISTATIC_SetText(pIStatic, pszName, NULL, AEE_FONT_BOLD,
                               AEE_FONT_NORMAL);

        if(WSTRLEN(pMe->m_CallInfo.other_party_no) != 0)
        {
            if(pMe->m_bNVAutoHyphen == TRUE)
            {
                AECHAR *pszHyphen = CDialerApp_HyphenateNumberString(
                                        pMe->m_CallInfo.other_party_no);
                if(WSTRCMP(pszHyphen, pszName) != 0)
                {
                    // want the phone number if it is not null and already being displayed
                    (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                    (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszHyphen, NULL, TRUE);
                }
                FREEIF(pszHyphen);
            }
            else
            {
                if(WSTRCMP(pMe->m_CallInfo.other_party_no, pszName) != 0)
                {
                    // want the phone number if it is not null and already being displayed
                    (void) ISTATIC_SetTextEx(pIStatic, (byte*) "\n", NULL, TRUE);
                    (void) ISTATIC_SetTextEx(pIStatic,
                                             (byte*) pMe->m_CallInfo.other_party_no,
                                             NULL, TRUE);
                }
            }
        }
    }

    (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE,
                                IDS_AVAILABLE, pszRecall,
                                ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
    (void) ISTATIC_SetTextEx(pIStatic, (byte*) pszRecall, NULL, TRUE);

    (void) IDIALOG_SetFocus(pActiveDlg, IDC_SK_RECALL);

    FREEIF(pszRecall);
    FREEIF(pszName);

    return TRUE;
#else
    return FALSE;
#endif // defined(FEATURE_WCDMA) || defined(FEATURE_GSM)
}
Пример #9
0
/*=============================================================================
FUNCTION: CDialerApp_SSRequestDlg_Init

DESCRIPTION: Initializes the controls for SS Request dialog

PARAMETERS:
  *pMe: CDialerApp object pointer

RETURN VALUE:
  boolean: Returns TRUE if successful

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
boolean CDialerApp_SSRequestDlg_Init(CDialerApp *pMe)
{
#if defined(FEATURE_WCDMA) || defined(FEATURE_GSM)
    IDialog *pActiveDlg;
    IStatic *pIStatic;
    IMenuCtl *pISoftKeyMenu;
    AEERect StaticRect;
    AEERect MenuRect;
    AECHAR *pszStrBeg = NULL;
    AECHAR *pszStrEnd = NULL;
    AECHAR *pszBuf = NULL;
    AECHAR szFormat[] = {'%','s',' ','%','s','\0'};
    CSSRequestDlgInfo *pDlgInfo = NULL;
    uint16 wIDSOp;


    PRINT_FUNCTION_NAME();
    // error checking
    if(pMe == NULL)
    {
        return FALSE;
    }

    pActiveDlg = CDialerApp_GetActiveDlg(pMe);

    // error checking
    if (pActiveDlg == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    pDlgInfo = (CSSRequestDlgInfo*) CDialerApp_GetActiveDlgInfo(pMe);
    if(pDlgInfo == NULL)
    {
        DIALER_ERR("NULL Pointer", 0,0,0);
        return FALSE;
    }


    // Get controls in dialog
    pIStatic = (IStatic*) IDIALOG_GetControl(pActiveDlg,
               IDC_STATIC_SSREQUEST);
    pISoftKeyMenu = (IMenuCtl*)IDIALOG_GetControl(pActiveDlg,
                    IDC_SK_SSREQUEST);
    if((pIStatic == NULL) || (pISoftKeyMenu == NULL))
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE; // error
    }

    // init buffer
    pszBuf = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE+DIALERAPP_MAX_NOTIF_BUFFER_SIZE)*sizeof(AECHAR));
    pszStrBeg = (AECHAR*) MALLOC ((DIALERAPP_MAX_NOTIF_BUFFER_SIZE)*sizeof(AECHAR));
    pszStrEnd = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if((pszBuf == NULL) || (pszStrBeg == NULL) || (pszStrEnd == NULL))
    {
        DIALER_ERR("No memory", 0,0,0);
        FREEIF(pszBuf);
        FREEIF(pszStrBeg);
        FREEIF(pszStrEnd);
        return FALSE;
    }

    switch(pDlgInfo->ssCode)
    {
    case AEESUPPSVC_CLIP:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CLIP;
        break;

    case AEESUPPSVC_CLIR:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CLIR;
        break;

    case AEESUPPSVC_COLP:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_COLP;
        break;

    case AEESUPPSVC_COLR:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_COLR;
        break;

    case AEESUPPSVC_ALL_FORWARDING_SS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_ALL_FORWARDING_SS;
        break;

    case AEESUPPSVC_CFU:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CFU;
        break;

    case AEESUPPSVC_ALL_CONDFWD_SS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_ALL_CONDFWD_SS;
        break;

    case AEESUPPSVC_CFB:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CFB;
        break;

    case AEESUPPSVC_CFNRY:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CFNRY;
        break;

    case AEESUPPSVC_CFNRC:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CFNRC;
        break;

    case AEESUPPSVC_CW:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CW;
        break;

    case AEESUPPSVC_ALL_CALL_RSTRCT_SS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_ALL_CALL_RSTRCT_SS;
        break;

    case AEESUPPSVC_BARRING_OUTGOING_CALLS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BARRING_OUTGOING_CALLS;
        break;

    case AEESUPPSVC_BAOC:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BAOC;
        break;

    case AEESUPPSVC_BOIC:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BOIC;
        break;

    case AEESUPPSVC_BOIC_EXHC:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BOIC_EXHC;
        break;

    case AEESUPPSVC_BARRING_OF_INCOMING_CALLS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BARRING_OF_INCOMING_CALLS;
        break;

    case AEESUPPSVC_BAIC:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BAIC;
        break;

    case AEESUPPSVC_BICROAM:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_BICROAM;
        break;

    case AEESUPPSVC_CCBS:
        wIDSOp = IDS_SUPPSYS_SS_CODE_E_TYPE_CCBS;
        break;

    default:
        wIDSOp = IDS_SS;
        break;
    }

    (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, wIDSOp, pszStrBeg,
                                ((DIALERAPP_MAX_NOTIF_BUFFER_SIZE)*sizeof(AECHAR)));
    (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_REQUESTING, pszStrEnd,
                                ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
    WSPRINTF(pszBuf, (sizeof(AECHAR)*(DIALERAPP_MAX_NOTIF_BUFFER_SIZE+DIALERAPP_MAX_STR_SIZE)), szFormat, pszStrBeg, pszStrEnd);

    // Update the softkey menu
    (void) IMENUCTL_DeleteAll(pISoftKeyMenu);
    (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_CANCELSSREQUEST,
                            IDL_SK_SSREQUEST_CANCEL, NULL, 0);
    SetDefaultSoftkeyLook(pMe->a.m_pIShell, pISoftKeyMenu);


    // Set Static control size
    ISTATIC_GetRect(pIStatic, &StaticRect);
    IMENUCTL_GetRect(pISoftKeyMenu, &MenuRect);
    SETAEERECT(&StaticRect, 10, 10, pMe->m_rc.dx-20, pMe->m_rc.dy-MenuRect.dy-20);

    // Static Info Properties
    ISTATIC_SetRect(pIStatic, &StaticRect);
    ISTATIC_SetActive(pIStatic, FALSE);
    ISTATIC_SetProperties(pIStatic, ST_MIDDLETEXT | ST_CENTERTEXT | ST_NOSCROLL);

    // check if alpha should be displayed
    if(WSTRLEN(pDlgInfo->szAlpha) > 0)
    {
        (void) ISTATIC_SetText(pIStatic, NULL, pDlgInfo->szAlpha, AEE_FONT_BOLD,
                               AEE_FONT_BOLD);
    }
    else
    {
        (void) ISTATIC_SetText(pIStatic, NULL, pszBuf, AEE_FONT_BOLD,
                               AEE_FONT_BOLD);
    }

    (void) IDIALOG_SetFocus(pActiveDlg, IDC_SK_SSREQUEST);

    FREE(pszBuf);
    FREE(pszStrBeg);
    FREE(pszStrEnd);

    return TRUE;
#else
    return FALSE;
#endif /* defined(FEATURE_WCDMA) || defined(FEATURE_GSM) */
}
Пример #10
0
/*=============================================================================
FUNCTION: CDialerApp_CallingDlg_Init

DESCRIPTION: Initializes the controls for Calling dialog

PARAMETERS:
  *pMe: CDialerApp object pointer

RETURN VALUE:
  boolean: Returns TRUE if successful

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
boolean CDialerApp_CallingDlg_Init(CDialerApp *pMe)
{
    IDialog *pActiveDlg;
    IStatic *pIStatic;
    IMenuCtl *pISoftKeyMenu;
    AEERect StaticRect;
    AEERect MenuRect;
    AECHAR *pszTitle = NULL;

    PRINT_FUNCTION_NAME();
    // error checking
    if(pMe == NULL)
    {
        return FALSE;
    }

    pActiveDlg = CDialerApp_GetActiveDlg(pMe);

    // error checking
    if (pActiveDlg == NULL)
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE;
    }

    // Get controls in dialog
    pIStatic = (IStatic*) IDIALOG_GetControl(pActiveDlg,
               IDC_STATIC_CALLING);
    pISoftKeyMenu = (IMenuCtl*)IDIALOG_GetControl(pActiveDlg,
                    IDC_SK_CALLING);
    if((pIStatic == NULL) || (pISoftKeyMenu == NULL))
    {
        DIALER_ERR("Null pointer", 0,0,0);
        return FALSE; // error
    }

    // init buffer
    pszTitle = (AECHAR*) MALLOC ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR));
    if(pszTitle == NULL)
    {
        DIALER_ERR("No memory", 0,0,0);
        return FALSE;
    }

    // load the title
#ifdef FEATURE_TTY
    if(CheckAEEReturnStatus(ICM_GetCallInfo(pMe->m_pICM, pMe->m_byCurrOrigCall, &(pMe->m_CallInfo), sizeof(AEECMCallInfo))) == FALSE)
    {
        DIALER_ERR("ICM_GetCallInfo FAILED", 0, 0, 0);
        return FALSE;
    }
    if( pMe->m_CallInfo.bTTYcall ) {
        (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_CALLING_TTY, pszTitle,
                                    ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
    }
    else {
        (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_CALLING, pszTitle,
                                    ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
    }
#else
    (void) ISHELL_LoadResString(pMe->a.m_pIShell, DIALERAPP_RES_FILE, IDS_CALLING, pszTitle,
                                ((DIALERAPP_MAX_STR_SIZE)*sizeof(AECHAR)));
#endif
    // Update the softkey menu
    (void) IMENUCTL_DeleteAll(pISoftKeyMenu);
    (void) IMENUCTL_AddItem(pISoftKeyMenu, DIALERAPP_RES_FILE, IDS_END,
                            IDL_SK_CALLING_END, NULL, 0);
    SetDefaultSoftkeyLook(pMe->a.m_pIShell, pISoftKeyMenu);


    // Set Static control size
    ISTATIC_GetRect(pIStatic, &StaticRect);
    IMENUCTL_GetRect(pISoftKeyMenu, &MenuRect);
    SETAEERECT(&StaticRect, 10, 10, pMe->m_rc.dx-20, pMe->m_rc.dy-MenuRect.dy-20);

    // Static Info Properties
    ISTATIC_SetRect(pIStatic, &StaticRect);
    ISTATIC_SetActive(pIStatic, FALSE);
    ISTATIC_SetProperties(pIStatic, ST_MIDDLETEXT | ST_UNDERLINE | ST_CENTERTITLE | ST_CENTERTEXT | ST_NOSCROLL);
    (void) ISTATIC_SetText(pIStatic, pszTitle, NULL, AEE_FONT_BOLD,
                           AEE_FONT_NORMAL);

    (void) IDIALOG_SetFocus(pActiveDlg, IDC_SK_CALLING);

    // set timer for emergency calls "searching"
    if(CheckAEEReturnStatus(ICM_GetCallInfo(pMe->m_pICM, pMe->m_byCurrOrigCall, &(pMe->m_CallInfo), sizeof(AEECMCallInfo))) == TRUE)
    {
        if(pMe->m_CallInfo.call_type == AEECM_CALL_TYPE_EMERGENCY)
        {
            (void) ISHELL_SetTimer(pMe->a.m_pIShell, 1000,
                                   (PFNNOTIFY) CDialerApp_CallingDlg_DisplayRefresh, (void*) pMe);
        }
    }

    FREE(pszTitle);

#ifdef FEATURE_UI_SECONDARY_DISP_SUPPORT
#error code not present
#endif

    return CDialerApp_CallingDlg_DisplayRefresh(pMe);
}
Пример #11
0
/*===========================================================================

FUNCTION: CallDemoAppUsage

DESCRIPTION
    This function executes the usage example selected from the main menu by the
  user.  It takes as input the app data pointer and the ID of the example the
  user selected.  After clearing the screen, the selected example is executed.
  Each example is a self-contained code block that contains any local variables
  needed to execute the example.  Each code block also creates and releases any
  BREW interfaces that are required, and will exit if any errors are detected.  
  Once the example has been executed, this function prints a heading at the top 
  of the screen to indicate which example was selected, 
  and a message at the bottom of the screen instructing the user how to return to
  the main menu to execute another example.
    
PROTOTYPE:
   static void IFileUsage(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).

DEPENDENCIES
  None

RETURN VALUE
  None

SIDE EFFECTS
  None

===========================================================================*/
static void CallDemoAppUsage (CallDemoApp * pMe, uint16 wParam)
{

    
   // Make sure the pointers we'll be using are valid
   if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->a.m_pIDisplay == NULL)
     return;

   // Erase screen first for display output purposes.
   DisplayEvent (pMe, USAGE_ERASE_SCREEN);
  IMENUCTL_SetProperties(pMe->m_pIMenu, MP_NO_REDRAW);
  IMENUCTL_SetActive(pMe->m_pIMenu, FALSE);

   // Initialize line number where we will start the output 
   // of each test
   pMe->m_cLineNum = 1;

   switch (wParam)
   {
        case USAGE_CALL_ORIG:
        {
           AECHAR szwStr[32];
           char szNumber[32];
           boolean Result;

           // get telephone number from resource file
           ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER, szwStr, sizeof(szwStr));
           WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

                  
          LISTENER_Init(&pMe->callListener, (PFNLISTENER) OriginateListener, pMe);
          Result = ICALLMGR_Originate(pMe->m_pCallMgr, AEET_CALL_TYPE_VOICE, szNumber, NULL, &pMe->m_pOutgoingCall, &pMe->callListener);
          if (Result != SUCCESS)
          {
             DBGPRINTF("ICALLMGR_Originate failed with res=%d", Result);
             break;
          }
          WriteLine(pMe, "Call Originate -->", NULL, FALSE);          
        }
        break;

        case USAGE_CALL_OUTGOING_END:
            {
                if (Telephone_EndCall(pMe) != SUCCESS) 
                {
                    if (pMe->m_pOutgoingCall) 
                    {
                        ICALL_Release(pMe->m_pOutgoingCall);
                        pMe->m_pOutgoingCall = NULL;
                    }
                }
                WriteLine(pMe, "Call End -->", NULL, FALSE);                
            }
            break;
            
        case USAGE_CALL_INCOMING_END:
            {
                int iResult = EFAILED;

                if (pMe->m_pIncomingCall != NULL)
                {
                    iResult = ICALL_End(pMe->m_pIncomingCall);
                    if (iResult == SUCCESS)
                    {
                        ICALL_Release(pMe->m_pIncomingCall);
                        pMe->m_pIncomingCall = NULL;
                    }
                }
                
                WriteLine(pMe, "Call End -->", NULL, FALSE);                
            }
            break;

        case USAGE_CALL_DTMF:
        {
           AECHAR szwStr[32];
           char szNumber[32];
           boolean Result;

           // get telephone number (main) from resource file
           ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_MAIN, szwStr, sizeof(szwStr));
           WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

                  
          LISTENER_Init(&pMe->callListener, (PFNLISTENER) OriginateListener, pMe);
          Result = ICALLMGR_Originate(pMe->m_pCallMgr, AEET_CALL_TYPE_VOICE, szNumber, NULL, &pMe->m_pOutgoingCall, &pMe->callListener);
          if (Result != SUCCESS)
          {
             DBGPRINTF("ICALLMGR_Originate failed with res=%d", Result);
             break;
          }
          WriteLine(pMe, "Call Originate -->", NULL, FALSE);  
          WriteLine(pMe, "Press 2 to DTMF", NULL, FALSE);  
          pMe->m_isDTMFItem = TRUE;
        }
        break;

        case USAGE_CALL_PARTY3:
        {
           AECHAR szwStr[32];
           char szNumber[32];
           boolean Result;

           // get telephone number (main) from resource file
           ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_A, szwStr, sizeof(szwStr));
           WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

                  
          LISTENER_Init(&pMe->callListener, (PFNLISTENER) OriginateListener, pMe);
          Result = ICALLMGR_Originate(pMe->m_pCallMgr, AEET_CALL_TYPE_VOICE, szNumber, NULL, &pMe->m_pOutgoingCall, &pMe->callListener);
          if (Result != SUCCESS)
          {
             DBGPRINTF("ICALLMGR_Originate failed with res=%d", Result);
             break;
          }
          WriteLine(pMe, "Call Originate A-->", NULL, FALSE);  
          WriteLine(pMe, "Press 3 to call B", NULL, FALSE);  
          pMe->m_isParty3Item = TRUE;
        }
        break;

        case USAGE_CALL_ANSWER:
            pMe->m_isRedirectItem = FALSE;
            break;
        
        case USAGE_CALL_REDIRECT:
            pMe->m_isRedirectItem = TRUE;
            break;
        
        default:
             return;
    }
            
    // Display above event. 
    DisplayEvent (pMe, wParam);

    return;
}
Пример #12
0
/*===========================================================================
   This function redraws the main window.
===========================================================================*/
static void CWhereDetailsWin_Redraw(IWindow * po)
{
   CWhereDetailsWin *  pme = (CWhereDetailsWin *)po;

   if (!pme->m_bActive)
      return;

   
   //XXX __begin
   IDISPLAY_ClearScreen(pme->m_pIDisplay);

   TS_DrawBackgroud(po);
   
   {
		AECHAR bufRes[MP_MAX_STRLEN];
		int a = 0, b = 0;
		int h = 0, xx = 0, yy = 0, dxx = 0, dyy = 0;
		AEERect rect;
		int xMargin = 0;

		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_0, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy = 64;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);

		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_1, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy += h;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);


		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_2, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy += h;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);


		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_3, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy += h;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);

		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_4, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy += h;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);

		ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_5, bufRes, sizeof(bufRes));
		h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12;
		xx = xMargin;
		yy += h;
		dxx = pme->m_pOwner->m_cxWidth - 2;
		dyy = h;
		SETAEERECT(&rect, xx, yy, dxx, dyy);
		TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect);
   }

   IDISPLAY_Update(pme->m_pIDisplay);
   //XXX _end
}
Пример #13
0
static boolean CallDemoApp_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
    CallDemoApp * pMe = (CallDemoApp*)pi;

    switch (eCode) 
    {
        case EVT_APP_START:
            // When this applet is started, try to create the main menu
            // that allows the user to select a usage example to execute.
            // If we cannot create an instance of the menu class, exit and
            // indicate that we have handled the event by returning TRUE
            if(ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MENUCTL, 
                                                (void **)&pMe->m_pIMenu) != SUCCESS)
                return TRUE;

            // Succeeded in obtaining a menu instance pointer, so
            // construct the menu and display it on the screen
            BuildMainMenu(pMe);
            return(TRUE);

        case EVT_APP_STOP:
            return(TRUE);

        case EVT_KEY: 
            if(pMe->m_isDTMFItem)
            {
                if (wParam == AVK_2)
                {
                    AECHAR szwStr[32];
                    char szNumber[32];
                    int nRet;

                    // get telephone number (main) from resource file
                    ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_SUB, szwStr, sizeof(szwStr));
                    WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

                    nRet = ICALL_BurstDTMF(pMe->m_pOutgoingCall,  AEET_DTMF_ON_95,AEET_DTMF_OFF_60,szNumber);
                    DBGPRINTF("ICALL_BurstDTMF ret %d", nRet);
                    WriteLine(pMe, "ICALL_BurstDTMF -->", NULL, FALSE);    
                }
            }


            if (pMe->m_isParty3Item)
            {
                if (wParam == AVK_3)
                {
                   AECHAR szwStr[32];
                   char szNumber[32];
                   boolean Result;

                   // get telephone number (main) from resource file
                   ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_B, szwStr, sizeof(szwStr));
                   WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

                          
                  LISTENER_Init(&pMe->callListenerB, (PFNLISTENER) OriginateListener, pMe);
                  Result = ICALLMGR_Originate(pMe->m_pCallMgr, AEET_CALL_TYPE_VOICE, szNumber, NULL, &pMe->m_pOutgoingCallB, &pMe->callListenerB);
                  if (Result != SUCCESS)
                  {
                     DBGPRINTF("ICALLMGR_Originate failed with res=%d", Result);
                     break;
                  }
                  WriteLine(pMe, "Call Originate B-->", NULL, FALSE);  
                  WriteLine(pMe, "Press 1 to unhold A", NULL, FALSE);  
                  return TRUE;
                }

                if (wParam == AVK_1)
                {
                  int nRet;
                  if(pMe->m_pOutgoingCall)
                  {
                    nRet = ICALL_SwitchTo( pMe->m_pOutgoingCall );
                    DBGPRINTF("ICALL_SwitchTo A ret:%d", nRet);
                  }
#if 0
                  if(pMe->m_pOutgoingCallB)
                  {
                    nRet = ICALL_Hold( pMe->m_pOutgoingCallB );
                    DBGPRINTF("ICALL_Hold B ret:%d", nRet);
                  }
#endif                  
                  WriteLine(pMe, "switch issued", NULL, FALSE);  
                  return TRUE;
                }

#if 0
                if (wParam == AVK_2)
                {
                  int nRet;
                  if(pMe->m_pOutgoingCallB)
                  {
                    nRet = ICALL_SwitchTo( pMe->m_pOutgoingCallB );
                     DBGPRINTF("ICALL_SwitchTo B ret:%d", nRet);
                  }
                  
                  if(pMe->m_pOutgoingCall)
                  {
                    nRet = ICALL_Hold( pMe->m_pOutgoingCall );
                    DBGPRINTF("ICALL_Hold A ret:%d", nRet);
                  }
                  WriteLine(pMe, "switch issued", NULL, FALSE);  
                  return TRUE;
                }
#endif                  
            }

            // ¿ØÖÆÉÏϼüÑ¡Ôñ²Ëµ¥
            if (pMe->m_pIMenu)
            {
                if ((IMENUCTL_IsActive(pMe->m_pIMenu) == FALSE) &&
                   ((wParam == AVK_UP) || (wParam == AVK_DOWN)))
                {
                    IMENUCTL_SetActive(pMe->m_pIMenu, TRUE);
                    IMENUCTL_Redraw(pMe->m_pIMenu);
                }

                return IMENUCTL_HandleEvent(pMe->m_pIMenu, EVT_KEY, wParam, 0);
            }
            else
                return FALSE;


        case EVT_NOTIFY:
            break;
            
        case EVT_COMMAND:
            switch(wParam)
            {
                // The following commands are generated by user selections
                // from the main usage app menu.
                
                case USAGE_CALL_ORIG:
                case USAGE_CALL_OUTGOING_END:
                case USAGE_CALL_INCOMING_END:
                case USAGE_CALL_DTMF:
                case USAGE_CALL_PARTY3:
                case USAGE_CALL_ANSWER:
                case USAGE_CALL_REDIRECT:
                    // Deactivate main menu to turn off horizontal scrolling of long menu items
                    IMENUCTL_SetActive(pMe->m_pIMenu, FALSE);

                    // Execute the usage example the user has selected
                    CallDemoAppUsage (pMe, wParam);
                    return TRUE;
             
                default:
                    return FALSE;
            } // switch(wPara)

        case EVT_MY_ANSWER:
        DBGPRINTF("handler of call incoming by answer");
        if (pMe->m_pIncomingCall)
        { 
            int nError;
            nError = ICALL_Answer(pMe->m_pIncomingCall);
            if (SUCCESS != nError)
            {
                DBGPRINTF("ICALL_Answer failed ret=%d", nError);
            }
            else
            {
                DBGPRINTF("ICALL_Answer -->");
                WriteLine(pMe, "ICALL_Answer -->", NULL, FALSE);          
            }
        }
                    return TRUE;

        case EVT_MY_REDIRECT:
        DBGPRINTF("handler of call incoming by redirect");
        if (pMe->m_pIncomingCall)
        { 
            int nError;
            AECHAR szwStr[32];
            char szNumber[32];

            // get redirect number
            ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_REDIRECT, szwStr, sizeof(szwStr));
            WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

            nError = ICALL_Redirect(pMe->m_pIncomingCall, szNumber);
            if (SUCCESS != nError)
            {
                DBGPRINTF("ICALL_Redirect failed ret=%d", nError);
            }
            else
            {
                DBGPRINTF("ICALL_Redirect -->%s", szNumber);
                WriteLine(pMe, "ICALL_Redirect -->", NULL, FALSE);          
            }
        }
        return TRUE;

        default:
            break;
   } //  switch (eCode) 

#ifdef EVENT_AUTO_GET
   if(eCode == pMe->m_UserAnswerEvent)
   {
        DBGPRINTF("handler of call incoming by answer");
        if (pMe->m_pIncomingCall)
        { 
            int nError;
            nError = ICALL_Answer(pMe->m_pIncomingCall);
            if (SUCCESS != nError)
            {
                DBGPRINTF("ICALL_Answer failed ret=%d", nError);
            }
            else
            {
                DBGPRINTF("ICALL_Answer -->");
                WriteLine(pMe, "ICALL_Answer -->", NULL, FALSE);          
            }
        }
   }
   
   if(eCode == pMe->m_UserRedirectEvent)
   {
        DBGPRINTF("handler of call incoming by redirect");
        if (pMe->m_pIncomingCall)
        { 
            int nError;
            AECHAR szwStr[32];
            char szNumber[32];

            // get redirect number
            ISHELL_LoadResString(pMe->a.m_pIShell, CALLDEMO_RES_FILE, IDS_STRING_TELEPHONE_NUMBER_REDIRECT, szwStr, sizeof(szwStr));
            WSTRTOSTR(szwStr, szNumber, sizeof(szNumber));

            nError = ICALL_Redirect(pMe->m_pIncomingCall, szNumber);
            if (SUCCESS != nError)
            {
                DBGPRINTF("ICALL_Redirect failed ret=%d", nError);
            }
            else
            {
                DBGPRINTF("ICALL_Redirect -->%s", szNumber);
                WriteLine(pMe, "ICALL_Redirect -->", NULL, FALSE);          
            }
        }
   }
#endif    
   return FALSE;
}
Пример #14
0
/*===========================================================================

FUNCTION: CGMENUCTL_Redraw

DESCRIPTION:
Redraws the control on the device screen.  If the control currently has
focus, the control is drawn with a border.

PARAMETERS:
pCtl [in] - A pointer to a CGMeuCtl instance

DEPENDENCIES:
None

RETURN VALUE:
None

SIDE EFFECTS:
Updates the device screen.
===========================================================================*/
extern void CGMENUCTL_Redraw(CGMeuCtl* pMe)
{
	AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE();
	AEERect rRect;

	if (pMe)
	{
		int i, j, height, h, a, b;
		AEEImageInfo infSe, infIc;
		AEERect rec;
		int xx, yy, dxx, dyy;
		RGBVAL oldColor;

		GMenuItem * pData = NULL;
		TQueueList * p = pMe->m_pDataList;

		ZEROAT(&infSe);

		IDISPLAY_EraseRect(pApp->m_pIDisplay, &pMe->m_Rect);

		h = IDISPLAY_GetFontMetrics(pApp->m_pIDisplay, AEE_FONT_NORMAL, &a, &b);

		//绘制背景图
		if (pMe->m_pImageBk)
		{
			IIMAGE_SetDrawSize(pMe->m_pImageBk, pMe->m_Rect.dx, pMe->m_Rect.dy);
			IIMAGE_Draw(pMe->m_pImageBk, pMe->m_Rect.x, pMe->m_Rect.y);
		}

		//确定菜单高度
		if (pMe->m_pImageSe)
		{
			IIMAGE_GetInfo(pMe->m_pImageSe, &infSe);
			IIMAGE_SetDrawSize(pMe->m_pImageSe, pMe->m_Rect.dx, infSe.cy);
		}
		else
		{
			infSe.cx = pMe->m_Rect.dx;
			infSe.cy = h;
		}

		//绘制菜单项
		i = 0;
		j = 0;
		height = pMe->m_Rect.y + 5;
		while (p)
		{
			AECHAR	iTemText[256];

			if (i < pMe->m_startIndex)
			{
				p = p->pNext;
				i++;
				continue;
			}

			if (j >= pMe->m_pageSize)
			{
				break;
			}

			pData = (GMenuItem*)p->pData;

			//加载菜单ICON
			if (pData->pImage == NULL && pData->pszResImage != NULL && pData->wImage != 0)
			{
				pData->pImage = ISHELL_LoadResImage(pApp->m_pIShell, pData->pszResImage, pData->wImage);
			}

			//加载菜单Text
			if (pData->pszResText != NULL && pData->wText != 0)
			{
				MEMSET(iTemText, 0, sizeof(AECHAR)*256);
				
				ISHELL_LoadResString(pApp->m_pIShell, pData->pszResText, pData->wText, iTemText, sizeof(AECHAR)* 256);

				pData->pText = iTemText;
			}

			if (i == pMe->m_Index)
			{
				if (pMe->m_pImageSe)
					IIMAGE_Draw(pMe->m_pImageSe, pMe->m_Rect.x, height + 2);

				ZEROAT(&infIc);
				if (pData->pImage)
				{
					IIMAGE_GetInfo(pData->pImage, &infIc);
					IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2);
				}

				xx = pMe->m_Rect.x + infIc.cx + 2;
				yy = height + (infSe.cy - h) / 2 + 2;
				dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx;
				dyy = h;
				SETAEERECT(&rec, xx, yy, dxx, dyy);

				oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cSelText);
				if (pMe->m_Properties & 0x02)
					IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT);
				IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT);

				if (pMe->m_isActive)
				{
					if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText) > dxx)
					{
						if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos) > dxx)
						{
							pMe->m_textPos++;
						}
						else
							pMe->m_textPos = 0;

						//单行太长的话,动态显示
						ISHELL_SetTimer(pApp->m_pIShell, 300, (PFNNOTIFY)CGMENUCTL_Redraw, (void*)pMe);
					}
				}

				height += infSe.cy;
				IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor);
			}
			else
			{
				ZEROAT(&infIc);
				if (pData->pImage)
				{
					IIMAGE_GetInfo(pData->pImage, &infIc);
					IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2);
				}

				xx = pMe->m_Rect.x + infIc.cx + 2;
				yy = height + (infSe.cy - h) / 2 + 2;
				dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx;
				dyy = h;
				SETAEERECT(&rec, xx, yy, dxx, dyy);

				oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cText);
				if (pMe->m_Properties & 0x01)
					IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT);
				IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT);

				height += infSe.cy;
				IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor);
			}

			p = p->pNext;
			i++;
			j++;
		}

		IDISPLAY_Update(pApp->m_pIDisplay);
		return ;
	}
}
Пример #15
0
/*===========================================================================

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;
}
Пример #16
0
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;
}
Пример #17
0
/*===========================================================================

FUNCTION: IFileUsage

DESCRIPTION
    This function executes the usage example selected from the main menu by the
  user.  It takes as input the app data pointer and the ID of the example the
  user selected.  After clearing the screen, the selected example is executed.
  Each example is a self-contained code block that contains any local variables
  needed to execute the example.  Each code block also creates and releases any
  BREW interfaces that are required, and will exit if any errors are detected.
  Once the example has been executed, this function prints a heading at the top
  of the screen to indicate which example was selected,
  and a message at the bottom of the screen instructing the user how to return to
  the main menu to execute another example.

PROTOTYPE:
   static void IFileUsage(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).

DEPENDENCIES
  None

RETURN VALUE
  None

SIDE EFFECTS
  None

===========================================================================*/
static void ISmsAppUsage (ISmsApp * pMe, uint16 wParam)
{


    // Make sure the pointers we'll be using are valid
    if (pMe == NULL || pMe->a.m_pIShell == NULL || pMe->a.m_pIDisplay == NULL)
        return;

    // Erase screen first for display output purposes.
    DisplayEvent (pMe, USAGE_ERASE_SCREEN);
    IMENUCTL_SetProperties(pMe->m_pIMenu, MP_NO_REDRAW);
    IMENUCTL_SetActive(pMe->m_pIMenu, FALSE);

    // Initialize line number where we will start the output
    // of each test
    pMe->m_cLineNum = 1;

    switch (wParam)
    {
    case USAGE_SMS_TX_ASCII:
    {
        int nErr;
        WebOpt awo[6]; /* ***IMPORTANT**** grow this if you add more
                             WebOpts here, or shrink it and call AddOpt() multiple times */
        int    i = 0;
        uint32 nReturn=0;


        nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->m_pISMSMsg);
        DBGPRINTF("CreateInstance of AEECLSID_SMSMSG ret %d", nErr);
        if(nErr != AEE_SUCCESS)
        {
            break;
        }

        /* NULL terminated string providing destination device number.
            '+' as first character signifies international number.  */
        awo[i].nId  = MSGOPT_TO_DEVICE_SZ ;
        awo[i].pVal = (void *)DESTINATION_NUMBER;
        i++;

        /* ascii text to be send */
        awo[i].nId  = MSGOPT_PAYLOAD_SZ ;
        awo[i].pVal = (void *)MO_TEXT_ASCII;
        i++;

        /* encoding */
        awo[i].nId  = MSGOPT_PAYLOAD_ENCODING;
        awo[i].pVal = (void *)AEE_ENC_ISOLATIN1;
        i++;

        awo[i].nId  = MSGOPT_MOSMS_ENCODING;
        awo[i].pVal = (void *)AEESMS_ENC_ASCII;
        i++;
#if 0
        /* user ack */
        awo[i].nId  = MSGOPT_USER_ACK;
        awo[i].pVal = (void *)TRUE;
        i++;
#endif
        /* this is absolutely necessary, do not remove, marks the end of the
           array of WebOpts */
        awo[i].nId  = WEBOPT_END;

        /* add 'em */
        nErr =ISMSMSG_AddOpt(pMe->m_pISMSMsg, awo);
        DBGPRINTF("ISMSMSG_AddOpt ret %d", nErr);

        CALLBACK_Init(&pMe->m_cb, SMSCallBack_Send, pMe);
        ISMS_SendMsg(pMe->m_pISMS, pMe->m_pISMSMsg, &pMe->m_cb, &nReturn);

        // Higher 16 bits specify error type specified as AEESMS_ERRORTYPE_XXX
        // lower  16 bits specify error specified as AEESMS_ERROR_XXX
        DBGPRINTF("ISMS_SendMsg ret 0x%x", nReturn);
    }
    break;

    case USAGE_SMS_TX_UNICODE:
    {
        int nErr;
        WebOpt awo[6]; /* ***IMPORTANT**** grow this if you add more
                             WebOpts here, or shrink it and call AddOpt() multiple times */
        int    i = 0;
        uint32 nReturn=0;
        AECHAR pszBuf[100];

        nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->m_pISMSMsg);
        DBGPRINTF("CreateInstance of AEECLSID_SMSMSG ret %d", nErr);
        if(nErr != AEE_SUCCESS)
        {
            break;
        }

        /* NULL terminated string providing destination device number.
            '+' as first character signifies international number.  */
        awo[i].nId  = MSGOPT_TO_DEVICE_SZ ;
        awo[i].pVal = (void *)DESTINATION_NUMBER;
        i++;

        /* unicode text to be send */
        awo[i].nId  = MSGOPT_PAYLOAD_WSZ ;
        ISHELL_LoadResString(pMe->a.m_pIShell, ISMS_RES_FILE, IDS_MO_TEXT_UNICODE, pszBuf, sizeof(pszBuf));
        awo[i].pVal = (void *)pszBuf;
        i++;

        /* encoding */
        awo[i].nId  = MSGOPT_PAYLOAD_ENCODING;
        awo[i].pVal = (void *)AEE_ENC_UNICODE ;
        i++;

        awo[i].nId  = MSGOPT_MOSMS_ENCODING;
        awo[i].pVal = (void *)AEESMS_ENC_UNICODE;
        i++;

#if 0
        /* user ack */
        awo[i].nId  = MSGOPT_READ_ACK;
        awo[i].pVal = (void *)TRUE;
        i++;
#endif

        /* this is absolutely necessary, do not remove, marks the end of the
           array of WebOpts */
        awo[i].nId  = MSGOPT_END;

        /* add 'em */
        nErr =ISMSMSG_AddOpt(pMe->m_pISMSMsg, awo);
        DBGPRINTF("ISMSMSG_AddOpt ret %d", nErr);

        CALLBACK_Init(&pMe->m_cb, SMSCallBack_Send, pMe);
        ISMS_SendMsg(pMe->m_pISMS, pMe->m_pISMSMsg, &pMe->m_cb, &nReturn);

        // Higher 16 bits specify error type specified as AEESMS_ERRORTYPE_XXX
        // lower  16 bits specify error specified as AEESMS_ERROR_XXX
        DBGPRINTF("ISMS_SendMsg ret 0x%x", nReturn);
    }
    break;

    case USAGE_SMS_TX_UTF8:
    {
        int nErr;
        WebOpt awo[6]; /* ***IMPORTANT**** grow this if you add more
                             WebOpts here, or shrink it and call AddOpt() multiple times */
        int    i = 0;
        uint32 nReturn=0;
        char utf8_Buf_Sending[302];
        uint16 count;
        // in utf-8 "数组19英文English混合" with heading of two bytes for length -0x0010
        // The length is little-endian, low byte first.
        char cTextUTF8[142]= {0xFF, 0xFE,
                              0x70, 0x65,0x57, 0x5B, 0x31, 0x0, 0x39, 0x0, 0xF1, 0x82, 0x87, 0x65, 0x45, 0x0,
                              0x6E, 0x0,  0x67, 0x0, 0x6c, 0x0, 0x69, 0x0, 0x73, 0x0, 0x68, 0x0, 0xF7, 0x6D, 0x08, 0x54, 0x0, 0x0
                             };
        //char cTextUTF8[142]={0x1e, 0x0,
        //                                    0xEF, 0xBB, 0xBF, 0xE6,0x95, 0xB0, 0xE7, 0xBB, 0x84, 0x31, 0x39, 0xE8, 0x8B, 0x8B, 0xB1, 0xE6, 0x96,
        //                                     0x87, 0x45,  0x6E, 0x67, 0x6c, 0x69, 0x73, 0x68, 0xE6, 0xB7, 0xB7, 0xE5, 0x90, 0x88 };

        nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->m_pISMSMsg);
        DBGPRINTF("CreateInstance of AEECLSID_SMSMSG ret %d", nErr);
        if(nErr != AEE_SUCCESS)
        {
            break;
        }

        /* NULL terminated string providing destination device number.
            '+' as first character signifies international number.  */
        awo[i].nId  = MSGOPT_TO_DEVICE_SZ ;
        awo[i].pVal = (void *)DESTINATION_NUMBER;
        i++;

        /* unicode text to be send */
        awo[i].nId  = MSGOPT_PAYLOAD_BINARY;
        MEMSET(utf8_Buf_Sending, 0, sizeof(utf8_Buf_Sending));
        WSTRTOUTF8((AECHAR *)cTextUTF8, WSTRLEN((AECHAR *)cTextUTF8), (byte *)&(utf8_Buf_Sending[2]), 300);
        count = STRLEN(&(utf8_Buf_Sending[2]));
        DBGPRINTF("WLen(%d)===> count=%d", WSTRLEN((AECHAR *)cTextUTF8),count);
        DBGPRINTF("0x%2x, %2x, %2x, %2x", utf8_Buf_Sending[0], utf8_Buf_Sending[1], utf8_Buf_Sending[2], utf8_Buf_Sending[3] );
        DBGPRINTF("0x%2x, %2x, %2x, %2x", utf8_Buf_Sending[4], utf8_Buf_Sending[5], utf8_Buf_Sending[6], utf8_Buf_Sending[7] );
        DBGPRINTF("0x%2x, %2x, %2x, %2x", utf8_Buf_Sending[8], utf8_Buf_Sending[9], utf8_Buf_Sending[10], utf8_Buf_Sending[11] );
        DBGPRINTF("0x%2x, %2x, %2x, %2x", utf8_Buf_Sending[12], utf8_Buf_Sending[13], utf8_Buf_Sending[14], utf8_Buf_Sending[15] );
        DBGPRINTF("0x%2x, %2x, %2x, %2x", utf8_Buf_Sending[16], utf8_Buf_Sending[17], utf8_Buf_Sending[18], utf8_Buf_Sending[19] );
        utf8_Buf_Sending[0]=count & 0xff;
        utf8_Buf_Sending[1]=(count>>8) & 0xff;
        awo[i].pVal = (void *)utf8_Buf_Sending;
        i++;

        /* encoding */
        awo[i].nId  = MSGOPT_PAYLOAD_ENCODING;
        awo[i].pVal = (void *)AEE_ENC_UTF8 ;
        i++;

        awo[i].nId  = MSGOPT_MOSMS_ENCODING;
        awo[i].pVal = (void *)AEESMS_ENC_OCTET;
        i++;

#if 0
        /* user ack */
        awo[i].nId  = MSGOPT_READ_ACK;
        awo[i].pVal = (void *)TRUE;
        i++;
#endif

        /* this is absolutely necessary, do not remove, marks the end of the
           array of WebOpts */
        awo[i].nId  = MSGOPT_END;

        /* add 'em */
        nErr =ISMSMSG_AddOpt(pMe->m_pISMSMsg, awo);
        DBGPRINTF("ISMSMSG_AddOpt ret %d", nErr);

        CALLBACK_Init(&pMe->m_cb, SMSCallBack_Send, pMe);
        ISMS_SendMsg(pMe->m_pISMS, pMe->m_pISMSMsg, &pMe->m_cb, &nReturn);

        // Higher 16 bits specify error type specified as AEESMS_ERRORTYPE_XXX
        // lower  16 bits specify error specified as AEESMS_ERROR_XXX
        DBGPRINTF("ISMS_SendMsg ret 0x%x", nReturn);
    }
    break;

    case USAGE_SMS_RX_TAPI_METHOD:
    {
        // 使用TAPI的notify机制接收短信
        AEECLSID clsNotifier= AEECLSID_TAPI; // Event sender
        AEECLSID clsNotify = AEECLSID_ISMS;  // Event listener
        // Set the notify event to be NOTIFY_MASK_EVENT. This event is used
        // as an example.
        uint32 dwMask = NMASK_TAPI_SMS_TEXT;
        int nErr;

        // Register a notification
        nErr = ISHELL_RegisterNotify (pMe->a.m_pIShell, clsNotify, clsNotifier, dwMask);
        DBGPRINTF("ISHELL_RegisterNotify ret %d", nErr);
    }

    break;

    case USAGE_SMS_RX_ISMS_METHOD:
    {
        // 使用新的AEECLSID_SMSNOTIFIER 的notify机制接收短信
        AEECLSID clsNotifier= AEECLSID_SMSNOTIFIER; // Event sender
        AEECLSID clsNotify = AEECLSID_ISMS; // Event listener
        // Set the notify event to be NOTIFY_MASK_EVENT. This event is used
        // as an example.
        uint32 dwMask = ((AEESMS_TYPE_TEXT << 16) | NMASK_SMS_TYPE);
        int nErr;

        // Register a notification
        nErr = ISHELL_RegisterNotify (pMe->a.m_pIShell, clsNotify, clsNotifier, dwMask);
        DBGPRINTF("ISHELL_RegisterNotify ret %d", nErr);
    }
    break;

    case USAGE_SMS_STORE_STATUS:
    {
        CALLBACK_Cancel(&pMe->m_cb);
        CALLBACK_Init(&pMe->m_cb, OATSMS_StoreReadMsgStorageStatusCb, (void*)pMe);

        ISMSSTORAGE_GetStorageStatus(pMe->m_pISMSStorage,
                                     pMe->m_mt,
                                     pMe->m_tag,
                                     &pMe->m_cb,
                                     &pMe->m_ss,
                                     &pMe->m_dwStatus);
    }
    break;

    case USAGE_SMS_STORE_ENUM_READ:
    {
        CALLBACK_Cancel(&pMe->EnumMsgInitCb);
        CALLBACK_Init(&pMe->EnumMsgInitCb, OATSMS_EnumMsgInitCb, (void*)pMe);
        ISMSSTORAGE_EnumMsgInit(pMe->m_pISMSStorage,
                                pMe->m_mt,
                                pMe->m_tag,
                                &pMe->EnumMsgInitCb,
                                &pMe->m_dwStatus);
    }
    break;

    default:
        return;
    }

    // Display above event.
    DisplayEvent (pMe, wParam);

    return;
}