CounterClockwise
}
+ [StructLayout(LayoutKind.Sequential)]
internal struct Eext_Rotary_Event_Info
{
public Eext_Rotary_Event_Direction Direction;
/// Property for the count value of the badge.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <exception cref="ArgumentException">Thrown when set negative number</exception>
public int Count
{
get
internal static bool IsSupported(string key)
{
- if (SystemInfo.TryGetValue(key, out bool value))
+ if (Information.TryGetValue(key, out bool value))
{
return value;
}
/*
-* 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.
-*/
+ * 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.Runtime.InteropServices;
/// <summary>
/// Gets the size allocated for the audio input buffer.
/// </summary>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
public int GetBufferSize()
{
AudioIOUtil.ThrowIfError(AudioInput.GetBufferSize(_handle, out var size));
/// Prepares the AudioCapture for reading audio data by starting buffering of audio data from the device.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// Operation failed due to internal error.\n
+ /// Operation failed due to an internal error.\n
/// -or-\n
/// The current state is not <see cref="AudioIOState.Idle"/>.
/// </exception>
/// Unprepares the AudioCapture.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// Operation failed due to internal error.\n
+ /// Operation failed due to an internal error.\n
/// -or-\n
/// The current state is <see cref="AudioIOState.Idle"/>.
/// </exception>
AudioIOUtil.ThrowIfError(AudioInput.Resume(_handle));
}
+
/// <summary>
/// Flushes and discards buffered audio data from the input stream.
/// </summary>
/// </summary>
/// <param name="streamPolicy">The <see cref="AudioStreamPolicy"/> to apply for the AudioCapture.</param>
/// <exception cref="ArgumentNullException"><paramref name="streamPolicy"/> is null.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
/// <exception cref="NotSupportedException"><paramref name="streamPolicy"/> is not supported.</exception>
/// <exception cref="ArgumentException">Not able to retrieve information from <paramref name="streamPolicy"/>.</exception>
public void ApplyStreamPolicy(AudioStreamPolicy streamPolicy)
}
/// <summary>
- /// Provides the ability to record audio from system audio input devices in synchronous way.
+ /// Provides the ability to record audio from system audio input devices in a synchronous way.
/// </summary>
/// <privilege>http://tizen.org/privilege/recorder</privilege>
public class AudioCapture : AudioCaptureBase
{
/// <summary>
- /// Initializes a new instance of the AudioCapture class with the specified sample rate, channel and sampleType.
+ /// Initializes a new instance of the AudioCapture class with the specified sample rate, channel, and sampleType.
/// </summary>
- /// <param name="sampleRate">The audio sample rate.(8000 ~ 48000Hz)</param>
+ /// <param name="sampleRate">The audio sample rate (8000 ~ 48000Hz).</param>
/// <param name="channel">The audio channel type.</param>
/// <param name="sampleType">The audio sample type.</param>
/// <exception cref="ArgumentOutOfRangeException">
}
/// <summary>
- /// Provides the ability to record audio from system audio input devices in asynchronous way.
+ /// Provides the ability to record audio from system audio input devices in an asynchronous way.
/// </summary>
/// <privilege>http://tizen.org/privilege/recorder</privilege>
public class AsyncAudioCapture : AudioCaptureBase
/// <summary>
/// Initializes a new instance of the AsyncAudioCapture class with the specified sample rate, channel and sampleType.
/// </summary>
- /// <param name="sampleRate">The audio sample rate.(8000 ~ 48000Hz)</param>
+ /// <param name="sampleRate">The audio sample rate (8000 ~ 48000Hz).</param>
/// <param name="channel">The audio channel type.</param>
/// <param name="sampleType">The audio sample type.</param>
/// <exception cref="ArgumentOutOfRangeException">
/*
-* 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.
-*/
+ * 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;
/*
-* 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.
-*/
+ * 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 Tizen.Internals.Errors;
{
Mono = 0x80,
Stereo
- };
+ }
internal enum AudioIOError
{
}
/// <summary>
- /// Specifies the states for the <see cref="AudioPlayback"/>, <see cref="AudioCapture"/> and <see cref="AsyncAudioCapture"/>.
+ /// Specifies the states for the <see cref="AudioPlayback"/>, <see cref="AudioCapture"/>, and <see cref="AsyncAudioCapture"/>.
/// </summary>
public enum AudioIOState
{
}
/// <summary>
- /// Enumeration for audio sample type.
+ /// Specifies the audio sample types.
/// </summary>
public enum AudioSampleType
{
/// </summary>
S16Le
}
-
-}
+}
\ No newline at end of file
/*
-* 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.
-*/
+ * 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>
- /// Provides data for the <see cref="AudioCaptureBase.StateChanged"/> event and <see cref="AudioPlayback.StateChanged"/>.
+ /// Provides data for the <see cref="AudioCaptureBase.StateChanged"/> event and the <see cref="AudioPlayback.StateChanged"/> event.
/// </summary>
public class AudioIOStateChangedEventArgs : EventArgs
{
public AudioIOState Current { get; }
/// <summary>
- /// Gets the value indicating whether the state is changed by policy or not.
+ /// Gets the value indicating whether the state is changed by a policy or not.
/// </summary>
public bool ByPolicy { get; }
}
/*
-* 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.
-*/
+ * 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.Diagnostics;
/*
-* 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.
-*/
+ * 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 static Interop.AudioIO;
namespace Tizen.Multimedia
{
/// <summary>
- /// Provides the ability to directly manage the system audio output devices and play PCM (pulse-code modulation) data.
+ /// Provides the ability to directly manage the system audio output devices and play the PCM (pulse-code modulation) data.
/// </summary>
public class AudioPlayback : IDisposable
{
#region Event
/// <summary>
- /// Occurs when audio playback data can be written.
+ /// Occurs when the audio playback data can be written.
/// </summary>
/// <seealso cref="Write(byte[])"/>
public event EventHandler<AudioPlaybackBufferAvailableEventArgs> BufferAvailable;
#endregion
/// <summary>
- /// Initializes a new instance of the AudioPlayback class with the specified sample rate, channel and sample type.
+ /// Initializes a new instance of the AudioPlayback class with the specified sample rate, channel, and sample type.
/// </summary>
- /// <param name="sampleRate">The audio sample rate.(8000 ~ 48000Hz)</param>
+ /// <param name="sampleRate">The audio sample rate (8000 ~ 48000Hz).</param>
/// <param name="channel">The audio channel type.</param>
/// <param name="sampleType">The audio sample type.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// <summary>
/// Gets the sound type supported by the audio output device.
/// </summary>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
public AudioStreamType StreamType
{
get
/// <summary>
/// Gets the size allocated for the audio output buffer.
/// </summary>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
public int GetBufferSize()
{
AudioIOUtil.ThrowIfError(AudioOutput.GetBufferSize(_handle, out var size));
}
/// <summary>
- /// Drains buffered audio data from the output stream.
- /// It blocks the calling thread until draining the stream buffer completely. (e.g. end of playback)
+ /// Drains the buffered audio data from the output stream.
+ /// It blocks the calling thread until the drain of the stream buffer is complete, for example, at the end of playback.
/// </summary>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The current state is <see cref="AudioIOState.Idle"/>.</exception>
public void Drain()
{
/// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception>
/// <exception cref="ArgumentException">The length of <paramref name="buffer"/> is zero.</exception>
/// <exception cref="InvalidOperationException">The current state is not <see cref="AudioIOState.Running"/>.</exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
public int Write(byte[] buffer)
{
ValidateState(AudioIOState.Running);
/// This must be called before <see cref="Write(byte[])"/>.
/// </remarks>
/// <exception cref="InvalidOperationException">
- /// Operation failed due to internal error.\n
+ /// Operation failed due to an internal error.\n
/// -or-\n
/// The current state is not <see cref="AudioIOState.Idle"/>.
/// </exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
/// <seealso cref="Unprepare"/>
public void Prepare()
{
/// Unprepares the AudioPlayback.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// Operation failed due to internal error.\n
+ /// Operation failed due to an internal error.\n
/// -or-\n
/// The current state is <see cref="AudioIOState.Idle"/>.
/// </exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
/// <seealso cref="Prepare"/>
public void Unprepare()
{
}
/// <summary>
- /// Pauses feeding of audio data to the device.
+ /// Pauses feeding of the audio data to the device.
/// </summary>
- /// <remarks>It has no effect if the current is the <see cref="AudioIOState.Paused"/>.</remarks>
+ /// <remarks>It has no effect if the current state is <see cref="AudioIOState.Paused"/>.</remarks>
/// <exception cref="InvalidOperationException">
/// The current state is <see cref="AudioIOState.Idle"/>.\n
/// -or-\n
/// The method is called in the <see cref="BufferAvailable"/> event handler.
/// </exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
/// <seealso cref="Resume"/>
public void Pause()
{
}
/// <summary>
- /// Resumes feeding of audio data to the device.
+ /// Resumes feeding of the audio data to the device.
/// </summary>
- /// <remarks>It has no effect if the current is the <see cref="AudioIOState.Running"/>.</remarks>
+ /// <remarks>It has no effect if the current state is <see cref="AudioIOState.Running"/>.</remarks>
/// <exception cref="InvalidOperationException">
/// The current state is <see cref="AudioIOState.Idle"/>.\n
/// -or-\n
/// The method is called in an event handler.
/// </exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
/// <seealso cref="Pause"/>
public void Resume()
{
}
/// <summary>
- /// Flushes and discards buffered audio data from the output stream.
+ /// Flushes and discards the buffered audio data from the output stream.
/// </summary>
/// <exception cref="InvalidOperationException">The current state is <see cref="AudioIOState.Idle"/>.</exception>
- /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed of.</exception>
public void Flush()
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
/// <param name="streamPolicy">The <see cref="AudioStreamPolicy"/> to apply for the AudioPlayback.</param>
/// <exception cref="ArgumentNullException"><paramref name="streamPolicy"/> is null.</exception>
/// <exception cref="ObjectDisposedException">
- /// <paramref name="streamPolicy"/> has already been disposed.\n
+ /// <paramref name="streamPolicy"/> has already been disposed of.\n
/// -or-\n
- /// The AudioPlayback has already been disposed.
+ /// The AudioPlayback has already been disposed of.
/// </exception>
/// <exception cref="NotSupportedException"><paramref name="streamPolicy"/> is not supported.</exception>
/// <exception cref="ArgumentException">Not able to retrieve information from <paramref name="streamPolicy"/>.</exception>
/*
-* 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.
-*/
+ * 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>
+ /// Provides data for the <see cref="AudioPlayback.BufferAvailable"/> event.
+ /// </summary>
public class AudioPlaybackBufferAvailableEventArgs : EventArgs
{
internal AudioPlaybackBufferAvailableEventArgs(int length)
Length = length;
}
+ /// <summary>
+ /// Gets the length of the buffer that can be written.
+ /// </summary>
+ /// <value>The length of the buffer that can be written.</value>
+ /// <seealso cref="AudioPlayback.Write(byte[])"/>
public int Length { get; }
}
}
/// <exception cref="ArgumentOutOfRangeException"><paramref name="durationMilliseconds"/> is less than -1.</exception>
/// <exception cref="InvalidOperationException">Any invalid operations occurred.</exception>
/// <exception cref="NotSupportedException"><paramref name="tone"/> is not a supported type.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy,
int durationMilliseconds)
{
/// <exception cref="ArgumentOutOfRangeException"><paramref name="durationMilliseconds"/> is less than -1.</exception>
/// <exception cref="InvalidOperationException">Any invalid operations occurred.</exception>
/// <exception cref="NotSupportedException"><paramref name="tone"/> is not a supported type.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy,
int durationMilliseconds, CancellationToken cancellationToken)
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Enumeration for Audio Codec.
+ /// Specifies the audio codec.
/// </summary>
public enum ToneType
{
/// </summary>
Dtmf2,
/// <summary>
- /// redefined DTMF 3.
+ /// Predefined DTMF 3.
/// </summary>
Dtmf3,
/// <summary>
/// <exception cref="InvalidOperationException">An internal error occurs.</exception>
/// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
/// <exception cref="FileFormatException">The format of <paramref name="path"/> is not supported.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
public static Task StartAsync(string path, AudioStreamPolicy streamPolicy,
CancellationToken cancellationToken)
{
#endregion Callback registrations
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the captured still image.
+ /// Provides data for the <see cref="Camera.Capturing"/> event.
/// </summary>
public class CameraCapturingEventArgs : EventArgs
{
}
/// <summary>
- /// The main image data of the captured still image.
+ /// Gets the main image data of the captured still image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public StillImage MainImage { get; }
/// <summary>
- /// The image data of the post view.
+ /// Gets the image data of the post view.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public StillImage PostView { get; }
/// <summary>
- /// The image data of the thumbnail.
+ /// Gets the image data of the thumbnail.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public StillImage Thumbnail { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the previous and the current state
- /// of the camera when its state is changed.
+ /// Provides data for the <see cref="Camera.DeviceStateChanged"/> event.
/// </summary>
public class CameraDeviceStateChangedEventArgs : EventArgs
{
}
/// <summary>
- /// The camera device type.
+ /// Gets the camera device type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraDevice Device { get; }
/// <summary>
- /// The current state of the camera device.
+ /// Gets the current state of the camera device.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraDeviceState State { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the error status and the
- /// state of the camera when it fails.
+ /// Provides data for the <see cref="Camera.ErrorOccurred"/> event.
/// </summary>
public class CameraErrorOccurredEventArgs : EventArgs
{
}
/// <summary>
- /// The camera error code.
+ /// Gets the camera error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraErrorCode Error { get; }
/// <summary>
- /// The state of the camera.
+ /// Gets the current state of the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraState State { get; }
}
}
-
{
}
}
-}
\ No newline at end of file
+}
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the focus state of the camera.
+ /// Provides data for the <see cref="Camera.FocusStateChanged"/> event.
/// </summary>
public class CameraFocusStateChangedEventArgs : EventArgs
{
}
/// <summary>
- /// The focus state of the camera.
+ /// Gets the focus state of the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraFocusState State { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about current state
- /// of the camera when interrupt is invoked internally in Native FW.
+ /// Provides data for the <see cref="Camera.InterruptStarted"/> event.
/// </summary>
public class CameraInterruptStartedEventArgs : EventArgs
{
}
/// <summary>
- /// Current state of the camera.
+ /// Gets the current state of the camera.
/// </summary>
public CameraState State { get; }
/// <summary>
- /// The policy that interrupted the camera.
+ /// Gets the policy that interrupted the camera.
/// </summary>
public CameraPolicy Policy { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the previous and the current state
- /// of the camera when it is interrupted.
+ /// Provides data for the <see cref="Camera.Interrupted"/> event.
/// </summary>
public class CameraInterruptedEventArgs : EventArgs
{
}
/// <summary>
- /// The previous state of the camera.
+ /// Gets the previous state of the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraState Previous { get; }
/// <summary>
- /// The current state of the camera.
+ /// Gets the current state of the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraState Current { get; }
/// <summary>
- /// The policy that interrupted the camera.
+ /// Gets the policy that interrupted the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraPolicy Policy { get; }
}
}
-
#endregion EXIF tag
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the previous and the current state
- /// of the camera when its state is changed.
+ /// Provides data for the <see cref="Camera.StateChanged"/> event.
/// </summary>
public class CameraStateChangedEventArgs : EventArgs
{
/// Gets the value indicating whether the state is changed by policy.
/// </summary>
/// <value>
- /// true if the state changed by policy such as resource conflict or security, otherwise false.
+ /// true if the state changed by policy, such as resource conflict or security, otherwise false.
/// </value>
/// <since_tizen> 3 </since_tizen>
public bool ByPolicy { get; }
}
}
-
/// <since_tizen> 3 </since_tizen>
public byte[] UV { get; }
}
-}
\ No newline at end of file
+}
/// <since_tizen> 3 </since_tizen>
public byte[] Data { get; }
}
-}
\ No newline at end of file
+}
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about all the faces detected.
+ /// Provides data for the <see cref="Camera.FaceDetected"/> event.
/// If the user needs to keep the faces data, the user has to copy the data.
/// </summary>
public class FaceDetectedEventArgs : EventArgs
}
/// <summary>
- /// The list containing faces of type <see cref="Tizen.Multimedia.FaceDetectionData"/>.
+ /// Gets the list containing faces of type <see cref="Tizen.Multimedia.FaceDetectionData"/>.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public IEnumerable<FaceDetectionData> Faces { get; }
}
}
-
public int Height { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the HDR capture progress.
+ /// Provides data for the <see cref="Camera.HdrCaptureProgress"/> event.
/// </summary>
public class HdrCaptureProgressEventArgs : EventArgs
{
}
/// <summary>
- /// The HDR capture progress in percent.
+ /// Gets the HDR Capture progress in percent.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int Percent { get; }
}
}
-
public interface IPreviewPlane
{
}
-}
\ No newline at end of file
+}
public double Altitude { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the media packet preview frame.
+ /// Provides data for the <see cref="Camera.MediaPacketPreview"/> event.
/// </summary>
public class MediaPacketPreviewEventArgs : EventArgs
{
}
/// <summary>
- /// The media packet data.
+ /// Gets the media packet data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public MediaPacket Packet { get; }
}
}
-
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the preview frame.
+ /// Provides data for the <see cref="Camera.Preview"/> event.
/// </summary>
public class PreviewEventArgs : EventArgs
{
}
/// <summary>
- /// The PreviewData frame.
+ /// Gets the preview frame data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PreviewFrame Preview { get; }
}
}
-
/// <since_tizen> 3 </since_tizen>
public IPreviewPlane Plane { get; }
}
-}
\ No newline at end of file
+}
/// <since_tizen> 3 </since_tizen>
public byte[] Data { get; }
}
-}
\ No newline at end of file
+}
/// <since_tizen> 3 </since_tizen>
public byte[] V { get; }
}
-}
\ No newline at end of file
+}
}
/// <summary>
- /// Gets the value indicating new status of the codec.
+ /// Gets the value indicating the new status of the codec.
/// </summary>
public MediaCodecStatus Status { get; }
}
/// <summary>
- /// Gets the packet that the codec has processed.
+ /// Gets the packet processed by the codec.
/// </summary>
public MediaPacket Packet { get; }
}
namespace Tizen.Multimedia.MediaCodec
{
/// <summary>
- /// Provides the means to encode and decode video and audio data.
+ /// Provides the means to encode and decode the video and the audio data.
/// </summary>
public class MediaCodec : IDisposable
{
private IntPtr _handle;
/// <summary>
- /// Initialize a new instance of the MediaCodec class.
+ /// Initializes a new instance of the MediaCodec class.
/// </summary>
public MediaCodec()
{
#endregion
/// <summary>
- /// Validates if the object already has been disposed of.
+ /// Validates if the object has already been disposed of.
/// </summary>
/// <exception cref="ObjectDisposedException">The current object has been disposed of.</exception>
private void ValidateNotDisposed()
/// Prepares the MediaCodec for encoding or decoding.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// The codec is not configured, yet.\n
+ /// The codec is not configured yet.\n
/// -or-\n
/// Internal error.
/// </exception>
/// Configures the MediaCodec.
/// </summary>
/// <param name="format">The <see cref="MediaFormat"/> for properties of media data to decode or encode.</param>
- /// <param name="encoder">The value indicating whether the codec works as a encoder or a decoder.</param>
+ /// <param name="encoder">The value indicating whether the codec works as an encoder or a decoder.</param>
/// <param name="codecType">The value indicating whether the codec uses hardware acceleration.</param>
- /// <exception cref="ArgumentNullException">format is null</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="format"/> is null.</exception>
/// <exception cref="ArgumentException">
/// <paramref name="codecType"/> is invalid.\n
/// -or-\n
/// <paramref name="format"/> is neither audio type nor video type.
/// </exception>
- /// <exception cref="NotSupportedException">the mime type of the format is not supported.</exception>
+ /// <exception cref="NotSupportedException">The mime type of the format is not supported.</exception>
/// <see cref="SupportedAudioCodecs"/>
/// <see cref="SupportedVideoCodecs"/>
public void Configure(MediaFormat format, bool encoder, MediaCodecTypes codecType)
/// Adds the packet to the internal queue of the codec.
/// </summary>
/// <param name="packet">The packet to be encoded or decoded.</param>
- /// <exception cref="ArgumentNullException">packet is null.</exception>
- /// <exception cref="InvalidOperationException">the current codec is not prepared, yet.</exception>
- /// <remarks>Any attempts to modify the packet will be failed until the <see cref="InputProcessed"/> event for the packet is invoked.</remarks>
+ /// <exception cref="ArgumentNullException"><paramref="packet"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">The current codec is not prepared yet.</exception>
+ /// <remarks>Any attempts to modify the packet will fail until the <see cref="InputProcessed"/> event for the packet is invoked.</remarks>
public void ProcessInput(MediaPacket packet)
{
ValidateNotDisposed();
/// <param name="encoder">The value indicating encoder or decoder.</param>
/// <param name="type">The mime type to query.</param>
/// <returns>The values indicating which codec types are supported on the current device.</returns>
- /// <exception cref="ArgumentException">type is invalid.</exception>
+ /// <exception cref="ArgumentException"><paramref="type"/> is invalid.</exception>
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatVideoMimeType type)
{
ValidateNotDisposed();
/// <param name="encoder">The value indicating encoder or decoder.</param>
/// <param name="type">The mime type to query.</param>
/// <returns>The values indicating which codec types are supported on the current device.</returns>
- /// <exception cref="ArgumentException">type is invalid.</exception>
+ /// <exception cref="ArgumentException"><paramref="type"/> is invalid.</exception>
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatAudioMimeType type)
{
ValidateNotDisposed();
/// <param name="index">The index of the band to get.</param>
/// <exception cref="ObjectDisposedException">The <see cref="Player"/> has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// index is less than zero.\n
+ /// <pramref name="index"/> is less than zero.\n
/// -or-\n
- /// index is equal to or greater than <see cref="Count"/>.
+ /// <paramref name="index"/> is equal to or greater than <see cref="Count"/>.
/// </exception>
public EqualizerBand this[int index]
{
get
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
Player.ValidateNotDisposed();
if (index < 0 || Count <= index)
/// <exception cref="ObjectDisposedException">The <see cref="Player"/> has already been disposed of.</exception>
public void Clear()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
Player.ValidateNotDisposed();
Native.EqualizerClear(Player.Handle).
ThrowIfFailed("Failed to clear equalizer effect");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
- /// Get the number of items.
+ /// Gets the number of items.
/// </summary>
public int Count { get; }
/// <summary>
- /// Get the band level range of the bands in dB.
+ /// Gets the band level range of the bands in the dB.
/// </summary>
public Range BandLevelRange { get; }
{
/// <summary>
- /// Represents a equalizer band of <see cref="AudioEffect"/>.
+ /// Represents an equalizer band of <see cref="AudioEffect"/>.
/// </summary>
public class EqualizerBand
{
internal EqualizerBand(AudioEffect owner, int index)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
Debug.Assert(owner != null);
_owner = owner;
{
get
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
_owner.Player.ValidateNotDisposed();
int value = 0;
}
set
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
_owner.Player.ValidateNotDisposed();
if (value < _owner.BandLevelRange.Min || _owner.BandLevelRange.Max < value)
/// <summary>
- /// Gets the frequency in dB.
+ /// Gets the frequency in the dB.
/// </summary>
public int Frequency { get; }
/// <summary>
- /// Gets the frequency range in dB.
+ /// Gets the frequency range in the dB.
/// </summary>
public int FrequencyRange { get; }
private byte[] _buffer;
/// <summary>
- /// Initialize a new instance of the MediaBufferSource class with an allocated buffer.
+ /// Initializes a new instance of the MediaBufferSource class with an allocated buffer.
/// </summary>
/// <param name="length">The value indicating the size of the buffer.</param>
/// <exception cref="ArgumentOutOfRangeException">
}
/// <summary>
- /// Initialize a new instance of the MediaBufferSource class from the buffer.
+ /// Initializes a new instance of the MediaBufferSource class from the buffer.
/// </summary>
/// <param name="buffer">The source array to be copied into the buffer.</param>
- /// <exception cref="ArgumentNullException">buffer is null.</exception>
+ /// <exception cref="ArgumentNullException"><paramref="buffer"/> is null.</exception>
public MediaBufferSource(byte[] buffer) : this(buffer, buffer == null ? 0 : buffer.Length)
{
}
//TODO remove default parameter.
/// <summary>
- /// Initialize a new instance of the MediaBufferSource class from the buffer
+ /// Initializes a new instance of the MediaBufferSource class from the buffer
/// with the specified length and the specified offset.
/// </summary>
/// <param name="buffer">The source array to be copied into the buffer.</param>
/// <param name="length">The value indicating the number of bytes to copy from the buffer.</param>
/// <param name="offset">The value indicating the offset in the buffer of the first byte to copy.</param>
- /// <exception cref="ArgumentNullException">buffer is null.</exception>
+ /// <exception cref="ArgumentNullException"><paramref="buffer"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="offset"/> is less than zero.\n
/// -or-\n
}
/// <summary>
- /// Create a MediaBufferSource that wraps a byte array.
+ /// Creates a MediaBufferSource that wraps a byte array.
/// </summary>
/// <param name="buffer">The array to be wrapped.</param>
/// <returns>A MediaBufferSource wrapping the byte array.</returns>
internal void AttachTo(Player player)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
OnAttached(player);
}
internal void DetachFrom(Player player)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
OnDetached(player);
}
}
/// <summary>
- /// Occurs when the buffer underrun or overflow.
+ /// Occurs when the buffer underruns or overflows.
/// </summary>
/// <remarks>The event handler will be executed on an internal thread.</remarks>
/// <seealso cref="BufferMaxSize"/>
/// Gets the max size of the buffer.
/// </summary>
/// <value>The max size of the buffer. The default is 200000.</value>
- /// <remarks>If the buffer level over the max size, <see cref="BufferStatusChanged"/> will be raised with <see cref="MediaStreamBufferStatus.Overflow"/>.</remarks>
+ /// <remarks>If the buffer level overflows the max size, <see cref="BufferStatusChanged"/> will be raised with <see cref="MediaStreamBufferStatus.Overflow"/>.</remarks>
/// <exception cref="InvalidOperationException">The <see cref="MediaStreamSource"/> is not assigned to a player.</exception>
- /// <exception cref="ArgumentOutOfRangeException">value is zero.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is zero.</exception>
/// <seealso cref="BufferStatusChanged"/>
public ulong BufferMaxSize
{
}
/// <summary>
- /// Gets the min threshold of the buffer or zero if the <see cref="MediaStreamSource"/> is not assigned to a player.
+ /// Gets the minimum threshold of the buffer, or zero if the <see cref="MediaStreamSource"/> is not assigned to a player.
/// </summary>
/// <value>The minimum threshold of the buffer in percentage. The default is zero.</value>
/// <remarks>If the buffer level drops below the threshold value, <see cref="BufferStatusChanged"/> will be raised with <see cref="MediaStreamBufferStatus.Underrun"/>.</remarks>
/// <exception cref="InvalidOperationException">The <see cref="MediaStreamSource"/> is not assigned to a player.</exception>
- /// <exception cref="ArgumentOutOfRangeException">value is greater than 100.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is greater than 100.</exception>
/// <seealso cref="BufferStatusChanged"/>
public uint BufferMinThreshold
{
{
/// <summary>
- /// Provides the ability to push packets as the source of <see cref="Player"/>
+ /// Provides the ability to push packets as the source of <see cref="Player"/>.
/// </summary>
/// <remarks>The source must be set as a source to a player before pushing.</remarks>
/// <seealso cref="Player.SetSource(MediaSource)"/>
/// <summary>
- /// Initialize a new instance of the MediaStreamSource class
+ /// Initializes a new instance of the MediaStreamSource class
/// with the specified <see cref="AudioMediaFormat"/> and <see cref="VideoMediaFormat"/>.
/// </summary>
/// <param name="audioMediaFormat">The <see cref="AudioMediaFormat"/> for this source.</param>
}
/// <summary>
- /// Initialize a new instance of the MediaStreamSource class with the specified <see cref="AudioMediaFormat"/>.
+ /// Initializes a new instance of the MediaStreamSource class with the specified <see cref="AudioMediaFormat"/>.
/// </summary>
/// <param name="audioMediaFormat">The <see cref="AudioMediaFormat"/> for this source.</param>
/// <remarks>AAC is supported.</remarks>
AudioConfiguration = CreateAudioConfiguration(audioMediaFormat);
}
/// <summary>
- /// Initialize a new instance of the MediaStreamSource class with the specified <see cref="VideoMediaFormat"/>.
+ /// Initializes a new instance of the MediaStreamSource class with the specified <see cref="VideoMediaFormat"/>.
/// </summary>
- /// <remarks>H.264 can is supported.</remarks>
+ /// <remarks>H.264 is supported.</remarks>
/// <param name="videoMediaFormat">The <see cref="VideoMediaFormat"/> for this source.</param>
/// <exception cref="ArgumentNullException"><paramref name="videoMediaFormat"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="videoMediaFormat"/> is not supported.</exception>
}
/// <summary>
- /// Gets the audio configuration or null if no AudioMediaFormat is specified in the constructor.
+ /// Gets the audio configuration, or null if no AudioMediaFormat is specified in the constructor.
/// </summary>
public MediaStreamConfiguration AudioConfiguration { get; }
/// <summary>
- /// Gets the video configuration or null if no VideoMediaFormat is specified in the constructor.
+ /// Gets the video configuration, or null if no VideoMediaFormat is specified in the constructor.
/// </summary>
public MediaStreamConfiguration VideoConfiguration { get; }
/// <summary>
/// Pushes elementary stream to decode audio or video.
/// </summary>
- /// <remarks>This source must be set as a source to a player and the player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
+ /// <remarks>This source must be set as a source to a player and the player must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.</remarks>
/// <param name="packet">The <see cref="MediaPacket"/> to decode.</param>
/// <exception cref="InvalidOperationException">
/// This source is not set as a source to a player.\n
/// -or-\n
/// The player is not in the valid state.
/// </exception>
- /// <exception cref="ArgumentNullException">packet is null.</exception>
- /// <exception cref="ObjectDisposedException">packet has been disposed.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="packet"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="packet"/> has been disposed of.</exception>
/// <exception cref="ArgumentException">
/// <paramref name="packet"/> is neither video nor audio type.\n
/// -or-\n
/// The format of packet is not matched with the specified format in the constructor.
/// </exception>
- /// <exception cref="NoBufferSpaceException">the internal buffer reaches limits.</exception>
+ /// <exception cref="NoBufferSpaceException">The internal buffer has reached its limits.</exception>
/// <seealso cref="Player.SetSource(MediaSource)"/>
/// <seealso cref="MediaStreamConfiguration.BufferMaxSize"/>
/// <seealso cref="MediaPacket"/>
}
/// <summary>
- /// Gets the <see cref="Player"/> that this source is assigned to as a source or null if this source is not assigned.
+ /// Gets the <see cref="Player"/> that this source is assigned to as a source, or null if this source is not assigned.
/// </summary>
/// <seealso cref="Player.SetSource(MediaSource)"/>
public Player Player => _player;
/// Represents a media source with a uri.
/// </summary>
/// <remarks>
- /// The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
+ /// The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from a network.
/// The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage.
/// The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage.
/// </remarks>
public partial class Player
{
/// <summary>
- /// Occurs when playback of a media is finished.
+ /// Occurs when the playback of a media is finished.
/// </summary>
public event EventHandler<EventArgs> PlaybackCompleted;
private NativePlayer.PlaybackCompletedCallback _playbackCompletedCallback;
/// <summary>
- /// Occurs when playback of a media is interrupted.
+ /// Occurs when the playback of a media is interrupted.
/// </summary>
public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterrupted;
private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback;
private NativePlayer.PlaybackErrorCallback _playbackErrorCallback;
/// <summary>
- /// Occurs when the video stream changed.
+ /// Occurs when the video stream is changed.
/// </summary>
/// <remarks>The event handler will be executed on an internal thread.</remarks>
public event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged;
private string _userAgent = "";
/// <summary>
- /// Gets or Sets the cookie for streaming playback.
+ /// Gets or sets the cookie for streaming playback.
/// </summary>
/// <remarks>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
}
/// <summary>
- /// Gets or Sets the user agent for streaming playback.
+ /// Gets or sets the user agent for streaming playback.
/// </summary>
/// <remarks>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <value>A <see cref="AudioLatencyMode"/> that specifies the mode. The default is <see cref="AudioLatencyMode.Mid"/>.</value>
/// <remarks>
/// If the mode is <see cref="AudioLatencyMode.High"/>,
- /// audio output interval can be increased so, it can keep more audio data to play.
+ /// audio output interval can be increased, so it can keep more audio data to play.
/// But, state transition like pause or resume can be more slower than default(<see cref="AudioLatencyMode.Mid"/>).
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
private PlayerTrackInfo _audioTrack;
/// <summary>
- /// Gets the track info for audio.
+ /// Gets the track info for the audio.
/// </summary>
/// <value>A <see cref="PlayerTrackInfo"/> for audio.</value>
public PlayerTrackInfo AudioTrackInfo
private PlayerTrackInfo _subtitleTrackInfo;
/// <summary>
- /// Gets the track info for subtitle.
+ /// Gets the track info for the subtitle.
/// </summary>
- /// <value>A <see cref="PlayerTrackInfo"/> for subtitle.</value>
+ /// <value>A <see cref="PlayerTrackInfo"/> for the subtitle.</value>
public PlayerTrackInfo SubtitleTrackInfo
{
get
namespace Tizen.Multimedia
{
- static internal class PlayerLog
+ internal static class PlayerLog
{
internal const string Tag = "Tizen.Multimedia.Player";
- internal const string Enter = "[ENTER]";
- internal const string Leave = "[LEAVE]";
}
/// <summary>
/// Provides the ability to control media playback.
/// </summary>
/// <remarks>
- /// The Player provides functions to play a media content.
+ /// The player provides functions to play a media content.
/// It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc.
/// Note that only one video player can be played at one time.
/// </remarks>
private PlayerHandle _handle;
/// <summary>
- /// Initialize a new instance of the Player class.
+ /// Initializes a new instance of the <see cref="Player"/> class.
/// </summary>
public Player()
{
#region Methods
/// <summary>
- /// Gets the streaming download Progress.
+ /// Gets the streaming download progress.
/// </summary>
/// <returns>The <see cref="DownloadProgress"/> containing current download progress.</returns>
/// <remarks>The player must be in the <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
public DownloadProgress GetDownloadProgress()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
int start = 0;
/// <exception cref="ArgumentNullException">The path is null.</exception>
public void SetSubtitle(string path)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidateNotDisposed();
if (path == null)
NativePlayer.SetSubtitlePath(Handle, path).
ThrowIfFailed("Failed to set the subtitle path to the player");
-
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
public void ClearSubtitle()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Idle);
NativePlayer.SetSubtitlePath(Handle, null).
ThrowIfFailed("Failed to clear the subtitle of the player");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
}
err.ThrowIfFailed("Failed to the subtitle offset of the player");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
private void Prepare()
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
public virtual Task PrepareAsync()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (_source == null)
{
throw new InvalidOperationException("No source is set.");
completionSource.TrySetException(e);
}
});
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
return completionSource.Task;
}
/// Unprepares the player.
/// </summary>
/// <remarks>
- /// The most recently used source is reset and no longer associated with the player. Playback is no longer possible.
+ /// The most recently used source is reset and is no longer associated with the player. Playback is no longer possible.
/// If you want to use the player again, you have to set a source and call <see cref="PrepareAsync"/> again.
/// <para>
- /// The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.
+ /// The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
/// It has no effect if the player is already in the <see cref="PlayerState.Idle"/> state.
/// </para>
/// </remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
public virtual void Unprepare()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (State == PlayerState.Idle)
{
Log.Warn(PlayerLog.Tag, "idle state already");
/// <seealso cref="ApplyAudioStreamPolicy"/>
public virtual void Start()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (State == PlayerState.Playing)
{
Log.Warn(PlayerLog.Tag, "playing state already");
ValidatePlayerState(PlayerState.Ready, PlayerState.Paused);
NativePlayer.Start(Handle).ThrowIfFailed("Failed to start the player");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
- /// Stops playing media content.
+ /// Stops playing the media content.
/// </summary>
/// <remarks>
/// The player must be in the <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.
/// <seealso cref="Pause"/>
public virtual void Stop()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (State == PlayerState.Ready)
{
Log.Warn(PlayerLog.Tag, "ready state already");
ValidatePlayerState(PlayerState.Paused, PlayerState.Playing);
NativePlayer.Stop(Handle).ThrowIfFailed("Failed to stop the player");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
/// <seealso cref="Start"/>
public virtual void Pause()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (State == PlayerState.Paused)
{
Log.Warn(PlayerLog.Tag, "pause state already");
ValidatePlayerState(PlayerState.Playing);
NativePlayer.Pause(Handle).ThrowIfFailed("Failed to pause the player");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
private MediaSource _source;
/// <seealso cref="PrepareAsync"/>
public void SetSource(MediaSource source)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Idle);
if (source != null)
}
_source = source;
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
- /// Captures a video frame asynchronously.
+ /// Captures a video frame, asynchronously.
/// </summary>
/// <returns>A task that represents the asynchronous capture operation.</returns>
/// <feature>http://tizen.org/feature/multimedia.raw_video</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public async Task<CapturedFrame> CaptureVideoAsync()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
-
ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
/// <summary>
/// Gets the play position in milliseconds.
/// </summary>
- /// <remarks>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
+ /// <remarks>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/>,
+ /// or <see cref="PlayerState.Paused"/> state.</remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <seealso cref="SetPlayPositionAsync(int, bool)"/>
public int GetPlayPosition()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing);
int playPosition = 0;
private void SetPlayPosition(int milliseconds, bool accurate,
NativePlayer.SeekCompletedCallback cb)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
var ret = NativePlayer.SetPlayPosition(Handle, milliseconds, accurate, cb, IntPtr.Zero);
//Note that we assume invalid param error is returned only when the position value is invalid.
/// <param name="position">The value indicating a desired position in milliseconds.</param>
/// <param name="accurate">The value indicating whether the operation performs with accuracy.</param>
/// <remarks>
- /// <para>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</para>
+ /// <para>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/>,
+ /// or <see cref="PlayerState.Paused"/> state.</para>
/// <para>If the <paramref name="accurate"/> is true, the play position will be adjusted as the specified <paramref name="position"/> value,
/// but this might be considerably slow. If false, the play position will be a nearest keyframe position.</para>
/// </remarks>
/// <seealso cref="GetPlayPosition"/>
public async Task SetPlayPositionAsync(int position, bool accurate)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
var taskCompletionSource = new TaskCompletionSource<bool>();
await taskCompletionSource.Task;
}
-
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
- /// Sets playback rate.
+ /// Sets the playback rate.
/// </summary>
/// <param name="rate">The value for the playback rate. Valid range is -5.0 to 5.0, inclusive.</param>
/// <remarks>
- /// <para>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</para>
+ /// <para>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/>,
+ /// or <see cref="PlayerState.Paused"/> state.</para>
/// <para>The sound will be muted, when the playback rate is under 0.0 or over 2.0.</para>
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// </exception>
public void SetPlaybackRate(float rate)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (rate < -5.0F || 5.0F < rate || rate == 0.0F)
{
throw new ArgumentOutOfRangeException(nameof(rate), rate, "Valid range is -5.0 to 5.0 (except 0.0)");
ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
NativePlayer.SetPlaybackRate(Handle, rate).ThrowIfFailed("Failed to set the playback rate.");
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
/// <summary>
/// <exception cref="InvalidOperationException">
/// Operation failed; internal error.
/// </exception>
- /// <exception cref="ObjectDisposedException">The player already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentException">The specified value to set is invalid.</exception>
public PlayerDisplayMode Mode
{
/// <exception cref="InvalidOperationException">
/// Operation failed; internal error.
/// </exception>
- /// <exception cref="ObjectDisposedException">The player already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
public bool IsVisible
{
get
/// <exception cref="InvalidOperationException">
/// Operation failed; internal error.
/// </exception>
- /// <exception cref="ObjectDisposedException">The player already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentException">The specified value to set is invalid.</exception>
public Rotation Rotation
{
/// -or-\n
/// <see cref="Mode"/> is not set to <see cref="PlayerDisplayMode.Roi"/>.
/// </exception>
- /// <exception cref="ObjectDisposedException">The player already has been disposed of.</exception>
- /// <exception cref="ArgumentOutOfRangeException">width or height is less than or equal to zero.</exception>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">The width or the height is less than or equal to zero.</exception>
public void SetRoi(Rectangle roi)
{
if (roi.Width <= 0)
Paused,
/// <summary>
- /// Preparing in progress.
+ /// Preparation in progress.
/// </summary>
/// <seealso cref="Player.PrepareAsync"/>/>
Preparing,
}
/// <summary>
- /// Specifies audio latency modes for <see cref="Player"/> .
+ /// Specifies audio latency modes for <see cref="Player"/>.
/// </summary>
/// <seealso cref="Player.AudioLatencyMode"/>
public enum AudioLatencyMode
}
/// <summary>
- /// Specifies display modes for <see cref="Player"/>
+ /// Specifies display modes for <see cref="Player"/>.
/// </summary>
/// <seealso cref="PlayerDisplaySettings.Mode"/>
public enum PlayerDisplayMode
CroppedFull,
/// <summary>
- /// Origin size (if surface size is larger than video size(width/height)) or
- /// Letter box (if video size(width/height) is larger than surface size).
+ /// Original size (if surface size is larger than video size(width/height)) or
+ /// letter box (if video size(width/height) is larger than surface size).
/// </summary>
OriginalOrFull,
/// <summary>
- /// Region of interest, See <see cref="PlayerDisplaySettings.SetRoi(Rectangle)"/>.
+ /// Region of interest.
/// </summary>
+ /// <seealso cref="PlayerDisplaySettings.SetRoi(Rectangle)"/>
Roi
}
internal enum StreamType
{
/// <summary>
- /// Audio element stream type
+ /// Audio element stream type.
/// </summary>
Audio = 1,
/// <summary>
- /// Video element stream type
+ /// Video element stream type.
/// </summary>
Video,
/// <summary>
- /// Text type
+ /// Text type.
/// </summary>
Text
}
public enum PlaybackInterruptionReason
{
/// <summary>
- /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared, automatically.
+ /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared automatically.
/// </summary>
ResourceConflict = 4
}
/// <summary>
/// Initializes a new instance of the PlayerErrorOccurredEventArgs class.
/// </summary>
- /// <param name="error">The value indicating what kind of error occurred.</param>
+ /// <param name="error">The value indicating the kind of error occurred.</param>
public PlayerErrorOccurredEventArgs(PlayerError error)
{
Error = error;
namespace Tizen.Multimedia
{
/// <summary>
- /// Provides a means to retrieve track information.
+ /// Provides a means to retrieve the track information.
/// </summary>
/// <seealso cref="Player.SubtitleTrackInfo"/>
/// <seealso cref="Player.AudioTrackInfo"/>
/// Gets the number of tracks.
/// </summary>
/// <returns>The number of tracks.</returns>
- /// <remarks>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed.</exception>
+ /// <remarks>
+ /// The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed of.</exception>
/// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception>
public int GetCount()
{
}
/// <summary>
- /// Gets the language code for the specified index or null if the language is undefined.
+ /// Gets the language code for the specified index, or null if the language is undefined.
/// </summary>
/// <returns>The number of tracks.</returns>
/// <remarks>
- /// <para>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</para>
+ /// <para>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.</para>
/// <para>The language codes are defined in ISO 639-1.</para>
/// </remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed of.</exception>
/// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="index"/> is less than zero.\n
/// Gets or sets the selected track index.
/// </summary>
/// <value>The currently selected track index.</value>
- /// <remarks>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed.</exception>
+ /// <remarks>
+ /// The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed of.</exception>
/// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="value"/> is less than zero.\n
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents properties for audio stream.
+ /// Represents properties for the audio stream.
/// </summary>
public struct AudioStreamProperties
{
/// <summary>
- /// Initialize a new instance of the AudioStreamProperties struct with the specified sample rate, channels and bit rate.
+ /// Initializes a new instance of the AudioStreamProperties struct with the specified sample rate, channels, and bit rate.
/// </summary>
/// <param name="sampleRate">The sample rate of the stream.</param>
/// <param name="channels">The number of channels of the stream.</param>
}
/// <summary>
- /// Represents properties for video stream.
+ /// Represents properties for the video stream.
/// </summary>
public struct VideoStreamProperties
{
/// <summary>
- /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate and size.
+ /// Initializes a new instance of the VideoStreamProperties struct with the specified fps, bit rate, and size.
/// </summary>
/// <param name="fps">The fps of the stream.</param>
/// <param name="bitRate">The bit rate of the stream.</param>
", width : " + size.Width + ", height : " + size.Height);
}
/// <summary>
- /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate, width and height.
+ /// Initializes a new instance of the VideoStreamProperties struct with the specified fps, bit rate, width, and height.
/// </summary>
/// <param name="fps">The fps of the stream.</param>
/// <param name="bitRate">The bit rate of the stream.</param>
}
/// <summary>
- /// Retrieves the album art of the stream or null if there is no album art data.
+ /// Retrieves the album art of the stream, or null if there is no album art data.
/// </summary>
/// <returns>Raw byte array if album art exists; otherwise null.</returns>
- /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
+ /// <remarks>
+ /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+ /// </exception>
public byte[] GetAlbumArt()
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
}
/// <summary>
- /// Retrieves the codec name of audio or null if there is no audio.
+ /// Retrieves the codec name of the audio or null if there is no audio.
/// </summary>
- /// <returns>A string that represents codec name.</returns>
+ /// <returns>A string that represents the codec name.</returns>
public string GetAudioCodec()
{
return GetCodecInfo(true);
}
/// <summary>
- /// Retrieves the codec name of video or null if there is no video.
+ /// Retrieves the codec name of the video or null if there is no video.
/// </summary>
- /// <returns>A string that represents codec name.</returns>
+ /// <returns>A string that represents the codec name.</returns>
public string GetVideoCodec()
{
return GetCodecInfo(false);
/// Gets the duration.
/// </summary>
/// <returns>The duration of the stream.</returns>
- /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
+ /// <remarks>
+ /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+ /// </exception>
public int GetDuration()
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
}
/// <summary>
- /// Gets the properties of audio.
+ /// Gets the properties of the audio.
/// </summary>
- /// <returns>A <see cref="AudioStreamProperties"/> that contains audio stream information.</returns>
- /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
+ /// <returns>A <see cref="AudioStreamProperties"/> that contains the audio stream information.</returns>
+ /// <remarks>
+ /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+ /// </exception>
public AudioStreamProperties GetAudioProperties()
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
NativePlayer.GetAudioStreamInfo(Player.Handle, out sampleRate, out channels, out bitRate).
ThrowIfFailed("Failed to get audio stream info");
- // TODO should we check value is zero and return null?
-
return new AudioStreamProperties(sampleRate, channels, bitRate);
}
/// <summary>
- /// Gets the properties of video.
+ /// Gets the properties of the video.
/// </summary>
- /// <returns>A <see cref="VideoStreamProperties"/> that contains video stream information.</returns>
- /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
+ /// <returns>A <see cref="VideoStreamProperties"/> that contains the video stream information.</returns>
+ /// <remarks>
+ /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+ /// </exception>
public VideoStreamProperties GetVideoProperties()
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
NativePlayer.GetVideoStreamInfo(Player.Handle, out fps, out bitRate).
ThrowIfFailed("Failed to get the video stream info");
- // TODO should we check value is zero and return null?
-
return new VideoStreamProperties(fps, bitRate, GetVideoSize());
}
/// </summary>
/// <returns>A string that represents the value of the specified key.</returns>
/// <param name="key">The key to query.</param>
- /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
+ /// <remarks>
+ /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
+ /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.</remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+ /// </exception>
public string GetMetadata(StreamMetadataKey key)
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
}
/// <summary>
- /// Gets the <see cref="Size"/> of new video.
+ /// Gets the <see cref="Size"/> of the new video.
/// </summary>
public Size Size { get; }
/// <summary>
- /// Gets the fps of new video
+ /// Gets the fps of the new video
/// </summary>
public int Fps { get; }
/// <summary>
- /// Gets the bit rate of new video.
+ /// Gets the bit rate of the new video.
/// </summary>
public int BitRate { get; }
/// Provides a means to edit the metadata of the media file.
/// </summary>
/// <privilege>
- /// If you want to access only internal storage,
+ /// If you want to access only an internal storage,
/// you should add privilege http://tizen.org/privilege/mediastorage. \n
- /// Or if you want to access only external storage,
+ /// Or if you want to access only an external storage,
/// you should add privilege http://tizen.org/privilege/externalstorage. \n
/// </privilege>
public class MetadataEditor : IDisposable
/// Initializes a new instance of the <see cref="MetadataEditor"/> class with the specified path.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="path">The path of the media file to edit metadata.</param>
+ /// <param name="path">The path of the media file to edit the metadata.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length string, contains only white space.</exception>
/// <exception cref="FileFormatException">The file is not supported.</exception>
- /// <exception cref="FileNotFoundException">File does not exist.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege to access the file.</exception>
+ /// <exception cref="FileNotFoundException">The file does not exist.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege to access the file.</exception>
public MetadataEditor(string path)
{
if (path == null)
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Artist
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Title
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Album
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Genre
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Author
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Copyright
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <remarks>
- /// If the media contains ID3 tag, this refers to the recorded date.
- /// If the media is a mp4 format, this refers to the year and the value to set will be converted into integer.
+ /// If the media contains the ID3 tag, this refers to the recorded date.
+ /// If the media is a mp4 format, this refers to the year, and the value to set will be converted into integer.
/// </remarks>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Date
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Description
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Comment
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string TrackNumber
{
get
/// Gets the count of album arts of media.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public int PictureCount
{
get => int.TryParse(GetParam(MetadataEditorAttr.PictureCount), out var value) ? value : 0;
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string Conductor
{
get
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <exception cref="InvalidOperationException">The file is read-only.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public string UnsyncLyrics
{
get
/// -or-\n
/// The file is read-only.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public void Commit()
{
if (_isFileReadOnly)
/// Gets the artwork image in the media file.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="index">The index of picture to import.</param>
- /// <returns> Artwork included in the media file.</returns>
- /// <returns>Artwork included in the media file.</returns>
+ /// <param name="index">The index of the picture to import.</param>
+ /// <returns>The artwork included in the media file.</returns>
/// <exception cref="InvalidOperationException">An internal error occurs.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="index"/> is less than zero.\n
/// -or-\n
/// <paramref name="index"/> is greater than or equal to <see cref="PictureCount"/>.\n
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public Artwork GetPicture(int index)
{
if (index < 0)
/// Appends the picture to the media file.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="path">The path of picture for adding to the metadata.</param>
+ /// <param name="path">The path of the picture for adding to the metadata.</param>
/// <exception cref="InvalidOperationException">
/// An internal error occurs.\n
/// -or-\n
/// The media file is read-only.
/// </exception>
- /// <exception cref="ArgumentNullException"> Picture path is null</exception>
- /// <exception cref="FileNotFoundException">File does not exist.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege to access the file.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="path"/> is null</exception>
+ /// <exception cref="FileNotFoundException">The file does not exist.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege to access the file.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
/// <exception cref="FileFormatException">The specified file is not supported.</exception>
public void AddPicture(string path)
{
/// Removes the picture from the media file.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="index">The index of picture to remove.</param>
+ /// <param name="index">The index of the picture to remove.</param>
/// <exception cref="InvalidOperationException">
/// An internal error occurs.\n
/// -or-\n
/// -or-\n
/// <paramref name="index"/> is greater than or equal to <see cref="PictureCount"/>.\n
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
public void RemovePicture(int index)
{
if (index < 0)
namespace Tizen.Multimedia
{
/// <summary>
- /// Enumeration for metadata extractor's error codes.
+ /// Enumeration for the metadata extractor's error codes.
/// </summary>
internal enum MetadataEditorError
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents artwork information of media.
+ /// Represents the artwork information of the media.
/// </summary>
public class Artwork
{
/// <summary>
- /// Initializes a new instance of the Artwork class with the specified data and mime type.
+ /// Initializes a new instance of the Artwork class with the specified data and the mime type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="data">The data of the artwork to set metadata.</param>
+ /// <param name="data">The data of the artwork to set the metadata.</param>
/// <param name="mimeType">The mime type of the data of the artwork.</param>
public Artwork(byte[] data, string mimeType)
{
public byte[] Data { get; }
/// <summary>
- /// Gets the mime type of artwork.
+ /// Gets the mime type of the artwork.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string MimeType { get; }
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents video metadata information.
+ /// Represents the video metadata information.
/// </summary>
public class VideoMetadata
{
public int? BitRate { get; }
/// <summary>
- /// Gets the video FPS.
+ /// Gets the video fps.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>The fps value, or null if the information does not exist.</value>
public int? Height { get; }
/// <summary>
- /// Get the codec type of the video.
+ /// Gets the codec type of the video.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>A string representing the codec type, or null if the information does not exist.</value>
}
/// <summary>
- /// Represents audio metadata information.
+ /// Represents the audio metadata information.
/// </summary>
public class AudioMetadata
{
}
/// <summary>
- /// Represents metadata information of a media.
+ /// Represents the metadata information of a media.
/// </summary>
public class Metadata
{
*/
using System;
+using System.IO;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
}
/// <summary>
- /// Provides a set of functions to get the metadata from a media file.
+ /// Provides a means to get the metadata from a media file.
/// </summary>
public class MetadataExtractor : IDisposable
{
/// Initializes a new instance of the MetadataExtractor class with the specified path.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="path">The path for the file to extract metadata.</param>
+ /// <param name="path">The path for the file to extract the metadata.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
- /// <exception cref="FileNotFoundException"><paramref name="path"/> is not exist.</exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exist.</exception>
public MetadataExtractor(string path)
{
if (path == null)
/// Initializes a new instance of the MetadataExtractor class with the specified buffer.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="buffer">The buffer to extract metadata.</param>
+ /// <param name="buffer">The buffer to extract the metadata.</param>
/// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception>
/// <exception cref="ArgumentException">The length of <paramref name="buffer"/> is zero.</exception>
public MetadataExtractor(byte[] buffer)
/// Retrieves the <see cref="Metadata"/>.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <returns>A <see cref="Metadata"/> for the given source.</returns>
- /// <exception cref="InvalidOperationException">Internal process error is occurred.</exception>
+ /// <returns>The <see cref="Metadata"/> for the given source.</returns>
+ /// <exception cref="InvalidOperationException">An internal process error occurs.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="MetadataExtractor"/> has been already disposed of.</exception>
public Metadata GetMetadata()
{
/// Gets the artwork image in the source.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <returns>A <see cref="Artwork"/> if it exists, otherwise null.</returns>
- /// <exception cref="InvalidOperationException">Internal process error is occurred.</exception>
+ /// <returns>The <see cref="Artwork"/> if it exists, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">An internal process error occurs.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="MetadataExtractor"/> has been already disposed of.</exception>
public Artwork GetArtwork()
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="index">The index of lyrics to retrieve.</param>
- /// <returns>A <see cref="SyncLyrics"/> object if <paramref name="index"/> is valid, otherwise null.</returns>
- /// <exception cref="InvalidOperationException">Internal process error is occurred.</exception>
+ /// <returns>The <see cref="SyncLyrics"/> object if <paramref name="index"/> is valid, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">An internal process error occurs.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="MetadataExtractor"/> has been already disposed of.</exception>
public SyncLyrics GetSyncLyrics(int index)
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>The raw thumbnail data in RGB888 if it exists, otherwise null.</returns>
- /// <exception cref="InvalidOperationException">Internal process error is occurred.</exception>
+ /// <exception cref="InvalidOperationException">An internal process error occurs.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="MetadataExtractor"/> has been already disposed of.</exception>
public byte[] GetVideoThumbnail()
{
}
}
- /// <summary>
- /// Metadata Extractor destructor
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
~MetadataExtractor()
{
Dispose(false);
namespace Tizen.Multimedia
{
/// <summary>
- /// Enumeration for metadata extractor's error codes.
+ /// Enumeration for the metadata extractor's error codes.
/// </summary>
internal enum MetadataExtractorError
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents synchronized lyrics information of media.
+ /// Represents the synchronized lyrics information of the media.
/// </summary>
public class SyncLyrics
{
/// <summary>
- /// Initialize a new instance of the MetadataExtractor class with the specified lyrics and timestamp.
+ /// Initializes a new instance of the MetadataExtractor class with the specified lyrics and the timestamp.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="lyrics">The text of synchronized lyrics.</param>
private const string FeatureFmRadio = "http://tizen.org/feature/fmradio";
/// <summary>
- /// Initialize a new instance of the Radio class.
+ /// Initializes a new instance of the Radio class.
/// </summary>
- /// <exception cref="NotSupportedException">Radio feature is not supported</exception>
+ /// <exception cref="NotSupportedException">The radio feature is not supported.</exception>
public Radio()
{
ValidateFeatureSupported(FeatureFmRadio);
}
/// <summary>
- /// Occurs when radio scan information is updated.
+ /// Occurs when the radio scanning information is updated.
/// </summary>
public event EventHandler<ScanUpdatedEventArgs> ScanUpdated;
/// <summary>
- /// Occurs when radio scanning stops.
+ /// Occurs when the radio scanning stops.
/// </summary>
public event EventHandler ScanStopped;
/// <summary>
- /// Occurs when radio scan is completed.
+ /// Occurs when the radio scanning is completed.
/// </summary>
public event EventHandler ScanCompleted;
/// <summary>
- /// Occurs when radio is interrupted
+ /// Occurs when the radio is interrupted.
/// </summary>
public event EventHandler<RadioInterruptedEventArgs> Interrupted;
}
/// <summary>
- /// Gets or sets the radio frequency, in [87500 ~ 108000] (kHz).
+ /// Gets or sets the radio frequency in the range of 87500 ~ 108000 kHz.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="value"/> is less than <see cref="Range.Min"/> of <see cref="FrequencyRange"/>.\n
}
/// <summary>
- /// Gets the current signal strength, in [-128 ~ 128] (dBm).
+ /// Gets the current signal strength in the range of -128 ~ 128 dBm.
/// </summary>
public int SignalStrength
{
}
/// <summary>
- /// Gets the value indicating if radio is muted.
+ /// Gets the value indicating if the radio is muted.
/// </summary>
/// <value>
/// true if the radio is muted; otherwise, false.
}
/// <summary>
- /// Gets the channel spacing for current region.
+ /// Gets the channel spacing for the current region.
/// </summary>
public int ChannelSpacing
{
}
/// <summary>
- /// Gets the frequency for the region, in [87500 ~ 108000] (kHz).
+ /// Gets the frequency for the region in the range of 87500 ~ 108000 kHz.
/// </summary>
public Range FrequencyRange
{
}
/// <summary>
- /// Starts radio scan, will trigger ScanInformationUpdated event, when scan information is updated
+ /// Starts the radio scanning and triggers the ScanInformationUpdated event when the scan information is updated.
/// </summary>
/// <remarks>The radio must be in the <see cref="RadioState.Ready"/> or <see cref="RadioState.Playing"/> state.</remarks>
/// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception>
}
/// <summary>
- /// Stops radio scan.
+ /// Stops the radio scanning.
/// </summary>
/// <remarks>The radio must be in the <see cref="RadioState.Scanning"/> state.</remarks>
/// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception>
/// </summary>
/// <returns>
/// A task that represents the asynchronous seeking operation.
- /// The result value is the current frequency, in range [87500 ~ 108000] (kHz).
+ /// The result value is the current frequency in the range of 87500 ~ 108000 kHz.
/// It can be -1 if the seeking operation has failed.
/// </returns>
/// <remarks>The radio must be in the <see cref="RadioState.Playing"/> state.</remarks>
/// </summary>
/// <returns>
/// A task that represents the asynchronous seeking operation.
- /// The result value is the current frequency, in range [87500 ~ 108000] (kHz).
+ /// The result value is the current frequency in the range of 87500 ~ 108000 kHz.
/// It can be -1 if the seeking operation has failed.
/// </returns>
/// <remarks>The radio must be in the <see cref="RadioState.Playing"/> state.</remarks>
private void ValidateFeatureSupported(string featurePath)
{
bool supported = false;
- SystemInfo.TryGetValue(featurePath, out supported);
+ Information.TryGetValue(featurePath, out supported);
if (supported == false)
{
}
/// <summary>
- /// Gets the policy that interrupted the recorder.
+ /// Gets the reason that interrupted the recorder.
/// </summary>
public RecorderPolicy Reason { get; }
/// </summary>
/// <privilege>http://tizen.org/privilege/mediacontroller.client</privilege>
/// <exception cref="InvalidOperationException">An internal error occurs.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege.</exception>
public MediaControllerManager()
{
Native.Create(out _handle).ThrowIfError("Failed to create media controller client.");
namespace Tizen.Multimedia.Remoting
{
+ /// <summary>
+ /// Specifies the repeat mode.
+ /// </summary>
public enum MediaControlRepeatMode
{
+ /// <summary>
+ /// Off.
+ /// </summary>
Off,
+
+ /// <summary>
+ /// On.
+ /// </summary>
On,
}
}
\ No newline at end of file
}
/// <summary>
- /// Gets the current state of screen mirroring.
+ /// Gets the current state of the screen mirroring.
/// </summary>
public ScreenMirroringState State { get; }
}
namespace Tizen.Multimedia.Remoting
{
/// <summary>
- /// Specifies audio codecs for <see cref="ScreenMirroring"/>.
+ /// Specifies the audio codecs for <see cref="ScreenMirroring"/>.
/// </summary>
/// <seealso cref="ScreenMirroringAudioInfo"/>
public enum ScreenMirroringAudioCodec
{
/// <summary>
- /// Screen mirroring is not negotiated yet.
+ /// The screen mirroring is not negotiated yet.
/// </summary>
None,
/// <summary>
- /// AAC codec for audio.
+ /// AAC codec.
/// </summary>
Aac,
/// <summary>
- /// AC3 codec for audio.
+ /// AC3 codec.
/// </summary>
Ac3,
/// <summary>
- /// LPCM codec for audio.
+ /// LPCM codec.
/// </summary>
Lpcm
}
/// <summary>
- /// Specifies video codecs for <see cref="ScreenMirroring"/>.
+ /// Specifies the video codecs for <see cref="ScreenMirroring"/>.
/// </summary>
/// <seealso cref="ScreenMirroringVideoInfo"/>
public enum ScreenMirroringVideoCodec
{
/// <summary>
- /// Screen mirroring is not negotiated yet.
+ /// The screen mirroring is not negotiated yet.
/// </summary>
None,
/// <summary>
- /// H.264 codec for video.
+ /// H.264 codec.
/// </summary>
H264
}
/// <summary>
- /// Specifies available combinations of resolutions and fps for <see cref="ScreenMirroring"/>.
+ /// Specifies the available combinations of resolutions and fps for <see cref="ScreenMirroring"/>.
/// </summary>
[Flags]
public enum ScreenMirroringResolutions
}
/// <summary>
- /// Specifies errors for <see cref="ScreenMirroring"/>.
+ /// Specifies the errors for <see cref="ScreenMirroring"/>.
/// </summary>
public enum ScreenMirroringError
{
namespace Tizen.Multimedia.Util
{
/// <summary>
- /// Represents image data returned by a decoder class.
+ /// Represents the image data returned by a decoder class.
/// </summary>
public class BitmapFrame
{
namespace Tizen.Multimedia.Util
{
/// <summary>
- /// Represent gif image data used to encode a gif image with <see cref="GifEncoder"/>.
+ /// Represents the gif image data used to encode a gif image with <see cref="GifEncoder"/>.
/// </summary>
public class GifFrame
{
/// <summary>
- /// Initialize a new instance of the <see cref="GifFrame"/> class with a buffer and a delay.
+ /// Initializes a new instance of the <see cref="GifFrame"/> class with a buffer and a delay.
/// </summary>
/// <param name="buffer">The raw image buffer to be encoded.</param>
/// <param name="delay">The delay for this image, in 0.001 sec units.</param>
internal enum ImageColorSpace
{
/// <summary>
- /// YV12 - YCrCb planar format
+ /// YV12 - YCrCb planar format.
/// </summary>
YV12,
/// <summary>
- /// YUV422 - planar
+ /// YUV422 - planar.
/// </summary>
Yuv422,
/// <summary>
- /// YUV420 - planar
+ /// YUV420 - planar.
/// </summary>
I420,
/// <summary>
- /// NV12- planar
+ /// NV12- planar.
/// </summary>
NV12,
/// <summary>
- /// UYVY - packed
+ /// UYVY - packed.
/// </summary>
Uyvy,
/// <summary>
- /// YUYV - packed
+ /// YUYV - packed.
/// </summary>
Yuyv,
/// <summary>
- /// RGB565, high-byte is Blue
+ /// RGB565, high-byte is blue.
/// </summary>
Rgb565,
/// <summary>
- /// RGB888, high-byte is Blue
+ /// RGB888, high-byte is blue.
/// </summary>
Rgb888,
/// <summary>
- /// ARGB8888, high-byte is Blue
+ /// ARGB8888, high-byte is blue.
/// </summary>
Argb8888,
/// <summary>
- /// BGRA8888, high-byte is Alpha
+ /// BGRA8888, high-byte is alpha.
/// </summary>
Bgra8888,
/// <summary>
- /// RGBA8888, high-byte is Alpha
+ /// RGBA8888, high-byte is alpha.
/// </summary>
Rgba8888,
/// <summary>
- /// BGRX8888, high-byte is X
+ /// BGRX8888, high-byte is X.
/// </summary>
Bgrx8888,
/// <summary>
- /// NV21- planar
+ /// NV21- planar.
/// </summary>
NV21,
/// <summary>
- /// NV16- planar
+ /// NV16- planar.
/// </summary>
NV16,
/// <summary>
- /// NV61- planar
+ /// NV61- planar.
/// </summary>
NV61,
}
/// <summary>
/// Decodes an image from the specified file.
/// </summary>
- /// <param name="inputFilePath">Input file path from which to decode.</param>
+ /// <param name="inputFilePath">The input file path from which to decode.</param>
/// <returns>A task that represents the asynchronous decoding operation.</returns>
/// <remarks>
/// Only Graphics Interchange Format(GIF) codec returns more than one frame.\n
/// \n
- /// http://tizen.org/privilege/mediastorage is needed if <paramref name="inputFilePath"/> is relevant to media storage.\n
- /// http://tizen.org/privilege/externalstorage is needed if <paramref name="inputFilePath"/> is relevant to external storage.
+ /// http://tizen.org/privilege/mediastorage is needed if <paramref name="inputFilePath"/> is relevant to the media storage.\n
+ /// http://tizen.org/privilege/externalstorage is needed if <paramref name="inputFilePath"/> is relevant to the external storage.
/// </remarks>
/// <exception cref="ArgumentNullException"><paramref name="inputFilePath"/> is null.</exception>
/// <exception cref="ArgumentException">
/// The format of <paramref name="inputFilePath"/> is not <see cref="InputFormat"/>.
/// </exception>
/// <exception cref="FileNotFoundException"><paramref name="inputFilePath"/> does not exists.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required permission to access the path.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required permission to access the path.</exception>
/// <exception cref="FileFormatException">The format of <paramref name="inputFilePath"/> is not <see cref="InputFormat"/>.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="ImageDecoder"/> has already been disposed of.</exception>
public async Task<IEnumerable<BitmapFrame>> DecodeAsync(string inputFilePath)
private static readonly byte[] _header = { (byte)'B', (byte)'M' };
/// <summary>
- /// Initialize a new instance of the <see cref="BmpDecoder"/> class.
+ /// Initializes a new instance of the <see cref="BmpDecoder"/> class.
/// </summary>
/// <remarks><see cref="ImageDecoder.InputFormat"/> will be the <see cref="ImageFormat.Bmp"/>.</remarks>
public BmpDecoder() : base(ImageFormat.Bmp)
}
/// <summary>
- /// Provides the ability to decode Portable Network Graphics (PNG) encoded images.
+ /// Provides the ability to decode the Portable Network Graphics (PNG) encoded images.
/// </summary>
public class PngDecoder : ImageDecoder
{
private static readonly byte[] _header = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
/// <summary>
- /// Initialize a new instance of the <see cref="PngDecoder"/> class.
+ /// Initializes a new instance of the <see cref="PngDecoder"/> class.
/// </summary>
/// <remarks><see cref="ImageDecoder.InputFormat"/> will be the <see cref="ImageFormat.Png"/>.</remarks>
public PngDecoder() : base(ImageFormat.Png)
}
/// <summary>
- /// Provides the ability to decode Joint Photographic Experts Group (JPEG) encoded images.
+ /// Provides the ability to decode the Joint Photographic Experts Group (JPEG) encoded images.
/// </summary>
public class JpegDecoder : ImageDecoder
{
private JpegDownscale _jpegDownscale = DefaultJpegDownscale;
/// <summary>
- /// Initialize a new instance of the <see cref="JpegDecoder"/> class.
+ /// Initializes a new instance of the <see cref="JpegDecoder"/> class.
/// </summary>
/// <remarks><see cref="ImageDecoder.InputFormat"/> will be the <see cref="ImageFormat.Jpeg"/>.</remarks>
public JpegDecoder() : base(ImageFormat.Jpeg)
}
/// <summary>
- /// Provides the ability to decode Graphics Interchange Format (GIF) encoded images.
+ /// Provides the ability to decode the Graphics Interchange Format (GIF) encoded images.
/// </summary>
public class GifDecoder : ImageDecoder
{
private static readonly byte[] _header = { (byte)'G', (byte)'I', (byte)'F' };
/// <summary>
- /// Initialize a new instance of the <see cref="GifDecoder"/> class.
+ /// Initializes a new instance of the <see cref="GifDecoder"/> class.
/// </summary>
/// <remarks><see cref="ImageDecoder.InputFormat"/> will be the <see cref="ImageFormat.Gif"/>.</remarks>
public GifDecoder() : base(ImageFormat.Gif)
}
/// <summary>
- /// Provides the ability to encode Bitmap (BMP) format images.
+ /// Provides the ability to encode the Bitmap (BMP) format images.
/// </summary>
public class BmpEncoder : ImageEncoder
{
/// <summary>
- /// Initialize a new instance of the <see cref="BmpEncoder"/> class.
+ /// Initializes a new instance of the <see cref="BmpEncoder"/> class.
/// </summary>
/// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Bmp"/>.</remarks>
public BmpEncoder() : base(ImageFormat.Bmp)
}
/// <summary>
- /// Provides the ability to encode Portable Network Graphics (PNG) format images.
+ /// Provides the ability to encode the Portable Network Graphics (PNG) format images.
/// </summary>
public class PngEncoder : ImageEncoder
{
private PngCompression? _compression;
/// <summary>
- /// Initialize a new instance of the <see cref="PngEncoder"/> class.
+ /// Initializes a new instance of the <see cref="PngEncoder"/> class.
/// </summary>
/// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Png"/>.</remarks>
public PngEncoder() :
}
/// <summary>
- /// Initialize a new instance of the <see cref="PngEncoder"/> class with <see cref="PngCompression"/>.
+ /// Initializes a new instance of the <see cref="PngEncoder"/> class with <see cref="PngCompression"/>.
/// </summary>
/// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Png"/>.</remarks>
/// <param name="compression">The compression level of the encoder.</param>
}
/// <summary>
- /// Provides the ability to encode Joint Photographic Experts Group (JPEG) format images.
+ /// Provides the ability to encode the Joint Photographic Experts Group (JPEG) format images.
/// </summary>
public class JpegEncoder : ImageEncoder
{
private int? _quality;
/// <summary>
- /// Initialize a new instance of the <see cref="JpegEncoder"/> class.
+ /// Initializes a new instance of the <see cref="JpegEncoder"/> class.
/// </summary>
/// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Jpeg"/>.</remarks>
public JpegEncoder() : base(ImageFormat.Jpeg)
/// <summary>
- /// Initialize a new instance of the <see cref="JpegEncoder"/> class with initial quality value.
+ /// Initializes a new instance of the <see cref="JpegEncoder"/> class with initial quality value.
/// </summary>
/// <param name="quality">The quality for JPEG image encoding; from 1(lowest quality) to 100(highest quality).</param>
/// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Jpeg"/>.</remarks>
}
/// <summary>
- /// Provides the ability to encode Graphics Interchange Format (GIF) format images.
+ /// Provides the ability to encode the Graphics Interchange Format (GIF) format images.
/// </summary>
public class GifEncoder : ImageEncoder
{
/// <summary>
- /// Initialize a new instance of the <see cref="GifEncoder"/> class.
- /// </summary>
- /// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Gif"/>.</remarks>
+ /// Initializes a new instance of the <see cref="GifEncoder"/> class.
+ /// </summary>
+ /// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Gif"/>.</remarks>
public GifEncoder() : base(ImageFormat.Gif)
{
}
/// <summary>
/// Returns an enumerator that can iterate through the collection.
/// </summary>
- /// <returns>A enumerator that can be used to iterate through the collection.</returns>
+ /// <returns>An enumerator that can be used to iterate through the collection.</returns>
public IEnumerator<ImageTransform> GetEnumerator() => _list.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => _list.GetEnumerator();
}
/// <summary>
- /// Rotates or flips an image.
+ /// Rotates an image.
/// </summary>
/// <seealso cref="Rotation"/>
public class RotateTransform : ImageTransform
private Rotation _rotation;
/// <summary>
- /// Initialize a new instance of the <see cref="RotateTransform"/> class.
+ /// Initializes a new instance of the <see cref="RotateTransform"/> class.
/// </summary>
/// <param name="rotation">The value how to rotate an image.</param>
/// <exception cref="ArgumentException"><paramref name="rotation"/> is invalid.</exception>
/// <summary>
- /// Rotates or flips an image.
+ /// Flips an image.
/// </summary>
/// <seealso cref="Rotation"/>
public class FlipTransform : ImageTransform
private Flips _flip;
/// <summary>
- /// Initialize a new instance of the <see cref="RotateTransform"/> class.
+ /// Initializes a new instance of the <see cref="RotateTransform"/> class.
/// </summary>
/// <param name="flip">The value how to flip an image.</param>
/// <exception cref="ArgumentException"><paramref name="flip"/> is invalid.</exception>
}
/// <summary>
- /// Changes colorspace of image.
+ /// Changes the colorspace of an image.
/// </summary>
/// <seealso cref="ColorSpace"/>
public class ColorSpaceTransform : ImageTransform
private ImageColorSpace _imageColorSpace;
/// <summary>
- /// Initialize a new instance of the <see cref="ColorSpaceTransform"/> class.
+ /// Initializes a new instance of the <see cref="ColorSpaceTransform"/> class.
/// </summary>
/// <param name="colorSpace">The colorspace of output image.</param>
/// <exception cref="ArgumentException"><paramref name="colorSpace"/> is invalid.</exception>
private Rectangle _region;
/// <summary>
- /// Initialize a new instance of the <see cref="CropTransform"/> class.
+ /// Initializes a new instance of the <see cref="CropTransform"/> class.
/// </summary>
/// <param name="region">The crop region.</param>
/// <exception cref="ArgumentOutOfRangeException">
private Size _size;
/// <summary>
- /// Initialize a new instance of the <see cref="ResizeTransform"/> class.
+ /// Initializes a new instance of the <see cref="ResizeTransform"/> class.
/// </summary>
/// <param name="size">The size that an image is resized to.</param>
/// <exception cref="ArgumentOutOfRangeException">
public class ImageTransformer : IDisposable
{
/// <summary>
- /// Initialize a new instance of the <see cref="ImageTransformer"/> class.
+ /// Initializes a new instance of the <see cref="ImageTransformer"/> class.
/// </summary>
public ImageTransformer()
{
namespace Tizen.Multimedia.Util
{
/// <summary>
- /// Specifies JPEG Downscale options for decoding.
+ /// Specifies the JPEG Downscale options for decoding.
/// </summary>
public enum JpegDownscale
{
namespace Tizen.Multimedia.Util
{
/// <summary>
- /// Specifies PNG compression levels.
+ /// Specifies the PNG compression levels.
/// </summary>
public enum PngCompression
{
/*
-* 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.
-*/
+ * 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.
+ */
namespace Tizen.Multimedia.Util
{
/// <summary>
- /// Represents the result of thumbnail extraction.
+ /// Represents the result of the thumbnail extraction.
/// </summary>
public class ThumbnailExtractionResult
{
/*
-* 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.
-*/
+ * 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.IO;
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>A task that represents the asynchronous extracting operation.</returns>
- /// <remarks>The size of the thumbnail will be the default size(320x240).\n</remarks>
+ /// <remarks>The size of the thumbnail will be the default size (320x240).</remarks>
/// <param name="path">The path of the media file to extract the thumbnail.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
- /// <exception cref="FileNotFoundException">Requested <paramref name="path"/> does not exist.</exception>
- /// <exception cref="InvalidOperationException">Internal error occurred.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exist.</exception>
+ /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
/// <exception cref="FileFormatException">The specified file is not supported.</exception>
public static Task<ThumbnailExtractionResult> ExtractAsync(string path)
{
/// <param name="path">The path of the media file to extract the thumbnail.</param>
/// <param name="cancellationToken">The token to stop the operation.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
- /// <exception cref="FileNotFoundException">Requested <paramref name="path"/> does not exist.</exception>
- /// <exception cref="InvalidOperationException">Internal error occurred.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exist.</exception>
+ /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
/// <exception cref="FileFormatException">The specified file is not supported.</exception>
public static Task<ThumbnailExtractionResult> ExtractAsync(string path, CancellationToken cancellationToken)
{
/// <since_tizen> 3 </since_tizen>
/// <returns>A task that represents the asynchronous extracting operation.</returns>
/// <remarks>
- /// If the width is not a multiple of 8, it can be changed by inner process.\n
+ /// If the width is not a multiple of 8, it can be changed by the inner process.\n
/// The width will be a multiple of 8 greater than the set value.
/// </remarks>
/// <param name="path">The path of the media file to extract the thumbnail.</param>
/// <param name="size">The size of the thumbnail.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
- /// <exception cref="FileNotFoundException">Requested <paramref name="path"/> does not exist.</exception>
- /// <exception cref="InvalidOperationException">Internal error occurred.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exist.</exception>
+ /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// Width or height of <paramref name="size"/> is less than or equal to zero.
+ /// The width or the height of <paramref name="size"/> is less than or equal to zero.
/// </exception>
/// <exception cref="FileFormatException">The specified file is not supported.</exception>
public static Task<ThumbnailExtractionResult> ExtractAsync(string path, Size size)
/// <since_tizen> 3 </since_tizen>
/// <returns>A task that represents the asynchronous extracting operation.</returns>
/// <remarks>
- /// If the width is not a multiple of 8, it can be changed by inner process.\n
+ /// If the width is not a multiple of 8, it can be changed by the inner process.\n
/// The width will be a multiple of 8 greater than the set value.
/// </remarks>
/// <param name="path">The path of the media file to extract the thumbnail.</param>
/// <param name="size">The size of the thumbnail.</param>
/// <param name="cancellationToken">The token to stop the operation.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
- /// <exception cref="FileNotFoundException">Requested <paramref name="path"/> does not exist.</exception>
- /// <exception cref="InvalidOperationException">Internal error occurred.</exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exist.</exception>
+ /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege for accessing the <paramref name="path"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// Width or height of <paramref name="size"/> is less than or equal to zero.
+ /// The width or the height of <paramref name="size"/> is less than or equal to zero.
/// </exception>
/// <exception cref="FileFormatException">The specified file is not supported.</exception>
public static Task<ThumbnailExtractionResult> ExtractAsync(string path, Size size,
/*
-* 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.
-*/
+ * 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.IO;
* limitations under the License.
*/
+using System;
+
namespace Tizen.Multimedia.Vision
{
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="BarcodeDetectionConfiguration"/> class.
/// </summary>
- /// <exception cref="System.NotSupportedException">The feature is not supported.</exception>
+ /// <exception cref="NotSupportedException">The feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public BarcodeDetectionConfiguration() : base("barcode_detection")
{
/// <summary>
/// Gets or sets the target of the barcode detection.
/// </summary>
- /// <exception cref="System.ArgumentException"><paramref name="value"/> is not valid.</exception>
- /// <exception cref="System.ObjectDisposedException">The <see cref="BarcodeDetectionConfiguration"/> already has been disposed of.</exception>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="BarcodeDetectionConfiguration"/> already has been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public BarcodeDetectionTarget Target
{
* limitations under the License.
*/
+using System;
using Tizen.Common;
namespace Tizen.Multimedia.Vision
/// <summary>
/// Initializes a new instance of the <see cref="BarcodeGenerationConfiguration"/> class.
/// </summary>
- /// <exception cref="System.NotSupportedException">The feature is not supported.</exception>
+ /// <exception cref="NotSupportedException">The feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public BarcodeGenerationConfiguration() : base("barcode_generation")
{
/// <summary>
/// Gets or sets the text visibility of the barcode to be generated.
/// </summary>
- /// <exception cref="System.ArgumentException"><paramref name="value"/> is not valid.</exception>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="BarcodeGenerationConfiguration"/> already has been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public Visibility TextVisibility
string featureType = _featurePath + type;
- bool ret = SystemInfo.TryGetValue(featureType, out isSupported);
+ bool ret = Information.TryGetValue(featureType, out isSupported);
return (isSupported && ret) ? true : false;
}
* limitations under the License.
*/
+using System;
+
namespace Tizen.Multimedia.Vision
{
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="FaceRecognitionConfiguration"/> class.
/// </summary>
- /// <exception cref="System.NotSupportedException">The feature is not supported.</exception>
+ /// <exception cref="NotSupportedException">The feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public FaceRecognitionConfiguration() : base("face_recognition")
{
/// Gets or sets the method used for face recognition model learning.
/// Default value is <see cref="FaceRecognitionModelType.Lbph"/>.
/// </summary>
- /// <exception cref="System.ArgumentException"><paramref name="value"/> is not valid.</exception>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <since_tizen> 3 </since_tizen>
public FaceRecognitionModelType ModelType
{
/// Initializes a new instance of the <see cref="FaceRecognitionModel"/> class with the specified path.
/// </summary>
/// <remarks>
- /// Models saved by <see cref="Save()"/> can be loaded.
+ /// Models saved by <see cref="Save(string)"/> can be loaded.
/// </remarks>
/// <param name="modelPath">Path to the model to load.</param>
/// <exception cref="ArgumentNullException"><paramref name="modelPath"/> is null.</exception>
/// Initializes a new instance of the <see cref="FaceTrackingModel"/> class with the specified path.
/// </summary>
/// <remarks>
- /// Models saved by <see cref="Save()"/> can be loaded.
+ /// Models saved by <see cref="Save(string)"/> can be loaded.
/// </remarks>
/// <param name="modelPath">Path to the model to load.</param>
/// <exception cref="ArgumentNullException"><paramref name="modelPath"/> is null.</exception>
/// <paramref name="modelPath"/> is not supported format.
/// </exception>
/// <exception cref="UnauthorizedAccessException">No permission to access the specified file.</exception>
- /// <seealso cref="Save()"/>
+ /// <seealso cref="Save(string)"/>
/// <since_tizen> 3 </since_tizen>
public FaceTrackingModel(string modelPath)
{
* limitations under the License.
*/
+using System;
+
namespace Tizen.Multimedia.Vision
{
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="ImageFillConfiguration"/> class.
/// </summary>
- /// <exception cref="System.NotSupportedException">The feature is not supported.</exception>
+ /// <exception cref="NotSupportedException">The feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public ImageFillConfiguration() : base("image_recognition")
{
/// Initializes a new instance of the <see cref="ImageObject"/> class from the specified file.
/// </summary>
/// <remarks>
- /// ImageObject has been saved by <see cref="Save()"/> can be loaded.
+ /// ImageObject has been saved by <see cref="Save(string)"/> can be loaded.
/// </remarks>
/// <param name="path">Path to the image object to load.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// Initializes a new instance of the <see cref="ImageTrackingModel"/> class with the specified path.
/// </summary>
/// <remarks>
- /// Model saved by <see cref="Save()"/> can be loaded.
+ /// Model saved by <see cref="Save(string)"/> can be loaded.
/// </remarks>
/// <param name="modelPath">Path to the model to load.</param>
/// <exception cref="ArgumentNullException"><paramref name="modelPath"/> is null.</exception>
/// <paramref name="modelPath"/> is not supported format.
/// </exception>
/// <exception cref="UnauthorizedAccessException">No permission to access the specified file.</exception>
- /// <seealso cref="Save()"/>
+ /// <seealso cref="Save(string)"/>
/// <since_tizen> 3 </since_tizen>
public ImageTrackingModel(string modelPath)
{
namespace Tizen.Multimedia
{
/// <summary>
- /// The Device API provides functions to query the information of sound devices.
+ /// Provides the ability to query the information of sound devices.
/// </summary>
public class AudioDevice
{
}
/// <summary>
- /// Gets the id of the device.
+ /// Gets the ID of the device.
/// </summary>
/// <value>The id of the device.</value>
public int Id => _id;
private static object _audioDeviceConnectionLock = new object();
/// <summary>
- /// Occurs when the state of connection of an audio device changes.
+ /// Occurs when the state of a connection of an audio device changes.
/// </summary>
public static event EventHandler<AudioDeviceConnectionChangedEventArgs> DeviceConnectionChanged
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Specifies the flag for audio device options.
+ /// Specifies the flags for the audio device options.
/// <para>
/// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
/// </para>
}
/// <summary>
- /// Specifies audio device type.
+ /// Specifies the audio device types.
/// </summary>
public enum AudioDeviceType
{
/// </summary>
BuiltinMic,
/// <summary>
- /// Audio jack that can be connected to wired accessory such as headphones and headsets.
+ /// Audio jack that can be connected to wired accessories such as headphones and headsets.
/// </summary>
AudioJack,
/// <summary>
- /// Bluetooth Media (A2DP).
+ /// Bluetooth media (A2DP).
/// </summary>
BluetoothMedia,
/// <summary>
/// </summary>
Forwarding,
/// <summary>
- /// USB Audio.
+ /// USB audio.
/// </summary>
UsbAudio,
/// <summary>
- /// Bluetooth Voice (SCO).
+ /// Bluetooth voice (SCO).
/// </summary>
BluetoothVoice
}
/// <summary>
- /// Specifies audio device direction.
+ /// Specifies the audio device directions.
/// </summary>
public enum AudioDeviceIoDirection
{
}
/// <summary>
- /// Specifies audio device state.
+ /// Specifies the audio device states.
/// </summary>
public enum AudioDeviceState
{
}
/// <summary>
- /// Specifies audio volume type.
+ /// Specifies the audio volume types.
/// </summary>
public enum AudioVolumeType
{
}
/// <summary>
- /// Specifies audio stream type.
+ /// Specifies the audio stream types.
/// </summary>
public enum AudioStreamType
{
}
/// <summary>
- /// Specifies change reason of audio stream focus state.
+ /// Specifies the change reasons of the audio stream focus state.
/// </summary>
public enum AudioStreamFocusChangedReason
{
}
/// <summary>
- /// Specifies the flag for audio stream focus options.
+ /// Specifies the flags for the audio stream focus options.
/// <para>
/// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
/// </para>
}
/// <summary>
- /// Specifies audio stream focus state.
+ /// Specifies the audio stream focus states.
/// </summary>
public enum AudioStreamFocusState
{
}
/// <summary>
- /// Specifies the flag for audio stream behaviors.
+ /// Specifies the flags for the audio stream behaviors.
/// <para>
/// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
/// </para>
namespace Tizen.Multimedia
{
/// <summary>
- /// Provides the ability to control a sound stream.
+ /// Provides the ability to control the sound stream.
/// </summary>
public class AudioStreamPolicy : IDisposable
{
private Interop.AudioStreamPolicy.FocusStateChangedCallback _focusStateChangedCallback;
/// <summary>
- /// Initializes a new instance of the <see cref="AudioStreamPolicy"/> class with <see cref="AudioStreamType"/>
+ /// Initializes a new instance of the <see cref="AudioStreamPolicy"/> class with <see cref="AudioStreamType"/>
/// </summary>
/// <remarks>
/// To apply the stream policy according to this stream information, the AudioStreamPolicy should
- /// be passed to other APIs related to playback or recording. (e.g., <see cref="Player"/>, <see cref="WavPlayer"/> , etc.)
+ /// be passed to other APIs related to playback or recording. (For example., <see cref="Player"/>, <see cref="WavPlayer"/> , etc.)
/// </remarks>
- /// <param name="streamType">Type of sound stream for which policy needs to be created.</param>
+ /// <param name="streamType">The type of the sound stream for which the policy needs to be created.</param>
/// <exception cref="ArgumentException"><paramref name="streamType"/> is invalid.</exception>
public AudioStreamPolicy(AudioStreamType streamType)
{
}
/// <summary>
- /// Gets the state of focus for playback.
+ /// Gets the state of focus for the playback.
/// </summary>
/// <value>The state of focus for playback.</value>
/// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public AudioStreamFocusState PlaybackFocusState => GetFocusState(true);
/// <summary>
- /// Gets the state of focus for recording.
+ /// Gets the state of focus for the recording.
/// </summary>
/// <value>The state of focus for recording.</value>
/// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
/*
-* 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.
-*/
+ * 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;
public AudioVolumeType Type { get; }
/// <summary>
- /// Gets the new volume.
+ /// Gets the new volume level.
/// </summary>
/// <value>The new volume level.</value>
public int Level { get; }
namespace Tizen.Multimedia
{
-
/// <summary>
/// Provides a means to control volume levels.
/// </summary>
/// -or-
/// <paramref name="value"/> is greater than <see cref="MaxVolumeLevel.this[AudioVolumeType]"/>.
/// </exception>
- /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege to set volume.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller does not have required privilege to set volume.</exception>
public int this[AudioVolumeType type]
{
get
internal static bool IsSupported(string featureKey)
{
bool supported = false;
- SystemInfo.TryGetValue(featureKey, out supported);
+ Information.TryGetValue(featureKey, out supported);
return supported;
}
if (!bufferOwner.IsBufferAccessible(buffer, MediaBufferAccessMode.Write))
{
- throw new InvalidOperationException("The buffer is not in writable state.");
+ throw new InvalidOperationException("The buffer is not in the writable state.");
}
}
}
public bool IsReadOnly { get; }
/// <summary>
- /// Validates the range
+ /// Validates the range.
/// </summary>
/// <param name="offset"></param>
/// <param name="length"></param>
/// <exception cref="ArgumentOutOfRangeException">
- /// offset + length is greater than <see cref="Length"/>.
+ /// The offset + length is greater than <see cref="Length"/>.
/// <para>-or-</para>
- /// offset or length is less than zero.
+ /// The offset or length is less than zero.
/// </exception>
private void ValidateRange(int offset, int length)
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Specifies whether a codec is audio codec or video codec.
+ /// Specifies whether a codec is an audio codec or a video codec.
/// </summary>
public enum CodecKind
{
/// <summary>
- /// Audio codec
+ /// Audio codec.
/// </summary>
Audio,
/// <summary>
- /// Video codec
+ /// Video codec.
/// </summary>
Video
}
public enum ColorSpace
{
/// <summary>
- /// Y800
+ /// Y800.
/// </summary>
Y800,
/// <summary>
- /// I420
+ /// I420.
/// </summary>
I420,
/// <summary>
- /// NV12
+ /// NV12.
/// </summary>
NV12,
/// <summary>
- /// NV16
+ /// NV16.
/// </summary>
NV16,
/// <summary>
- /// NV21
+ /// NV21.
/// </summary>
NV21,
/// <summary>
- /// NV61
+ /// NV61.
/// </summary>
NV61,
/// <summary>
- /// YV12
+ /// YV12.
/// </summary>
///
YV12,
/// <summary>
- /// YUYV
+ /// YUYV.
/// </summary>
Yuyv,
/// <summary>
- /// YUV422
+ /// YUV422.
/// </summary>
Yuv422,
/// <summary>
- /// UYVY
+ /// UYVY.
/// </summary>
Uyvy,
/// <summary>
- /// YUV422P
+ /// YUV422P.
/// </summary>
///
Yuv422P,
/// <summary>
- /// RGB565
+ /// RGB565.
/// </summary>
Rgb565,
/// <summary>
- /// RGB888
+ /// RGB888.
/// </summary>
Rgb888,
/// <summary>
- /// RGBA8888
+ /// RGBA8888.
/// </summary>
Rgba8888,
/// <summary>
- /// ARGB8888
+ /// ARGB8888.
/// </summary>
Argb8888,
/// <summary>
- /// BGRA8888
+ /// BGRA8888.
/// </summary>
Bgra8888,
/// <summary>
- /// BGRX8888
+ /// BGRX8888.
/// </summary>
Bgrx8888
internal enum DisplayType
{
/// <summary>
- /// Overlay surface display
+ /// Overlay surface display.
/// </summary>
Overlay,
/// <summary>
- /// Evas image object surface display
+ /// Evas image object surface display.
/// </summary>
Surface,
/// <summary>
- /// This disposes off buffers
+ /// This disposes off buffers.
/// </summary>
None,
}
{
/// <summary>
/// The exception that is thrown when an input file or a data stream that is supposed to conform
- /// to a certain file format specification is malformed.
+ /// to a certain file format specification, is malformed.
/// </summary>
public class FileFormatException : FormatException
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Provides functionality to read and write a media buffer.
+ /// Provides functionality to read and write the media buffer.
/// </summary>
public interface IMediaBuffer
{
/// </summary>
/// <param name="index">The index of the value to get or set.</param>
/// <exception cref="ArgumentOutOfRangeException">
- /// index is less than zero.\n
+ /// <paramref name="index"/> is less than zero.\n
/// -or-\n
- /// index is equal to or greater than <see cref="Length"/>.
+ /// <paramref name="index"/> is equal to or greater than <see cref="Length"/>.
/// </exception>
- /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
- /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
+ /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">The buffer is not available, i.e. not writable state.</exception>
byte this[int index]
{
get;
/// <param name="dest">The array to copy to.</param>
/// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
/// <param name="length">The number of array elements to copy.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="dest"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> or <paramref name="length"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
void CopyTo(byte[] dest, int startIndex, int length);
/// <summary>
/// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
/// <param name="length">The number of array elements to copy.</param>
/// <param name="offset">The zero-based index in the buffer where copying should start.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="dest"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/>, <paramref name="length"/>,
+ /// or <paramref name="offset"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
void CopyTo(byte[] dest, int startIndex, int length, int offset);
/// <summary>
/// Copies data from the buffer to a byte array.
/// </summary>
/// <param name="source">The array to copy from.</param>
- /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
+ /// <param name="startIndex">The zero-based index in the destination array where copying should start.</param>
/// <param name="length">The number of elements to copy.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> or <paramref name="length"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
-
void CopyFrom(byte[] source, int startIndex, int length);
/// <summary>
/// Copies data from the buffer to a byte array.
/// </summary>
/// <param name="source">The array to copy from.</param>
- /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
+ /// <param name="startIndex">The zero-based index in the destination array where copying should start.</param>
/// <param name="length">The number of elements to copy.</param>
/// <param name="offset">The zero-based index in the buffer where copying should start.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/>, <paramref name="length"/>,
+ /// or <paramref name="offset"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
void CopyFrom(byte[] source, int startIndex, int length, int offset);
}
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents a point in 2D space.
+ /// Represents a point in the 2D space.
/// </summary>
public struct Point
{
/// <summary>
/// Initializes a new instance of the Point with the specified coordinates.
/// </summary>
- /// <param name="x">X-axis coordinate of the point in 2D space.</param>
- /// <param name="y">Y-axis coordinate of the point in 2D space.</param>
+ /// <param name="x">X-axis coordinate of the point in the 2D space.</param>
+ /// <param name="y">Y-axis coordinate of the point in the 2D space.</param>
public Point(int x, int y)
{
X = x;
}
/// <summary>
- /// Gets or sets X-axis coordinate of the point in 2D space.
+ /// Gets or sets the X-axis coordinate of the point in the 2D space.
/// </summary>
public int X
{
}
/// <summary>
- /// Gets or sets Y-axis coordinate of the point in 2D space.
+ /// Gets or sets the Y-axis coordinate of the point in the 2D space.
/// </summary>
public int Y
{
public struct Range
{
/// <summary>
- /// Initializes a new instance of the Range with the specified values.
+ /// Initializes a new instance of the range with the specified values.
/// </summary>
/// <param name="min">Minimum value of the range.</param>
/// <param name="max">Maximum value of the range.</param>
}
/// <summary>
- /// Gets or sets minimum value of the range.
+ /// Gets or sets the minimum value of the range.
/// </summary>
public int Min
{
}
/// <summary>
- /// Gets or sets maximum value of the range.
+ /// Gets or sets the maximum value of the range.
/// </summary>
public int Max
{
}
/// <summary>
- /// Gets length of the range.
+ /// Gets the length of the range.
/// </summary>
public int Length => Max - Min;
/// <summary>
- /// Determines if the specified value is inside of the range.
+ /// Determines if the specified value is within the range.
/// </summary>
- /// <param name="value">A value to check.</param>
- /// <returns>true if the value is inside of the range; otherwise false.</returns>
+ /// <param name="value">The value to check.</param>
+ /// <returns>true if the value is within the range; otherwise false.</returns>
public bool IsInside(int value)
{
return Min <= value && value <= Max;
namespace Tizen.Multimedia
{
/// <summary>
- /// This class represents location of the object bounded by rectangle defined by
+ /// Represents the location of the object bounded by a rectangle defined by
/// coordinates of top left corner, width and height.
/// </summary>
public struct Rectangle
private Size _size;
/// <summary>
- /// Initializes a new instance of the Rectangle with the specified values.
+ /// Initializes a new instance of the <see cref="Rectangle"/> with the specified values.
/// </summary>
/// <param name="x">The x-coordinate of the upper-left corner of the rectangle.</param>
/// <param name="y">The y-coordinate of the upper-left corner of the rectangle.</param>
}
/// <summary>
- /// Initializes a new instance of the Rectangle with the specified values.
+ /// Initializes a new instance of the <see cref="Rectangle"/> with the specified values.
/// </summary>
/// <param name="location">A <see cref="Location"/> that represents the upper-left corner of the rectangular region.</param>
/// <param name="size">A <see cref="Size"/> that represents the width and height of the rectangular region.</param>
public struct Size
{
/// <summary>
- /// Initializes a new instance of the Size with the specified values.
+ /// Initializes a new instance of the <see cref="Size"/> with the specified values.
/// </summary>
/// <param name="width">Width of the size.</param>
/// <param name="height">Height of the size.</param>
}
/// <summary>
- /// Gets or sets the width of the Size.
+ /// Gets or sets the width.
/// </summary>
public int Width
{
}
/// <summary>
- /// Gets or sets the height of the Size.
+ /// Gets or sets the height.
/// </summary>
public int Height
{
/// <summary>
/// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
- /// channel, sample rate, bit and bit rate.
+ /// channel, sample rate, bit, and bit rate.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="channel">The channel value of the format.</param>
/// <param name="bitRate">The bit rate value of the format.</param>
/// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid(i.e. undefined value).</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="channel"/>, <paramref name="sampleRate"/>, <paramref name="bit"/> or <paramref name="bitRate"/> is less than zero.
+ /// <paramref name="channel"/>, <paramref name="sampleRate"/>, <paramref name="bit"/>, or <paramref name="bitRate"/> is less than zero.
/// </exception>
public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
int channel, int sampleRate, int bit, int bitRate)
/// <summary>
/// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
- /// channel, sample rate, bit, bit rate and aac type.
+ /// channel, sample rate, bit, bit rate, and AAC type.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="channel">The channel value of the format.</param>
/// <param name="bitRate">The bit rate value of the format.</param>
/// <param name="aacType">The AAC bitstream format(ADIF or ADTS).</param>
/// <exception cref="ArgumentException">
- /// <paramref name="mimeType"/> or <paramref name="aacType"/> is invalid(i.e. undefined value).\n
+ /// <paramref name="mimeType"/> or <paramref name="aacType"/> is invalid (i.e. undefined value).\n
/// -or-\n
- /// <paramref name="aacType"/> is not <see cref="MediaFormatAacType.None"/>, but <paramref name="mimeType"/> is one of aac types.
+ /// <paramref name="aacType"/> is not <see cref="MediaFormatAacType.None"/>, but <paramref name="mimeType"/> is one of the AAC types.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="channel"/>, <paramref name="sampleRate"/>, <paramref name="bit"/> or <paramref name="bitRate"/> is less than zero.
+ /// <paramref name="channel"/>, <paramref name="sampleRate"/>, <paramref name="bit"/>, or <paramref name="bitRate"/> is less than zero.
/// </exception>
public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
int channel, int sampleRate, int bit, int bitRate, MediaFormatAacType aacType)
}
/// <summary>
- /// Returns an indication whether a specified mime type is a aac type.
+ /// Returns an indication whether a specified mime type is an AAC type.
/// </summary>
/// <param name="mimeType">A mime type.</param>
private static bool IsAacSupportedMimeType(MediaFormatAudioMimeType mimeType)
}
/// <summary>
- /// Retrieves audio properties of media format from a native handle.
+ /// Retrieves audio properties of the media format from a native handle.
/// </summary>
- /// <param name="handle">A native handle that properties are retrieved from.</param>
- /// <param name="mimeType">An out parameter for mime type.</param>
- /// <param name="channel">An out parameter for channel.</param>
- /// <param name="sampleRate">An out parameter for sample rate.</param>
- /// <param name="bit">An out parameter for bit.</param>
- /// <param name="bitRate">An out parameter for bit rate.</param>
+ /// <param name="handle">A native handle that the properties are retrieved from.</param>
+ /// <param name="mimeType">An out parameter for the mime type.</param>
+ /// <param name="channel">An out parameter for the channel.</param>
+ /// <param name="sampleRate">An out parameter for the sample rate.</param>
+ /// <param name="bit">An out parameter for the bit.</param>
+ /// <param name="bitRate">An out parameter for the bit rate.</param>
private static void GetInfo(IntPtr handle, out MediaFormatAudioMimeType mimeType,
out int channel, out int sampleRate, out int bit, out int bitRate)
{
}
/// <summary>
- /// Retrieves aac type value from a native handle.
+ /// Retrieves the AAC type value from a native handle.
/// </summary>
- /// <param name="handle">A native handle that properties are retrieved from.</param>
- /// <param name="aacType">An out parameter for aac type.</param>
+ /// <param name="handle">A native handle that the properties are retrieved from.</param>
+ /// <param name="aacType">An out parameter for tha AAC type.</param>
private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType)
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
public int BitRate { get; }
/// <summary>
- /// Gets the aac type of the current format.
+ /// Gets the AAC type of the current format.
/// </summary>
public MediaFormatAacType AacType { get; }
/// Initializes a new instance of the ContainerMediaFormat class.
/// </summary>
/// <param name="mimeType">The mime type of the container format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
public ContainerMediaFormat(MediaFormatContainerMimeType mimeType)
: base(MediaFormatType.Container)
{
/// Creates a media format from a native handle.
/// </summary>
/// <param name="handle">A native handle.</param>
- /// <returns>An object of one of subclasses of <see cref="MediaFormat"/>.</returns>
+ /// <returns>An object of one of the subclasses of <see cref="MediaFormat"/>.</returns>
internal static MediaFormat FromHandle(IntPtr handle)
{
if (handle == IntPtr.Zero)
}
/// <summary>
- /// Create a native media format from this object.
+ /// Creates a native media format from this object.
/// </summary>
/// <returns>A converted native handle.</returns>
/// <remarks>The returned handle must be destroyed using <see cref="Interop.MediaFormat.Unref(IntPtr)"/>.</remarks>
}
/// <summary>
- /// Fill out properties of a native media format with the current media format object.
+ /// Fills out properties of a native media format with the current media format object.
/// </summary>
/// <param name="handle">A native handle to be written.</param>
internal abstract void AsNativeHandle(IntPtr handle);
namespace Tizen.Multimedia
{
/// <summary>
- /// Specifies aac types for <see cref="AudioMediaFormat"/>.
- /// </summary>
+ /// Specifies the AAC types for <see cref="AudioMediaFormat"/>.
+ /// </summary>
public enum MediaFormatAacType
{
/// <summary>
- /// Raw, no header
+ /// Raw, no header.
/// </summary>
None,
/// <summary>
- /// ADTS header
+ /// ADTS header.
/// </summary>
Adts,
/// <summary>
- /// ADIF header
+ /// ADIF header.
/// </summary>
Adif
}
}
/// <summary>
- /// Enumeration for media format data type
+ /// Specifies the media format data types.
/// </summary>
internal enum MediaFormatDataType
{
/// <summary>
- /// Encoded type
+ /// Encoded type.
/// </summary>
Encoded = 0x10000000,
/// <summary>
- /// Raw type
+ /// Raw type.
/// </summary>
Raw = 0x20000000,
}
public enum MediaFormatAudioMimeType
{
/// <summary>
- /// AMR, Alias for <see cref="AmrNB"/>.
+ /// AMR, alias for <see cref="AmrNB"/>.
/// </summary>
Amr = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1040),
AmrWB = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1041),
/// <summary>
- /// AAC, Alias for <see cref="AacLC"/>.
+ /// AAC, alias for <see cref="AacLC"/>.
/// </summary>
Aac = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1060),
H263P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2021),
/// <summary>
- /// H264_SP
+ /// H264_SP.
/// </summary>
H264SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2030),
Mpeg4Asp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2071),
/// <summary>
- /// I420
+ /// I420.
/// </summary>
I420 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2510),
public enum MediaFormatContainerMimeType
{
/// <summary>
- /// MP4 container, Video.
+ /// MP4 container, video.
/// </summary>
MP4 = (MediaFormatType.Container | 0x3010),
/// <summary>
- /// AVI container, Video.
+ /// AVI container, video.
/// </summary>
Avi = (MediaFormatType.Container | 0x3020),
/// <summary>
- /// MPEG2TS container, Video.
+ /// MPEG2TS container, video.
/// </summary>
Mpeg2TS = (MediaFormatType.Container | 0x3030),
/// <summary>
- /// MPEG2PS container, Video.
+ /// MPEG2PS container, video.
/// </summary>
Mpeg2PS = (MediaFormatType.Container | 0x3040),
/// <summary>
- /// MATROSKA container, Video.
+ /// MATROSKA container, video.
/// </summary>
Matroska = (MediaFormatType.Container | 0x3050),
/// <summary>
- /// WEBM container, Video.
+ /// WEBM container, video.
/// </summary>
Webm = (MediaFormatType.Container | 0x3060),
/// <summary>
- /// 3GP container, Video.
+ /// 3GP container, video.
/// </summary>
ThreeGP = (MediaFormatType.Container | 0x3070),
/// <summary>
- /// WAV container, Audio.
+ /// WAV container, audio.
/// </summary>
Wav = (MediaFormatType.Container | 0x4010),
/// <summary>
- /// OGG container, Audio
+ /// OGG container, audio
/// </summary>
Ogg = (MediaFormatType.Container | 0x4020),
/// <summary>
- /// AAC_ADTS container, Audio
+ /// AAC_ADTS container, audio
/// </summary>
AacAdts = (MediaFormatType.Container | 0x4030),
/// <summary>
- /// AAC_ADIF container, Audio
+ /// AAC_ADIF container, audio.
/// </summary>
AacAdif = (MediaFormatType.Container | 0x4031),
}
/// <summary>
- /// Enumeration for text mime type
+ /// Specifies the text mime types.
/// </summary>
public enum MediaFormatTextMimeType
{
namespace Tizen.Multimedia
{
/// <summary>
- /// Specifies text types.
+ /// Specifies the text types.
/// </summary>
public enum MediaFormatTextType
{
None,
/// <summary>
- /// The mp4 type.
+ /// MP4.
/// </summary>
MP4,
/// <summary>
- /// The 3gpp type.
+ /// 3GPP.
/// </summary>
ThreeGpp
}
private readonly LockState _lock = new LockState();
/// <summary>
- /// Validate the current object is not locked.
+ /// Validates the current object is not locked.
/// </summary>
/// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The MediaPacket is in use by another module.</exception>
/// Initializes a new instance of the MediaPacket class with the specified media format.
/// </summary>
/// <param name="format">The media format containing properties for the packet.</param>
- /// <exception cref="ArgumentNullException">format is null.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="format"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <see cref="MediaFormatType"/> of the specified format is <see cref="MediaFormatType.Container"/>.</exception>
+ /// The <see cref="MediaFormatType"/> of the specified format is <see cref="MediaFormatType.Container"/>.
+ /// </exception>
/// <exception cref="InvalidOperationException">Operation failed.</exception>
internal MediaPacket(MediaFormat format)
{
/// <summary>
/// Gets or sets the PTS(Presentation Time Stamp) value of the current packet.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">
- /// The MediaPacket is not writable state which means it being used by another module.</exception>
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
+ /// </exception>
public ulong Pts
{
get
/// <summary>
/// Gets or sets the DTS(Decoding Time Stamp) value of the current packet.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">
- /// The MediaPacket is not in writable state which means it being used by another module.</exception>
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
+ /// </exception>
public ulong Dts
{
get
}
/// <summary>
- /// Gets a value indicating whether the packet is encoded type.
+ /// Gets a value indicating whether the packet is the encoded type.
/// </summary>
- /// <value>true if the packet is encoded type; otherwise, false.</value>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <value>true if the packet is the encoded type; otherwise, false.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
public bool IsEncoded
{
get
/// Gets the buffer of the packet.
/// </summary>
/// <value>The <see cref="MediaPacketBuffer"/> allocated to the packet.
- /// This property will return null if the packet is raw video format.</value>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// This property will return null if the packet is in the raw video format.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <seealso cref="IsEncoded"/>
/// <seealso cref="VideoPlanes"/>
public MediaPacketBuffer Buffer
/// <summary>
/// Gets or sets a length of data written in the <see cref="Buffer"/>.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// The value specified for this property is less than zero or greater than <see cref="MediaPacketBuffer.Length"/>.</exception>
/// <exception cref="InvalidOperationException">
/// The MediaPacket has <see cref="VideoPlanes"/> instead of <see cref="Buffer"/>.\n
/// -or-\n
- /// The MediaPacket is not in writable state which means it being used by another module.
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
/// </exception>
public int BufferWrittenLength
{
/// Gets the video planes of the packet.
/// </summary>
/// <value>The <see cref="MediaPacketVideoPlane"/>s allocated to the packet.
- /// This property will return null if the packet is not raw video format.</value>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// This property will return null if the packet is not in the raw video format.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <seealso cref="IsEncoded"/>
/// <seealso cref="Buffer"/>
public MediaPacketVideoPlane[] VideoPlanes
/// <summary>
/// Gets or sets the buffer flags of the packet.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">
- /// The MediaPacket is not in writable state which means it being used by another module.
- /// </exception>
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
+ /// </exception>
public MediaPacketBufferFlags BufferFlags
{
get
/// Releases all resources used by the <see cref="MediaPacket"/> object.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// The MediaPacket can not be disposed which means it being used by another module.
+ /// The MediaPacket can not be disposed, which means it is being used by another module.
/// </exception>
public void Dispose()
{
}
/// <summary>
- /// Validate the current object has not been disposed of.
+ /// Validates the current object has not been disposed of.
/// </summary>
/// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
private void ValidateNotDisposed()
/// <summary>
/// Ensures whether the packet is writable.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The MediaPacket is being used by another module.</exception>
internal void EnsureWritableState()
{
/// <summary>
/// Ensures whether the packet is readable.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
internal void EnsureReadableState()
{
ValidateNotDisposed();
}
/// <summary>
- /// Gets a value indicating whether the packet is raw video format.
+ /// Gets a value indicating whether the packet is in the raw video format.
/// </summary>
- /// <value>true if the packet is raw video format; otherwise, false.</value>
+ /// <value>true if the packet is in the raw video format; otherwise, false.</value>
private bool IsVideoPlaneSupported
{
get
/// </summary>
/// <param name="index">The index of the value to get or set.</param>
/// <exception cref="ArgumentOutOfRangeException">
- /// index is less than zero.\n
+ /// <paramref name="index"/> is less than zero.\n
/// -or-\n
- /// index is equal to or greater than <see cref="Length"/>.
+ /// <paramref name="index"/> is equal to or greater than <see cref="Length"/>.
/// </exception>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The MediaPacket that owns the current buffer is being used by another module.</exception>
public byte this[int index]
{
}
/// <summary>
- /// Validates the range
+ /// Validates the range.
/// </summary>
/// <param name="offset"></param>
/// <param name="length"></param>
/// <exception cref="ArgumentOutOfRangeException">
- /// offset + length is greater than <see cref="Length"/>.\n
+ /// <paramref name="offset"/> + <paramref name="length"/> is greater than <see cref="Length"/>.\n
/// -or-\n
- /// offset or length is less than zero.
+ /// <paramref name="offset"/> or <paramref name="length"/> is less than zero.
/// </exception>
private void ValidateRange(int offset, int length)
{
}
/// <summary>
- /// Copies data from a byte array to the buffer.
+ /// Copies the data from a byte array to the buffer.
/// </summary>
/// <param name="source">The array to copy from.</param>
/// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
/// <param name="length">The number of array elements to copy.</param>
/// <param name="offset">The zero-based index in the buffer where copying should start.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="startIndex"/>, <paramref name="offset"/>, or <paramref name="length"/> is not valid.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
public void CopyFrom(byte[] source, int startIndex, int length, int offset = 0)
{
_packet.EnsureReadableState();
}
/// <summary>
- /// Copies data from the buffer to a byte array.
+ /// Copies the data from the buffer to a byte array.
/// </summary>
/// <param name="dest">The array to copy to.</param>
- /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
+ /// <param name="startIndex">The zero-based index in the destination array where copying should start.</param>
/// <param name="length">The number of elements to copy.</param>
/// <param name="offset">The zero-based index in the buffer where copying should start.</param>
- /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="startIndex"/>, <paramref name="offset"/>, <paramref name="length"/>, or <paramref name="offset"/> is not valid.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The MediaPacket that owns the current buffer is being used by another module.</exception>
public void CopyTo(byte[] dest, int startIndex, int length, int offset = 0)
{
/// <summary>
/// Gets the size of the buffer, in bytes.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
public int Length
{
get
public enum MediaPacketBufferFlags
{
/// <summary>
- /// The buffer contains codec initialization or codec specific data instead of media data.
+ /// The buffer contains the codec initialization or the codec specific data instead of the media data.
/// </summary>
CodecConfig = 0x1,
/// <summary>
- /// The buffer indicates the end of stream.
+ /// The buffer indicates the end of the stream.
/// </summary>
EndOfStream = 0x2,
namespace Tizen.Multimedia
{
/// <summary>
- /// Represents a video plane for <see cref="MediaPacket"/>.
- /// This class is used if and only if the format of the packet is raw video.
+ /// Represents a video plane for the <see cref="MediaPacket"/>.
+ /// This class is used if and only if the format of the packet is the raw video.
/// </summary>
public class MediaPacketVideoPlane
{
/// <summary>
/// Gets the buffer of the current video plane.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
public MediaPacketBuffer Buffer
{
get
/// <summary>
/// Gets the stride width of the current video plane.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
public int StrideWidth
{
get
/// <summary>
/// Gets the stride height of the current video plane.
/// </summary>
- /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer has already been disposed of.</exception>
public int StrideHeight
{
get
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="textType">The text type of the format.</param>
/// <exception cref="ArgumentException">
- /// mimeType or textType is invalid(i.e. undefined value).</exception>
+ /// <paramref name="mimeType"/> or <paramref name="textType"/> is invalid (i.e. undefined value).
+ /// </exception>
public TextMediaFormat(MediaFormatTextMimeType mimeType, MediaFormatTextType textType)
: base(MediaFormatType.Text)
{
}
/// <summary>
- /// Retrieves text properties of media format from a native handle.
+ /// Retrieves text properties of the media format from a native handle.
/// </summary>
- /// <param name="handle">A native handle that properties are retrieved from.</param>
- /// <param name="mimeType">An out parameter for mime type.</param>
- /// <param name="textType">An out parameter for text type.</param>
+ /// <param name="handle">A native handle that the properties are retrieved from.</param>
+ /// <param name="mimeType">An out parameter for the mime type.</param>
+ /// <param name="textType">An out parameter for the text type.</param>
private static void GetInfo(IntPtr handle, out MediaFormatTextMimeType mimeType,
out MediaFormatTextType textType)
{
private const int DefaultBitRate = 0;
/// <summary>
- /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, width and height.
+ /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, width, and height.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="width">The width value of the format.</param>
/// <param name="height">The height value of the format</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, or height is less than zero.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="width"/> or <paramref name="height"/> is less than zero.</exception>
public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height)
: this(mimeType, width, height, DefaultFrameRate)
{
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="size">The size of the format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, or height is less than zero.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException">The width or the height of <paramref name="size"/> is less than zero.</exception>
public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size)
: this(mimeType, size, DefaultFrameRate)
{
/// <summary>
/// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
- /// width, height and frame rate.
+ /// width, height, and frame rate.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="width">The width value of the format.</param>
/// <param name="height">The height value of the format</param>
/// <param name="frameRate">The frame rate of the format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, height or frameRate is less than zero.</exception>
- public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height,
- int frameRate)
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="width"/>, <paramref name="height"/>, or <paramref name="frameRate"/> is less than zero.
+ /// </exception>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height, int frameRate)
: this(mimeType, width, height, frameRate, DefaultBitRate)
{
}
/// <summary>
/// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
- /// width, height and frame rate.
+ /// width, height, and frame rate.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="size">The video size of the format.</param>
/// <param name="frameRate">The frame rate of the format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, height or frameRate is less than zero.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// The width or the height of <paramref name="size"/> is less than zero.\n
+ /// -or-\n
+ /// <paramref name="frameRate"/> is less than zero.
+ /// </exception>
public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size,
int frameRate)
: this(mimeType, size, frameRate, DefaultBitRate)
/// <summary>
/// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
- /// width, height, frame rate and bit rate.
+ /// width, height, frame rate, and bit rate.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="width">The width value of the format.</param>
/// <param name="height">The height value of the format</param>
/// <param name="frameRate">The frame rate of the format.</param>
/// <param name="bitRate">The bit rate of the format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, height, frameRate or bitRate is less than zero.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="width"/>, <paramref name="height"/>, <paramref name="frameRate"/>, or <paramref name="bitRate"/> is less than zero.
+ /// </exception>
public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height,
int frameRate, int bitRate)
: this(mimeType, new Size(width, height), frameRate, bitRate)
/// <summary>
/// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
- /// size, frame rate and bit rate.
+ /// size, frame rate, and bit rate.
/// </summary>
/// <param name="mimeType">The mime type of the format.</param>
/// <param name="size">The size of the format.</param>
/// <param name="frameRate">The frame rate of the format.</param>
/// <param name="bitRate">The bit rate of the format.</param>
- /// <exception cref="ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
- /// <exception cref="ArgumentOutOfRangeException">width, height, frameRate or bitRate is less than zero.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mimeType"/> is invalid (i.e. undefined value).</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// The width or the height of <paramref name="size"/> is less than zero.\n
+ /// -or-\n
+ /// <paramref name="frameRate"/> is less than zero.\n
+ /// -or-\n
+ /// <paramref name="bitRate"/> is less than zero.
+ /// </exception>
public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size,
int frameRate, int bitRate)
: base(MediaFormatType.Video)
}
/// <summary>
- /// Retrieves video properties of media format from a native handle.
+ /// Retrieves video properties of the media format from a native handle.
/// </summary>
- /// <param name="handle">A native handle that properties are retrieved from.</param>
- /// <param name="width">An out parameter for width.</param>
- /// <param name="height">An out parameter for height.</param>
- /// <param name="bitRate">An out parameter for bit rate.</param>
- /// <param name="mimeType">An out parameter for mime type.</param>
+ /// <param name="handle">A native handle that the properties are retrieved from.</param>
+ /// <param name="width">An out parameter for the width.</param>
+ /// <param name="height">An out parameter for the height.</param>
+ /// <param name="bitRate">An out parameter for the bit rate.</param>
+ /// <param name="mimeType">An out parameter for the mime type.</param>
private static void GetInfo(IntPtr handle, out int width, out int height, out int bitRate,
out MediaFormatVideoMimeType mimeType)
{
/// <summary>
/// Retrieves frame rate from a native handle.
/// </summary>
- /// <param name="handle">A native handle that properties are retrieved from.</param>
- /// <param name="frameRate">An out parameter for frame rate.</param>
+ /// <param name="handle">A native handle that the properties are retrieved from.</param>
+ /// <param name="frameRate">An out parameter for the frame rate.</param>
private static void GetFrameRate(IntPtr handle, out int frameRate)
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
namespace Tizen.Multimedia
{
/// <summary>
- /// The MediaView class allows application developers to display the video output on screen.
+ /// The MediaView class allows application developers to display the video output on the screen.
/// </summary>
/// <remarks>
/// This view should not be instantiated directly.\n
{
get
{
- return BluetoothAdapterImpl.Instance.IsBluetoothEnabled;
+ try
+ {
+ return BluetoothAdapterImpl.Instance.IsBluetoothEnabled;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
}
set
{
- BluetoothAdapterImpl.Instance.Name = value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.Name = value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// The StateChanged event is raised when the Bluetooth adapter state is changed.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<StateChangedEventArgs> StateChanged
{
add
{
- BluetoothAdapterImpl.Instance.StateChanged += value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.StateChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
remove
{
- BluetoothAdapterImpl.Instance.StateChanged -= value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.StateChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// The NameChanged event is raised when the Bluetooth adapter name is changed.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<NameChangedEventArgs> NameChanged
{
add
{
- BluetoothAdapterImpl.Instance.NameChanged += value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.NameChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
remove
{
- BluetoothAdapterImpl.Instance.NameChanged -= value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.NameChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// The VisibilityModeChanged event is raised when the Bluetooth adapter visibility mode is changed.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<VisibilityModeChangedEventArgs> VisibilityModeChanged
{
add
{
- BluetoothAdapterImpl.Instance.VisibilityModeChanged += value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.VisibilityModeChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
remove
{
- BluetoothAdapterImpl.Instance.VisibilityModeChanged -= value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.VisibilityModeChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// The VisibilityDurationChanged event is raised very second until the visibility mode is changed to NonDiscoverable.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<VisibilityDurationChangedEventArgs> VisibilityDurationChanged
{
add
{
- BluetoothAdapterImpl.Instance.VisibilityDurationChanged += value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.VisibilityDurationChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
remove
{
- BluetoothAdapterImpl.Instance.VisibilityDurationChanged -= value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.VisibilityDurationChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// The DiscoveryStateChanged event is raised when the device discovery state is changed.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
{
add
{
- BluetoothAdapterImpl.Instance.DiscoveryStateChanged += value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.DiscoveryStateChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
remove
{
- BluetoothAdapterImpl.Instance.DiscoveryStateChanged -= value;
+ try
+ {
+ BluetoothAdapterImpl.Instance.DiscoveryStateChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <summary>
/// This event is called when the LE scan result is obtained.
/// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public event EventHandler<AdapterLeScanResultChangedEventArgs> ScanResultChanged
{
add
{
- BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged += value;
+ try
+ {
+ BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged += value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
- remove {
- BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged -= value;
+ remove
+ {
+ try
+ {
+ BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged -= value;
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
}
/// <exception cref="System.InvalidOperationException">Thrown when the Bluetooth is not enabled.</exception>
static public bool IsServiceUsed(string serviceUuid)
{
- return BluetoothAdapterImpl.Instance.IsServiceUsed(serviceUuid);
+ try
+ {
+ return BluetoothAdapterImpl.Instance.IsServiceUsed(serviceUuid);
+ }
+ catch (TypeInitializationException e)
+ {
+ throw e.InnerException;
+ }
}
/// <summary>
if (ret != (int)BluetoothError.None)
{
Log.Error (Globals.LogTag, "Failed to deinitialize bluetooth, Error - " + (BluetoothError)ret);
- BluetoothErrorFactory.ThrowBluetoothException (ret);
}
else
{
ResourceFoundEventArgs e = new ResourceFoundEventArgs()
{
RequestId = requestId,
+ EventContinue = true,
Resource = resource
};
ResourceFound?.Invoke(null, e);
PlatformInformationFoundEventArgs e = new PlatformInformationFoundEventArgs()
{
RequestId = requestId,
+ EventContinue = true,
PlatformId = (platformId != IntPtr.Zero) ? Marshal.PtrToStringAnsi(platformId) : string.Empty,
ManufacturerName = (manufacturerName != IntPtr.Zero) ? Marshal.PtrToStringAnsi(manufacturerName) : string.Empty,
ManufacturerURL = (manufacturerUrl != IntPtr.Zero) ? Marshal.PtrToStringAnsi(manufacturerUrl) : string.Empty,
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
bool isNfcSupported = false;
bool isTagSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
if (!isNfcSupported || !isTagSupported)
{
bool isNfcSupported = false;
bool isTagSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
if (!isNfcSupported || !isTagSupported)
{
bool isNfcSupported = false;
bool isCeSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
if (!isNfcSupported || !isCeSupported)
{
bool isNfcSupported = false;
bool isCeSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
if (!isNfcSupported || !isCeSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
bool isNfcSupported = false;
bool isTagSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported);
if (!isNfcSupported || !isTagSupported)
{
bool isNfcSupported = false;
bool isP2pSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.p2p", out isP2pSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.p2p", out isP2pSupported);
if (!isNfcSupported || !isP2pSupported)
{
bool isNfcSupported = false;
bool isCeSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported);
if (!isNfcSupported || !isCeSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
{
bool isNfcSupported = false;
- SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
+ Information.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported);
if (!isNfcSupported)
{
internal static bool CheckIfSupported(SensorType type, String key)
{
bool isSupported = false;
- bool error = SystemInfo.TryGetValue(key, out isSupported);
+ bool error = Information.TryGetValue(key, out isSupported);
if (!error || !isSupported)
{
--- /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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace Tizen.System
+{
+ /// <summary>
+ /// The Information class provides functions to obtain various system information.
+ /// </summary>
+ public static class Information
+ {
+ internal const string HttpPrefix = "http://";
+ internal const string RuntimeInfoStringKeyPrefix = "tizen.org/runtimefeature/";
+
+ internal const string RuntimeInfoStringKeyBluetooth = "bluetooth";
+ internal const string RuntimeInfoStringKeyTetheringWiFi = "tethering.wifi";
+ internal const string RuntimeInfoStringKeyTetheringBluetooth = "tethering.bluetooth";
+ internal const string RuntimeInfoStringKeyTetheringUsb = "tethering.usb";
+ internal const string RuntimeInfoStringKeyPacketData = "packetdata";
+ internal const string RuntimeInfoStringKeyDataRoaming = "dataroaming";
+ internal const string RuntimeInfoStringKeyVibration = "vibration";
+ internal const string RuntimeInfoStringKeyAudioJackConnected = "audiojack.connected";
+ internal const string RuntimeInfoStringKeyBatteryCharging = "battery.charging";
+ internal const string RuntimeInfoStringKeyTvOut = "tvout";
+ internal const string RuntimeInfoStringKeyCharger = "charger";
+ internal const string RuntimeInfoStringKeyAutoRotation = "autorotation";
+ internal const string RuntimeInfoStringKeyGps = "gps";
+ internal const string RuntimeInfoStringKeyAudioJackType = "audiojack.type";
+
+
+ private static readonly Dictionary<string, RuntimeInfoKey> StringEnumMapping = new Dictionary<string, RuntimeInfoKey>
+ {
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyBluetooth] = RuntimeInfoKey.Bluetooth,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringWiFi] = RuntimeInfoKey.WifiHotspot,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringBluetooth] = RuntimeInfoKey.BluetoothTethering,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringUsb] = RuntimeInfoKey.UsbTethering,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyPacketData] = RuntimeInfoKey.PacketData,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyDataRoaming] = RuntimeInfoKey.DataRoaming,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyVibration] = RuntimeInfoKey.Vibration,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAudioJackConnected] = RuntimeInfoKey.AudioJack,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyBatteryCharging] = RuntimeInfoKey.BatteryIsCharging,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTvOut] = RuntimeInfoKey.TvOut,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyCharger] = RuntimeInfoKey.Charger,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAutoRotation] = RuntimeInfoKey.AutoRotation,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyGps] = RuntimeInfoKey.Gps,
+ [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAudioJackType] = RuntimeInfoKey.AudioJackConnector
+ };
+
+ internal static readonly Dictionary<RuntimeInfoKey, string> EnumStringMapping = new Dictionary<RuntimeInfoKey, string>
+ {
+ [RuntimeInfoKey.Bluetooth] = RuntimeInfoStringKeyBluetooth,
+ [RuntimeInfoKey.WifiHotspot] = RuntimeInfoStringKeyTetheringWiFi,
+ [RuntimeInfoKey.BluetoothTethering] = RuntimeInfoStringKeyTetheringBluetooth,
+ [RuntimeInfoKey.UsbTethering] = RuntimeInfoStringKeyTetheringUsb,
+ [RuntimeInfoKey.PacketData] = RuntimeInfoStringKeyPacketData,
+ [RuntimeInfoKey.DataRoaming] = RuntimeInfoStringKeyDataRoaming,
+ [RuntimeInfoKey.Vibration] = RuntimeInfoStringKeyVibration,
+ [RuntimeInfoKey.AudioJack] = RuntimeInfoStringKeyAudioJackConnected,
+ [RuntimeInfoKey.BatteryIsCharging] = RuntimeInfoStringKeyBatteryCharging,
+ [RuntimeInfoKey.TvOut] = RuntimeInfoStringKeyTvOut,
+ [RuntimeInfoKey.Charger] = RuntimeInfoStringKeyCharger,
+ [RuntimeInfoKey.AutoRotation] = RuntimeInfoStringKeyAutoRotation,
+ [RuntimeInfoKey.Gps] = RuntimeInfoStringKeyGps,
+ [RuntimeInfoKey.AudioJackConnector] = RuntimeInfoStringKeyAudioJackType
+ };
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private static bool ConvertStringToRuntimeInfoKey(string key, out RuntimeInfoKey feature)
+ {
+ string filteredKey = key.StartsWith(HttpPrefix) ? key.Substring(HttpPrefix.Length) : key;
+ feature = default(RuntimeInfoKey);
+
+ return StringEnumMapping.TryGetValue(filteredKey, out feature);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private static bool TryGetRuntimeInfoValue<T>(RuntimeInfoKey key, out T value)
+ {
+ value = default(T);
+
+ if (!RuntimeInfo.Is<T>(key))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid return type");
+ return false;
+ }
+
+ return RuntimeInfo.TryGetValue<T>(key, out value);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private static bool TryGetSystemInfoValue<T>(string key, out T value)
+ {
+ value = default(T);
+
+ if (!SystemInfo.IsValidKey(key))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ return false;
+ }
+
+ if (!SystemInfo.Is<T>(key))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid return type");
+ return false;
+ }
+
+ return SystemInfo.TryGetValue<T>(key, out value);
+ }
+
+ /// <summary>
+ /// Gets the value of the feature.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <typeparam name="T">The type of <paramref name="value"/>.</typeparam>
+ /// <param name="key">The name of the feature.</param>
+ /// <param name="value">The value of the given feature.</param>
+ /// <returns>Returns true on success, otherwise false.</returns>
+ public static bool TryGetValue<T>(string key, out T value)
+ {
+ RuntimeInfoKey runtimeFeature;
+
+ if (ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+ {
+ return TryGetRuntimeInfoValue<T>(runtimeFeature, out value);
+ }
+ else
+ {
+ return TryGetSystemInfoValue<T>(key, out value);
+ }
+ }
+
+ /// <summary>
+ /// Registers a change event callback for given runtime feature key.
+ /// </summary>
+ /// <remarks>
+ /// This function is only for runtime feature.
+ /// </remarks>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="key">The name of runtime feature which wants to register callback.</param>
+ /// <param name="callback">The callback function to subscribe.</param>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+ /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
+ public static void SetCallback(string key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+ {
+ RuntimeInfoKey runtimeFeature;
+
+ if (!ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ RuntimeInfo.SetCallback(runtimeFeature, callback);
+ }
+
+ /// <summary>
+ /// Unregisters a change event callback for given runtime feature key.
+ /// </summary>
+ /// <remarks>
+ /// This function is only for runtime feature.
+ /// </remarks>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="key">The name of runtime feature which wants to unregister callback.</param>
+ /// <param name="callback">The callback function to unsubscribe.</param>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+ /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
+ public static void UnsetCallback(string key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+ {
+ RuntimeInfoKey runtimeFeature;
+
+ if (!ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ RuntimeInfo.UnsetCallback(runtimeFeature, callback);
+ }
+ }
+}
namespace Tizen.System
{
[EditorBrowsable(EditorBrowsableState.Never)]
- internal enum RuntimeInfoError
+ internal enum InformationError
{
None = ErrorCode.None,
InvalidParameter = ErrorCode.InvalidParameter,
}
[EditorBrowsable(EditorBrowsableState.Never)]
- internal static class RuntimeInfoErrorFactory
+ internal static class InformationErrorFactory
{
- internal const string LogTag = "Tizen.System.RuntimeInformation";
+ internal const string LogTag = "Tizen.System.Information";
- internal static void ThrowException(int err)
+ internal static void ThrowException(InformationError err)
{
- RuntimeInfoError error = (RuntimeInfoError)err;
- if (error == RuntimeInfoError.InvalidParameter)
+ InformationError error = (InformationError)err;
+ if (error == InformationError.InvalidParameter)
{
throw new ArgumentException("Invalid parameter");
}
- else if (error == RuntimeInfoError.OutOfMemory)
+ else if (error == InformationError.OutOfMemory)
{
throw new OutOfMemoryException("Out of memory");
}
- else if (error == RuntimeInfoError.Io)
+ else if (error == InformationError.Io)
{
throw new IOException("I/O Error");
}
- else if (error == RuntimeInfoError.RemoteIo)
+ else if (error == InformationError.RemoteIo)
{
throw new IOException("Remote I/O Error");
}
- else if (error == RuntimeInfoError.PermissionDenied)
+ else if (error == InformationError.PermissionDenied)
{
throw new UnauthorizedAccessException("Permission denied");
}
- else if (error == RuntimeInfoError.NotSupported)
+ else if (error == InformationError.NotSupported)
{
throw new NotSupportedException("Not supported");
}
- else if (error == RuntimeInfoError.NoData)
+ else if (error == InformationError.NoData)
{
throw new NotSupportedException("No data");
}
{
internal static partial class RuntimeInfo
{
- public delegate void RuntimeInformationChangedCallback(RuntimeInformationKey key, IntPtr userData);
+ public delegate void RuntimeInformationChangedCallback(RuntimeInfoKey key, IntPtr userData);
[StructLayout(LayoutKind.Sequential)]
public struct MemoryInfo
}
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_int")]
- public static extern int GetValue(RuntimeInformationKey key, out int status);
+ public static extern InformationError GetValue(RuntimeInfoKey key, out int status);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_bool")]
- public static extern int GetValue(RuntimeInformationKey key, out bool status);
+ public static extern InformationError GetValue(RuntimeInfoKey key, out bool status);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_double")]
- public static extern int GetValue(RuntimeInformationKey key, out double status);
+ public static extern InformationError GetValue(RuntimeInfoKey key, out double status);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_string")]
- public static extern int GetValue(RuntimeInformationKey key, out string status);
+ public static extern InformationError GetValue(RuntimeInfoKey key, out string status);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_system_memory_info")]
- public static extern int GetSystemMemoryInfo(out MemoryInfo memoryInfo);
+ public static extern InformationError GetSystemMemoryInfo(out MemoryInfo memoryInfo);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_memory_info")]
- public static extern int GetProcessMemoryInfo(int[] pid, int size, out ProcessMemoryInfo[] array);
+ public static extern InformationError GetProcessMemoryInfo(int[] pid, int size, ref IntPtr array);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_cpu_usage")]
- public static extern int GetCpuUsage(out CpuUsage cpuUsage);
+ public static extern InformationError GetCpuUsage(out CpuUsage cpuUsage);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_cpu_usage")]
- public static extern int GetProcessCpuUsage(int[] pid, int size, out ProcessCpuUsage[] array);
+ public static extern InformationError GetProcessCpuUsage(int[] pid, int size, ref IntPtr array);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_count")]
- public static extern int GetProcessorCount(out int processorCount);
+ public static extern InformationError GetProcessorCount(out int processorCount);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_current_frequency")]
- public static extern int GetProcessorCurrentFrequency(int coreId, out int cpuFreq);
+ public static extern InformationError GetProcessorCurrentFrequency(int coreId, out int cpuFreq);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_max_frequency")]
- public static extern int GetProcessorMaxFrequency(int coreId, out int cpuFreq);
+ public static extern InformationError GetProcessorMaxFrequency(int coreId, out int cpuFreq);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_set_changed_cb")]
- public static extern int SetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
+ public static extern InformationError SetRuntimeInfoChangedCallback(RuntimeInfoKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_unset_changed_cb")]
- public static extern int UnsetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey);
+ public static extern InformationError UnsetRuntimeInfoChangedCallback(RuntimeInfoKey runtimeInfoKey);
}
}
* limitations under the License.
*/
-using System;
+using Tizen.System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class SystemInfo
{
- internal enum ErrorCode
- {
- None = Tizen.Internals.Errors.ErrorCode.None,
- InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
- OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
- IoError = Tizen.Internals.Errors.ErrorCode.IoError,
- PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
- NotSupported = Tizen.Internals.Errors.ErrorCode.NoSuchDevice,
- }
-
internal enum SystemInfoValueType
{
Bool = 0,
}
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_type")]
- internal static extern ErrorCode SystemInfoGetPlatformType(string key, out SystemInfoValueType type);
+ internal static extern InformationError SystemInfoGetPlatformType(string key, out SystemInfoValueType type);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_type")]
- internal static extern ErrorCode SystemInfoGetCustomType(string key, out SystemInfoValueType type);
+ internal static extern InformationError SystemInfoGetCustomType(string key, out SystemInfoValueType type);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_bool")]
- internal static extern ErrorCode SystemInfoGetPlatformBool(string key, out bool value);
+ internal static extern InformationError SystemInfoGetPlatformBool(string key, out bool value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_int")]
- internal static extern ErrorCode SystemInfoGetPlatformInt(string key, out int value);
+ internal static extern InformationError SystemInfoGetPlatformInt(string key, out int value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_double")]
- internal static extern ErrorCode SystemInfoGetPlatformDouble(string key, out double value);
+ internal static extern InformationError SystemInfoGetPlatformDouble(string key, out double value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_string")]
- internal static extern ErrorCode SystemInfoGetPlatformString(string key, out string value);
+ internal static extern InformationError SystemInfoGetPlatformString(string key, out string value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_bool")]
- internal static extern ErrorCode SystemInfoGetCustomBool(string key, out bool value);
+ internal static extern InformationError SystemInfoGetCustomBool(string key, out bool value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_int")]
- internal static extern ErrorCode SystemInfoGetCustomInt(string key, out int value);
+ internal static extern InformationError SystemInfoGetCustomInt(string key, out int value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_double")]
- internal static extern ErrorCode SystemInfoGetCustomDouble(string key, out double value);
+ internal static extern InformationError SystemInfoGetCustomDouble(string key, out double value);
[DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_string")]
- internal static extern ErrorCode SystemInfoGetCustomString(string key, out string value);
+ internal static extern InformationError SystemInfoGetCustomString(string key, out string value);
}
}
+++ /dev/null
-/*
-* 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.ComponentModel;
-
-namespace Tizen.System
-{
- /// <summary>
- /// The structure for CPU usage.
- /// </summary>
- public class CpuUsage
- {
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal CpuUsage(Interop.RuntimeInfo.CpuUsage usage)
- {
- IoWait = usage.IoWait;
- Nice = usage.IoWait;
- System = usage.System;
- User = usage.User;
- }
- /// <summary>
- /// Running time of un-niced user processes (Percent).
- /// </summary>
- public double User { get; internal set; }
- /// <summary>
- /// Running time of kernel processes (Percent).
- /// </summary>
- public double System { get; internal set; }
- /// <summary>
- /// Running time of niced user processes (Percent).
- /// </summary>
- public double Nice { get; internal set; }
- /// <summary>
- /// Time waiting for I/O completion (Percent).
- /// </summary>
- public double IoWait { get; internal set; }
- }
-
- /// <summary>
- /// The structure for CPU usage per process.
- /// </summary>
- public class ProcessCpuUsage
- {
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal ProcessCpuUsage(Interop.RuntimeInfo.ProcessCpuUsage usage)
- {
- UTime = usage.UTime;
- STime = usage.STime;
- }
- /// <summary>
- /// The amount of time this process has been scheduled in user mode (clock ticks).
- /// </summary>
- public uint UTime { get; internal set; }
- /// <summary>
- /// The amount of time this process has been scheduled in kernel mode (clock ticks).
- /// </summary>
- public uint STime { get; internal set; }
- }
-}
* limitations under the License.
*/
-using System;
+using System.ComponentModel;
namespace Tizen.System
{
+ [EditorBrowsable(EditorBrowsableState.Never)]
/// <summary>
/// Enumeration for the runtime information key.
/// </summary>
- public enum RuntimeInformationKey
+ internal enum RuntimeInfoKey
{
/// <summary>
/// Indicates whether Bluetooth is enabled.
Bluetooth = 2,
/// <summary>
/// Indicates whether Wi-Fi hotspot is enabled.
- /// <see cref="WifiStatus"/>
/// </summary>
WifiHotspot = 3,
/// <summary>
}
/// <summary>
- /// Enumeration for the Wi-Fi status.
- /// </summary>
- public enum WifiStatus
- {
- /// <summary>
- /// The Wi-Fi is disabled.
- /// </summary>
- Disabled,
- /// <summary>
- /// The Wi-Fi is enabled and the network connection is not established.
- /// </summary>
- Unconnected,
- /// <summary>
- /// The network connection is established in a Wi-Fi network.
- /// </summary>
- Connected
- }
-
- /// <summary>
/// Enumeration for the GPS status.
/// </summary>
public enum GpsStatus
+++ /dev/null
-/*
-* 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.ComponentModel;
-
-namespace Tizen.System
-{
- /// <summary>
- /// Memory information.
- /// </summary>
- public class SystemMemoryInformation
- {
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal SystemMemoryInformation(Interop.RuntimeInfo.MemoryInfo info)
- {
- Total = info.Total;
- Used = info.Used;
- Cache = info.Cache;
- Free = info.Free;
- Swap = info.Swap;
- }
- /// <summary>
- /// Total memory (KiB).
- /// </summary>
- public int Total { get; internal set; }
- /// <summary>
- /// Used memory (KiB).
- /// </summary>
- public int Used { get; internal set; }
- /// <summary>
- /// Free memory (KiB).
- /// </summary>
- public int Free { get; internal set; }
- /// <summary>
- /// Cache memory (KiB).
- /// </summary>
- public int Cache { get; internal set; }
- /// <summary>
- /// Swap memory (KiB).
- /// </summary>
- public int Swap { get; internal set; }
- }
-
- /// <summary>
- /// Memory information per process.
- /// </summary>
- public class ProcessMemoryInformation
- {
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal ProcessMemoryInformation(Interop.RuntimeInfo.ProcessMemoryInfo info)
- {
- PrivateClean = info.PrivateClean;
- PrivateDirty = info.PrivateDirty;
- Pss = info.Pss;
- Rss = info.Rss;
- SharedClean = info.SharedClean;
- SharedDirty = info.SharedDirty;
- Vsz = info.Vsz;
- }
- /// <summary>
- /// Virtual memory size (KiB).
- /// </summary>
- public int Vsz { get; internal set; }
- /// <summary>
- /// Resident set size (KiB).
- /// </summary>
- public int Rss { get; internal set; }
- /// <summary>
- /// Proportional set size (KiB).
- /// </summary>
- public int Pss { get; internal set; }
- /// <summary>
- /// Not modified and mapped by other processes (KiB).
- /// </summary>
- public int SharedClean { get; internal set; }
- /// <summary>
- /// Modified and mapped by other processes (KiB).
- /// </summary>
- public int SharedDirty { get; internal set; }
- /// <summary>
- /// Not modified and available only to that process (KiB).
- /// </summary>
- public int PrivateClean { get; internal set; }
- /// <summary>
- /// Modified and available only to that process (KiB).
- /// </summary>
- public int PrivateDirty { get; internal set; }
- }
-}
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Tizen.System
{
/// <summary>
- /// RuntimeInfoChangedEventArgs is an extended EventArgs class. This class contains event arguments for runtime event listeners.
+ /// RuntimeFeatureStatusChangedEventArgs is an extended EventArgs class. This class contains event arguments for runtime event listeners.
/// </summary>
- public class RuntimeKeyStatusChangedEventArgs : EventArgs
+ public class RuntimeFeatureStatusChangedEventArgs : EventArgs
{
/// <summary>
/// The key indicating the runtime system preference which was changed.
+ /// It includes the prefix "http://" though you don't use for registering callback.
/// </summary>
- public RuntimeInformationKey Key { get; internal set; }
+ public String Key { get; internal set; }
}
}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.ComponentModel;
+
+namespace Tizen.System
+{
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal static class RuntimeInfo
+ {
+ private static RuntimeInfoEventHandler BluetoothEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.Bluetooth);
+ private static RuntimeInfoEventHandler WifiHotspotEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.WifiHotspot);
+ private static RuntimeInfoEventHandler BluetoothTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.BluetoothTethering);
+ private static RuntimeInfoEventHandler UsbTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.UsbTethering);
+ private static RuntimeInfoEventHandler PacketDataEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.PacketData);
+ private static RuntimeInfoEventHandler DataRoamingEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.DataRoaming);
+ private static RuntimeInfoEventHandler VibrationEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.Vibration);
+ private static RuntimeInfoEventHandler AudioJackConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.AudioJack);
+ private static RuntimeInfoEventHandler GpsStatusChanged = new RuntimeInfoEventHandler(RuntimeInfoKey.Gps);
+ private static RuntimeInfoEventHandler BatteryIsCharging = new RuntimeInfoEventHandler(RuntimeInfoKey.BatteryIsCharging);
+ private static RuntimeInfoEventHandler TvOutConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.TvOut);
+ private static RuntimeInfoEventHandler AudioJackConnectorChanged = new RuntimeInfoEventHandler(RuntimeInfoKey.AudioJackConnector);
+ private static RuntimeInfoEventHandler ChargerConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.Charger);
+ private static RuntimeInfoEventHandler AutoRotationEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.AutoRotation);
+
+ internal static readonly Dictionary<RuntimeInfoKey, Type> s_keyDataTypeMapping = new Dictionary<RuntimeInfoKey, Type>
+ {
+ [RuntimeInfoKey.Bluetooth] = typeof(bool),
+ [RuntimeInfoKey.WifiHotspot] = typeof(bool),
+ [RuntimeInfoKey.BluetoothTethering] = typeof(bool),
+ [RuntimeInfoKey.UsbTethering] = typeof(bool),
+ [RuntimeInfoKey.PacketData] = typeof(bool),
+ [RuntimeInfoKey.DataRoaming] = typeof(bool),
+ [RuntimeInfoKey.Vibration] = typeof(bool),
+ [RuntimeInfoKey.AudioJack] = typeof(bool),
+ [RuntimeInfoKey.BatteryIsCharging] = typeof(bool),
+ [RuntimeInfoKey.TvOut] = typeof(bool),
+ [RuntimeInfoKey.Charger] = typeof(bool),
+ [RuntimeInfoKey.AutoRotation] = typeof(bool),
+ [RuntimeInfoKey.Gps] = typeof(int),
+ [RuntimeInfoKey.AudioJackConnector] = typeof(int)
+ };
+
+ /// <summary>
+ /// Validates the data type of the status represented by the runtime key.
+ /// Note that this is a generic method.
+ /// </summary>
+ /// <typeparam name="T">The generic type to validate.</typeparam>
+ /// <param name="key">The runtime information key for which the status type is validated.</param>
+ /// <returns>True if the data type matches.</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+ internal static bool Is<T>(RuntimeInfoKey key)
+ {
+ if (!s_keyDataTypeMapping.ContainsKey(key))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid data type");
+ throw new ArgumentException("Invalid parameter");
+ }
+
+ return s_keyDataTypeMapping[key] == typeof(T);
+ }
+
+ /// <summary>
+ /// Gets the status of runtime key.
+ /// Note that this is a generic method.
+ /// </summary>
+ /// <typeparam name="T">The generic type to return.</typeparam>
+ /// <param name="key">The runtime information key for which the current should be read.</param>
+ /// <param name="value">The value of the given feature.</param>
+ /// <returns>Returns true on success, otherwise false.</returns>
+ internal static bool TryGetValue<T>(RuntimeInfoKey key, out T value)
+ {
+ Type type;
+ value = default(T);
+
+ if (!s_keyDataTypeMapping.TryGetValue(key, out type))
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ return false;
+ }
+
+ if (type == typeof(bool))
+ {
+ InformationError ret = Interop.RuntimeInfo.GetValue(TvProductHelper.ConvertKeyIfTvProduct(key), out bool val);
+
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
+ return false;
+ }
+
+ value = (T)(object)val;
+ }
+ else if(type == typeof(int))
+ {
+ InformationError ret = Interop.RuntimeInfo.GetValue(TvProductHelper.ConvertKeyIfTvProduct(key), out int val);
+
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
+ return false;
+ }
+
+ value = (T)(object)val;
+ }
+
+ return true;
+ }
+
+ private static void FindEventHandler(RuntimeInfoKey key, ref RuntimeInfoEventHandler handler)
+ {
+ switch (key)
+ {
+ case RuntimeInfoKey.Bluetooth:
+ handler = BluetoothEnabled;
+ break;
+ case RuntimeInfoKey.WifiHotspot:
+ handler = WifiHotspotEnabled;
+ break;
+ case RuntimeInfoKey.BluetoothTethering:
+ handler = BluetoothTetheringEnabled;
+ break;
+ case RuntimeInfoKey.UsbTethering:
+ handler = UsbTetheringEnabled;
+ break;
+ case RuntimeInfoKey.PacketData:
+ handler = PacketDataEnabled;
+ break;
+ case RuntimeInfoKey.DataRoaming:
+ handler = DataRoamingEnabled;
+ break;
+ case RuntimeInfoKey.Vibration:
+ handler = VibrationEnabled;
+ break;
+ case RuntimeInfoKey.AudioJack:
+ handler = AudioJackConnected;
+ break;
+ case RuntimeInfoKey.Gps:
+ handler = GpsStatusChanged;
+ break;
+ case RuntimeInfoKey.BatteryIsCharging:
+ handler = BatteryIsCharging;
+ break;
+ case RuntimeInfoKey.TvOut:
+ handler = TvOutConnected;
+ break;
+ case RuntimeInfoKey.AudioJackConnector:
+ handler = AudioJackConnectorChanged;
+ break;
+ case RuntimeInfoKey.Charger:
+ handler = ChargerConnected;
+ break;
+ case RuntimeInfoKey.AutoRotation:
+ handler = AutoRotationEnabled;
+ break;
+ default:
+ handler = null;
+ break;
+ }
+ }
+
+ /// <summary>
+ /// Registers a change event callback for given key.
+ /// </summary>
+ /// <param name="key">The runtime information key which wants to register callback.</param>
+ /// <param name="callback">The callback function to subscribe.</param>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+ /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
+ internal static void SetCallback(RuntimeInfoKey key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+ {
+ RuntimeInfoEventHandler handler = null;
+
+ FindEventHandler(key, ref handler);
+ if (handler == null)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ handler.EventHandler += callback;
+ }
+
+ /// <summary>
+ /// Unregisters a change event callback for given key.
+ /// </summary>
+ /// <param name="key">The runtime information key which wants to unregister callback.</param>
+ /// <param name="callback">The callback function to unsubscribe.</param>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+ internal static void UnsetCallback(RuntimeInfoKey key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+ {
+ RuntimeInfoEventHandler handler = null;
+
+ FindEventHandler(key, ref handler);
+ if (handler == null)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ handler.EventHandler -= callback;
+ }
+ }
+}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.ComponentModel;
+
+namespace Tizen.System
+{
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal class RuntimeInfoEventHandler
+ {
+ private RuntimeInfoKey Key;
+ private event EventHandler<RuntimeFeatureStatusChangedEventArgs> Handler;
+
+ internal RuntimeInfoEventHandler(RuntimeInfoKey key)
+ {
+ Key = key;
+ Handler = null;
+ }
+
+ internal event EventHandler<RuntimeFeatureStatusChangedEventArgs> EventHandler
+ {
+ add
+ {
+ if (Handler == null)
+ {
+ InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(TvProductHelper.ConvertKeyIfTvProduct(Key), RuntimeInformationChangedCallback, IntPtr.Zero);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+ InformationErrorFactory.ThrowException(ret);
+ }
+ }
+ Handler += value;
+ }
+ remove
+ {
+ Handler -= value;
+ if (Handler == null)
+ {
+ InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(TvProductHelper.ConvertKeyIfTvProduct(Key));
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+ InformationErrorFactory.ThrowException(ret);
+ }
+ }
+ }
+ }
+
+ private void RuntimeInformationChangedCallback(RuntimeInfoKey key, IntPtr userData)
+ {
+ RuntimeFeatureStatusChangedEventArgs eventArgs = new RuntimeFeatureStatusChangedEventArgs()
+ {
+ Key = Information.HttpPrefix + Information.RuntimeInfoStringKeyPrefix + (Information.EnumStringMapping.ContainsKey(key) ? Information.EnumStringMapping[key] : "Invalid")
+ };
+
+ Handler?.Invoke(null, eventArgs);
+ }
+ }
+}
+++ /dev/null
-/*
-* 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.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.ComponentModel;
-
-namespace Tizen.System
-{
- /// <summary>
- /// The RuntimeInformation provides functions to obtain the runtime information of various system preferences.
- /// </summary>
- public static class RuntimeInformation
- {
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_bluetoothEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_wifiHotspotEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_bluetoothTetheringEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_usbTetheringEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_packetDataEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_dataRoamingEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_vibrationEnabled;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_audioJackConnected;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_gpsStatusChanged;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_batteryIsCharging;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_tvOutConnected;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_audioJackConnectorChanged;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_chargerConnected;
- private static event EventHandler<RuntimeKeyStatusChangedEventArgs> s_autoRotationEnabled;
-
- private static readonly Interop.RuntimeInfo.RuntimeInformationChangedCallback s_runtimeInfoChangedCallback = (RuntimeInformationKey key, IntPtr userData) =>
- {
- RuntimeKeyStatusChangedEventArgs eventArgs = new RuntimeKeyStatusChangedEventArgs()
- {
- Key = key
- };
- switch (key)
- {
- case RuntimeInformationKey.Bluetooth:
- {
- s_bluetoothEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.WifiHotspot:
- {
- s_wifiHotspotEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.BluetoothTethering:
- {
- s_bluetoothTetheringEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.UsbTethering:
- {
- s_usbTetheringEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.PacketData:
- {
- s_packetDataEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.DataRoaming:
- {
- s_dataRoamingEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.Vibration:
- {
- s_vibrationEnabled?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.AudioJack:
- {
- s_audioJackConnected?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.Gps:
- {
- s_gpsStatusChanged?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.BatteryIsCharging:
- {
- s_batteryIsCharging?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.TvOut:
- {
- s_tvOutConnected?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.AudioJackConnector:
- {
- s_audioJackConnectorChanged?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.Charger:
- {
- s_chargerConnected?.Invoke(null, eventArgs);
- break;
- };
- case RuntimeInformationKey.AutoRotation:
- {
- s_autoRotationEnabled?.Invoke(null, eventArgs);
- break;
- };
- default:
- break;
- };
- };
-
- internal static readonly Dictionary<RuntimeInformationKey, Type> s_keyDataTypeMapping = new Dictionary<RuntimeInformationKey, Type>
- {
- [RuntimeInformationKey.Bluetooth] = typeof(bool),
- [RuntimeInformationKey.WifiHotspot] = typeof(bool),
- [RuntimeInformationKey.BluetoothTethering] = typeof(bool),
- [RuntimeInformationKey.UsbTethering] = typeof(bool),
- [RuntimeInformationKey.PacketData] = typeof(bool),
- [RuntimeInformationKey.DataRoaming] = typeof(bool),
- [RuntimeInformationKey.Vibration] = typeof(bool),
- [RuntimeInformationKey.AudioJack] = typeof(bool),
- [RuntimeInformationKey.BatteryIsCharging] = typeof(bool),
- [RuntimeInformationKey.TvOut] = typeof(bool),
- [RuntimeInformationKey.Charger] = typeof(bool),
- [RuntimeInformationKey.AutoRotation] = typeof(bool),
- [RuntimeInformationKey.Gps] = typeof(int),
- [RuntimeInformationKey.AudioJackConnector] = typeof(int)
- };
-
- internal static readonly Dictionary<RuntimeInformationKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInformationKey, int>
- {
- [RuntimeInformationKey.Bluetooth] = 5,
- [RuntimeInformationKey.WifiHotspot] = 6,
- [RuntimeInformationKey.BluetoothTethering] = 7,
- [RuntimeInformationKey.UsbTethering] = 8,
- [RuntimeInformationKey.PacketData] = 13,
- [RuntimeInformationKey.DataRoaming] = 14,
- [RuntimeInformationKey.Vibration] = 16,
- [RuntimeInformationKey.AudioJack] = 20,
- [RuntimeInformationKey.BatteryIsCharging] = 22,
- [RuntimeInformationKey.TvOut] = 18,
- [RuntimeInformationKey.Charger] = 26,
- [RuntimeInformationKey.AutoRotation] = 28,
- [RuntimeInformationKey.Gps] = 21,
- [RuntimeInformationKey.AudioJackConnector] = 20
- };
-
- internal static int is_TV_product = -1;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- /// This function is for a TV product. It will be removed.
- internal static RuntimeInformationKey ConvertKeyIfTvProduct(RuntimeInformationKey key)
- {
- bool is_key_existed = false;
- string profile;
- int key_TV = -1;
-
- if (is_TV_product == -1)
- {
- is_key_existed = SystemInfo.TryGetValue<string>("http://com.samsung/build_config/product_type", out profile);
- if (is_key_existed && String.Compare(profile, "TV") == 0)
- {
- is_TV_product = 1;
- }
- else
- {
- is_TV_product = 0;
- }
- }
-
- if (is_TV_product == 0)
- {
- return key;
- }
- else
- {
- if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV))
- {
- RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
- }
- return (RuntimeInformationKey)key_TV;
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static object GetStatus(RuntimeInformationKey key)
- {
- Type value;
- if (!s_keyDataTypeMapping.TryGetValue(key, out value))
- {
- RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
- }
-
- if (s_keyDataTypeMapping[key] == typeof(int))
- {
- int status;
- int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- return status;
- }
- else
- {
- bool status;
- int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- return status;
- }
- }
-
- /// <summary>
- /// Validates the data type of the status represented by the runtime key.
- /// Note that this is a generic method.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <typeparam name="T">The generic type to validate.</typeparam>
- /// <param name="key">The runtime information key for which the status type is validated.</param>
- /// <returns>True if the data type matches.</returns>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
- public static bool Is<T>(RuntimeInformationKey key)
- {
- if (!s_keyDataTypeMapping.ContainsKey(key))
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid data type");
- throw new ArgumentException("Invalid parameter");
- }
-
- return s_keyDataTypeMapping[key] == typeof(T);
- }
-
- /// <summary>
- /// Gets the status of runtime key.
- /// Note that this is a generic method.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <typeparam name="T">The generic type to return.</typeparam>
- /// <param name="key">The runtime information key for which the current should be read.</param>
- /// <returns>The current status of the given key.</returns>.
- /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
- /// <exception cref="IOException">Thrown when I/O error occurs while reading from the system.</exception>
- /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
- public static T GetStatus<T>(RuntimeInformationKey key)
- {
- return (T)GetStatus(key);
- }
-
- /// <summary>
- /// Gets the system memory information.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>The system memory information structure.</returns>
- /// <exception cref="IOException">Thrown when I/O error occurs while reading from the system.</exception>
- public static SystemMemoryInformation GetSystemMemoryInformation()
- {
- Interop.RuntimeInfo.MemoryInfo info = new Interop.RuntimeInfo.MemoryInfo();
- int ret = Interop.RuntimeInfo.GetSystemMemoryInfo(out info);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get System memory information");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- return new SystemMemoryInformation(info);
- }
-
- /// <summary>
- /// Gets the memory information per process.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="pid">List of unique process ids.</param>
- /// <returns>List of memory information per process.</returns>
- /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
- /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
- public static IDictionary<int, ProcessMemoryInformation> GetProcessMemoryInformation(IEnumerable<int> pid)
- {
- int[] processArray = pid.ToArray<int>();
- Interop.RuntimeInfo.ProcessMemoryInfo[] processMemoryArray = new Interop.RuntimeInfo.ProcessMemoryInfo[pid.Count<int>()];
- Dictionary<int, ProcessMemoryInformation> map = new Dictionary<int, ProcessMemoryInformation>();
- int ret = Interop.RuntimeInfo.GetProcessMemoryInfo(processArray, pid.Count<int>(), out processMemoryArray);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process memory information");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- int idx = 0;
- foreach (Interop.RuntimeInfo.ProcessMemoryInfo cur in processMemoryArray)
- {
- ProcessMemoryInformation processMemory = new ProcessMemoryInformation(cur);
- map.Add(processArray[idx], processMemory);
- idx++;
- }
-
- return map;
- }
-
- /// <summary>
- /// Gets the system CPU usage time.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>The system CPU usage time structure.</returns>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system.</exception>
- public static CpuUsage GetCpuUsage()
- {
- Interop.RuntimeInfo.CpuUsage usage = new Interop.RuntimeInfo.CpuUsage();
- int ret = Interop.RuntimeInfo.GetCpuUsage(out usage);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get cpu usage");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- return new CpuUsage(usage);
- }
-
- /// <summary>
- /// Gets the CPU usage time per process.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="pid">List of unique process ids.</param>
- /// <returns>List of CPU usage information per process.</returns>
- /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
- /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
- public static IDictionary<int, ProcessCpuUsage> GetProcessCpuUsage(IEnumerable<int> pid)
- {
- int[] processArray = pid.ToArray<int>();
- Interop.RuntimeInfo.ProcessCpuUsage[] processCpuUsageArray = new Interop.RuntimeInfo.ProcessCpuUsage[pid.Count<int>()];
- Dictionary<int, ProcessCpuUsage> map = new Dictionary<int, ProcessCpuUsage>();
- int ret = Interop.RuntimeInfo.GetProcessCpuUsage(processArray, pid.Count<int>(), out processCpuUsageArray);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process cpu usage");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- int idx = 0;
- foreach (Interop.RuntimeInfo.ProcessCpuUsage cur in processCpuUsageArray)
- {
- ProcessCpuUsage processUsage = new ProcessCpuUsage(cur);
- map.Add(processArray[idx], processUsage);
- idx++;
- }
-
- return map;
- }
-
- /// <summary>
- /// Gets the number of processors.
- /// </summary>
- /// <value>The number of processors.</value>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from system.</exception>
- public static int ProcessorCount
- {
- get
- {
- int count;
- int ret = Interop.RuntimeInfo.GetProcessorCount(out count);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor count");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
-
- return count;
- }
- }
-
- /// <summary>
- /// Gets the current frequency of the processor.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="coreId">The index (from 0) of the CPU core that you want to know the frequency of.</param>
- /// <returns>The current frequency(MHz) of processor.</returns>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="coreid"/> is invalid.</exception>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from system.</exception>
- /// <exception cref="NotSupportedException">Thrown when this system does not store the current CPU frequency.</exception>
- public static int GetProcessorCurrentFrequency(int coreId)
- {
- int frequency;
- int ret = Interop.RuntimeInfo.GetProcessorCurrentFrequency(coreId, out frequency);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor current frequency");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- return frequency;
- }
-
- /// <summary>
- /// Gets the max frequency of the processor.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="coreId">The index (from 0) of CPU core that you want to know the frequency of.</param>
- /// <returns>The max frequency(MHz) of processor.</returns>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="coreid"/> is invalid.</exception>
- /// <exception cref="IOException">Thrown when an I/O error occurs while reading from system.</exception>
- /// <exception cref="NotSupportedException">Thrown when this system does not store the max CPU frequency.</exception>
- public static int GetProcessorMaxFrequency(int coreId)
- {
- int frequency;
- int ret = Interop.RuntimeInfo.GetProcessorMaxFrequency(coreId, out frequency);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor max frequency");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- return frequency;
- }
-
- /// <summary>
- /// (event) BluetoothEnabled is raised when the system preference for Bluetooth is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> BluetoothEnabled
- {
- add
- {
- if (s_bluetoothEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_bluetoothEnabled += value;
- }
- remove
- {
- s_bluetoothEnabled -= value;
- if (s_bluetoothEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) WifiHotspotEnabled is raised when the system preference for Wi-Fi is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> WifiHotspotEnabled
- {
- add
- {
- if (s_wifiHotspotEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_wifiHotspotEnabled += value;
- }
- remove
- {
- s_wifiHotspotEnabled -= value;
- if (s_wifiHotspotEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) BluetoothTetheringEnabled is raised when the system preference for bluetooth tethering is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> BluetoothTetheringEnabled
- {
- add
- {
- if (s_bluetoothTetheringEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_bluetoothTetheringEnabled += value;
- }
- remove
- {
- s_bluetoothTetheringEnabled -= value;
- if (s_bluetoothTetheringEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) UsbTetheringEnabled is raised when the system preference for USB tethering is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> UsbTetheringEnabled
- {
- add
- {
- if (s_usbTetheringEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_usbTetheringEnabled += value;
- }
- remove
- {
- s_usbTetheringEnabled -= value;
- if (s_usbTetheringEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) PacketDataEnabled is raised when the system preference for package data through 3G network is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> PacketDataEnabled
- {
- add
- {
- if (s_packetDataEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_packetDataEnabled += value;
- }
- remove
- {
- s_packetDataEnabled -= value;
- if (s_packetDataEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) DataRoamingEnabled is raised when the system preference for data roaming is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> DataRoamingEnabled
- {
- add
- {
- if (s_dataRoamingEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_dataRoamingEnabled += value;
- }
- remove
- {
- s_dataRoamingEnabled -= value;
- if (s_dataRoamingEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) VibrationEnabled is raised when the system preference for vibration is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> VibrationEnabled
- {
- add
- {
- if (s_vibrationEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_vibrationEnabled += value;
- }
- remove
- {
- s_vibrationEnabled -= value;
- if (s_vibrationEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) AudioJackConnected is raised when the audio jack is connected/disconnected.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> AudioJackConnected
- {
- add
- {
- if (s_audioJackConnected == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_audioJackConnected += value;
- }
- remove
- {
- s_audioJackConnected -= value;
- if (s_audioJackConnected == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) GpsStatusChanged is raised when the status of GPS is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> GpsStatusChanged
- {
- add
- {
- if (s_gpsStatusChanged == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_gpsStatusChanged += value;
- }
- remove
- {
- s_gpsStatusChanged -= value;
- if (s_gpsStatusChanged == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) BatteryIsCharging is raised when the battery is currently charging.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> BatteryIsCharging
- {
- add
- {
- if (s_batteryIsCharging == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_batteryIsCharging += value;
- }
- remove
- {
- s_batteryIsCharging -= value;
- if (s_batteryIsCharging == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) TvOutConnected is raised when TV out is connected/disconnected.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> TvOutConnected
- {
- add
- {
- if (s_tvOutConnected == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_tvOutConnected += value;
- }
- remove
- {
- s_tvOutConnected -= value;
- if (s_tvOutConnected == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) AudioJackConnectorChanged is raised when the audio jack connection changes.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> AudioJackConnectorChanged
- {
- add
- {
- if (s_audioJackConnectorChanged == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_audioJackConnectorChanged += value;
- }
- remove
- {
- s_audioJackConnectorChanged -= value;
- if (s_audioJackConnectorChanged == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) ChargerConnected is raised when the charger is connected/disconnected.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> ChargerConnected
- {
- add
- {
- if (s_chargerConnected == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_chargerConnected += value;
- }
- remove
- {
- s_chargerConnected -= value;
- if (s_chargerConnected == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- /// <summary>
- /// (event) AutoRotationEnabled is raised when the system preference for auto rotation is changed.
- /// </summary>
- public static event EventHandler<RuntimeKeyStatusChangedEventArgs> AutoRotationEnabled
- {
- add
- {
- if (s_autoRotationEnabled == null)
- {
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation), s_runtimeInfoChangedCallback, IntPtr.Zero);
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- s_autoRotationEnabled += value;
- }
- remove
- {
- s_autoRotationEnabled -= value;
- if (s_autoRotationEnabled == null)
- {
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation));
- if (ret != (int)RuntimeInfoError.None)
- {
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
- RuntimeInfoErrorFactory.ThrowException(ret);
- }
- }
- }
- }
- }
-}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.System
+{
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal static class TvProductHelper
+ {
+ private static int is_TV_product = -1;
+
+ private static readonly Dictionary<RuntimeInfoKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInfoKey, int>
+ {
+ [RuntimeInfoKey.Bluetooth] = 5,
+ [RuntimeInfoKey.WifiHotspot] = 6,
+ [RuntimeInfoKey.BluetoothTethering] = 7,
+ [RuntimeInfoKey.UsbTethering] = 8,
+ [RuntimeInfoKey.PacketData] = 13,
+ [RuntimeInfoKey.DataRoaming] = 14,
+ [RuntimeInfoKey.Vibration] = 16,
+ [RuntimeInfoKey.AudioJack] = 20,
+ [RuntimeInfoKey.BatteryIsCharging] = 22,
+ [RuntimeInfoKey.TvOut] = 18,
+ [RuntimeInfoKey.Charger] = 26,
+ [RuntimeInfoKey.AutoRotation] = 28,
+ [RuntimeInfoKey.Gps] = 21,
+ [RuntimeInfoKey.AudioJackConnector] = 20
+ };
+
+ /// This function is for a TV product. It will be removed.
+ internal static RuntimeInfoKey ConvertKeyIfTvProduct(RuntimeInfoKey key)
+ {
+ bool is_key_existed = false;
+ string profile;
+ int key_TV = -1;
+
+ if (is_TV_product == -1)
+ {
+ is_key_existed = SystemInfo.TryGetValue<string>("http://com.samsung/build_config/product_type", out profile);
+ if (is_key_existed && String.Compare(profile, "TV") == 0)
+ {
+ is_TV_product = 1;
+ }
+ else
+ {
+ is_TV_product = 0;
+ }
+ }
+
+ if (is_TV_product == 0)
+ {
+ return key;
+ }
+ else
+ {
+ if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV))
+ {
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+ return (RuntimeInfoKey)key_TV;
+ }
+ }
+ }
+}
namespace Tizen.System
{
- /// <summary>
- /// System Information class. This class has methods which can be used to obtain device information.
- /// </summary>
- public static class SystemInfo
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal static class SystemInfo
{
- private const string LogTag = "Tizen.System";
-
[EditorBrowsable(EditorBrowsableState.Never)]
private static Interop.SystemInfo.SystemInfoType GetValueType(string key, out Interop.SystemInfo.SystemInfoValueType valueType)
{
- Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.SystemInfoGetPlatformType(key, out valueType);
- if (err == Interop.SystemInfo.ErrorCode.None)
+ InformationError err = Interop.SystemInfo.SystemInfoGetPlatformType(key, out valueType);
+ if (err == InformationError.None)
{
return Interop.SystemInfo.SystemInfoType.platform;
}
- Log.Debug(LogTag, string.Format("Key {0} not in platform system info", key));
+ Log.Debug(InformationErrorFactory.LogTag, string.Format("Key {0} not in platform system info", key));
err = Interop.SystemInfo.SystemInfoGetCustomType(key, out valueType);
- if (err == Interop.SystemInfo.ErrorCode.None)
+ if (err == InformationError.None)
{
return Interop.SystemInfo.SystemInfoType.Custom;
}
- Log.Debug(LogTag, string.Format("Key {0} not in custom system info", key));
+ Log.Debug(InformationErrorFactory.LogTag, string.Format("Key {0} not in custom system info", key));
return Interop.SystemInfo.SystemInfoType.None;
}
/// <summary>
/// Checks if the type of value for the given feature is T.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <typeparam name="T">Type of value for the feature key.</typeparam>
/// <param name="key">The name of the feature.</param>
/// <returns>True if type of value for the given feature is T, otherwise false.</returns>
- public static bool Is<T>(string key)
+ internal static bool Is<T>(string key)
{
Interop.SystemInfo.SystemInfoValueType valueType;
Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
/// <summary>
/// Checks if the given key is a valid feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <param name="key">The name of the feature.</param>
/// <returns>True if the key is valid, otherwise false.</returns>
- public static bool IsValidKey(string key)
+ internal static bool IsValidKey(string key)
{
Interop.SystemInfo.SystemInfoValueType valueType;
return GetValueType(key, out valueType) != Interop.SystemInfo.SystemInfoType.None;
/// <summary>
/// Gets the value of the feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <typeparam name="T">Type of key value.</typeparam>
/// <param name="key">The name of the feature.</param>
/// <param name="value">The value of the given feature.</param>
/// <returns>Returns true on success, otherwise false.</returns>
- public static bool TryGetValue<T>(string key, out T value)
+ internal static bool TryGetValue<T>(string key, out T value)
{
bool res = false;
if (typeof(T) == typeof(bool))
/// <summary>
/// Gets the bool value of the feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <param name="key">The name of the feature.</param>
/// <param name="value">The value of the given feature.</param>
/// <returns>Returns true on success, otherwise false.</returns>
- public static bool TryGetValue(string key, out bool value)
+ internal static bool TryGetValue(string key, out bool value)
{
Interop.SystemInfo.SystemInfoValueType valueType;
Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
- Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+ InformationError err = InformationError.InvalidParameter;
if (keyType == Interop.SystemInfo.SystemInfoType.platform)
{
err = Interop.SystemInfo.SystemInfoGetPlatformBool(key, out value);
value = false;
}
- if (err != Interop.SystemInfo.ErrorCode.None)
+ if (err != InformationError.None)
{
- Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+ Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
return false;
}
/// <summary>
/// Gets the int value of the feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <param name="key">The name of the feature.</param>
/// <param name="value">The value of the given feature.</param>
/// <returns>Returns true on success, otherwise false.</returns>
- public static bool TryGetValue(string key, out int value)
+ internal static bool TryGetValue(string key, out int value)
{
Interop.SystemInfo.SystemInfoValueType valueType;
Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
- Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+ InformationError err = InformationError.InvalidParameter;
if (keyType == Interop.SystemInfo.SystemInfoType.platform)
{
err = Interop.SystemInfo.SystemInfoGetPlatformInt(key, out value);
value = 0;
}
- if (err != Interop.SystemInfo.ErrorCode.None)
+ if (err != InformationError.None)
{
- Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+ Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
return false;
}
/// <summary>
/// Gets the double value of the feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <param name="key">The name of the feature.</param>
/// <param name="value">The value of the given feature.</param>
/// <returns>Returns true on success, otherwise false.</returns>
- public static bool TryGetValue(string key, out double value)
+ internal static bool TryGetValue(string key, out double value)
{
Interop.SystemInfo.SystemInfoValueType valueType;
Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
- Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+ InformationError err = InformationError.InvalidParameter;
if (keyType == Interop.SystemInfo.SystemInfoType.platform)
{
err = Interop.SystemInfo.SystemInfoGetPlatformDouble(key, out value);
value = 0;
}
- if (err != Interop.SystemInfo.ErrorCode.None)
+ if (err != InformationError.None)
{
- Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+ Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
return false;
}
/// <summary>
/// Gets the string value of the feature.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
/// <param name="key">The name of the feature.</param>
/// <param name="value">The value of the given feature.</param>
/// <returns>Returns true on success, otherwise false.</returns>
- public static bool TryGetValue(string key, out string value)
+ internal static bool TryGetValue(string key, out string value)
{
Interop.SystemInfo.SystemInfoValueType valueType;
Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
- Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+ InformationError err = InformationError.InvalidParameter;
if (keyType == Interop.SystemInfo.SystemInfoType.platform)
{
err = Interop.SystemInfo.SystemInfoGetPlatformString(key, out value);
value = string.Empty;
}
- if (err != Interop.SystemInfo.ErrorCode.None)
+ if (err != InformationError.None)
{
- Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+ Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
return false;
}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+namespace Tizen.System
+{
+ /// <summary>
+ /// The class for CPU usage per process.
+ /// </summary>
+ public class ProcessCpuUsage
+ {
+ private int[] Pids;
+ private Interop.RuntimeInfo.ProcessCpuUsage[] Usages;
+
+ /// <summary>
+ /// The constructor of ProcessCpuUsage class.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">List of unique process ids.</param>
+ /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
+ public ProcessCpuUsage(IEnumerable<int> pid)
+ {
+ Update(pid);
+ }
+
+ /// <summary>
+ /// The number of usage entries.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Count { get; internal set; }
+
+ /// <summary>
+ /// Gets the amount of time this process has been scheduled in user mode.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The amount of time <paramref name="pid"/> has been scheduled in user mode (clock ticks).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public uint GetUTime(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].UTime;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the amount of time this process has been scheduled in kernel mode.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The amount of time <paramref name="pid"/> has been scheduled in kernel mode (clock ticks).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public uint GetSTime(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].STime;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Update the process CPU usage to the latest.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">List of unique process ids.</param>
+ /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
+ public void Update(IEnumerable<int> pid)
+ {
+ InformationError ret;
+
+ Pids = pid.ToArray<int>();
+ IntPtr ptr = new IntPtr();
+ Count = Pids.Count<int>();
+
+ ret = Interop.RuntimeInfo.GetProcessCpuUsage(Pids, Count, ref ptr);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Process cpu usage");
+ InformationErrorFactory.ThrowException(ret);
+ }
+
+ Usages = new Interop.RuntimeInfo.ProcessCpuUsage[Count];
+ for (int i = 0; i < Count; i++)
+ {
+ Usages[i] = Marshal.PtrToStructure<Interop.RuntimeInfo.ProcessCpuUsage>(ptr);
+ ptr += Marshal.SizeOf<Interop.RuntimeInfo.ProcessCpuUsage>();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+namespace Tizen.System
+{
+ /// <summary>
+ /// The class for memory information per process.
+ /// </summary>
+ public class ProcessMemoryUsage
+ {
+ private int[] Pids;
+ private Interop.RuntimeInfo.ProcessMemoryInfo[] Usages;
+
+ /// <summary>
+ /// The constructor of ProcessMemoryInformation class.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">List of unique process ids.</param>
+ /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
+ public ProcessMemoryUsage(IEnumerable<int> pid)
+ {
+ Update(pid);
+ }
+
+ /// <summary>
+ /// The number of usage entries.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Count { get; internal set; }
+
+ /// <summary>
+ /// Gets the virtual memory size of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The virtual memory size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetVsz(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].Vsz;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the resident set size of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The resident set size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetRss(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].Rss;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the proportional set size of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The proportional set size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetPss(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].Pss;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the size not modified and mapped by other processes of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The shared clean memory size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetSharedClean(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].SharedClean;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the size modified and mapped by other processes of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The shared dirty memory size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetSharedDirty(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].SharedDirty;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the size not modified and available only to that process of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The private clean memory size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetPrivateClean(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].PrivateClean;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets the size modified and available only to that process of a process.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">The process id.</param>
+ /// <returns>The private dirty memory size <paramref name="pid"/> is using (KiB).</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is invalid.</exception>
+ public int GetPrivateDirty(int pid)
+ {
+ for (int i = 0; i < Count; i++)
+ if (pid == Pids[i])
+ return Usages[i].PrivateDirty;
+
+ Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ return 0;
+ }
+
+ /// <summary>
+ /// Update the process memory information to the latest.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="pid">List of unique process ids.</param>
+ /// <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="pid"/> is empty.</exception>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
+ public void Update(IEnumerable<int> pid)
+ {
+ InformationError ret;
+
+ Pids = pid.ToArray<int>();
+ IntPtr ptr = new IntPtr();
+ Count = Pids.Count<int>();
+
+ ret = Interop.RuntimeInfo.GetProcessMemoryInfo(Pids, Count, ref ptr);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Process cpu usage");
+ InformationErrorFactory.ThrowException(ret);
+ }
+
+ Usages = new Interop.RuntimeInfo.ProcessMemoryInfo[Count];
+ for (int i = 0; i < Count; i++)
+ {
+ Usages[i] = Marshal.PtrToStructure<Interop.RuntimeInfo.ProcessMemoryInfo>(ptr);
+ ptr += Marshal.SizeOf<Interop.RuntimeInfo.ProcessCpuUsage>();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System;
+using System.IO;
+
+namespace Tizen.System
+{
+ /// <summary>
+ /// The class for system CPU usage.
+ /// </summary>
+ public class SystemCpuUsage
+ {
+ private Interop.RuntimeInfo.CpuUsage Usage;
+ private int[] CurrentFrequencies;
+ private int[] MaxFrequencies;
+
+ /// <summary>
+ /// The constructor of SystemCpuUsage class.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system.</exception>
+ /// <exception cref="NotSupportedException">Thrown when this system does not store the current CPU frequency.</exception>
+ public SystemCpuUsage()
+ {
+ Update();
+ }
+
+ /// <summary>
+ /// Running time of un-niced user processes (Percent).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public double User
+ {
+ get
+ {
+ return Usage.User;
+ }
+ }
+
+ /// <summary>
+ /// Running time of kernel processes (Percent).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public double System
+ {
+ get
+ {
+ return Usage.System;
+ }
+ }
+
+ /// <summary>
+ /// Running time of niced user processes (Percent).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public double Nice
+ {
+ get
+ {
+ return Usage.Nice;
+ }
+ }
+
+ /// <summary>
+ /// Time waiting for I/O completion (Percent).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public double IoWait
+ {
+ get
+ {
+ return Usage.IoWait;
+ }
+ }
+
+ /// <summary>
+ /// The number of processors.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int ProcessorCount { get; internal set; }
+
+ /// <summary>
+ /// Gets the current frequency of the processor.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="coreId">The index (from 0) of the CPU core that you want to know the frequency of.</param>
+ /// <returns>The current frequency(MHz) of processor.</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="coreId"/> is invalid.</exception>
+ public int GetCurrentFrequency(int coreId)
+ {
+ if(coreId < 0 || coreId >= ProcessorCount)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid core ID " + coreId);
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ return CurrentFrequencies[coreId];
+ }
+
+ /// <summary>
+ /// Gets the max frequency of the processor.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="coreId">The index (from 0) of CPU core that you want to know the frequency of.</param>
+ /// <returns>The max frequency(MHz) of processor.</returns>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="coreId"/> is invalid.</exception>
+ public int GetMaxFrequency(int coreId)
+ {
+ if (coreId < 0 || coreId >= ProcessorCount)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Invalid core ID " + coreId);
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+ }
+
+ return MaxFrequencies[coreId];
+ }
+
+ /// <summary>
+ /// Update the system CPU usage to the latest.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system.</exception>
+ /// <exception cref="NotSupportedException">Thrown when this system does not store the current CPU frequency.</exception>
+ public void Update()
+ {
+ InformationError ret;
+ int count;
+
+ ret = Interop.RuntimeInfo.GetCpuUsage(out Usage);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get cpu usage");
+ InformationErrorFactory.ThrowException(ret);
+ }
+
+ ret = Interop.RuntimeInfo.GetProcessorCount(out count);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Processor count");
+ InformationErrorFactory.ThrowException(ret);
+ return;
+ }
+
+ ProcessorCount = count;
+ CurrentFrequencies = new int[ProcessorCount];
+ MaxFrequencies = new int[ProcessorCount];
+
+ for (int coreId = 0; coreId < ProcessorCount; coreId++)
+ {
+ ret = Interop.RuntimeInfo.GetProcessorCurrentFrequency(coreId, out CurrentFrequencies[coreId]);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get the current frequency of processor " + coreId);
+ InformationErrorFactory.ThrowException(ret);
+ }
+
+ ret = Interop.RuntimeInfo.GetProcessorMaxFrequency(coreId, out MaxFrequencies[coreId]);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get the max frequency of processor " + coreId);
+ InformationErrorFactory.ThrowException(ret);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+* Copyright (c) 2016 - 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.
+*/
+
+using System.IO;
+
+namespace Tizen.System
+{
+ /// <summary>
+ /// The class for system memory information.
+ /// </summary>
+ public class SystemMemoryUsage
+ {
+ private Interop.RuntimeInfo.MemoryInfo Info;
+
+ /// <summary>
+ /// The constructor of MemoryInformation class.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <exception cref="IOException">Thrown when an I/O error occurs while reading from the system.</exception>
+ public SystemMemoryUsage()
+ {
+ Update();
+ }
+
+ /// <summary>
+ /// Total memory (KiB).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Total
+ {
+ get
+ {
+ return Info.Total;
+ }
+ }
+
+ /// <summary>
+ /// Used memory (KiB).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Used
+ {
+ get
+ {
+ return Info.Used;
+ }
+ }
+
+ /// <summary>
+ /// Free memory (KiB).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Free
+ {
+ get
+ {
+ return Info.Free;
+ }
+ }
+
+ /// <summary>
+ /// Cache memory (KiB).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Cache
+ {
+ get
+ {
+ return Info.Cache;
+ }
+ }
+
+ /// <summary>
+ /// Swap memory (KiB).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int Swap
+ {
+ get
+ {
+ return Info.Swap;
+ }
+ }
+
+ /// <summary>
+ /// Update the system memory information to the latest.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <exception cref="IOException">Thrown when I/O error occurs while reading from the system.</exception>
+ public void Update()
+ {
+ InformationError ret = Interop.RuntimeInfo.GetSystemMemoryInfo(out Info);
+ if (ret != InformationError.None)
+ {
+ Log.Error(InformationErrorFactory.LogTag, "Interop failed to get System memory information");
+ InformationErrorFactory.ThrowException(ret);
+ }
+ }
+ }
+}
<!-- Property Group for .NET Core Project -->
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp1.1</TargetFramework>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<!-- Property Group for Tizen Project -->