Merge "code sync with platform/core/csapi/sync-manager" preview1-00190
authorYounho Park <younho.park@samsung.com>
Tue, 12 Sep 2017 05:08:09 +0000 (05:08 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 12 Sep 2017 05:08:09 +0000 (05:08 +0000)
19 files changed:
src/ElmSharp/ElmSharp/EvasMap.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaDatabase.cs
src/Tizen.Location/Tizen.Location/GpsSatellite.cs
src/Tizen.Location/Tizen.Location/Locator.cs
src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs
src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs
src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs
src/Tizen.Sensor/Interop/Interop.Sensor.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/HeartRateMonitor.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/SleepMonitor.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/StationaryActivityDetector.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/WalkingActivityDetector.cs

index cdf1410..13fa2ee 100755 (executable)
@@ -123,7 +123,7 @@ namespace ElmSharp
         /// <param name="dz">The amount of degrees from 0.0 to 360.0 to rotate around Z axis</param>
         /// <param name="cx">The rotation's center horizontal position</param>
         /// <param name="cy">The rotation's center vertical position</param>
-        /// <param name="cz">The rotation's center vertical position</param>
+        /// <param name="cz">The rotation's center depth position</param>
         public void Rotate3D(double dx, double dy, double dz, int cx, int cy, int cz)
         {
             Interop.Evas.evas_map_util_3d_rotate(_evasMap, dx, dy, dz, cx, cy, cz);
index c8676f7..8474364 100644 (file)
@@ -356,10 +356,9 @@ namespace Tizen.Content.MediaContent
         {
             var tcs = new TaskCompletionSource<bool>();
 
-            using (var cbKeeper = ObjectKeeper.Get(GetScanCompletedCallback(tcs)))
+            using (var cbKeeper = ObjectKeeper.Get(GetScanCompletedCallback(tcs, cancellationToken)))
             using (RegisterCancellationAction(tcs, folderPath, cancellationToken))
             {
-
                 Interop.Content.ScanFolder(folderPath, recursive, cbKeeper.Target)
                     .ThrowIfError("Failed to scan");
 
@@ -367,13 +366,21 @@ namespace Tizen.Content.MediaContent
             }
         }
 
-        private static Interop.Content.MediaScanCompletedCallback GetScanCompletedCallback(TaskCompletionSource<bool> tcs)
+        private static Interop.Content.MediaScanCompletedCallback GetScanCompletedCallback(TaskCompletionSource<bool> tcs,
+            CancellationToken cancellationToken)
         {
             return (scanResult, _) =>
             {
                 if (scanResult == MediaContentError.None)
                 {
-                    tcs.TrySetResult(true);
+                    if (cancellationToken.IsCancellationRequested)
+                    {
+                        tcs.TrySetCanceled();
+                    }
+                    else
+                    {
+                        tcs.TrySetResult(true);
+                    }
                 }
                 else
                 {
@@ -398,7 +405,6 @@ namespace Tizen.Content.MediaContent
                 }
 
                 Interop.Content.CancelScanFolder(folderPath).ThrowIfError("Failed to cancel scanning");
-                tcs.TrySetCanceled();
             });
         }
 
index d870c96..d2c35aa 100755 (executable)
@@ -68,7 +68,7 @@ namespace Tizen.Location
         /// <since_tizen> 3 </since_tizen>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public string Nmea
         {
@@ -100,7 +100,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public int ActiveCount
         {
@@ -132,7 +132,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public int InViewCount
         {
@@ -164,7 +164,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public IList<SatelliteInformation> Satellites
         {
@@ -233,7 +233,7 @@ namespace Tizen.Location
         /// <since_tizen> 3 </since_tizen>
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public event EventHandler<SatelliteStatusChangedEventArgs> SatelliteStatusUpdated
         {
@@ -327,21 +327,18 @@ namespace Tizen.Location
         /// The azimuth information of the satellite.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="azimuth"> The azimuth value of the satellite in degrees.</param>
         public uint Azimuth { get; private set; }
 
         /// <summary>
         /// The elevation information of the satellite.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="azimuth"> The azimuth value of the satellite in degrees.</param>
         public uint Elevation { get; private set; }
 
         /// <summary>
         /// The PRN of the satellite.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="azimuth"> The azimuth value of the satellite in degrees.</param>
         public uint Prn { get; private set; }
 
         /// <summary>
index 137e161..9a72fff 100755 (executable)
@@ -266,7 +266,7 @@ namespace Tizen.Location
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <privilege>http://tizen.org/privilege/location</privilege>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public bool EnableMock
         {
@@ -317,7 +317,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public void Start()
         {
@@ -371,7 +371,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public void SetMockLocation(Location location)
         {
@@ -400,7 +400,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public void ClearMock()
         {
@@ -422,7 +422,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public Task<Location> GetLocationAsync(int timeout)
         {
@@ -468,7 +468,7 @@ namespace Tizen.Location
         /// <privilege>http://tizen.org/privilege/location</privilege>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the location.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the location.</exception>
         /// <exception cref="NotSupportedException">Thrown when the location is not supported.</exception>
         public Location GetLocation()
         {
index c191ce3..36e8c93 100755 (executable)
@@ -24,7 +24,7 @@ namespace Tizen.Location
         /// The class constructor for the SettingChangedEventArgs class.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="method">The positioing method used for the location information.</param>
+        /// <param name="type">The positioing method used for the location information.</param>
         /// <param name="enable">The status of the method.</param>
         public SettingChangedEventArgs(LocationType type, bool enable)
         {
index 6fe514d..abd6e58 100644 (file)
@@ -62,5 +62,14 @@ internal static partial class Interop
 
         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")]
         internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_db_connect")]
+        internal static extern MediaControllerError ConnectDb(out IntPtr dbHandle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_db_disconnect")]
+        internal static extern MediaControllerError DisconnectDb(IntPtr dbHandle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_db_check_server_table_exist")]
+        internal static extern MediaControllerError CheckServerExist(IntPtr dbHandle, string appId, out bool value);
     }
 }
index f4fcdf2..c4909bb 100644 (file)
@@ -27,6 +27,7 @@ namespace Tizen.Multimedia.Remoting
     public static class MediaControlServer
     {
         private static IntPtr _handle = IntPtr.Zero;
+        private static bool? _isRunning;
 
         /// <summary>
         /// Gets a value indicating whether the server is running.
@@ -36,53 +37,71 @@ namespace Tizen.Multimedia.Remoting
         /// <seealso cref="Stop"/>
         public static bool IsRunning
         {
-            get => _handle != IntPtr.Zero;
+            get
+            {
+                if (_isRunning.HasValue == false)
+                {
+                    _isRunning = GetRunningState();
+                }
+
+                return _isRunning.Value;
+            }
+        }
+
+        private static bool GetRunningState()
+        {
+            IntPtr handle = IntPtr.Zero;
+            try
+            {
+                Native.ConnectDb(out handle).ThrowIfError("Failed to retrieve the running state.");
+
+                Native.CheckServerExist(handle, Applications.Application.Current.ApplicationInfo.ApplicationId,
+                    out var value).ThrowIfError("Failed to retrieve the running state.");
+
+                return value;
+            }
+            finally
+            {
+                if (handle != IntPtr.Zero)
+                {
+                    Native.DisconnectDb(handle);
+                }
+            }
         }
 
-        private static void ThrowIfNotRunning()
+        private static void EnsureInitializedIfRunning()
         {
+            if (_handle != IntPtr.Zero)
+            {
+                return;
+            }
+
             if (IsRunning == false)
             {
                 throw new InvalidOperationException("The server is not running.");
             }
+
+            Initialize();
         }
 
         private static IntPtr Handle
         {
             get
             {
-                ThrowIfNotRunning();
+                EnsureInitializedIfRunning();
 
                 return _handle;
             }
         }
 
-        /// <summary>
-        /// Starts the media control server.
-        /// </summary>
-        /// <remarks>
-        /// When the server starts, <see cref="MediaControllerManager.ServerStarted"/> will be raised.
-        /// </remarks>
-        /// <privilege>http://tizen.org/privilege/mediacontroller.server</privilege>
-        /// <exception cref="InvalidOperationException">
-        ///     The server has already started.\n
-        ///     -or-\n
-        ///     An internal error occurs.
-        /// </exception>
-        /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege.</exception>
-        /// <seealso cref="MediaControllerManager.ServerStarted"/>
-        public static void Start()
+        private static void Initialize()
         {
-            if (IsRunning)
-            {
-                throw new InvalidOperationException("The server is already running.");
-            }
-
             Native.Create(out _handle).ThrowIfError("Failed to create media controller server.");
 
             try
             {
                 RegisterPlaybackCommandReceivedEvent();
+                _isRunning = true;
             }
             catch
             {
@@ -94,6 +113,21 @@ namespace Tizen.Multimedia.Remoting
         }
 
         /// <summary>
+        /// Starts the media control server.
+        /// </summary>
+        /// <remarks>
+        /// When the server starts, <see cref="MediaControllerManager.ServerStarted"/> will be raised.
+        /// </remarks>
+        /// <privilege>http://tizen.org/privilege/mediacontroller.server</privilege>
+        /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+        /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege.</exception>
+        /// <seealso cref="MediaControllerManager.ServerStarted"/>
+        public static void Start()
+        {
+            Initialize();
+        }
+
+        /// <summary>
         /// Stops the media control server.
         /// </summary>
         /// <remarks>
@@ -107,12 +141,13 @@ namespace Tizen.Multimedia.Remoting
         /// <seealso cref="MediaControllerManager.ServerStopped"/>
         public static void Stop()
         {
-            ThrowIfNotRunning();
+            EnsureInitializedIfRunning();
 
             Native.Destroy(_handle).ThrowIfError("Failed to stop the server.");
 
             _handle = IntPtr.Zero;
             _playbackCommandCallback = null;
+            _isRunning = false;
         }
 
         /// <summary>
index a9bff16..ebb3f81 100755 (executable)
@@ -375,6 +375,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Default constructor. Initializes an object of the CellularAuthInformation.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public CellularAuthInformation()
         {
         }
index 9fa8b86..3636f1d 100755 (executable)
@@ -304,6 +304,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Adds a route to the routing table.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="family">The address family.</param>
         /// <param name="interfaceName">The name of the network interface.</param>
         /// <param name="hostAddress">The IP address of the host.</param>
@@ -328,6 +329,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// Removes a route from the routing table.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="family">The address family.</param>
         /// <param name="interfaceName">The name of network interface.</param>
         /// <param name="hostAddress">The IP address of the host.</param>
index ee0882a..4a2a475 100755 (executable)
@@ -113,6 +113,7 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The DHCP server address. It is only supported for the IPV4 address family.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <value>Server address of the DHCP.</value>
         System.Net.IPAddress DhcpServerAddress { get; }
     }
index 9782a33..7fa490a 100755 (executable)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+using System;
+
 namespace Tizen.Network.Nsd
 {
     /// <summary>
index 192e11b..1f2dbc9 100755 (executable)
@@ -223,7 +223,7 @@ namespace Tizen.Network.WiFi
         }
 
         /// <summary>
-        /// Gets the result of a specific AP scan.
+        /// Gets the result of ScanSpecificAPAsync(string essid) API.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <returns>A list containing the WiFiAP objects.</returns>
index 97e5189..d77be57 100755 (executable)
@@ -210,7 +210,7 @@ namespace Tizen.Network.WiFi
         /// <summary>
         /// The Received signal strength indication(RSSI).
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 4 </since_tizen>
         /// <value>Represents Rssi level of WiFi.</value>
         /// <feature>http://tizen.org/feature/network.wifi</feature>
         /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
index 58a6b1e..160c033 100644 (file)
@@ -130,7 +130,7 @@ internal static partial class Interop
 
     internal static SensorEventStruct IntPtrToEventStruct(IntPtr unmanagedVariable)
     {
-        SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure(unmanagedVariable, typeof(SensorEventStruct));
+        SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure<SensorEventStruct>(unmanagedVariable);
         return outStruct;
     }
 }
index e6c6f48..330628c 100755 (executable)
@@ -69,7 +69,7 @@ namespace Tizen.Sensor
         /// <feature>http://tizen.org/feature/sensor.heart_rate_monitor</feature>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
         /// <exception cref="NotSupportedException">Thrown when the sensor is not supported.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <param name='index'>
         /// Index. Default value for this is 0. Index refers to a particular heart rate monitor in case of multiple sensors.
index 2f778f3..4c9c502 100755 (executable)
@@ -118,7 +118,7 @@ namespace Tizen.Sensor
         /// <feature>http://tizen.org/feature/sensor.pedometer</feature>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
         /// <exception cref="NotSupportedException">Thrown when the sensor is not supported.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <param name='index'>
         /// Index. Default value for this is 0. Index refers to a particular pedometer sensor in case of multiple sensors.
index e9c8578..7ac0b46 100755 (executable)
@@ -69,7 +69,7 @@ namespace Tizen.Sensor
         /// <feature>http://tizen.org/feature/sensor.sleep_monitor</feature>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
         /// <exception cref="NotSupportedException">Thrown when the sensor is not supported.</exception>
-        /// <exception cref="UnauthroizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown when the application has no privilege to use the sensor.</exception>
         /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state.</exception>
         /// <param name='index'>
         /// Index. Default value for this is 0. Index refers to a particular sleep monitor in case of multiple sensors.
index 74d88c1..79ebddb 100755 (executable)
@@ -61,7 +61,7 @@ namespace Tizen.Sensor
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="Tizen.Sensor.stationaryActivityDetector"/> class.
+        /// Initializes a new instance of the <see cref="Tizen.Sensor.StationaryActivityDetector"/> class.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <feature>http://tizen.org/feature/sensor.activity_recognition</feature>
index 6e5c162..d2b7906 100755 (executable)
@@ -61,7 +61,7 @@ namespace Tizen.Sensor
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="Tizen.Sensor.walkingActivityDetector"/> class.
+        /// Initializes a new instance of the <see cref="Tizen.Sensor.WalkingActivityDetector"/> class.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <feature>http://tizen.org/feature/sensor.activity_recognition</feature>