Address Book Field Types - problem | developer.brewmp.com Address Book Field Types - problem | developer.brewmp.com

Developer

Address Book Field Types - problem

Forums:

Hi,

I would like to insert a contact to the address book that has two phones of the same type - for example two phones of type AEE_ADDRFIELD_PHONE_CELL.

The device I am working with is Motorola V3C. This device lets the user insert such a contact through the GUI but when I try to add such a contact through my application - it fails.

Can anyone help?

Thanks,
Sharon

This scenario also doesn't work on the simulator.
I'm getting error 781.
I'm posting the source code here maybe you can see what's wrong...
AEEAddrField aFields[MAX_FIELDS_STUB];
AECHAR sFName[MAX_BUFFER_STUB]={0};
AECHAR sHPNum[MAX_BUFFER_STUB]={0};
AECHAR sSndNum[MAX_BUFFER_STUB]={0};
STRTOWSTR(pFirst, sFName, MAX_BUFFER_STUB*sizeof(AECHAR));
STRTOWSTR(pHPhone, sHPNum, MAX_BUFFER_STUB*sizeof(AECHAR));
STRTOWSTR(pLast, sSndNum, MAX_BUFFER_STUB*sizeof(AECHAR));
aFields[0].fID = AEE_ADDRFIELD_NAME;
aFields[0].fType = AEEDB_FT_STRING;
aFields[0].pBuffer = sFName;
aFields[0].wDataLen = (WSTRLEN(sFName)+1) * sizeof(AECHAR);
aFields[1].fID = AEE_ADDRFIELD_PHONE_CELL;
aFields[1].fType = AEEDB_FT_PHONE;
aFields[1].pBuffer = sHPNum;
aFields[1].wDataLen = (WSTRLEN(sHPNum)+1) * sizeof(AECHAR);
aFields[2].fID = AEE_ADDRFIELD_PHONE_CELL;
aFields[2].fType = AEEDB_FT_PHONE;
aFields[2].pBuffer = sSndNum;
aFields[2].wDataLen = (WSTRLEN(sSndNum)+1) * sizeof(AECHAR);
// create record
IAddrRec *pIAddrRec;
pIAddrRec = IADDRBOOK_CreateRec(m_pAddrBook,
AEE_ADDR_CAT_BUSINESS,
aFields, MAX_FIELDS_STUB);
if (pIAddrRec == NULL)
{
int32 nErr = IADDRBOOK_GetLastError(m_pAddrBook);
// dbgprintf("Error in create record: %d",nErr);
}
IADDRREC_Release(pIAddrRec);
Thanks,
Sharon

This scenario also doesn't work on the simulator.
I'm getting error 781.
I'm posting the source code here maybe you can see what's wrong...
AEEAddrField aFields[MAX_FIELDS_STUB];
AECHAR sFName[MAX_BUFFER_STUB]={0};
AECHAR sHPNum[MAX_BUFFER_STUB]={0};
AECHAR sSndNum[MAX_BUFFER_STUB]={0};
STRTOWSTR(pFirst, sFName, MAX_BUFFER_STUB*sizeof(AECHAR));
STRTOWSTR(pHPhone, sHPNum, MAX_BUFFER_STUB*sizeof(AECHAR));
STRTOWSTR(pLast, sSndNum, MAX_BUFFER_STUB*sizeof(AECHAR));
aFields[0].fID = AEE_ADDRFIELD_NAME;
aFields[0].fType = AEEDB_FT_STRING;
aFields[0].pBuffer = sFName;
aFields[0].wDataLen = (WSTRLEN(sFName)+1) * sizeof(AECHAR);
aFields[1].fID = AEE_ADDRFIELD_PHONE_CELL;
aFields[1].fType = AEEDB_FT_PHONE;
aFields[1].pBuffer = sHPNum;
aFields[1].wDataLen = (WSTRLEN(sHPNum)+1) * sizeof(AECHAR);
aFields[2].fID = AEE_ADDRFIELD_PHONE_CELL;
aFields[2].fType = AEEDB_FT_PHONE;
aFields[2].pBuffer = sSndNum;
aFields[2].wDataLen = (WSTRLEN(sSndNum)+1) * sizeof(AECHAR);
// create record
IAddrRec *pIAddrRec;
pIAddrRec = IADDRBOOK_CreateRec(m_pAddrBook,
AEE_ADDR_CAT_BUSINESS,
aFields, MAX_FIELDS_STUB);
if (pIAddrRec == NULL)
{
int32 nErr = IADDRBOOK_GetLastError(m_pAddrBook);
// dbgprintf("Error in create record: %d",nErr);
}
IADDRREC_Release(pIAddrRec);
Thanks,
Sharon

The 781 indicate a 'AEE_ADDR_INVALID_REC' error. Which means the record is not built correctly. Here the number of fields does explain much about MAX_FIELDS_STUB. If you have defined MAX_FIELDS_STUB as 10 and used only 0-3 of that array, then CREATE API will fail.
Also try AEE_ADDR_CAT_PERSONAL instead of AEE_ADDR_CAT_BUSINESS which worked for me.
Check this thread also -
http://brewforums.qualcomm.com/showthread.php?t=13685

The 781 indicate a 'AEE_ADDR_INVALID_REC' error. Which means the record is not built correctly. Here the number of fields does explain much about MAX_FIELDS_STUB. If you have defined MAX_FIELDS_STUB as 10 and used only 0-3 of that array, then CREATE API will fail.
Also try AEE_ADDR_CAT_PERSONAL instead of AEE_ADDR_CAT_BUSINESS which worked for me.
Check this thread also -
http://brewforums.qualcomm.com/showthread.php?t=13685

Hi,
Thanks for your reply.
MAX_FIELDS_STUB == 3
Did you manage to insert such a contact with two cell phones to the device with category personal?
Do you have any other idea why the code doesn't work?
Thanks,
Sharon

Hi,
Thanks for your reply.
MAX_FIELDS_STUB == 3
Did you manage to insert such a contact with two cell phones to the device with category personal?
Do you have any other idea why the code doesn't work?
Thanks,
Sharon

Also, when I tried the personal category on the device I get this error:
787 - AEE_ADDR_INVALID_ENUM_FIELD
Any thoughts?
Thanks,
Sharon

Also, when I tried the personal category on the device I get this error:
787 - AEE_ADDR_INVALID_ENUM_FIELD
Any thoughts?
Thanks,
Sharon

There you go, thats the problem. You cannot use same field twice. If your intension is to add mobile1 and mobile2, then only supported phones can accept with right field name. Please try with unique field names.

There you go, thats the problem. You cannot use same field twice. If your intension is to add mobile1 and mobile2, then only supported phones can accept with right field name. Please try with unique field names.