X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fs_call.c;h=00ed15ab19190d380ffb35ac7aa48bfa37838b5c;hb=54df662dbb1d3f5bbfa878798935edbbf87f90c4;hp=e48e9001389ce8621e6229df5d63765ed0c66fe3;hpb=3f20c7dd87e545768faacdfc7ffe80f59e8978fb;p=platform%2Fcore%2Ftelephony%2Ftel-plugin-imc.git diff --git a/src/s_call.c b/src/s_call.c index e48e900..00ed15a 100644 --- a/src/s_call.c +++ b/src/s_call.c @@ -474,7 +474,7 @@ static void _call_status_idle(TcorePlugin *p, CallObject *co) UserRequest *ur; dbg("Entry"); - core_obj = tcore_plugin_ref_core_object(p, "call"); + core_obj = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL); dbg("Call ID [%d], Call Status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co)); if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_IDLE) { @@ -533,7 +533,7 @@ static void _call_status_dialing(TcorePlugin *p, CallObject *co) // Send notification to TAPI tcore_server_send_notification(tcore_plugin_ref_server(p), - tcore_plugin_ref_core_object(p, "call"), + tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_DIALING, sizeof(struct tnoti_call_status_dialing), (void *) &data); @@ -562,7 +562,7 @@ static void _call_status_alert(TcorePlugin *p, CallObject *co) // Send notification to TAPI tcore_server_send_notification(tcore_plugin_ref_server(p), - tcore_plugin_ref_core_object(p, "call"), + tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_ALERT, sizeof(struct tnoti_call_status_alert), (void *) &data); @@ -590,7 +590,7 @@ static void _call_status_active(TcorePlugin *p, CallObject *co) // Send notification to TAPI tcore_server_send_notification(tcore_plugin_ref_server(p), - tcore_plugin_ref_core_object(p, "call"), + tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_ACTIVE, sizeof(struct tnoti_call_status_active), (void *) &data); @@ -618,7 +618,7 @@ static void _call_status_held(TcorePlugin *p, CallObject *co) // Send notification to TAPI tcore_server_send_notification(tcore_plugin_ref_server(p), - tcore_plugin_ref_core_object(p, "call"), + tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_HELD, sizeof(struct tnoti_call_status_held), (void *) &data); @@ -662,7 +662,7 @@ static void _call_status_incoming(TcorePlugin *p, CallObject *co) // Send notification to TAPI tcore_server_send_notification(tcore_plugin_ref_server(p), - tcore_plugin_ref_core_object(p, "call"), + tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_CALL), TNOTI_CALL_STATUS_INCOMING, sizeof(struct tnoti_call_status_incoming), (void *) &data); @@ -3397,696 +3397,22 @@ static struct tcore_call_operations call_ops = { .set_sound_noise_reduction = NULL, }; -static void s_call_info_mo_waiting(CoreObject *o) +gboolean s_call_init(TcorePlugin *cp, CoreObject *co_call) { - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_WAITING, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mo_forwarded(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_FORWARDED, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mo_barred_incoming(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_BARRED_INCOMING, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mo_barred_outgoing(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_BARRED_OUTGOING, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mo_deflected(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_DEFLECTED, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mo_clir_suppression_reject(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - dbg("Entry"); - // Parent plugin - plugin = tcore_object_ref_plugin(o); + tcore_call_override_ops(co_call, &call_ops, NULL); - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT, - sizeof(unsigned int), - (void *) &id); + /* Add Callbacks */ + tcore_object_override_callback(co_call, "+XCALLSTAT", on_notification_call_info, NULL); + tcore_object_override_callback(co_call, "+CLIP", on_notification_call_clip_info, NULL); dbg("Exit"); - return; -} - -static void s_call_info_mo_cfu(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL, - sizeof(unsigned int), - (void *) &id); - dbg("Exit"); - return; -} - -static void s_call_info_mo_cfc(CoreObject *o) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_current_on_mo_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_FORWARD_CONDITIONAL, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode, char *number) -{ - CallObject *co = NULL; - - dbg("Entry"); - - // Call Core object - co = tcore_call_object_current_on_mt_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Set CLI information - tcore_call_object_set_cli_info(co, mode, number); - - dbg("Exit"); - return; -} - -static void s_call_info_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode, char *name, int dcs) -{ - CallObject *co = NULL; - - dbg("Entry"); - - // Call Core object - co = tcore_call_object_current_on_mt_processing(o); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Set CNA information - tcore_call_object_set_cna_info(co, mode, name, dcs); - - dbg("Exit"); - return; -} - -static void s_call_info_mt_forwarded_call(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_FORWARDED_CALL, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mt_deflected_call(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_DEFLECTED_CALL, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_mt_transfered(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_TRANSFERED_CALL, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_held(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_HELD, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_active(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_ACTIVE, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_joined(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_JOINED, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_released_on_hold(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_RELEASED_ON_HOLD, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_transfer_alert(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_TRANSFER_ALERT, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_transfered(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_TRANSFERED, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -static void s_call_info_cf_check_message(CoreObject *o, char *number) -{ - TcorePlugin *plugin = NULL; - CallObject *co = NULL; - int id = 0; - - dbg("Entry"); - - // Parent plugin - plugin = tcore_object_ref_plugin(o); - - // Call Core object - co = tcore_call_object_find_by_number(o, number); - if (!co) { - err("Failed to find Call Core object!"); - return; - } - - // Call ID - id = tcore_call_object_get_id(co); - - // Send notification to TAPI - tcore_server_send_notification(tcore_plugin_ref_server(plugin), - tcore_plugin_ref_core_object(plugin, "call"), - TNOTI_CALL_INFO_CF_CHECK_MESSAGE, - sizeof(unsigned int), - (void *) &id); - - dbg("Exit"); - return; -} - -// Call Information Operations -static struct tcore_call_information_operations call_information_ops = { - .mo_call_col = 0, - .mo_call_waiting = s_call_info_mo_waiting, - .mo_call_cug = 0, - .mo_call_forwarded = s_call_info_mo_forwarded, - .mo_call_barred_incoming = s_call_info_mo_barred_incoming, - .mo_call_barred_outgoing = s_call_info_mo_barred_outgoing, - .mo_call_deflected = s_call_info_mo_deflected, - .mo_call_clir_suppression_reject = s_call_info_mo_clir_suppression_reject, - .mo_call_cfu = s_call_info_mo_cfu, - .mo_call_cfc = s_call_info_mo_cfc, - .mt_call_cli = s_call_info_mt_cli, - .mt_call_cna = s_call_info_mt_cna, - .mt_call_forwarded_call = s_call_info_mt_forwarded_call, - .mt_call_cug_call = 0, - .mt_call_deflected_call = s_call_info_mt_deflected_call, - .mt_call_transfered = s_call_info_mt_transfered, - .call_held = s_call_info_held, - .call_active = s_call_info_active, - .call_joined = s_call_info_joined, - .call_released_on_hold = s_call_info_released_on_hold, - .call_transfer_alert = s_call_info_transfer_alert, - .call_transfered = s_call_info_transfered, - .call_cf_check_message = s_call_info_cf_check_message, -}; - -gboolean s_call_init(TcorePlugin *p, TcoreHal *h) -{ - CoreObject *o = NULL; - struct property_call_info *data = NULL; - - dbg("Entry"); - - // Creating Call COre object - o = tcore_call_new(p, "call", &call_ops, h); - if (!o) { - err("Failed to create Call Core Object"); - return FALSE; - } - - // Set Call Operations - tcore_call_information_set_operations(o, &call_information_ops); - - // Add Callbacks - tcore_object_add_callback(o, "+XCALLSTAT", on_notification_call_info, NULL); - tcore_object_add_callback(o, "+CLIP", on_notification_call_clip_info, NULL); - - // User Data - data = calloc(sizeof(struct property_call_info *), 1); - tcore_plugin_link_property(p, "CALL", data); - - dbg("Exit"); return TRUE; } -void s_call_exit(TcorePlugin *p) +void s_call_exit(TcorePlugin *cp, CoreObject *co_call) { - CoreObject *o = NULL; - struct property_network_info *data = NULL; - - dbg("Entry"); - - o = tcore_plugin_ref_core_object(p, "call"); - - // Free Call Core Object */ - tcore_call_free(o); - - // Free 'CALL' property */ - data = tcore_plugin_ref_property(p, "CALL"); - if (data) { - g_free(data); - } - dbg("Exit"); - return; }