[Multimedia] Modified the ScreenMirroring to throw NotSupportedException when the... 75/151575/1
authorcoderhyme <jhyo.kim@samsung.com>
Thu, 21 Sep 2017 07:50:50 +0000 (16:50 +0900)
committercoderhyme <jhyo.kim@samsung.com>
Thu, 21 Sep 2017 07:50:50 +0000 (16:50 +0900)
Change-Id: I38a94ab922346fa4a599494428a666751ba4ee8b
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs

index 2d02dc8..4e0bd7d 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen.Multimedia.Remoting
     /// </summary>
     public class ScreenMirroring : IDisposable, IDisplayable<ScreenMirroringErrorCode>
     {
+        private const string Feature = "http://tizen.org/feature/network.wifi.direct.display";
         private const int Port = 2022;
 
         private IntPtr _handle;
@@ -47,6 +48,11 @@ namespace Tizen.Multimedia.Remoting
             }
         }
 
+        private static bool IsSupported()
+        {
+            return System.Information.TryGetValue(Feature, out bool isSupported) ? isSupported : false;
+        }
+
         /// <summary>
         /// Initializes a new instance of the ScreenMirroring class.
         /// </summary>
@@ -54,6 +60,11 @@ namespace Tizen.Multimedia.Remoting
         /// <exception cref="NotSupportedException">The feature is not supported.</exception>
         public ScreenMirroring()
         {
+            if (IsSupported() == false)
+            {
+                throw new PlatformNotSupportedException($"The feature({Feature}) is not supported on the current device");
+            }
+
             Native.Create(out _handle).ThrowIfError("Failed to create ScreenMirroring.");
 
             _state = new AtomicState();