diff options
Diffstat (limited to 'common/ipc/ctsvc_ipc_speeddial.c')
-rw-r--r-- | common/ipc/ctsvc_ipc_speeddial.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/common/ipc/ctsvc_ipc_speeddial.c b/common/ipc/ctsvc_ipc_speeddial.c new file mode 100644 index 0000000..770ac63 --- /dev/null +++ b/common/ipc/ctsvc_ipc_speeddial.c @@ -0,0 +1,61 @@ +#include "ctsvc_ipc_macros.h" + +#include "ctsvc_internal.h" +#include "ctsvc_ipc_marshal.h" +#include "contacts_record.h" + +static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record); +static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, pims_ipc_data_h ipc_data); + +ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_speeddial_plugin_cb = { + .unmarshal_record = __ctsvc_ipc_unmarshal_speeddial, + .marshal_record = __ctsvc_ipc_marshal_speeddial, + .get_primary_id = NULL +}; + + +static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record) +{ + RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA); + RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA); + + ctsvc_speeddial_s* speeddial_p = (ctsvc_speeddial_s*) record; + do { + if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_id) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->person_id) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->display_name) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->image_thumbnail_path) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_type) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->label) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->number) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->dial_number) != CONTACTS_ERROR_NONE) break; + + return CONTACTS_ERROR_NONE; + } while(0); + + CTS_ERR("_ctsvc_ipc_unmarshal fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; +} + +static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, pims_ipc_data_h ipc_data) +{ + ctsvc_speeddial_s* speeddial_p = (ctsvc_speeddial_s*)record; + RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA); + RETV_IF(speeddial_p==NULL,CONTACTS_ERROR_NO_DATA); + do { + if (ctsvc_ipc_marshal_int((speeddial_p->number_id),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_int((speeddial_p->person_id),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_string((speeddial_p->display_name),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_string((speeddial_p->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_int((speeddial_p->number_type),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_string((speeddial_p->label),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_string((speeddial_p->number),ipc_data) != CONTACTS_ERROR_NONE) break; + if (ctsvc_ipc_marshal_int((speeddial_p->dial_number),ipc_data) != CONTACTS_ERROR_NONE) break; + + return CONTACTS_ERROR_NONE; + } while(0); + + CTS_ERR("_ctsvc_ipc_marshal fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; +} + |