[Screen-mirroring] Apply latest changes of screen mirroring
authorHyunsoo, Park <hance.park@samsung.com>
Thu, 5 Jan 2017 05:20:51 +0000 (14:20 +0900)
committerHyunsoo, Park <hance.park@samsung.com>
Mon, 9 Jan 2017 04:16:02 +0000 (13:16 +0900)
1. Remove unused enums
2. Remove related with 'codec' apis which has same code but diffrent api name.
3. Remove ErrorOccurredEventArgs.cs file
4. Change 'SCMirroring' to 'ScreenMirroring'
5. Apply codes for robust testcase

Change-Id: Ibd15e09dcc4370dd06e599f128f32c493d06b88e
Signed-off-by: Hyunsoo, Park <hance.park@samsung.com>
src/Tizen.Multimedia/Interop/Interop.ScreenMirroring.cs
src/Tizen.Multimedia/ScreenMirroring/AudioInformation.cs
src/Tizen.Multimedia/ScreenMirroring/ErrorOccurredEventArgs.cs [deleted file]
src/Tizen.Multimedia/ScreenMirroring/ScreenMirroring.cs
src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringEnumerations.cs
src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs
src/Tizen.Multimedia/ScreenMirroring/StateChangedEventArgs.cs
src/Tizen.Multimedia/ScreenMirroring/VideoInformation.cs
src/Tizen.Multimedia/Tizen.Multimedia.Net45.csproj
src/Tizen.Multimedia/Tizen.Multimedia.csproj

index 87d862f..cfda95c 100755 (executable)
@@ -1,20 +1,4 @@
-/*
- * Copyright (c) 2016 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.
- */
-
-using System;
+using System;
 using System.Runtime.InteropServices;
 
 internal static partial class Interop
@@ -22,13 +6,13 @@ internal static partial class Interop
     internal static partial class ScreenMirroring
     {
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void StateErrorCallback(IntPtr userData, int state, int error);
+        internal delegate void StateChangedCallback(IntPtr userData, int state, int error);
 
         [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_create")]
         internal static extern int Create(out IntPtr scmirroringSink);
 
         [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_state_changed_cb")]
-        internal static extern int SetStateErrorCb(IntPtr scmirroringSink, StateErrorCallback cb, IntPtr userData);
+        internal static extern int SetStateChangedCb(IntPtr scmirroringSink, StateChangedCallback cb, IntPtr userData);
 
         [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_ip_and_port")]
         internal static extern int SetIpAndPort(IntPtr scmirroringSink, string ip, string port);
@@ -61,7 +45,7 @@ internal static partial class Interop
         internal static extern int Unprepare(IntPtr scmirroringSink);
 
         [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unset_state_changed_cb")]
-        internal static extern int UnsetStateErrorCb(IntPtr scmirroringSink);
+        internal static extern int UnsetStateChangedCb(IntPtr scmirroringSink);
 
         [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_destroy")]
         internal static extern int Destroy(IntPtr scmirroringSink);
index 447febf..dc3e716 100755 (executable)
@@ -48,9 +48,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedAudioCodec(ref _handle, out _codec);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio codec" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio codec" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get audio codec");
                 }
 
@@ -68,9 +68,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedAudioChannel(ref _handle, out _channel);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio channel" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio channel" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get audio channel");
                 }
 
@@ -88,9 +88,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedAudioSampleRate(ref _handle, out _sampleRate);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio sample rate" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio sample rate" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get audio sample rate");
                 }
 
@@ -108,9 +108,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedAudioBitwidth(ref _handle, out _bitWidth);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio bitwidth" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio bitwidth" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get audio bitwidth");
                 }
 
diff --git a/src/Tizen.Multimedia/ScreenMirroring/ErrorOccurredEventArgs.cs b/src/Tizen.Multimedia/ScreenMirroring/ErrorOccurredEventArgs.cs
deleted file mode 100755 (executable)
index a24d9f2..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2016 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.
- */
-
-using System;
-
-namespace Tizen.Multimedia
-{
-    /// <summary>
-    /// ErrorOccurred event arguments
-    /// </summary>
-    /// <remarks>
-    /// ErrorOccurred event arguments
-    /// </remarks>
-    public class ErrorOccurredEventArgs : EventArgs
-    {
-        internal int _error;
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="error"> Error Occurred </param>
-        internal ErrorOccurredEventArgs(int error)
-        {
-            _error = error;
-        }
-
-        /// <summary>
-        /// Get the error code.
-        /// </summary>
-        /// <value> error code </value>
-        public SCMirroringError Error
-        {
-            get
-            {
-                return (SCMirroringError)_error;
-            }
-        }
-    }
-}
\ No newline at end of file
index 11b93b3..aafb29e 100755 (executable)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 using System;
 using System.Threading.Tasks;
-using System.Runtime.InteropServices;
 
 namespace Tizen.Multimedia
 {
@@ -40,8 +38,7 @@ namespace Tizen.Multimedia
 
         private bool _disposed = false;
         private EventHandler<StateChangedEventArgs> _stateChanged;
-        private Interop.ScreenMirroring.StateErrorCallback _stateErrorCallback;
-        private EventHandler<ErrorOccurredEventArgs> _errorOccurred;
+        private Interop.ScreenMirroring.StateChangedCallback _stateChangedCallback;
 
         /// <summary>
         /// Initializes a new instance of the ScreenMirroring class with parameters Ip, Port, Surface type and Display handle.
@@ -57,7 +54,7 @@ namespace Tizen.Multimedia
         public ScreenMirroring(SurfaceType type, MediaView display, string ip, string port)
         {
             int ret = Interop.ScreenMirroring.Create(out _handle);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
                 ScreenMirroringErrorFactory.ThrowException(ret, "Failed to create Screen Mirroring Sink");
             }
@@ -70,17 +67,17 @@ namespace Tizen.Multimedia
 
             // Set ip and port
             int ret1 = Interop.ScreenMirroring.SetIpAndPort(_handle, _ip, _port);
-            if (ret1 != (int)SCMirroringError.None)
+            if (ret1 != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (SCMirroringError)ret1);
+                Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (ScreenMirroringError)ret1);
                 ScreenMirroringErrorFactory.ThrowException(ret, "set ip and port failed");
             }
 
             // Set display
             int ret2 = Interop.ScreenMirroring.SetDisplay(_handle, (int)_type, _display);
-            if (ret2 != (int)SCMirroringError.None)
+            if (ret2 != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (SCMirroringError)ret2);
+                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (ScreenMirroringError)ret2);
                 ScreenMirroringErrorFactory.ThrowException(ret, "set display failed");
             }
 
@@ -129,32 +126,6 @@ namespace Tizen.Multimedia
         }
 
         /// <summary>
-        /// ErrorOccurred event is raised when error is occured in screen mirroring sink.
-        /// Must be called after Create() API.
-        /// </summary>
-        public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
-        {
-            add
-            {
-                if (_errorOccurred == null)
-                {
-                    RegisterErrorOccurredEvent();
-                }
-
-                _errorOccurred += value;
-            }
-
-            remove
-            {
-                _errorOccurred -= value;
-                if (_errorOccurred == null)
-                {
-                    UnregisterErrorOccurredEvent();
-                }
-            }
-        }
-
-        /// <summary>
         /// Sets the server ip and port.
         /// This must be called before connect() and after create().
         /// </summary>
@@ -168,9 +139,9 @@ namespace Tizen.Multimedia
         public void SetIpAndPort(string ip, string port)
         {
             int ret = Interop.ScreenMirroring.SetIpAndPort(_handle, ip, port);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (SCMirroringError)ret);
+                Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (ScreenMirroringError)ret);
                 ScreenMirroringErrorFactory.ThrowException(ret, "set ip and port failed");
             }
         }
@@ -185,9 +156,9 @@ namespace Tizen.Multimedia
         public void SetResolution(int resolution)
         {
             int ret = Interop.ScreenMirroring.SetResolution(_handle, resolution);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set resolution failed" + (SCMirroringError)ret);
+                Log.Error(ScreenMirroringLog.LogTag, "Set resolution failed" + (ScreenMirroringError)ret);
                 ScreenMirroringErrorFactory.ThrowException(ret, "set resolution failed");
             }
         }
@@ -201,15 +172,15 @@ namespace Tizen.Multimedia
         /// </example>
         /// <param name="type">Type.</param>
         /// <param name="display">Display.</param>
-        /// <remarks> Display Handle not clear </remarks>
+        /// <remarks> Display Handle creates using mediaview class </remarks>
         /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public void SetDisplay(SurfaceType type, MediaView display)
         {
             int ret = Interop.ScreenMirroring.SetDisplay(_handle, (int)type, display);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (SCMirroringError)ret);
+                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (ScreenMirroringError)ret);
                 ScreenMirroringErrorFactory.ThrowException(ret, "set display failed");
             }
         }
@@ -221,20 +192,19 @@ namespace Tizen.Multimedia
         public void Prepare()
         {
             int ret = Interop.ScreenMirroring.Prepare(_handle);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
                 ScreenMirroringErrorFactory.ThrowException(ret, "Failed to prepare sink for screen mirroring");
             }
         }
 
         /// <summary>
-        /// Creates connection and prepare for receiving data from SCMIRRORING source.
+        /// Creates connection and prepare for receiving data from ScreenMirroring source.
         /// This must be called after prepare().
         /// </summary>
         /// <remarks> It will not give the current state. Need to subscribe for event to get the current state </remarks>
         /// <returns>bool value</returns>
         /// <privilege>http://tizen.org/privilege/internet</privilege>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public Task<bool> ConnectAsync()
         {
@@ -242,18 +212,19 @@ namespace Tizen.Multimedia
             var task = new TaskCompletionSource<bool>();
 
             Task.Factory.StartNew(() =>
-            {
-                if (ret == (int)SCMirroringError.None)
                 {
-                    task.SetResult(true);
-                }
-
-                else if (ret != (int)SCMirroringError.None)
-                {
-                    task.SetResult(false);
-                    ScreenMirroringErrorFactory.ThrowException(ret, "Failed to connect the screen mirroring source");
-                }
-            });
+                    if (ret == (int)ScreenMirroringError.None)
+                    {
+                        task.SetResult(true);
+                    }
+
+                    else if (ret != (int)ScreenMirroringError.None)
+                    {
+                        Log.Error(ScreenMirroringLog.LogTag, "Failed to start screen mirroring" + (ScreenMirroringError)ret);
+                        InvalidOperationException e = new InvalidOperationException("Operation Failed");
+                        task.TrySetException(e);
+                    }
+                });
 
             return task.Task;
         }
@@ -291,13 +262,12 @@ namespace Tizen.Multimedia
         }
 
         /// <summary>
-        /// Start receiving data from the SCMIRRORING source and display it(Mirror).
+        /// Start receiving data from the ScreenMirroring source and display it(Mirror).
         /// This must be called after connectasync().
         ///  </summary>
         /// <remarks> It will not give the current state. Need to subscribe for event to get the current state </remarks>
         /// <returns>bool value<returns>
         /// <privilege>http://tizen.org/privilege/internet</privilege>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public Task<bool> StartAsync()
         {
@@ -305,30 +275,30 @@ namespace Tizen.Multimedia
             var task = new TaskCompletionSource<bool>();
 
             Task.Factory.StartNew(() =>
-            {
-                if (ret == (int)SCMirroringError.None)
                 {
-                    task.SetResult(true);
-                }
-
-                else if (ret != (int)SCMirroringError.None)
-                {
-                    task.SetResult(false);
-                    ScreenMirroringErrorFactory.ThrowException(ret, "Failed to start the screen mirroring");
-                }
-            });
+                    if (ret == (int)ScreenMirroringError.None)
+                    {
+                        task.SetResult(true);
+                    }
+
+                    else if (ret != (int)ScreenMirroringError.None)
+                    {
+                        Log.Error(ScreenMirroringLog.LogTag, "Failed to start screen mirroring" + (ScreenMirroringError)ret);
+                        InvalidOperationException e = new InvalidOperationException("Operation Failed");
+                        task.TrySetException(e);
+                    }
+                });
 
             return task.Task;
         }
 
         /// <summary>
-        /// Pauses receiving data from the SCMIRRORING source.
+        /// Pauses receiving data from the ScreenMirroring source.
         /// This must be called after startasync().
         /// </summary>
         /// <remarks> It will not give the current state. Need to subscribe for event to get the current state </remarks>
         /// <returns>bool value</returns>
         /// <privilege>http://tizen.org/privilege/internet</privilege>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public Task<bool> PauseAsync()
         {
@@ -336,30 +306,30 @@ namespace Tizen.Multimedia
             var task = new TaskCompletionSource<bool>();
 
             Task.Factory.StartNew(() =>
-            {
-                if (ret == (int)SCMirroringError.None)
-                {
-                    task.SetResult(true);
-                }
-
-                else if (ret != (int)SCMirroringError.None)
                 {
-                    task.SetResult(false);
-                    ScreenMirroringErrorFactory.ThrowException(ret, "Failed to pause the receiving data from screen mirroring source");
-                }
-            });
+                    if (ret == (int)ScreenMirroringError.None)
+                    {
+                        task.SetResult(true);
+                    }
+
+                    else if (ret != (int)ScreenMirroringError.None)
+                    {
+                        Log.Error(ScreenMirroringLog.LogTag, "Failed to start screen mirroring" + (ScreenMirroringError)ret);
+                        InvalidOperationException e = new InvalidOperationException("Operation Failed");
+                        task.TrySetException(e);
+                    }
+                });
 
             return task.Task;
         }
 
         /// <summary>
-        /// Resumes receiving data from the SCMIRRORING source.
+        /// Resumes receiving data from the ScreenMirroring source.
         /// This must be called after pauseasync().
         /// </summary>
         /// <remarks> It will not give the current state. Need to subscribe for event to get the current state </remarks>
         /// <returns>bool value</returns>
         /// <privilege>http://tizen.org/privilege/internet</privilege>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public Task<bool> ResumeAsync()
         {
@@ -367,18 +337,19 @@ namespace Tizen.Multimedia
             var task = new TaskCompletionSource<bool>();
 
             Task.Factory.StartNew(() =>
-            {
-                if (ret == (int)SCMirroringError.None)
                 {
-                    task.SetResult(true);
-                }
-
-                else if (ret != (int)SCMirroringError.None)
-                {
-                    task.SetResult(false);
-                    ScreenMirroringErrorFactory.ThrowException(ret, "Failed to resume the receiving data from screen mirroring source");
-                }
-            });
+                    if (ret == (int)ScreenMirroringError.None)
+                    {
+                        task.SetResult(true);
+                    }
+
+                    else if (ret != (int)ScreenMirroringError.None)
+                    {
+                        Log.Error(ScreenMirroringLog.LogTag, "Failed to start screen mirroring" + (ScreenMirroringError)ret);
+                        InvalidOperationException e = new InvalidOperationException("Operation Failed");
+                        task.TrySetException(e);
+                    }
+                });
 
             return task.Task;
         }
@@ -388,12 +359,12 @@ namespace Tizen.Multimedia
         /// valid states: connected/playing/paused
         /// </summary>
         /// <privilege>http://tizen.org/privilege/internet</privilege>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
+        /// <exception cref="ArgumentException">Thrown when method fail due to no connection between devices</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public void Disconnect()
         {
             int ret = Interop.ScreenMirroring.Disconnect(_handle);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
                 ScreenMirroringErrorFactory.ThrowException(ret, "Failed to disconnect sink for screen mirroring");
             }
@@ -403,12 +374,11 @@ namespace Tizen.Multimedia
         /// Unprepare this instance.
         /// valid states: prepared/disconnected.
         /// </summary>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         public void Unprepare()
         {
             int ret = Interop.ScreenMirroring.Unprepare(_handle);
-            if (ret != (int)SCMirroringError.None)
+            if (ret != (int)ScreenMirroringError.None)
             {
                 ScreenMirroringErrorFactory.ThrowException(ret, "Failed to reset the screen mirroring sink");
             }
@@ -459,30 +429,25 @@ namespace Tizen.Multimedia
         private void StateError(int state, int error)
         {
             ///if _stateChanged is subscribe, this will be invoke.
-            StateChangedEventArgs eventArgsState = new StateChangedEventArgs(state);
+            StateChangedEventArgs eventArgsState = new StateChangedEventArgs(state, error);
             _stateChanged?.Invoke(this, eventArgsState);
-
-            ///if _errorOccurred is subscribe, this will be invoke.
-            ErrorOccurredEventArgs eventArgsError = new ErrorOccurredEventArgs(error);
-            _errorOccurred?.Invoke(this, eventArgsError);
         }
 
         /// <summary>
         /// Registers the state changed event.
         /// </summary>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         private void RegisterStateChangedEvent()
         {
-            _stateErrorCallback = (IntPtr userData, int state, int error) =>
+            _stateChangedCallback = (IntPtr userData, int state, int error) =>
                 {
                     StateError(state, error);
                 };
 
-            int ret = Interop.ScreenMirroring.SetStateErrorCb(_handle, _stateErrorCallback, IntPtr.Zero);
-            if (ret != (int)SCMirroringError.None)
+            int ret = Interop.ScreenMirroring.SetStateChangedCb(_handle, _stateChangedCallback, IntPtr.Zero);
+            if (ret != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Setting StateChanged callback failed" + (SCMirroringError)ret);
+                Log.Error(ScreenMirroringLog.LogTag, "Setting StateChanged callback failed" + (ScreenMirroringError)ret);
                 ScreenMirroringErrorFactory.ThrowException(ret, "Setting StateChanged callback failed");
             }
         }
@@ -490,51 +455,15 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Unregisters the state changed event.
         /// </summary>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
         /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
         private void UnregisterStateChangedEvent()
         {
-            int ret = Interop.ScreenMirroring.UnsetStateErrorCb(_handle);
-            if (ret != (int)SCMirroringError.None)
+            int ret = Interop.ScreenMirroring.UnsetStateChangedCb(_handle);
+            if (ret != (int)ScreenMirroringError.None)
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Unsetting StateChnaged callback failed" + (SCMirroringError)ret);
+                Log.Error(ScreenMirroringLog.LogTag, "Unsetting StateChnaged callback failed" + (ScreenMirroringError)ret);
                 ScreenMirroringErrorFactory.ThrowException(ret, "Unsetting StateChanged callback failed");
             }
         }
-
-        /// <summary>
-        /// Registers the error occurred event.
-        /// </summary>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
-        /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
-        private void RegisterErrorOccurredEvent()
-        {
-            _stateErrorCallback = (IntPtr userData, int state, int error) =>
-                {
-                    StateError(state, error);
-                };
-
-            int ret = Interop.ScreenMirroring.SetStateErrorCb(_handle, _stateErrorCallback, IntPtr.Zero);
-            if (ret != (int)SCMirroringError.None)
-            {
-                Log.Error(ScreenMirroringLog.LogTag, "Setting ErrorOccurred callback failed" + (SCMirroringError)ret);
-                ScreenMirroringErrorFactory.ThrowException(ret, "Setting ErrorOccurred callback failed");
-            }
-        }
-
-        /// <summary>
-        /// Unregisters the error occurred event.
-        /// </summary>
-        /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
-        /// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
-        private void UnregisterErrorOccurredEvent()
-        {
-            int ret = Interop.ScreenMirroring.UnsetStateErrorCb(_handle);
-            if (ret != (int)SCMirroringError.None)
-            {
-                Log.Error(ScreenMirroringLog.LogTag, "Unsetting ErrorOccurred callback failed" + (SCMirroringError)ret);
-                ScreenMirroringErrorFactory.ThrowException(ret, "Unsetting ErrorOccurred callback failed");
-            }
-        }
     }
-}
\ No newline at end of file
+}
index 82cce54..b84cd5b 100755 (executable)
@@ -105,7 +105,7 @@ namespace Tizen.Multimedia
     /// <summary>
     /// Enumeration for screen mirroring sink state
     /// </summary>
-    public enum SCMirroringSinkState
+    public enum ScreenMirroringSinkState
     {
         /// <summary>
         /// Screen mirroring is not created yet
@@ -140,19 +140,15 @@ namespace Tizen.Multimedia
     /// <summary>
     /// Enumeration for screen mirroring error.
     /// </summary>
-    public enum SCMirroringError
+    public enum ScreenMirroringErrorCode
     {
         /// <summary>
         /// Successful
         /// </summary>
-        None = SCMirroringErrorCode.None,
-        /// <summary>
-        /// Invalid parameter
-        /// </summary>
-        InvalidParameter = SCMirroringErrorCode.InvalidParameter,
+        None = ScreenMirroringError.None,
         /// <summary>
         /// Invalid operation
         /// </summary>
-        InvalidOperation = SCMirroringErrorCode.InvalidOperation
+        InvalidOperation = ScreenMirroringError.InvalidOperation
     }
-}
+}
\ No newline at end of file
index ed69588..6c23f75 100755 (executable)
  * limitations under the License.
  */
 
-using System;
+using System;
 using Tizen.Internals.Errors;
 namespace Tizen.Multimedia
 {
-    internal enum SCMirroringErrorCode
+    internal enum ScreenMirroringError
     {
         None = ErrorCode.None,
         InvalidParameter = ErrorCode.InvalidParameter,
@@ -33,23 +33,23 @@ namespace Tizen.Multimedia
     {
         internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null)
         {
-            SCMirroringErrorCode err = (SCMirroringErrorCode)errorCode;
+            ScreenMirroringError err = (ScreenMirroringError)errorCode;
             if (string.IsNullOrEmpty(errorMessage))
             {
                 errorMessage = err.ToString();
             }
 
-            switch ((SCMirroringErrorCode)errorCode)
+            switch ((ScreenMirroringError)errorCode)
             {
-                case SCMirroringErrorCode.InvalidParameter:
+                case ScreenMirroringError.InvalidParameter:
                 throw new ArgumentException(errorMessage, paramName);
 
-                case SCMirroringErrorCode.OutOfMemory:
-                case SCMirroringErrorCode.InvalidOperation:
-                case SCMirroringErrorCode.ConnectionTimeOut:
-                case SCMirroringErrorCode.PermissionDenied:
-                case SCMirroringErrorCode.NotSupported:
-                case SCMirroringErrorCode.Unknown:
+                case ScreenMirroringError.OutOfMemory:
+                case ScreenMirroringError.InvalidOperation:
+                case ScreenMirroringError.ConnectionTimeOut:
+                case ScreenMirroringError.PermissionDenied:
+                case ScreenMirroringError.NotSupported:
+                case ScreenMirroringError.Unknown:
                 throw new InvalidOperationException(errorMessage);
             }
         }
index fe4a2ff..6db0132 100755 (executable)
@@ -27,25 +27,40 @@ namespace Tizen.Multimedia
     public class StateChangedEventArgs : EventArgs
     {
         internal int _state;
+        internal int _error;
 
         /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="state"> State Changed </param>
-        internal StateChangedEventArgs(int state)
+        /// <param name="error"> Error Occurred </param>
+        internal StateChangedEventArgs(int state, int error)
         {
             _state = state;
+            _error = error;
+        }
+
+        /// <summary>
+        /// Get the error.
+        /// </summary>
+        /// <value> error code </value>
+        public ScreenMirroringErrorCode Error
+        {
+            get
+            {
+                return (ScreenMirroringErrorCode)_error;
+            }
         }
 
         /// <summary>
         /// Get the current state.
         /// </summary>
         /// <value> current state </value>
-        public SCMirroringSinkState State
+        public ScreenMirroringSinkState State
         {
             get
             {
-                return (SCMirroringSinkState)_state;
+                return (ScreenMirroringSinkState)_state;
             }
         }
     }
index d462cb7..b3ec9a1 100755 (executable)
@@ -1,3 +1,4 @@
+/// Video Information
 /*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
@@ -48,9 +49,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedVideoCodec(ref _handle, out _codec);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get video codec" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get video codec" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get video codec");
                 }
 
@@ -68,9 +69,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedVideoResolution(ref _handle, out _width, out _height);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get height" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get height" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get video height");
                 }
 
@@ -88,9 +89,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedVideoResolution(ref _handle, out _width, out _height);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get width" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get width" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get video width");
                 }
 
@@ -108,9 +109,9 @@ namespace Tizen.Multimedia
             {
                 int ret;
                 ret = Interop.ScreenMirroring.GetNegotiatedVideoFrameRate(ref _handle, out _frameRate);
-                if (ret != (int)SCMirroringError.None)
+                if (ret != (int)ScreenMirroringError.None)
                 {
-                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get frame rate" + (SCMirroringError)ret);
+                    Log.Error(ScreenMirroringLog.LogTag, "Failed to get frame rate" + (ScreenMirroringError)ret);
                     ScreenMirroringErrorFactory.ThrowException(ret, "failed to get video frame rate");
                 }
 
index f37d66e..f25d92f 100755 (executable)
     <Compile Include="MediaController\MediaControllerServer.cs" />
     <Compile Include="MediaController\CustomCommandReplyEventArgs.cs" />
     <Compile Include="ScreenMirroring\AudioInformation.cs" />
-    <Compile Include="ScreenMirroring\ErrorOccurredEventArgs.cs" />
     <Compile Include="ScreenMirroring\ScreenMirroring.cs" />
     <Compile Include="ScreenMirroring\ScreenMirroringEnumerations.cs" />
     <Compile Include="ScreenMirroring\StateChangedEventArgs.cs" />
index 157ed29..d73ee4c 100755 (executable)
     <Compile Include="MediaController\MediaControllerServer.cs" />\r
     <Compile Include="MediaController\CustomCommandReplyEventArgs.cs" />\r
     <Compile Include="ScreenMirroring\AudioInformation.cs" />\r
-    <Compile Include="ScreenMirroring\ErrorOccurredEventArgs.cs" />\r
     <Compile Include="ScreenMirroring\ScreenMirroring.cs" />\r
     <Compile Include="ScreenMirroring\ScreenMirroringEnumerations.cs" />\r
     <Compile Include="ScreenMirroring\StateChangedEventArgs.cs" />\r
     <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
     <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
   </PropertyGroup>\r
-</Project>
+</Project>
\ No newline at end of file