8 #include <glib-object.h>
18 #include <user_request.h>
19 #include <core_object.h>
21 #include <communicator.h>
23 #include "generated-code.h"
27 static void _launch_voice_call( struct tnoti_call_status_incoming* incoming )
31 char forward[2] = {0, };
32 char active_line[2] = {0, };
34 char number[83] = {0, };
35 char name[83] = {0, };
40 snprintf( id, 2, "%d", incoming->id );
41 dbg("id : [%s]", id );
42 snprintf( cli, 2, "%d", incoming->cli.mode );
43 dbg("cli : [%s]", id );
44 snprintf( number, 83, "%s", incoming->cli.number );
45 dbg("number : [%s]", number );
46 snprintf( forward, 2, "%d", incoming->forward );
47 dbg("forward : [%s]", forward );
48 snprintf( active_line, 2, "%d", incoming->active_line );
49 dbg("active_line : [%s]", active_line );
51 if ( incoming->cna.mode == CALL_CNA_MODE_PRESENT )
52 snprintf( cna, 2, "%d", 0 );
54 snprintf( cna, 2, "%d", 1 );
56 dbg("cna : [%s]", cna );
57 snprintf( name, 83, "%s", incoming->cna.name );
58 dbg("name : [%s]", name );
64 bundle_add(kb, "launch-type", "MT");
65 bundle_add(kb, "handle", id);
66 bundle_add(kb, "number", number);
67 bundle_add(kb, "name_mode", cna);
68 bundle_add(kb, "name", name);
69 bundle_add(kb, "clicause", cli);
70 bundle_add(kb, "fwded", forward);
71 bundle_add(kb, "activeline", active_line);
73 ret = aul_launch_app("com.samsung.call", kb);
74 dbg("aul_launch_app [ voice call ] : %d", ret );
77 appsvc_set_operation(kb, APPSVC_OPERATION_CALL);
78 appsvc_set_uri(kb,"tel:MT");
80 appsvc_add_data(kb, "launch-type", "MT");
81 appsvc_add_data(kb, "handle", id);
82 appsvc_add_data(kb, "number", number);
83 appsvc_add_data(kb, "name_mode", cna);
84 appsvc_add_data(kb, "name", name);
85 appsvc_add_data(kb, "clicause", cli);
86 appsvc_add_data(kb, "fwded", forward);
87 appsvc_add_data(kb, "activeline", active_line);
89 appsvc_run_service(kb, 0, NULL, NULL);
94 static void _launch_video_call( struct tnoti_call_status_incoming* incoming )
98 char forward[2] = {0, };
99 char number[83] = {0, };
104 dbg("Func Entrance");
106 snprintf( id, 2, "%d", incoming->id );
107 dbg("id : [%s]", id );
108 snprintf( number, 83, "%s", incoming->cli.number );
109 dbg("number : [%s]", number );
110 snprintf( cli, 2, "%d", incoming->cli.mode );
111 dbg("cli : [%s]", id );
112 snprintf( forward, 2, "%d", incoming->forward );
113 dbg("forward : [%s]", forward );
115 kb = bundle_create();
116 bundle_add(kb, "KEY_CALL_TYPE", "mt");
117 bundle_add(kb, "KEY_CALL_HANDLE", id);
118 bundle_add(kb, "KEY_CALLING_PARTY_NUMBER", number);
119 bundle_add(kb, "KEY_CLI_CAUSE", cli);
120 bundle_add(kb, "KEY_FORWARDED", forward);
122 ret = aul_launch_app("com.samsung.vtmain", kb);
125 dbg("VT AUL return %d",ret);
128 static gboolean on_call_dial(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_type, gchar* call_number, gpointer user_data)
130 struct treq_call_dial req;
131 struct custom_data *ctx = user_data;
132 UserRequest *ur = MAKE_UR(ctx, call, invocation);
137 dbg("[ error ] ur : 0");
141 req.type = call_type;
144 memcpy( req.number, call_number, MAX_CALL_DIAL_NUM_LEN );
146 tcore_user_request_set_data( ur, sizeof( struct treq_call_dial ), &req );
147 tcore_user_request_set_command( ur, TREQ_CALL_DIAL );
149 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
150 if ( ret != TCORE_RETURN_SUCCESS ) {
151 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
158 static gboolean on_call_answer(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gint answer_type, gpointer user_data)
160 struct treq_call_answer req;
161 struct custom_data *ctx = user_data;
162 UserRequest *ur = MAKE_UR(ctx, call, invocation);
167 dbg("[ error ] ur : 0");
172 req.type = answer_type;
174 tcore_user_request_set_data( ur, sizeof( struct treq_call_answer ), &req );
175 tcore_user_request_set_command( ur, TREQ_CALL_ANSWER );
177 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
178 if ( ret != TCORE_RETURN_SUCCESS ) {
179 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
186 static gboolean on_call_end(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gint end_type, gpointer user_data)
188 struct treq_call_end req;
189 struct custom_data *ctx = user_data;
190 UserRequest *ur = MAKE_UR(ctx, call, invocation);
195 dbg("[ error ] ur : 0");
202 tcore_user_request_set_data( ur, sizeof( struct treq_call_end ), &req );
203 tcore_user_request_set_command( ur, TREQ_CALL_END );
205 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
206 if ( ret != TCORE_RETURN_SUCCESS ) {
207 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
214 static gboolean on_call_dtmf(TelephonyCall *call, GDBusMethodInvocation *invocation, gchar *dtmf_string, gpointer user_data)
216 struct treq_call_dtmf req;
217 struct custom_data *ctx = user_data;
218 UserRequest *ur = MAKE_UR(ctx, call, invocation);
223 dbg("[ error ] ur : 0");
228 memcpy( req.digits, dtmf_string, MAX_CALL_DTMF_DIGITS_LEN );
230 tcore_user_request_set_data( ur, sizeof( struct treq_call_dtmf ), &req );
231 tcore_user_request_set_command( ur, TREQ_CALL_SEND_DTMF );
233 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
234 if ( ret != TCORE_RETURN_SUCCESS ) {
235 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
242 static gboolean on_call_active(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
244 struct treq_call_active req;
245 struct custom_data *ctx = user_data;
246 UserRequest *ur = MAKE_UR(ctx, call, invocation);
251 dbg("[ error ] ur : 0");
257 tcore_user_request_set_data( ur, sizeof( struct treq_call_active ), &req );
258 tcore_user_request_set_command( ur, TREQ_CALL_ACTIVE );
260 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
261 if ( ret != TCORE_RETURN_SUCCESS ) {
262 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
269 static gboolean on_call_hold(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
271 struct treq_call_hold req;
272 struct custom_data *ctx = user_data;
273 UserRequest *ur = MAKE_UR(ctx, call, invocation);
278 dbg("[ error ] ur : 0");
284 tcore_user_request_set_data( ur, sizeof( struct treq_call_hold ), &req );
285 tcore_user_request_set_command( ur, TREQ_CALL_HOLD );
287 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
288 if ( ret != TCORE_RETURN_SUCCESS ) {
289 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
296 static gboolean on_call_swap(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
298 struct treq_call_swap req;
299 struct custom_data *ctx = user_data;
300 UserRequest *ur = MAKE_UR(ctx, call, invocation);
305 dbg("[ error ] ur : 0");
311 tcore_user_request_set_data( ur, sizeof( struct treq_call_swap ), &req );
312 tcore_user_request_set_command( ur, TREQ_CALL_SWAP );
314 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
315 if ( ret != TCORE_RETURN_SUCCESS ) {
316 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
323 static gboolean on_call_join(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
325 struct treq_call_join req;
326 struct custom_data *ctx = user_data;
327 UserRequest *ur = MAKE_UR(ctx, call, invocation);
332 dbg("[ error ] ur : 0");
338 tcore_user_request_set_data( ur, sizeof( struct treq_call_join ), &req );
339 tcore_user_request_set_command( ur, TREQ_CALL_JOIN );
341 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
342 if ( ret != TCORE_RETURN_SUCCESS ) {
343 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
350 static gboolean on_call_split(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
352 struct treq_call_split req;
353 struct custom_data *ctx = user_data;
354 UserRequest *ur = MAKE_UR(ctx, call, invocation);
359 dbg("[ error ] ur : 0");
365 tcore_user_request_set_data( ur, sizeof( struct treq_call_split ), &req );
366 tcore_user_request_set_command( ur, TREQ_CALL_SPLIT );
368 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
369 if ( ret != TCORE_RETURN_SUCCESS ) {
370 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
377 static gboolean on_call_transfer(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
379 struct treq_call_transfer req;
380 struct custom_data *ctx = user_data;
381 UserRequest *ur = MAKE_UR(ctx, call, invocation);
386 dbg("[ error ] ur : 0");
392 tcore_user_request_set_data( ur, sizeof( struct treq_call_transfer ), &req );
393 tcore_user_request_set_command( ur, TREQ_CALL_TRANSFER );
395 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
396 if ( ret != TCORE_RETURN_SUCCESS ) {
397 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
404 static gboolean on_call_deflect(TelephonyCall *call, GDBusMethodInvocation *invocation, gchar *call_number, gpointer user_data)
406 struct treq_call_deflect req;
407 struct custom_data *ctx = user_data;
408 UserRequest *ur = MAKE_UR(ctx, call, invocation);
413 dbg("[ error ] ur : 0");
418 memcpy( req.number, call_number, MAX_CALL_NUMBER_LEN );
420 tcore_user_request_set_data( ur, sizeof( struct treq_call_deflect ), &req );
421 tcore_user_request_set_command( ur, TREQ_CALL_DEFLECT );
423 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
424 if ( ret != TCORE_RETURN_SUCCESS ) {
425 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
432 static gboolean on_call_get_status(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data )
434 struct custom_data *ctx = user_data;
435 TcorePlugin *plugin = 0;
440 gchar call_number[MAX_CALL_NUMBER_LEN];
442 gboolean call_direction;
444 gboolean call_multiparty_state;
446 plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT);
448 dbg("[ error ] plugin : 0");
452 o_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
454 dbg("[ error ] co_list : 0");
458 o = (CoreObject *)o_list->data;
459 g_slist_free(o_list);
461 co = tcore_call_object_find_by_id( o, call_id );
463 dbg("[ error ] co : 0");
467 tcore_call_object_get_number( co, call_number );
469 call_type = tcore_call_object_get_type( co );
470 call_direction = tcore_call_object_get_direction( co );
472 if ( call_direction == TCORE_CALL_DIRECTION_OUTGOING ) {
473 call_direction = TRUE;
475 call_direction = FALSE;
478 call_status = tcore_call_object_get_status( co );
479 call_multiparty_state = tcore_call_object_get_multiparty_state( co );
482 telephony_call_complete_get_status(call, invocation,
483 call_id, call_number, call_type, call_direction, call_status, call_multiparty_state );
488 static gboolean on_call_get_status_all(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data )
490 struct custom_data *ctx = user_data;
491 TcorePlugin *plugin = 0;
500 gchar call_number[MAX_CALL_NUMBER_LEN];
502 gboolean call_direction;
504 gboolean call_multiparty_state;
508 plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT);
510 dbg("[ error ] plugin : 0");
514 list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
516 dbg("[ error ] co_list : 0");
520 o = (CoreObject *)list->data;
523 g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
525 #define MAX_CALL_STATUS_NUM 7
526 for ( i=0; i<MAX_CALL_STATUS_NUM; i++ ) {
527 list = tcore_call_object_find_by_status( o, i );
534 dbg("[ check ] there is a call on state (0x%x)", i);
538 co = (CallObject*)list->data;
540 dbg("[ error ] call object : 0");
545 call_id = tcore_call_object_get_id( co );
546 len = tcore_call_object_get_number( co, call_number );
548 dbg("[ check ] no number : (0x%d)", call_id);
551 call_type = tcore_call_object_get_type( co );
552 call_direction = tcore_call_object_get_direction( co );
554 if ( call_direction == TCORE_CALL_DIRECTION_OUTGOING ) {
555 call_direction = TRUE;
557 call_direction = FALSE;
560 call_status = tcore_call_object_get_status( co );
561 call_multiparty_state = tcore_call_object_get_multiparty_state( co );
563 g_variant_builder_open(&b, G_VARIANT_TYPE("a{sv}"));
564 g_variant_builder_add(&b, "{sv}", "call_id", g_variant_new_int32( call_id ));
565 g_variant_builder_add(&b, "{sv}", "call_number", g_variant_new_string( call_number ));
566 g_variant_builder_add(&b, "{sv}", "call_type", g_variant_new_int32( call_type ));
567 g_variant_builder_add(&b, "{sv}", "call_direction", g_variant_new_boolean( call_direction ));
568 g_variant_builder_add(&b, "{sv}", "call_state", g_variant_new_int32( call_status ));
569 g_variant_builder_add(&b, "{sv}", "call_multiparty_state", g_variant_new_boolean( call_multiparty_state ));
570 g_variant_builder_close(&b);
572 tmp = g_slist_next( tmp );
576 dbg("[ check ] there is no call on state (0x%x)", i);
582 gv = g_variant_builder_end(&b);
584 telephony_call_complete_get_status_all(call, invocation, gv);
591 static gboolean on_call_set_sound_path(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_path, gboolean extra_volume_on, gpointer user_data)
593 struct treq_call_sound_set_path req;
594 struct custom_data *ctx = user_data;
595 UserRequest *ur = MAKE_UR(ctx, call, invocation);
600 dbg("[ error ] ur : 0");
604 req.path = sound_path;
605 req.extra_volume_on = extra_volume_on;
607 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_path ), &req );
608 tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_PATH );
610 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
611 if ( ret != TCORE_RETURN_SUCCESS ) {
612 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
619 static gboolean on_call_get_volume(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_device, gint sound_type, gpointer user_data)
621 struct treq_call_sound_get_volume_level req;
622 struct custom_data *ctx = user_data;
623 UserRequest *ur = MAKE_UR(ctx, call, invocation);
628 dbg("[ error ] ur : 0");
632 req.device = sound_device;
633 req.sound = sound_type;
635 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_get_volume_level ), &req );
636 tcore_user_request_set_command( ur, TREQ_CALL_GET_SOUND_VOLUME_LEVEL );
638 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
639 if ( ret != TCORE_RETURN_SUCCESS ) {
640 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
647 static gboolean on_call_set_volume(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_device, gint sound_type, gint sound_volume, gpointer user_data)
649 struct treq_call_sound_set_volume_level req;
650 struct custom_data *ctx = user_data;
651 UserRequest *ur = MAKE_UR(ctx, call, invocation);
656 dbg("[ error ] ur : 0");
660 req.device = sound_device;
661 req.sound = sound_type;
662 req.volume = sound_volume;
664 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_volume_level ), &req );
665 tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_VOLUME_LEVEL );
667 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
668 if ( ret != TCORE_RETURN_SUCCESS ) {
669 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
676 static gboolean on_call_get_mute_status(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
678 struct custom_data *ctx = user_data;
679 UserRequest *ur = MAKE_UR(ctx, call, invocation);
684 dbg("[ error ] ur : 0");
688 tcore_user_request_set_command( ur, TREQ_CALL_GET_MUTE_STATUS );
690 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
691 if ( ret != TCORE_RETURN_SUCCESS ) {
692 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
699 static gboolean on_call_mute(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
701 struct custom_data *ctx = user_data;
702 UserRequest *ur = MAKE_UR(ctx, call, invocation);
707 dbg("[ error ] ur : 0");
711 tcore_user_request_set_command( ur, TREQ_CALL_MUTE );
713 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
714 if ( ret != TCORE_RETURN_SUCCESS ) {
715 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
722 static gboolean on_call_unmute(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
724 struct custom_data *ctx = user_data;
725 UserRequest *ur = MAKE_UR(ctx, call, invocation);
730 dbg("[ error ] ur : 0");
734 tcore_user_request_set_command( ur, TREQ_CALL_UNMUTE );
736 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
737 if ( ret != TCORE_RETURN_SUCCESS ) {
738 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
745 static gboolean on_call_set_sound_recording(TelephonyCall *call, GDBusMethodInvocation *invocation, gint recording_state, gpointer user_data)
747 struct custom_data *ctx = user_data;
748 struct treq_call_sound_set_recording req;
750 UserRequest *ur = MAKE_UR(ctx, call, invocation);
755 dbg("[ error ] ur : 0");
759 req.state = (gboolean)recording_state;
761 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_recording ), &req );
762 tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_RECORDING );
764 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
765 if ( ret != TCORE_RETURN_SUCCESS ) {
766 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
773 static gboolean on_call_set_sound_equalization(TelephonyCall *call, GDBusMethodInvocation *invocation, gint eq_mode, gint eq_direction, gchar* eq_parameter, gpointer user_data)
775 struct custom_data *ctx = user_data;
776 struct treq_call_sound_set_equalization req;
778 UserRequest *ur = MAKE_UR(ctx, call, invocation);
783 dbg("[ error ] ur : 0");
787 req.mode = (gboolean)eq_mode;
788 req.direction = (enum telephony_call_sound_direction)eq_direction;
789 memcpy( (char*)req.parameter, (const char*)eq_parameter, (MAX_CALL_EQ_PARAMETER_SIZE*2) );
791 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_equalization ), &req );
792 tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_EQUALIZATION );
794 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
795 if ( ret != TCORE_RETURN_SUCCESS ) {
796 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
803 static gboolean on_call_set_sound_noise_reduction(TelephonyCall *call, GDBusMethodInvocation *invocation, gint nr_state, gpointer user_data)
805 struct custom_data *ctx = user_data;
806 struct treq_call_sound_set_noise_reduction req;
808 UserRequest *ur = MAKE_UR(ctx, call, invocation);
813 dbg("[ error ] ur : 0");
817 req.status = (gboolean)nr_state;
819 tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_noise_reduction ), &req );
820 tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_NOISE_REDUCTION );
822 ret = tcore_communicator_dispatch_request( ctx->comm, ur );
823 if ( ret != TCORE_RETURN_SUCCESS ) {
824 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
832 gboolean dbus_plugin_setup_call_interface(TelephonyObjectSkeleton *object, struct custom_data *ctx)
836 call = telephony_call_skeleton_new();
837 telephony_object_skeleton_set_call(object, call);
838 g_object_unref(call);
840 g_signal_connect (call,
842 G_CALLBACK (on_call_dial),
845 g_signal_connect (call,
847 G_CALLBACK (on_call_answer),
850 g_signal_connect (call,
852 G_CALLBACK (on_call_end),
855 g_signal_connect (call,
857 G_CALLBACK (on_call_dtmf),
860 g_signal_connect (call,
862 G_CALLBACK (on_call_active),
865 g_signal_connect (call,
867 G_CALLBACK (on_call_hold),
870 g_signal_connect (call,
872 G_CALLBACK (on_call_swap),
875 g_signal_connect (call,
877 G_CALLBACK (on_call_join),
880 g_signal_connect (call,
882 G_CALLBACK (on_call_split),
885 g_signal_connect (call,
887 G_CALLBACK (on_call_transfer),
890 g_signal_connect (call,
892 G_CALLBACK (on_call_deflect),
895 g_signal_connect (call,
897 G_CALLBACK (on_call_get_status),
900 g_signal_connect (call,
901 "handle-get-status-all",
902 G_CALLBACK (on_call_get_status_all),
906 g_signal_connect (call,
907 "handle-set-sound-path",
908 G_CALLBACK (on_call_set_sound_path),
911 g_signal_connect (call,
913 G_CALLBACK (on_call_get_volume),
916 g_signal_connect (call,
918 G_CALLBACK (on_call_set_volume),
921 g_signal_connect (call,
922 "handle-get-mute-status",
923 G_CALLBACK (on_call_get_mute_status),
926 g_signal_connect (call,
928 G_CALLBACK (on_call_mute),
931 g_signal_connect (call,
933 G_CALLBACK (on_call_unmute),
936 g_signal_connect (call,
937 "handle-set-sound-recording",
938 G_CALLBACK (on_call_set_sound_recording),
941 g_signal_connect (call,
942 "handle-set-sound-equalization",
943 G_CALLBACK (on_call_set_sound_equalization),
946 g_signal_connect (call,
947 "handle-set-sound-noise-reduction",
948 G_CALLBACK (on_call_set_sound_noise_reduction),
955 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)
960 char *modem_name = NULL;
961 TcorePlugin *p = NULL;
963 modem_name = tcore_user_request_get_modem_name(ur);
967 p = tcore_server_find_plugin(ctx->server, modem_name);
972 co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_NETWORK);
977 co_call = (CoreObject *)co_list->data;
978 g_slist_free(co_list);
985 case TRESP_CALL_DIAL: {
986 struct tresp_call_dial *resp = (struct tresp_call_dial*)data;
988 dbg("receive TRESP_CALL_DIAL");
989 dbg("resp->err : [%d]", resp->err);
991 telephony_call_complete_dial(dbus_info->interface_object, dbus_info->invocation, resp->err);
994 case TRESP_CALL_ANSWER: {
995 struct tresp_call_answer *resp = (struct tresp_call_answer*)data;
997 dbg("receive TRESP_CALL_ANSWER");
998 dbg("resp->err : [%d]", resp->err);
999 dbg("resp->id : [%d]", resp->id);
1001 telephony_call_complete_answer(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1005 case TRESP_CALL_END: {
1006 struct tresp_call_end *resp = (struct tresp_call_end*)data;
1008 dbg("receive TRESP_CALL_END");
1009 dbg("resp->err : [%d]", resp->err);
1010 dbg("resp->id : [%d]", resp->err);
1011 dbg("resp->type : [%d]", resp->type);
1013 telephony_call_complete_end(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id, resp->type );
1017 case TRESP_CALL_HOLD: {
1018 struct tresp_call_hold *resp = (struct tresp_call_hold*)data;
1020 dbg("receive TRESP_CALL_HOLD");
1021 dbg("resp->err : [%d]", resp->err);
1022 dbg("resp->id : [%d]", resp->id);
1024 telephony_call_complete_hold(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1028 case TRESP_CALL_ACTIVE: {
1029 struct tresp_call_active *resp = (struct tresp_call_active*)data;
1031 dbg("receive TRESP_CALL_ACTIVE");
1032 dbg("resp->err : [%d]", resp->err);
1033 dbg("resp->id : [%d]", resp->id);
1035 telephony_call_complete_active(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1039 case TRESP_CALL_SWAP: {
1040 struct tresp_call_swap *resp = (struct tresp_call_swap*)data;
1042 dbg("receive TRESP_CALL_SWAP");
1043 dbg("resp->err : [%d]", resp->err);
1044 dbg("resp->id : [%d]", resp->id);
1046 telephony_call_complete_swap(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1050 case TRESP_CALL_JOIN: {
1051 struct tresp_call_join *resp = (struct tresp_call_join*)data;
1053 dbg("receive TRESP_CALL_JOIN");
1054 dbg("resp->err : [%d]", resp->err);
1055 dbg("resp->id : [%d]", resp->id);
1057 telephony_call_complete_join(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1062 case TRESP_CALL_SPLIT: {
1063 struct tresp_call_split *resp = (struct tresp_call_split*)data;
1065 dbg("receive TRESP_CALL_SPLIT");
1066 dbg("resp->err : [%d]", resp->err);
1067 dbg("resp->id : [%d]", resp->id);
1069 telephony_call_complete_split(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1073 case TRESP_CALL_DEFLECT: {
1074 struct tresp_call_deflect *resp = (struct tresp_call_deflect*)data;
1076 dbg("receive TRESP_CALL_DEFLECT");
1077 dbg("resp->err : [%d]", resp->err);
1078 dbg("resp->id : [%d]", resp->id);
1080 telephony_call_complete_deflect(dbus_info->interface_object, dbus_info->invocation, resp->err );
1084 case TRESP_CALL_TRANSFER: {
1085 struct tresp_call_transfer *resp = (struct tresp_call_transfer*)data;
1087 dbg("receive TRESP_CALL_TRANSFER");
1088 dbg("resp->err : [%d]", resp->err);
1089 dbg("resp->id : [%d]", resp->id);
1091 telephony_call_complete_transfer(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1095 case TRESP_CALL_SEND_DTMF: {
1096 struct tresp_call_dtmf *resp = (struct tresp_call_dtmf*)data;
1098 dbg("receive TRESP_CALL_SEND_DTMF");
1099 dbg("resp->err : [%d]", resp->err);
1101 telephony_call_complete_dtmf(dbus_info->interface_object, dbus_info->invocation, resp->err);
1104 case TRESP_CALL_SET_SOUND_PATH: {
1105 struct tresp_call_sound_set_path *resp = (struct tresp_call_sound_set_path*)data;
1107 dbg("receive TRESP_CALL_SET_SOUND_PATH");
1108 dbg("resp->err : [%d]", resp->err);
1110 telephony_call_complete_set_sound_path(dbus_info->interface_object, dbus_info->invocation, resp->err);
1113 case TRESP_CALL_SET_SOUND_VOLUME_LEVEL: {
1114 struct tresp_call_sound_set_volume_level *resp = (struct tresp_call_sound_set_volume_level*)data;
1116 dbg("receive TRESP_CALL_SET_SOUND_VOLUME_LEVEL");
1117 dbg("resp->err : [%d]", resp->err);
1119 telephony_call_complete_set_volume(dbus_info->interface_object, dbus_info->invocation, resp->err);
1122 case TRESP_CALL_GET_SOUND_VOLUME_LEVEL: {
1123 struct tresp_call_sound_get_volume_level *resp = (struct tresp_call_sound_get_volume_level*)data;
1124 GVariant *result = 0;
1127 dbg("receive TRESP_CALL_GET_SOUND_VOLUME_LEVEL");
1129 g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
1131 g_variant_builder_open(&b, G_VARIANT_TYPE("a{sv}"));
1133 dbg("resp->err : [%d]", resp->err);
1135 g_variant_builder_add(&b, "{sv}", "err", g_variant_new_int32(resp->err));
1139 dbg("resp->record_num : [%d]", resp->record_num);
1141 for ( i=0; i<resp->record_num; i++ ) {
1142 dbg("resp->type : [%d]", resp->record[i].sound);
1143 dbg("resp->level : [%d]", resp->record[i].volume);
1145 g_variant_builder_add(&b, "{sv}", "type", g_variant_new_int32(resp->record[i].sound));
1146 g_variant_builder_add(&b, "{sv}", "level", g_variant_new_int32(resp->record[i].volume));
1151 g_variant_builder_close(&b);
1153 result = g_variant_builder_end(&b);
1155 telephony_call_complete_get_volume(dbus_info->interface_object, dbus_info->invocation, resp->err, result );
1157 g_variant_unref(result);
1161 case TRESP_CALL_MUTE: {
1162 struct tresp_call_mute *resp = (struct tresp_call_mute*)data;
1164 dbg("receive TRESP_CALL_MUTE");
1165 dbg("resp->err : [%d]", resp->err);
1167 telephony_call_complete_mute(dbus_info->interface_object, dbus_info->invocation, resp->err);
1170 case TRESP_CALL_UNMUTE: {
1171 struct tresp_call_unmute *resp = (struct tresp_call_unmute*)data;
1173 dbg("receive TRESP_CALL_UNMUTE");
1174 dbg("resp->err : [%d]", resp->err);
1176 telephony_call_complete_unmute(dbus_info->interface_object, dbus_info->invocation, resp->err);
1179 case TRESP_CALL_GET_MUTE_STATUS: {
1180 struct tresp_call_get_mute_status *resp = (struct tresp_call_get_mute_status*)data;
1182 dbg("receive TRESP_CALL_GET_MUTE_STATUS");
1183 dbg("resp->err : [%d]", resp->err);
1184 dbg("resp->status : [%d]", resp->status);
1186 telephony_call_complete_get_mute_status(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->status );
1190 case TRESP_CALL_SET_SOUND_RECORDING: {
1191 struct tresp_call_sound_set_recording *resp = (struct tresp_call_sound_set_recording*)data;
1192 telephony_call_complete_set_sound_recording(dbus_info->interface_object, dbus_info->invocation, resp->err );
1196 case TRESP_CALL_SET_SOUND_EQUALIZATION: {
1197 struct tresp_call_sound_set_equalization *resp = (struct tresp_call_sound_set_equalization*)data;
1198 telephony_call_complete_set_sound_equalization(dbus_info->interface_object, dbus_info->invocation, resp->err );
1202 case TRESP_CALL_SET_SOUND_NOISE_REDUCTION: {
1203 struct tresp_call_sound_set_noise_reduction *resp = (struct tresp_call_sound_set_noise_reduction*)data;
1204 telephony_call_complete_set_sound_noise_reduction(dbus_info->interface_object, dbus_info->invocation, resp->err );
1209 dbg("not handled command[%d]", command);
1217 gboolean dbus_plugin_call_notification(struct custom_data *ctx, const char *plugin_name, TelephonyObjectSkeleton *object, enum tcore_notification_command command, unsigned int data_len, const void *data)
1219 TelephonyCall *call;
1226 call = telephony_object_peek_call(TELEPHONY_OBJECT(object));
1227 dbg("call = %p", call);
1230 case TNOTI_CALL_STATUS_IDLE: {
1231 struct tnoti_call_status_idle *idle = (struct tnoti_call_status_idle*)data;
1233 dbg("[ check ] call status : idle");
1235 if ( idle->type != CALL_TYPE_VIDEO ) {
1236 dbg("[ check ] this is voice call");
1237 telephony_call_emit_voice_call_status_idle( call, idle->id, idle->cause, 0, 0 );
1239 dbg("[ check ] this is video call");
1240 telephony_call_emit_video_call_status_idle( call, idle->id, idle->cause, 0, 0 );
1245 case TNOTI_CALL_STATUS_DIALING: {
1246 struct tnoti_call_status_dialing *dialing = (struct tnoti_call_status_dialing*)data;
1248 dbg("[ check ] call status : dialing");
1249 dbg("[ check ] call type : (%d)", dialing->type);
1250 dbg("[ check ] call id : (%d)", dialing->id);
1252 if ( dialing->type != CALL_TYPE_VIDEO ) {
1253 dbg("[ check ] this is voice call");
1254 telephony_call_emit_voice_call_status_dialing( call, dialing->id );
1256 dbg("[ check ] this is video call");
1257 telephony_call_emit_video_call_status_dialing( call, dialing->id );
1261 case TNOTI_CALL_STATUS_ALERT: {
1262 struct tnoti_call_status_alert *alert = (struct tnoti_call_status_alert*)data;
1264 dbg("[ check ] call status : alert");
1266 if ( alert->type != CALL_TYPE_VIDEO ) {
1267 dbg("[ check ] this is voice call");
1268 telephony_call_emit_voice_call_status_alert( call, alert->id );
1270 dbg("[ check ] this is video call");
1271 telephony_call_emit_video_call_status_alert( call, alert->id );
1275 case TNOTI_CALL_STATUS_ACTIVE: {
1276 struct tnoti_call_status_active *active = (struct tnoti_call_status_active*)data;
1278 dbg("[ check ] call status : active");
1280 if ( active->type != CALL_TYPE_VIDEO ) {
1281 dbg("[ check ] this is voice call");
1282 telephony_call_emit_voice_call_status_active( call, active->id );
1284 dbg("[ check ] this is video call");
1285 telephony_call_emit_video_call_status_active( call, active->id );
1289 case TNOTI_CALL_STATUS_HELD: {
1290 struct tnoti_call_status_held *held = (struct tnoti_call_status_held*)data;
1292 dbg("[ check ] call status : held");
1294 telephony_call_emit_voice_call_status_held( call, held->id );
1297 case TNOTI_CALL_STATUS_INCOMING: {
1298 struct tnoti_call_status_incoming *incoming = (struct tnoti_call_status_incoming*)data;
1300 dbg("[ check ] call status : incoming");
1302 if ( incoming->type != CALL_TYPE_VIDEO ) {
1303 dbg("[ check ] this is voice call");
1305 telephony_call_emit_voice_call_status_incoming( call, incoming->id );
1307 _launch_voice_call( incoming );
1310 dbg("[ check ] this is video call");
1311 telephony_call_emit_video_call_status_incoming( call, incoming->id );
1313 _launch_video_call( incoming );
1318 case TNOTI_CALL_SOUND_PATH: {
1320 struct tnoti_call_sound_path *noti = (struct tnoti_call_sound_path*)data;
1321 telephony_call_emit_call_sound_path( call, noti->path );
1326 case TNOTI_CALL_SOUND_RINGBACK_TONE: {
1327 struct tnoti_call_sound_ringback_tone *noti = (struct tnoti_call_sound_ringback_tone*)data;
1328 telephony_call_emit_call_sound_ringback_tone( call, (gint)noti->status );
1332 case TNOTI_CALL_SOUND_WBAMR: {
1333 struct tnoti_call_sound_wbamr *noti = (struct tnoti_call_sound_wbamr*)data;
1334 telephony_call_emit_call_sound_wbamr( call, (gint)noti->status );
1338 case TNOTI_CALL_SOUND_EQUALIZATION: {
1339 struct tnoti_call_sound_equalization *noti = (struct tnoti_call_sound_equalization*)data;
1340 telephony_call_emit_call_sound_equalization( call, (gint)noti->mode, (gint)noti->direction );
1344 case TNOTI_CALL_SOUND_NOISE_REDUCTION: {
1345 struct tnoti_call_sound_noise_reduction *noti = (struct tnoti_call_sound_noise_reduction*)data;
1346 telephony_call_emit_call_sound_noise_reduction( call, (gint)noti->status );
1351 dbg("not handled command[%d]", command);