Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All,

I am working on an application where i need to get the existing SMS from the Inbox. I am doing this in the following way:

1. On EVT_APP_START, creating the instances for AEECLSID_SMSSTORAGE and AEECLSID_SMSMSG.

2. On Success, initialize a Call Back for ISMSStorage_GetStorageStatus.

3. After getting the Inbox Slots, do ISMSSTORAGE_ReadMsg until we read the last message in the Inbox.

But the problem here is: "When i execute ISMSStorage_GetStorageStatus its crashing on Simulator as well as on the device. I tried this on LG VX9800."

Here is a code snippet:

case EVT_APP_START:

pMe->nErr = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE, (void **)&pMe->pSMSStorage);

if(SUCCESS == pMe->nErr)
{
pMe->nErr = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->pSMSMsg);
if(SUCCESS == pMe->nErr)
{
ReadAllSMS(pMe);
}
else
{
DBGPRINTF("Failed to initialize");
}
}

ReadAllSMS():

CALLBACK_Cancel(&pMe->cb);
CALLBACK_Init(&pMe->cb, StorageStatusCb, (void *)pMe);

pMe->nCount = 0;

ISMSSTORAGE_GetStorageStatus(pMe->pSMSStorage, AEESMS_NV_CDMA, AEESMS_TAG_NONE, &pMe->cb, &pMe->pIStatus, &pMe->nErr);

StorageStatusCb():

ismsstorage *pMe = (ismsstorage *)po;

if(SUCCESS == pMe->nErr)
{
if(0 == pMe->nCount)
{
DBGPRINTF("Size: %d", pMe->pIStatus.nSize);
DBGPRINTF("Max Slots: %d", pMe->pIStatus.nMaxSlots);
DBGPRINTF("Free Slots: %d", pMe->pIStatus.nFreeSlots);
DBGPRINTF("Used Slots: %d", pMe->pIStatus.nUsedTagSlots);
}

if(pMe->nCount < (pMe->pIStatus.nMaxSlots - pMe->pIStatus.nFreeSlots))
{
CALLBACK_Cancel(&pMe->cb);
CALLBACK_Init(&pMe->cb, ReadSMSCb, (void *)pMe);

pMe->nIndex = pMe->nCount;

ISMSSTORAGE_ReadMsg(pMe->pSMSStorage, AEESMS_NV_CDMA, pMe->nIndex, &pMe->cb, (ISMSMsg **)&pMe->pSMSMsg, &pMe->nErr);

pMe->nCount++;
}
}

ReadSMSCb():

ismsstorage *pMe = (ismsstorage *)po;

if (pMe->nErr == SUCCESS)
{
ISMSMsg* pISMSMsgRead = (ISMSMsg *)pMe->pSMSMsg;
SMSMsgOpt smo;

DBGPRINTF("Read: SUCCESS");
if(ISMSMSG_GetOpt(pISMSMsgRead, MSGOPT_PAYLOAD_SZ, &smo) == SUCCESS)
{
DBGPRINTF("Message: %s", (char*)smo.pVal);

StorageStatusCb(pMe);
}
else
{
DBGPRINTF("Message: Error");
}
}
else
{
DBGPRINTF("Read: FAILED");
}

Can any one let me know whtz going wrong here..Thanks a lot in advance.

Cheers,
Sunil

let try to check you create the AEECLSID_SMSSTORAGE,AEECLSID_SMSMSG successfully
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE, (void **)&pMe->pSMSStorage);
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->pSMSMsg);

let try to check you create the AEECLSID_SMSSTORAGE,AEECLSID_SMSMSG successfully
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE, (void **)&pMe->pSMSStorage);
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSMSG, (void **)&pMe->pSMSMsg);

Hello vnnweb
After creating the instances of SMSMSG and SMSSTORAGE successfully, i am doing all these stuff. You can check that in the above code. Creating instances was successful. Any way thanks for ur reply. Wanted more info on these issue... :(
Thanks & Regards
Sunil

Hello vnnweb
After creating the instances of SMSMSG and SMSSTORAGE successfully, i am doing all these stuff. You can check that in the above code. Creating instances was successful. Any way thanks for ur reply. Wanted more info on these issue... :(
Thanks & Regards
Sunil

Is it the exact code? looks like you have added ReadAllSMS():,StorageStatusCb(): If these stmt means those are executed, then getstatus is not having problem as the callback is called.
Otherwise I dont see any return from the failure of the createinstance.
Also you didnt give all the code involved "&pMe->pIStatus, &pMe->nErr". Not sure if these are just pointers or exact data type.

Is it the exact code? looks like you have added ReadAllSMS():,StorageStatusCb(): If these stmt means those are executed, then getstatus is not having problem as the callback is called.
Otherwise I dont see any return from the failure of the createinstance.
Also you didnt give all the code involved "&pMe->pIStatus, &pMe->nErr". Not sure if these are just pointers or exact data type.

You must be using simulator version 3.1.2. Use 3.1.5 if you are testing on simulator. Also, before trying on device, check if the device supports ISMSStorage.

You must be using simulator version 3.1.2. Use 3.1.5 if you are testing on simulator. Also, before trying on device, check if the device supports ISMSStorage.

hi malayp...
did u able to read messages from inbox using ISMSSTORAGE api......

hi malayp...
did u able to read messages from inbox using ISMSSTORAGE api......

Yes. On BREW 3.1.4 and 3.1.5.

Yes. On BREW 3.1.4 and 3.1.5.

Hi Malay,
I am working on an app which displays the count of unread SMS messages.Iam using ISMSStorage_GetStorageStatus() API for this.But Iam getting always 0 (zero) as the count regardless of the storage type.
now tell me, whether i should use in addition any other APIs like ISMSSTORAGE_EnumMsgInit() first to make the INIT and then call this API ISMSStorage_GetStorageStatus() ?
currently Iam having a status call back function for this ISMSStorage_GetStorageStatus() and then loop around to get the number of unread SMS count.Pls tell whether iam missing out anything. (the storage type iam using is AEESMS_NV_CDMA).
Thanks
Naren

Hi Malay,
I am working on an app which displays the count of unread SMS messages.Iam using ISMSStorage_GetStorageStatus() API for this.But Iam getting always 0 (zero) as the count regardless of the storage type.
now tell me, whether i should use in addition any other APIs like ISMSSTORAGE_EnumMsgInit() first to make the INIT and then call this API ISMSStorage_GetStorageStatus() ?
currently Iam having a status call back function for this ISMSStorage_GetStorageStatus() and then loop around to get the number of unread SMS count.Pls tell whether iam missing out anything. (the storage type iam using is AEESMS_NV_CDMA).
Thanks
Naren