static void OATSMS_EnumMsgNextCb(void * po) { int nErr = SUCCESS; ISmsApp * pMe = (ISmsApp *)po; DBGPRINTF("OATSMS_EnumMsgNextCb"); if (SUCCESS == (nErr = pMe->m_dwStatus)) { showSMS(pMe, pMe->m_pISMSMsg); pMe->m_pISMSMsg = NULL; // initial for next time // no item left == mean ending if (0xFFFFFFFF != pMe->m_dwIndex) { CALLBACK_Cancel(&pMe->EnumMsgNextCb); CALLBACK_Init(&pMe->EnumMsgNextCb, OATSMS_EnumMsgNextCb, (void*)pMe); ISMSSTORAGE_EnumNextMsg(pMe->m_pISMSStorage, pMe->m_mt, &pMe->EnumMsgNextCb, &pMe->m_dwIndex, &pMe->m_pISMSMsg, &pMe->m_dwStatus); } else { DBGPRINTF("OATSMS_EnumMsgNextCb end"); } } else { DBGPRINTF("EnumMsgNextfailed (nErr=%d)", pMe->m_dwStatus); } }
/*=========================================================================== FUNCTION ISmsApp_FreeAppData DESCRIPTION Frees any data and interfaces used by this app. PROTOTYPE: static void ISmsApp_FreeAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE None. SIDE EFFECTS None. ===========================================================================*/ static void ISmsApp_FreeAppData(IApplet* pi) { ISmsApp * pMe = (ISmsApp*)pi; CALLBACK_Cancel(&pMe->m_cb); if(pMe->m_pIMenu != NULL) { IMENUCTL_Release(pMe->m_pIMenu); pMe->m_pIMenu = NULL; } if(pMe->m_pISMSMsg != NULL) { ISMSMSG_Release(pMe->m_pISMSMsg); pMe->m_pISMSMsg = NULL; } if(pMe->m_pISMS != NULL) { ISMS_Release(pMe->m_pISMS); pMe->m_pISMS = NULL; } }
/*=========================================================================== ===========================================================================*/ static void SamplePosDet_GetGPSInfo_Callback( CSamplePosDet *pMe ) { struct _GetGPSInfo *pGetGPSInfo = SamplePosDet_GetScreenData( pMe ); GetGPSInfo_PaintRegions rgn = GETGPSINFO_PAINT_FIXDATA; if( pGetGPSInfo->theInfo.nErr == SUCCESS ) { /* Process new data from IPosDet */ pGetGPSInfo->dwFixNumber++; pGetGPSInfo->dwFixDuration += pGetGPSInfo->wProgress; pGetGPSInfo->wProgress = 0; } else if( pGetGPSInfo->theInfo.nErr == EIDLE ) { /* End of tracking */ CALLBACK_Cancel( &pGetGPSInfo->cbProgressTimer ); } else if( pGetGPSInfo->theInfo.nErr == AEEGPS_ERR_TIMEOUT ) { /* Record the timeout and perhaps re-try. */ pGetGPSInfo->dwTimeout++; rgn = GETGPSINFO_PAINT_FIXCOUNT; } else { DBGPRINTF("@Something is not right here. Requires corrective action. Bailout"); /* Something is not right here. Requires corrective action. Bailout */ pGetGPSInfo->bAbort = TRUE; rgn = GETGPSINFO_PAINT_ERROR; } SamplePosDet_DrawScreen( pMe, (uint32)rgn ); }
void StatusBox_Dtor(StatusBox *me) { FREEIF(me->pStringData); CALLBACK_Cancel(&me->cb); RELEASEIF(me->piImage); ZEROAT(me); }
void Tooltip_Dtor(Tooltip *me) { FREEIF(me->pStringData); RELEASEIF(me->piDisplay); RELEASEIF(me->piShell); CALLBACK_Cancel(&me->cb); ZEROAT(me); }
void Tooltip_Cancel(Tooltip *me) { if (me->bShown) { me->pfnInvalidate(me->pInvalidateData); } me->bShown = FALSE; CALLBACK_Cancel(&me->cb); }
void StatusBox_Stop(StatusBox *me) { me->bActive = FALSE; me->bStarted = FALSE; if ((IImage *)0 != me->piImage) { IIMAGE_Stop(me->piImage); } CALLBACK_Cancel(&me->cb); me->pfnInvalidate(me->pInvalidateData); }
static void Loc_Cancel( AEECallback *pcb ) { LocState *pts = (LocState *)pcb->pCancelData; if( TRUE == pts->bInNotification ) { /* It is not safe to cleanup from a notification. Defer it. */ pts->bSetForCancellation = TRUE; return; } /* Kill any ongoing process */ CALLBACK_Cancel( &pts->cbInfo ); CALLBACK_Cancel( &pts->cbIntervalTimer ); pts->pcbResp->pfnCancel = 0; pts->pcbResp->pCancelData = 0; IPOSDET_Release( pts->pPos ); ISHELL_Release( pts->pShell ); FREE( pts ); }
/*======================================================================= Function: Loc_Stop() =======================================================================*/ int Loc_Stop( LocState *pts ) { if( !pts ) { return EBADPARM; } pts->bInProgress = FALSE; /* Kill any ongoing process */ CALLBACK_Cancel( &pts->cbInfo ); CALLBACK_Cancel( &pts->cbIntervalTimer ); /* Report that Locing is halted */ pts->pResp->nErr = EIDLE; //Loc_Notify( pts ); if( TRUE == pts->bSetForCancellation ) { Loc_Cancel( pts->pcbResp ); } return SUCCESS; }
/*======================================================================= Function: Loc_Init() =======================================================================*/ int Loc_Init( IShell *pIShell, IPosDet *pIPos, AEECallback *pcb, LocState **po ) { int nErr = SUCCESS; LocState *pts = NULL; if( !pIShell || !pIPos || !pcb || !po ) { nErr = EBADPARM; } else if( NULL == (pts = MALLOC( sizeof(LocState) )) ){ nErr = ENOMEMORY; } else { ZEROAT( pts ); pts->pShell = pIShell; ISHELL_AddRef( pIShell ); pts->pPos = pIPos; IPOSDET_AddRef( pIPos ); /* Install the notification cb */ CALLBACK_Cancel( pcb ); pts->pcbResp = pcb; pts->pcbResp->pfnCancel = Loc_Cancel; pts->pcbResp->pCancelData = pts; CALLBACK_Init( &pts->cbIntervalTimer, Loc_cbInterval, pts ); CALLBACK_Init( &pts->cbInfo, Loc_cbInfo, pts ); } *po = pts; return nErr; }
static void OATSMS_EnumMsgInitCb(void * po) { ISmsApp * pMe = (ISmsApp *)po; DBGPRINTF("OATSMS_EnumMsgInitCb"); pMe->m_pISMSMsg = NULL; // initial to save msg if (SUCCESS == pMe->m_dwStatus) { CALLBACK_Cancel(&pMe->EnumMsgNextCb); CALLBACK_Init(&pMe->EnumMsgNextCb, OATSMS_EnumMsgNextCb, (void*)pMe); ISMSSTORAGE_EnumNextMsg(pMe->m_pISMSStorage, pMe->m_mt, &pMe->EnumMsgNextCb, &pMe->m_dwIndex, &pMe->m_pISMSMsg, &pMe->m_dwStatus); } else { DBGPRINTF("EnumMsgInit failed (nErr=%d)", pMe->m_dwStatus); } }
void setSharedTimerFireTime(double fireTime) { ASSERT(sharedTimerFiredFunction); CALLBACK_Cancel(&sharedTimerCallback); double interval = fireTime - currentTime(); int intervalInMS; if (interval < 0) intervalInMS = 0; else { interval *= 1000; intervalInMS = static_cast<int>(interval); } sharedTimerCallback.pfnCancel = 0; sharedTimerCallback.pfnNotify = invokeCallback; sharedTimerCallback.pNotifyData = 0; IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; ISHELL_SetTimerEx(shell, intervalInMS, &sharedTimerCallback); }
/*============================================================================= FUNCTION: OEMCardSessionNotifier_Release DESCRIPTION: Decreases the number of references to the ICardSessionNotifier object. If the last reference is removed, it deallocates the object. DEPENDENCIES: None SIDE EFFECTS: None =============================================================================*/ uint32 OEMCardSessionNotifier_Release( ICardSessionNotifier *pMe) { MSG_HIGH("OEMCardSessionNotifier_Release", 0, 0, 0); if (NULL == pMe) return (0); if (pMe->m_uRefs == 0) return 0; if (--pMe->m_uRefs) return pMe->m_uRefs; /* Ref count is zero. Release memory */ if (pMe->m_coreObj) { (void) OEMCardSessionCore_Release(); pMe->m_coreObj = NULL; } CALLBACK_Cancel(&pMe->m_cbExit); FREE(pMe); switch(pMe->m_u8Slot) { case OEMCARDSESSION_SLOT1: ICardSessionNotifierObj_Slot1 = NULL; break; case OEMCARDSESSION_SLOT2: ICardSessionNotifierObj_Slot2 = NULL; break; default: MSG_ERROR("Unknown Slot for Notifier 0x%x", pMe->m_u8Slot, 0, 0); break; } return (0); }
/*=========================================================================== FUNCTION SampleAppWizard_HandleEvent DESCRIPTION This is the EventHandler for this app. All events to this app are handled in this function. All APPs must supply an Event Handler. PROTOTYPE: boolean SampleAppWizard_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam) PARAMETERS: pi: Pointer to the AEEApplet structure. This structure contains information specific to this applet. It was initialized during the AEEClsCreateInstance() function. ecode: Specifies the Event sent to this applet wParam, dwParam: Event specific data. DEPENDENCIES none RETURN VALUE TRUE: If the app has processed the event FALSE: If the app did not process the event SIDE EFFECTS none ===========================================================================*/ static boolean MemChecker_HandleEvent(MemChecker* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam) { #if 1 // for debugging if (EVT_POINTER_DOWN == eCode) { AEERect rc; int x, y; AEE_POINTER_GET_XY((char *)dwParam, &x, &y); SETAEERECT(&rc, x, y, 2, 2); IDisplay_FillRect(pMe->a.m_pIDisplay, &rc, RGB_BLACK); IDisplay_Update(pMe->a.m_pIDisplay); } #endif if (pMe->m_pIDesktopWindow && IDesktopWindow_HandleEvent(pMe->m_pIDesktopWindow, eCode, wParam, dwParam)) { return TRUE; } switch (eCode) { // App is told it is starting up case EVT_APP_START: DBGPRINTF("##MemChecker_HandleEvent: EVT_APP_START ##############"); if (pMe->m_bBackground) { pMe->m_bBackground = FALSE; IContainer_Invalidate((IContainer *)pMe->m_pIDesktopWindow, NULL, NULL); return TRUE; } ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_APPLETCTL, (void **)&pMe->m_pIAppletCtl); IniFileParser_LoadFile(pMe->a.m_pIShell, MemChecker_ParseLineCB, pMe); // ClassFactory & DestopWindow pMe->m_pIClassFactory = XClassFactory_New(); IClassFactory_CreateInstance(pMe->m_pIClassFactory, XCLSID_DesktopWindow, (void **)&pMe->m_pIDesktopWindow); IWidget_SetName((IWidget*)pMe->m_pIDesktopWindow, "DesktopWindow"); IDesktopWindow_SetDisplay(pMe->m_pIDesktopWindow, pMe->a.m_pIDisplay); IWidget_SetRectEx((IWidget*)pMe->m_pIDesktopWindow, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen); MemChecker_CreateMainMenu(pMe); return(TRUE); // App is told it is exiting case EVT_APP_STOP: DBGPRINTF("##MemChecker_HandleEvent: EVT_APP_STOP ###################"); if (pMe->m_bBackground) { *(boolean *)dwParam = FALSE; return TRUE; } CALLBACK_Cancel(&pMe->m_cbModUnload); CALLBACK_Cancel(&pMe->m_cbWaitForAppStartup); MemHook_Uninstall(); RELEASEIF(pMe->m_pIClassFactory); RELEASEIF(pMe->m_pIDesktopWindow); RELEASEIF(pMe->m_pIAppletCtl); return(TRUE); // App is being suspended case EVT_APP_SUSPEND: DBGPRINTF("##MemChecker_HandleEvent: EVT_APP_SUSPEND ################"); return(TRUE); // App is being resumed case EVT_APP_RESUME: DBGPRINTF("##MemChecker_HandleEvent: EVT_APP_RESUME #################"); IContainer_Invalidate((IContainer *)pMe->m_pIDesktopWindow, NULL, NULL); return(TRUE); // An SMS message has arrived for this app. Message is in the dwParam above as (char *) // sender simply uses this format "//BREW:ClassId:Message", example //BREW:0x00000001:Hello World case EVT_APP_MESSAGE: // Add your code here... return(TRUE); // If nothing fits up to this point then we'll just break out default: break; } return FALSE; }
/*=========================================================================== ===========================================================================*/ boolean SamplePosDet_GetGPSInfo_HandleEvent( CSamplePosDet *pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam ) { boolean bHandled = FALSE; struct _GetGPSInfo *pGetGPSInfo = SamplePosDet_GetScreenData( pMe ); switch( eCode ) { case EVT_SCREEN: if( wParam == SCREEN_PARAM_INIT ) { if( pGetGPSInfo == 0 ) { pGetGPSInfo = MALLOC( sizeof( struct _GetGPSInfo ) ); if( pGetGPSInfo ) { int nErr = SUCCESS; ZEROAT( pGetGPSInfo ); pGetGPSInfo->theInfo.server = pMe->gpsSettings.server; pGetGPSInfo->theInfo.qos = pMe->gpsSettings.qos; pGetGPSInfo->theInfo.optim = pMe->gpsSettings.optim; pGetGPSInfo->wMainMenuEntry = (uint16)dwParam; SamplePosDet_SetScreenData( pMe, (void *)pGetGPSInfo ); if( ISHELL_CreateInstance( pMe->theApp.m_pIShell, AEECLSID_POSDET, (void **)&pGetGPSInfo->pPosDet ) == SUCCESS ) { CALLBACK_Init( &pGetGPSInfo->cbPosDet, SamplePosDet_GetGPSInfo_Callback, pMe ); CALLBACK_Init( &pGetGPSInfo->cbProgressTimer, SamplePosDet_GetGPSInfo_SecondTicker, pMe ); nErr = Track_Init( pMe->theApp.m_pIShell, pGetGPSInfo->pPosDet, &pGetGPSInfo->cbPosDet, &pGetGPSInfo->pts ); if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_ONE_SHOT ) { nErr = Track_Start( pGetGPSInfo->pts, TRACK_NETWORK, 1, 0, &pGetGPSInfo->theInfo ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_LOCAL ) { nErr = Track_Start( pGetGPSInfo->pts, TRACK_LOCAL, 0, 0, &pGetGPSInfo->theInfo ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_NETWORK ) { nErr = Track_Start( pGetGPSInfo->pts, TRACK_NETWORK, 0, 0, &pGetGPSInfo->theInfo ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_AUTO ) { nErr = Track_Start( pGetGPSInfo->pts, TRACK_AUTO, 0, 0, &pGetGPSInfo->theInfo ); } else { nErr = EFAILED; } SamplePosDet_DrawScreen( pMe, (uint32)GETGPSINFO_PAINT_ALL ); if( nErr != SUCCESS ) { pGetGPSInfo->theInfo.nErr = nErr; SamplePosDet_DrawScreen( pMe, (uint32)GETGPSINFO_PAINT_ERROR ); } else { ISHELL_SetTimerEx( pMe->theApp.m_pIShell, 1000, &pGetGPSInfo->cbProgressTimer ); } bHandled = TRUE; } } } if( !bHandled ) { SamplePosDet_GotoScreen( pMe, SCREENID_MAINMENU, 0 ); bHandled = TRUE; } } else if( wParam == SCREEN_PARAM_CLOSE ) { if( pGetGPSInfo ) { if( pGetGPSInfo->pPosDet ) { CALLBACK_Cancel( &pGetGPSInfo->cbProgressTimer ); CALLBACK_Cancel( &pGetGPSInfo->cbPosDet ); IPOSDET_Release( pGetGPSInfo->pPosDet ); } FREE( pGetGPSInfo ); } SamplePosDet_SetScreenData( pMe, 0 ); pMe->currentHandler = 0; bHandled = TRUE; } else if( wParam == SCREEN_PARAM_PAINT ) { if( !pGetGPSInfo->bPaused ) { SamplePosDet_GetGPSInfo_Paint( pMe, (GetGPSInfo_PaintRegions)dwParam ); } bHandled = TRUE; } break; case EVT_KEY: if( wParam == AVK_CLR || wParam == AVK_SOFT2) { Track_Stop(pGetGPSInfo->pts); if (pGetGPSInfo) { if (pGetGPSInfo->pPosDet) { CALLBACK_Cancel(&pGetGPSInfo->cbProgressTimer); CALLBACK_Cancel(&pGetGPSInfo->cbPosDet); IPOSDET_Release(pGetGPSInfo->pPosDet); } FREE(pGetGPSInfo); } SamplePosDet_GotoScreen( pMe, SCREENID_MAINMENU, 0 ); bHandled = TRUE; } break; case EVT_DIALOG_START: pGetGPSInfo->bPaused = TRUE; bHandled = TRUE; break; case EVT_DIALOG_END: pGetGPSInfo->bPaused = FALSE; SamplePosDet_DrawScreen( pMe, (uint32)GETGPSINFO_PAINT_ALL ); bHandled = TRUE; break; case EVT_COMMAND: break; } return bHandled; }
void Slider_Stop(Slider *me) { CALLBACK_Cancel(&me->cb); }
void stopSharedTimer() { CALLBACK_Cancel(&sharedTimerCallback); }
/*=========================================================================== 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; }