X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fs_network.c;h=e4aab10e9495b00b5c1a26b52f644d1d53f20f46;hb=8e963946721400567c03b47164981cce1ce0cbd4;hp=7c5e8d983458c6fdfbce33ed7675f0cadf039043;hpb=96434a28507a2df50eae8e5aaa7507d0a383c577;p=platform%2Fcore%2Ftelephony%2Ftel-plugin-imc.git diff --git a/src/s_network.c b/src/s_network.c index 7c5e8d9..e4aab10 100644 --- a/src/s_network.c +++ b/src/s_network.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -118,18 +119,16 @@ static void on_confirmation_network_message_send(TcorePending *p, gboolean resul } } -static void nwk_prepare_and_send_pending_request(TcorePlugin *plugin, char *co_name, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, UserRequest *ur, TcorePendingResponseCallback callback) +static void nwk_prepare_and_send_pending_request(CoreObject *co, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, UserRequest *ur, TcorePendingResponseCallback callback) { TcoreATRequest *req = NULL; TcoreHal *hal; - CoreObject *o = NULL; TcorePending *pending = NULL; TReturn ret; - o = tcore_plugin_ref_core_object(plugin, co_name); - hal = tcore_object_get_hal(o); + hal = tcore_object_get_hal(co); - pending = tcore_pending_new(o, 0); + pending = tcore_pending_new(co, 0); req = tcore_at_request_new(at_cmd, prefix, at_cmd_type); dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd)); @@ -244,23 +243,18 @@ static enum telephony_network_service_type _get_service_type(enum telephony_netw static void _ps_set(TcorePlugin *p, int status) { - GSList *co_list = NULL; + CoreObject *co_ps; - co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_PS); - do { - CoreObject *o = NULL; - o = (CoreObject *) co_list->data; - if (!o) - break; - - if (status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) { - tcore_ps_set_online(o, TRUE); - } else { - tcore_ps_set_online(o, FALSE); - } - } while ((co_list = g_slist_next(co_list))); + co_ps = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_PS); + if (co_ps == NULL) { + err("No PS Core Object on plugin"); + return; + } - g_slist_free(co_list); + if (status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) + tcore_ps_set_online(co_ps, TRUE); + else + tcore_ps_set_online(co_ps, FALSE); } static void on_timeout_search_network(TcorePending *p, void *user_data) @@ -1623,7 +1617,7 @@ minutes, seconds.*/ dbg("new pending(AT+XOPS=0/5/6 for Nitz PLMN name)"); /* Get NITZ name and plmn_id via AT+XCOPS = 0/5/6 */ - nwk_prepare_and_send_pending_request(tcore_object_ref_plugin(o), "umts_network", "AT+XCOPS=0;+XCOPS=5;+XCOPS=6", "+XCOPS", TCORE_AT_MULTILINE, ur, on_response_get_nitz_name); + nwk_prepare_and_send_pending_request(o, "AT+XCOPS=0;+XCOPS=5;+XCOPS=6", "+XCOPS", TCORE_AT_MULTILINE, ur, on_response_get_nitz_name); } else { dbg("line is NULL"); } @@ -2143,7 +2137,7 @@ static TReturn get_serving_network(CoreObject *o, UserRequest *ur) dbg("new pending(AT+COPS?)"); - nwk_prepare_and_send_pending_request(tcore_object_ref_plugin(o), "umts_network", "AT+COPS=3,2;+COPS?;+COPS=3,0;+COPS?", "+COPS", TCORE_AT_MULTILINE, ur, on_response_get_serving_network); + nwk_prepare_and_send_pending_request(o, "AT+COPS=3,2;+COPS?;+COPS=3,0;+COPS?", "+COPS", TCORE_AT_MULTILINE, ur, on_response_get_serving_network); return TCORE_RETURN_SUCCESS; } @@ -2165,33 +2159,29 @@ static struct tcore_network_operations network_ops = { .get_serving_network = get_serving_network, }; -gboolean s_network_init(TcorePlugin *p, TcoreHal *h) +gboolean s_network_init(TcorePlugin *cp, CoreObject *co_network) { - CoreObject *o = NULL; + dbg("Enter"); - o = tcore_network_new(p, "umts_network", &network_ops, h); - if (!o) - return FALSE; + tcore_network_override_ops(co_network, &network_ops); - tcore_object_add_callback(o, "+CREG", on_event_cs_network_regist, NULL); - tcore_object_add_callback(o, "+CGREG", on_event_ps_network_regist, NULL); - tcore_object_add_callback(o, "+XCIEV", on_event_network_icon_info, NULL); + tcore_object_override_callback(co_network, "+CREG", on_event_cs_network_regist, NULL); + tcore_object_override_callback(co_network, "+CGREG", on_event_ps_network_regist, NULL); + tcore_object_override_callback(co_network, "+XCIEV", on_event_network_icon_info, NULL); /* +CTZV: ,