Fix for TV product build macro
[platform/core/multimedia/libmm-session.git] / mm_session.h
index 9bad099..3292397 100644 (file)
@@ -45,33 +45,35 @@ extern "C" {
   * This enumeration defines application's session types.
   */
 enum MMSessionType {
-       MM_SESSION_TYPE_SHARE = 0,      /**< Share type : this type shares it's session with other share type application */
-       MM_SESSION_TYPE_EXCLUSIVE,      /**< Exclusive type : this type make previous session stop. And it does not allow other share type session start */
-       MM_SESSION_TYPE_NUM,
+       MM_SESSION_TYPE_MEDIA = 0,
+       MM_SESSION_TYPE_MEDIA_RECORD,
+       MM_SESSION_TYPE_ALARM,
+       MM_SESSION_TYPE_NOTIFY,
+       MM_SESSION_TYPE_EMERGENCY,
+       MM_SESSION_TYPE_CALL,
+       MM_SESSION_TYPE_VIDEOCALL,
+       MM_SESSION_TYPE_VOIP,
+       MM_SESSION_TYPE_VOICE_RECOGNITION,
+       MM_SESSION_TYPE_RECORD_AUDIO,
+       MM_SESSION_TYPE_RECORD_VIDEO,
+       MM_SESSION_TYPE_NUM
 };
 
 /**
-  * This enumeration defines session callback message type.
+  * This enumeration defines behavior of update.
   */
 typedef enum {
-       MM_SESSION_MSG_STOP,    /**< Message Stop : this messages means that session of application has interrupted by policy.
-                                                                                               So application should stop it's multi-media context when this message has come */
-       MM_SESSION_MSG_RESUME,  /**< Message Stop : this messages means that session interrupt of application has ended.
-                                                                                               So application could resume it's multi-media context when this message has come */
-       MM_SESSION_MSG_NUM
-}session_msg_t;
+       MM_SESSION_UPDATE_TYPE_ADD,
+       MM_SESSION_UPDATE_TYPE_REMOVE,
+       MM_SESSION_UPDATE_TYPE_NUM
+} session_update_type_t;
 
-typedef enum {
-       MM_SESSION_EVENT_MEDIA = 0,
-       MM_SESSION_EVENT_CALL,
-       MM_SESSION_EVENT_ALARM,
-       MM_SESSION_EVENT_EARJACK_UNPLUG,
-       MM_SESSION_EVENT_RESOURCE_CONFLICT,
-       MM_SESSION_EVENT_EMERGENCY,
-       MM_SESSION_EVENT_RESUMABLE_MEDIA,
-}session_event_t;
-
-typedef void (*session_callback_fn) (session_msg_t msg, session_event_t event, void *user_param);
+/**
+  * This define is for session options
+  */
+#define MM_SESSION_OPTION_PAUSE_OTHERS                      0x0001
+#define MM_SESSION_OPTION_UNINTERRUPTIBLE                   0x0002
+#define MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED  0x0010
 
 /**
  * This function defines application's Multimedia Session policy
@@ -81,7 +83,7 @@ typedef void (*session_callback_fn) (session_msg_t msg, session_event_t event, v
  * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     Session type is unique for each application (each PID actually).
- *                     if application want to change session type, Finish session first and Init again
+ *                     if application want to change session type, Finish session first and Init again
  * @see                MMSessionType mm_session_finish
  * @since
  * @pre                There should be pre-initialized session type for caller application.
@@ -95,7 +97,7 @@ static int _create(void *data)
        int ret = 0;
 
        // Initialize Multimedia Session Type
-       ret = mm_session_init(MM_SESSION_TYPE_SHARE);
+       ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
        if(ret < 0)
        {
                printf("Can not initialize session \n");
@@ -134,56 +136,28 @@ int main()
  */
 int mm_session_init(int sessiontype);
 
-
-
-
 /**
- * This function defines application's Multimedia Session policy
+ * This function finish application's Multimedia Session.
  *
- * @param      sessiontype     [in] Multimedia Session type
- * @param      session_callback_fn [in] session message callback function pointer
- * @param      user_param [in] callback function user parameter
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     Session type is unique for each application (each PID actually).
- *                     if application want to change session type, Finish session first and Init again
- * @pre                There should be pre-initialized session type for caller application.
- * @post       A session type of caller application will be defined process widely.
- *                     And session callback will be registered as given function pointer with given user_param
- * @see                MMSessionType mm_session_finish
+ *                     if application want to change session type, Finish session first and Init again
+ * @see                mm_session_init
+ * @pre                A session type should be initialized for caller application.
+ * @post       A session type for caller application will be cleared.
  * @since
  * @par Example
  * @code
 #include <mm_session.h>
 
-session_callback_fn session_cb(session_msg_t msg,  session_event_t event, void *user_param)
-{
-       struct appdata* ad = (struct appdata*) user_param;
-
-       switch(msg)
-       {
-       case MM_SESSION_MSG_STOP:
-               // Stop multi-media context here
-               ...
-               break;
-       case MM_SESSION_MSG_RESUME:
-               // Resume multi-media context here
-               ...
-               break;
-       default:
-               break;
-       }
-       ...
-}
-
 static int _create(void *data)
 {
-       struct appdata* ad = (struct appdata*) data;
        int ret = 0;
 
-       // Initialize Multimedia Session Type with callback
-       ret = mm_session_init_ex(MM_SESSION_TYPE_SHARE, session_cb, (void*)ad);
+       // Initialize Multimedia Session Type
+       ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
        if(ret < 0)
        {
                printf("Can not initialize session \n");
@@ -204,7 +178,6 @@ static int _terminate(void* data)
        ...
 }
 
-
 int main()
 {
        ...
@@ -218,83 +191,48 @@ int main()
        ...
        return appcore_efl_main(PACKAGE, ..., &ops);
 }
-
  * @endcode
  */
-int mm_session_init_ex(int sessiontype, session_callback_fn callback, void* user_param);
-
-
+int mm_session_finish(void);
 
 /**
- * This function finish application's Multimedia Session.
+ * This function get current application's Multimedia Session type
  *
- * 
+ * @param      sessiontype     [out] Current Multimedia Session type
  * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
- * @remark     Session type is unique for each application (each PID actually).
- *                     if application want to change session type, Finish session first and Init again
  * @see                mm_session_init
- * @pre                A session type should be initialized for caller application.
- * @post       A session type for caller application will be cleared.
  * @since
- * @par Example
- * @code
-#include <mm_session.h>
-
-static int _create(void *data)
-{
-       int ret = 0;
-
-       // Initialize Multimedia Session Type
-       ret = mm_session_init(MM_SESSION_TYPE_SHARE);
-       if(ret < 0)
-       {
-               printf("Can not initialize session \n");
-       }
-       ...
-}
-
-static int _terminate(void* data)
-{
-       int ret = 0;
-
-       // Deinitialize Multimedia Session Type
-       ret = mm_session_finish();
-       if(ret < 0)
-       {
-               printf("Can not finish session\n");
-       }
-       ...
-}
+ */
+int mm_session_get_current_type(int *sessiontype);
 
-int main()
-{
-       ...
-       struct appcore_ops ops = {
-               .create = _create,
-               .terminate = _terminate,
-               .pause = _pause,
-               .resume = _resume,
-               .reset = _reset,
-       };
-       ...
-       return appcore_efl_main(PACKAGE, ..., &ops);
-}
- * @endcode
+/**
+ * This function get current application's Multimedia Session information
+ *
+ * @param      session_type    [out] Current Multimedia Session type
+ * @param      session_options [out] Current Multimedia Session options
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @see
+ * @since
  */
-int mm_session_finish(void);
+int mm_session_get_current_information(int *session_type, int *session_options);
 
 /**
- * This function get current application's Multimedia Session type
+ * This function update application's Multimedia Session options
  *
- * @param      sessiontype     [out] Current Multimedia Session type
+ * @param      update_type     [in] add or remove options
+ * @param      session_options [in] Multimedia Session options to be updated
  * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
- * @see                mm_session_init
+ * @see
  * @since
  */
-int mm_session_get_current_type (int *sessiontype);
+int mm_session_update_option(session_update_type_t update_type, int options);
 
+#ifdef TIZEN_TV
+void mm_session_dotnet_cleanup(int signo);
+#endif
 
 /**
        @}