static guint __inoti_handler = 0;
static GSList *__noti_list = NULL;
-void ctsvc_inotify_call_blocked_callback() {
- noti_info *noti;
- GSList *it = NULL;
-
- for (it = __noti_list;it;it=it->next) {
- noti = (noti_info *)it->data;
-
- if (noti->cb && noti->blocked) {
- CTS_DBG("%s", noti->view_uri);
- noti->blocked = false;
- noti->cb(noti->view_uri, noti->cb_data);
- }
- }
-}
-
static inline void __ctsvc_inotify_handle_callback(GSList *noti_list, int wd, uint32_t mask)
{
noti_info *noti;
void ctsvc_inotify_close(void);
int ctsvc_inotify_subscribe(const char *view_uri, contacts_db_changed_cb cb, void *data);
int ctsvc_inotify_unsubscribe(const char *view_uri, contacts_db_changed_cb cb, void *user_data);
-void ctsvc_inotify_call_blocked_callback();
#endif /* __TIZEN_SOCIAL_CTSVC_INOTIFY_H__ */
static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property_id, int *out);
static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property_id, int value);
static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const char* str);
-static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value);
static int __ctsvc_extension_create(contacts_record_h *out_record);
static int __ctsvc_extension_destroy(contacts_record_h record, bool delete_child);
static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_group_relation_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int property_id, int value);
-static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char* str);
static int __ctsvc_messenger_create(contacts_record_h *out_record);
static int __ctsvc_messenger_destroy(contacts_record_h record, bool delete_child);
static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int property_id, int *out);
static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value);
-static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str);
static int __ctsvc_url_create(contacts_record_h *out_record);
static int __ctsvc_url_destroy(contacts_record_h record, bool delete_child);
.get_str = __ctsvc_event_get_str,
.get_str_p = __ctsvc_event_get_str_p,
.get_int = __ctsvc_event_get_int,
- .get_bool = __ctsvc_event_get_bool,
+ .get_bool = NULL,
.get_lli = NULL,
.get_double = NULL,
.set_str = __ctsvc_event_set_str,
.set_int = __ctsvc_event_set_int,
- .set_bool = __ctsvc_event_set_bool,
+ .set_bool = NULL,
.set_lli = NULL,
.set_double = NULL,
.add_child_record = NULL,
.get_bool = NULL,
.get_lli = NULL,
.get_double = NULL,
- .set_str = __ctsvc_group_relation_set_str,
+ .set_str = NULL,
.set_int = __ctsvc_group_relation_set_int,
.set_bool = NULL,
.set_lli = NULL,
.get_bool = __ctsvc_simple_contact_get_bool,
.get_lli = NULL,
.get_double = NULL,
- .set_str = __ctsvc_simple_contact_set_str,
- .set_int = __ctsvc_simple_contact_set_int,
+ .set_str = NULL,
+ .set_int = NULL,
.set_bool = NULL,
.set_lli = NULL,
.set_double = NULL,
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value)
-{
- ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_CONTACT_ID:
- contact->contact_id = value;
- break;
- case CTSVC_PROPERTY_CONTACT_DISPLAY_SOURCE_DATA_ID:
- contact->display_source_type = value;
- break;
- case CTSVC_PROPERTY_CONTACT_PERSON_ID:
- contact->person_id = value;
- break;
- case CTSVC_PROPERTY_CONTACT_ADDRESSBOOK_ID:
- RETVM_IF(0 < contact->contact_id, CONTACTS_ERROR_INVALID_PARAMETER,
- "Invalide parameter : property_id(%d) is a read-only value (contact)", property_id);
- contact->addressbook_id = value;
- break;
- default:
- CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple contact)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_id, int value)
{
ctsvc_name_s *name = (ctsvc_name_s *)record;
}
-static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str)
-{
- ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
- FREEandSTRDUP(contact->display_name, str);
- break;
-/*
- CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
-*/
- case CTSVC_PROPERTY_CONTACT_RINGTONE:
- FREEandSTRDUP(contact->ringtone_path, str);
- break;
- case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
- FREEandSTRDUP(contact->image_thumbnail_path, str);
- break;
- case CTSVC_PROPERTY_CONTACT_UID:
- FREEandSTRDUP(contact->uid, str);
- break;
- case CTSVC_PROPERTY_CONTACT_VIBRATION:
- FREEandSTRDUP(contact->vibration, str);
- break;
- case CTSVC_PROPERTY_CONTACT_MESSAGE_ALERT:
- FREEandSTRDUP(contact->message_alert, str);
- break;
- default :
- CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple_contact)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const char* str)
{
ctsvc_name_s *name = (ctsvc_name_s *)record;
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char* str)
-{
- ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s *)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME:
- FREEandSTRDUP(group_relation->group_name, str);
- break;
-/*
- CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (group_relation)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
-*/
- default :
- CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group_relation)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const char* str)
{
ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
-{
- ctsvc_event_s *event = (ctsvc_event_s *)record;
- switch (property_id) {
- case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH: /* deprecated */
- *value = event->is_leap_month;
- break;
- default:
- CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(event)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
{
ctsvc_image_s *image = (ctsvc_image_s *)record;
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value)
-{
- ctsvc_event_s *event = (ctsvc_event_s *)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH: /* deprecated */
- event->is_leap_month = value;
- break;
- default:
- CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int property_id, bool value)
{
ctsvc_image_s *image = (ctsvc_image_s *)record;
static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
-static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value);
static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char* str);
static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int property_id, bool value);
.get_lli = NULL,
.get_double = NULL,
.set_str = __ctsvc_person_set_str,
- .set_int = __ctsvc_person_set_int,
+ .set_int = NULL,
.set_bool = __ctsvc_person_set_bool,
.set_lli = NULL,
.set_double = NULL,
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value)
-{
- ctsvc_person_s *person = (ctsvc_person_s *)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_PERSON_DISPLAY_CONTACT_ID:
- person->name_contact_id = value;
- break;
- case CTSVC_PROPERTY_PERSON_ID:
- person->person_id = value;
- break;
- case CTSVC_PROPERTY_PERSON_LINK_COUNT:
- person->link_count = value;
- break;
- default:
- CTS_ERR("This field(0x%0x) is not supported in value(person)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char* str)
{
ctsvc_person_s *person = (ctsvc_person_s *)record;
static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, int* out_value);
-static int __ctsvc_result_get_lli(contacts_record_h record, unsigned int property_id, long long int* out_value);
-static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool* out_value);
-static int __ctsvc_result_get_double(contacts_record_h record, unsigned int property_id, double* out_value);
-static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value);
-static int __ctsvc_result_set_lli(contacts_record_h record, unsigned int property_id, long long int value);
-static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value);
-static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str);
-static int __ctsvc_result_set_double(contacts_record_h record, unsigned int property_id, double value);
ctsvc_record_plugin_cb_s result_plugin_cbs = {
.create = __ctsvc_result_create,
.get_str = __ctsvc_result_get_str,
.get_str_p = __ctsvc_result_get_str_p,
.get_int = __ctsvc_result_get_int,
- .get_bool = __ctsvc_result_get_bool,
- .get_lli = __ctsvc_result_get_lli,
- .get_double = __ctsvc_result_get_double,
- .set_str = __ctsvc_result_set_str,
- .set_int = __ctsvc_result_set_int,
- .set_bool = __ctsvc_result_set_bool,
- .set_lli = __ctsvc_result_set_lli,
- .set_double = __ctsvc_result_set_double,
+ .get_bool = NULL,
+ .get_lli = NULL,
+ .get_double = NULL,
+ .set_str = NULL,
+ .set_int = NULL,
+ .set_bool = NULL,
+ .set_lli = NULL,
+ .set_double = NULL,
.add_child_record = NULL,
.remove_child_record = NULL,
.get_child_record_count = NULL,
return CONTACTS_ERROR_NO_DATA;
}
-static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- ctsvc_result_value_s *data;
-
- /* TODO: check the value type of property_id is int */
- for (cursor = result->values;cursor;cursor=cursor->next) {
- data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_INT) {
-#ifdef _CONTACTS_IPC_SERVER
- if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO)
- data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
- else
-#endif /* _CONTACTS_IPC_SERVER */
- data->value.i = value;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- data = calloc(1, sizeof(ctsvc_result_value_s));
- if (NULL == data) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- data->property_id = property_id;
- data->type = CTSVC_VIEW_DATA_TYPE_INT;
-#ifdef _CONTACTS_IPC_SERVER
- if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO)
- data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
- else
-#endif /* _CONTACTS_IPC_SERVER */
- data->value.i = value;
- result->values = g_slist_append(result->values, (void*)data);
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_result_set_lli(contacts_record_h record, unsigned int property_id, long long int value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- ctsvc_result_value_s *data;
-
- /* TODO: check the value type of property_id is int */
- for (cursor = result->values;cursor;cursor=cursor->next) {
- data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_LLI) {
- data->value.l = value;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- data = calloc(1, sizeof(ctsvc_result_value_s));
- if (NULL == data) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- data->property_id = property_id;
- data->type = CTSVC_VIEW_DATA_TYPE_LLI;
- data->value.l = value;
- result->values = g_slist_append(result->values, (void*)data);
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_result_set_double(contacts_record_h record, unsigned int property_id, double value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- ctsvc_result_value_s *data;
-
- for (cursor = result->values;cursor;cursor=cursor->next) {
- data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_DOUBLE) {
- data->value.d = value;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- data = calloc(1, sizeof(ctsvc_result_value_s));
- if (NULL == data) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- data->property_id = property_id;
- data->type = CTSVC_VIEW_DATA_TYPE_DOUBLE;
- data->value.d = value;
- result->values = g_slist_append(result->values, (void*)data);
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- ctsvc_result_value_s *data;
-
- /* TODO: check the value type of property_id is int */
- for (cursor = result->values;cursor;cursor=cursor->next) {
- data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
- data->value.b = value;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- data = calloc(1, sizeof(ctsvc_result_value_s));
- if (NULL == data) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- data->property_id = property_id;
- data->type = CTSVC_VIEW_DATA_TYPE_BOOL;
- data->value.i = value;
- result->values = g_slist_append(result->values, (void*)data);
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- ctsvc_result_value_s *data;
- char *full_path = NULL;
- int str_len;
-
- /* TODO: check the value type of property_id is int */
- for (cursor = result->values;cursor;cursor=cursor->next) {
- data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_STR) {
- switch (property_id) {
- case CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL:
- case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
- if (str) {
- str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
- full_path = calloc(1, str_len);
- if (NULL == full_path) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str);
- }
- free(data->value.s);
- data->value.s = full_path;
- return CONTACTS_ERROR_NONE;
- default:
- FREEandSTRDUP(data->value.s, str);
- return CONTACTS_ERROR_NONE;
- }
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- data = calloc(1, sizeof(ctsvc_result_value_s));
- if (NULL == data) {
- CTS_ERR("calloc() Fail");
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- data->property_id = property_id;
- data->type = CTSVC_VIEW_DATA_TYPE_STR;
- switch (property_id) {
- case CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL:
- case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
- if (str) {
- str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
- full_path = calloc(1, str_len);
- if (NULL == full_path) {
- CTS_ERR("calloc() Fail");
- free(data);
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str);
- }
- free(data->value.s);
- data->value.s = full_path;
- break;
- default:
- data->value.s = SAFE_STRDUP(str);
- break;
- }
-
- result->values = g_slist_append(result->values, (void*)data);
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool* out_value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- for (cursor = result->values;cursor;cursor=cursor->next) {
- ctsvc_result_value_s *data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
- *out_value = data->value.b;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- return CONTACTS_ERROR_NO_DATA;
-}
-
-static int __ctsvc_result_get_lli(contacts_record_h record, unsigned int property_id, long long int* out_value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- for (cursor = result->values;cursor;cursor=cursor->next) {
- ctsvc_result_value_s *data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_LLI) {
- *out_value = data->value.l;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- return CONTACTS_ERROR_NO_DATA;
-}
-
-static int __ctsvc_result_get_double(contacts_record_h record, unsigned int property_id, double* out_value)
-{
- ctsvc_result_s* result = (ctsvc_result_s *)record;
- GSList *cursor;
- for (cursor = result->values;cursor;cursor=cursor->next) {
- ctsvc_result_value_s *data = cursor->data;
- if (data->property_id == property_id) {
- if (data->type == CTSVC_VIEW_DATA_TYPE_DOUBLE) {
- *out_value = data->value.d;
- return CONTACTS_ERROR_NONE;
- }
- else {
- CTS_ERR("use another get_type API, (type : %d)", data->type);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- return CONTACTS_ERROR_NO_DATA;
-}
-
static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_id, int *out);
static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value);
-static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char* str);
ctsvc_record_plugin_cb_s sdn_plugin_cbs = {
.create = __ctsvc_sdn_create,
.get_bool = NULL,
.get_lli = NULL,
.get_double = NULL,
- .set_str = __ctsvc_sdn_set_str,
- .set_int = __ctsvc_sdn_set_int,
+ .set_str = NULL,
+ .set_int = NULL,
.set_bool = NULL,
.set_lli = NULL,
.set_double = NULL,
return __ctsvc_sdn_get_str_real(record, property_id, out_str, true);
}
-static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value)
-{
- ctsvc_sdn_s* sdn = (ctsvc_sdn_s*)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_SDN_ID:
- sdn->id = value;
- break;
- case CTSVC_PROPERTY_SDN_SIM_SLOT_NO:
- sdn->sim_slot_no = value;
- break;
- default:
- CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
-static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char* str)
-{
- ctsvc_sdn_s* sdn = (ctsvc_sdn_s*)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_SDN_NAME:
- FREEandSTRDUP(sdn->name, str);
- break;
- case CTSVC_PROPERTY_SDN_NUMBER:
- FREEandSTRDUP(sdn->number, str);
- break;
- default :
- CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
-
static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int property_id, int value);
-static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char* str);
ctsvc_record_plugin_cb_s speeddial_plugin_cbs = {
.get_bool = NULL,
.get_lli = NULL,
.get_double = NULL,
- .set_str = __ctsvc_speeddial_set_str,
+ .set_str = NULL,
.set_int = __ctsvc_speeddial_set_int,
.set_bool = NULL,
.set_lli = NULL,
return CONTACTS_ERROR_NONE;
}
-static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char* str)
-{
- ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
-
- switch(property_id) {
- case CTSVC_PROPERTY_SPEEDDIAL_DISPLAY_NAME:
- FREEandSTRDUP(speeddial->display_name, str);
- break;
- case CTSVC_PROPERTY_SPEEDDIAL_NUMBER:
- FREEandSTRDUP(speeddial->number, str);
- break;
- case CTSVC_PROPERTY_SPEEDDIAL_IMAGE_THUMBNAIL:
- FREEandSTRDUP(speeddial->image_thumbnail_path, str);
- break;
- case CTSVC_PROPERTY_SPEEDDIAL_NUMBER_LABEL:
- FREEandSTRDUP(speeddial->label, str);
- break;
- default :
- CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- return CONTACTS_ERROR_NONE;
-}
}
break;
case CTSVC_FILTER_DOUBLE:
- if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_double(ipc_data,&filter->value.d)) {
- CTS_ERR("ctsvc_ipc_unmarshal_double() Fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- break;
case CTSVC_FILTER_LLI:
- if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_lli(ipc_data,&filter->value.l)) {
- CTS_ERR("ctsvc_ipc_unmarshal_lli() Fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- break;
default:
break;
}
}
break;
case CTSVC_FILTER_DOUBLE:
- if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_double((filter->value.d),ipc_data)) {
- CTS_ERR("ctsvc_ipc_marshal_double() Fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- break;
case CTSVC_FILTER_LLI:
- if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_lli((filter->value.l),ipc_data)) {
- CTS_ERR("ctsvc_ipc_marshal_lli() Fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- break;
default:
break;
}
return CONTACTS_ERROR_NONE;
}
-int ctsvc_ipc_unmarshal_lli(const pims_ipc_data_h data, long long int *pout)
-{
- RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
- RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- unsigned int size = 0;
- void *tmp = pims_ipc_data_get(data,&size);
- if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get() Fail");
- return CONTACTS_ERROR_NO_DATA;
- }
- else {
- *pout = *(long long int*)tmp;
- }
- return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_ipc_unmarshal_long(const pims_ipc_data_h data, long *pout)
-{
- RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
- RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- unsigned int size = 0;
- void *tmp = pims_ipc_data_get(data, &size);
- if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get() Fail");
- return CONTACTS_ERROR_NO_DATA;
- }
- else {
- *pout = *(long*)tmp;
- }
- return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_ipc_unmarshal_double(const pims_ipc_data_h data, double *pout)
-{
- RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
- RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- unsigned int size = 0;
- void* tmp = pims_ipc_data_get(data,&size);
- if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get() Fail");
- return CONTACTS_ERROR_NO_DATA;
- }
- else {
- *pout = *(double*)tmp;
- }
- return CONTACTS_ERROR_NONE;
-}
-
int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_s* common)
{
void *tmp = NULL;
return CONTACTS_ERROR_NONE;
}
-int ctsvc_ipc_marshal_lli(const long long int in, pims_ipc_data_h ipc_data)
-{
- RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(long long int)) != 0) {
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_ipc_marshal_long(const long in, pims_ipc_data_h ipc_data)
-{
- RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(long)) != 0) {
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_ipc_marshal_double(const double in, pims_ipc_data_h ipc_data)
-{
- RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
- if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(double)) != 0) {
- return CONTACTS_ERROR_OUT_OF_MEMORY;
- }
- return CONTACTS_ERROR_NONE;
-}
-
int ctsvc_ipc_marshal_record_common(const ctsvc_record_s* common, pims_ipc_data_h ipc_data)
{
int ctsvc_ipc_unmarshal_bool(const pims_ipc_data_h data, bool *pout);
int ctsvc_ipc_unmarshal_int(const pims_ipc_data_h data, int *pout);
int ctsvc_ipc_unmarshal_unsigned_int(const pims_ipc_data_h data, unsigned int *pout);
-int ctsvc_ipc_unmarshal_lli(const pims_ipc_data_h data, long long int *pout);
-int ctsvc_ipc_unmarshal_long(const pims_ipc_data_h data, long *pout);
-int ctsvc_ipc_unmarshal_double(const pims_ipc_data_h data, double *pout);
int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_s* common);
/*
int ctsvc_ipc_marshal_bool(const bool in, pims_ipc_data_h ipc_data);
int ctsvc_ipc_marshal_int(const int in, pims_ipc_data_h ipc_data);
int ctsvc_ipc_marshal_unsigned_int(const unsigned int in, pims_ipc_data_h ipc_data);
-int ctsvc_ipc_marshal_lli(const long long int in, pims_ipc_data_h ipc_data);
-int ctsvc_ipc_marshal_long(const long in, pims_ipc_data_h ipc_data);
-int ctsvc_ipc_marshal_double(const double in, pims_ipc_data_h ipc_data);
int ctsvc_ipc_marshal_record_common(const ctsvc_record_s* common, pims_ipc_data_h ipc_data);
/*
}
}
else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
- if (ctsvc_ipc_unmarshal_double(ipc_data,&pvalue->value.d) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_marshal fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ return CONTACTS_ERROR_NONE;
}
else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
- if (ctsvc_ipc_unmarshal_lli(ipc_data,&pvalue->value.l) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_marshal fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ return CONTACTS_ERROR_NONE;
}
else {
ASSERT_NOT_REACHED("invalid parameter (property:%d)",pvalue->property_id);
}
}
else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
- if (ctsvc_ipc_marshal_double(pvalue->value.d,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_marshal fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ return CONTACTS_ERROR_NONE;
}
else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
- if (ctsvc_ipc_marshal_lli(pvalue->value.l,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_marshal fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ return CONTACTS_ERROR_NONE;
}
else {
ASSERT_NOT_REACHED("invalid parameter (property:%d)",pvalue->property_id);