IAddressBook problem | developer.brewmp.com IAddressBook problem | developer.brewmp.com

Developer

IAddressBook problem

Forums:

hi all

i am working with brew 3.1.4 & simulator 3.0.1. i want to access device primary address book. i found some sort of code snippet on forum & after implementing, it displays error msg "error in creating rec" but at the same time it create 'address' folder in parent directory which contain 'phbk' file . this phbk file contain the entries which i have made through code. what all this mean?

The code...
AEEAddrField aFields[NUM_INFOADB_RECORD_FIELDS];
AECHAR* sFName = L"Anand";
AECHAR* sLName = L"Mahajan";
AECHAR* sHPNum = L"1234567890";
AECHAR* sWPNum = L"0987654321";

IAddrRec *pIAddrRec;

aFields[ADB_RECORD_FIELD_FNAME].fID = AEE_ADDRFIELD_FIRSTNAME; // fill in first name field
aFields[ADB_RECORD_FIELD_FNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_FNAME].pBuffer = sFName;
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = WSTRLEN(sFName);

aFields[ADB_RECORD_FIELD_LNAME].fID = AEE_ADDRFIELD_LASTNAME; // fill in last name field
aFields[ADB_RECORD_FIELD_LNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_LNAME].pBuffer = sLName;
aFields[ADB_RECORD_FIELD_LNAME].wDataLen = WSTRLEN(sLName);

aFields[ADB_RECORD_FIELD_HPHONE].fID = AEE_ADDRFIELD_PHONE_HOME; // fill in home phone field
aFields[ADB_RECORD_FIELD_HPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_HPHONE].pBuffer = sHPNum;
aFields[ADB_RECORD_FIELD_HPHONE].wDataLen = WSTRLEN(sHPNum);

aFields[ADB_RECORD_FIELD_WPHONE].fID = AEE_ADDRFIELD_PHONE_WORK; // fill in work phone field
aFields[ADB_RECORD_FIELD_WPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_WPHONE].pBuffer = sWPNum;
aFields[ADB_RECORD_FIELD_WPHONE].wDataLen = WSTRLEN(sWPNum);

if(NULL == (pIAddrRec = IADDRBOOK_CreateRec(pMe->pIAddBook, AEE_ADDR_CAT_PERSONAL, aFields, NUM_INFOADB_RECORD_FIELDS)))
{
DBGPRINTF("null");
IADDRBOOK_Release(pMe->pIAddBook);
return;
}

{

IADDRREC_Release (pIAddrRec ); // must release the newly created record
IADDRBOOK_Release(pMe->pIAddBook);
}

pls help.
ketan

ketan wrote:hi all
i am working with brew 3.1.4 & simulator 3.0.1. i want to access device primary address book. i found some sort of code snippet on forum & after implementing, it displays error msg "error in creating rec" but at the same time it create 'address' folder in parent directory which contain 'phbk' file . this phbk file contain the entries which i have made through code. what all this mean?
The code...
AEEAddrField aFields[NUM_INFOADB_RECORD_FIELDS];
AECHAR* sFName = L"Anand";
AECHAR* sLName = L"Mahajan";
AECHAR* sHPNum = L"1234567890";
AECHAR* sWPNum = L"0987654321";
IAddrRec *pIAddrRec;
aFields[ADB_RECORD_FIELD_FNAME].fID = AEE_ADDRFIELD_FIRSTNAME; // fill in first name field
aFields[ADB_RECORD_FIELD_FNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_FNAME].pBuffer = sFName;
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = WSTRLEN(sFName);
aFields[ADB_RECORD_FIELD_LNAME].fID = AEE_ADDRFIELD_LASTNAME; // fill in last name field
aFields[ADB_RECORD_FIELD_LNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_LNAME].pBuffer = sLName;
aFields[ADB_RECORD_FIELD_LNAME].wDataLen = WSTRLEN(sLName);
aFields[ADB_RECORD_FIELD_HPHONE].fID = AEE_ADDRFIELD_PHONE_HOME; // fill in home phone field
aFields[ADB_RECORD_FIELD_HPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_HPHONE].pBuffer = sHPNum;
aFields[ADB_RECORD_FIELD_HPHONE].wDataLen = WSTRLEN(sHPNum);
aFields[ADB_RECORD_FIELD_WPHONE].fID = AEE_ADDRFIELD_PHONE_WORK; // fill in work phone field
aFields[ADB_RECORD_FIELD_WPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_WPHONE].pBuffer = sWPNum;
aFields[ADB_RECORD_FIELD_WPHONE].wDataLen = WSTRLEN(sWPNum);
if(NULL == (pIAddrRec = IADDRBOOK_CreateRec(pMe->pIAddBook, AEE_ADDR_CAT_PERSONAL, aFields, NUM_INFOADB_RECORD_FIELDS)))
{
DBGPRINTF("null");
IADDRBOOK_Release(pMe->pIAddBook);
return;
}
{
IADDRREC_Release (pIAddrRec ); // must release the newly created record
IADDRBOOK_Release(pMe->pIAddBook);
}
pls help.
ketan
have you set the permissons in the mif file ?

ketan wrote:hi all
i am working with brew 3.1.4 & simulator 3.0.1. i want to access device primary address book. i found some sort of code snippet on forum & after implementing, it displays error msg "error in creating rec" but at the same time it create 'address' folder in parent directory which contain 'phbk' file . this phbk file contain the entries which i have made through code. what all this mean?
The code...
AEEAddrField aFields[NUM_INFOADB_RECORD_FIELDS];
AECHAR* sFName = L"Anand";
AECHAR* sLName = L"Mahajan";
AECHAR* sHPNum = L"1234567890";
AECHAR* sWPNum = L"0987654321";
IAddrRec *pIAddrRec;
aFields[ADB_RECORD_FIELD_FNAME].fID = AEE_ADDRFIELD_FIRSTNAME; // fill in first name field
aFields[ADB_RECORD_FIELD_FNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_FNAME].pBuffer = sFName;
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = WSTRLEN(sFName);
aFields[ADB_RECORD_FIELD_LNAME].fID = AEE_ADDRFIELD_LASTNAME; // fill in last name field
aFields[ADB_RECORD_FIELD_LNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_LNAME].pBuffer = sLName;
aFields[ADB_RECORD_FIELD_LNAME].wDataLen = WSTRLEN(sLName);
aFields[ADB_RECORD_FIELD_HPHONE].fID = AEE_ADDRFIELD_PHONE_HOME; // fill in home phone field
aFields[ADB_RECORD_FIELD_HPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_HPHONE].pBuffer = sHPNum;
aFields[ADB_RECORD_FIELD_HPHONE].wDataLen = WSTRLEN(sHPNum);
aFields[ADB_RECORD_FIELD_WPHONE].fID = AEE_ADDRFIELD_PHONE_WORK; // fill in work phone field
aFields[ADB_RECORD_FIELD_WPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_WPHONE].pBuffer = sWPNum;
aFields[ADB_RECORD_FIELD_WPHONE].wDataLen = WSTRLEN(sWPNum);
if(NULL == (pIAddrRec = IADDRBOOK_CreateRec(pMe->pIAddBook, AEE_ADDR_CAT_PERSONAL, aFields, NUM_INFOADB_RECORD_FIELDS)))
{
DBGPRINTF("null");
IADDRBOOK_Release(pMe->pIAddBook);
return;
}
{
IADDRREC_Release (pIAddrRec ); // must release the newly created record
IADDRBOOK_Release(pMe->pIAddBook);
}
pls help.
ketan
have you set the permissons in the mif file ?

yes, i had
ketan

yes, i had
ketan

ketan wrote:hi all
i am working with brew 3.1.4 & simulator 3.0.1. i want to access device primary address book. i found some sort of code snippet on forum & after implementing, it displays error msg "error in creating rec" but at the same time it create 'address' folder in parent directory which contain 'phbk' file . this phbk file contain the entries which i have made through code. what all this mean?
The code...
AEEAddrField aFields[NUM_INFOADB_RECORD_FIELDS];
AECHAR* sFName = L"Anand";
AECHAR* sLName = L"Mahajan";
AECHAR* sHPNum = L"1234567890";
AECHAR* sWPNum = L"0987654321";
IAddrRec *pIAddrRec;
aFields[ADB_RECORD_FIELD_FNAME].fID = AEE_ADDRFIELD_FIRSTNAME; // fill in first name field
aFields[ADB_RECORD_FIELD_FNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_FNAME].pBuffer = sFName;
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = WSTRLEN(sFName);
aFields[ADB_RECORD_FIELD_LNAME].fID = AEE_ADDRFIELD_LASTNAME; // fill in last name field
aFields[ADB_RECORD_FIELD_LNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_LNAME].pBuffer = sLName;
aFields[ADB_RECORD_FIELD_LNAME].wDataLen = WSTRLEN(sLName);
aFields[ADB_RECORD_FIELD_HPHONE].fID = AEE_ADDRFIELD_PHONE_HOME; // fill in home phone field
aFields[ADB_RECORD_FIELD_HPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_HPHONE].pBuffer = sHPNum;
aFields[ADB_RECORD_FIELD_HPHONE].wDataLen = WSTRLEN(sHPNum);
aFields[ADB_RECORD_FIELD_WPHONE].fID = AEE_ADDRFIELD_PHONE_WORK; // fill in work phone field
aFields[ADB_RECORD_FIELD_WPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_WPHONE].pBuffer = sWPNum;
aFields[ADB_RECORD_FIELD_WPHONE].wDataLen = WSTRLEN(sWPNum);
if(NULL == (pIAddrRec = IADDRBOOK_CreateRec(pMe->pIAddBook, AEE_ADDR_CAT_PERSONAL, aFields, NUM_INFOADB_RECORD_FIELDS)))
{
DBGPRINTF("null");
IADDRBOOK_Release(pMe->pIAddBook);
return;
}
{
IADDRREC_Release (pIAddrRec ); // must release the newly created record
IADDRBOOK_Release(pMe->pIAddBook);
}
pls help.
ketan
what i think it's not right
wDataLen ->Length of the data in bytes.
WSTRLEN->Returns the number of AECHAR characters in string
those 2 don't match.
i think you should try :
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = (WSTRLEN(sFName)+1)*sizeof(AECHAR);
( same goes to the other fields ).

ketan wrote:hi all
i am working with brew 3.1.4 & simulator 3.0.1. i want to access device primary address book. i found some sort of code snippet on forum & after implementing, it displays error msg "error in creating rec" but at the same time it create 'address' folder in parent directory which contain 'phbk' file . this phbk file contain the entries which i have made through code. what all this mean?
The code...
AEEAddrField aFields[NUM_INFOADB_RECORD_FIELDS];
AECHAR* sFName = L"Anand";
AECHAR* sLName = L"Mahajan";
AECHAR* sHPNum = L"1234567890";
AECHAR* sWPNum = L"0987654321";
IAddrRec *pIAddrRec;
aFields[ADB_RECORD_FIELD_FNAME].fID = AEE_ADDRFIELD_FIRSTNAME; // fill in first name field
aFields[ADB_RECORD_FIELD_FNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_FNAME].pBuffer = sFName;
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = WSTRLEN(sFName);
aFields[ADB_RECORD_FIELD_LNAME].fID = AEE_ADDRFIELD_LASTNAME; // fill in last name field
aFields[ADB_RECORD_FIELD_LNAME].fType = AEEDB_FT_STRING;
aFields[ADB_RECORD_FIELD_LNAME].pBuffer = sLName;
aFields[ADB_RECORD_FIELD_LNAME].wDataLen = WSTRLEN(sLName);
aFields[ADB_RECORD_FIELD_HPHONE].fID = AEE_ADDRFIELD_PHONE_HOME; // fill in home phone field
aFields[ADB_RECORD_FIELD_HPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_HPHONE].pBuffer = sHPNum;
aFields[ADB_RECORD_FIELD_HPHONE].wDataLen = WSTRLEN(sHPNum);
aFields[ADB_RECORD_FIELD_WPHONE].fID = AEE_ADDRFIELD_PHONE_WORK; // fill in work phone field
aFields[ADB_RECORD_FIELD_WPHONE].fType = AEEDB_FT_PHONE;
aFields[ADB_RECORD_FIELD_WPHONE].pBuffer = sWPNum;
aFields[ADB_RECORD_FIELD_WPHONE].wDataLen = WSTRLEN(sWPNum);
if(NULL == (pIAddrRec = IADDRBOOK_CreateRec(pMe->pIAddBook, AEE_ADDR_CAT_PERSONAL, aFields, NUM_INFOADB_RECORD_FIELDS)))
{
DBGPRINTF("null");
IADDRBOOK_Release(pMe->pIAddBook);
return;
}
{
IADDRREC_Release (pIAddrRec ); // must release the newly created record
IADDRBOOK_Release(pMe->pIAddBook);
}
pls help.
ketan
what i think it's not right
wDataLen ->Length of the data in bytes.
WSTRLEN->Returns the number of AECHAR characters in string
those 2 don't match.
i think you should try :
aFields[ADB_RECORD_FIELD_FNAME].wDataLen = (WSTRLEN(sFName)+1)*sizeof(AECHAR);
( same goes to the other fields ).

thanks it working

thanks it working