/// <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);
{
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");
}
}
- 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
{
}
Interop.Content.CancelScanFolder(folderPath).ThrowIfError("Failed to cancel scanning");
- tcs.TrySetCanceled();
});
}
/// <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
{
/// <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
{
/// <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
{
/// <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
{
/// <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
{
/// 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>
/// </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
{
/// <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()
{
/// <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)
{
/// <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()
{
/// <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)
{
/// <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()
{
/// 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)
{
[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);
}
}
public static class MediaControlServer
{
private static IntPtr _handle = IntPtr.Zero;
+ private static bool? _isRunning;
/// <summary>
/// Gets a value indicating whether the server is running.
/// <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
{
}
/// <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>
/// <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>
/// <summary>
/// Default constructor. Initializes an object of the CellularAuthInformation.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public CellularAuthInformation()
{
}
/// <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>
/// <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>
/// <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; }
}
* limitations under the License.
*/
+using System;
+
namespace Tizen.Network.Nsd
{
/// <summary>
}
/// <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>
/// <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>
internal static SensorEventStruct IntPtrToEventStruct(IntPtr unmanagedVariable)
{
- SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure(unmanagedVariable, typeof(SensorEventStruct));
+ SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure<SensorEventStruct>(unmanagedVariable);
return outStruct;
}
}
/// <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.
/// <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.
/// <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.
}
/// <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>
}
/// <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>