void CContactInfo::CountMultiFields(AECHAR *pwzField, int &nCount)
{
	if (NULL==pwzField ) return;

	nCount++;

	AECHAR pwzNewTag[]=NEW_FIELD;
	char pszNewtag[10];
	SPRINTF(pszNewtag, "%S", pwzNewTag);

	char *pszTmp=NULL;
	int nLen=WSTRLEN(pwzField);
	pszTmp = (char*)MALLOC(nLen+1);
	if ( NULL==pszTmp ) return;
	WSTRTOSTR(pwzField, pszTmp, nLen+1);

	char *pNext=pszTmp;
	char *pFound=NULL;
	while ( NULL!=(pFound=STRSTR(pNext, pszNewtag)))
	{
		nCount++;
		pNext = pFound+1;
	}

	FREEIF(pszTmp);
}
// 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;
}
Example #3
0
/*===========================================================================
===========================================================================*/
static boolean SamplePosDet_InitApplet( CSamplePosDet *pMe )
{
   boolean bRet = TRUE;
   pMe->currentHandler = 0;

   // Load the GPS settings from the config file, if possible
   SamplePosDet_InitGPSSettings( pMe );

   {
	   Coordinate c1, c2;
	   double dis = 0;
	   char szDis[64];
	   AECHAR wcharbuf[32];
	   
	   //shanghai 31.1774276, 121.5272106
	   c1.lat = 31.1774276;
	   c1.lon = 121.5272106;
	   
	   //beijing 39.911954, 116.377817
	   c2.lat = 39.911954;
	   c2.lon = 116.377817;
	   
	   //shenzhen 22.543847, 113.912316
	   c1.lat = 22.543847;
	   c1.lon = 113.912316;
	   dis = Track_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
	   
	   
	   MEMSET(szDis,0,sizeof(szDis));
	   
	   FLOATTOWSTR(dis, wcharbuf, 32);
	   WSTRTOSTR(wcharbuf,szDis, 64);
	   
	   DBGPRINTF("Track_cbOrientInfo dis:%s", szDis);
	   //SamplePosDet_Printf( pMe, 5, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "%s m", szDis );
	   
	}

   return bRet;
}
// ================================================================================
// FUNCTION		: IsSmsMatched
// DESCRIPTION	: Check wheather the sms matched with the filtered phone number..
// ================================================================================
boolean CDbHandler::IsSmsMatched(AECHAR *pszPhoneNo, char **pFilterAr, int nNo)
{
	if ( 0==nNo ) return TRUE;

	char *pszTemp=NULL;
	int nLen= WSTRLEN(pszPhoneNo)+1;
	pszTemp = (char*)MALLOC(nLen);
	if (NULL==pszTemp) return FALSE;
	WSTRTOSTR(pszPhoneNo, pszTemp, nLen);
	
	//search the phone no in array
	for (int i=0; i<nNo; i++)
	{
		if ( 0==STRCMP(pFilterAr[i], pszTemp))
		{
			FREEIF(pszTemp);
			return TRUE;
		}
	}

	FREEIF(pszTemp);
	return FALSE;
}
Example #5
0
void Loc_Test_All(void)
{
   Coordinate c1, c2;
   double dis = 0, th = 0;
   char szDis[64], szAzh[64];
   AECHAR bufDis[32], bufAzh[32];

   //DESTINATION
   //beijing 39.911954, 116.377817
   c1.lat = 39.911954;
   c1.lon = 116.377817;

   //1 chengde 40.8493953666,118.0478839599
   c2.lat = 40.8493953666;
   c2.lon = 118.0478839599;
   dis = Loc_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
   th = Loc_Calc_Azimuth(c1.lat, c1.lon, c2.lat, c2.lon);

   MEMSET(szDis,0,sizeof(szDis));
   FLOATTOWSTR(dis, bufDis, 32);
   WSTRTOSTR(bufDis,szDis, 64);

   MEMSET(szAzh,0,sizeof(szAzh));
   FLOATTOWSTR(th, bufAzh, 32);
   WSTRTOSTR(bufAzh, szAzh, 64);
   
   DBGPRINTF("location_get 1 dis:%s azh:%s", szDis, szAzh);

   //2 shanghai 31.1774276, 121.5272106	//1076679.0804040465
   c2.lat = 31.1774276;
   c2.lon = 121.5272106;
   dis = Loc_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
   th = Loc_Calc_Azimuth(c1.lat, c1.lon, c2.lat, c2.lon);

   MEMSET(szDis,0,sizeof(szDis));
   FLOATTOWSTR(dis, bufDis, 32);
   WSTRTOSTR(bufDis,szDis, 64);

   MEMSET(szAzh,0,sizeof(szAzh));
   FLOATTOWSTR(th, bufAzh, 32);
   WSTRTOSTR(bufAzh, szAzh, 64);   
   DBGPRINTF("location_get 2 dis:%s azh:%s", szDis, szAzh);


   //3 sjz 38.0422378880,114.4925141047
   c2.lat = 38.0422378880;
   c2.lon = 114.4925141047;
   dis = Loc_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
   th = Loc_Calc_Azimuth(c1.lat, c1.lon, c2.lat, c2.lon);

   MEMSET(szDis,0,sizeof(szDis));
   FLOATTOWSTR(dis, bufDis, 32);
   WSTRTOSTR(bufDis,szDis, 64);

   MEMSET(szAzh,0,sizeof(szAzh));
   FLOATTOWSTR(th, bufAzh, 32);
   WSTRTOSTR(bufAzh, szAzh, 64);
   DBGPRINTF("location_get 3 dis:%s azh:%s", szDis, szAzh);


   //4 zhangjiakou 40.3964667463,114.8377011418
   c2.lat = 40.3964667463;
   c2.lon = 114.8377011418;
   dis = Loc_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
   th = Loc_Calc_Azimuth(c1.lat, c1.lon, c2.lat, c2.lon);

   MEMSET(szDis,0,sizeof(szDis));
   FLOATTOWSTR(dis, bufDis, 32);
   WSTRTOSTR(bufDis,szDis, 64);

   MEMSET(szAzh,0,sizeof(szAzh));
   FLOATTOWSTR(th, bufAzh, 32);
   WSTRTOSTR(bufAzh, szAzh, 64);
   DBGPRINTF("location_get 4 dis:%s azh:%s", szDis, szAzh);

}
Example #6
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;
}
Example #7
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;
}
Example #8
0
/*===========================================================================
===========================================================================*/
static void SamplePosDet_GetGPSInfo_Paint( CSamplePosDet *pMe, GetGPSInfo_PaintRegions rgn )
{
   struct _GetGPSInfo *pGetGPSInfo = SamplePosDet_GetScreenData( pMe );

  
   if( rgn == GETGPSINFO_PAINT_ALL ) {
      IDISPLAY_ClearScreen( pMe->theApp.m_pIDisplay );
      SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_LEFT, "GetGPSInfo" );
      if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_ONE_SHOT ) {
         SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "One Shot" );
      }
      else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_LOCAL ) {
         SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track L" );
      }
      else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_NETWORK ) {
         SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track N" );
      }
      else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_AUTO ) {
         SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track A" );
      }
   }

   if( rgn == GETGPSINFO_PAINT_FIXCOUNT || rgn == GETGPSINFO_PAINT_ALL ) {
      SamplePosDet_Printf( pMe, 1, 4, AEE_FONT_NORMAL, IDF_ALIGN_LEFT, "Failed : %d", pGetGPSInfo->dwFail+pGetGPSInfo->dwTimeout );
      SamplePosDet_Printf( pMe, 1, 4, AEE_FONT_NORMAL, IDF_ALIGN_RIGHT, "Timeout : %d", pGetGPSInfo->dwTimeout );
   }

   if( rgn == GETGPSINFO_PAINT_FIXDATA || rgn == GETGPSINFO_PAINT_ALL ) {
#define MAXTEXTLEN   22
      AECHAR wcText[MAXTEXTLEN];
      char   latlonStr[MAXTEXTLEN];

      SamplePosDet_Printf( pMe, 2, 4, AEE_FONT_NORMAL, IDF_ALIGN_LEFT, "Fixes : %d", pGetGPSInfo->dwFixNumber );

      FLOATTOWSTR( pGetGPSInfo->theInfo.lat, wcText, MAXTEXTLEN * sizeof(AECHAR) );
      WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN );
      SamplePosDet_Printf( pMe, 3, 4, AEE_FONT_BOLD, IDF_ALIGN_CENTER|IDF_RECT_FILL, "%s d", latlonStr );

      FLOATTOWSTR( pGetGPSInfo->theInfo.lon, wcText, MAXTEXTLEN * sizeof(AECHAR) );
      WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN );
      SamplePosDet_Printf( pMe, 4, 4, AEE_FONT_BOLD, IDF_ALIGN_CENTER|IDF_RECT_FILL, "%s d", latlonStr );

	  		  
      SamplePosDet_Printf( pMe, 5, 4, AEE_FONT_BOLD, IDF_ALIGN_RIGHT|IDF_RECT_FILL, "%d m", pGetGPSInfo->theInfo.height );

	  
      {
         double fv;
         fv = FASSIGN_INT( pGetGPSInfo->dwFixDuration );
         if( pGetGPSInfo->dwFixNumber ) {
            fv = FDIV(fv, pGetGPSInfo->dwFixNumber);
         }
         FLOATTOWSTR( fv, wcText, MAXTEXTLEN * sizeof(AECHAR) );
         WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN );
         SamplePosDet_Printf( pMe, 6, 4, AEE_FONT_BOLD, IDF_ALIGN_RIGHT|IDF_RECT_FILL, "Avg %ss", latlonStr );   
      }
   }

   if( rgn == GETGPSINFO_PAINT_ERROR ) {
      SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_BOLD, IDF_ALIGN_BOTTOM|IDF_ALIGN_CENTER|IDF_TEXT_INVERTED, 
         "ABORTED 0x%x", pGetGPSInfo->theInfo.nErr );
   }

   if( rgn == GETGPSINFO_PAINT_FIXANIM || rgn == GETGPSINFO_PAINT_ALL ) {
      SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_NORMAL, IDF_ALIGN_BOTTOM|IDF_ALIGN_CENTER|IDF_RECT_FILL, 
         ".....%d.....", pGetGPSInfo->wProgress );
   }

   //if (FABS(pGetGPSInfo->theInfo.lat) > 0)
   {
	   Coordinate c1, c2;
	   double dis = 0;
	   char szDis[64];
	   AECHAR wcharbuf[32];
	   
	   //shanghai 31.1774276, 121.5272106
	   c1.lat = 31.1774276;
	   c1.lon = 121.5272106;
	   
	   //beijing 39.911954, 116.377817
	   c2.lat = 39.911954;
	   c2.lon = 116.377817;
	   
	   //shenzhen 22.543847, 113.912316
	   //c1.lat = 22.543847;
	   //c1.lon = 113.912316;
	   c1.lat = pGetGPSInfo->theInfo.lat;
	   c1.lon = pGetGPSInfo->theInfo.lon;

	   dis = Track_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon);
	   
	   
	   MEMSET(szDis,0,sizeof(szDis));
	   
	   FLOATTOWSTR(dis, wcharbuf, 32);
	   WSTRTOSTR(wcharbuf,szDis, 64);
	   
	   DBGPRINTF("Track_cbOrientInfo dis:%s", szDis);
	   SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "%s m", szDis );
	   
	  }
	  {
		  uint16 d1 = 0;
		  uint8 d2 = 0;
		  d1 = ((uint16)(pGetGPSInfo->theInfo.wAzimuth & (~0x3f)))>>6;
		  d2 = (uint8)(pGetGPSInfo->theInfo.wAzimuth & 0x3f);
		  SamplePosDet_Printf( pMe, 8, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "Head %d.%d", d1, d2 );   
		  SamplePosDet_Printf( pMe, 9, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "Heading %d", pGetGPSInfo->theInfo.heading);  
	  }

}
void CContactInfo::FillMultiField(AEEAddrField *pField, int &nPos, AECHAR *pwzName, AEEAddrFieldID type)
{
	//	pwzName	=		[email protected]<NEW>[email protected]

	if (NULL==pwzName ) return;

	AECHAR pwzNewTag[]=NEW_FIELD;
	char pszNewtag[10];
	SPRINTF(pszNewtag, "%S", pwzNewTag);
	int nTagLen = STRLEN(pszNewtag);

	char *pszTmp=NULL;
	int nLen=WSTRLEN(pwzName);
	pszTmp = (char*)MALLOC(nLen+1);
	if ( NULL==pszTmp ) return;
	WSTRTOSTR(pwzName, pszTmp, nLen+1);

	char *pNext=pszTmp;
	char *pFound=NULL;
	char *pValue=NULL;
	char *pEnd=NULL;
	int nValueLen =0;
	int nBufferPos=0;

	pValue = pNext;
	DBGPRINTF("%s", pValue);
	while ( NULL!=(pFound=STRSTR(pNext, pszNewtag)))
	{
		pField[nPos].fID = type;
		pField[nPos].fType = AEEDB_FT_STRING;
		
		nBufferPos = STRLEN(pszTmp)-STRLEN(pValue);
		pField[nPos].pBuffer = pwzName+ nBufferPos;
		
		//value lenth
		nValueLen = STRLEN(pValue)-STRLEN(pFound);
		
		DBGPRINTF("%s", pValue);
		pField[nPos].wDataLen = (nValueLen+1)*sizeof(AECHAR);

		nPos++;
		pNext = pFound+1;
		pValue = pFound+ nTagLen;
	}

	DBGPRINTF("%s", pValue);
	pField[nPos].fID = type;
	pField[nPos].fType = AEEDB_FT_STRING;
	nBufferPos = STRLEN(pszTmp)-STRLEN(pValue);
	pField[nPos].pBuffer = pwzName+ nBufferPos;
	nValueLen=STRLEN(pValue);
	pField[nPos].wDataLen = (nValueLen+1)*sizeof(AECHAR);

	nPos++;

	FREEIF(pszTmp);

	AECHAR *pwzSart=pwzName;
	AECHAR *pwzEnd=NULL;
	AECHAR pwzNull = '\0';
	while ( NULL!=(pwzEnd=WSTRCHR(pwzSart, '<')))
	{
		*pwzEnd='\0';
		pwzSart = pwzEnd+4;
	}
	
}
Example #10
0
/*======================================================================= 
Function: SamplePosDet_QosSettings_HandleEvent()

Description: 
   Event handler function for the QoS settings menu.

Prototype:

   boolean SamplePosDet_QosSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode,
                                                 uint16 wParam, uint32 dwParam)

Parameters:
   pMe: [in]. CSamplePosDet instance.
   eCode: [in]. Event code.
   wParam: [in]. Event wParam.
   dwParam: [in]. Event dwParam.

Return Value:

   TRUE - If the event was handled by this menu.
   FALSE - If the event was not handled.
 
Comments:  
   None

Side Effects: 
   None

See Also:
   None
=======================================================================*/
boolean SamplePosDet_QosSettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode,
                                                 uint16 wParam, uint32 dwParam)
{
   boolean bHandled = FALSE;
   CTextCtlData *ptcd = SamplePosDet_GetScreenData( pMe );
   ITextCtl *pTextCtl = NULL;
   IMenuCtl *pSoftKeyMenu = NULL;
   char * pszStr;
   AECHAR * pQos;
   uint32 nResult;

   if (ptcd) {
      pSoftKeyMenu = ptcd->pSoftKey;
      pTextCtl = ptcd->pTextCtl;
   }

   switch( eCode ) {
   case EVT_SCREEN:
      if( wParam == SCREEN_PARAM_INIT ) {
         if( pTextCtl ) {  /* This is not expected to happen */
            SamplePosDet_DrawScreen( pMe, 0 );
            bHandled = TRUE;
         }
         else {
            if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_TEXTCTL, 
               (void **)&pTextCtl ) == SUCCESS ) {
               if (ISHELL_CreateInstance(pMe->theApp.m_pIShell, AEECLSID_SOFTKEYCTL,
                  (void **)&pSoftKeyMenu) == SUCCESS) {

                  IMENUCTL_AddItem( pSoftKeyMenu, SAMPLEPOSDET_RES_FILE, IDS_SOFTKEY_SAVE,
                     IDS_SOFTKEY_SAVE, NULL, (uint32)pSoftKeyMenu );

                  ITEXTCTL_SetSoftKeyMenu( pTextCtl, pSoftKeyMenu );
                  ITEXTCTL_SetTitle( pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_QOS_SETTINGS_TITLE, NULL );
                  ITEXTCTL_SetInputMode( pTextCtl, AEE_TM_NUMBERS );

                  // Load the current QoS value, if it exists
                  pszStr = MALLOC(50);
                  pQos = MALLOC(100);
                  SPRINTF(pszStr, "%d", pMe->gpsSettings.qos);
                  STRTOWSTR(pszStr, pQos, 100);
                  ITEXTCTL_SetText(pTextCtl, pQos, -1);
                  FREE(pszStr);
                  FREE(pQos);

                  ptcd = MALLOC( sizeof(CTextCtlData) );

                  ptcd->pSoftKey = pSoftKeyMenu;
                  ptcd->pTextCtl = pTextCtl;
                  SamplePosDet_SetScreenData( pMe, (void *)ptcd );
                  SamplePosDet_DrawScreen( pMe, 0 );
                  bHandled = TRUE;
               }
            }
         }
      }
      else if( wParam == SCREEN_PARAM_CLOSE ) {
         ITEXTCTL_Release( pTextCtl );
         IMENUCTL_Release( pSoftKeyMenu );
         FREE( ptcd );
         SamplePosDet_SetScreenData( pMe, 0 );
         pMe->currentHandler = 0;
         bHandled = TRUE;
      }
      else if( wParam == SCREEN_PARAM_PAINT ) {
         if( ITEXTCTL_IsActive( pTextCtl ) ) {
            ITEXTCTL_Redraw( pTextCtl );
         }
         else {
            ITEXTCTL_SetActive( pTextCtl, TRUE );  /* Also causes a menu draw */
         }
      }
      break;

   case EVT_KEY:
   case EVT_KEY_PRESS:
   case EVT_KEY_RELEASE:
      bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam );
      if (!bHandled) {
         bHandled = IMENUCTL_HandleEvent( pSoftKeyMenu, eCode, wParam, dwParam );
         
         if(!bHandled && wParam == AVK_CLR && eCode == EVT_KEY) {
            SamplePosDet_GotoScreen( pMe, SCREENID_CONFIG, 0 );
            bHandled = TRUE;
         }
      }
      break;
   case EVT_COMMAND:
      bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam );
      if (!bHandled) {
         if (IDS_SOFTKEY_SAVE == wParam) {
            // Need to validate and save the Port settings here
            pQos = ITEXTCTL_GetTextPtr(pTextCtl);
            pszStr = MALLOC(50);
            WSTRTOSTR(pQos, pszStr, 50);
            nResult = STRTOUL(pszStr, NULL, 10);
            if (nResult >= 0 && nResult <= 255) {
               pMe->gpsSettings.qos = (AEEGPSQos)nResult;
               SamplePosDet_SaveGPSSettings(pMe);
               SamplePosDet_GotoScreen(pMe, SCREENID_CONFIG, 0);
            }
            else {
               ITEXTCTL_SetTitle(pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_QOS_SETTINGS_INVALID, NULL);
               ITEXTCTL_Redraw(pTextCtl);
            }
            FREE(pszStr);
            bHandled = TRUE;
         }
      }
      break;
   }
   return bHandled;
}
Example #11
0
/*======================================================================= 
Function: SamplePosDet_PDESettings_HandleEvent()

Description: 
   Event handler function for the PDE settings menu.

Prototype:

   boolean SamplePosDet_PDESettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode,
                                                 uint16 wParam, uint32 dwParam)

Parameters:
   pMe: [in]. CSamplePosDet instance.
   eCode: [in]. Event code.
   wParam: [in]. Event wParam.
   dwParam: [in]. Event dwParam.

Return Value:

   TRUE - If the event was handled by this menu.
   FALSE - If the event was not handled.
 
Comments:  
   None

Side Effects: 
   None

See Also:
   None
=======================================================================*/
boolean SamplePosDet_PDESettings_HandleEvent(CSamplePosDet *pMe, AEEEvent eCode,
                                                 uint16 wParam, uint32 dwParam)
{
   AECHAR * pServer;
   uint32 nResult;
   boolean bHandled = FALSE;
   CTextCtlData *ptcd = SamplePosDet_GetScreenData( pMe );
   ITextCtl *pTextCtl = NULL;
   IMenuCtl *pSoftKeyMenu = NULL;
   char * pszStr;

   if (ptcd) {
      pSoftKeyMenu = ptcd->pSoftKey;
      pTextCtl = ptcd->pTextCtl;
   }

   switch( eCode ) {
   case EVT_SCREEN:
      if( wParam == SCREEN_PARAM_INIT ) {
         if( pTextCtl ) {  /* This is not expected to happen */
            SamplePosDet_DrawScreen( pMe, 0 );
            bHandled = TRUE;
         }
         else {
            if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_TEXTCTL, 
               (void **)&pTextCtl ) == SUCCESS ) {
               if (ISHELL_CreateInstance(pMe->theApp.m_pIShell, AEECLSID_SOFTKEYCTL,
                  (void **)&pSoftKeyMenu) == SUCCESS) {

                  IMENUCTL_AddItem( pSoftKeyMenu, SAMPLEPOSDET_RES_FILE, IDS_SOFTKEY_SAVE,
                     IDS_SOFTKEY_SAVE, NULL, (uint32)pSoftKeyMenu );

                  ITEXTCTL_SetSoftKeyMenu( pTextCtl, pSoftKeyMenu );
                  ITEXTCTL_SetTitle( pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_PDE_SETTINGS_TITLE, NULL );
                  ITEXTCTL_SetInputMode( pTextCtl, AEE_TM_NUMBERS );

                  // Load the current IP address, if it exists
                  if (AEEGPS_SERVER_IP == pMe->gpsSettings.server.svrType) {
                     pszStr = MALLOC(50);
                     INET_NTOA(pMe->gpsSettings.server.svr.ipsvr.addr, pszStr, 50);
                     pServer = MALLOC(100);
                     STRTOWSTR(pszStr, pServer, 100);
                     ITEXTCTL_SetText(pTextCtl, pServer, -1);
                     FREE(pszStr);
                     FREE(pServer);
                  }

                  ptcd = MALLOC( sizeof(CTextCtlData) );
                  
                  ptcd->pSoftKey = pSoftKeyMenu;
                  ptcd->pTextCtl = pTextCtl;
                  SamplePosDet_SetScreenData( pMe, (void *)ptcd );
                  SamplePosDet_DrawScreen( pMe, 0 );
                  bHandled = TRUE;
               }
            }
         }
      }
      else if( wParam == SCREEN_PARAM_CLOSE ) {
         ITEXTCTL_Release( pTextCtl );
         IMENUCTL_Release( pSoftKeyMenu );
         FREE( ptcd );
         SamplePosDet_SetScreenData( pMe, 0 );
         pMe->currentHandler = 0;
         bHandled = TRUE;
      }
      else if( wParam == SCREEN_PARAM_PAINT ) {
         if( ITEXTCTL_IsActive( pTextCtl ) ) {
            ITEXTCTL_Redraw( pTextCtl );
         }
         else {
            ITEXTCTL_SetActive( pTextCtl, TRUE );  /* Also causes a menu draw */
         }
      }
      break;

   case EVT_KEY:
   case EVT_KEY_PRESS:
   case EVT_KEY_RELEASE:
      bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam );
      if (!bHandled) {
         bHandled = IMENUCTL_HandleEvent( pSoftKeyMenu, eCode, wParam, dwParam );
         
         if(!bHandled && wParam == AVK_CLR && eCode == EVT_KEY) {
            SamplePosDet_GotoScreen( pMe, SCREENID_SERVER_SETTINGS, 0 );
            bHandled = TRUE;
         }
      }
      break;

   case EVT_COMMAND:
      bHandled = ITEXTCTL_HandleEvent( pTextCtl, eCode, wParam, dwParam );
      if (!bHandled) {
         if (IDS_SOFTKEY_SAVE == wParam) {   // Save the new IP address
            pServer = ITEXTCTL_GetTextPtr(pTextCtl);
            pszStr = MALLOC(50);
            WSTRTOSTR(pServer, pszStr, 50);
            if (INET_ATON(pszStr, &nResult)) {
               pMe->gpsSettings.server.svrType = AEEGPS_SERVER_IP;
               pMe->gpsSettings.server.svr.ipsvr.addr = nResult;
               SamplePosDet_SaveGPSSettings(pMe);
               SamplePosDet_GotoScreen(pMe, SCREENID_PORT_SETTINGS, 0);
            }
            else {
               ITEXTCTL_SetTitle(pTextCtl, SAMPLEPOSDET_RES_FILE, IDS_PDE_SETTINGS_INVALID, NULL);
               ITEXTCTL_Redraw(pTextCtl);
            }
            FREE(pszStr);
            // add code to save the new PDE IP address
            bHandled = TRUE;
         }
      }
      break;
   }
   return bHandled;
}
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);
}
Example #13
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;
}