首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Brew >

brew ISMSSTORAGE_DeleteAll如何使用

2012-02-25 
brew ISMSSTORAGE_DeleteAll怎么使用?没找到相应的资料,我是这样做的ISHELL_CreateInstance(pMe-a.m_pISh

brew ISMSSTORAGE_DeleteAll怎么使用?
没找到相应的资料,我是这样做的
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE , (void**)&pMe->pISMSStorage);

ISMSSTORAGE_QueryInterface (pMe->pISMSStorage, AEEIID_MODEL , (void **)&pMe->pIModel);

IModel_AddListener(pMe->pIModel, pMe->pIModelLst);

ISMSSTORAGE_DeleteAll(pMe->pISMSStorage, (AEESMSStorageType)AEESMS_NV_CDMA, (AEECallback *)delete_cb, &(pMe->p_er));

前3步都可以,最后一步就崩了。。。

看reference里面的介绍,执行完成delete后,会发送一个EVT_MDL_SMSSTORAGE_DELETE_ALL到client, 这个client指的是当前application吗?这个event是需要listeners来接收吗?那ISMSSTORAGE_DeleteAll中定义的callback function又有什么作用呢?这个流程具体是怎么样的?

谁有这方面的资料,或者知道怎么做的,请留言,非常感谢。。。

对了,还有brew手机有lock的api吗?

[解决办法]
delete_cb是删除成功之后的Callback吧。
是不是这个Callback没有进行设置啊,之后调用时崩溃了。
[解决办法]
AEECallback结构是这样的:

C/C++ code
   struct _AEECallback   {      AEECallback*        pNext;      void*               pmc;      CallbackCancelFunc* pfnCancel;      void*               pCancelData;      CallbackNotifyFunc* pfnNotify;      void*               pNotifyData;      void*               pReserved;   };
[解决办法]
首先MIF文件中设置Dependencies
然后修改代码:
C/C++ code
#include "AEEModGen.h"  #include "AEEAppGen.h"  #include "AEEShell.h"  #include "AEE.h"#include "AEETapi.h"  #include "AEEStdlib.h"#include "AEESMS.h"#include "AEEAddrBook.h"#include "brew_phone_number.bid"typedef struct _brew_phone_number {    AEEApplet      a ;       AEEDeviceInfo  DeviceInfo;    IShell            *pIShell;    ITAPI            *pITAPI;    ISMS            *pISMS;    ISMSMsg            *pISMSMsg;    IAddrBook        *pIADDR_RUIM;    IAddrBook        *pIADDR;    ISMSStorage        *pISMSStorage;    uint32            p_er;    IModel            *pIModel;    ModelListener    *pIModelLst;    AEECallback  cb;    boolean            m_bGoBg;} brew_phone_number;static  boolean brew_phone_number_HandleEvent(brew_phone_number* pMe,                                                    AEEEvent eCode, uint16 wParam,                                                    uint32 dwParam);boolean brew_phone_number_InitAppData(brew_phone_number* pMe);void    brew_phone_number_FreeAppData(brew_phone_number* pMe);void delete_cb(void *po);int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj){    *ppObj = NULL;    if( ClsId == AEECLSID_BREW_PHONE_NUMBER )    {        // Create the applet and make room for the applet structure        if( AEEApplet_New(sizeof(brew_phone_number),                          ClsId,                          pIShell,                          po,                          (IApplet**)ppObj,                          (AEEHANDLER)brew_phone_number_HandleEvent,                          (PFNFREEAPPDATA)brew_phone_number_FreeAppData) ) // the FreeAppData function is called after sending EVT_APP_STOP to the HandleEvent function                                  {            //Initialize applet data, this is called before sending EVT_APP_START            // to the HandleEvent function            if(brew_phone_number_InitAppData((brew_phone_number*)*ppObj))            {                //Data initialized successfully                return(AEE_SUCCESS);            }            else            {                //Release the applet. This will free the memory allocated for the applet when                // AEEApplet_New was called.                IAPPLET_Release((IApplet*)*ppObj);                return EFAILED;            }        } // end AEEApplet_New    }    return(EFAILED);}static boolean brew_phone_number_HandleEvent(brew_phone_number* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam){      int res;    int len;    len = 20;    switch (eCode)     {        case EVT_APP_START:                   res = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_SMSSTORAGE , (void**)&pMe->pISMSStorage);            if(res != SUCCESS)                DBGPRINTF("create instance returns %d !\n",res);            DBGPRINTF("NOW STRING..........\n");            if(pMe->m_bGoBg) {                ISHELL_CloseApplet(pMe->pIShell, FALSE);            }                res = ISMSSTORAGE_QueryInterface (pMe->pISMSStorage, AEEIID_MODEL , (void **)&pMe->pIModel);                DBGPRINTF("____________res = %d!\n",res);            res = IModel_AddListener(pMe->pIModel, pMe->pIModelLst);            DBGPRINTF("____________res = %d!\n",res);            ISMSSTORAGE_DeleteAll(pMe->pISMSStorage, (AEESMSStorageType)AEESMS_NV_CDMA, &(pMe->cb), &(pMe->p_er));            DBGPRINTF("________________delete error: %d\n",pMe->p_er);            return(TRUE);        case EVT_MDL_SMSSTORAGE_DELETE_ALL:            DBGPRINTF("recv delete all event!!!!!!!!!!!!!!!!!!!!!!!\n");            return(TRUE);        // App is told it is exiting        case EVT_APP_STOP:            // Add your code here...            if(pMe->m_bGoBg) {                *((boolean*) dwParam) = FALSE;            }              return(TRUE);        // App is being suspended         case EVT_APP_SUSPEND:            // Add your code here...              return(TRUE);        // App is being resumed        case EVT_APP_RESUME:            // Add your code here...              return(TRUE);    case EVT_NOTIFY:            {                AEENotify* temp = (AEENotify*)dwParam;                if (temp && (temp->cls == AEECLSID_SHELL))  // event sender                 {                     if ((temp->dwMask & NMASK_SHELL_INIT) == NMASK_SHELL_INIT)                     {                         // AEECLSID_SHELLINIT ?本?用                         ISHELL_StartApplet(pMe->a.m_pIShell, AEECLSID_BREW_PHONE_NUMBER);                     }                 }                 return TRUE;            }                case EVT_APP_MESSAGE:            // Add your code here...            DBGPRINTF("in APP message\n");              return(TRUE);        case EVT_KEY:            // Add your code here...              return(TRUE);       default:            break;   }   return FALSE;}boolean brew_phone_number_InitAppData(brew_phone_number* pMe){    pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);    ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);    pMe->pIShell = pMe->a.m_pIShell;    pMe->pITAPI = NULL;    pMe->pISMS = NULL;    pMe->pISMSMsg = NULL;    pMe->pISMSStorage = NULL;    pMe->pIModelLst = (ModelListener*)MALLOC(sizeof(ModelListener));    pMe->m_bGoBg = 1;   CALLBACK_Init(&pMe->cb, delete_cb, pMe);    return TRUE;}void brew_phone_number_FreeAppData(brew_phone_number* pMe){}void delete_cb(void *po){    brew_phone_number *pMe = (brew_phone_number*)po;    DBGPRINTF("_______________delete_cb\n");} 


[解决办法]
你应该去qualcomm的example里面看看IModel_AddListener是怎么用的。。。
pMe->pIModelLst没有初始化。。。Listener在哪,

C/C++ code
   //这里一组操作,基本上都是一起的,以成组出现的。   LISTENER_Cancel(&me->modelListener);   LISTENER_Init(&me->modelListener, BitmapWidget_ModelChanged, me);   nErr = IMODEL_AddListener(me->base.piModel, &me->modelListener);
[解决办法]
探讨
。。。

看reference里面的介绍,执行完成delete后,会发送一个EVT_MDL_SMSSTORAGE_DELETE_ALL到client, 这个client指的是当前application吗?这个event是需要listeners来接收吗?
。。。

[解决办法]
Dependencies里面我加了一个NetWork,和一个SMSMAINCLIENT就可以啊、
[解决办法]
探讨
引用:
引用:
引用:
Dependencies里面我加了一个NetWork,和一个SMSMAINCLIENT就可以啊、


为什么我的不行呢?我加了两个之后,还是create不成功,返回还是3.。。。。郁闷了
我这里成功了,返回Success

我把前面加上SMS的create instance,然后成功了,可能有依赖?
下面的问题是EVT_MDL_SMSSTORAGE_DELETE_ALL在哪里接收?
delete_cb又需要处理什么。。。。。没有真机测试,先问问,呵呵

热点排行