2.0 init
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 21 Aug 2012 09:13:27 +0000 (18:13 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 21 Aug 2012 09:13:27 +0000 (18:13 +0900)
debian/changelog
mm_session.c
mm_session.h
mm_session_private.h
packaging/libmm-session.spec

index 3c1e3d52b7a0c1482d78841a7d1e2f560d908be0..c66765dac03efabfe14a1280cef883ef7d3e9868 100644 (file)
@@ -1,7 +1,347 @@
+libmm-session (0.2.0-0) unstable; urgency=low
+
+  * [AudioRoute] add subsession function and enable rich call
+  * Git : slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.2.0-0
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Mon, 23 Apr 2012 16:49:09 +0900
+
 libmm-session (0.1.7-6) unstable; urgency=low
 
-  * Initial release
-  * Git: pkgs/l/libmm-session
-  * Tag: libmm-session_0.1.7-6
+  * Code cleanup
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-6
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Wed, 13 Jul 2011 19:47:11 +0900
+
+libmm-session (0.1.7-5) unstable; urgency=low
+
+  * Remove PLATFORM_INIT macro in configure.ac
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-5
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Thu, 19 May 2011 16:37:22 +0900
+
+libmm-session (0.1.7-4) unstable; urgency=low
+
+  * update TC (forced mm_sesseion_finish before running)
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-4
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Thu, 17 Feb 2011 13:03:55 +0900
+
+libmm-session (0.1.7-3) unstable; urgency=low
+
+  * update TC (add errorcode)
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-3
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Sat, 12 Feb 2011 08:38:42 +0900
+
+libmm-session (0.1.7-2) unstable; urgency=low
+
+  * add g_idle_add at monitor callback 
+  * seperate call & videocall at session 
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-2 
+
+ -- Jisung Ahn <jcastle.ahn@samsung.com>  Mon, 31 Jan 2011 09:55:10 +0900
+
+libmm-session (0.1.7-1) unstable; urgency=low
+
+  * Update TC
+  * Git : 165.213.180.234:slp/pkgs/l/libmm-session
+  * Tag : libmm-session_0.1.7-1
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Wed, 19 Jan 2011 14:34:06 +0900
+
+libmm-session (0.1.7-0) unstable; urgency=low
+
+  * add ASM_RESOURCE_OVELRAY on call
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.7-0
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Tue, 23 Nov 2010 10:04:45 +0900
+
+libmm-session (0.1.6-7) unstable; urgency=low
+
+  * update mm_session_finish()
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-7
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Sat, 20 Nov 2010 09:52:38 +0900
+
+libmm-session (0.1.6-6) unstable; urgency=low
+
+  * update debian/rules
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-6
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Thu, 18 Nov 2010 15:56:00 +0900
+
+libmm-session (0.1.6-5) unstable; urgency=low
+
+  * update doxygen
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-5
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Wed, 17 Nov 2010 16:57:30 +0900
+
+libmm-session (0.1.6-4) unstable; urgency=low
+
+  * check MSL status before mm_session_finish()
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-4 
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Wed, 17 Nov 2010 11:18:21 +0900
+
+libmm-session (0.1.6-3) unstable; urgency=low
+
+  * misc log update
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-3
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 15 Nov 2010 14:44:42 +0900
+
+libmm-session (0.1.6-2) unstable; urgency=low
+
+  * reupload
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-2
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 25 Oct 2010 11:17:09 +0900
+
+libmm-session (0.1.6-1) unstable; urgency=low
+
+  * Revise doxygen comment
+  * Revise COPYRIGHT
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-1
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Sat, 23 Oct 2010 17:30:22 +0900
+
+libmm-session (0.1.6-0) unstable; urgency=low
+
+  * Add mm_session_init_ex() function which support callback
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.6-0
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Sat, 23 Oct 2010 11:37:17 +0900
+
+libmm-session (0.1.5-2) unstable; urgency=low
+
+  * misc header update
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.5-2
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Thu, 14 Oct 2010 08:42:16 +0900
+
+libmm-session (0.1.5-1) unstable; urgency=low
+
+  * Enable fini module
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.5-1
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Tue, 05 Oct 2010 12:11:17 +0900
+
+libmm-session (0.1.5-0) unstable; urgency=low
+
+  * Add Replace & Alarm type
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.5-0
+
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Mon, 04 Oct 2010 09:40:49 +0900
+
+libmm-session (0.1.4-1) unstable; urgency=low
+
+  * add utc files 
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.4-1
+
+ -- YoungHwan Ahn <younghwan_.an@samsung.com>  Fri, 24 Sep 2010 16:32:23 +0900
+
+libmm-session (0.1.4-0) unstable; urgency=low
+
+  * update for asm upgrade
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.4-0
+  
+ -- Kwanghui Cho <kwanghui.cho@samsung.com>  Fri, 10 Sep 2010 17:22:28 +0900
+
+libmm-session (0.1.3-1) unstable; urgency=low
+
+  * Remove deprecated API (MMSession*)
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.3-1
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Thu, 29 Jul 2010 11:44:22 +0900
+
+libmm-session (0.1.3-0) unstable; urgency=low
+
+  * Make policy file to 777 mode
+  * Git : 165.213.180.234:/git/slp/pkgs/libmm-session
+  * Tag : libmm-session_0.1.3-0
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Wed, 28 Jul 2010 22:33:17 +0900
+
+libmm-session (0.1.2-11) unstable; urgency=low
+
+  * Modify doxygen
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-11
+
+ -- YoungHwan Ahn <younghwan_.an@samsung.com>  Wed, 07 Jul 2010 18:16:19 +0900
+
+libmm-session (0.1.2-10) unstable; urgency=low
+
+  * Change maintainer
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-10
+
+ -- JongHyuk Choi <jhchoi.choi@samsung.com>  Wed, 07 Jul 2010 13:41:12 +0900
+
+libmm-session (0.1.2-9) unstable; urgency=low
+
+  * apply doxygen policy to generate doc
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-9 
+
+ -- YoungHwan Ahn <younghwan_.an@samsung.com>  Mon, 05 Jul 2010 14:22:50 +0900
+
+libmm-session (0.1.2-8) unstable; urgency=low
+
+  * remove old dlog dependency
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-8
+
+ -- YoungHwan Ahn <younghwan_.an@samsung.com>  Fri, 25 Jun 2010 19:04:31 +0900
+
+libmm-session (0.1.2-7) unstable; urgency=low
+
+  * Reupload for mm-log update
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-7
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Thu, 17 Jun 2010 14:04:31 +0900
+
+libmm-session (0.1.2-6) unstable; urgency=low
+
+  * reupload
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-6
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Sat, 29 May 2010 12:34:16 +0900
+
+libmm-session (0.1.2-5) unstable; urgency=low
+
+  * Update debian/control file
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-5
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Tue, 25 May 2010 18:06:05 +0900
+
+libmm-session (0.1.2-4) unstable; urgency=low
+
+  * repackage by vconf dependency change
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-4
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Thu, 13 May 2010 09:32:41 +0900
+
+libmm-session (0.1.2-3) unstable; urgency=low
+
+  * remove postinst file
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-3
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 10 May 2010 19:35:06 +0900
+
+libmm-session (0.1.2-2) unstable; urgency=low
+
+  * Include .la
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-2
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Mon, 03 May 2010 22:43:17 +0900
+
+libmm-session (0.1.2-1) unstable; urgency=low
+
+  * make new sdk-dev package which includes .pc file & public header file
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-1
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 03 May 2010 18:18:06 +0900
+
+libmm-session (0.1.2-0) unstable; urgency=low
+
+  * posix api style
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.2-0
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 26 Apr 2010 16:31:08 +0900
+
+libmm-session (0.1.1-2) unstable; urgency=low
+
+  * Fix libmm-session-dev dependency
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.1-2
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Fri, 23 Apr 2010 18:12:23 +0900
+
+libmm-session (0.1.1-1) unstable; urgency=low
+
+  * Add postinst script
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.1-1
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 19 Apr 2010 10:43:18 +0900
+
+libmm-session (0.1.1-0) unstable; urgency=low
+
+  * Add more utility function
+  * Git : 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libmm-session-0.1
+  * Tag : libmm-session_0.1.1-0
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Thu, 15 Apr 2010 16:57:31 +0900
+
+libmm-session (0.1.0-6) unstable; urgency=low
+
+  * Toolchain Upgrade
+
+ -- Wonhyung Cho <wh01.cho@samsung.com>  Thu, 25 Mar 2010 13:45:47 +0900
+
+libmm-session (0.1.0-5) unstable; urgency=low
+
+  * To apply change of audio-sesssion-manager library
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Wed, 17 Mar 2010 11:10:53 +0900
+
+libmm-session (0.1.0-4) unstable; urgency=low
+
+  * Repacking for mm-common update
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Thu, 11 Mar 2010 12:03:33 +0900
+
+libmm-session (0.1.0-3) unstable; urgency=low
+
+  * Modify section to main
+
+ -- Seungbae Shin <seungbae.shin@samsung.com>  Fri, 05 Mar 2010 18:15:13 +0900
+
+libmm-session (0.1.0-2) unstable; urgency=low
+
+  * Rebuild for audio-session-manager event type expend
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Tue, 23 Feb 2010 15:15:09 +0900
+
+libmm-session (0.1.0-1) unstable; urgency=low
+
+  * Move asm register to MSL (except Call) 
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Mon, 22 Feb 2010 10:25:09 +0900
+
+libmm-session (0.1.0-0) unstable; urgency=low
+
+  * Initial Release.
 
- -- Seungbae Shin <seungbae.shin@samsung.com>  Wed, 07 Dec 2011 12:05:55 +0900
+ -- KwangHui Cho <kwanghui.cho@samsung.com>  Tue, 09 Feb 2010 17:29:12 +0900
index 81d348cca0e090d61b85ec26f9c2ccdb7e7fe053..1da3f7dd355fef8092294b55c412e1fc58b101d8 100644 (file)
 typedef struct {
        session_callback_fn fn;
        void* data;
-       session_msg_t param;
+       session_msg_t msg;
+       session_event_t event;
 }session_monitor_t;
 
 int g_call_asm_handle = -1;
 int g_monitor_asm_handle = -1;
 session_monitor_t g_monitor_data;
 
-
 ASM_cb_result_t asm_monitor_callback(int handle, ASM_event_sources_t event_src, ASM_sound_commands_t command, unsigned int sound_status, void* cb_data);
 
 EXPORT_API
@@ -70,47 +70,40 @@ int mm_session_init_ex(int sessiontype, session_callback_fn callback, void* user
        debug_log("type : %d", sessiontype);
 
        if(sessiontype != MM_SESSION_TYPE_SHARE && sessiontype != MM_SESSION_TYPE_EXCLUSIVE &&
-                       sessiontype != MM_SESSION_TYPE_NOTIFY && sessiontype != MM_SESSION_TYPE_CALL && sessiontype != MM_SESSION_TYPE_ALARM  && sessiontype != MM_SESSION_TYPE_VIDEOCALL)
-       {
+                       sessiontype != MM_SESSION_TYPE_NOTIFY && sessiontype != MM_SESSION_TYPE_CALL && sessiontype != MM_SESSION_TYPE_ALARM  && sessiontype != MM_SESSION_TYPE_VIDEOCALL
+                       && sessiontype != MM_SESSION_TYPE_RICH_CALL) {
                debug_error("Invalid argument %d",sessiontype);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
        result = _mm_session_util_read_type(-1, &ltype);
-       if(MM_ERROR_INVALID_HANDLE != result)
-       {
+       if(MM_ERROR_INVALID_HANDLE != result) {
                debug_error("Session already initialized. Please finish current session first");
                return MM_ERROR_POLICY_DUPLICATED;
        }
 
-       if(sessiontype == MM_SESSION_TYPE_CALL)
-       {
-               if(!ASM_register_sound(-1, &g_call_asm_handle, ASM_EVENT_CALL, ASM_STATE_PLAYING, NULL, NULL, ASM_RESOURCE_NONE, &error))
-               {
+       if(sessiontype == MM_SESSION_TYPE_CALL) {
+               if(!ASM_register_sound(-1, &g_call_asm_handle, ASM_EVENT_CALL, ASM_STATE_PLAYING, NULL, NULL, ASM_RESOURCE_NONE, &error)) {
                        debug_error("Can not register sound");
                        return MM_ERROR_INVALID_HANDLE;
                }
-       }
-       else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL)
-       {
-               if(!ASM_register_sound(-1, &g_call_asm_handle, ASM_EVENT_VIDEOCALL, ASM_STATE_PLAYING, NULL, NULL, ASM_RESOURCE_CAMERA|ASM_RESOURCE_VIDEO_OVERLAY, &error))
-               {
+       } else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL) {
+               if(!ASM_register_sound(-1, &g_call_asm_handle, ASM_EVENT_VIDEOCALL, ASM_STATE_PLAYING, NULL, NULL, ASM_RESOURCE_CAMERA|ASM_RESOURCE_VIDEO_OVERLAY, &error))     {
                        debug_error("Can not register sound");
                        return MM_ERROR_INVALID_HANDLE;
                }
-       }
-       else
-       {
-               if(NULL == callback)
-               {
-                       debug_warning("Null callback function");
+       } else if(sessiontype == MM_SESSION_TYPE_RICH_CALL) {
+               if(!ASM_register_sound(-1, &g_call_asm_handle, ASM_EVENT_RICH_CALL, ASM_STATE_PLAYING, NULL, NULL, ASM_RESOURCE_NONE, &error)) {
+                       debug_error("Can not register sound");
+                       return MM_ERROR_INVALID_HANDLE;
                }
-               else
-               {
+       } else {
+               if(NULL == callback) {
+                       debug_warning("Null callback function");
+               } else {
                        g_monitor_data.fn = callback;
                        g_monitor_data.data = user_param;
-                       if(!ASM_register_sound(-1, &g_monitor_asm_handle, ASM_EVENT_MONITOR, ASM_STATE_NONE, asm_monitor_callback, (void*)&g_monitor_data, ASM_RESOURCE_NONE, &error))
-                       {
+                       if(!ASM_register_sound(-1, &g_monitor_asm_handle, ASM_EVENT_MONITOR, ASM_STATE_NONE, asm_monitor_callback, (void*)&g_monitor_data, ASM_RESOURCE_NONE, &error)) {
                                debug_error("Can not register monitor");
                                return MM_ERROR_INVALID_HANDLE;
                        }
@@ -118,16 +111,15 @@ int mm_session_init_ex(int sessiontype, session_callback_fn callback, void* user
        }
 
        result = _mm_session_util_write_type(-1, sessiontype);
-       if(MM_ERROR_NONE != result)
-       {
+       if(MM_ERROR_NONE != result) {
                debug_error("Write type failed");
                if(sessiontype == MM_SESSION_TYPE_CALL) {
                        ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_CALL, &error);
-               }
-               else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL) {
+               } else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL) {
                        ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_VIDEOCALL, &error);
-               }
-               else {
+               } else if(sessiontype == MM_SESSION_TYPE_RICH_CALL) {
+                       ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_RICH_CALL, &error);
+               } else {
                        ASM_unregister_sound(g_monitor_asm_handle, ASM_EVENT_MONITOR, &error);
                }
                return result;
@@ -136,7 +128,6 @@ int mm_session_init_ex(int sessiontype, session_callback_fn callback, void* user
        return MM_ERROR_NONE;
 }
 
-
 EXPORT_API
 int mm_session_finish()
 {
@@ -146,25 +137,19 @@ int mm_session_finish()
        ASM_sound_states_t state = ASM_STATE_NONE;
        debug_log("");
 
-       if(g_call_asm_handle == -1)
-       {
-               if(g_monitor_asm_handle == -1)
-               {
+       if(g_call_asm_handle == -1) {
+               if(g_monitor_asm_handle == -1) {
                        //register monitor handle to get MSL status of caller process
-                       if(!ASM_register_sound(-1, &g_monitor_asm_handle, ASM_EVENT_MONITOR, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &error))
-                       {
+                       if(!ASM_register_sound(-1, &g_monitor_asm_handle, ASM_EVENT_MONITOR, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &error)) {
                                debug_error("[%s] Can not register monitor", __func__);
                                return MM_ERROR_INVALID_HANDLE;
                        }
                }
 
-               if(!ASM_get_process_session_state(g_monitor_asm_handle, &state, &error))
-               {
+               if(!ASM_get_process_session_state(g_monitor_asm_handle, &state, &error)) {
                        debug_error("[%s] Can not get process status", __func__);
                        return MM_ERROR_POLICY_INTERNAL;
-               }
-               else
-               {
+               } else {
                        switch(state)
                        {
                        case ASM_STATE_IGNORE:
@@ -183,36 +168,32 @@ int mm_session_finish()
 
 
        result = _mm_session_util_read_type(-1, &sessiontype);
-       if(MM_ERROR_NONE != result)
-       {
+       if(MM_ERROR_NONE != result) {
                debug_error("Can not read current type");
                return result;
        }
 
-       if(sessiontype == MM_SESSION_TYPE_CALL)
-       {
-               if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_CALL, &error))
-               {
+       if(sessiontype == MM_SESSION_TYPE_CALL) {
+               if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_CALL, &error)) {
                        debug_error("\"CALL\" ASM unregister failed");
                        return MM_ERROR_INVALID_HANDLE;
                }
                g_call_asm_handle = -1;
-       }
-       else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL)
-       {
-               if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_VIDEOCALL, &error))
-               {
+       } else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL) {
+               if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_VIDEOCALL, &error)) {
                        debug_error("\"VIDEOCALL\" ASM unregister failed");
                        return MM_ERROR_INVALID_HANDLE;
                }
                g_call_asm_handle = -1;
-       }
-       else
-       {
-               if(g_monitor_asm_handle != -1) //TODO :: this is trivial check. this should be removed later.
-               {
-                       if(!ASM_unregister_sound(g_monitor_asm_handle, ASM_EVENT_MONITOR, &error))
-                       {
+       } else if(sessiontype == MM_SESSION_TYPE_RICH_CALL) {
+               if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_RICH_CALL, &error)) {
+                       debug_error("\"RICH-CALL\" ASM unregister failed");
+                       return MM_ERROR_INVALID_HANDLE;
+               }
+               g_call_asm_handle = -1;
+       } else {
+               if(g_monitor_asm_handle != -1) { //TODO :: this is trivial check. this should be removed later.
+                       if(!ASM_unregister_sound(g_monitor_asm_handle, ASM_EVENT_MONITOR, &error)) {
                                debug_error("ASM unregister failed");
                                return MM_ERROR_INVALID_HANDLE;
                        }
@@ -227,8 +208,44 @@ int mm_session_finish()
        return MM_ERROR_NONE;
 }
 
+EXPORT_API
+int mm_session_set_subsession (mm_subsession_t subsession)
+{
+       int error = 0;
+       int result = MM_ERROR_NONE;
+       debug_log("");
+
+       if(g_call_asm_handle == -1) {
+               debug_error ("call session is not started...\n");
+               return MM_ERROR_INVALID_HANDLE;
+       }
 
+       /* FIXME : Error handling */
+       ASM_set_subsession (g_call_asm_handle, subsession, &error, NULL);
 
+       return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_session_get_subsession (mm_subsession_t *subsession)
+{
+       int error = 0;
+       int result = MM_ERROR_NONE;
+       int sessiontype = MM_SESSION_TYPE_SHARE;
+       ASM_sound_states_t state = ASM_STATE_NONE;
+       debug_log("");
+
+       if(g_call_asm_handle == -1) {
+               debug_error ("call session is not started...\n");
+               return MM_ERROR_INVALID_HANDLE;
+       }
+
+       ASM_get_subsession (g_call_asm_handle, subsession, &error, NULL);
+
+       debug_log("ASM_get_subsession returned [%d]\n", *subsession);
+
+       return MM_ERROR_NONE;
+}
 
 EXPORT_API
 int _mm_session_util_delete_type(int app_pid)
@@ -247,29 +264,26 @@ int _mm_session_util_delete_type(int app_pid)
                return MM_ERROR_FILE_NOT_FOUND;
        ////// DELETE SESSION TYPE /////////
        EXPORT_API
-       int mm_session_finish()
-       {
+       int mm_session_finish() {
                int error = 0;
                int result = MM_ERROR_NONE;
                int sessiontype = MM_SESSION_TYPE_SHARE;
 
                result = _mm_session_util_read_type(-1, &sessiontype);
-               if(MM_ERROR_NONE != result)
-               {
+               if(MM_ERROR_NONE != result) {
                        return result;
                }
 
-               if(sessiontype == MM_SESSION_TYPE_CALL)
-               {
-                       if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_CALL, &error))
-                       {
+               if(sessiontype == MM_SESSION_TYPE_CALL) {
+                       if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_CALL, &error)) {
                                return MM_ERROR_INVALID_HANDLE;
                        }
-               }
-               else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL)
-               {
-                       if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_VIDEOCALL, &error))
-                       {
+               } else if(sessiontype == MM_SESSION_TYPE_VIDEOCALL) {
+                       if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_VIDEOCALL, &error)) {
+                               return MM_ERROR_INVALID_HANDLE;
+                       }
+               } else if(sessiontype == MM_SESSION_TYPE_RICH_CALL) {
+                       if(!ASM_unregister_sound(g_call_asm_handle, ASM_EVENT_RICH_CALL, &error)) {
                                return MM_ERROR_INVALID_HANDLE;
                        }
                }
@@ -285,7 +299,6 @@ int _mm_session_util_delete_type(int app_pid)
        return MM_ERROR_NONE;
 }
 
-
 EXPORT_API
 int _mm_session_util_write_type(int app_pid, int sessiontype)
 {
@@ -295,8 +308,8 @@ int _mm_session_util_write_type(int app_pid, int sessiontype)
        int res=0;
 
        if(sessiontype != MM_SESSION_TYPE_SHARE && sessiontype != MM_SESSION_TYPE_EXCLUSIVE &&
-                       sessiontype != MM_SESSION_TYPE_NOTIFY && sessiontype != MM_SESSION_TYPE_CALL && sessiontype != MM_SESSION_TYPE_ALARM && sessiontype != MM_SESSION_TYPE_VIDEOCALL)
-       {
+                       sessiontype != MM_SESSION_TYPE_NOTIFY && sessiontype != MM_SESSION_TYPE_CALL && sessiontype != MM_SESSION_TYPE_ALARM
+                       && sessiontype != MM_SESSION_TYPE_RICH_CALL) {
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
@@ -308,8 +321,7 @@ int _mm_session_util_write_type(int app_pid, int sessiontype)
        ////// WRITE SESSION TYPE /////////
        snprintf(filename, sizeof(filename)-1, "/tmp/mm_session_%d",mypid);
        fd = open(filename, O_WRONLY | O_CREAT, 0644 );
-       if(fd < 0)
-       {
+       if(fd < 0) {
                debug_error("open() failed with %d",errno);
                return MM_ERROR_FILE_WRITE;
        }
@@ -323,7 +335,6 @@ int _mm_session_util_write_type(int app_pid, int sessiontype)
        return MM_ERROR_NONE;
 }
 
-
 EXPORT_API
 int _mm_session_util_read_type(int app_pid, int *sessiontype)
 {
@@ -342,8 +353,7 @@ int _mm_session_util_read_type(int app_pid, int *sessiontype)
        ////// READ SESSION TYPE /////////
        snprintf(filename, sizeof(filename)-1, "/tmp/mm_session_%d",mypid);
        fd = open(filename, O_RDONLY);
-       if(fd < 0)
-       {
+       if(fd < 0) {
                return MM_ERROR_INVALID_HANDLE;
        }
        read(fd, sessiontype, sizeof(int));
@@ -356,12 +366,40 @@ int _mm_session_util_read_type(int app_pid, int *sessiontype)
 gboolean _asm_monitor_cb(gpointer *data)
 {
        session_monitor_t* monitor = (session_monitor_t*)data;
+       if (monitor) {
+               if (monitor->fn) {
+                       monitor->fn(monitor->msg, monitor->event, monitor->data);
+               }
+       }
 
-       monitor->fn(monitor->param, monitor->data);
-       
        return FALSE;
 }
 
+static session_event_t _translate_from_asm_to_mm_session (ASM_event_sources_t event_src)
+{
+       switch (event_src)
+       {
+       case ASM_EVENT_SOURCE_CALL_START:
+       case ASM_EVENT_SOURCE_CALL_END:
+               return MM_SESSION_EVENT_CALL;
+
+       case ASM_EVENT_SOURCE_EARJACK_UNPLUG:
+               return MM_SESSION_EVENT_EARJACK_UNPLUG;
+
+       case ASM_EVENT_SOURCE_RESOURCE_CONFLICT:
+               return MM_SESSION_EVENT_RESOURCE_CONFLICT;
+
+       case ASM_EVENT_SOURCE_ALARM_START:
+       case ASM_EVENT_SOURCE_ALARM_END:
+               return MM_SESSION_EVENT_ALARM;
+
+       case ASM_EVENT_SOURCE_OTHER_APP:
+       case ASM_EVENT_SOURCE_OTHER_PLAYER_APP:
+       default:
+               return MM_SESSION_EVENT_OTHER_APP;
+       }
+}
+
 ASM_cb_result_t
 asm_monitor_callback(int handle, ASM_event_sources_t event_src, ASM_sound_commands_t command, unsigned int sound_status, void* cb_data)
 {
@@ -369,8 +407,7 @@ asm_monitor_callback(int handle, ASM_event_sources_t event_src, ASM_sound_comman
        session_monitor_t *monitor = (session_monitor_t*)cb_data;
 
        debug_log("monitor callback called for handle %d, event_src %d", handle, event_src);
-       if(!monitor)
-       {
+       if(!monitor) {
                debug_log("monitor instance is null\n");
                return ASM_CB_RES_IGNORE;
        }
@@ -380,29 +417,31 @@ asm_monitor_callback(int handle, ASM_event_sources_t event_src, ASM_sound_comman
        case ASM_COMMAND_STOP:
        case ASM_COMMAND_PAUSE:
                //call session_callback_fn for stop here
-               if(monitor->fn != NULL) {
-                       monitor->param = MM_SESSION_MSG_STOP;
+               if(monitor->fn) {
+                       monitor->msg = MM_SESSION_MSG_STOP;
+                       monitor->event = _translate_from_asm_to_mm_session (event_src);
                        g_idle_add((GSourceFunc)_asm_monitor_cb, (gpointer)monitor);
                }
-               cb_res = ASM_CB_RES_STOP;
+               cb_res = (command == ASM_COMMAND_STOP)? ASM_CB_RES_STOP : ASM_CB_RES_PAUSE;
                break;
+
        case ASM_COMMAND_RESUME:
        case ASM_COMMAND_PLAY:
                //call session_callback_fn for resume here
-               if(monitor->fn != NULL) {
-                       monitor->param = MM_SESSION_MSG_RESUME;
+               if(monitor->fn) {
+                       monitor->msg = MM_SESSION_MSG_RESUME;
+                       monitor->event = _translate_from_asm_to_mm_session (event_src);
                        g_idle_add((GSourceFunc)_asm_monitor_cb, (gpointer)monitor);
                }
-               cb_res = ASM_CB_RES_NONE;;
+               cb_res = ASM_CB_RES_IGNORE;
+               break;
+
        default:
                break;
        }
        return cb_res;
 }
 
-
-
-
 __attribute__ ((destructor))
 void __mmsession_finalize(void)
 {
index 721af5cf9aea820ceec0c92626d915337410ab33..bc343d9fe55f7e4ff56b1aefc4bee7a516d9d3e2 100644 (file)
@@ -61,7 +61,15 @@ typedef enum {
        MM_SESSION_MSG_NUM
 }session_msg_t;
 
-typedef void (*session_callback_fn) (session_msg_t msg, void *user_param);
+typedef enum {
+       MM_SESSION_EVENT_OTHER_APP = 0,
+       MM_SESSION_EVENT_CALL,
+       MM_SESSION_EVENT_ALARM,
+       MM_SESSION_EVENT_EARJACK_UNPLUG,
+       MM_SESSION_EVENT_RESOURCE_CONFLICT,
+}session_event_t;
+
+typedef void (*session_callback_fn) (session_msg_t msg, session_event_t event, void *user_param);
 
 /**
  * This function defines application's Multimedia Session policy
@@ -147,7 +155,7 @@ int mm_session_init(int sessiontype);
  * @code
 #include <mm_session.h>
 
-session_callback_fn session_cb(session_msg_t msg, void *user_param)
+session_callback_fn session_cb(session_msg_t msg,  session_event_t event, void *user_param)
 {
        struct appdata* ad = (struct appdata*) user_param;
 
index 8cde2817878a814aa544ae1fc4a1372138f131ed..1839517c057c2cb7e194ef8de5b1dc01a692b5a1 100644 (file)
@@ -43,10 +43,17 @@ enum MMSessionTypePrivate{
        MM_SESSION_TYPE_NOTIFY = 10,
        MM_SESSION_TYPE_CALL,
        MM_SESSION_TYPE_ALARM,
-       MM_SESSION_TYPE_VIDEOCALL,      
+       MM_SESSION_TYPE_VIDEOCALL,
+       MM_SESSION_TYPE_RICH_CALL,
        MM_SESSION_PRIVATE_TYPE_NUM
 };
 
+typedef enum {
+       MM_SUBSESSION_TYPE_VOICE = 0,
+       MM_SUBSESSION_TYPE_RINGTONE,
+       MM_SUBSESSION_TYPE_MEDIA
+} mm_subsession_t;
+
 /**
  * This function delete session type information to system
  *
@@ -95,6 +102,34 @@ int _mm_session_util_write_type(int app_pid, int sessiontype);
  */
 int _mm_session_util_read_type(int app_pid, int *sessiontype);
 
+/**
+ * This function set sub-session type
+ *
+ * @param      subsession [in] subsession type
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     This function is only for internal implementation do not use this at application
+ *                     Session type is unique for each application.
+ * @see                mm_session_get_subsession
+ * @since
+ */
+int mm_session_set_subsession (mm_subsession_t subsession);
+
+/**
+ * This function get current sub-session type
+ *
+ * @param      subsession [out] subsession type
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     This function is only for internal implementation do not use this at application
+ *                     Session type is unique for each application.
+ * @see                mm_session_set_subsession
+ * @since
+ */
+int mm_session_get_subsession (mm_subsession_t *subsession);
+
 #ifdef __cplusplus
 }
 #endif
index 1d972f046961829d45a2057351607700a88d0798..3fa0489db9f9c46573624fd66277a43162931bc6 100644 (file)
@@ -1,10 +1,11 @@
+#sbs-git:slp/pkgs/l/libmm-session libmm-session 0.1.7 4ce6db8f3ceb62486e1441679e53e5c7f09201c7
 
 Name:       libmm-session
 Summary:    Mm-session development pkg for samsung
-Version:    0.1.7
-Release:    1
-Group:      System/Libraries
-License:    Apache-2.0
+Version: 0.2.0
+Release:    3
+Group:      TO_BE/FILLED_IN
+License:    TO BE FILLED IN
 Source0:    libmm-session-%{version}.tar.bz2
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -49,11 +50,11 @@ rm -rf %{buildroot}
 
 
 %files
+%defattr(-,root,root,-)
 /usr/lib/libmmfsession.so.*
 
-
 %files devel
+%defattr(-,root,root,-)
 /usr/include/mmf/*.h
 /usr/lib/libmmfsession.so
 /usr/lib/pkgconfig/mm-session.pc
-