Пример #1
0
void TS_SetMenuAttr(IMenuCtl * pMenu, AEECLSID clsMenu, uint16 nColorDepth, AEERect * pRect, uint32 dwProps)
{
	AEEItemStyle		sel, normal;
	AEEMenuColors		col;

	// Menu Style
	normal.ft = MENU8_FT;
	normal.xOffset = 0;
	normal.yOffset = 0;
	normal.roImage = MENU8_RO;

    sel.ft = MENU8_SELECT_FT;
	sel.xOffset = 0;
	sel.yOffset = 0;
	sel.roImage = MENU8_SELECT_RO;

	// Menu Colors
    col.cSelText = MENU8_SELECT_TEXT;
	col.wMask = MENU8_COLOR_MASK;

   if (clsMenu == AEECLSID_MENUCTL)
   {
	   col.cBack = MENU8_BACKGROUND;
	   col.cSelBack = MENU8_SELECT_BACKGROUND;

      dwProps |= IMENUCTL_GetProperties(pMenu);
   }
   else if (clsMenu == AEECLSID_SOFTKEYCTL || clsMenu == AEECLSID_ICONVIEWCTL)
   {
	   col.cBack = TB8_BACKGROUND;
	   col.cSelBack = TB8_SELECT_BACKGROUND;

      dwProps |= MP_ICON_TEXT_TOP | MP_NO_ARROWS;
   }

   if (clsMenu == AEECLSID_MENUCTL || clsMenu == AEECLSID_SOFTKEYCTL || clsMenu == AEECLSID_ICONVIEWCTL)
   {
	   IMENUCTL_SetStyle(pMenu, &normal, &sel);
	   IMENUCTL_SetColors(pMenu, &col);
	   IMENUCTL_SetProperties(pMenu, dwProps);
      if (pRect)
         IMENUCTL_SetRect(pMenu, pRect);
   }
}
Пример #2
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;
}
Пример #3
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;
}