how to add call Logs through "ICALLHISTORY_AddEntry()" | developer.brewmp.com how to add call Logs through "ICALLHISTORY_AddEntry()" | developer.brewmp.com

Developer

how to add call Logs through "ICALLHISTORY_AddEntry()"

Forums:

Hi  I am using foolowing code to add call log: 

 

{

 

nErr = ISHELL_CreateInstance(pMe->piShell , AEECLSID_CALLHISTORY ,(void**)&pMe->pCallHistory);  

 

 nErr = ICALLHISTORY_EnumInitByCallType(pMe->pCallHistory,AEECALLHISTORY_CALL_TYPE_TO); 

 

 

 

 

AEECallHistoryEntry * pCHE 

 

pCHE = (AEECallHistoryEntry *)MALLOC(sizeof (AEECallHistoryEntry));

 

pCHE->pFields = (AEECallHistoryField *)MALLOC(sizeof (AEECallHistoryField));

 

pCHE->pFields->ClsId = 0;

 

pCHE->pFields->pData = 460;

 

pCHE->pFields->wDataLen =10;

pCHE->pFields->wID =1;

pCHE->wNumFields = 4; 

nErr = ICALLHISTORY_AddEntry(pMe->pCallHistory,pCHE);

 

 

FREE(pCHE->pFields);

 

 

FREE(pCHE);

 

 

}

 

 

 But i am unable to add call logs.

so pleease tell me , how to add call logs in simulator or is their any other way.

 

Thanks,

there seems to be some issues in the code:-
1. pCHE->wNumFields = 4; // this is the number of fields allocated in pCHE->pFields. you have assigned it a value of 4 but you have added one feild.
2. The entry in feild in invalid:-
 pCHE->pFields->wID =1; // the values are defined in AEECallHistory.h - you assign it to 1 which is AEECALLHISTORY_FIELD_CALL_TYPE. Other values should be defined as per this value. but the values are invalid as per this AEECALLHISTORY_FIELD_CALL_TYPE.
pCHE->pFields->pData = 460; // permissible values for AEECALLHISTORY_FIELD_CALL_TYPE are AEECALLHISTORY_CALL_TYPE_TO, AEECALLHISTORY_CALL_TYPE_FROM, AEECALLHISTORY_CALL_TYPE_MISSED - defined as 1 2 & 3.
pCHE->pFields->wDataLen =10; // this is the length of the data in pData.
 
see a code example below, on how to add & get a history entry:-
/****************************
#include "AEECallHistory.h"

ICallHistory *pCallHist;
****************************/

void addToCallHist(myApp *pMe)
{
int nErr;
AEECallHistoryEntry he;

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

he.pFields = (AEECallHistoryField*)MALLOC(sizeof(AEECallHistoryField)*4);

uint16 value16 = AEECALLHISTORY_CALL_TYPE_TO;
uint32 value32 = GETTIMESECONDS();

he.pFields[0].ClsId = 0;
he.pFields[0].wID = AEECALLHISTORY_FIELD_CALL_TYPE;
he.pFields[0].pData = (void*)&value16;
he.pFields[0].wDataLen = sizeof(uint16);

he.pFields[1].ClsId = 0;
he.pFields[1].wID = AEECALLHISTORY_FIELD_NUMBER;
he.pFields[1].pData = (void*)"9885714058";
he.pFields[1].wDataLen = 10;

he.pFields[2].ClsId = 0;
he.pFields[2].wID = AEECALLHISTORY_FIELD_DATE_TIME;
he.pFields[2].pData = (void*)&value32;
he.pFields[2].wDataLen = sizeof(uint32);

he.wNumFields = 3;

nErr = ICALLHISTORY_AddEntry(pMe->pCallHist, &he);

void getHistEntrys(myApp *pMe)
{
int nErr;
char *str;
AEECallHistoryEntry *he;

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

ICALLHISTORY_EnumInit(pMe->pCallHist);

he = NULL;
do{
he = (AEECallHistoryEntry*)ICALLHISTORY_EnumNext(pMe->pCallHist, &nErr);
} while(he != NULL);

there seems to be some issues in the code:-
1. pCHE->wNumFields = 4; // this is the number of fields allocated in pCHE->pFields. you have assigned it a value of 4 but you have added one feild.
2. The entry in feild in invalid:-
 pCHE->pFields->wID =1; // the values are defined in AEECallHistory.h - you assign it to 1 which is AEECALLHISTORY_FIELD_CALL_TYPE. Other values should be defined as per this value. but the values are invalid as per this AEECALLHISTORY_FIELD_CALL_TYPE.
pCHE->pFields->pData = 460; // permissible values for AEECALLHISTORY_FIELD_CALL_TYPE are AEECALLHISTORY_CALL_TYPE_TO, AEECALLHISTORY_CALL_TYPE_FROM, AEECALLHISTORY_CALL_TYPE_MISSED - defined as 1 2 & 3.
pCHE->pFields->wDataLen =10; // this is the length of the data in pData.
 
see a code example below, on how to add & get a history entry:-
/****************************
#include "AEECallHistory.h"

ICallHistory *pCallHist;
****************************/

void addToCallHist(myApp *pMe)
{
int nErr;
AEECallHistoryEntry he;

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

he.pFields = (AEECallHistoryField*)MALLOC(sizeof(AEECallHistoryField)*4);

uint16 value16 = AEECALLHISTORY_CALL_TYPE_TO;
uint32 value32 = GETTIMESECONDS();

he.pFields[0].ClsId = 0;
he.pFields[0].wID = AEECALLHISTORY_FIELD_CALL_TYPE;
he.pFields[0].pData = (void*)&value16;
he.pFields[0].wDataLen = sizeof(uint16);

he.pFields[1].ClsId = 0;
he.pFields[1].wID = AEECALLHISTORY_FIELD_NUMBER;
he.pFields[1].pData = (void*)"9885714058";
he.pFields[1].wDataLen = 10;

he.pFields[2].ClsId = 0;
he.pFields[2].wID = AEECALLHISTORY_FIELD_DATE_TIME;
he.pFields[2].pData = (void*)&value32;
he.pFields[2].wDataLen = sizeof(uint32);

he.wNumFields = 3;

nErr = ICALLHISTORY_AddEntry(pMe->pCallHist, &he);

void getHistEntrys(myApp *pMe)
{
int nErr;
char *str;
AEECallHistoryEntry *he;

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

ICALLHISTORY_EnumInit(pMe->pCallHist);

he = NULL;
do{
he = (AEECallHistoryEntry*)ICALLHISTORY_EnumNext(pMe->pCallHist, &nErr);
} while(he != NULL);

Thanks dear
Its Working...
 

Thanks dear
Its Working...