int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink);
/**
- * @brief Start receiving data from the SCMIRRORING source and display it(mirror).
+ * @brief Starts receiving data from the SCMIRRORING source and display it(mirror).
*
* @since_tizen 2.4
* @privlevel public
int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink);
/**
- * @brief Pauses receiving data from the SCMIRRORING source.
+ * @brief Resumes receiving data from the SCMIRRORING source.
* @details This function pauses receiving data from the SCMIRRORING source, which means it sends RTSP PLAY message to source.
*
* @since_tizen 2.4
*/
int scmirroring_sink_get_negotiated_audio_bitwidth(scmirroring_sink_h *scmirroring_sink, int *bitwidth);
+/**
+ * @brief Gets the current state of screen mirroring sink.
+ * @details The current state of screen mirroring sink is changed by calling CAPIs. And it provides the state of screen mirroring sink the time this api is called.
+ *
+ * @since_tizen 5.0
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] The current state of screen mirroring sink
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ */
+int scmirroring_sink_get_current_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
return ret;
}
+
+int scmirroring_sink_get_current_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state)
+{
+ int result = MM_ERROR_NONE;
+ int mm_state = MM_WFD_SINK_STATE_NONE;
+ scmirroring_sink_s *handle = (scmirroring_sink_s *)(scmirroring_sink);
+
+ scmirroring_debug_fenter();
+ scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink* is NULL");
+ scmirroring_retvm_if(state == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "state is NULL");
+ scmirroring_retvm_if(handle->magic_num != SCMIRRORING_MAGIC_NUMBER, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid handle");
+
+ result = mm_wfd_sink_get_current_state(handle->mm_handle, &mm_state);
+ if (result == MM_ERROR_NONE) {
+ *state = __scmirroring_sink_state_convert(mm_state);
+ scmirroring_debug("ScreenMirroring current state is [%d]", *state);
+ }
+ scmirroring_debug_fleave();
+ return __scmirroring_sink_error_convert(__func__, result);
+}
+++ /dev/null
-/*
-* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include <stdio.h>
-#include <mmf/mm_wfd_sink.h>
-#include <scmirroring_sink.h>
-#include <scmirroring_internal.h>
-#include <scmirroring_private.h>
-
-
-static scmirroring_error_e __scmirroring_sink_error_convert(const char *func, int error)
-{
- int ret = SCMIRRORING_ERROR_NONE;
- const char *errorstr = NULL;
-
- switch (error) {
- case MM_ERROR_NONE:
- ret = SCMIRRORING_ERROR_NONE;
- errorstr = "ERROR_NONE";
- break;
-
- case MM_ERROR_WFD_NO_FREE_SPACE:
- ret = SCMIRRORING_ERROR_OUT_OF_MEMORY;
- errorstr = "OUT_OF_MEMORY";
- break;
-
- case MM_ERROR_WFD_NOT_INITIALIZED:
- case MM_ERROR_COMMON_INVALID_ATTRTYPE:
- case MM_ERROR_COMMON_INVALID_PERMISSION:
- case MM_ERROR_COMMON_OUT_OF_ARRAY:
- case MM_ERROR_COMMON_OUT_OF_RANGE:
- case MM_ERROR_COMMON_ATTR_NOT_EXIST:
- ret = SCMIRRORING_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
-
- default:
- ret = SCMIRRORING_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION";
- }
-
- if (ret != SCMIRRORING_ERROR_NONE)
- scmirroring_error("[%s] %s (0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, error);
- else
- scmirroring_debug("[%s] %s", func, errorstr);
-
- return ret;
-}
-
-
-static scmirroring_sink_state_e __scmirroring_sink_state_convert(MMWFDSinkStateType mm_state)
-{
- scmirroring_sink_state_e temp_state = SCMIRRORING_SINK_STATE_NONE;
-
- switch (mm_state) {
- case MM_WFD_SINK_STATE_NONE:
- temp_state = SCMIRRORING_SINK_STATE_NONE;
- break;
- case MM_WFD_SINK_STATE_NULL:
- temp_state = SCMIRRORING_SINK_STATE_NULL;
- break;
- case MM_WFD_SINK_STATE_PREPARED:
- temp_state = SCMIRRORING_SINK_STATE_PREPARED;
- break;
- case MM_WFD_SINK_STATE_CONNECTED:
- temp_state = SCMIRRORING_SINK_STATE_CONNECTED;
- break;
- case MM_WFD_SINK_STATE_PLAYING:
- temp_state = SCMIRRORING_SINK_STATE_PLAYING;
- break;
- case MM_WFD_SINK_STATE_PAUSED:
- temp_state = SCMIRRORING_SINK_STATE_PAUSED;
- break;
- case MM_WFD_SINK_STATE_DISCONNECTED:
- temp_state = SCMIRRORING_SINK_STATE_DISCONNECTED;
- break;
- default:
- temp_state = SCMIRRORING_SINK_STATE_NONE;
- scmirroring_debug("In default case, MMWFDSinkStateType is [%d]", mm_state);
- break;
- }
-
- return temp_state;
-}
-
-int scmirroring_sink_get_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state)
-{
- int result = MM_ERROR_NONE;
- int mm_state = MM_WFD_SINK_STATE_NONE;
- scmirroring_sink_s *handle = (scmirroring_sink_s *)(scmirroring_sink);
-
- scmirroring_debug_fenter();
- scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink* is NULL");
- scmirroring_retvm_if(state == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "state is NULL");
- scmirroring_retvm_if(handle->magic_num != SCMIRRORING_MAGIC_NUMBER, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid handle");
-
- result = mm_wfd_sink_get_state(handle->mm_handle, &mm_state);
- if (result == MM_ERROR_NONE) {
- *state = __scmirroring_sink_state_convert(mm_state);
- scmirroring_debug("ScreenMirroring state is [%d]", *state);
- }
- scmirroring_debug_fleave();
-
- return __scmirroring_sink_error_convert(__func__, result);
-}