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

Developer

Forums

Forums:

Hi All,

         Is it possible to set/get photo to contact records in pim_IContacts. if yes how??

Note that adding photo to address book is device dependent and varies from device to device. One way is to directly passing the file path into Vcard and another is to passing raw binary data directly(generallyOEM dependent)
Follow below steps:
1.) create instance of pim_AEECLSID_ContactStore.ISHELL_CreateInstance(pMe->applet.m_pIShell, pim_AEECLSID_ContactStore, (void **)&piContactStore);
 2.) create vcard and assign photo file card to this and use pim_IRecordStore_AddRecord() to create the record.
eg.
pim_IRecordStore_AddRecord(piContactStore, (const unsigned char*)Entry, STRLEN(Entry)+1, &ID);
3.) Call pim_IRecordStore_GetRecord() first to get entry length in order to allocate memory.
pim_IRecordStore_GetRecord(piContactStore,ID,0,NULL, 0, &EntryLenReq);
4.) call second time pim_IRecordStore_GetRecord() with in buffer.
pim_IRecordStore_GetRecord(piContactStore,ID, 0,(unsigned char*)pGetRecordData, EntryLen, &EntryLenReq);
Thanks

Note that adding photo to address book is device dependent and varies from device to device. One way is to directly passing the file path into Vcard and another is to passing raw binary data directly(generallyOEM dependent)
Follow below steps:
1.) create instance of pim_AEECLSID_ContactStore.ISHELL_CreateInstance(pMe->applet.m_pIShell, pim_AEECLSID_ContactStore, (void **)&piContactStore);
 2.) create vcard and assign photo file card to this and use pim_IRecordStore_AddRecord() to create the record.
eg.
pim_IRecordStore_AddRecord(piContactStore, (const unsigned char*)Entry, STRLEN(Entry)+1, &ID);
3.) Call pim_IRecordStore_GetRecord() first to get entry length in order to allocate memory.
pim_IRecordStore_GetRecord(piContactStore,ID,0,NULL, 0, &EntryLenReq);
4.) call second time pim_IRecordStore_GetRecord() with in buffer.
pim_IRecordStore_GetRecord(piContactStore,ID, 0,(unsigned char*)pGetRecordData, EntryLen, &EntryLenReq);
Thanks

Hi,
Storing via VCARD is one way and YES, you can add a picture or photo to a contact using pim_IContacts also.
Few points to note:
1) A photo can ONLY be added to phone (pim_AEECLSID_EFSDBDevice) based contacts not to any SIM (ADN / FDN / ECC) based contacts.
2) It's recommended and mostly practiced that the applications will store the file system path of a photo like “fs:/~/mypic.jpg” not the complete binary or image data. It’s not that IContacts can’t store complete image, but it’s just not the efficient way and may degrade the performace (both while storing and retrieving the data).
3) Note that once the filepath or complete binary data of the photo is being retrieved, pim_IContacts interface DOES NOT have any role in displaying the photo to the user.
4) When a file system path is stored, make sure that the applications have the proper Privileges or Permissions for accessing location of the photo file. For example, if one application stores a path to a photo file within its own directory and another application, trying to access it, should need to have proper priveleges to read the photo file from the first application’s directory.
pim_IContacts interface provides below field and subfields (defined in the file "pim_EFSDBDevice.bid") for attaching a photo:
1) Field "pim_EFSDBDevice_FieldID_Photo" for storing an URI of a photo attached to a given contact.
2) Sub-field "pim_EFSDBDevice_Subfield_Phone_Photo" for storing an URI of a photo attached to a given phone number. Note that a contact can have multiple phone numbers (like HOME, WORK, CELL) and using this sub-field, you could set a photo for each of these phone numbers.
3) Sub-field "pim_EFSDBDevice_GroupInfoKey_Photo" for storing an URI of a photo attached to a given Group.
Just like any other fields of a contact record, the values for these fields and sub-fields are set using pim_IContactsRecord_SetFieldValue() and are retrieved using pim_IContactsRecord_GetFieldValue(). Also, if required, the application can edit or update the field values accordingly.
Regards,
Suresh Kumar S

Hi,
Storing via VCARD is one way and YES, you can add a picture or photo to a contact using pim_IContacts also.
Few points to note:
1) A photo can ONLY be added to phone (pim_AEECLSID_EFSDBDevice) based contacts not to any SIM (ADN / FDN / ECC) based contacts.
2) It's recommended and mostly practiced that the applications will store the file system path of a photo like “fs:/~/mypic.jpg” not the complete binary or image data. It’s not that IContacts can’t store complete image, but it’s just not the efficient way and may degrade the performace (both while storing and retrieving the data).
3) Note that once the filepath or complete binary data of the photo is being retrieved, pim_IContacts interface DOES NOT have any role in displaying the photo to the user.
4) When a file system path is stored, make sure that the applications have the proper Privileges or Permissions for accessing location of the photo file. For example, if one application stores a path to a photo file within its own directory and another application, trying to access it, should need to have proper priveleges to read the photo file from the first application’s directory.
pim_IContacts interface provides below field and subfields (defined in the file "pim_EFSDBDevice.bid") for attaching a photo:
1) Field "pim_EFSDBDevice_FieldID_Photo" for storing an URI of a photo attached to a given contact.
2) Sub-field "pim_EFSDBDevice_Subfield_Phone_Photo" for storing an URI of a photo attached to a given phone number. Note that a contact can have multiple phone numbers (like HOME, WORK, CELL) and using this sub-field, you could set a photo for each of these phone numbers.
3) Sub-field "pim_EFSDBDevice_GroupInfoKey_Photo" for storing an URI of a photo attached to a given Group.
Just like any other fields of a contact record, the values for these fields and sub-fields are set using pim_IContactsRecord_SetFieldValue() and are retrieved using pim_IContactsRecord_GetFieldValue(). Also, if required, the application can edit or update the field values accordingly.
Regards,
Suresh Kumar S

HI Suresh Kumar,
    Thanks  for your reply.

HI Suresh Kumar,
    Thanks  for your reply.