From: Guillaume Zajac Date: Tue, 12 Mar 2013 14:26:13 +0000 (+0100) Subject: Update plugin to compile with new libtcore X-Git-Tag: submit/tizen_2.1/20130424.233420~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ef7046bb9ab8707c25c742adbf899baaf0ab4ba;p=platform%2Fcore%2Ftelephony%2Ftel-plugin-dbus_tapi.git Update plugin to compile with new libtcore --- diff --git a/src/call.c b/src/call.c index f0d020f..60f248a 100644 --- a/src/call.c +++ b/src/call.c @@ -459,7 +459,6 @@ static gboolean on_call_get_status(TelephonyCall *call, GDBusMethodInvocation *i { struct custom_data *ctx = user_data; TcorePlugin *plugin = 0; - GSList *o_list = 0; CoreObject *o = 0; CallObject *co = 0; @@ -475,15 +474,12 @@ static gboolean on_call_get_status(TelephonyCall *call, GDBusMethodInvocation *i return FALSE; } - o_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL); - if ( !o_list ) { - dbg("[ error ] co_list : 0"); + o = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_CALL); + if ( !o ) { + dbg("no core object call"); return FALSE; } - o = (CoreObject *)o_list->data; - g_slist_free(o_list); - co = tcore_call_object_find_by_id( o, call_id ); if ( !co ) { dbg("[ error ] co : 0"); @@ -537,14 +533,9 @@ static gboolean on_call_get_status_all(TelephonyCall *call, GDBusMethodInvocatio return FALSE; } - list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL); - if ( !list ) { - dbg("[ error ] co_list : 0"); + o = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_CALL); + if ( !o ) return FALSE; - } - - o = (CoreObject *)list->data; - g_slist_free(list); g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}")); @@ -1048,7 +1039,6 @@ gboolean dbus_plugin_setup_call_interface(TelephonyObjectSkeleton *object, struc gboolean dbus_plugin_call_response(struct custom_data *ctx, UserRequest *ur, struct dbus_request_info *dbus_info, enum tcore_response_command command, unsigned int data_len, const void *data) { int i = 0; - GSList *co_list; CoreObject *co_call; char *modem_name = NULL; TcorePlugin *p = NULL; @@ -1062,17 +1052,9 @@ gboolean dbus_plugin_call_response(struct custom_data *ctx, UserRequest *ur, str if (!p) return FALSE; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_NETWORK); - if (!co_list) { - return FALSE; - } - - co_call = (CoreObject *)co_list->data; - g_slist_free(co_list); - - if (!co_call) { + co_call = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL); + if (!co_call) return FALSE; - } switch (command) { case TRESP_CALL_DIAL: { diff --git a/src/desc-dbus.c b/src/desc-dbus.c index a2a135f..f67f44e 100644 --- a/src/desc-dbus.c +++ b/src/desc-dbus.c @@ -52,7 +52,6 @@ static void add_modem(struct custom_data *ctx, TcorePlugin *p) TelephonyObjectSkeleton *object; char *plugin_name = NULL; char *path = NULL; - GSList *co_list = NULL; plugin_name = tcore_plugin_ref_plugin_name(p); if (!plugin_name) @@ -74,59 +73,35 @@ static void add_modem(struct custom_data *ctx, TcorePlugin *p) /* Add interfaces */ dbus_plugin_setup_modem_interface(object, ctx); - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_CALL); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL) != NULL) dbus_plugin_setup_call_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_NETWORK); - if (co_list) { - g_slist_free(co_list); + + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_NETWORK) != NULL) dbus_plugin_setup_network_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SS); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SS) != NULL) dbus_plugin_setup_ss_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SMS); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SMS) != NULL) dbus_plugin_setup_sms_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SAT); - if (co_list) { - g_slist_free(co_list); + + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SAT) != NULL) dbus_plugin_setup_sat_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_PHONEBOOK); - if (co_list) { - g_slist_free(co_list); + + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_PHONEBOOK) != NULL) dbus_plugin_setup_phonebook_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SAP); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SAP) != NULL) dbus_plugin_setup_sap_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SIM); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SIM) != NULL) dbus_plugin_setup_sim_interface(object, ctx); - } - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_GPS); - if (co_list) { - g_slist_free(co_list); + if (tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_GPS) != NULL) dbus_plugin_setup_gps_interface(object, ctx); - } g_dbus_object_manager_server_export (ctx->manager, G_DBUS_OBJECT_SKELETON (object)); @@ -139,8 +114,8 @@ static void refresh_object(struct custom_data *ctx) { GSList *plugins; GSList *cur; - GSList *co_list; TcorePlugin *p; + CoreObject *co; if (!ctx->manager) { dbg("not ready.."); @@ -157,16 +132,12 @@ static void refresh_object(struct custom_data *ctx) if (!p) continue; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_MODEM); - if (!co_list) + co = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_MODEM); + if (!co) continue; - if (!tcore_object_get_hal(co_list->data)) { - g_slist_free(co_list); + if (!tcore_object_get_hal(co)) continue; - } - - g_slist_free(co_list); add_modem(ctx, p); } @@ -337,10 +308,10 @@ on_manager_getmodems (TelephonyManager *mgr, struct custom_data *ctx = user_data; GSList *plugins; GSList *cur; - GSList *co_list; int max_count = 0; int count; TcorePlugin *p; + CoreObject *co; gchar **list; plugins = tcore_server_ref_plugins(ctx->server); @@ -359,15 +330,12 @@ on_manager_getmodems (TelephonyManager *mgr, if (!p) continue; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_MODEM); - if (!co_list) + co = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_MODEM); + if (!co) continue; - if (!tcore_object_get_hal(co_list->data)) { - g_slist_free(co_list); + if (!tcore_object_get_hal(co)) continue; - } - g_slist_free(co_list); list[count] = g_strdup(tcore_plugin_get_description(p)->name); count++; diff --git a/src/gps.c b/src/gps.c index 1c3bb58..59bbbcc 100644 --- a/src/gps.c +++ b/src/gps.c @@ -125,7 +125,6 @@ gboolean dbus_plugin_gps_response(struct custom_data *ctx, UserRequest *ur, stru { const struct tresp_gps_set_frequency_aiding*resp_gps_frequency_aiding = data; - GSList *co_list; CoreObject *co_gps; char *modem_name = NULL; TcorePlugin *p = NULL; @@ -139,17 +138,9 @@ gboolean dbus_plugin_gps_response(struct custom_data *ctx, UserRequest *ur, stru if (!p) return FALSE; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_GPS); - if (!co_list) { + co_gps = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_GPS); + if (!co_gps) return FALSE; - } - - co_gps = (CoreObject *)co_list->data; - g_slist_free(co_list); - - if (!co_gps) { - return FALSE; - } switch (command) { case TRESP_GPS_SET_FREQUENCY_AIDING: diff --git a/src/network.c b/src/network.c index 5dc04eb..7998819 100644 --- a/src/network.c +++ b/src/network.c @@ -706,7 +706,6 @@ gboolean dbus_plugin_network_response(struct custom_data *ctx, UserRequest *ur, int i = 0; char *buf; - GSList *co_list; CoreObject *co_network; char *modem_name = NULL; TcorePlugin *p = NULL; @@ -720,17 +719,9 @@ gboolean dbus_plugin_network_response(struct custom_data *ctx, UserRequest *ur, if (!p) return FALSE; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_NETWORK); - if (!co_list) { + co_network = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_NETWORK); + if (!co_network) return FALSE; - } - - co_network = (CoreObject *)co_list->data; - g_slist_free(co_list); - - if (!co_network) { - return FALSE; - } switch (command) { case TRESP_NETWORK_SEARCH: { diff --git a/src/phonebook.c b/src/phonebook.c index a9e1a0d..94fc41f 100644 --- a/src/phonebook.c +++ b/src/phonebook.c @@ -58,21 +58,13 @@ static gboolean on_phonebook_get_init_status(TelephonyPhonebook *phonebook, GDBu struct custom_data *ctx = user_data; gboolean pb_status = FALSE; struct tel_phonebook_support_list *list = NULL; - GSList *co_list = NULL; CoreObject *co_pb = NULL; TcorePlugin *plugin = NULL; dbg("Func Entrance"); plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT); - co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_PHONEBOOK); - if (!co_list) { - dbg("error- co_list is NULL"); - return FALSE; - } - co_pb = (CoreObject *)co_list->data; - g_slist_free(co_list); - + co_pb = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_PHONEBOOK); if (!co_pb) { dbg("error- co_pb is NULL"); return FALSE; diff --git a/src/sim.c b/src/sim.c index 4de9f67..b0bc04e 100644 --- a/src/sim.c +++ b/src/sim.c @@ -84,21 +84,13 @@ static gboolean on_sim_get_init_status(TelephonySim *sim, GDBusMethodInvocation struct custom_data *ctx = user_data; gint tmp_cardstatus = 0xff; gboolean b_changed = FALSE; - GSList *co_list = NULL; CoreObject *co_sim = NULL; TcorePlugin *plugin = NULL; dbg("Func Entrance"); plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT); - co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SIM); - if (!co_list) { - dbg("error- co_list is NULL"); - return FALSE; - } - co_sim = (CoreObject *)co_list->data; - g_slist_free(co_list); - + co_sim = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SIM); if (!co_sim) { dbg("error- co_sim is NULL"); return FALSE; @@ -118,21 +110,13 @@ static gboolean on_sim_get_card_type(TelephonySim *sim, GDBusMethodInvocation *i { struct custom_data *ctx = user_data; enum tel_sim_type type = SIM_TYPE_UNKNOWN; - GSList *co_list = NULL; CoreObject *co_sim = NULL; TcorePlugin *plugin = NULL; dbg("Func Entrance"); plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT); - co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SIM); - if (!co_list) { - dbg("error- co_list is NULL"); - return FALSE; - } - co_sim = (CoreObject *)co_list->data; - g_slist_free(co_list); - + co_sim = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SIM); if (!co_sim) { dbg("error- co_sim is NULL"); return FALSE; @@ -150,20 +134,12 @@ static gboolean on_sim_get_imsi(TelephonySim *sim, GDBusMethodInvocation *invoca { struct custom_data *ctx = user_data; struct tel_sim_imsi *n_imsi; - GSList *co_list = NULL; CoreObject *co_sim = NULL; TcorePlugin *plugin = NULL; dbg("Func Entrance"); plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT); - co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SIM); - if (!co_list) { - dbg("error- co_list is NULL"); - return FALSE; - } - co_sim = (CoreObject *)co_list->data; - g_slist_free(co_list); - + co_sim = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SIM); if (!co_sim) { dbg("error- co_sim is NULL"); return FALSE; diff --git a/src/sms.c b/src/sms.c index 5443568..72558cd 100644 --- a/src/sms.c +++ b/src/sms.c @@ -410,19 +410,16 @@ on_sms_set_sca(TelephonySms *sms, GDBusMethodInvocation *invocation, setSca.scaInfo.typeOfNum = arg_ton; setSca.scaInfo.numPlanId = arg_npi; - if ((setSca.scaInfo.dialNumLen <= 0) || (setSca.scaInfo.dialNumLen > (SMS_MAX_SMS_SERVICE_CENTER_ADDR + 1))) - { + if ((setSca.scaInfo.dialNumLen <= 0) + || (setSca.scaInfo.dialNumLen > SMS_SMSP_ADDRESS_LEN)) { err("[tcore_SMS] TAPI_API_INVALID_INPUT !!!"); return FALSE; } - else if(setSca.index != 0) - { + else if(setSca.index != 0) { err("[tcore_SMS] Index except 0 is supported"); // api_err = TAPI_API_NOT_SUPPORTED; return FALSE; - } - else - { + } else { gsize length; guchar *decoded_sca = NULL; @@ -771,22 +768,13 @@ on_sms_get_sms_ready_status(TelephonySms *sms, GDBusMethodInvocation *invocation gpointer user_data) { struct custom_data *ctx = user_data; - GSList *co_list = NULL; CoreObject *co_sms = NULL; TcorePlugin *plugin = NULL; dbg("Func Entrance"); plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT); - co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SMS); - if (!co_list) { - dbg("error- co_list is NULL"); - return FALSE; - } - - co_sms = (CoreObject *)co_list->data; - g_slist_free(co_list); - + co_sms = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SMS); if (!co_sms) { dbg("error- co_sms is NULL"); return FALSE; @@ -829,7 +817,6 @@ gboolean dbus_plugin_setup_sms_interface(TelephonyObjectSkeleton *object, struct gboolean dbus_plugin_sms_response(struct custom_data *ctx, UserRequest *ur, struct dbus_request_info *dbus_info, enum tcore_response_command command, unsigned int data_len, const void *data) { - GSList *co_list; CoreObject *co_sms; char *modem_name = NULL; TcorePlugin *p = NULL; @@ -844,17 +831,9 @@ gboolean dbus_plugin_sms_response(struct custom_data *ctx, UserRequest *ur, stru if (!p) return FALSE; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_SMS); - if (!co_list) { + co_sms = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_SMS); + if (!co_sms) return FALSE; - } - - co_sms = (CoreObject *)co_list->data; - g_slist_free(co_list); - - if (!co_sms) { - return FALSE; - } switch (command) { case TRESP_SMS_SEND_UMTS_MSG: {