Prefix:4.0.0
-Suffix:preview1-00073
-Number:73
-VCS:870b19ef52307b189610c29bd2b4a892f3190443
+Suffix:preview1-00080
+Number:80
+VCS:b49627402170a33387280fbbece6e4fb0afbebec
Name: csapi-tizenfx
Summary: Assemblies of Tizen .NET
-Version: 4.0.0.73
+Version: 4.0.0.80
Release: 1
Group: Development/Libraries
License: Apache-2.0
%description dummy
Dummy assemblies of Tizen .NET
+%package full
+Summary: All Tizen .NET assemblies
+Group: Development/Libraries
+AutoReqProv: no
+
+%description full
+All Tizen .NET assemblies
+
+%package common
+Summary: Tizen .NET assemblies for Common profile
+Group: Development/Libraries
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%description common
+Tizen .NET assemblies for Common profile
+
+%package mobile
+Summary: Tizen .NET assemblies for Mobile profile
+Group: Development/Libraries
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%description mobile
+Tizen .NET assemblies for Mobile profile
+
+%package mobile-emul
+Summary: Tizen .NET assemblies for Emulator of Mobile profile
+Group: Development/Libraries
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%description mobile-emul
+Tizen .NET assemblies for Emulator of Mobile profile
+
%package tv
Summary: Tizen .NET assemblies for TV profile
Group: Development/Libraries
%description tv
Tizen .NET assemblies for TV profile
+%package ivi
+Summary: Tizen .NET assemblies for IVI profile
+Group: Development/Libraries
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%description ivi
+Tizen .NET assemblies for IVI profile
+
+%package wearable
+Summary: Tizen .NET assemblies for Wearable profile
+Group: Development/Libraries
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%description wearable
+Tizen .NET assemblies for Wearable profile
+
%prep
%setup -q
cp %{SOURCE1} .
%build
+./scripts/filelist.sh common > common.filelist
+./scripts/filelist.sh mobile > mobile.filelist
+./scripts/filelist.sh mobile-emul > mobile-emul.filelist
+./scripts/filelist.sh tv > tv.filelist
+./scripts/filelist.sh ivi > ivi.filelist
+./scripts/filelist.sh wearable > wearable.filelist
%install
mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_PATH}
install -p -m 644 binaries/frameworks_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
install -p -m 644 binaries/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
-%files
+%files nuget
+%{DOTNET_NUGET_SOURCE}/*.nupkg
+
+%files dummy
+%attr(644,root,root) %{DOTNET_ASSEMBLY_DUMMY_PATH}/*.dll
+
+%files full
%manifest %{name}.manifest
%license LICENSE
%attr(644,root,root) %{DOTNET_ASSEMBLY_PATH}/*.dll
%attr(644,root,root) %{DOTNET_ASSEMBLY_RES_PATH}/*
-%files nuget
-%{DOTNET_NUGET_SOURCE}/*.nupkg
+%files common -f common.filelist
+%manifest %{name}.manifest
+%license LICENSE
-%files dummy
-%attr(644,root,root) %{DOTNET_ASSEMBLY_DUMMY_PATH}/*.dll
+%files mobile -f mobile.filelist
+%manifest %{name}.manifest
+%license LICENSE
+
+%files mobile-emul -f mobile-emul.filelist
+%manifest %{name}.manifest
+%license LICENSE
+
+%files tv -f tv.filelist
+%manifest %{name}.manifest
+%license LICENSE
+
+%files ivi -f ivi.filelist
+%manifest %{name}.manifest
+%license LICENSE
-%files tv -f csapi-tizenfx-tv.files
+%files wearable -f wearable.filelist
%manifest %{name}.manifest
%license LICENSE
namespace Tizen.Applications
{
/// <summary>
- /// The Alarm API allows setting an "alarm clock" for the delivery of a notification at some point in the future.
+ /// The alarm API allows setting an "alarm clock" for the delivery of a notification at some point in the future.
/// </summary>
/// <example>
/// <code>
private const string _logTag = "Tizen.Applications.Alarm";
/// <summary>
- /// Constructor created with new AlarmId.
+ /// Constructor created with the new AlarmId.
/// </summary>
/// <param name="id"></param>
internal Alarm(int id)
/// </summary>
/// <privilege>http://tizen.org/privilege/alarm.get</privilege>
/// <remarks>
- /// week_flag may be a combination of days, like Tuesday | Friday
+ /// week_flag may be a combination of days, like Tuesday | Friday.
/// </remarks>
public AlarmWeekFlag WeekFlag
{
}
/// <summary>
- /// Cancels the the specific alarm.
+ /// Cancels the specific alarm.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied due to insufficient previlleges.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied due to insufficient privileges.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public void Cancel()
using Tizen.Applications.Notifications;
/// <summary>
- /// Enumeration for Alarm Week Flag, the days of the week.
+ /// Enumeration for alarm week flag, the days of the week.
/// </summary>
[Flags]
public enum AlarmWeekFlag
{
/// <summary>
- /// Identifier for Sunday.
+ /// An identifier for Sunday.
/// </summary>
Sunday = 0x01,
/// <summary>
- /// Identifier for Monday.
+ /// An identifier for Monday.
/// </summary>
Monday = 0x02,
/// <summary>
- /// Identifier for Tuesday.
+ /// An identifier for Tuesday.
/// </summary>
Tuesday = 0x04,
/// <summary>
- /// Identifier for Wednesday.
+ /// An identifier for Wednesday.
/// </summary>
Wednesday = 0x08,
/// <summary>
- /// Identifier for Thursday.
+ /// An identifier for Thursday.
/// </summary>
Thursday = 0x10,
/// <summary>
- /// Identifier for Friday.
+ /// An identifier for Friday.
/// </summary>
Friday = 0x20,
/// <summary>
- /// Identifier for Saturday.
+ /// An identifier for Saturday.
/// </summary>
Saturday = 0x40,
/// <summary>
- /// All Days of the Week.
+ /// All days of the week.
/// </summary>
AllDays = Sunday |Monday|Tuesday|Wednesday|Thursday|Friday|Saturday,
/// <summary>
- /// Only Weekdays
+ /// Only weekdays.
/// </summary>
WeekDays = Monday | Tuesday | Wednesday | Thursday | Friday
}
/// <summary>
- /// Mobile devices typically give constant access to information from various sources.Some of this information is best delivered through alarms -
- /// the most obvious case is a calendar scheduling application which lets you know when a meeting is about to start.Alarms are certainly better than actively waiting in a loop.
+ /// Mobile devices typically give constant access to information from various sources. Some of this information is best delivered through alarms.
+ /// The most obvious case is a calendar scheduling application, which lets you know when a meeting is about to start. Alarms are certainly better than actively waiting in a loop.
/// They are also better than putting an interface to sleep because they do not block your main UI thread.
/// Use of alarms helps build smooth user experiences and implements unattended data synchronization tasks.
- /// If an application is installed after setting the alarm, your alarm is cancelled automatically.
+ /// If an application is installed after setting the alarm, your alarm is canceled automatically.
/// </summary>
/// <example>
/// <code>
/// </summary>
/// <param name="delay">The amount of time before the first execution (in seconds).</param>
/// <param name="period"> The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy.
- /// The actual interval is calculated by the OS. The minimum value is 600sec</param>
- /// <param name="appControl"> The destination AppControl to perform a specific task when the alarm is triggered </param>
- /// <returns>Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// The actual interval is calculated by the OS. The minimum value is 600sec.</param>
+ /// <param name="appControl"> The destination AppControl is used to perform a specific task when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public static Alarm CreateAlarm(int delay, int period, AppControl appControl)
/// Sets an alarm to be triggered after a specific time.
/// The alarm will go off delay seconds later.
/// </summary>
- /// <param name="delay"> The amount of time before the execution (in seconds) </param>
- /// <param name="appControl"> The destination AppControl to perform a specific task when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="delay"> The amount of time before the execution (in seconds). </param>
+ /// <param name="appControl"> The destination AppControl to perform a specific task when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public static Alarm CreateAlarm(int delay, AppControl appControl)
/// Sets an alarm to be triggered at a specific time.
/// The date describes the time of the first occurrence.
/// </summary>
- /// <param name="value"> The first active alarm time </param>
- /// <param name="appControl"> The destination AppControl to perform specific work when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <remarks>This operation is permitted wit UI application appcontrol only.</remarks>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="value"> The first active alarm time. </param>
+ /// <param name="appControl"> The destination AppControl to perform specific work when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <remarks>This operation is permitted with the UI application appcontrol only.</remarks>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public static Alarm CreateAlarm(DateTime value, AppControl appControl)
/// <summary>
/// Sets an alarm to be triggered periodically, starting at a specific time.
/// The date describes the time of the first occurrence.
- /// weekFlag is the repeat value of the days of the week.
- /// If weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
+ /// The weekFlag is the repeat value of the days of the week.
+ /// If the weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
/// </summary>
- /// <remarks>This operation is permitted wit UI application appcontrol only.</remarks>
- /// <param name="value"> The first active alarm time </param>
- /// <param name="weekFlag"> The day of the week, AlarmWeekFlag may be a combination of days, like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday</param>
- /// <param name="appControl"> The destination AppControl to perform specific work when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>This operation is permitted with UI application appcontrol only.</remarks>
+ /// <param name="value"> The first active alarm time. </param>
+ /// <param name="weekFlag"> The day of the week, AlarmWeekFlag may be a combination of days, like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday.</param>
+ /// <param name="appControl"> The destination AppControl to perform specific work when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public static Alarm CreateAlarm(DateTime value, AlarmWeekFlag weekFlag, AppControl appControl)
/// Sets a notification alarm to be triggered at a specific time.
/// The date describes the time of the first occurrence.
/// </summary>
- /// <param name="dateTime"> The first active alarm time </param>
- /// <param name="notification"> The notification to be posted when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="dateTime"> The first active alarm time. </param>
+ /// <param name="notification"> The notification to be posted when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// </summary>
/// <param name="delay">The amount of time before the first execution (in seconds). </param>
/// <param name="period"> The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy. </param>
- /// <param name="notification"> The notification to be posted when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="notification"> The notification to be posted when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// <summary>
/// Sets a notification alarm to be triggered periodically, starting at a specific time.
/// The date describes the time of the first occurrence.
- /// weekFlag is the repeat value of the days of the week.
- /// If weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
+ /// The weekFlag is the repeat value of the days of the week.
+ /// If the weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
/// </summary>
- /// <param name="dateTime"> The first active alarm time </param>
+ /// <param name="dateTime"> The first active alarm time. </param>
/// <param name="weekFlag"> The day of the week, AlarmWeekFlag may be a combination of days,
- /// like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday</param>
- /// <param name="notification"> The notification to be posted when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday.</param>
+ /// <param name="notification"> The notification to be posted when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// The alarm will go off delay seconds later.
/// </summary>
/// <param name="delay">The amount of time before the first execution (in seconds).</param>
- /// <param name="notification"> The notification to be posted when the alarm is triggered </param>
- /// <returns> Alarm Instance created with the set param values.</returns>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="notification"> The notification to be posted when the alarm is triggered. </param>
+ /// <returns> An alarm instance is created with the set param values.</returns>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// <summary>
/// Cancels all scheduled alarms that are registered by the application that calls this API.
/// </summary>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.set</privilege>
public static void CancelAll()
/// <summary>
/// Retrieves all registered alarms.
/// </summary>
- /// <returns>List of all Alarm instances.</returns>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <returns>List of all alarm instances.</returns>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/alarm.get</privilege>
public static IEnumerable<Alarm> GetAllScheduledAlarms()
/// <summary>
/// Gets the current system time.
/// </summary>
- /// <returns>The current system time</returns>
+ /// <returns>The current system time.</returns>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
public static DateTime GetCurrentTime()
{
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the License);
+ * 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,
+ * 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.Applications
{
/// <summary>
- /// Immutable class for getting information of the badge.
+ /// The class containing common properties of the Badge.
/// </summary>
public class Badge
{
- private readonly string _appId;
- private readonly int _count;
- private readonly bool _isDisplay;
+ private int count = 0;
- internal Badge(string appid, int count, bool isDisplay)
+ /// <summary>
+ /// Initializes a new instance of the Badge class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <param name="appId">Application ID</param>
+ /// <param name="count">Count value</param>
+ /// <param name="visible">True if it should be displayed</param>
+ /// <exception cref="ArgumentException">Thrown when failed because of invalid argument</exception>
+ public Badge(string appId, int count = 1, bool visible = true)
{
- _appId = appid;
- _count = count;
- _isDisplay = isDisplay;
+ if (IsNegativeNumber(count))
+ {
+ throw BadgeErrorFactory.GetException(BadgeError.InvalidParameter, "The count must be positive number");
+ }
+ AppId = appId;
+ this.count = count;
+ Visible = visible;
}
/// <summary>
{
get
{
- return _count;
+ return count;
+ }
+ set
+ {
+ if (IsNegativeNumber(value))
+ {
+ throw BadgeErrorFactory.GetException(BadgeError.InvalidParameter, "The count must be positive number");
+ }
+
+ count = value;
}
}
/// Property for the application ID of the badge.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public string AppId
- {
- get
- {
- return _appId;
- }
- }
+ public string AppId { get; set; }
/// <summary>
- /// Property for the flag of 'display'.
+ /// Property for display visibility. True if the badge display visible, otherwise false..
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public bool IsDisplay
+ public bool Visible{ get; set; }
+
+ private bool IsNegativeNumber(int number)
{
- get
- {
- return _isDisplay;
- }
+ return number < 0;
}
}
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the License);
+ * 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,
+ * 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.
/// Event handler for receiving badge events.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
public static event EventHandler<BadgeEventArgs> Changed
{
add
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="appId">Application ID.</param>
+ /// <returns>The Badge object with inputted application ID</returns>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="ArgumentException">Thrown when failed because of an invalid argument.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
public static Badge Find(string appId)
{
uint count;
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="appId">Application ID.</param>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="ArgumentException">Thrown when failed because of a an invalid argument.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
public static void Remove(string appId)
{
BadgeError err = Interop.Badge.Remove(appId);
}
/// <summary>
- /// Adds the badge information.
+ /// Removes the badge information.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="appId">Application ID.</param>
- /// <param name="count">Count value.</param>
- /// <param name="isDisplay">True if it should be displayed.</param>
+ /// <param name="badge">The Badge object.</param>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="ArgumentException">Thrown when failed because of an invalid argument.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
- public static void Add(string appId, int count = 1, bool isDisplay = true)
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
+ public static void Remove(Badge badge)
{
- BadgeError err = Interop.Badge.Add(appId);
- if (err != BadgeError.None)
+ if (badge == null)
{
- throw BadgeErrorFactory.GetException(err, "Failed to add badge of " + appId);
+ throw BadgeErrorFactory.GetException(BadgeError.InvalidParameter, "Invalid Badge object");
}
- try
- {
- Update(appId, count, isDisplay);
- }
- catch (Exception e)
- {
- Remove(appId);
- throw e;
- }
+ Remove(badge.AppId);
}
/// <summary>
- /// Updates the badge information.
+ /// Adds the badge information.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="appId">Application ID.</param>
- /// <param name="count">Count value.</param>
+ /// <param name="badge">The Badge object.</param>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="ArgumentException">Thrown when failed because of an invalid argument.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
- public static void Update(string appId, int count)
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
+ public static void Add(Badge badge)
{
- BadgeError err = Interop.Badge.SetCount(appId, (uint)count);
+ if (badge == null)
+ {
+ throw BadgeErrorFactory.GetException(BadgeError.InvalidParameter, "Invalid Badge object");
+ }
+
+ BadgeError err = Interop.Badge.Add(badge.AppId);
if (err != BadgeError.None)
{
- throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + appId);
+ throw BadgeErrorFactory.GetException(err, "Failed to add badge of " + badge.AppId);
+ }
+
+ try
+ {
+ Update(badge);
+ }
+ catch (Exception e)
+ {
+ Remove(badge.AppId);
+ throw e;
}
}
/// Updates the badge information.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="appId">Application ID.</param>
- /// <param name="isDisplay">True if it should be displayed.</param>
+ /// <param name="badge">The Badge object.</param>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="ArgumentException">Thrown when failed because of an invalid argument.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
- public static void Update(string appId, bool isDisplay)
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
+ public static void Update(Badge badge)
{
- BadgeError err = Interop.Badge.SetDisplay(appId, isDisplay ? 1U : 0U);
+ if (badge == null)
+ {
+ throw BadgeErrorFactory.GetException(BadgeError.InvalidParameter, "Invalid Badge object");
+ }
+
+ BadgeError err = Interop.Badge.SetCount(badge.AppId, (uint)badge.Count);
if (err != BadgeError.None)
{
- throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + appId);
+ throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + badge.AppId);
}
- }
- /// <summary>
- /// Updates the badge information.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="appId">Application ID.</param>
- /// <param name="count">Count value.</param>
- /// <param name="isDisplay">True if it should be displayed.</param>
- /// <exception cref="ArgumentException">Thrown when failed because of invalid argument.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
- /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
- public static void Update(string appId, int count, bool isDisplay)
- {
- Update(appId, count);
- Update(appId, isDisplay);
+ err = Interop.Badge.SetDisplay(badge.AppId, badge.Visible ? 1U : 0U);
+ if (err != BadgeError.None)
+ {
+ throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + badge.AppId);
+ }
}
/// <summary>
/// Gets all the badge information.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <returns>List of all Badge instances.</returns>
+ /// <feature>http://tizen.org/feature/badge</feature>
+ /// <privilege>http://tizen.org/privilege/notification</privilege>
/// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
- /// <privilege>http://tizen.org/privilege/notification</privilege>
+ /// <exception cref="NotSupportedException">Thrown when Badge is not supported.</exception>
public static IEnumerable<Badge> GetBadges()
{
IList<Badge> list = new List<Badge>();
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the License);
+ * 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,
+ * 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.
OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
IoError = Tizen.Internals.Errors.ErrorCode.IoError,
+ NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
DbError = -0x01120000 | 0x01,
AlreadyExists = -0x01120000 | 0x02,
DBusError = -0x01120000 | 0x03,
Log.Error(LogTag, msg);
return new ArgumentException(ret + " error occurred.");
case BadgeError.PermissionDenied:
+ Log.Error(LogTag, msg);
throw new UnauthorizedAccessException("Permission denied (http://tizen.org/privilege/notification)");
+ case BadgeError.NotSupported:
+ Log.Error(LogTag, msg);
+ throw new NotSupportedException("Not Supported (http://tizen.org/feature/badge)");
default:
Log.Error(LogTag, msg);
return new InvalidOperationException(ret + " error occurred.");
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the License);
+ * 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,
+ * 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.Applications.CoreBackend
{
/// <summary>
- /// Abstract class to provide default event handlers for apps.
+ /// An abstract class to provide default event handlers for apps.
/// </summary>
public abstract class DefaultCoreBackend : ICoreBackend
{
/// <summary>
- /// Low level event types
+ /// Low level event types.
/// </summary>
public enum AppEventType
{
namespace Tizen.Applications.CoreBackend
{
/// <summary>
- /// Class that represents the type of event for backends. This class can be converted from string type.
+ /// This class represents the type of event for backends. This class can be converted from the string type.
/// </summary>
public class EventType
{
/// <summary>
- /// Pre-defined event type. "PreCreated"
+ /// Pre-defined event type "PreCreated".
/// </summary>
public static readonly EventType PreCreated = "PreCreated";
/// <summary>
- /// Pre-defined event type. "Created"
+ /// Pre-defined event type "Created".
/// </summary>
public static readonly EventType Created = "Created";
/// <summary>
- /// Pre-defined event type. "Terminated"
+ /// Pre-defined event type "Terminated".
/// </summary>
public static readonly EventType Terminated = "Terminated";
/// <summary>
- /// Pre-defined event type. "AppControlReceived"
+ /// Pre-defined event type "AppControlReceived".
/// </summary>
public static readonly EventType AppControlReceived = "AppControlReceived";
/// <summary>
- /// Pre-defined event type. "Resumed"
+ /// Pre-defined event type "Resumed".
/// </summary>
public static readonly EventType Resumed = "Resumed";
/// <summary>
- /// Pre-defined event type. "Paused"
+ /// Pre-defined event type "Paused".
/// </summary>
public static readonly EventType Paused = "Paused";
/// <summary>
- /// Pre-defined event type. "LowMemory"
+ /// Pre-defined event type "LowMemory".
/// </summary>
public static readonly EventType LowMemory = "LowMemory";
/// <summary>
- /// Pre-defined event type. "LowBattery"
+ /// Pre-defined event type "LowBattery".
/// </summary>
public static readonly EventType LowBattery = "LowBattery";
/// <summary>
- /// Pre-defined event type. "LocaleChanged"
+ /// Pre-defined event type "LocaleChanged".
/// </summary>
public static readonly EventType LocaleChanged = "LocaleChanged";
/// <summary>
- /// Pre-defined event type. "RegionFormatChanged"
+ /// Pre-defined event type "RegionFormatChanged".
/// </summary>
public static readonly EventType RegionFormatChanged = "RegionFormatChanged";
/// <summary>
- /// Pre-defined event type. "DeviceOrientationChanged"
+ /// Pre-defined event type "DeviceOrientationChanged".
/// </summary>
public static readonly EventType DeviceOrientationChanged = "DeviceOrientationChanged";
namespace Tizen.Applications.CoreBackend
{
/// <summary>
- /// Interface that represents the backend lifecycles.
+ /// An interface that represents the backend lifecycles.
/// </summary>
public interface ICoreBackend : IDisposable
{
void AddEventHandler<TEventArgs>(EventType evType, Action<TEventArgs> handler) where TEventArgs : EventArgs;
/// <summary>
- /// Runs the mainloop of backend.
+ /// Runs the mainloop of the backend.
/// </summary>
/// <param name="args"></param>
void Run(string[] args);
/// <summary>
- /// Exits the mainloop of backend.
+ /// Exits the mainloop of the backend.
/// </summary>
void Exit();
}
/// <summary>
/// Initializes the instance of the AppControl class.
/// </summary>
- /// <exception cref="InvalidOperationException">Thrown when failed to create AppControl handle.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed to create the AppControl handle.</exception>
public AppControl()
{
Interop.AppControl.ErrorCode err = Interop.AppControl.Create(out _handle);
}
/// <summary>
- /// Initializes the instance of the AppControl class with parameter.
+ /// Initializes the instance of the AppControl class with a parameter.
/// </summary>
- /// <param name="enableAppStartedResultEvent">The flag value to receive an additional launch result event on launch request.</param>
- /// <exception cref="InvalidOperationException">Thrown when failed to create AppControl handle.</exception>
+ /// <param name="enableAppStartedResultEvent">The flag value to receive an additional launch result event on the launch request.</param>
+ /// <exception cref="InvalidOperationException">Thrown when failed to create the AppControl handle.</exception>
public AppControl(bool enableAppStartedResultEvent)
{
Interop.AppControl.ErrorCode err = Interop.AppControl.Create(out _handle);
/// </summary>
/// <value>
/// Since Tizen 2.4, if the parameter 'uri' is started with 'file://' and
- /// it is a regular file in this application's data path which can be obtained
+ /// it is a regular file in this application's data path, which can be obtained
/// by property DataPath in ApplicationInfo class,
/// it will be shared to the callee application.
/// Framework will grant a temporary permission to the callee application for this file and
}
/// <summary>
- /// Gets and sets the application id to explicitly launch.
+ /// Gets and sets the application ID to explicitly launch.
/// </summary>
/// <value>
- /// (if the application id is null for setter, it clears the previous value.)
+ /// (if the application ID is null for setter, it clears the previous value.)
/// </value>
/// <example>
/// <code>
/// Gets and sets the launch mode of the application.
/// </summary>
/// <value>
- /// Although LaunchMode were set as AppControlLaunchMode.Group,
- /// callee application would be launched as single mode
+ /// Although, LaunchMode were set as AppControlLaunchMode.Group, the
+ /// callee application would be launched as a single mode
/// if the manifest file of callee application defined the launch mode as "single".
- /// This property can just set the preference of caller application to launch an application.
- /// Sub-applications which were launched as group mode always have own process.
- /// Since Tizen 3.0, if launch mode not set in the caller app control,
- /// this property returns AppControlLaunchMode.Single launch mode.
+ /// This property can just set the preference of the caller application to launch an application.
+ /// Sub-applications, which were launched as a group mode always have own process.
+ /// Since Tizen 3.0, if launch mode is not set in the caller application control,
+ /// this property returns the AppControlLaunchMode.Single launch mode.
/// </value>
/// <example>
/// <code>
/// <summary>
/// Retrieves all applications that can be launched to handle the given app_control request.
/// </summary>
- /// <param name="control">The AppControl</param>
- /// <returns>ApplicationIds</returns>
- /// <exception cref="InvalidOperationException">Thrown when failed because of invalid parameter</exception>
+ /// <param name="control">The AppControl.</param>
+ /// <returns>ApplicationIds.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid parameter.</exception>
/// <example>
/// <code>
/// IEnumerable<string> applicationIds = AppControl.GetMatchedApplicationIds(control);
/// If the operation is AppControlOperations.Default, the application ID is mandatory to explicitly launch the application. \n
/// Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform.
/// Also, implicit launch requests are NOT delivered to service applications since 2.4.
- /// To launch a service application, an explicit launch request with application ID given by property ApplicationId MUST be sent.
+ /// To launch a service application, an explicit launch request with the application ID given by property ApplicationId MUST be sent.
/// </remarks>
- /// <param name="launchRequest">The AppControl</param>
- /// <exception cref="ArgumentNullException">Thrown when failed because of a null arguament</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed because of invalid operation</exception>
- /// <exception cref="TimeoutException">Thrown when failed because of timeout</exception>
+ /// <param name="launchRequest">The AppControl.</param>
+ /// <exception cref="ArgumentNullException">Thrown when failed because of a null argument.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
+ /// <exception cref="TimeoutException">Thrown when failed because of timeout.</exception>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
/// <example>
/// <code>
/// If the operation is AppControlOperations.Default, the application ID is mandatory to explicitly launch the application. \n
/// Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform.
/// Also, implicit launch requests are NOT delivered to service applications since 2.4.
- /// To launch a service application, an explicit launch request with application ID given by property ApplicationId MUST be sent.
+ /// To launch a service application, an explicit launch request with the application ID given by property ApplicationId MUST be sent.
/// </remarks>
- /// <param name="launchRequest">The AppControl</param>
- /// <param name="replyAfterLaunching">The callback function to be called when the reply is delivered</param>
- /// <exception cref="ArgumentException">Thrown when failed because of arguament is invalid</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed because of invalid operation</exception>
- /// <exception cref="TimeoutException">Thrown when failed because of timeout</exception>
+ /// <param name="launchRequest">The AppControl.</param>
+ /// <param name="replyAfterLaunching">The callback function to be called when the reply is delivered.</param>
+ /// <exception cref="ArgumentException">Thrown when failed because of the argument is invalid.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
+ /// <exception cref="TimeoutException">Thrown when failed because of timeout.</exception>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
/// <example>
/// <code>
/// </summary>
/// <remarks>
/// You are not allowed to terminate other general applications using this API.
- /// This API can be used to terminate sub-applications which were launched as group mode by caller application.
- /// Once callee application is being terminated by this API,
- /// other applications which were launched by callee application as group mode will be terminated as well
+ /// This API can be used to terminate sub-applications, which were launched as a group mode by the caller application.
+ /// Once the callee application is being terminated by this API,
+ /// other applications, which were launched by the callee application as a group mode will be terminated as well.
/// </remarks>
- /// <param name="terminateRequest">The AppControl</param>
- /// <exception cref="ArgumentException">Thrown when failed because of arguament is invalid</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed because of invalid operation</exception>
- /// <exception cref="TimeoutException">Thrown when failed because of timeout</exception>
+ /// <param name="terminateRequest">The AppControl.</param>
+ /// <exception cref="ArgumentException">Thrown when failed because of the argument is invalid.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
+ /// <exception cref="TimeoutException">Thrown when failed because of timeout.</exception>
/// <example>
/// <code>
/// AppControl terminateRequest = new AppControl();
}
/// <summary>
- /// Class for Extra Data
+ /// Class for extra data.
/// </summary>
public class ExtraDataCollection
{
/// <remarks>
/// The function replaces any existing value for the given key.
/// </remarks>
- /// <param name="key">The name of the extra data</param>
- /// <param name="value">The value associated with the given key</param>
- /// <exception cref="ArgumentNullException">Thrown when key or value is a zero-length string</exception>
- /// <exception cref="ArgumentException">Thrown when the application tries to use the same key with system-defined key</exception>
+ /// <param name="key">The name of the extra data.</param>
+ /// <param name="value">The value associated with the given key.</param>
+ /// <exception cref="ArgumentNullException">Thrown when a key or a value is a zero-length string.</exception>
+ /// <exception cref="ArgumentException">Thrown when the application tries to use the same key with the system-defined key.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <remarks>
/// The function replaces any existing value for the given key.
/// </remarks>
- /// <param name="key">The name of the extra data</param>
- /// <param name="value">The value associated with the given key</param>
- /// <exception cref="ArgumentNullException">Thrown when key or value is a zero-length string</exception>
- /// <exception cref="ArgumentException">Thrown when the application tries to use the same key with system-defined key</exception>
+ /// <param name="key">The name of the extra data.</param>
+ /// <param name="value">The value associated with the given key.</param>
+ /// <exception cref="ArgumentNullException">Thrown when key or value is a zero-length string.</exception>
+ /// <exception cref="ArgumentException">Thrown when the application tries to use the same key with the system-defined key.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// Gets the extra data.
/// </summary>
/// <typeparam name="T">Only string and IEnumerable<string></typeparam>
- /// <param name="key">The name of extra data</param>
- /// <returns>The value associated with the given key</returns>
- /// <exception cref="ArgumentNullException">Thrown when the key is invalid parameter</exception>
- /// <exception cref="KeyNotFoundException">Thrown when the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown when the key is rejected</exception>
+ /// <param name="key">The name of extra data.</param>
+ /// <returns>The value associated with the given key.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when the key is an invalid parameter.</exception>
+ /// <exception cref="KeyNotFoundException">Thrown when the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown when the key is rejected.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Gets the extra data.
/// </summary>
- /// <param name="key">The name of extra data</param>
- /// <returns>The value associated with the given key</returns>
- /// <exception cref="ArgumentNullException">Thrown when the key is invalid parameter</exception>
- /// <exception cref="KeyNotFoundException">Thrown when the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown when the key is rejected</exception>
+ /// <param name="key">The name of extra data.</param>
+ /// <returns>The value associated with the given key.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when the key is an invalid parameter.</exception>
+ /// <exception cref="KeyNotFoundException">Thrown when the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown when the key is rejected.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Gets all keys in extra data.
/// </summary>
- /// <returns>The keys in the AppControl</returns>
- /// <exception cref="InvalidOperationException">Thrown when invalid parameter</exception>
+ /// <returns>The keys in the AppControl.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when the key is an invalid parameter.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Tries getting the extra data.
/// </summary>
- /// <param name="key">The name of extra data</param>
- /// <param name="value">The value associated with the given key</param>
- /// <returns>The result whether getting the value is done</returns>
- /// <exception cref="ArgumentNullException">Thrown when the key is invalid parameter</exception>
- /// <exception cref="KeyNotFoundException">Thrown when the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown when the key is rejected</exception>
+ /// <param name="key">The name of extra data.</param>
+ /// <param name="value">The value associated with the given key.</param>
+ /// <returns>The result whether getting the value is done.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when the key is an invalid parameter.</exception>
+ /// <exception cref="KeyNotFoundException">Thrown when the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown when the key is rejected.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Tries getting the extra data.
/// </summary>
- /// <param name="key">The name of extra data</param>
- /// <param name="value">The value associated with the given key</param>
- /// <returns>The result whether getting the value is done</returns>
- /// <exception cref="ArgumentNullException">Thrown when the key is invalid parameter</exception>
- /// <exception cref="KeyNotFoundException">Thrown when the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown when the key is rejected</exception>
+ /// <param name="key">The name of extra data.</param>
+ /// <param name="value">The value associated with the given key.</param>
+ /// <returns>The result whether getting the value is done.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when the key is an invalid parameter.</exception>
+ /// <exception cref="KeyNotFoundException">Thrown when the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown when the key is rejected.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Removes the extra data.
/// </summary>
- /// <param name="key">The name of the extra data</param>
- /// <exception cref="ArgumentNullException">Thrown when the key is a zero-length string</exception>
- /// <exception cref="KeyNotFoundException">Thrown when the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown when the key is rejected</exception>
+ /// <param name="key">The name of the extra data.</param>
+ /// <exception cref="ArgumentNullException">Thrown when the key is a zero-length string.</exception>
+ /// <exception cref="KeyNotFoundException">Thrown when the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown when the key is rejected.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
/// <summary>
/// Counts keys in the extra data.
/// </summary>
- /// <returns>The number of counting keys</returns>
- /// <exception cref="InvalidOperationException">Thrown when invalid parameter</exception>
+ /// <returns>The number of counting keys.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when the key is an invalid parameter.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
}
/// <summary>
- /// Checks whether the extra data associated with the given key is of collection data type.
+ /// Checks whether the extra data associated with the given key is of the collection data type.
/// </summary>
- /// <param name="key">The name of the extra data</param>
- /// <returns>If true the extra data is of array data type, otherwise false</returns>
- /// <exception cref="ArgumentNullException">Thrown when the key is a zero-length string</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed to check the key</exception>
+ /// <param name="key">The name of the extra data.</param>
+ /// <returns>If true, the extra data is of the array data type, otherwise false.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when the key is a zero-length string.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed to check the key.</exception>
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
public static class AppControlData
{
/// <summary>
- /// Subject
+ /// Subject.
/// </summary>
public const string Subject = "http://tizen.org/appcontrol/data/subject";
/// <summary>
- /// Recipients
+ /// Recipients.
/// </summary>
public const string To = "http://tizen.org/appcontrol/data/to";
/// <summary>
- /// E-mail addresses that should be carbon copied
+ /// E-mail addresses that should be carbon copied.
/// </summary>
public const string Cc = "http://tizen.org/appcontrol/data/cc";
/// <summary>
- /// E-mail addresses that should be blind carbon copied
+ /// E-mail addresses that should be blind carbon copied.
/// </summary>
public const string Bcc = "http://tizen.org/appcontrol/data/bcc";
/// <summary>
- /// Text
+ /// Text.
/// </summary>
public const string Text = "http://tizen.org/appcontrol/data/text";
/// <summary>
- /// Title
+ /// Title.
/// </summary>
public const string Title = "http://tizen.org/appcontrol/data/title";
/// <summary>
- /// Selected items
+ /// Selected items.
/// </summary>
public const string Selected = "http://tizen.org/appcontrol/data/selected";
/// <summary>
- /// Paths of items
+ /// Paths of items.
/// </summary>
public const string Path = "http://tizen.org/appcontrol/data/path";
/// <summary>
- /// Selection mode. ("single" or "multiple")
+ /// Selection mode ("single" or "multiple").
/// </summary>
public const string SectionMode = "http://tizen.org/appcontrol/data/selection_mode";
/// <summary>
- /// All-day mode of event ("true" or "false")
+ /// All-day mode of the event ("true" or "false").
/// </summary>
public const string AllDay = "http://tizen.org/appcontrol/data/calendar/all_day";
/// <summary>
- /// Start time of event (format: YYYY-MM-DD HH:MM:SS)
+ /// Start time of the event (format: YYYY-MM-DD HH:MM:SS).
/// </summary>
public const string StartTime = "http://tizen.org/appcontrol/data/calendar/start_time";
/// <summary>
- /// End time of event (format: YYYY-MM-DD HH:MM:SS)
+ /// End time of the event (format: YYYY-MM-DD HH:MM:SS).
/// </summary>
public const string Endtime = "http://tizen.org/appcontrol/data/calendar/end_time";
/// <summary>
- /// E-mail addressed
+ /// E-mail addressed.
/// </summary>
public const string Email = "http://tizen.org/appcontrol/data/email";
/// <summary>
- /// Phone numbers
+ /// Phone numbers.
/// </summary>
public const string Phone = "http://tizen.org/appcontrol/data/phone";
/// <summary>
- /// URLs
+ /// URLs.
/// </summary>
public const string Url = "http://tizen.org/appcontrol/data/url";
/// <summary>
- /// IDs
+ /// IDs.
/// </summary>
public const string Ids = "http://tizen.org/appcontrol/data/id";
/// <summary>
- /// Type
+ /// Type.
/// </summary>
public const string Type = "http://tizen.org/appcontrol/data/type";
/// <summary>
- /// Total count
+ /// Total count.
/// </summary>
public const string TotalCount = "http://tizen.org/appcontrol/data/total_count";
/// <summary>
- /// Total size (unit : bytes)
+ /// Total size (unit : bytes).
/// </summary>
public const string TotalSize = "http://tizen.org/appcontrol/data/total_size";
/// <summary>
- /// Name
+ /// Name.
/// </summary>
public const string Name = "http://tizen.org/appcontrol/data/name";
/// <summary>
- /// Location
+ /// Location.
/// </summary>
public const string Location = "http://tizen.org/appcontrol/data/location";
/// <summary>
- /// Select the type of input method
+ /// Select the type of input method.
/// </summary>
public const string InputType = "http://tizen.org/appcontrol/data/input_type";
/// <summary>
- /// Send the pre inputted text such as "http://" in web
+ /// Send the pre inputted text, such as "http://" in web.
/// </summary>
public const string InputDefaultText = "http://tizen.org/appcontrol/data/input_default_text";
/// <summary>
- /// Send guide text to show to user such as "Input user name"
+ /// Send guide text to show to the user, such as "Input user name".
/// </summary>
public const string InputGuideText = "http://tizen.org/appcontrol/data/input_guide_text";
/// <summary>
- /// Send text to receive answer result from smart reply
+ /// Send text to receive answer result from smart reply.
/// </summary>
public const string InputPredictionHint = "http://tizen.org/appcontrol/data/input_prediction_hint";
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for App Control Launch Mode.
+ /// Enumeration for the application control launch mode.
/// </summary>
public enum AppControlLaunchMode
{
/// <summary>
- /// Prefer to launch an application as single mode
+ /// Prefer to launch an application as a single mode.
/// </summary>
Single = 0,
/// <summary>
- /// Prefer to launch an application as group mode
+ /// Prefer to launch an application as a group mode.
/// </summary>
Group,
}
public const string ShareText = "http://tizen.org/appcontrol/operation/share_text";
/// <summary>
- /// Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call.
+ /// Dials a number. This shows an UI with the number to be dialed, allowing the user to explicitly initiate the call.
/// </summary>
public const string Dial = "http://tizen.org/appcontrol/operation/dial";
public const string SettingBluetoothEnable = "http://tizen.org/appcontrol/operation/setting/bt_enable";
/// <summary>
- /// Shows settings to configure Bluetooth visibility.
+ /// Shows settings to configure the Bluetooth visibility.
/// </summary>
public const string SettingBluetoothVisibility = "http://tizen.org/appcontrol/operation/setting/bt_visibility";
public class AppControlReceivedEventArgs : EventArgs
{
/// <summary>
- /// Initializes AppControlReceivedEventArgs class.
+ /// Initializes the AppControlReceivedEventArgs class.
/// </summary>
/// <param name="appControl"></param>
public AppControlReceivedEventArgs(ReceivedAppControl appControl)
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for App Control Result.
+ /// Enumeration for the application control result.
/// </summary>
public enum AppControlReplyResult
{
/// <summary>
- /// Callee application launched actually
+ /// The callee application launched actually.
/// </summary>
AppStarted = 1,
/// <summary>
- /// Operation is succeeded
+ /// The operation succeeded.
/// </summary>
Succeeded = 0,
/// <summary>
- /// Operation is failed by the callee
+ /// The operation failed by the callee.
/// </summary>
Failed = -1,
/// <summary>
- /// Operation is canceled by the platform
+ /// The operation canceled by the platform.
/// </summary>
Canceled = -2,
}
namespace Tizen.Applications
{
/// <summary>
- /// Class that represents a Tizen application.
+ /// The class that represents a Tizen application.
/// </summary>
public abstract class Application : IDisposable
{
private ApplicationInfo _applicationInfo;
/// <summary>
- /// Gets the instance of current application.
+ /// Gets the instance of the current application.
/// </summary>
public static Application Current { get { return s_CurrentApplication; } }
/// <summary>
- /// Gets the class representing directory information of current application.
+ /// Gets the class representing directory information of the current application.
/// </summary>
public DirectoryInfo DirectoryInfo
{
}
/// <summary>
- /// Gets the class representing information of current application.
+ /// Gets the class representing information of the current application.
/// </summary>
public ApplicationInfo ApplicationInfo
{
}
/// <summary>
- /// Exits the main loop of application.
+ /// Exits the main loop of the application.
/// </summary>
public abstract void Exit();
}
/// <summary>
- /// Finalizer of the Application class.
+ /// Finalizer of the application class.
/// </summary>
~Application()
{
}
/// <summary>
- /// Releases all resources used by the Application class.
+ /// Releases all resources used by the application class.
/// </summary>
public void Dispose()
{
namespace Tizen.Applications
{
/// <summary>
- /// Arguments for the event that is raised when the application is disabled.
+ /// Arguments for the event raised when the application is disabled.
/// </summary>
public class ApplicationDisabledEventArgs : EventArgs
{
}
/// <summary>
- /// The Id of the application
+ /// The ID of the application.
/// </summary>
public string ApplicationId { get { return _applicationId; } }
/// <summary>
- /// The Event state of the application
+ /// The event state of the application.
/// </summary>
public ApplicationEventState EventState { get { return _eventState; } }
}
namespace Tizen.Applications
{
/// <summary>
- /// Arguments for the event that is raised when the application is enabled.
+ /// Arguments for the event raised when the application is enabled.
/// </summary>
public class ApplicationEnabledEventArgs : EventArgs
{
}
/// <summary>
- /// The Id of the application
+ /// The ID of the application.
/// </summary>
public string ApplicationId { get { return _applicationId; } }
/// <summary>
- /// The Event state of the application
+ /// The event state of the application.
/// </summary>
public ApplicationEventState EventState { get { return _eventState; } }
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration of the application event state
+ /// Enumeration for the application event state.
/// </summary>
public enum ApplicationEventState
{
/// <summary>
- /// Processing Started.
+ /// Processing started.
/// </summary>
Started = Interop.ApplicationManager.AppManagerEventState.Started,
/// <summary>
- /// Processing Completed.
+ /// Processing completed.
/// </summary>
Completed = Interop.ApplicationManager.AppManagerEventState.Completed,
/// <summary>
- /// Processing Failed.
+ /// Processing failed.
/// </summary>
Failed = Interop.ApplicationManager.AppManagerEventState.Failed
}
}
/// <summary>
- /// A constructor of ApplicationInfo that takes the application id.
+ /// A constructor of ApplicationInfo that takes the application ID.
/// </summary>
- /// <param name="applicationId">application id.</param>
+ /// <param name="applicationId">Application ID.</param>
public ApplicationInfo(string applicationId)
{
_applicationId = applicationId;
}
/// <summary>
- /// Destructor of the class
+ /// Destructor of the class.
/// </summary>
~ApplicationInfo()
{
}
/// <summary>
- /// Gets the application id.
+ /// Gets the application ID.
/// </summary>
public string ApplicationId
{
}
/// <summary>
- /// Gets the package id of the application.
+ /// Gets the package ID of the application.
/// </summary>
public string PackageId
{
}
/// <summary>
- /// Checks whether application information is nodisplay. If the application icon is not displayed on the menu screen, true; otherwise, false.
+ /// Checks whether the application information is nodisplay. If the application icon is not displayed on the menu screen, true; otherwise, false.
/// </summary>
public bool IsNoDisplay
{
}
/// <summary>
- /// Checks whether application is launched on booting time. If the application will be automatically start on boot, true; otherwise, false.
+ /// Checks whether the application is launched on booting time. If the application automatically starts on boot, true; otherwise, false.
/// </summary>
public bool IsOnBoot
{
}
/// <summary>
- /// Checks whether application is preloaded. If the application is preloaded, true; otherwise, false.
+ /// Checks whether the application is preloaded. If the application is preloaded, true; otherwise, false.
/// </summary>
public bool IsPreload
{
}
/// <summary>
- /// Gets the localized label of application for the given locale.
+ /// Gets the localized label of the application for the given locale.
/// </summary>
- /// <param name="locale">locale.</param>
+ /// <param name="locale">Locale.</param>
public string GetLocalizedLabel(string locale)
{
string label = string.Empty;
namespace Tizen.Applications
{
/// <summary>
- /// This class is a parameter of GetInstalledApplicationsAsync method.
+ /// This class is a parameter of the GetInstalledApplicationsAsync method.
/// </summary>
public class ApplicationInfoFilter
{
namespace Tizen.Applications
{
/// <summary>
- /// This class is a parameter of GetInstalledApplicationsAsync method.
+ /// This class is a parameter of the GetInstalledApplicationsAsync method.
/// </summary>
public class ApplicationInfoMetadataFilter : ApplicationInfoFilter
{
namespace Tizen.Applications
{
/// <summary>
- /// Arguments for the event that is raised when the application is launched.
+ /// Arguments for the event raised when the application is launched.
/// </summary>
public class ApplicationLaunchedEventArgs : EventArgs
{
}
/// <summary>
- /// Gets the information of the specified application with the application id.
+ /// Gets the information of the specified application with the application ID.
/// </summary>
- /// <param name="applicationId">Application id.</param>
+ /// <param name="applicationId">Application ID.</param>
public static ApplicationInfo GetInstalledApplication(string applicationId)
{
IntPtr infoHandle = IntPtr.Zero;
/// <summary>
/// Returns if the specified application is running or not.
/// </summary>
- /// <param name="applicationId">The application Id.</param>
+ /// <param name="applicationId">The application ID.</param>
/// <returns>Returns true if the given application is running, otherwise false.</returns>
/// <exception cref="ArgumentException">Thrown when the given parameter is invalid.</exception>
public static bool IsRunning(string applicationId)
/// <summary>
/// Gets the information of the recent applications.
/// </summary>
- /// <returns>Returns a dictionary containing all recent application info.</returns>
- /// <exception cref="InvalidOperationException">Thrown when failed because of invalid operation</exception>
+ /// <returns>Returns a dictionary containing all the recent application info.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<RecentApplicationInfo> GetRecentApplications()
{
}
/// <summary>
- /// A constructor of ApplicationRunningContext that takes the application id.
+ /// A constructor of ApplicationRunningContext that takes the application ID.
/// </summary>
- /// <param name="applicationId">application id.</param>
- /// <exception cref="ArgumentException">Thrown when failed of invalid argument.</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed because of application not exist error or system error.</exception>
+ /// <param name="applicationId">Application ID.</param>
+ /// <exception cref="ArgumentException">Thrown when failed because of an invalid argument.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of the "application not exist" error or the system error.</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed because of out of memory.</exception>
public ApplicationRunningContext(string applicationId)
{
}
/// <summary>
- /// Destructor of the class
+ /// Destructor of the class.
/// </summary>
~ApplicationRunningContext()
{
}
/// <summary>
- /// Enumeration for the Application State.
+ /// Enumeration for the application state.
/// </summary>
public enum AppState
{
/// <summary>
- /// The undefined state
+ /// The undefined state.
/// </summary>
Undefined = 0,
Background,
/// <summary>
- /// The Service application is running.
+ /// The service application is running.
/// </summary>
Service,
}
/// <summary>
- /// Gets the application id.
+ /// Gets the application ID.
/// </summary>
public string ApplicationId
{
}
/// <summary>
- /// Gets the package id of the application.
+ /// Gets the package ID of the application.
/// </summary>
public string PackageId
{
}
/// <summary>
- /// Gets the application's process id.
+ /// Gets the application's process ID.
/// </summary>
public int ProcessId
{
/// Terminates the application.
/// </summary>
/// <exception cref="ArgumentException">Thrown when failed of invalid argument.</exception>
- /// <exception cref="InvalidOperationException">Thrown when failed because of permission denied or system error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when failed because of permission denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of system error.</exception>
/// <privilege>http://tizen.org/privilege/appmanager.kill</privilege>
[EditorBrowsable(EditorBrowsableState.Never)]
public void Terminate()
case Interop.ApplicationManager.ErrorCode.InvalidParameter:
throw new ArgumentException("Invalid argument.");
case Interop.ApplicationManager.ErrorCode.PermissionDenied:
- throw new InvalidOperationException("Permission denied.");
+ throw new UnauthorizedAccessException("Permission denied.");
+ default:
+ throw new InvalidOperationException("Invalid Operation.");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Resumes the running application.
+ /// </summary>
+ /// <exception cref="ArgumentException">Thrown when failed of invalid argument.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when failed because of permission denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of system error.</exception>
+ /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ public void Resume()
+ {
+ err = Interop.ApplicationManager.AppManagerResumeApp(_contextHandle);
+ if (err != Interop.ApplicationManager.ErrorCode.None)
+ {
+ switch (err)
+ {
+ case Interop.ApplicationManager.ErrorCode.InvalidParameter:
+ throw new ArgumentException("Invalid argument.");
+ case Interop.ApplicationManager.ErrorCode.PermissionDenied:
+ throw new UnauthorizedAccessException("Permission denied.");
default:
throw new InvalidOperationException("Invalid Operation.");
}
_disposed = true;
}
}
-}
\ No newline at end of file
+}
namespace Tizen.Applications
{
/// <summary>
- /// Arguments for the event that is raised when the application is terminated.
+ /// Arguments for the event raised when the application is terminated.
/// </summary>
public class ApplicationTerminatedEventArgs : EventArgs
{
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for applications type.
+ /// Enumeration for the applications type.
/// </summary>
public enum ApplicationType
{
namespace Tizen.Applications
{
/// <summary>
- /// A Bundle object represents a bundle.
+ /// A bundle object represents a bundle.
/// A bundle holds items (key-value pairs) and can be used with other Tizen APIs.
/// Keys can be used to access values.
/// This class is accessed by using a constructor to create a new instance of this object.
private readonly HashSet<string> _keys;
/// <summary>
- /// The Bundle constructor.
+ /// The bundle constructor.
/// </summary>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// </code>
}
/// <summary>
- /// The Bundle constructor.
+ /// The bundle constructor.
/// </summary>
/// <param name="handle">The SafeBundleHandle instance.</param>
/// <exception cref="System.ArgumentNullException">Thrown when the handle is null or invalid.</exception>
}
/// <summary>
- /// The number of items in a Bundle object.
+ /// The number of items in a bundle object.
/// </summary>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
}
/// <summary>
- /// The keys in a Bundle object.
+ /// The keys in a bundle object.
/// </summary>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// Checks whether the bundle contains an item with a specified key.
/// </summary>
/// <param name="key">The key to check for.</param>
- /// <returns>true if the bundle contains the key. false otherwise.</returns>
+ /// <returns>true if the bundle contains the key, false otherwise.</returns>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// bundle.AddItem("string", "a_string");
/// <summary>
/// Adds an item into the bundle.
/// </summary>
- /// <param name="key">The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed.</param>
+ /// <param name="key">The key to identify the item with. If an item with the key already exists in the bundle, this method will not succeed.</param>
/// <param name="value">The value of the item.</param>
/// <exception cref="System.ArgumentException">Thrown when the key already exists or when there is an invalid parameter.</exception>
- /// <exception cref="System.ArgumentNullException">Thrown when value is null.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.ArgumentNullException">Thrown when a value is null.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
/// <summary>
/// Adds an item into the bundle.
/// </summary>
- /// <param name="key">The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed.</param>
+ /// <param name="key">The key to identify the item with. If an item with the key already exists in the bundle, this method will not succeed.</param>
/// <param name="value">The value of the item.</param>
/// <param name="offset">The zero-based byte offset in value from which to add to the bundle.</param>
/// <param name="count">The maximum number of bytes to add to the bundle starting with offset.</param>
/// <exception cref="System.ArgumentOutOfRangeException">Thrown when the offset or count is out of range.</exception>
/// <exception cref="System.ArgumentException">Thrown when the key already exists or when there is an invalid parameter.</exception>
- /// <exception cref="System.ArgumentNullException">Thrown when value is null.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.ArgumentNullException">Thrown when a value is null.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
/// <summary>
/// Adds an item into the bundle.
/// </summary>
- /// <param name="key">The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed.</param>
+ /// <param name="key">The key to identify the item with. If an item with the key already exists in the bundle, this method will not succeed.</param>
/// <param name="value">The value of the item.</param>
/// <exception cref="System.ArgumentException">Thrown when the key already exists or when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// bundle.AddItem("string", "a_string");
/// <summary>
/// Adds an item into the bundle.
/// </summary>
- /// <param name="key">The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed.</param>
+ /// <param name="key">The key to identify the item with. If an item with the key already exists in the bundle, this method will not succeed.</param>
/// <param name="value">The value of the item.</param>
/// <exception cref="System.ArgumentException">Thrown when the key already exists or when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// <param name="key">The key of the bundle item whose value is desired.</param>
/// <returns>The value of the bundle item.</returns>
/// <exception cref="System.ArgumentException">Thrown when the key does not exist or when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// bundle.AddItem("string", "a_string");
/// <returns>The value of the bundle item if it is of the specified generic type.</returns>
/// <exception cref="System.ArgumentException">Thrown when the key does not exist or when there is an invalid parameter.</exception>
/// <exception cref="System.InvalidCastException">Thrown when the value of the bundle item cannot be converted to the specified generic type.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// </summary>
/// <param name="key">The key of the bundle item whose value is desired.</param>
/// <param name="value">The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type.</param>
- /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise.</returns>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter, false otherwise.</returns>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
/// </summary>
/// <param name="key">The key of the bundle item whose value is desired.</param>
/// <param name="value">The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type.</param>
- /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise.</returns>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter, false otherwise.</returns>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// bundle.AddItem("string", "a_string");
/// </summary>
/// <param name="key">The key of the bundle item whose value is desired.</param>
/// <param name="value">The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type.</param>
- /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise.</returns>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <returns>true if an item with the key exists and if the value is the same type as the output value parameter, false otherwise.</returns>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// </summary>
/// <typeparam name="T">The generic type to check for.</typeparam>
/// <param name="key">The key whose type wants to be checked.</param>
- /// <returns>true if the item is of the specified type. false otherwise.</returns>
+ /// <returns>true if the item is of the specified type, false otherwise.</returns>
/// <exception cref="System.ArgumentException">Thrown when the key does not exist or when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
}
/// <summary>
- /// Removes a a bundle item with a specific key from a Bundle.
+ /// Removes a bundle item with a specific key from a Bundle.
/// </summary>
/// <param name="key">The key of the item to delete.</param>
- /// <returns>true if the item is successfully found and removed. false otherwise (even if the item is not found).</returns>
+ /// <returns>true if the item is successfully found and removed, false otherwise (even if the item is not found).</returns>
/// <exception cref="System.ArgumentException">Thrown when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// bundle.AddItem("string", "a_string");
/// <summary>
/// Decodes an encoded bundle data.
/// </summary>
- /// <param name="bundleRaw">The encoded bundle data. bundleRaw should be return value of Tizen.Applications.Bundle.Encode, otherwise this method will not succeed</param>
+ /// <param name="bundleRaw">The encoded bundle data. bundleRaw should be the returned value of Tizen.Applications.Bundle.Encode, otherwise this method will not succeed.</param>
/// <returns>Decoded Bundle object.</returns>
/// <exception cref="System.ArgumentException">Thrown when there is an invalid parameter.</exception>
/// <code>
/// <summary>
/// Encodes bundle to string.
/// </summary>
- /// <returns>Encoded Bundle data in string.</returns>
- /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the Bundle instance has been disposed.</exception>
+ /// <returns>Encoded bundle data in string.</returns>
+ /// <exception cref="System.InvalidOperationException">Thrown when out of memory or when the bundle instance has been disposed.</exception>
/// <code>
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string bundleRaw = bundle.Encode();
}
/// <summary>
- /// Destructor of the Bundle class.
+ /// Destructor of the bundle class.
/// </summary>
~Bundle()
{
namespace Tizen.Applications
{
/// <summary>
- /// Class that represents an application controlled lifecycles by the backend system.
+ /// This class represents an application controlled lifecycles by the backend system.
/// </summary>
public class CoreApplication : Application
{
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for device orientation.
+ /// Enumeration for the device orientation.
/// </summary>
public enum DeviceOrientation
{
/// <summary>
- /// The device orientation is 0
+ /// The device orientation is 0.
/// </summary>
Orientation_0 = 0,
/// <summary>
- /// The device orientation is 90
+ /// The device orientation is 90.
/// </summary>
Orientation_90 = 90,
/// <summary>
- /// The device orientation is 180
+ /// The device orientation is 180.
/// </summary>
Orientation_180 = 180,
/// <summary>
- /// The device orientation is 270
+ /// The device orientation is 270.
/// </summary>
Orientation_270 = 270,
}
namespace Tizen.Applications
{
/// <summary>
- /// The class for the argument of the DeviceOrientationChanged EventHandler
+ /// The class for event arguments of the DeviceOrientationChanged.
/// </summary>
public class DeviceOrientationEventArgs : EventArgs
{
/// <summary>
- /// Initializes DeviceOrientationEventArgs class
+ /// Initializes the DeviceOrientationEventArgs class.
/// </summary>
/// <param name="orientation">The information of the DeviceOrientation</param>
public DeviceOrientationEventArgs(DeviceOrientation orientation)
}
/// <summary>
- /// The property to get the intformation of the DeviceOrientation
+ /// The received DeviceOrientation.
/// </summary>
public DeviceOrientation DeviceOrientation { get; private set; }
}
-}
\ No newline at end of file
+}
}
/// <summary>
- /// Gets the absolute path to the application's data directory which is used to store private data of the application.
+ /// Gets the absolute path to the application's data directory, which is used to store private data of the application.
/// </summary>
public string Data
{
}
/// <summary>
- /// Gets the absolute path to the application's cache directory which is used to store temporary data of the application.
+ /// Gets the absolute path to the application's cache directory, which is used to store temporary data of the application.
/// </summary>
public string Cache
{
}
/// <summary>
- /// Gets the absolute path to the application's shared data directory which is used to share data with other applications.
+ /// Gets the absolute path to the application's shared data directory, which is used to share data with other applications.
/// </summary>
public string SharedData
{
}
/// <summary>
- /// Gets the absolute path to the application's shared resource directory which is used to share resources with other applications.
+ /// Gets the absolute path to the application's shared resource directory, which is used to share resources with other applications.
/// </summary>
public string SharedResource
{
/// <summary>
- /// Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications.
+ /// Gets the absolute path to the application's shared trusted directory, which is used to share data with a family of trusted applications.
/// </summary>
public string SharedTrusted
{
}
/// <summary>
- /// Gets the absolute path to the application's external data directory which is used to store data of the application.
+ /// Gets the absolute path to the application's external data directory, which is used to store data of the application.
/// </summary>
public string ExternalData
{
}
/// <summary>
- /// Gets the absolute path to the application's external cache directory which is used to store temporary data of the application.
+ /// Gets the absolute path to the application's external cache directory, which is used to store temporary data of the application.
/// </summary>
public string ExternalCache
{
}
/// <summary>
- /// Gets the absolute path to the application's external shared data directory which is used to share data with other applications.
+ /// Gets the absolute path to the application's external shared data directory, which is used to share data with other applications.
/// </summary>
public string ExternalSharedData
{
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for low battery status.
+ /// Enumeration for the low battery status.
/// </summary>
public enum LowBatteryStatus
{
/// <summary>
- ///
+ ///
/// </summary>
None = 0,
/// <summary>
- /// The battery status is under 1%
+ /// The battery status is under 1%.
/// </summary>
PowerOff = 1,
/// <summary>
- /// The battery status is under 5%
+ /// The battery status is under 5%.
/// </summary>
CriticalLow
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for low memory status.
+ /// Enumeration for the low memory status.
/// </summary>
public enum LowMemoryStatus
{
/// <summary>
- /// Not initialized status
+ /// Not initialized status.
/// </summary>
None = 0x00,
/// <summary>
- /// Normal status
+ /// Normal status.
/// </summary>
Normal = 0x01,
/// <summary>
- /// Soft warning status
+ /// Soft warning status.
/// </summary>
SoftWarning = 0x02,
/// <summary>
- /// Hard warning status
+ /// Hard warning status.
/// </summary>
HardWarning = 0x04,
}
/// Gets the application ID of the caller from the launch request.
/// </summary>
/// <value>
- /// The application ID of the caller
+ /// The application ID of the caller.
/// </value>
/// <example>
/// <code>
/// Checks whether the caller is requesting a reply from the launch request.
/// </summary>
/// <value>
- /// If true this ReceivedAppControl is requested by the caller, otherwise false
+ /// If true, this ReceivedAppControl is requested by the caller, otherwise false
/// </value>
/// <example>
/// <code>
/// <summary>
/// Replies to the launch request sent by the caller.
- /// If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
+ /// If the caller application sends the launch request to receive the result, the callee application can return the result back to the caller.
/// </summary>
- /// <param name="replyRequest">The AppControl in which the results of the callee are contained</param>
- /// <param name="result">The result code of the launch request</param>
+ /// <param name="replyRequest">The AppControl in which the results of the callee are contained.</param>
+ /// <param name="result">The result code of the launch request.</param>
/// <example>
/// <code>
/// protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
namespace Tizen.Applications
{
/// <summary>
- /// This class provides methods and properties to get information of recent application.
+ /// This class provides methods and properties to get information of the recent application.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public class RecentApplicationControl
}
/// <summary>
- /// Deletes the application from recent application list.
+ /// Deletes the application from the recent application list.
/// </summary>
/// <privlevel>platform</privlevel>
public void Delete()
}
/// <summary>
- /// Delete all recent applicationsfrom recent application list.
+ /// Deletes all recent applications from the recent application list.
/// </summary>
/// <privlevel>platform</privlevel>
public static void DeleteAll()
namespace Tizen.Applications
{
/// <summary>
- /// This class provides methods and properties to get information of recent application.
+ /// This class provides methods and properties to get information of the recent application.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public class RecentApplicationInfo : ApplicationInfo
private const string LogTag = "Tizen.Applications";
/// <summary>
- /// Gets the instance id.
+ /// Gets the instance ID.
/// </summary>
public string InstanceId { get; private set; }
/// <summary>
- /// Gets the instance Name.
+ /// Gets the instance name.
/// </summary>
public string InstanceName { get; private set; }
public string Arg { get; private set; }
/// <summary>
- /// Gets the uri.
+ /// Gets the URI.
/// </summary>
public string Uri { get; private set; }
namespace Tizen.Applications
{
/// <summary>
- /// Class for getting resource path.
+ /// The class for getting the resource path.
/// </summary>
public static class ResourceManager
{
/// <summary>
- /// Enumeration for Resource category.
+ /// Enumeration for the resource category.
/// </summary>
public enum Category : int
{
}
/// <summary>
- /// Converts resource ID to path name.
+ /// Converts resource ID to the path name.
/// </summary>
- /// <param name="category">Category to search</param>
- /// <param name="id">ID to search</param>
- /// <returns>Found resource path</returns>
- /// <exception cref="InvalidOperationException">Thrown in case of failed conditions</exception>
+ /// <param name="category">Category to search.</param>
+ /// <param name="id">ID to search.</param>
+ /// <returns>Found resource path.</returns>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
public static string GetPath(Category category, string id)
{
string path;
}
/// <summary>
- /// Converts resource ID to path name.
+ /// Converts resource ID to the path name.
/// </summary>
- /// <param name="category">Category to search</param>
- /// <param name="id">ID to search</param>
- /// <returns>Found resource path or null when the resource doesn't exist</returns>
- /// <exception cref="InvalidOperationException">Thrown in case of failed conditions</exception>
+ /// <param name="category">Category to search.</param>
+ /// <param name="id">ID to search.</param>
+ /// <returns>Found resource path or null when the resource doesn't exist.</returns>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
public static string TryGetPath(Category category, string id)
{
string path;
namespace Tizen.Applications
{
/// <summary>
- /// Represents a wrapper class for a unmanaged AppControl handle.
+ /// Represents a wrapper class for an unmanaged AppControl handle.
/// </summary>
public sealed class SafeAppControlHandle : SafeHandle
{
/// <summary>
/// When overridden in a derived class, executes the code required to free the handle.
/// </summary>
- /// <returns>true if the handle is released successfully</returns>
+ /// <returns>true if the handle is released successfully.</returns>
protected override bool ReleaseHandle()
{
Interop.AppControl.DangerousDestroy(this.handle);
namespace Tizen.Applications
{
/// <summary>
- /// Represents a wrapper class for a unmanaged Bundle handle.
+ /// Represents a wrapper class for an unmanaged bundle handle.
/// </summary>
public sealed class SafeBundleHandle : SafeHandle
{
/// <summary>
/// When overridden in a derived class, executes the code required to free the handle.
/// </summary>
- /// <returns>true if the handle is released successfully</returns>
+ /// <returns>true if the handle is released successfully.</returns>
protected override bool ReleaseHandle()
{
Interop.Bundle.DangerousFree(this.handle);
}
/// <summary>
- /// Initilizes a new TizenSynchronizationContext and install into current thread
+ /// Initilizes a new TizenSynchronizationContext and install into the current thread.
/// </summary>
/// <remarks>
- /// It is equivalent
+ /// It is equivalent.
/// <code>
/// SetSynchronizationContext(new TizenSynchronizationContext());
/// </code>
/// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
/// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
/// <remarks>
- /// The Post method starts an asynchronous request to post a message.</remarks>
+ /// The post method starts an asynchronous request to post a message.</remarks>
public override void Post(SendOrPostCallback d, object state)
{
Post(() =>
}
/// <summary>
- /// Dispatches a synchronous message to a Tizen main loop
+ /// Dispatches a synchronous message to a Tizen main loop.
/// </summary>
/// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
/// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
/// <remarks>
- /// The Send method starts a synchronous request to send a message.</remarks>
+ /// The send method starts a synchronous request to send a message.</remarks>
public override void Send(SendOrPostCallback d, object state)
{
var mre = new ManualResetEvent(false);
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// Represents BulkData class for DataControl bulk request.
+ /// Represents the BulkData class for the DataControl bulk request.
/// </summary>
public class BulkData : IDisposable
{
private Interop.DataControl.SafeBulkDataHandle _handle;
/// <summary>
- /// Initializes BulkData class.
+ /// Initializes the BulkData class.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
public BulkData()
}
/// <summary>
- /// Adds bulk data.
+ /// Adds the bulk data.
/// </summary>
/// <param name="data">Bulk data</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public void Add(Bundle data)
{
ResultType ret;
}
/// <summary>
- /// Gets current data count.
+ /// Gets the current data count.
/// </summary>
public int GetCount()
{
/// <summary>
/// Returns the data at the given zero-based data index.
/// </summary>
- /// <param name="index">Target data index</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="index">The target data index.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public Bundle GetData(int index)
{
IntPtr bundlePtr;
}
/// <summary>
- /// Releases all resources used by the BulkData class.
+ /// Releases all the resources used by the BulkData class.
/// </summary>
public void Dispose()
{
}
/// <summary>
- /// Represents BulkResultData class for DataControl bulk request.
+ /// Represents the BulkResultData class for the DataControl bulk request.
/// </summary>
public class BulkResultData : IDisposable
{
private bool _disposed = false;
private Interop.DataControl.SafeBulkResultDataHandle _handle;
/// <summary>
- /// Initializes BulkResultData class.
+ /// Initializes the BulkResultData class.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
public BulkResultData()
}
/// <summary>
- /// Adds bulk operation result data.
+ /// Adds the bulk operation result data.
/// </summary>
- /// <param name="data">Result data</param>
- /// <param name="result">Result</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="data">The result data.</param>
+ /// <param name="result">Result.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public void Add(Bundle data, int result)
{
ResultType ret;
}
/// <summary>
- /// Gets current result data count.
+ /// Gets the current result data count.
/// </summary>
public int GetCount()
{
/// <summary>
/// Returns the result data at the given zero-based data index.
/// </summary>
- /// <param name="index">Target result data index</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="index">The target result data index.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public Bundle GetData(int index)
{
IntPtr bundlePtr;
/// <summary>
/// Returns the result at the given zero-based data index.
/// </summary>
- /// <param name="index">Target result index</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="index">The target result index.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public int GetResult(int index)
{
IntPtr bundlePtr;
}
/// <summary>
- /// Releases all resources used by the BulkResultData class.
+ /// Releases all the resources used by the BulkResultData class.
/// </summary>
public void Dispose()
{
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// Represents Consumer class for DataControl consumer application.
+ /// Represents the Consumer class for the DataControl consumer application.
/// </summary>
public abstract class Consumer : IDisposable
{
}
/// <summary>
- /// Sends insert request to provider application.
+ /// Sends the insert request to the provider application.
/// </summary>
- /// <remarks>OnInsertResult will recieve result of this API</remarks>
- /// <param name="insertData">Insert data</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnInsertResult will recieve the result of this API.</remarks>
+ /// <param name="insertData">The insert data.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends select request to provider application.
+ /// Sends the select request to the provider application.
/// </summary>
- /// <remarks>OnSelectResult will recieve result of this API</remarks>
- /// <param name="columnList">Select target column list</param>
- /// <param name="where">Where statement for select query</param>
- /// <param name="order">Order statement for select query</param>
- /// <param name="pageNumber">Select target page number</param>
- /// <param name="countPerPage">Select row count per page</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>The OnSelectResult will recieve the result of this API.</remarks>
+ /// <param name="columnList">Select the target column list.</param>
+ /// <param name="where">The Where statement for the select query.</param>
+ /// <param name="order">The Order statement for the select query.</param>
+ /// <param name="pageNumber">Select the target page number.</param>
+ /// <param name="countPerPage">Select the row count per page.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied..</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends delete request to provider application.
+ /// Sends the delete request to the provider application.
/// </summary>
- /// <remarks>OnDeleteResult will recieve result of this API</remarks>
- /// <param name="where">Where statement for delete query</param>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>The OnDeleteResult will recieve the result of this API</remarks>
+ /// <param name="where">The Where statement for the delete query.</param>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends update request to provider application.
+ /// Sends the update request to the provider application.
/// </summary>
- /// <remarks>OnUpdateResult will recieve result of this API</remarks>
- /// <param name="updateData">Update data</param>
- /// <param name="where">Where statement for query</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnUpdateResult will recieve result of this API.</remarks>
+ /// <param name="updateData">The update data.</param>
+ /// <param name="where">The Where statement for the query.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends bulk insert request to provider application.
+ /// Sends the bulk insert request to the provider application.
/// </summary>
- /// <remarks>OnBulkInsertResult will recieve result of this API</remarks>
- /// <param name="insertData">Bulk insert data</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnBulkInsertResult will recieve the result of this API.</remarks>
+ /// <param name="insertData">The bulk insert data.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case oif a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends map add request to provider application.
+ /// Sends the map add request to the provider application.
/// </summary>
- /// <remarks>OnMapAddResult will recieve result of this API</remarks>
- /// <param name="key">The key of the value to add</param>
- /// <param name="value">The value to add</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnMapAddResult will recieve the result of this API.</remarks>
+ /// <param name="key">The key of the value to add.</param>
+ /// <param name="value">The value to add.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of if a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends map get request to provider application.
+ /// Sends the map get request to the provider application.
/// </summary>
- /// <remarks>OnMapGetResult will recieve result of this API</remarks>
- /// <param name="key">The key of the value list to obtain</param>
- /// <param name="pageNumber">The page number of the value set</param>
- /// <param name="countPerPage">The desired maximum count of the data items per page</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>The OnMapGetResult will recieve the result of this API.</remarks>
+ /// <param name="key">The key of the value list to obtain.</param>
+ /// <param name="pageNumber">The page number of the value set.</param>
+ /// <param name="countPerPage">The desired maximum count of the data items per page.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends map remove request to provider application.
+ /// Sends the map remove request to the provider application.
/// </summary>
- /// <remarks>OnMapRemoveResult will recieve result of this API</remarks>
- /// <param name="key">The key of the value to remove</param>
- /// <param name="value">The value to remove</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>The OnMapRemoveResult will recieve the result of this API.</remarks>
+ /// <param name="key">The key of the value to remove.</param>
+ /// <param name="value">The value to remove.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends map set request to provider application.
+ /// Sends the map set request to the provider application.
/// </summary>
- /// <remarks>OnMapSetResult will recieve result of this API</remarks>
- /// <param name="key">The key of the value to replace</param>
- /// <param name="oldValue">The value to be replaced</param>
- /// <param name="newValue"> The new value that replaces the existing value</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnMapSetResult will recieve the result of this API.</remarks>
+ /// <param name="key">The key of the value to replace.</param>
+ /// <param name="oldValue">The value to be replaced.</param>
+ /// <param name="newValue"> The new value that replaces the existing value.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Sends map bulk add request to provider application.
+ /// Sends the map bulk add request to the provider application.
/// </summary>
- /// <remarks>OnMapBulkAddResult will recieve result of this API</remarks>
- /// <param name="addData">Map bulk add data</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(1MB)</exception>
+ /// <remarks>The OnMapBulkAddResult will recieve the result of this API.</remarks>
+ /// <param name="addData">The map bulk add data.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Listen DataChange event
+ /// Listens the DataChange event.
/// </summary>
- /// <remarks>OnDataChangeListenResult will recieve result of this API</remarks>
- /// <remarks>If success, OnDataChange will recieve DataChange event</remarks>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>The OnDataChangeListenResult will recieve the result of this API.</remarks>
+ /// <remarks>If success, the OnDataChange will recieve the DataChange event.</remarks>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
}
/// <summary>
- /// Initializes Consumer class with providerId and dataId.
+ /// Initializes the Consumer class with the providerId and the ataId.
/// </summary>
- /// <param name="providerId">DataControl Provider ID</param>
- /// <param name="dataId">DataControl Data ID</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="providerId">The DataControl Provider ID.</param>
+ /// <param name="dataId">The DataControl Data ID.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
public Consumer(string providerId, string dataId)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the DataChangeListen result is received.
+ /// Overrides this method if you want to handle the behavior when the DataChangeListen result is received.
/// </summary>
protected virtual void OnDataChangeListenResult(DataChangeListenResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the data change event is received.
+ /// Overrides this method if you want to handle the behavior when the data change event is received.
/// </summary>
protected virtual void OnDataChange(ChangeType type, Bundle data)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the select response is received.
+ /// Overrides this method if you want to handle the behavior when the select response is received.
/// </summary>
protected abstract void OnSelectResult(SelectResult result);
/// <summary>
- /// Overrides this method if want to handle behavior when the insert response is received.
+ /// Overrides this method if you want to handle the behavior when the insert response is received.
/// </summary>
protected abstract void OnInsertResult(InsertResult result);
/// <summary>
- /// Overrides this method if want to handle behavior when the update response is received.
+ /// Overrides this method if you want to handle the behavior when the update response is received.
/// </summary>
protected abstract void OnUpdateResult(UpdateResult result);
/// <summary>
- /// Overrides this method if want to handle behavior when the delete response is received.
+ /// Overrides this method if want to handle the behavior when the delete response is received.
/// </summary>
protected abstract void OnDeleteResult(DeleteResult result);
/// <summary>
- /// Overrides this method if want to handle behavior when the BulkInsert response is received.
+ /// Overrides this method if you want to handle the behavior when the BulkInsert response is received.
/// </summary>
protected virtual void OnBulkInsertResult(BulkInsertResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map get response is received.
+ /// Overrides this method if you want to handle the behavior when the map get response is received.
/// </summary>
protected virtual void OnMapGetResult(MapGetResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map add response is received.
+ /// Overrides this method if you want to handle the behavior when the map add response is received.
/// </summary>
protected virtual void OnMapAddResult(MapAddResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map set response is received.
+ /// Overrides this method if you want to handle the behavior when the map set response is received.
/// </summary>
protected virtual void OnMapSetResult(MapSetResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map remove response is received.
+ /// Overrides this method if you want to handle the behavior when the map remove response is received.
/// </summary>
protected virtual void OnMapRemoveResult(MapRemoveResult result)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the BulkAdd response is received.
+ /// Overrides this method if you want to handle the behavior when the BulkAdd response is received.
/// </summary>
protected virtual void OnMapBulkAddResult(MapBulkAddResult result)
{
}
/// <summary>
- /// Releases the unmanaged resourced used by the Consumer class specifying whether to perform a normal dispose operation.
+ /// Releases the unmanaged resources used by the Consumer class specifying whether to perform a normal dispose operation.
/// </summary>
/// <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
protected virtual void Dispose(bool disposing)
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// This interface is for DataControl cursor.
+ /// This interface is for the DataControl cursor.
/// </summary>
public interface ICursor
{
/// </summary>
bool Reset();
/// <summary>
- /// / Gets an int value.
+ /// Gets an integer value.
/// </summary>
/// <param name="index">The index of row.</param>
int GetIntValue(int index);
/// <summary>
- /// / Gets an int64 value.
+ /// Gets an int64 value.
/// </summary>
/// <param name="index">The index of row.</param>
Int64 GetInt64Value(int index);
/// <summary>
- /// Gets an double value.
+ /// Gets a double value.
/// </summary>
/// <param name="index">The index of row.</param>
double GetDoubleValue(int index);
/// <summary>
- /// Gets an string value.
+ /// Gets a string value.
/// </summary>
/// <param name="index">The index of row.</param>
string GetStringValue(int index);
/// <summary>
- /// Gets a blob value.
+ /// Gets a BLOB value.
/// </summary>
/// <param name="index">The index of row.</param>
byte[] GetBlobValue(int index);
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// Represents MatrixCursor class for DataControl provider's matrix cursor.
+ /// Represents the MatrixCursor class for the DataControl provider's matrix cursor.
/// </summary>
public class MatrixCursor : IDisposable, ICursor
{
}
/// <summary>
- /// Gets column count of MatrixCursor.
+ /// Gets the column count of the MatrixCursor.
/// </summary>
public int GetColumnCount()
{
/// Returns the column type at the given zero-based column index.
/// </summary>
/// <param name="index">Target column index</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public ColumnType GetColumnType(int index)
{
if (index < 0 || index >= _columnTypes.Length)
/// <summary>
/// Returns the column name at the given zero-based column index.
/// </summary>
- /// <param name="index">Target column index</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="index">The target column index.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public string GetColumnName(int index)
{
if (index < 0 || index >= _columnTypes.Length)
}
/// <summary>
- /// Gets MatrixCursor's row count.
+ /// Gets the MatrixCursor's row count.
/// </summary>
public long GetRowCount()
{
}
/// <summary>
- /// Returns the value of the requested column as a int.
+ /// Returns the value of the requested column as an integer.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public int GetIntValue(int index)
{
int ret;
}
/// <summary>
- /// Returns the value of the requested column as a int64.
+ /// Returns the value of the requested column as int64.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public Int64 GetInt64Value(int index)
{
Int64 ret;
/// <summary>
/// Returns the value of the requested column as a double.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public double GetDoubleValue(int index)
{
double ret;
/// <summary>
/// Returns the value of the requested column as a string.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public string GetStringValue(int index)
{
string ret;
}
/// <summary>
- /// Returns the value of the requested column as a blob.
+ /// Returns the value of the requested column as a BLOB.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public byte[] GetBlobValue(int index)
{
byte[] byte_array;
}
/// <summary>
- /// Initializes MatrixCursor class with columnNames and columnTypes.
+ /// Initializes the MatrixCursor class with columnNames and columnTypes.
/// </summary>
- /// <param name="columnNames">MatrixCursor's column name list</param>
- /// <param name="columnTypes">MatrixCursor's column type list</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="columnNames">The MatrixCursor's column name list.</param>
+ /// <param name="columnTypes">The MatrixCursor's column type list.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
public MatrixCursor(string[] columnNames, ColumnType[] columnTypes)
{
/// Adds a new row to the end with the given column values.
/// </summary>
/// <param name="columnValues">New column values</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public void AddRow(object[] columnValues)
{
int i, size = 0;
}
/// <summary>
- /// Releases all resources used by the MatrixCursor class.
+ /// Releases all the resources used by the MatrixCursor class.
/// </summary>
public void Dispose()
{
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// Represents Provider class for DataControl provider application.
+ /// Represents the Provider class for the DataControl provider application.
/// </summary>
public abstract class Provider : IDisposable
{
private bool _isRunning = false;
/// <summary>
- /// Gets the data ID
+ /// Gets the data ID.
/// </summary>
public string DataID
{
/// <summary>
/// Sends a data change notification to consumer applications which have successfully added a data change listen.
/// </summary>
- /// <param name="type">Changed data type</param>
- /// <param name="changedData">Customized information about changed data</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="type">The changed data type.</param>
+ /// <param name="changedData">Customized information about the changed data.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
public void SendDataChange(ChangeType type, Bundle changedData)
}
/// <summary>
- /// Initializes Provider class with dataID.
+ /// Initializes the Provider class with the dataID.
/// </summary>
- /// <param name="dataID">DataControl Data ID</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="dataID">The DataControl Data ID.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public Provider(string dataID)
{
if (string.IsNullOrEmpty(dataID))
}
/// <summary>
- /// Starts Provider service.
+ /// Starts the Provider service.
/// </summary>
- /// <remarks>Only one Provider service can be ran for each process</remarks>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <remarks>Only one Provider service can be run for each process.</remarks>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
public void Run()
}
/// <summary>
- /// Stop Provider service.
+ /// Stops the Provider service.
/// </summary>
public void Stop()
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the select request is received.
+ /// Overrides this method if you want to handle the behavior when the select request is received.
/// </summary>
protected abstract SelectResult OnSelect(string query, string where, string[] columList, int columnCount, string order, int pageNum, int countPerPage);
/// <summary>
- /// Overrides this method if want to handle behavior when the insert request is received.
+ /// Overrides this method if you want to handle the behavior when the insert request is received.
/// </summary>
protected abstract InsertResult OnInsert(string query, Bundle insertData);
/// <summary>
- /// Overrides this method if want to handle behavior when the update request is received.
+ /// Overrides this method if you want to handle the behavior when the update request is received.
/// </summary>
protected abstract UpdateResult OnUpdate(string query, string where, Bundle updateData);
/// <summary>
- /// Overrides this method if want to handle behavior when the delete request is received.
+ /// Overrides this method if you want to handle the behavior when the delete request is received.
/// </summary>
protected abstract DeleteResult OnDelete(string query, string where);
/// <summary>
- /// Overrides this method if want to handle behavior when the bulk insert request is received.
+ /// Overrides this method if you want to handle the behavior when the bulk insert request is received.
/// </summary>
protected virtual BulkInsertResult OnBulkInsert(IEnumerable<string> query, BulkData bulkInsertData)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map get request is received.
+ /// Overrides this method if you want to handle the behavior when the map get request is received.
/// </summary>
protected virtual MapGetResult OnMapGet(string key)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the map add request is received.
+ /// Overrides this method if you want to handle the behavior when the map add request is received.
/// </summary>
protected virtual MapAddResult OnMapAdd(string key, string value)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the update request is received.
+ /// Overrides this method if you want to handle the behavior when the update request is received.
/// </summary>
protected virtual MapSetResult OnMapSet(string key, string oldValue, string newValue)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the delete request is received.
+ /// Overrides this method if you want to handle the behavior when the delete request is received.
/// </summary>
protected virtual MapRemoveResult OnMapRemove(string key, string value)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the bulk add request is received.
+ /// Overrides this method if you want to handle the behavior when the bulk add request is received.
/// </summary>
protected virtual MapBulkAddResult OnMapBulkAdd(BulkData bulkAddData)
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the data change listen request is received.
+ /// Overrides this method if you want to handle the behavior when the data change listen request is received.
/// </summary>
protected virtual DataChangeListenResult OnDataChangeListenRequest(string requestAppID)
{
}
/// <summary>
- /// Releases the unmanaged resourced used by the Provider class specifying whether to perform a normal dispose operation.
+ /// Releases unmanaged resources used by the Provider class specifying whether to perform a normal dispose operation.
/// </summary>
/// <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
protected virtual void Dispose(bool disposing)
}
/// <summary>
- /// Releases all resources used by the Provider class.
+ /// Releases all the resources used by the Provider class.
/// </summary>
public void Dispose()
{
namespace Tizen.Applications.DataControl
{
/// <summary>
- /// This class is for containing insert operation result.
+ /// This class contains the insert operation result.
/// </summary>
public class InsertResult
{
/// <summary>
- /// Gets the insert data's row id.
+ /// Gets the insert data's row ID.
/// </summary>
public long RowID
{
}
/// <summary>
- /// Initializes InsertResult class with columnNames and columnTypes.
+ /// Initializes the InsertResult class with columnNames and columnTypes.
/// </summary>
- /// <param name="rowID">Inserted row ID</param>
- /// <param name="result">Insert request result</param>
+ /// <param name="rowID">The inserted row ID.</param>
+ /// <param name="result">The insert request result.</param>
public InsertResult(long rowID, bool result)
{
RowID = rowID;
}
/// <summary>
- /// This class is for containing bulk insert operation result.
+ /// This class contains the bulk insert operation result.
/// </summary>
public class BulkInsertResult
{
}
/// <summary>
- /// Initializes InsertResult class with bulkResultData and result.
+ /// Initializes the InsertResult class with the bulkResultData and the result.
/// </summary>
- /// <param name="bulkResultData">Bulk insert request result data</param>
- /// <param name="result">Bulk insert request result</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="bulkResultData">The bulk insert request result data.</param>
+ /// <param name="result">The bulk insert request result.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public BulkInsertResult(BulkResultData bulkResultData, bool result)
{
if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid))
}
/// <summary>
- /// This class is for containing update operation result.
+ /// This class contains the update operation result.
/// </summary>
public class UpdateResult
{
}
/// <summary>
- /// Initializes UpdateResult class with result.
+ /// Initializes the UpdateResult class with the result.
/// </summary>
- /// <param name="result">Update request result</param>
+ /// <param name="result">The update request result.</param>
public UpdateResult(bool result)
{
Result = result;
}
/// <summary>
- /// This class is for containing delete operation result.
+ /// This class contains the delete operation result.
/// </summary>
public class DeleteResult
{
}
/// <summary>
- /// Initializes DeleteResult class with result.
+ /// Initializes the DeleteResult class with the result.
/// </summary>
- /// <param name="result">Delete request result</param>
+ /// <param name="result">The delete request result.</param>
public DeleteResult(bool result)
{
Result = result;
}
/// <summary>
- /// This class is for containing select operation result.
+ /// This class contains the select operation result.
/// </summary>
public class SelectResult
{
}
/// <summary>
- /// Initializes SelectResult class with cursor and result.
+ /// Initializes the SelectResult class with the cursor and the result.
/// </summary>
- /// <param name="cursor">Cursor with selected data</param>
- /// <param name="result">Select request result</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="cursor">The cursor with the selected data.</param>
+ /// <param name="result">The select request result.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public SelectResult(ICursor cursor, bool result)
{
int i;
}
/// <summary>
- /// This class is for containing MapAdd operation result.
+ /// This class contains the MapAdd operation result.
/// </summary>
public class MapAddResult
{
}
/// <summary>
- /// Initializes MapAddResult class with result.
+ /// Initializes the MapAddResult class with the result.
/// </summary>
- /// <param name="result">MapAdd request result</param>
+ /// <param name="result">The MapAdd request result.</param>
public MapAddResult(bool result)
{
Result = result;
}
/// <summary>
- /// This class is for containing MapBulkAdd operation result.
+ /// This class contains the MapBulkAdd operation result.
/// </summary>
public class MapBulkAddResult
{
}
/// <summary>
- /// Initializes MapBulkAddResult class with bulkResultData and result.
+ /// Initializes the MapBulkAddResult class with the bulkResultData and the result.
/// </summary>
- /// <param name="bulkResultData">MapBulkAdd request result data</param>
- /// <param name="result">MapBulkAdd request result</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="bulkResultData">The MapBulkAdd request result data.</param>
+ /// <param name="result">The MapBulkAdd request result.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public MapBulkAddResult(BulkResultData bulkResultData, bool result)
{
if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid))
}
/// <summary>
- /// This class is for containing MapSet operation result.
+ /// This class contains the MapSet operation result.
/// </summary>
public class MapSetResult
{
}
/// <summary>
- /// Initializes MapSetResult class with result.
+ /// Initializes the MapSetResult class with the result.
/// </summary>
/// <param name="result">MapSet request result</param>
public MapSetResult(bool result)
}
/// <summary>
- /// This class is for containing MapRemove operation result.
+ /// This class contains the MapRemove operation result.
/// </summary>
public class MapRemoveResult
{
}
/// <summary>
- /// Initializes MapRemoveResult class with result.
+ /// Initializes the MapRemoveResult class with the result.
/// </summary>
- /// <param name="result">MapRemove request result</param>
+ /// <param name="result">The MapRemove request result.</param>
public MapRemoveResult(bool result)
{
Result = result;
}
/// <summary>
- /// This class is for containing MapGet operation result.
+ /// This class contains the MapGet operation result.
/// </summary>
public class MapGetResult
{
}
/// <summary>
- /// Initializes MapGetResult class with data and result.
+ /// Initializes the MapGetResult class with the data and the result.
/// </summary>
- /// <param name="valueLIst">MapGet request result data</param>
- /// <param name="result">MapGet request result</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parmaeter.</exception>
+ /// <param name="valueLIst">The MapGet request result data.</param>
+ /// <param name="result">The MapGet request result.</param>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
public MapGetResult(string[] valueLIst, bool result)
{
if (result == true && valueLIst == null)
}
/// <summary>
- /// This class is for containing DataChangeListen operation result.
+ /// This class contains the DataChangeListen operation result.
/// </summary>
public class DataChangeListenResult
{
}
/// <summary>
- /// Initializes DataChangeListenResult class with result.
+ /// Initializes the DataChangeListenResult class with the result.
/// </summary>
- /// <param name="result">DataChangeListen request result</param>
+ /// <param name="result">The DataChangeListen request result.</param>
public DataChangeListenResult(ResultType result)
{
Result = result;
{
/// <summary>
- /// Enumeration for DataControl column type
+ /// Enumeration for the DataControl column types.
/// </summary>
public enum ColumnType : short
{
/// <summary>
- /// Value representing DataControl operation Success
+ /// Value representing DataControl operation success.
/// </summary>
ColumnTypeInt = 1,
/// <summary>
- /// Value representing DataControl operation Success
+ /// Value representing DataControl operation success.
/// </summary>
ColumnTypeDouble = 2,
/// <summary>
- /// Value representing DataControl operation Success
+ /// Value representing DataControl operation success.
/// </summary>
ColumnTypeString = 3,
/// <summary>
- /// Value representing DataControl operation Success
+ /// Value representing DataControl operation success.
/// </summary>
ColumnTypeBlob = 4
}
/// <summary>
- /// Enumeration for DataControl column type
+ /// Enumeration for the DataControl column types.
/// </summary>
public enum ChangeType : short
{
/// <summary>
- /// Value representing DataControl provider data changed by update
+ /// Value representing DataControl provider data changed by update.
/// </summary>
Update,
/// <summary>
- /// Value representing DataControl provider data changed by insert
+ /// Value representing DataControl provider data changed by insert.
/// </summary>
Insert,
/// <summary>
- /// Value representing DataControl provider data changed by delete
+ /// Value representing DataControl provider data changed by delete.
/// </summary>
Delete,
/// <summary>
- /// Value representing DataControl provider data changed by map add
+ /// Value representing DataControl provider data changed by map add.
/// </summary>
MapAdd,
/// <summary>
- /// Value representing DataControl provider data changed by map remove
+ /// Value representing DataControl provider data changed by map remove.
/// </summary>
MapRemove,
/// <summary>
- /// Value representing DataControl provider data changed by map set
+ /// Value representing DataControl provider data changed by map set.
/// </summary>
MapSet,
}
/// <summary>
- /// Enumeration for DataControl result type
+ /// Enumeration for the DataControl result types.
/// </summary>
public enum ResultType : int
{
/// <summary>
- /// Value representing DataControl operation success
+ /// Value representing DataControl operation success.
/// </summary>
Success = Interop.DataControl.NativeResultType.Success,
/// <summary>
- /// Value representing DataControl operation cause out of memory error
+ /// Value representing DataControl operation causing out of memory error.
/// </summary>
OutOfMemory = Interop.DataControl.NativeResultType.OutOfMemory,
/// <summary>
- /// Value representing DataControl operation cause IO error
+ /// Value representing DataControl operation causing I/O error.
/// </summary>
IoError = Interop.DataControl.NativeResultType.IoError,
/// <summary>
- /// Value representing DataControl operation cause Invalid parameter error
+ /// Value representing DataControl operation causing invalid parameter error.
/// </summary>
InvalidParameter = Interop.DataControl.NativeResultType.InvalidParameter,
/// <summary>
- /// Value representing DataControl operation cause permission denied error
+ /// Value representing DataControl operation causing permission denied error.
/// </summary>
PermissionDenied = Interop.DataControl.NativeResultType.PermissionDenied,
/// <summary>
- /// Value representing DataControl operation cause max exceed error
+ /// Value representing DataControl operation causing max exceed error.
/// </summary>
MaxExceed = Interop.DataControl.NativeResultType.MaxExceed,
}
namespace Tizen.Applications.Messages
{
/// <summary>
- /// The Message Port API provides functions to send and receive messages between applications.
+ /// The message port API provides functions to send and receive messages between applications.
/// </summary>
/// <remarks>
- /// The Message Port API provides functions for passing messages between applications. An application should register its own local port to receive messages from remote applications.
+ /// The message port API provides functions for passing messages between applications. An application should register its own local port to receive messages from remote applications.
/// If a remote application sends a message, the registered callback function of the local port is called.
/// The trusted message-port API allows communications between applications that are signed by the same developer(author) certificate.
/// </remarks>
/// <summary>
/// Initializes the instance of the MessagePort class.
/// </summary>
- /// <param name="portName">The name of the local message port</param>
- /// <param name="trusted">If true is the trusted message port of application, otherwise false</param>
- /// <exception cref="System.InvalidOperationException">Thrown when portName is null or empty</exception>
+ /// <param name="portName">The name of the local message port.</param>
+ /// <param name="trusted">If true, it is the trusted message port of application, otherwise false.</param>
+ /// <exception cref="System.InvalidOperationException">Thrown when portName is null or empty.</exception>
/// <code>
/// MessagePort messagePort = new MessagePort("SenderPort", true);
/// </code>
public event EventHandler<MessageReceivedEventArgs> MessageReceived;
/// <summary>
- /// The name of the local message port
+ /// The name of the local message port.
/// </summary>
public string PortName
{
}
}
/// <summary>
- /// If true the message port is a trusted port, otherwise false it is not
+ /// If true, the message port is a trusted port, otherwise false.
/// </summary>
public bool Trusted
{
}
/// <summary>
- /// If true the message port is listening, otherwise false it is not
+ /// If true, the message port is listening, otherwise false.
/// </summary>
public bool Listening
{
/// <summary>
/// Register the local message port.
/// </summary>
- /// <exception cref="System.InvalidOperationException">Thrown when portName is already used, when there is an invalid parameter, when out of memory, when there is an I/O error</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when portName is already used, when there is an invalid parameter, when out of memory, when there is an I/O error.</exception>
/// <code>
/// MessagePort messagePort = new MessagePort("SenderPort", true);
/// messagePort.MessageReceived += MessageReceivedCallback;
/// <summary>
/// Unregisters the local message port.
/// </summary>
- /// <exception cref="System.InvalidOperationException">Thrown when messageport is already stopped, when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when messageport is already stopped, when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
/// <code>
/// MessagePort messagePort = new MessagePort("SenderPort", true);
/// messagePort.MessageReceived += MessageReceivedCallback;
}
/// <summary>
- /// Sends a untrusted message to the message port of a remote application.
+ /// Sends an untrusted message to the message port of a remote application.
/// </summary>
- /// <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB</param>
- /// <param name="remoteAppId">The ID of the remote application</param>
- /// <param name="remotePortName">The name of the remote message port</param>
- /// <exception cref="System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB)</exception>
+ /// <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB.</param>
+ /// <param name="remoteAppId">The ID of the remote application.</param>
+ /// <param name="remotePortName">The name of the remote message port.</param>
+ /// <exception cref="System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB).</exception>
/// <code>
/// MessagePort messagePort = new MessagePort("SenderPort", true);
/// messagePort.MessageReceived += MessageReceivedCallback;
/// <summary>
/// Sends a message to the message port of a remote application.
/// </summary>
- /// <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB</param>
- /// <param name="remoteAppId">The ID of the remote application</param>
- /// <param name="remotePortName">The name of the remote message port</param>
- /// <param name="trusted">If true the trusted message port of remote application otherwise false</param>
- /// <exception cref="System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB)</exception>
+ /// <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB.</param>
+ /// <param name="remoteAppId">The ID of the remote application.</param>
+ /// <param name="remotePortName">The name of the remote message port.</param>
+ /// <param name="trusted">If true, it is the trusted message port of remote application, otherwise false.</param>
+ /// <exception cref="System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB).</exception>
/// <code>
/// MessagePort messagePort = new MessagePort("SenderPort", true);
/// messagePort.MessageReceived += MessageReceivedCallback;
}
/// <summary>
- /// Releases the unmanaged resourced used by the MessagePort class specifying whether to perform a normal dispose operation.
+ /// Releases the unmanaged resource used by the MessagePort class specifying whether to perform a normal dispose operation.
/// </summary>
/// <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
protected virtual void Dispose(bool disposing)
namespace Tizen.Applications.Messages
{
/// <summary>
- /// An extended EventArgs class which contains remote message port information and message
+ /// An extended EventArgs class, which contains remote message port information and message.
/// </summary>
public class MessageReceivedEventArgs : EventArgs
{
/// <summary>
- /// Contains AppId, Port Name, Trusted
+ /// Contains AppId, port name, and trusted.
/// </summary>
public RemoteValues Remote { get; internal set; }
/// <summary>
- /// The message passed from the remote application
+ /// The message passed from the remote application.
/// </summary>
public Bundle Message { get; internal set; }
}
namespace Tizen.Applications.Messages
{
/// <summary>
- /// Contains AppId, Port Name, Trusted
+ /// Contains AppId, port name, and trusted.
/// </summary>
public class RemoteValues
{
/// <summary>
- /// The ID of the remote application that sent this message
+ /// The ID of the remote application that sent this message.
/// </summary>
public string AppId { get; set; }
/// <summary>
- /// The name of the remote message port
+ /// The name of the remote message port.
/// </summary>
public string PortName { get; set; }
/// <summary>
- /// If true the remote port is a trusted port, otherwise if false it is not
+ /// If true, the remote port is a trusted port, otherwise, if false, it is not.
/// </summary>
public bool Trusted { get; set; }
}
[DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")]
internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index);
+ [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_event_handler")]
+ internal static extern NotificationError SetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, SafeAppControlHandle appcontrol);
+
+ [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_event_handler")]
+ internal static extern NotificationError GetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, out SafeAppControlHandle appcontrol);
+
internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text)
{
NotificationError ret;
using System.ComponentModel;
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
private bool disposed = false;
private IDictionary<string, StyleBase> styleDictionary;
- private IDictionary<string, Bundle> extenderDictionary;
+ private IDictionary<string, Bundle> extraDataDictionary;
private int count = 0;
/// <summary>
public Notification()
{
styleDictionary = new Dictionary<string, StyleBase>();
- extenderDictionary = new Dictionary<string, Bundle>();
+ extraDataDictionary = new Dictionary<string, Bundle>();
}
/// <summary>
- /// Gets or sets Tag of Notification.
+ /// Gets or sets the tag of notification.
/// </summary>
public string Tag { get; set; } = string.Empty;
/// <summary>
- /// Gets or sets Title of Notification.
+ /// Gets or sets the title of notification.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
- /// Gets or sets icon of Notification.
+ /// Gets or sets the icon of notification.
+ /// You should set an absolute path for an image file.
/// </summary>
public string Icon { get; set; } = string.Empty;
/// <summary>
- /// Gets or sets sub icon of Notification.
+ /// Gets or sets the sub icon of notification.
/// This SubIcon is displayed in Icon you set.
+ /// You should set an absolute path for an image file.
/// </summary>
public string SubIcon { get; set; } = string.Empty;
/// <summary>
- /// Gets or sets content of Notification.
+ /// Gets or sets the content of notification.
/// </summary>
public string Content { get; set; } = string.Empty;
/// <summary>
- /// Gets or sets a value indicating whether TimeStamp of Notification is Visible or not.
+ /// Gets or sets a value indicating whether TimeStamp of the notification is Visible or not.
/// Default to true.
/// </summary>
public bool IsTimeStampVisible { get; set; } = true;
/// <summary>
- /// Gets or sets TimeStamp of Notification.
+ /// Gets or sets the TimeStamp of notification.
/// </summary>
/// <remarks>
- /// If you don't set TimeStamp, It will be set value that time when the notification is posted.
+ /// If you don't set TimeStamp, it will set the value when the notification is posted.
/// TimeStamp requires NotificationManager.Post() to be called.
- /// If you set IsVisibleTimeStamp property is false, TimeStamp is not Visible in Notification.
+ /// If you set IsVisibleTimeStamp property to false, TimeStamp is not visible in notification.
/// </remarks>
public DateTime TimeStamp { get; set; }
/// <summary>
- /// Gets or sets Action which is invoked when notification is clicked
+ /// Gets or sets action, which is invoked when the notification is clicked.
/// </summary>
/// <remarks>
/// If you set it to null, the already set AppControl will be removed and nothing will happen when you click on notification.
public AppControl Action { get; set; }
/// <summary>
- /// Gets or sets Count which is displayed at the right side of notification.
+ /// Gets or sets count, which is displayed at the right side of the notification.
/// </summary>
/// <remarks>
/// You must set only positive number.
- /// If you set count to negative number, This property throw exception.
+ /// If you set count to negative number, this property throws exception.
/// </remarks>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public int Count
{
get
public bool IsOngoing { get; set; } = false;
/// <summary>
- /// Gets or sets property
+ /// Gets or sets property.
/// </summary>
/// <seealso cref="Tizen.Applications.Notifications.NotificationProperty"></seealso>
public NotificationProperty Property { get; set; } = NotificationProperty.None;
/// <summary>
- /// Gets or sets <see cref="Notification.ProgressType"/> object for display at notification
+ /// Gets or sets <see cref="Notification.ProgressType"/> object for display at notification.
/// </summary>
/// <seealso cref="Tizen.Applications.Notifications.Notification.ProgressType"></seealso>
public ProgressType Progress { get; set; }
/// <summary>
- /// Gets or sets <see cref="Notification.AccessorySet"/> which is included vibration, led and sound option to be applied at Notification.
+ /// Gets or sets <see cref="Notification.AccessorySet"/> which is included vibration, LED and sound option to be applied at notification.
/// </summary>
/// <remarks>
/// If you set it to null, the already set AccessorySet will be initialized.
public AccessorySet Accessory { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether notification is displayed on default viewer.
+ /// Gets or sets a value indicating whether notification is displayed on the default viewer.
/// If you set false and add style, you can see only style notification.
/// </summary>
- public bool IsDisplay { get; set; } = true;
+ public bool IsVisible { get; set; } = true;
/// <summary>
- /// Gets or sets NotificationSafeHandle
+ /// Gets or sets NotificationSafeHandle.
/// </summary>
internal NotificationSafeHandle Handle
{
}
/// <summary>
- /// Gets or sets Private ID
+ /// Gets or sets private ID.
/// </summary>
internal int PrivID { get; set; } = -1;
/// <summary>
- /// Method to add various style to be applied to notification.
+ /// Method for adding various styles to be applied to notification.
/// </summary>
/// <remarks>
- /// The user always see about valid notification style. If you add style which is not supported in platform,
+ /// The user always see about valid notification style. If you add a style which is not supported in platform,
/// this method has no effect.
/// </remarks>
- /// <param name="style">The style to be applied to notification</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <param name="style">The style to be applied to notification.</param>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
/// <example>
/// <code>
/// Notification notification = new Notification
/// <summary>
/// Method to remove style you already added.
/// </summary>
- /// <typeparam name="T">Type of notification style to be queried</typeparam>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <typeparam name="T">Type of notification style to be queried.</typeparam>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public void RemoveStyle<T>() where T : Notification.StyleBase, new()
{
T type = new T();
/// <summary>
/// Method to get style you already added.
/// </summary>
- /// <typeparam name="T">Type of notification style to be queried</typeparam>
+ /// <typeparam name="T">Type of notification style to be queried.</typeparam>
/// <returns>
- /// The Notification.Style object associated with the given style
+ /// The Notification.Style object associated with the given style.
/// </returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public T GetStyle<T>() where T : Notification.StyleBase, new()
{
T type = new T();
}
/// <summary>
- /// Method to set extender data to add extra data
+ /// Method to set extra data to add extra data.
/// </summary>
/// <remarks>
- /// The type of extra data is Bundle.
+ /// The type of extra data is bundle.
/// </remarks>
/// <param name="key">The key of the extra data you want to add.</param>
/// <param name="value">The value you want to add.</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
/// <example>
/// <code>
/// Notification notification = new Notification
/// Bundle bundle = new Bundle();
/// bundle.AddItem("key", "value");
///
- /// notification.SetExtender("firstKey", bundle);
+ /// notification.SetExtraData("firstKey", bundle);
/// </code>
/// </example>
- public void SetExtender(string key, Bundle value)
+ public void SetExtraData(string key, Bundle value)
{
if (value == null || value.SafeBundleHandle.IsInvalid || string.IsNullOrEmpty(key))
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered");
}
- if (extenderDictionary.ContainsKey(key) == true)
+ if (extraDataDictionary.ContainsKey(key) == true)
{
Log.Info(LogTag, "The key is existed, so extender data is replaced");
- extenderDictionary.Remove(key);
- extenderDictionary.Add(key, value);
+ extraDataDictionary.Remove(key);
+ extraDataDictionary.Add(key, value);
}
else
{
- extenderDictionary.Add(key, value);
+ extraDataDictionary.Add(key, value);
}
}
/// <summary>
- /// Method to remove extender you already added.
+ /// Method to remove extra you already added.
/// </summary>
/// <remarks>
- /// The type of extra data is Bundle.
+ /// The type of extra data is bundle.
/// </remarks>
/// <param name="key">The key of the extra data to add.</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- public void RemoveExtender(string key)
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
+ public void RemoveExtraData(string key)
{
if (string.IsNullOrEmpty(key))
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered");
}
- if (extenderDictionary.ContainsKey(key))
+ if (extraDataDictionary.ContainsKey(key))
{
- extenderDictionary.Remove(key);
+ extraDataDictionary.Remove(key);
}
else
{
}
/// <summary>
- /// Method to get extender data you already set
+ /// Method to get extra data you already set.
/// </summary>
/// <param name="key">The key of the extra data to get.</param>
- /// <returns>Bundle Object that include extender data</returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- public Bundle GetExtender(string key)
+ /// <returns>Bundle Object that include extra data</returns>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
+ public Bundle GetExtraData(string key)
{
if (string.IsNullOrEmpty(key))
{
}
Bundle bundle;
- if (extenderDictionary.TryGetValue(key, out bundle) == false)
+ if (extraDataDictionary.TryGetValue(key, out bundle) == false)
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered : " + key);
}
return styleDictionary;
}
- internal IDictionary<string, Bundle> GetExtenderDictionary()
+ internal IDictionary<string, Bundle> GetextraDataDictionary()
{
- return extenderDictionary;
+ return extraDataDictionary;
}
internal StyleBase GetStyle(string key)
{
NotificationBinder.BindObject(this);
- foreach (string key in GetExtenderDictionary().Keys)
+ foreach (string key in GetextraDataDictionary().Keys)
{
Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle");
- Interop.Notification.SetExtentionData(Handle, key, extenderDictionary[key].SafeBundleHandle);
+ Interop.Notification.SetExtentionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
}
foreach (Notification.StyleBase style in styleDictionary.Values)
Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
foreach (string key in bundle.Keys)
{
+ if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
+ continue;
+
SafeBundleHandle sbh;
Interop.Notification.GetExtentionData(Handle, key, out sbh);
- extenderDictionary.Add(key, new Bundle(sbh));
+ extraDataDictionary.Add(key, new Bundle(sbh));
}
}
using Tizen.Common;
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for Notification AccessorySet which is included vibration, led, sound option
+ /// Class for notification AccessorySet, which includes vibration, LED, and sound option.
/// </summary>
public sealed class AccessorySet : MakerBase
{
/// Gets or sets the sound option. Default to AccessoryOption.Off.
/// </summary>
/// <remarks>
- /// If you set AccessoryOption.Custom and not set SoundPath, then turn on the default sound.
+ /// If you set AccessoryOption.Custom, you must the SoundPath. Otherwise, an exception is thrown.
/// </remarks>
public AccessoryOption SoundOption { get; set; } = AccessoryOption.Off;
/// <summary>
/// Gets or sets the sound path, It will play on the sound file you set.
+ /// You should set an absolute path for a sound file.
/// </summary>
public string SoundPath { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether vibration is operated. Default to false.
+ /// Gets or sets a value indicating whether vibration is operated. Default is false.
/// </summary>
public bool CanVibrate { get; set; } = false;
/// <summary>
- /// Gets or sets the led option. Default to AccessoryOption.Off.
+ /// Gets or sets the led option. The default value is AccessoryOption.Off.
/// </summary>
/// <remarks>
- /// If you set AccessoryOption.Custom and not set LedColor, then turn on the LED with default color.
+ /// If you set AccessoryOption.Custom and not set LedColor, the LED will show default color.
/// </remarks>
public AccessoryOption LedOption { get; set; } = AccessoryOption.Off;
/// <summary>
- /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate
+ /// Gets or sets the on time so that it looks like the device's LED is blinking.
/// </summary>
/// <remarks>
/// Default value of LedOnMillisecond is 0.
/// The rate is specified in terms of the number of Milliseconds to be on.
- /// You should always set LedOnMillisecond with LedOffMillisecond. Otherwise, it may not operate normally.
+ /// You must set the on and off times at the same time. Otherwise, it may not operate normally.
/// </remarks>
public int LedOnMillisecond { get; set; }
/// <summary>
- /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate.
+ /// Gets or sets the off time so that it looks like the device's LED is blinking.
/// </summary>
/// <remarks>
/// The rate is specified in terms of the number of Milliseconds to be off.
- /// You should always set LedOffMillisecond with LedOnMillisecond. Otherwise, it may not operate normally.
+ /// You must set the on and off times at the same time. Otherwise, it may not operate normally.
/// </remarks>
public int LedOffMillisecond { get; set; }
/// <summary>
- /// Gets or sets the led color that you would like the LED on the device to blink.
+ /// Gets or sets the LED color that you would like the LED on the device to blink.
/// </summary>
/// <remarks>
- /// If you want to set LedColor, you should always set LedOption is AccessoryOption.Custom. Otherwise, it may operate default led color.
+ /// If you want to set LedColor, you should always set LedOption as AccessoryOption.Custom, otherwise, it may operate default LED color.
/// </remarks>
public Color LedColor { get; set; }
using System.Collections.Generic;
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for generating Active style notification
+ /// Class for generating active style notification.
/// </summary>
public sealed class ActiveStyle : StyleBase
{
}
/// <summary>
- /// Gets or sets an absolute path for an image file to display on the background of active notification
+ /// Gets or sets an absolute path for an image file to display on the background of active notification.
/// </summary>
public string BackgroundImage { get; set; }
/// Gets or sets a value indicating whether the active notification is removed automatically. Default value is true.
/// </summary>
/// <remarks>
- /// IsAutoRemove option lets the active notification be removed several seconds after it shows.
+ /// IsAutoRemove option lets the active notification to be removed several seconds after it shows.
/// When 'IsAutoRemove' is set as false, the active notification will not be removed as long as the user removes
- /// the active notification or the app which posted the active notification removes the active notification.
+ /// it or the application, which posted the active notification.
/// </remarks>>
public bool IsAutoRemove { get; set; } = true;
/// <summary>
- /// Gets or sets the default button to display highlight on the active notification
+ /// Gets or sets the default button to display highlight on the active notification.
/// </summary>
/// <remarks>
- /// The default button for display highlight is only reflected on Tizen TV.
- /// If you use this Property on other profile, this value have no effect
+ /// The default button for display highlight is only reflected on the Tizen TV.
+ /// If you use this property on other profile, this value has no effect.
/// </remarks>
public ButtonIndex DefaultButton { get; set; } = ButtonIndex.None;
/// </summary>
/// <remarks>
/// When you add a ReplyAction to the ActiveStyle, the notification UI will show a ReplyAction with button.
- /// If you set null parameter, ReplyAction is disappeared.
+ /// If you set null parameter, ReplyAction is not displayed.
/// </remarks>
/// <example>
/// <code>
public ReplyAction ReplyAction { get; set; }
/// <summary>
- /// Gets the key of ActiveStyle
+ /// Gets or sets Action which is invoked when notification is hidden by user.
+ /// </summary>
+ /// <remarks>
+ /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by user.
+ /// The property is only reflected on Tizen TV.
+ /// If you use this API on other profile, this action have no effect
+ /// </remarks>
+ /// <seealso cref="Tizen.Applications.AppControl"></seealso>
+ public AppControl HiddenByUserAction { get; set; }
+
+ /// <summary>
+ /// Gets or sets Action which is invoked when there is no any response by user until hide timeout.
+ /// </summary>
+ /// <remarks>
+ /// This action occurs when there is no response to the notification until the delete timeout set by SetRemoveTime().
+ /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by timeout.
+ /// The property is only reflected on Tizen TV.
+ /// If you use this API on other profile, this action settings have no effect
+ /// </remarks>
+ /// <seealso cref="Tizen.Applications.AppControl"></seealso>
+ public AppControl HiddenByTimeoutAction { get; set; }
+
+ /// <summary>
+ /// Gets or sets Action which is invoked when the notification is hidden by external factor.
+ /// </summary>
+ /// <remarks>
+ /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by external factor.
+ /// The property is only reflected on Tizen TV.
+ /// If you use this API on other profile, this action settings have no effect
+ /// </remarks>
+ /// <seealso cref="Tizen.Applications.AppControl"></seealso>
+ public AppControl HiddenByExternalAction { get; set; }
+
+ /// <summary>
+ /// Gets the key of ActiveStyle.
/// </summary>
internal override string Key
{
}
/// <summary>
- /// Method to set times to hide or delete notification.
+ /// Method to set time to hide or delete notification.
/// </summary>
/// <remarks>
- /// The time settings for hiding and deleting are only reflected on Tizen TV.
- /// If you use this API on other profile, this time settings have no effect
+ /// The time settings for hiding and deleting are only reflected on the Tizen TV.
+ /// If you use this API on other profile, this time settings have no effect.
/// </remarks>
- /// <param name="hideTime">The value in second when the notification can be hidden from the notification viewer after notification is posted</param>
- /// <param name="deleteTime">The value in second when the notification can be deleted from the notification list in setting application after notification is posted</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <param name="hideTime">The value in seconds when the notification can be hidden from the notification viewer after the notification is posted.</param>
+ /// <param name="deleteTime">The value in seconds when the notification can be deleted from the notification list in setting application after notification is posted.</param>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public void SetRemoveTime(int hideTime, int deleteTime)
{
if (hideTime < 0 || deleteTime < 0)
}
/// <summary>
- /// Method to get times to hide or delete notification.
+ /// Method to get time set to hide or delete notification.
/// </summary>
- /// <param name="hideTime">The value in second when the notification can be hidden from the notification viewer after notification is posted</param>
- /// <param name="deleteTime">The value in second when the notification can be deleted from the notification list in setting application after notification is posted</param>
+ /// <param name="hideTime">The value in seconds when the notification can be hidden from the notification viewer after notification is posted.</param>
+ /// <param name="deleteTime">The value in seconds when the notification can be deleted from the notification list in setting application after notification is posted.</param>
public void GetRemoveTime(out int hideTime, out int deleteTime)
{
hideTime = hideTimeout;
/// If you add button that has same index, the button is replaced to latest adding button.
/// If you don't set an index on ButtonAction, the index is set sequentially from zero.
/// </remarks>
- /// <param name="button">An ButtonAction for appear to the notification</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <param name="button">A ButtonAction for appear to the notification.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
/// <example>
/// <code>
///
}
/// <summary>
- /// Remove the ButtonAction you already add.
+ /// Removes the ButtonAction you already added.
/// </summary>
- /// <param name="index">The index to remove a button</param>
- /// <returns>true if the element is successfully found and removed; otherwise, false</returns>
+ /// <param name="index">The index to remove a button.</param>
+ /// <returns>true if the element is successfully found and removed; otherwise, false.</returns>
public bool RemoveButtonAction(ButtonIndex index)
{
bool ret = buttonDictionary.Remove(index);
/// <summary>
/// Gets the ButtonAction of the active notification.
/// </summary>
- /// <param name="index">The index to get a button you already add</param>
- /// <returns>The ButtonAction object which is you already add</returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <param name="index">The index to get a button you already added.</param>
+ /// <returns>The ButtonAction object, which you already added.</returns>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
public ButtonAction GetButtonAction(ButtonIndex index)
{
ButtonAction button = null;
}
}
}
-}
\ No newline at end of file
+}
Interop.Notification.SetID(notification.Handle, notification.PrivID);
- if (notification.IsDisplay)
+ if (notification.IsVisible)
{
Interop.Notification.SetApplist(notification.Handle, (int)NotificationDisplayApplist.Tray);
}
Interop.Notification.GetApplist(notification.Handle, out appList);
if ((appList & (int)NotificationDisplayApplist.Tray) == 0)
{
- notification.IsDisplay = false;
+ notification.IsVisible = false;
}
BindSafeHandleText(notification);
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class to help you set button on Active style of Notification
+ /// This class helps you to set the button on active style of notification.
/// </summary>
/// <remarks>
- /// It must include a Text, an Index, an ImagePath, and an Action to be invoked when user select the button.
+ /// It must include a text, an index, an ImagePath, and an action to be invoked when the user selects the button.
/// </remarks>>
public sealed class ButtonAction : MakerBase
{
/// <summary>
- /// Gets or sets the index of Button which is appeared at Notification.
+ /// Gets or sets the index of the button, which appeares as notification.
/// </summary>
public ButtonIndex Index { get; set; } = ButtonIndex.None;
/// <summary>
- /// Gets or sets the text describing the button
+ /// Gets or sets the text describing the button.
/// </summary>
public string Text { get; set; }
/// <summary>
- /// Gets or sets the image path that represent the button
+ /// Gets or sets the image path that represents the button.
+ /// You should provide an absolute path for an image file.
/// </summary>
public string ImagePath { get; set; }
/// <summary>
- /// Gets or sets the action which is invoked when button is clicked
+ /// Gets or sets the action, which is invoked when the button is clicked.
/// </summary>
/// <value>
- /// If you don't set Action, nothing happens when button is clicked.
+ /// If you don't set action, nothing happens when the button is clicked.
/// </value>
/// <example>
/// <code>
using System;
/// <summary>
- /// Enumeration for Progress category
+ /// Enumeration for the progress category.
/// </summary>
public enum ProgressCategory
{
/// <summary>
- /// Value for percent type
+ /// Value for percent type.
/// </summary>
Percent,
/// <summary>
- /// Value for time type
+ /// Value for time type.
/// </summary>
Time,
/// <summary>
- /// Value for pending type which is not updated progress current value
+ /// Value for pending type, which is not the updated progress current value.
/// </summary>
PendingBar
}
/// <summary>
- /// Enumeration for Accessory option
+ /// Enumeration for the accessory option.
/// </summary>
public enum AccessoryOption
{
/// <summary>
- /// Value for off accessory option
+ /// Value for off accessory option.
/// </summary>
Off = -1,
/// <summary>
- /// Value for on accessory option
+ /// Value for on accessory option.
/// </summary>
On,
/// <summary>
- /// Value for custom accessory option
+ /// Value for the custom accessory option.
/// </summary>
Custom
}
/// <summary>
- /// Enumeration for Button Index
+ /// Enumeration for the button index.
/// </summary>
public enum ButtonIndex
{
/// <summary>
- /// Value for default button index
+ /// Value for the default button index.
/// </summary>
None = -1,
/// <summary>
- /// Value for first button index
+ /// Value for the first button index.
/// </summary>
First,
/// <summary>
- /// Value for second button index
+ /// Value for the second button index.
/// </summary>
Second,
/// <summary>
- /// Value for third button index
+ /// Value for the third button index.
/// </summary>
Third
}
/// <summary>
- /// Enumeration for notification particular property
+ /// Enumeration for the notification particular property.
/// </summary>
[Flags]
public enum NotificationProperty
{
/// <summary>
- /// Value for adjust nothing
+ /// Value for adjust nothing.
/// </summary>
None = 0x00,
/// <summary>
- /// Value for display only SIM card inserted
+ /// Value for display only SIM card inserted.
/// </summary>
- DisplayOnlySimmode = 0x01,
+ DisplayOnlySimMode = 0x01,
/// <summary>
- /// Value for disable application launch when it selected
+ /// Value for disable application launch when it is selected.
/// </summary>
DisableAppLaunch = 0x02,
/// <summary>
- /// Value for disable auto delete when it selected
+ /// Value for disable auto delete when it is selected.
/// </summary>
DisableAutoDelete = 0x04,
/// <summary>
- /// Value for deleted when device is rebooted even though notification is not set Ongoing
+ /// Value for deleted when device is rebooted even though notification is not set ongoing.
/// </summary>
VolatileDisplay = 0x100
}
/// <summary>
- /// Enumeration for block state
+ /// Enumeration for the block state.
/// </summary>
public enum NotificationBlockState
{
/// <summary>
- /// Value to check the app is allowed to post notification
+ /// Value to check if the app is allowed to post notification.
/// </summary>
Allowed = 0,
/// <summary>
- /// Value to check the app is not allowed to post any notification
+ /// Value to check if the app is not allowed to post any notification.
/// </summary>
Blocked,
/// <summary>
- /// Value to check do not disturb mode which is user set
+ /// Value to check if the do not disturb mode is set by the user.
/// </summary>
DoNotDisturb
}
ThirdButton,
ClickOnIcon = 6,
ClockOnThumbnail = 7,
- ClickOnTextInputButton = 8
+ ClickOnTextInputButton = 8,
+ HiddenByUser = 100,
+ HiddenByTimeout = 101,
+ HiddenByExternal = 102,
}
internal enum NotificationLayout
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// The class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for generating Indicator style notification
+ /// Class for generating indicator style notification.
/// </summary>
public sealed class IndicatorStyle : StyleBase
{
public string IconPath { get; set; }
/// <summary>
- /// Gets or sets a sub text for displaying Indicator style
+ /// Gets or sets a sub text for displaying indicator style.
/// </summary>
public string SubText { get; set; }
/// <summary>
- /// Gets the key of IndicatorStyle
+ /// Gets the key of IndicatorStyle.
/// </summary>
internal override string Key
{
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for generating Lock style notification
+ /// Class for generating lock style notification.
/// </summary>
public sealed class LockStyle : StyleBase
{
/// <summary>
- /// Gets or sets an absolute path for an image file to display on the icon of Lock style
+ /// Gets or sets an absolute path for an image file to display the icon of lock style.
/// </summary>
public string IconPath { get; set; }
/// <summary>
- /// Gets or sets an absolute path for a thumbnail image file to display on Lock style
+ /// Gets or sets an absolute path for a thumbnail image file to display on lock style.
/// </summary>
public string ThumbnailPath { get; set; }
/// <summary>
- /// Gets the key of LockStyle
+ /// Gets the key of LockStyle.
/// </summary>
internal override string Key
{
using System.ComponentModel;
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// An object that help notification make to SafeHandle.
+ /// An object that helps notification to make to SafeHandle.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class MakerBase
using System.ComponentModel;
/// <summary>
- /// NotificationManager class to post, update, delete and get Notification.
+ /// NotificationManager class to post, update, delete, and get notification.
/// </summary>
public static class NotificationManager
{
/// <summary>
- /// Posts a new Notification.
+ /// Posts a new notification.
/// </summary>
- /// <param name="notification">Notification to post</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="notification">Notification to post.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
/// <code>
}
/// <summary>
- /// Updates a posted Notification.
+ /// Updates a posted notification.
/// </summary>
- /// <param name="notification">Notification to update</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="notification">Notification to update.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
/// <code>
/// </example>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// <pre>
- /// Post method should be called on the Notification object.
+ /// Post method should be called on the notification object.
/// </pre>
public static void Update(Notification notification)
{
}
/// <summary>
- /// Deletes a posted Notification.
+ /// Deletes a posted notification.
/// </summary>
- /// <param name="notification">Notification to remove</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <param name="notification">Notification to remove.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
/// <code>
/// </example>
/// <privilege>http://tizen.org/privilege/notification</privilege>
/// <pre>
- /// Post method should be called on the Notification object.
+ /// Post method should be called on the notification object.
/// </pre>
public static void Delete(Notification notification)
{
}
/// <summary>
- /// Removes all posted Notification of calling application.
+ /// Removes all posted notifications of calling application.
/// </summary>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
/// <code>
}
/// <summary>
- /// Searches for a posted notification which has the inputted tag and isn't deleted not yet.
+ /// Searches for a posted notification which has the specified tag and has not been deleted yet.
/// </summary>
/// <remarks>
- /// Load method should be called only for notifications which have been posted using NotificationManager.Post method.
+ /// Load method should be called only for notifications, which have been posted using the NotificationManager.Post method.
/// If two or more notifications share the same tag, the notification posted most recently is returned.
/// </remarks>
- /// <param name="tag">Tag used to query</param>
- /// <returns>Notification Object with inputted tag</returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid or when the tag does not exist</exception>
+ /// <param name="tag">Tag used to query.</param>
+ /// <returns>Notification Object with specified tag.</returns>
+ /// <exception cref="ArgumentException">Throwing the same exception when argument is invalid and when the tag does not exist is misleading.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
}
/// <summary>
- /// Saves a notification template to the notification database
+ /// Saves a notification template to the notification database.
/// </summary>
- /// <param name="notification">Notification to save as template</param>
- /// <param name="name">Template name</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
- /// <exception cref="InvalidOperationException">Thrown when can't save as template</exception>
+ /// <param name="notification">Notification to save as template.</param>
+ /// <param name="name">Template name.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when it can't be saved as a template.</exception>
/// <example>
/// <code>
/// Notification notification = new Notification
}
/// <summary>
- /// Loads a notification template from the notification database
+ /// Loads a notification template from the notification database.
/// </summary>
- /// <param name="name">Template name</param>
- /// <returns>Notification Object with inputted template name</returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid or when no template with input name exists</exception>
+ /// <param name="name">Template name.</param>
+ /// <returns>Notification Object with inputted template name.</returns>
+ /// <exception cref="ArgumentException">Throwing the same exception when argument is invalid and when the template does not exist is misleading.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <example>
/// <remarks>
/// The user can set the notification block state in settings.
/// The block state indicates whether or not notifications can be posted.
- /// Additionally only notifications to the notification panel are allowed in "Do not disturb mode".
- /// Sound, Vibrate and Active notifications are blocked.
+ /// Additionally, only notifications to the notification panel are allowed in "Do not disturb mode".
+ /// Sound, vibrate, and active notifications are blocked.
/// </remarks>
- /// <returns>NotificationBlockState is state if notification is posted</returns>
- /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
+ /// <returns>NotificationBlockState is a state if notification is posted.</returns>
+ /// <exception cref="UnauthorizedAccessException">Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
public static NotificationBlockState GetBlockState()
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for displaying progress notification
- /// You must initialize progress category, current, max value when you create object.
+ /// Class for displaying progress notification.
+ /// You must initialize progress category, current, and max value when you create an object.
/// </summary>
public sealed class ProgressType : MakerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="ProgressType"/> class.
- /// You must initialize category, current, max value of progress.
+ /// You must initialize category, current, and max value of the progress.
/// </summary>
- /// <param name="category">The category of progress that appeared on Notification</param>
- /// <param name="current">The current value of the progress</param>
- /// <param name="max">The max value of the progress</param>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <param name="category">The category of progress that appeared on notification.</param>
+ /// <param name="current">The current value of the progress.</param>
+ /// <param name="max">The max value of the progress.</param>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
public ProgressType(ProgressCategory category, double current, double max)
{
if (IsNegativeNumber(current))
public ProgressCategory Category { get; set; }
/// <summary>
- /// Gets or sets current value of ProgressType
+ /// Gets or sets current value of ProgressType.
/// </summary>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public double ProgressCurrent
{
get
}
/// <summary>
- /// Gets or sets max value of ProgressType
+ /// Gets or sets max value of ProgressType.
/// </summary>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
public double ProgressMax
{
get
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// Class for displaying direct-reply at notification.
- /// You must set a ReplyMax and Button. Otherwise user can't send written text to application which is set by AppControl.
+ /// Class for displaying direct-reply on notification.
+ /// You must set a ReplyMax and Button. Otherwise, user can't send written text to application which is set by AppControl.
/// </summary>
public sealed class ReplyAction : MakerBase
{
/// <summary>
- /// Gets or sets the Index of Button which is appeared at Notification.
- /// If you set ParentIndex, ReplyAction is displayed when button matched with ParentIndex click by the user.
- /// If you don't set ParentIndex, appeared to notification directly.
+ /// Gets or sets the index of button, which appears at notification.
+ /// If you set ParentIndex, ReplyAction is displayed when button matches with ParentIndex that is clicked by the user.
+ /// If you don't set ParentIndex, it appears as notification directly.
/// </summary>
public ButtonIndex ParentIndex { get; set; } = ButtonIndex.None;
/// <summary>
- /// Gets or sets the PlaceHolderText of ReplyAction which is appeared at Notification.
+ /// Gets or sets the PlaceHolderText of ReplyAction which appears at notification.
/// If you set PlaceHolderText, it is displayed to placeholder in notification.
/// </summary>
public string PlaceHolderText { get; set; }
/// <summary>
- /// Gets or sets the ReplyMax of ReplyAction which is appeared at Notification.
+ /// Gets or sets the maximum number of characters that the user can input.
/// You must set a ReplyMax. Otherwise user don't write text to placeholder in notification.
/// </summary>
/// <value>
public int ReplyMax { get; set; } = 160;
/// <summary>
- /// Gets or sets the Button which is appeared to ReplyAction in Notification.
- /// You must set a Button. Otherwise user can't send written text to application which is set by AppControl.
+ /// Gets or sets the button, which appears as ReplyAction in notification.
+ /// You must set the button, otherwise, a user can't send written text to application, which is set by AppControl.
/// </summary>
/// <remarks>
/// If you set it to null, the already set ButtonAction will be removed.
namespace Tizen.Applications.Notifications
{
/// <summary>
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
/// </summary>
/// <remarks>
/// A notification is a message that is displayed on the notification area.
public sealed partial class Notification
{
/// <summary>
- /// An object that can apply a rich notification style to a Notification object.
- /// If the platform does not provide rich notification styles in this class have no effect.
+ /// An object can apply a rich notification style to a notification object.
+ /// If the platform does not provide rich notification, styles in this class have no effect.
/// </summary>
public abstract class StyleBase : MakerBase
{
{
style.ReplyAction.Make(notification);
}
+
+ if (style.HiddenByUserAction != null)
+ {
+ Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByUser, style.HiddenByUserAction.SafeAppControlHandle);
+ }
+
+ if (style.HiddenByTimeoutAction != null)
+ {
+ Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByTimeout, style.HiddenByUserAction.SafeAppControlHandle);
+ }
+
+ if (style.HiddenByExternalAction != null)
+ {
+ Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByExternal, style.HiddenByUserAction.SafeAppControlHandle);
+ }
}
internal static void BindSafeHandle(Notification notification)
}
}
+ appcontrol = null;
+ Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByUser, out appcontrol);
+ if (appcontrol != null)
+ {
+ active.HiddenByUserAction = new AppControl(appcontrol);
+ }
+
+ appcontrol = null;
+ Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByTimeout, out appcontrol);
+ if (appcontrol != null)
+ {
+ active.HiddenByTimeoutAction = new AppControl(appcontrol);
+ }
+
+ appcontrol = null;
+ Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByExternal, out appcontrol);
+ if (appcontrol != null)
+ {
+ active.HiddenByExternalAction = new AppControl(appcontrol);
+ }
+
Interop.Notification.GetAutoRemove(notification.Handle, out autoRemove);
active.IsAutoRemove = autoRemove;
if (autoRemove)
[DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_default_button")]
internal static extern ErrorCode GetDefaultButton(NotificationSafeHandle handle, out int index);
+ [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extension_event_handler")]
+ internal static extern ErrorCode GetExtensionAction(NotificationSafeHandle handle, UserEventType type, out SafeAppControlHandle appcontrol);
+
internal static ErrorCode GetAppId(NotificationSafeHandle handle, out string appid)
{
ErrorCode err;
public class NotificationDeleteEventArgs : EventArgs
{
/// <summary>
- /// Gets the unique number of the Notification.
+ /// Gets the unique number of the notification.
/// </summary>
public int UniqueNumber { get; internal set; }
}
private const string LogTag = "Tizen.Applications.NotificationEventListener";
internal IDictionary<string, StyleArgs> Style;
- internal IDictionary<string, Bundle> Extender;
+ internal IDictionary<string, Bundle> ExtraData;
internal Interop.NotificationEventListener.NotificationSafeHandle Handle;
/// <summary>
public NotificationEventArgs()
{
Style = new Dictionary<string, StyleArgs>();
- Extender = new Dictionary<string, Bundle>();
+ ExtraData = new Dictionary<string, Bundle>();
}
/// <summary>
- /// Gets the unique id of Notification.
+ /// Gets the unique ID of the notification.
/// </summary>
public int UniqueNumber { get; internal set; }
/// <summary>
- /// Gets the appId of Notification.
+ /// Gets the appId of the notification.
/// </summary>
public string AppID { get; internal set; }
/// <summary>
- /// Gets the title of Notification.
+ /// Gets the title of the notification.
/// </summary>
public string Title { get; internal set; }
/// <summary>
- /// Gets the content text of Notification.
+ /// Gets the content text of the notification.
/// </summary>
public string Content { get; internal set; }
/// <summary>
- /// Gets the icon's path of Notification.
+ /// Gets the icon's path of the notification.
/// </summary>
public string Icon { get; internal set; }
/// <summary>
- /// Gets the sub icon path of Notification.
+ /// Gets the sub icon path of the notification.
/// </summary>
public string SubIcon { get; internal set; }
/// <summary>
- /// Gets the Timestamp of notification is visible or not.
+ /// Gets the timestamp if the notification is visible or not.
/// </summary>
public bool IsTimeStampVisible { get; internal set; }
/// <summary>
- /// Gets TimeStamp of Notification.
+ /// Gets TimeStamp of notification.
/// </summary>
/// <remarks>
- /// If IsTimeStampVisible property is set false, this TimeStamp property is meanless.
+ /// If IsTimeStampVisible property is set false, this TimeStamp property is meaningless.
/// </remarks>
public DateTime TimeStamp { get; internal set; }
/// <summary>
- /// Gets the count which is displayed at the right side of notification.
+ /// Gets the count, which is displayed at the right side of notification.
/// </summary>
public int Count { get; internal set; }
/// <summary>
- /// Gets the Tag of notification.
+ /// Gets the tag of notification.
/// </summary>
public string Tag { get; internal set; }
/// <summary>
/// Gets a value that determines whether notification is displayed on the default viewer.
- /// If IsDisplay property set false and add style, you can see only style notification.
+ /// If IsDisplay property is set as false and add style, you can see only style notification.
/// </summary>
- public bool IsDisplay { get; internal set; } = true;
+ public bool IsVisible { get; internal set; } = true;
[EditorBrowsable(EditorBrowsableState.Never)]
public bool HasEventFlag { get; internal set; } = false;
/// <summary>
- /// Gets the AppControl which is invoked when notification is clicked.
+ /// Gets the AppControl, which is invoked when notification is clicked.
/// </summary>
public AppControl Action { get; internal set; }
public ProgressArgs Progress { get; internal set; }
/// <summary>
- /// Gets the AccessoryArgs which has option of Sound, Vibration, LED.
+ /// Gets the AccessoryArgs, which has option of sound, vibration, and LED.
/// </summary>
public AccessoryArgs Accessory { get; internal set; }
/// <summary>
- /// Gets the key for extender.
+ /// Gets the key for extra data.
/// </summary>
- public ICollection<string> ExtenderKey
+ public ICollection<string> ExtraDataKey
{
get
{
- return Extender.Keys;
+ return ExtraData.Keys;
}
}
public NotificationProperty Property { get; internal set; }
/// <summary>
- /// Gets the styleArgs of active, lock, indicator, bigpicture.
+ /// Gets the styleArgs of active, lock, indicator, and bigpicture.
/// </summary>
- /// <typeparam name="T">Type of notification style to be queried</typeparam>
- /// <returns>The NotificationEventListener.StyleArgs object associated with the given style</returns>
- /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
+ /// <typeparam name="T">Type of notification style to be queried.</typeparam>
+ /// <returns>The NotificationEventListener.StyleArgs object associated with the given style.</returns>
+ /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
public T GetStyle<T>() where T : StyleArgs, new()
{
T type = new T();
}
/// <summary>
- /// Gets the ExtenderArgs.
+ /// Gets the ExtraDataArgs.
/// </summary>
- /// <param name="key">The key that specifies which extender</param>
- /// <returns>Returns the bundle for key</returns>
- public Bundle GetExtender(string key)
+ /// <param name="key">The key that specifies which extra data.</param>
+ /// <returns>Returns the bundle for key.</returns>
+ public Bundle GetExtraData(string key)
{
Bundle bundle;
throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered");
}
- if (Extender.TryGetValue(key, out bundle) == false)
+ if (ExtraData.TryGetValue(key, out bundle) == false)
{
throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered : " + key);
}
using Tizen.Common;
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Notification accessory.
+ /// Class to get infomation about notification accessory.
/// </summary>
public class AccessoryArgs
{
public bool CanVibrate { get; internal set; }
/// <summary>
- /// Gets the led option.
+ /// Gets the LED option.
/// </summary>
public AccessoryOption LedOption { get; internal set; }
/// <summary>
- /// Gets led on time period that you would like the LED on the device to blink. as well as the rate.
+ /// Gets LED on time period that you would like the LED on the device to blink as well as the rate.
/// </summary>
/// <value>
/// Default value of LedOnMilliseconds is 0.
public int LedOnMillisecond { get; internal set; }
/// <summary>
- /// Gets led on time period that you would like the LED on the device to blink. as well as the rate.
+ /// Gets LED on time period that you would like the LED on the device to blink as well as the rate.
/// </summary>
/// <value>
/// Default value of LedOffMillisecond is 0.
public int LedOffMillisecond { get; internal set; }
/// <summary>
- /// Gets led color that you would like the LED on the device to blink.
+ /// Gets LED color that you would like the LED on the device to blink.
/// </summary>
public Color LedColor { get; internal set; }
}
using System.Collections.Generic;
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Notification Active style.
+ /// Class to get infomation about notification active style.
/// </summary>
public class ActiveStyleArgs : StyleArgs
{
/// </summary>
/// <value>
/// When 'IsAutoRemove' is set as false, the active notification will not be removed as long as the user removes
- /// the active notification or the app which posted the active notification removes the active notification.
+ /// the active notification, or the app which posted the active notification removes the active notification.
/// </value>
public bool IsAutoRemove { get; internal set; }
public string BackgroundImage { get; internal set; }
/// <summary>
- /// Gets the default button to display highlight on the active notification
+ /// Gets the default button to display highlight on the active notification.
/// </summary>
public ButtonIndex DefaultButton { get; internal set; }
/// <summary>
- /// Gets timeout value in second when the notification can be hidden from the viewer.
+ /// Gets timeout value in seconds when the notification can be hidden from the viewer.
/// </summary>
public int HideTimeout { get; internal set; }
/// <summary>
- /// Gets timeout value in second when the notification can be deleted from the viewer.
+ /// Gets timeout value in seconds when the notification can be deleted from the viewer.
/// </summary>
public int DeleteTimeout { get; internal set; }
/// <summary>
+ /// Gets Action which is invoked when notification is hidden by user.
+ /// </summary>
+ /// <remarks>
+ /// The property is only reflected on Tizen TV.
+ /// If you use this API on other profile, this action have no effect
+ /// </remarks>
+ public AppControl HiddenByUserAction { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets Action which is invoked when there is no any response by user until hide timeout.
+ /// </summary>
+ /// <remarks>
+ /// The property is only reflected on Tizen TV.
+ /// If you use this API on other profile, this action settings have no effect
+ /// </remarks>
+ public AppControl HiddenByTimeoutAction { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets Action which is invoked when the notification is hidden by external factor.
+ /// </summary>
+ /// <remarks>
+ /// If you use this API on other profile, this action settings have no effect
+ /// </remarks>
+ public AppControl HiddenByExternalAction { get; internal set; }
+
+ /// <summary>
/// Gets a button to this active notification style.
/// Buttons are displayed in the notification content.
/// </summary>
Interop.NotificationEventListener.GetStyleList(eventargs.Handle, out displayList);
if ((displayList & (int)NotificationDisplayApplist.Tray) == 0)
{
- eventargs.IsDisplay = false;
+ eventargs.IsVisible = false;
}
err = Interop.NotificationEventListener.GetExtentionBundle(eventargs.Handle, out extention, out dummy);
Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
foreach (string key in bundle.Keys)
{
+ if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
+ continue;
+
SafeBundleHandle sbh;
Interop.NotificationEventListener.GetExtender(eventargs.Handle, key, out sbh);
- eventargs.Extender.Add(key, new Bundle(sbh));
+ eventargs.ExtraData.Add(key, new Bundle(sbh));
}
}
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Notification ButtonAction.
+ /// Class to get infomation about notification ButtonAction.
/// </summary>
public class ButtonActionArgs
{
/// <summary>
- /// Gets the Index of the Button which is appeared at Notification.
+ /// Gets the index of the button, which appears at notification.
/// </summary>
public ButtonIndex Index { get; internal set; }
public string Text { get; internal set; }
/// <summary>
- /// Gets the image's path that represent the button.
+ /// Gets the image's path that represents the button.
/// </summary>
public string ImagePath { get; internal set; }
using System.ComponentModel;
/// <summary>
- /// Enumeration for Progress category
+ /// Enumeration for the progress category.
/// </summary>
public enum ProgressCategory
{
/// <summary>
- /// Value for percent type
+ /// Value for the percent type.
/// </summary>
Percent,
/// <summary>
- /// Value for time type
+ /// Value for the time type.
/// </summary>
Time,
/// <summary>
- /// Value for pending type which is not updated progress current value
+ /// Value for the pending type, which is not the updated progress current value.
/// </summary>
PendingBar
}
/// <summary>
- /// Enumeration for Accessory option
+ /// Enumeration for the accessory option.
/// </summary>
public enum AccessoryOption
{
/// <summary>
- /// Value for off accessory option
+ /// Value for off accessory option.
/// </summary>
Off = -1,
/// <summary>
- /// Value for on accessory option
+ /// Value for on accessory option.
/// </summary>
On,
/// <summary>
- /// Value for custom accessory option
+ /// Value for the custom accessory option.
/// </summary>
Custom
}
/// <summary>
- /// Enumeration for Button Index
+ /// Enumeration for the button index.
/// </summary>
public enum ButtonIndex
{
/// <summary>
- /// Value for default button index
+ /// Value for the default button index.
/// </summary>
None = -1,
/// <summary>
- /// Value for first button index
+ /// Value for the first button index.
/// </summary>
First,
/// <summary>
- /// Value for second button index
+ /// Value for the second button index.
/// </summary>
Second,
/// <summary>
- /// Value for third button index
+ /// Value for the third button index.
/// </summary>
Third
}
/// <summary>
- /// Enumeration for notification particular property
+ /// Enumeration for the notification particular property.
/// </summary>
[Flags]
public enum NotificationProperty
{
/// <summary>
- /// Value for adjust nothing
+ /// Value for the adjust nothing.
/// </summary>
None = 0x00,
/// <summary>
- /// Value for display only SIM card inserted
+ /// Value for display only when SIM card inserted.
/// </summary>
DisplayOnlySimMode = 0x01,
/// <summary>
- /// Value for disable application launch when it selected
+ /// Value for disable application launch when it is selected.
/// </summary>
DisableAppLaunch = 0x02,
/// <summary>
- /// Value for disable auto delete when it selected
+ /// Value for disable auto delete when it is selected.
/// </summary>
DisableAutoDelete = 0x04,
/// <summary>
- /// Value for deleted when device is rebooted even though notification is not set OngoingType
+ /// Value for deleted when device is rebooted even though notification is not set OngoingType.
/// </summary>
VolatileDisplay = 0x100,
}
public enum UserEventType
{
/// <summary>
- /// Event type : Click on button 1
+ /// Event type : Click on button 1.
/// </summary>
ClickOnButton1 = 0,
/// <summary>
- /// Event type : Click on button 2
+ /// Event type : Click on button 2.
/// </summary>
ClickOnButton2,
/// <summary>
- /// Event type : Click on button 3
+ /// Event type : Click on button 3.
/// </summary>
ClickOnButton3,
/// <summary>
- /// Event type : Click on text_input button
+ /// Event type : Click on text_input button.
/// </summary>
ClickOnReplyButton = 8,
/// <summary>
- /// Event type : Hidden by user
+ /// Event type : Hidden by user.
/// </summary>
HiddenByUser = 100,
/// <summary>
- /// Event type : Deleted by timer
+ /// Event type : Deleted by timer.
/// </summary>
HiddenByTimeout = 101,
/// <summary>
- /// Event type : Clicked by user
+ /// Event type : Deleted by timer.
+ /// </summary>
+ HiddenByExternal = 102,
+
+ /// <summary>
+ /// Event type : Clicked by user.
/// </summary>
ClickOnNotification = 200,
/// <summary>
- /// Event type : Deleted by user
+ /// Event type : Deleted by user.
/// </summary>
DeleteNotification = 201,
}
internal enum NotificationType
{
/// <summary>
- /// Notification type
+ /// Notification type.
/// </summary>
Notification = 0,
/// <summary>
- /// Ongoing type
+ /// Ongoing type.
/// </summary>
Ongoing,
}
internal enum NotificationText
{
/// <summary>
- /// Title
+ /// Title.
/// </summary>
Title = 0,
/// <summary>
- /// Content
+ /// Content.
/// </summary>
Content,
/// <summary>
- /// Text to display event count
+ /// Text to display the event count.
/// </summary>
EventCount = 3,
/// <summary>
- /// Box contents 1
+ /// Box contents 1.
/// </summary>
FirstMainText,
/// <summary>
- /// Box contents 1-1
+ /// Box contents 1-1.
/// </summary>
FirstSubText,
/// <summary>
- /// Box contents 2
+ /// Box contents 2.
/// </summary>
SecondMainText,
/// <summary>
- /// Box contents 2-1
+ /// Box contents 2-1.
/// </summary>
SecondSubText,
/// <summary>
- /// Text on button 1
+ /// Text on button 1.
/// </summary>
FirstButton = 13,
/// <summary>
- /// Text on button 2
+ /// Text on button 2.
/// </summary>
SecondButton,
/// <summary>
- /// Text on button 3
+ /// Text on button 3.
/// </summary>
ThirdButton,
/// <summary>
- /// Guide text on the message reply box
+ /// Guide text on the message reply box.
/// </summary>
PlaceHolder = 19,
/// <summary>
- /// Text on button the on message reply box
+ /// Text on button on the message reply box.
/// </summary>
InputButton = 20,
}
/// <summary>
- /// Enumeration for image type.
+ /// Enumeration for the image type.
/// </summary>
internal enum NotificationImage
{
/// <summary>
- /// Icon
+ /// Icon.
/// </summary>
Icon = 0,
/// <summary>
- /// Indicator icon
+ /// Indicator icon.
/// </summary>
Indicator,
/// <summary>
- /// Lock screen icon
+ /// Lock screen icon.
/// </summary>
Lockscreen,
/// <summary>
- /// Thumbnail
+ /// Thumbnail.
/// </summary>
Thumbnail,
/// <summary>
- /// Lock screen thumbnail
+ /// Lock screen thumbnail.
/// </summary>
ThumbnailLockscreen,
/// <summary>
- /// Icon
+ /// Icon.
/// </summary>
SubIcon,
/// <summary>
- /// image displayed on background
+ /// Image displayed on background.
/// </summary>
Background,
/// <summary>
- /// Image for button 1
+ /// Image for button 1.
/// </summary>
Button_1 = 12,
/// <summary>
- /// Image for button 2
+ /// Image for button 2.
/// </summary>
Button_2,
/// <summary>
- /// Image for button 3
+ /// Image for button 3.
/// </summary>
Button_3,
/// <summary>
- /// Image for message reply
+ /// Image for message reply.
/// </summary>
TextInputButton = 18,
}
internal enum NotificationLayout
{
/// <summary>
- /// Default
+ /// Default.
/// </summary>
None = 0,
/// <summary>
- /// Layout for notification. Used to inform single event
+ /// Layout for notification. Used to inform single event.
/// </summary>
SingleEvent = 1,
/// <summary>
- /// Layout for notification. Used to display images
+ /// Layout for notification. Used to display images.
/// </summary>
Thumbnail = 3,
/// <summary>
- /// Layout for ongoing notification. Used to display text message
+ /// Layout for ongoing notification. Used to display text message.
/// </summary>
OngoingEvent = 4,
/// <summary>
- /// Layout for ongoing notification. Used to display progress
+ /// Layout for ongoing notification. Used to display progress.
/// </summary>
OngoingProgress = 5,
}
internal enum LaunchOption
{
/// <summary>
- /// Launching with app control
+ /// Launching with application control.
/// </summary>
AppControl = 1
}
internal enum NotificationOperationDataType
{
/// <summary>
- /// Default
+ /// Default.
/// </summary>
Min = 0,
/// <summary>
- /// Operation type
+ /// Operation type.
/// </summary>
Type,
/// <summary>
- /// Private ID
+ /// Private ID.
/// </summary>
UniqueNumber,
/// <summary>
- /// Notification handler
+ /// Notification handler.
/// </summary>
Notification,
/// <summary>
- /// Reserved
+ /// Reserved.
/// </summary>
ExtraInformation1,
/// <summary>
- /// Reserved
+ /// Reserved.
/// </summary>
ExtraInformation2,
}
internal enum NotificationOperationType
{
/// <summary>
- /// Default
+ /// Default.
/// </summary>
None = 0,
/// <summary>
- /// Notification inserted
+ /// Notification inserted.
/// </summary>
Insert,
/// <summary>
- /// Notification updated
+ /// Notification updated.
/// </summary>
Update,
/// <summary>
- /// Notification deleted
+ /// Notification deleted.
/// </summary>
Delete,
}
internal enum ClickEventType
{
/// <summary>
- /// Event type : Click on button 1
+ /// Event type : Click on button 1.
/// </summary>
FirstButton = 0,
/// <summary>
- /// Event type : Click on button 2
+ /// Event type : Click on button 2.
/// </summary>
SecondButton = 1,
/// <summary>
- /// Event type : Click on button 3
+ /// Event type : Click on button 3.
/// </summary>
ThirdButton = 2,
/// <summary>
- /// Event type : Click on icon
+ /// Event type : Click on icon.
/// </summary>
Icon = 6,
/// <summary>
- /// Event type : Click on thumbnail
+ /// Event type : Click on thumbnail.
/// </summary>
Thumbnail = 7,
/// <summary>
- /// Event type : Click on text_input button
+ /// Event type : Click on text_input button.
/// </summary>
InputButton = 8,
}
internal enum NotificationDisplayApplist
{
/// <summary>
- /// Notification Tray(Quickpanel)
+ /// Notification Tray(Quickpanel).
/// </summary>
Tray = 0x00000001,
/// <summary>
- /// Ticker notification
+ /// Ticker notification.
/// </summary>
Ticker = 0x00000002,
/// <summary>
- /// Lock screen
+ /// Lock screen.
/// </summary>
Lock = 0x00000004,
/// <summary>
- /// Indicator
+ /// Indicator.
/// </summary>
Indicator = 0x00000008,
/// <summary>
- /// Active notification
+ /// Active notification.
/// </summary>
Active = 0x00000010,
/// <summary>
- /// All display application except active notification
+ /// All display application except active notification.
/// </summary>
All = 0x0000000f,
}
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to generate the Indicator style notification.
+ /// Class to generate the indicator style notification.
/// </summary>
public class IndicatorStyleArgs : StyleArgs
{
/// <summary>
- /// Gets the path of the image file to display on the icon of Indicator style.
+ /// Gets the path of the image file to display on the icon of indicator style.
/// </summary>
public string IconPath { get; internal set; }
/// <summary>
- /// Gets the sub text to display Indicator style.
+ /// Gets the sub text to display indicator style.
/// </summary>
public string SubText { get; internal set; }
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Notification Lock style.
+ /// Class to get infomation about notification lock style.
/// </summary>
public class LockStyleArgs : StyleArgs
{
/// <summary>
- /// Gets the path of the image file to display on the icon of Lock style.
+ /// Gets the path of the image file to display on the icon of lock style.
/// </summary>
public string IconPath { get; internal set; }
/// <summary>
- /// Gets the path of the thumbnail image file to display on the icon of Lock style.
+ /// Gets the path of the thumbnail image file to display on the icon of lock style.
/// </summary>
public string Thumbnail { get; internal set; }
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Progress Notification.
+ /// Class to get infomation about progress notification.
/// </summary>
public class ProgressArgs
{
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// <summary>
- /// Class to get infomation about Notification ReplyAction.
+ /// Class to get infomation about notification ReplyAction.
/// </summary>
public class ReplyActionArgs
{
/// <summary>
- /// Gets Index of Button which is appeared at Notification.
+ /// Gets index of button, which appears at notification.
/// If there is no ParentIndex, the ReplyAction should be displayed directly on the active notification.
/// </summary>
public ButtonIndex ParentIndex { get; internal set; } = ButtonIndex.None;
/// <summary>
- /// Gets the PlaceHolderText of ReplyAction which is appeared at Notification.
+ /// Gets the PlaceHolderText of ReplyAction, which appears at notification.
/// It will be displayed to the text input box on the active notification.
/// </summary>
public string PlaceHolderText { get; internal set; }
namespace Tizen.Applications.NotificationEventListener
{
/// <summary>
- /// This class provides the methods and properties to get information about the posted or updated notification.
+ /// This class provides methods and properties to get information about the posted or updated notification.
/// </summary>
public partial class NotificationEventArgs
{
/// This class provides a way to register callback function for some notification events.
/// </summary>
/// <remarks>
- /// The event listener can use this class to get a list of notification or to clear notifications.
+ /// The event listener can use this class to get a list of notifications or to clear notifications.
/// </remarks>
public partial class NotificationListenerManager
{
}
/// <summary>
- /// Registers a callback for notification insert event.
+ /// Event handler for notification insert event.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
- public static event EventHandler<NotificationEventArgs> NotificationAddEventHandler
+ public static event EventHandler<NotificationEventArgs> Added
{
add
{
}
/// <summary>
- /// Registers a callback for notification update event.
+ /// Event handler for notification update event.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
- public static event EventHandler<NotificationEventArgs> NotificationUpdateEventHandler
+ public static event EventHandler<NotificationEventArgs> Updated
{
add
{
}
/// <summary>
- /// Registers a callback for notification delete event.
+ /// Event handler for notification delete event.
/// </summary>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
- public static event EventHandler<NotificationDeleteEventArgs> NotificationDeleteEventHandler
+ public static event EventHandler<NotificationDeleteEventArgs> Deleted
{
add
{
}
/// <summary>
- /// Deletes a Notification with appId and uniqueNumber.
+ /// Deletes a notification with appId and uniqueNumber.
/// </summary>
/// <param name="appId">The name of the application you want to delete.</param>
/// <param name="uniqueNumber">The unique number of the notification.</param>
- /// <exception cref="ArgumentException">Thrown in case of Invalid parameter.</exception>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
public static void Delete(string appId, int uniqueNumber)
}
/// <summary>
- /// Deletes all Notification.
+ /// Deletes all notifications.
/// </summary>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
public static void DeleteAll()
}
/// <summary>
- /// Returns the notification list handle.
+ /// Returns the notification list.
/// </summary>
- /// <exception cref="UnauthorizedAccessException"> Thrown in case of Permission deny.</exception>
+ /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
/// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
/// <privilege>http://tizen.org/privilege/notification</privilege>
public static IList<NotificationEventArgs> GetList()
isExisted = true;
}
- if (eventargs.Extender.TryGetValue(replyKey, out bundle))
+ if (eventargs.ExtraData.TryGetValue(replyKey, out bundle))
{
if (bundle.Contains(replyKey))
{
}
activeStyle.DeleteTimeout = timeout;
+ SafeAppControlHandle appcontrol = null;
+ Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByUser, out appcontrol);
+ if (appcontrol != null)
+ {
+ activeStyle.HiddenByUserAction = new AppControl(appcontrol);
+ }
+
+ appcontrol = null;
+ Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByTimeout, out appcontrol);
+ if (appcontrol != null)
+ {
+ activeStyle.HiddenByTimeoutAction = new AppControl(appcontrol);
+ }
+
+ appcontrol = null;
+ Interop.NotificationEventListener.GetExtensionAction(eventargs.Handle, UserEventType.HiddenByExternal, out appcontrol);
+ if (appcontrol != null)
+ {
+ activeStyle.HiddenByExternalAction = new AppControl(appcontrol);
+ }
+
NotificationReplyActionArgBinder.BindObject(eventargs);
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for certificate compare result type.
+ /// Enumeration for the certificate compare result type.
/// </summary>
public enum CertCompareResultType
{
/// </summary>
Mismatch = Interop.PackageManager.CertCompareResultType.Mismatch,
/// <summary>
- /// First package doesn't have certificate.
+ /// First package does not have the certificate.
/// </summary>
LhsNoCert = Interop.PackageManager.CertCompareResultType.LhsNoCert,
/// <summary>
- /// Second package doesn't have certificate.
+ /// Second package does not have the certificate.
/// </summary>
RhsNoCert = Interop.PackageManager.CertCompareResultType.RhsNoCert,
/// <summary>
- /// Certificates of both packages are not exist.
+ /// Certificates for both the packages do not exist.
/// </summary>
BothNoCert = Interop.PackageManager.CertCompareResultType.BothNoCert
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for certification type.
+ /// Enumeration for the certification types.
/// </summary>
public enum CertificateType
{
/// <summary>
- /// Author Certificate.
+ /// Author certificate.
/// </summary>
Author,
/// <summary>
- /// Distributor Certificate.
+ /// Distributor certificate.
/// </summary>
Distributor,
/// <summary>
- /// Distributor2 Certificate.
+ /// Distributor2 certificate.
/// </summary>
Distributor2,
}
namespace Tizen.Applications
{
/// <summary>
- /// This class provide methods and properties to get information about packages.
+ /// This class provides the methods and properties to get information about the packages.
/// </summary>
public class Package
{
}
/// <summary>
- /// Package ID.
+ /// The package ID.
/// </summary>
public string Id { get { return _id; } }
public string TizenExpansionPackageName { get { return _expansionPackageName; } }
/// <summary>
- /// Checks whether the package is system package.
+ /// Checks whether the package is a system package.
/// </summary>
public bool IsSystemPackage { get { return _isSystemPackage; } }
public bool IsAccessible { get { return _isAccessible; } }
/// <summary>
- /// Certificate information for the package
+ /// Certificate information for the package.
/// </summary>
public IReadOnlyDictionary<CertificateType, PackageCertificate> Certificates { get { return _certificates; } }
/// <summary>
- /// Requested privilege for the package
+ /// Requested privilege for the package.
/// </summary>
public IEnumerable<string> Privileges { get { return _privileges; } }
public int InstalledTime { get { return _installedTime; } }
/// <summary>
- /// Retrieves all application IDs of this package.
+ /// Retrieves all the application IDs of this package.
/// </summary>
- /// <returns>Returns a dictionary containing all application info for given application type.</returns>
+ /// <returns>Returns a dictionary containing all the application information for a given application type.</returns>
public IEnumerable<ApplicationInfo> GetApplications()
{
return GetApplications(ApplicationType.All);
}
/// <summary>
- /// Retrieves all application IDs of this package.
+ /// Retrieves all the application IDs of this package.
/// </summary>
- /// <param name="type">Optional: AppType enum value</param>
- /// <returns>Returns a dictionary containing all application info for given application type.</returns>
+ /// <param name="type">Optional: AppType enumeration value.</param>
+ /// <returns>Returns a dictionary containing all the application information for a given application type.</returns>
public IEnumerable<ApplicationInfo> GetApplications(ApplicationType type)
{
List<ApplicationInfo> appInfoList = new List<ApplicationInfo>();
}
/// <summary>
- /// Gets size information for this package.
+ /// Gets the package size information.
/// </summary>
- /// <returns>package size information</returns>
+ /// <returns>Package size information.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
public async Task<PackageSizeInformation> GetSizeInformationAsync()
{
}
/// <summary>
- /// Compare certificate information with given package id.
+ /// Compares the certificate information with the given package ID.
/// </summary>
- /// <param name="packageId">Id of the package</param>
- /// <returns>Certificate comparison result</returns>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
+ /// <param name="packageId">ID of the package.</param>
+ /// <returns>Certificate comparison result.</returns>
+ /// <exception cref="ArgumentException">Thrown when a failed input package ID is invalid.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
public CertCompareResultType CompareCertInfo(string packageId)
{
Interop.PackageManager.CertCompareResultType compareResult;
namespace Tizen.Applications
{
/// <summary>
- /// This class provides information about package certification.
+ /// This class provides information about the package certification.
/// </summary>
public class PackageCertificate
{
}
/// <summary>
- /// Root certificate
+ /// Root certificate.
/// </summary>
public string Root { get { return _root; } }
/// <summary>
- /// Intermediate certificate
+ /// Intermediate certificate.
/// </summary>
public string Intermediate { get { return _intermediate; } }
/// <summary>
- /// Signer certificate
+ /// Signer certificate.
/// </summary>
public string Signer { get { return _signer; } }
namespace Tizen.Applications
{
/// <summary>
- /// This class provide methods and properties for DRM operation
+ /// This class provides the methods and properties for the DRM operation.
/// </summary>
public class PackageDrm
{
}
/// <summary>
- /// Returns response data
+ /// Returns the response data.
/// </summary>
- /// <returns>Returns response data which is given when GenerateLicenseRequest has invoked</returns>
+ /// <returns>Returns the response data which is given when GenerateLicenseRequest has been invoked.</returns>
public string ResponseData { get { return _responseData; } }
/// <summary>
- /// Returns request data
+ /// Returns the request data.
/// </summary>
- /// <returns>Returns request data which is generated when GenerateLicenseRequest has invoked</returns>
+ /// <returns>Returns the request data which is generated when GenerateLicenseRequest has been invoked.</returns>
public string RequestData { get { return _requestData; } }
/// <summary>
- /// Returns license URL
+ /// Returns the license URL.
/// </summary>
- /// <returns>Returns license URL which is generated when GenerateLicenseRequest has invoked</returns>
+ /// <returns>Returns the license URL which is generated when GenerateLicenseRequest has been invoked.</returns>
public string LicenseUrl { get { return _licenseUrl; } }
internal static PackageDrm CreateDrmRequest(string responseData, string requestData, string licenseUrl)
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for package manager event state.
+ /// Enumeration for the package manager event state.
/// </summary>
public enum PackageEventState
{
/// <summary>
- /// Processing started
+ /// Processing started.
/// </summary>
Started = Interop.PackageManager.PackageEventState.Started,
/// <summary>
/// </summary>
Processing = Interop.PackageManager.PackageEventState.Processing,
/// <summary>
- /// Processing Completed.
+ /// Processing completed.
/// </summary>
Completed = Interop.PackageManager.PackageEventState.Completed,
/// <summary>
- /// Processing Failed.
+ /// Processing failed.
/// </summary>
Failed = Interop.PackageManager.PackageEventState.Failed
}
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for package manager event type.
+ /// Enumeration for the package manager event types.
/// </summary>
public enum PackageEventType
{
namespace Tizen.Applications
{
/// <summary>
- /// This class is a parameter of PackageManager::GetPackages method.
+ /// This class is a parameter of the PackageManager::GetPackages method.
/// </summary>
public class PackageFilter
{
private IDictionary<string, bool> _filter;
/// <summary>
- /// Default constructor with empty filter list. All installed applications will satisfy this filter unless updated with more specific filters.
+ /// The default constructor with an empty filter list. All the installed applications will satisfy this filter unless updated with more specific filters.
/// </summary>
public PackageFilter()
{
}
/// <summary>
- /// Constructor with specific filters. Using this will filter out installed packages which do not meet the criteria of the filters.
+ /// The constructor with specific filters. Using this will filter out the installed packages which do not meet the filter criteria.
/// </summary>
public PackageFilter(IDictionary<string, bool> filter)
{
}
/// <summary>
- /// This class contains possible keys for filter to be used in the GetPackages method.
+ /// This class contains possible keys for the filter to be used in the GetPackages method.
/// </summary>
public static class Keys
{
/// <summary>
- /// Key of the boolean property for filtering whether the package is removable
+ /// Key of the boolean property for filtering if the package is removable.
/// </summary>
public const string Removable = "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE";
/// <summary>
- /// Key of the boolean property for filtering whether the package is readonly.
+ /// Key of the boolean property for filtering if the package is read-only.
/// </summary>
public const string ReadOnly = "PMINFO_PKGINFO_PROP_PACKAGE_READONLY";
/// <summary>
- /// Key of the boolean property for filtering whether the package supports disabling.
+ /// Key of the boolean property for filtering if the package supports disabling.
/// </summary>
public const string SupportsDisable = "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE";
/// <summary>
- /// Key of the boolean property for filtering whether the package is disabled.
+ /// Key of the boolean property for filtering if the package is disabled.
/// </summary>
public const string Disable = "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE";
/// <summary>
- /// Key of the boolean property for filtering whether the package is preloaded.
+ /// Key of the boolean property for filtering if the package is preloaded.
/// </summary>
public const string Preload = "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD";
}
/// PackageManager class. This class has the methods and events of the PackageManager.
/// </summary>
/// <remarks>
- /// The package manager is one of the core modules of Tizen application framework, and responsible for getting their information.
+ /// The package manager is one of the core modules of the Tizen application framework and responsible for getting their information.
/// You can also retrieve information related to the packages that are installed on the device.
/// </remarks>
public static class PackageManager
private static Interop.PackageManager.PackageManagerEventCallback s_packageManagerEventCallback;
/// <summary>
- /// Event Callback Method for the request.
+ /// Event callback method for the request.
/// </summary>
- /// <param name="type">Type of the package which was requested</param>
- /// <param name="packageId">ID of the package which was requested</param>
- /// <param name="eventType">Event type of the request</param>
- /// <param name="eventState">Current event state of the request</param>
- /// <param name="progress">Progress for the request being processed by the package manager (in percent)</param>
+ /// <param name="type">Type of the package which was requested.</param>
+ /// <param name="packageId">ID of the package which was requested.</param>
+ /// <param name="eventType">Event type of the request.</param>
+ /// <param name="eventState">Current event state of the request.</param>
+ /// <param name="progress">Progress for the request being processed by the package manager (in percent).</param>
public delegate void RequestEventCallback(string type, string packageId, PackageEventType eventType, PackageEventState eventState, int progress);
private static Dictionary<int, RequestEventCallback> RequestCallbacks = new Dictionary<int, RequestEventCallback>();
private delegate Interop.PackageManager.ErrorCode InstallMethod(SafePackageManagerRequestHandle requestHandle, string pkgPath, out int requestID);
/// <summary>
- /// InstallProgressChanged event. This event is occurred when a package is getting installed and the progress of the request to the package manager changes.
+ /// InstallProgressChanged event. This event occurs when a package is getting installed and the progress of the request to the package manager is changed.
/// </summary>
public static event EventHandler<PackageManagerEventArgs> InstallProgressChanged
{
}
/// <summary>
- /// UninstallProgressChanged event. This event is occurred when a package is getting uninstalled and the progress of the request to the package manager changes.
+ /// UninstallProgressChanged event. This event occurs when a package is getting uninstalled and the progress of the request to the package manager is changed.
/// </summary>
public static event EventHandler<PackageManagerEventArgs> UninstallProgressChanged
{
}
/// <summary>
- /// UpdateProgressChanged event. This event is occurred when a package is getting updated and the progress of the request to the package manager changes.
+ /// UpdateProgressChanged event. This event occurs when a package is getting updated and the progress of the request to the package manager is changed.
/// </summary>
public static event EventHandler<PackageManagerEventArgs> UpdateProgressChanged
{
}
/// <summary>
- /// MoveProgressChanged event. This event is occurred when a package is getting moved and the progress of the request to the package manager changes.
+ /// MoveProgressChanged event. This event occurs when a package is getting moved and the progress of the request to the package manager is changed.
/// </summary>
public static event EventHandler<PackageManagerEventArgs> MoveProgressChanged
{
}
/// <summary>
- /// ClearDataProgressChanged event. This event is occurred when data directories are cleared in the given package.
+ /// ClearDataProgressChanged event. This event occurs when data directories are cleared in the given package.
/// </summary>
public static event EventHandler<PackageManagerEventArgs> ClearDataProgressChanged
{
};
/// <summary>
- /// Gets the package ID for the given app ID.
+ /// Gets the package ID for the given application ID.
/// </summary>
- /// <param name="applicationId">The ID of the application</param>
- /// <returns>Returns the ID of the package. Empty string if App ID does not exist</returns>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
+ /// <param name="applicationId">The ID of the application.</param>
+ /// <returns>Returns the ID of the package. Empty string if the application ID does not exist.</returns>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
public static string GetPackageIdByApplicationId(string applicationId)
{
/// <summary>
/// Gets the package information for the given package.
/// </summary>
- /// <param name="packageId">The ID of the package</param>
+ /// <param name="packageId">The ID of the package.</param>
/// <returns>Returns the package information for the given package ID.</returns>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
+ /// <exception cref="ArgumentException">Thrown when the failed input package ID is invalid.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method fails due to an internal I/O error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
public static Package GetPackage(string packageId)
{
}
/// <summary>
- /// Clears the application's internal and external cache directory.
+ /// Clears the application's internal and external cache directories.
/// </summary>
- /// <param name="packageId">Id of the package</param>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <param name="packageId">ID of the package.</param>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method fails due to an internal I/O error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
/// <privilege>http://tizen.org/privilege/packagemanager.clearcache</privilege>
public static void ClearCacheDirectory(string packageId)
{
}
/// <summary>
- /// Clears all application's internal and external cache directory.
+ /// Clears all the application's internal and external cache directories.
/// </summary>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method fails due to an internal IO error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
public static void ClearAllCacheDirectory()
}
/// <summary>
- /// Clears the application's internal and external data directories
+ /// Clears the application's internal and external data directories.
/// </summary>
/// <remarks>
- /// All files under data, shared/data and shared/trusted in the internal storage are removed.
- /// And, If external storeage exists, then all files under data and shared/trusted in the external storage are removed.
+ /// All files under data, shared/data, and shared/trusted in the internal storage are removed.
+ /// And, if the external storage exists, then all files under data and shared/trusted in the external storage are removed.
/// </remarks>
- /// <param name="packageId">Id of the package</param>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <param name="packageId">ID of the package.</param>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal IO error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
public static void ClearDataDirectory(string packageId)
}
/// <summary>
- /// Retrieves package information of all installed packages.
+ /// Retrieves the package information of all installed packages.
/// </summary>
/// <returns>Returns the list of packages.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
}
/// <summary>
- /// Retrieves package information of all installed packages satisfying filter conditions.
+ /// Retrieves the package information of all the installed packages satisfying the filter conditions.
/// </summary>
- /// <param name="filter">Optional - package filters</param>
+ /// <param name="filter">Optional - package filters.</param>
/// <returns>Returns the list of packages.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
public static IEnumerable<Package> GetPackages(PackageFilter filter)
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <returns>Returns true if installtion request is successful, false otherwise.</returns>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <returns>Returns true if the installation request is successful, otherwise false.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of the installation, the caller should check the progress using the InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="type">Package type for the package to be installed</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="type">Package type for the package to be installed.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="type">Package type for the package to be installed</param>
- /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="type">Package type for the package to be installed.</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
- /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed.</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
- /// <param name="type">Package type for the package to be installed</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed.</param>
+ /// <param name="type">Package type for the package to be installed.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Installs package located at the given path
+ /// Installs the package located at the given path.
/// </summary>
- /// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
- /// <param name="type">Package type for the package to be installed</param>
- /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
- /// <param name="installMode">Optional parameter to indicate special installation mode</param>
+ /// <param name="packagePath">Absolute path for the package to be installed.</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed.</param>
+ /// <param name="type">Package type for the package to be installed.</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request.</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode.</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of installation is seccessful.
- /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for installation is successful.
+ /// To check the result of installation, the caller should check the progress using the InstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Uninstalls package with the given name.
+ /// Uninstalls the package with the given name.
/// </summary>
- /// <param name="packageId">Id of the package to be uninstalled</param>
- /// <returns>Returns true if uninstallation request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be uninstalled.</param>
+ /// <returns>Returns true if the uninstallation request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of uninstallation is seccessful.
- /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event.
+ /// The 'true' means that the request for uninstallation is successful.
+ /// To check the result of uninstallation, the caller should check the progress using the UninstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Uninstalls package with the given name.
+ /// Uninstalls package with the given names.
/// </summary>
- /// <param name="packageId">Id of the package to be uninstalled</param>
- /// <param name="type">Optional - Package type for the package to be uninstalled</param>
- /// <returns>Returns true if uninstalltion request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be uninstalled.</param>
+ /// <param name="type">Optional - Package type for the package to be uninstalled.</param>
+ /// <returns>Returns true if the uninstalltion request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of uninstallation is seccessful.
- /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event.
+ /// The 'true' means that the request for uninstallation is successful.
+ /// To check the result of uninstallation, the caller should check the progress using the UninstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Uninstalls package with the given name.
+ /// Uninstalls the package with the given name.
/// </summary>
- /// <param name="packageId">Id of the package to be uninstalled</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
- /// <returns>Returns true if uninstalltion request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be uninstalled.</param>
+ /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request.</param>
+ /// <returns>Returns true if the uninstallation request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of uninstallation is seccessful.
- /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for uninstallation is successful.
+ /// To check the result of uninstallation, the caller should check the progress using the UninstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Uninstalls package with the given name.
+ /// Uninstalls the package with the given name.
/// </summary>
- /// <param name="packageId">Id of the package to be uninstalled</param>
- /// <param name="type">Optional - Package type for the package to be uninstalled</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
- /// <returns>Returns true if uninstalltion request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be uninstalled</param>
+ /// <param name="type">Optional - Package type for the package to be uninstalled.</param>
+ /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request.</param>
+ /// <returns>Returns true if the uninstallation request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of uninstallation is seccessful.
- /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event OR eventCallback.
+ /// The 'true' means that the request for uninstallation is successful.
+ /// To check the result of uninstallation, the caller should check the progress using the UninstallProgressChanged event or eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Move package to given storage.
+ /// Moves the package to the given storage.
/// </summary>
- /// <param name="packageId">Id of the package to be moved</param>
- /// <param name="newStorage">Storage, package should be moved to</param>
- /// <returns>Returns true if move request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be moved.</param>
+ /// <param name="newStorage">Storage package should be moved to.</param>
+ /// <returns>Returns true if the move request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of move is seccessful.
- /// To check the result of move, the caller should check the progress using MoveProgressChanged event.
+ /// The 'true' means that the request for move is successful.
+ /// To check the result of move, the caller should check the progress using the MoveProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Move package to given storage.
+ /// Moves the package to the given storage.
/// </summary>
- /// <param name="packageId">Id of the package to be moved</param>
- /// <param name="type">Optional - Package type for the package to be moved</param>
- /// <param name="newStorage">Storage, package should be moved to</param>
- /// <returns>Returns true if move request is successful, false otherwise.</returns>
+ /// <param name="packageId">ID of the package to be moved.</param>
+ /// <param name="type">Optional - Package type for the package to be moved.</param>
+ /// <param name="newStorage">Storage package should be moved to.</param>
+ /// <returns>Returns true if the move request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of move is seccessful.
- /// To check the result of move, the caller should check the progress using MoveProgressChanged event.
+ /// The 'true' means that the request for move is successful.
+ /// To check the result of move, the caller should check the progress using the MoveProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Move package to given storage.
+ /// Moves the package to the given storage.
/// </summary>
- /// <param name="packageId">Id of the package to be moved</param>
- /// <param name="newStorage">Storage, package should be moved to</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="packageId">ID of the package to be moved.</param>
+ /// <param name="newStorage">Storage package should be moved to.</param>
+ /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request.</param>
/// <returns>Returns true if move request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of move is seccessful.
- /// To check the result of move, the caller should check the progress using MoveProgressChanged event.
+ /// The 'true' means that the request for move is successful.
+ /// To check the result of move, the caller should check the progress using the MoveProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Move package to given storage.
+ /// Moves the package to the given storage.
/// </summary>
- /// <param name="packageId">Id of the package to be moved</param>
- /// <param name="type">Optional - Package type for the package to be moved</param>
- /// <param name="newStorage">Storage, package should be moved to</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="packageId">ID of the package to be moved.</param>
+ /// <param name="type">Optional - Package type for the package to be moved.</param>
+ /// <param name="newStorage">Storage, package should be moved to.</param>
+ /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request.</param>
/// <returns>Returns true if move request is successful, false otherwise.</returns>
/// <remarks>
- /// The 'true' means that just the request of move is seccessful.
- /// To check the result of move, the caller should check the progress using MoveProgressChanged event.
+ /// The 'true' means that the request for move is successful.
+ /// To check the result of move, the caller should check the progress using the MoveProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
}
/// <summary>
- /// Gets permission type of package which has given application id
+ /// Gets the permission type of the package which has a given application ID.
/// </summary>
- /// <param name="applicationId">Id of the application</param>
- /// <returns>Returns permission type.</returns>
+ /// <param name="applicationId">ID of the application.</param>
+ /// <returns>Returns the permission type.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
+ /// <exception cref="ArgumentException">Thrown when the failed input package ID is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
public static PermissionType GetPermissionTypeByApplicationId(string applicationId)
{
Interop.PackageManager.PackageManagerPermissionType permissionType;
}
/// <summary>
- /// Gets package's preload attribute which contain given applicion id
+ /// Gets the package's preload attribute which contains a given application ID.
/// </summary>
- /// <param name="applicationId">Id of the application</param>
- /// <returns>Returns true if package is preloaded. Otherwise return false.</returns>
+ /// <param name="applicationId">ID of the application.</param>
+ /// <returns>Returns true if the package is preloaded, otherwise false.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
+ /// <exception cref="ArgumentException">Thrown when the failed input package ID is invalid.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
public static bool IsPreloadPackageByApplicationId(string applicationId)
{
bool isPreloadPackage;
}
/// <summary>
- /// Compare certificate of two packages
+ /// Compares the certificate of the two packages.
/// </summary>
- /// <param name="lhsPackageId">package id to compare</param>
- /// <param name="rhsPackageId">package id to be compared</param>
+ /// <param name="lhsPackageId">Package ID to compare.</param>
+ /// <param name="rhsPackageId">Package ID to be compared.</param>
/// <returns>Returns certificate comparison result.</returns>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
+ /// <exception cref="ArgumentException">Thrown when the failed input package ID is invalid.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
public static CertCompareResultType CompareCertInfo(string lhsPackageId, string rhsPackageId)
{
Interop.PackageManager.CertCompareResultType compareResult;
}
/// <summary>
- /// Compare certificate of two packages which contain each given application id
+ /// Compares the certificate of the two packages which contain each given application ID.
/// </summary>
- /// <param name="lhsApplicationId">application id to compare</param>
- /// <param name="rhsApplicationId">application id to be compared</param>
+ /// <param name="lhsApplicationId">Application ID to compare.</param>
+ /// <param name="rhsApplicationId">Application ID to be compared.</param>
/// <returns>Returns certificate comparison result.</returns>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error</exception>
+ /// <exception cref="ArgumentException">Thrown when the failed input package ID is invalid.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
public static CertCompareResultType CompareCertInfoByApplicationId(string lhsApplicationId, string rhsApplicationId)
{
Interop.PackageManager.CertCompareResultType compareResult;
public static class Drm
{
/// <summary>
- /// Generates request for getting license
+ /// Generates a request for getting the license.
/// </summary>
- /// <param name="responseData">Response data string of the purchase request</param>
- /// <returns>Returns package drm information of given response data which contains require data and license url</returns>
+ /// <param name="responseData">Response data string of the purchase request.</param>
+ /// <returns>Returns the package DRM information of a given response data which contains the required data and license URL.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
public static PackageDrm GenerateLicenseRequest(string responseData)
{
return PackageDrm.GenerateLicenseRequest(responseData);
}
/// <summary>
- /// Registers encrypted license
+ /// Registers the encrypted license.
/// </summary>
- /// <param name="responseData">The response data string of the rights request</param>
- /// <returns>Returns true if succeed. Otherwise return false</returns>
+ /// <param name="responseData">The response data string of the rights request.</param>
+ /// <returns>Returns true if succeeds, otherwise false.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to internal system error.</exception>
public static bool RegisterLicense(string responseData)
{
Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmRegisterLicense(responseData);
}
/// <summary>
- /// Decrypts contents which is encrypted
+ /// Decrypts the contents which are encrypted.
/// </summary>
- /// <param name="drmFilePath">Drm file path</param>
- /// <param name="decryptedFilePath">Decrypted file path</param>
- /// <returns>Returns true if succeed. Otherwise return false</returns>
+ /// <param name="drmFilePath">Drm file path.</param>
+ /// <param name="decryptedFilePath">Decrypted file path.</param>
+ /// <returns>Returns true if succeeds, otherwise false.</returns>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
/// <privlevel>platform</privlevel>
- /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid</exception>
- /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access this method</exception>
- /// <exception cref="SystemException">Thrown when method failed due to internal system error</exception>
+ /// <exception cref="ArgumentException">Thrown when failed when input package ID is invalid.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
public static bool DecryptPackage(string drmFilePath, string decryptedFilePath)
{
Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmDecryptPackage(drmFilePath, decryptedFilePath);
namespace Tizen.Applications
{
/// <summary>
- /// PackageManagerEventArgs class. This class is an event arguments of the InstallProgressChanged, UninstallProgressChanged and UpdateProgressChanged events.
+ /// PackageManagerEventArgs class. This class is an event arguments of the InstallProgressChanged, UninstallProgressChanged, and UpdateProgressChanged events.
/// </summary>
public class PackageManagerEventArgs : EventArgs
{
}
/// <summary>
- /// Type of the package to be installed, uninstalled or updated
+ /// Type of the package to be installed, uninstalled, or updated.
/// </summary>
public PackageType PackageType { get { return _packageType; } }
/// <summary>
- /// package ID to be installed, uninstalled or updated
+ /// Package ID to be installed, uninstalled, or updated.
/// </summary>
public string PackageId { get { return _packageId; } }
/// <summary>
- /// Current state of the request to the package manager
+ /// Current state of the request to the package manager.
/// </summary>
public PackageEventState State { get { return _state; } }
namespace Tizen.Applications
{
/// <summary>
- /// This class has the read only properties to get package size information.
+ /// This class has read-only properties to get the package size information.
/// </summary>
public class PackageSizeInformation
{
private PackageSizeInformation() { }
/// <summary>
- /// Data size for package.
+ /// Data size for the package.
/// </summary>
public long DataSize { get { return _dataSize; } }
/// <summary>
- /// Cache size for package.
+ /// Cache size for the package.
/// </summary>
public long CacheSize { get { return _cacheSize; } }
/// <summary>
- /// Application size for package.
+ /// Application size for the package.
/// </summary>
public long AppSize { get { return _appSize; } }
/// <summary>
- /// External data size for package.
+ /// External data size for the package.
/// </summary>
public long ExternalDataSize { get { return _externalDataSize; } }
/// <summary>
- /// External cache size for package.
+ /// External cache size for the package.
/// </summary>
public long ExternalCacheSize { get { return _externalCacheSize; } }
/// <summary>
- /// External application size for package.
+ /// External application size for the package.
/// </summary>
public long ExternalAppSize { get { return _externalAppSize; } }
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for package type.
+ /// Enumeration for the package types.
/// </summary>
public enum PackageType
{
UNKNOWN,
/// <summary>
- /// Tizen native application package
+ /// Tizen native application package.
/// </summary>
TPK,
/// <summary>
- /// Tizen web/ hybrid application Package
+ /// Tizen web/hybrid application package.
/// </summary>
WGT,
/// <summary>
- /// It's a special meaning type to represent the tizen application package which is installed using rpm spec.
+ /// A special meaning type to represent the Tizen application package which is installed using the RPM spec.
/// Only some preloaded packages can have this type.
/// </summary>
RPM
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for permission type.
+ /// Enumeration for the permission types.
/// </summary>
public enum PermissionType
{
/// <summary>
- /// Permission is normal
+ /// Permission is normal.
/// </summary>
Normal,
/// <summary>
- /// Permission is signature
+ /// Permission is signature.
/// </summary>
Signature,
/// <summary>
- /// Permission is privilege
+ /// Permission is privilege.
/// </summary>
Privilege
}
/// <summary>
/// Executes the code required to free the SafePackageManagerHandle.
/// </summary>
- /// <returns>true if the handle is released successfully</returns>
+ /// <returns>True if the handle is released successfully.</returns>
protected override bool ReleaseHandle()
{
Interop.PackageManager.PackageManagerDestroy(handle);
/// <summary>
/// Executes the code required to free the SafePackageManagerRequestHandle.
/// </summary>
- /// <returns>true if the handle is released successfully</returns>
+ /// <returns>True if the handle is released successfully.</returns>
protected override bool ReleaseHandle()
{
Interop.PackageManager.PackageManagerRequestDestroy(handle);
namespace Tizen.Applications
{
/// <summary>
- /// Enumeration for storage type.
+ /// Enumeration for the storage types.
/// </summary>
public enum StorageType
{
using Tizen.Applications;
/// <summary>
-/// Contains Interop declarations of Preference classes.
+/// Contains interop declarations of the preference classes.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Contains Interop declarations of Preference device API.
+ /// Contains interop declarations of the preference device API.
/// </summary>
internal static partial class Preference
{
namespace Tizen.Applications
{
/// <summary>
- /// The Preference class provides APIs to store and retrieve application specific data/preference. A preference is saved in the form of a key-value pair.
- /// Keys are always text strings and value can be any one of four types: integer, double, string and boolean.
+ /// The preference class provides APIs to store and retrieve an application specific data/preference. A preference is saved in the form of a key-value pair.
+ /// Keys are always text strings and the value can be any one of the four types: integer, double, string, and boolean.
/// </summary>
public static class Preference
{
}
/// <summary>
- /// Retrieves all keys of the application preferences
+ /// Retrieves all keys of the application preferences.
/// </summary>
/// <value>
- /// The list of keys
+ /// The list of keys.
/// </value>
/// <example>
/// <code>
/// Gets the event context for the given key.
/// </summary>
/// <seealso cref="EventContext"/>
- /// <param name="key">The preference key</param>
- /// <returns>The event context of respective key</returns>
- /// <exception cref="KeyNotFoundException">Thrown if the key is not found</exception>
- /// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
+ /// <param name="key">The preference key.</param>
+ /// <returns>The event context of respective key.</returns>
+ /// <exception cref="KeyNotFoundException">Thrown if the key is not found.</exception>
+ /// <exception cref="ArgumentException">Thrown if the key is invalid parameter.</exception>
/// <example>
/// <code>
/// private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e)
/// <summary>
/// Checks whether the given key exists in the preference.
/// </summary>
- /// <param name="key">The name of the key to check</param>
- /// <returns>true if the key exists in the preference, otherwise false</returns>
+ /// <param name="key">The name of the key to check.</param>
+ /// <returns>True if the key exists in the preference, otherwise false.</returns>
/// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
- /// <exception cref="IOException">Thrown when method failed due to internal IO error.</exception>
+ /// <exception cref="IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// Preference.Set("active_user", "Joe");
/// Sets a key-value pair representing the preference.
/// </summary>
/// <remarks>
- /// If the key already exists in the Preference, old value will be overwritten with new value.
- /// Data types supported for value are: integer, double, string and bool.
+ /// If the key already exists in the preference, the old value will be overwritten with a new value.
+ /// Data types for supported values are: integer, double, string, and bool.
/// </remarks>
- /// <param name="key">The name of the key to create/modigy</param>
+ /// <param name="key">The name of the key to create/modify./param>
/// <param name="value">The value corresponding to the key.</param>
/// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// Preference.Set("Option_enabled", true);
/// Note that this is a generic method.
/// </summary>
/// <typeparam name="T">The generic type to return.</typeparam>
- /// <param name="key">The key of the preference</param>
+ /// <param name="key">The key of the preference.</param>
/// <returns>The value of the preference item if it is of the specified generic type.</returns>
- /// <exception cref="KeyNotFoundException">Thrown if the key is not found</exception>
+ /// <exception cref="KeyNotFoundException">Thrown if the key is not found.</exception>
/// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// bool exists = Preference.Contains("active_user");
/// <summary>
/// Removes any preference value with the given key.
/// </summary>
- /// <param name="key">The key to remove</param>
- /// <exception cref="KeyNotFoundException">Thrown if the key is not found</exception>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error.</exception>
+ /// <param name="key">The key to remove.</param>
+ /// <exception cref="KeyNotFoundException">Thrown if the key is not found.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// bool exists = Preference.Contains("active_user");
}
/// <summary>
- /// Removes all key-value pairs from the preference.
+ /// Removes all the key-value pairs from the preference.
/// </summary>
- /// <exception cref="System.IO.IOException">Thrown when method failed due to internal IO error.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// Preference.Set("Option_enabled", true);
}
/// <summary>
- /// The class manages event handlers of preference keys. The class enables having event handlers for individual preference keys.
+ /// The class manages event handlers of the preference keys. The class enables having event handlers for individual preference keys.
/// </summary>
public class EventContext
{
}
/// <summary>
- /// Occurs whenever there is change in the value of preference key.
+ /// Occurs whenever there is a change in the value of a preference key.
/// </summary>
/// <exception cref="System.ArgumentException">Thrown when the key does not exist or when there is an invalid parameter.</exception>
- /// <exception cref="System.InvalidOperationException">Thrown when the Bundle instance has been disposed.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
/// <example>
/// <code>
/// private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e)
namespace Tizen.Applications
{
/// <summary>
- /// This class is an event arguments of the PreferenceChanged events.
+ /// This class is an event argument of the PreferenceChanged event.
/// </summary>
public class PreferenceChangedEventArgs : EventArgs
{
namespace Tizen.Applications
{
/// <summary>
- /// Represents a service application.
+ /// Represents the service applications.
/// </summary>
public class ServiceApplication : CoreApplication
{
/// <summary>
- /// Initializes ServiceApplication class.
+ /// Initializes the ServiceApplication class.
/// </summary>
public ServiceApplication() : base(new ServiceCoreBackend())
{
namespace Tizen.Applications
{
/// <summary>
- /// The class helps you create and show ToastMessage which is a view quick message for the user
+ /// The class helps you to create and show the ToastMessage which is a view quick message for the user.
/// </summary>
public sealed class ToastMessage
{
/// <summary>
- /// Gets and sets message to post ToastMessage
+ /// Gets and sets a message to post the ToastMessage.
/// </summary>
public string Message { get; set; }
/// <summary>
- /// Posts a message on a toast popup
+ /// Posts a message on a toast pop-up.
/// </summary>
- /// <exception cref="ArgumentNullException">Thrown when Message is null</exception>
+ /// <exception cref="ArgumentNullException">Thrown when the message is null.</exception>
/// <example>
/// <code>
/// ToastMessage toast = new ToastMessage
namespace Tizen.Applications
{
/// <summary>
- /// Represents an application that have UI screen. The events for resuming and pausing are provided.
+ /// Represents an application that has an UI screen. The events for resuming and pausing are provided.
/// </summary>
public class CoreUIApplication : CoreApplication
{
/// Initializes the CoreUIApplication class.
/// </summary>
/// <remarks>
- /// Default backend for UI application will be used.
+ /// The default backend for the UI application will be used.
/// </remarks>
public CoreUIApplication() : base(new UICoreBackend())
{
/// Initializes the CoreUIApplication class.
/// </summary>
/// <remarks>
- /// If want to change the backend, use this constructor.
+ /// If you want to change the backend, use this constructor.
/// </remarks>
- /// <param name="backend">The backend instance implementing ICoreBacked interface.</param>
+ /// <param name="backend">The backend instance implementing the ICoreBacked interface.</param>
public CoreUIApplication(ICoreBackend backend) : base(backend)
{
}
/// <summary>
/// Runs the UI application's main loop.
/// </summary>
- /// <param name="args">Arguments from commandline.</param>
+ /// <param name="args">Arguments from the commandline.</param>
public override void Run(string[] args)
{
Backend.AddEventHandler(EventType.PreCreated, OnPreCreate);
}
/// <summary>
- /// Overrides this method if want to handle behavior before calling OnCreate().
+ /// Overrides this method if you want to handle the behavior before calling OnCreate().
/// </summary>
protected virtual void OnPreCreate()
{
}
/// <summary>
- /// Overrides this method if want to handle behavior when the application is resumed.
+ /// Overrides this method if you want to handle the behavior when the application is resumed.
/// If base.OnResume() is not called, the event 'Resumed' will not be emitted.
/// </summary>
protected virtual void OnResume()
}
/// <summary>
- /// Overrides this method if want to handle behavior when the application is paused.
+ /// Overrides this method if you want to handle the behavior when the application is paused.
/// If base.OnPause() is not called, the event 'Paused' will not be emitted.
/// </summary>
protected virtual void OnPause()
namespace Tizen.Content.MimeType
{
/// <summary>
- /// The MimeUtil API provides functions to map MIME types to file extensions and vice versa.</summary>
+ /// The MimeUtil API provides functions to map the MIME types to file extensions and vice versa.</summary>
/// <remarks>
- /// Conversions are provided from file extensions to MIME types and from MIME types to file extensions.</remarks>
+ /// Conversions are provided from the file extensions to MIME types and from the MIME types to file extensions.</remarks>
public static class MimeUtil
{
/// <summary>
/// Gets the MIME type for the given file extension.
- /// The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
+ /// The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats.
/// </summary>
- /// <param name="fileExtension"> The file Extension</param>
+ /// <param name="fileExtension"> The file extension.</param>
/// <example>
/// <code>
/// string mimeType = MimeUtil.GetMimeType("png");
}
/// <summary>
- /// Gets file extensions for the given MIME type. </summary>
+ /// Gets the file extensions for the given MIME type.</summary>
/// <returns>
- /// If Successfull, return's the list of file extension strings for the given MIME type.
- /// The array of file extension are without the leading dot ('.')</returns>
- /// <param name="mime"> The mime type</param>
+ /// If successful, returns the list of file extension strings for the given MIME type.
+ /// The array of file extension is without the leading dot ('.').</returns>
+ /// <param name="mime"> The MIME type.</param>
/// <example>
/// <code>
/// IEnumerable<string> extColl = MimeUtil.GetFileExtension("video/mpeg");
using System;
using System.Runtime.InteropServices;
+using static Interop.AudioIO;
namespace Tizen.Multimedia
{
/// <summary>
/// Provides the ability to directly manage the system audio input devices.
/// </summary>
- /// <remarks>The recorder privilege(http://tizen.org/privilege/recorder) is required.</remarks>
+ /// <privilege>http://tizen.org/privilege/recorder</privilege>
public abstract class AudioCaptureBase : IDisposable
{
/// <summary>
- /// Specifies the minimum value allowed for the audio capture.
+ /// Specifies the minimum value allowed for the audio capture, in Hertz (Hz).
/// </summary>
+ /// <seealso cref="SampleRate"/>
public static readonly int MinSampleRate = 8000;
/// <summary>
- /// Specifies the maximum value allowed for the audio capture.
+ /// Specifies the maximum value allowed for the audio capture, in Hertz (Hz).
/// </summary>
+ /// <seealso cref="SampleRate"/>
public static readonly int MaxSampleRate = 48000;
internal IntPtr _handle = IntPtr.Zero;
SampleType = sampleType;
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioInput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle));
+ AudioInput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle));
RegisterStateChangedCallback();
}
/// </summary>
public event EventHandler<AudioIOStateChangedEventArgs> StateChanged;
- private Interop.AudioIO.AudioStateChangedCallback _stateChangedCallback;
+ private AudioStateChangedCallback _stateChangedCallback;
private void RegisterStateChangedCallback()
{
};
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero));
+ AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero));
}
#region Dispose support
}
}
- Interop.AudioIO.AudioInput.Destroy(_handle);
+ AudioInput.Destroy(_handle);
_handle = IntPtr.Zero;
_isDisposed = true;
}
}
/// <summary>
- /// Gets the sample rate of the audio input data stream.
+ /// Gets the sample rate of the audio input data stream, in Hertz (Hz).
/// </summary>
public int SampleRate { get; }
/// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
public int GetBufferSize()
{
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.GetBufferSize(_handle, out var size));
+ AudioIOUtil.ThrowIfError(AudioInput.GetBufferSize(_handle, out var size));
return size;
}
{
ValidateState(AudioIOState.Idle);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Prepare(_handle),
+ AudioIOUtil.ThrowIfError(AudioInput.Prepare(_handle),
"Failed to prepare the AudioCapture");
}
/// </summary>
/// <exception cref="InvalidOperationException">
/// Operation failed due to internal error.\n
- /// \n
+ /// -or-\n
/// The current state is <see cref="AudioIOState.Idle"/>.
/// </exception>
/// <seealso cref="Prepare"/>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Unprepare(_handle),
+ AudioIOUtil.ThrowIfError(AudioInput.Unprepare(_handle),
"Failed to unprepare the AudioCapture");
}
/// Pauses buffering of audio data from the device.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// The current state is <see cref="AudioState.Idle"/>.\n
+ /// The current state is <see cref="AudioIOState.Idle"/>.\n
/// -or-\n
/// The method is called in the <see cref="AsyncAudioCapture.DataAvailable"/> event handler.
/// </exception>
}
ValidateState(AudioIOState.Running);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Pause(_handle));
+ AudioIOUtil.ThrowIfError(AudioInput.Pause(_handle));
}
/// <summary>
/// Resumes buffering audio data from the device.
/// </summary>
/// <exception cref="InvalidOperationException">
- /// The current state is <see cref="AudioState.Idle"/>.\n
+ /// The current state is <see cref="AudioIOState.Idle"/>.\n
/// -or-\n
/// The method is called in the <see cref="AsyncAudioCapture.DataAvailable"/> event handler.
/// </exception>
}
ValidateState(AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Resume(_handle));
+ AudioIOUtil.ThrowIfError(AudioInput.Resume(_handle));
}
/// <summary>
/// Flushes and discards buffered audio data from the input stream.
/// </summary>
- /// <exception cref="InvalidOperationException">The current state is <see cref="AudioState.Idle"/>.</exception>
+ /// <exception cref="InvalidOperationException">The current state is <see cref="AudioIOState.Idle"/>.</exception>
public void Flush()
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = Interop.AudioIO.AudioInput.Flush(_handle);
+ int ret = AudioInput.Flush(_handle);
MultimediaDebug.AssertNoError(ret);
}
throw new ArgumentNullException(nameof(streamPolicy));
}
- if (streamPolicy.Handle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(streamPolicy));
- }
-
ValidateNotDisposed();
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.SetStreamInfo(_handle, streamPolicy.Handle));
+ AudioIOUtil.ThrowIfError(AudioInput.SetStreamInfo(_handle, streamPolicy.Handle));
}
}
/// <param name="channel">The audio channel type.</param>
/// <param name="sampleType">The audio sample type.</param>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="sampleRate"/> is less than <see cref="MinSampleRate"/>.\n
+ /// <paramref name="sampleRate"/> is less than <see cref="AudioCaptureBase.MinSampleRate"/>.\n
/// -or-\n
- /// <paramref name="sampleRate"/> is greater than <see cref="MaxSampleRate"/>.
+ /// <paramref name="sampleRate"/> is greater than <see cref="AudioCaptureBase.MaxSampleRate"/>.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="channel"/> is invalid.\n
byte[] buffer = new byte[count];
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Read(_handle, buffer, count),
+ AudioIOUtil.ThrowIfError(AudioInput.Read(_handle, buffer, count),
"Failed to read");
return buffer;
/// <param name="channel">The audio channel type.</param>
/// <param name="sampleType">The audio sample type.</param>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="sampleRate"/> is less than <see cref="MinSampleRate"/>.\n
+ /// <paramref name="sampleRate"/> is less than <see cref="AudioCaptureBase.MinSampleRate"/>.\n
/// -or-\n
- /// <paramref name="sampleRate"/> is greater than <see cref="MaxSampleRate"/>.
+ /// <paramref name="sampleRate"/> is greater than <see cref="AudioCaptureBase.MaxSampleRate"/>.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="channel"/> is invalid.\n
_streamCallback = (IntPtr handle, uint length, IntPtr _) => { OnInputDataAvailable(handle, length); };
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioInput.SetStreamCallback(_handle, _streamCallback, IntPtr.Zero),
+ AudioInput.SetStreamCallback(_handle, _streamCallback, IntPtr.Zero),
$"Failed to initialize a { nameof(AsyncAudioCapture) }");
}
- private Interop.AudioIO.AudioStreamCallback _streamCallback;
+ private AudioStreamCallback _streamCallback;
private void OnInputDataAvailable(IntPtr handle, uint length)
{
IntPtr ptr = IntPtr.Zero;
try
{
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Peek(_handle, out ptr, ref length));
+ AudioIOUtil.ThrowIfError(AudioInput.Peek(_handle, out ptr, ref length));
byte[] buffer = new byte[length];
Marshal.Copy(ptr, buffer, 0, (int)length);
- Interop.AudioIO.AudioInput.Drop(_handle);
+ AudioInput.Drop(_handle);
DataAvailable?.Invoke(this, new AudioDataAvailableEventArgs(buffer));
}
*/
using System;
+using static Interop.AudioIO;
namespace Tizen.Multimedia
{
/// </summary>
public class AudioPlayback : IDisposable
{
+ /// <summary>
+ /// Specifies the minimum value allowed for the audio capture, in Hertz (Hz).
+ /// </summary>
+ /// <seealso cref="SampleRate"/>
public static readonly int MinSampleRate = 8000;
+
+ /// <summary>
+ /// Specifies the maximum value allowed for the audio capture, in Hertz (Hz).
+ /// </summary>
+ /// <seealso cref="SampleRate"/>
public static readonly int MaxSampleRate = 48000;
private IntPtr _handle = IntPtr.Zero;
/// <seealso cref="Write(byte[])"/>
public event EventHandler<AudioPlaybackBufferAvailableEventArgs> BufferAvailable;
- private Interop.AudioIO.AudioStreamCallback _streamCallback;
+ private AudioStreamCallback _streamCallback;
private void RegisterStreamCallback()
{
};
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero),
+ AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero),
$"Failed to create {nameof(AudioPlayback)}");
}
/// </summary>
public event EventHandler<AudioIOStateChangedEventArgs> StateChanged;
- private Interop.AudioIO.AudioStateChangedCallback _stateChangedCallback;
+ private AudioStateChangedCallback _stateChangedCallback;
private void RegisterStateChangedCallback()
{
};
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
+ AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
$"Failed to create {nameof(AudioPlayback)}");
}
#endregion
SampleType = sampleType;
AudioIOUtil.ThrowIfError(
- Interop.AudioIO.AudioOutput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle),
+ AudioOutput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle),
$"Failed to create {nameof(AudioPlayback)}");
RegisterStreamCallback();
}
}
- Interop.AudioIO.AudioOutput.Destroy(_handle);
+ AudioOutput.Destroy(_handle);
_handle = IntPtr.Zero;
_isDisposed = true;
}
}
/// <summary>
- /// Gets the sample rate of the audio output data stream.
+ /// Gets the sample rate of the audio output data stream, in Hertz (Hz).
/// </summary>
public int SampleRate { get; }
ValidateNotDisposed();
int audioType = 0;
- int ret = Interop.AudioIO.AudioOutput.GetSoundType(_handle, out audioType);
+ int ret = AudioOutput.GetSoundType(_handle, out audioType);
MultimediaDebug.AssertNoError(ret);
return (AudioStreamType)audioType;
/// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
public int GetBufferSize()
{
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.GetBufferSize(_handle, out var size));
+ AudioIOUtil.ThrowIfError(AudioOutput.GetBufferSize(_handle, out var size));
return 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)
+ /// It blocks the calling thread until draining the stream buffer completely. (e.g. end of playback)
/// </summary>
/// <exception cref="ObjectDisposedException">The AudioPlayback has already been disposed.</exception>
/// <exception cref="InvalidOperationException">The current state is <see cref="AudioIOState.Idle"/>.</exception>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = Interop.AudioIO.AudioOutput.Drain(_handle);
+ int ret = AudioOutput.Drain(_handle);
MultimediaDebug.AssertNoError(ret);
}
throw new ArgumentException("buffer has no data.(the Length is zero.)", nameof(buffer));
}
- int ret = Interop.AudioIO.AudioOutput.Write(_handle, buffer, (uint)buffer.Length);
+ int ret = AudioOutput.Write(_handle, buffer, (uint)buffer.Length);
AudioIOUtil.ThrowIfError(ret, "Failed to write buffer");
{
ValidateState(AudioIOState.Idle);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Prepare(_handle),
+ AudioIOUtil.ThrowIfError(AudioOutput.Prepare(_handle),
$"Failed to prepare the {nameof(AudioPlayback)}");
}
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Unprepare(_handle),
+ AudioIOUtil.ThrowIfError(AudioOutput.Unprepare(_handle),
$"Failed to unprepare the {nameof(AudioPlayback)}");
}
}
ValidateState(AudioIOState.Running);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Pause(_handle));
+ AudioIOUtil.ThrowIfError(AudioOutput.Pause(_handle));
}
/// <summary>
}
ValidateState(AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Resume(_handle));
+ AudioIOUtil.ThrowIfError(AudioOutput.Resume(_handle));
}
/// <summary>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = Interop.AudioIO.AudioOutput.Flush(_handle);
+ int ret = AudioOutput.Flush(_handle);
MultimediaDebug.AssertNoError(ret);
}
throw new ArgumentNullException(nameof(streamPolicy));
}
- if (streamPolicy.Handle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(streamPolicy));
- }
-
ValidateNotDisposed();
- AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.SetStreamInfo(_handle, streamPolicy.Handle));
+ AudioIOUtil.ThrowIfError(AudioOutput.SetStreamInfo(_handle, streamPolicy.Handle));
}
}
}
using System;
using System.Runtime.InteropServices;
+using Tizen.Multimedia;
internal static partial class Interop
{
internal static extern int Destroy(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_sound_stream_info")]
- internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle);
+ internal static extern int SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_prepare")]
internal static extern int Prepare(IntPtr handle);
internal static extern int Resume(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_sound_stream_info")]
- internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle);
+ internal static extern int SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_unprepare")]
internal static extern int Unprepare(IntPtr handle);
* limitations under the License.
*/
-using System;
using System.Runtime.InteropServices;
using Tizen.Multimedia;
internal static partial class TonePlayer
{
[DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_start_new")]
- internal static extern TonePlayerError Start(ToneType tone, IntPtr streamInfoHandle,
+ internal static extern TonePlayerError Start(ToneType tone, AudioStreamPolicyHandle streamInfoHandle,
int durationMs, out int id);
[DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_stop")]
internal delegate void WavPlayerCompletedCallback(int playerId, IntPtr userData);
[DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_start_new")]
- internal static extern WavPlayerError Start(string filePath, IntPtr streamInfoHandle,
+ internal static extern WavPlayerError Start(string filePath, AudioStreamPolicyHandle streamInfoHandle,
WavPlayerCompletedCallback completedCallback, IntPtr userData, out int id);
[DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_stop")]
using System;
using System.Threading;
using System.Threading.Tasks;
+using Native = Interop.TonePlayer;
namespace Tizen.Multimedia
{
var tcs = new TaskCompletionSource<bool>();
- Interop.TonePlayer.Start(tone, streamPolicy.Handle, durationMilliseconds, out var id).
+ Native.Start(tone, streamPolicy.Handle, durationMilliseconds, out var id).
Validate("Failed to play tone.");
using (RegisterCancellationAction(tcs, cancellationToken, id))
return cancellationToken.Register(() =>
{
- Interop.TonePlayer.Stop(id).Validate("Failed to cancel");
+ Native.Stop(id).Validate("Failed to cancel");
tcs.TrySetCanceled();
});
}
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+using Native = Interop.WavPlayer;
namespace Tizen.Multimedia
{
/// </exception>
/// <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=""/> is not supported.</exception>
+ /// <exception cref="FileFormatException">The format of <paramref name="path"/> is not supported.</exception>
/// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
public static Task StartAsync(string path, AudioStreamPolicy streamPolicy)
{
/// </exception>
/// <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=""/> is not supported.</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>
public static Task StartAsync(string path, AudioStreamPolicy streamPolicy,
CancellationToken cancellationToken)
{
var tcs = new TaskCompletionSource<bool>();
- Interop.WavPlayer.WavPlayerCompletedCallback cb = (id_, _) => tcs.TrySetResult(true);
+ Native.WavPlayerCompletedCallback cb = (id_, _) => tcs.TrySetResult(true);
- Interop.WavPlayer.Start(path, streamPolicy.Handle, cb, IntPtr.Zero, out var id).
- Validate("Failed to play.");
-
- using (RegisterCancellationAction(tcs, cancellationToken, id))
+ using (ObjectKeeper.Get(cb))
{
- await tcs.Task;
+ Native.Start(path, streamPolicy.Handle, cb, IntPtr.Zero, out var id).
+ Validate("Failed to play.");
+
+ using (RegisterCancellationAction(tcs, cancellationToken, id))
+ {
+ await tcs.Task;
+ }
}
}
return cancellationToken.Register(() =>
{
- Interop.WavPlayer.Stop(id).Validate("Failed to cancel");
+ Native.Stop(id).Validate("Failed to cancel");
tcs.TrySetCanceled();
});
}
/// Retrieves all the fps by resolution supported by the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <param name="width">The width of required preview resolution.</param>
+ /// <param name="height">The height of required preview resolution.</param>
/// <returns>
/// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
/// </returns>
/// Retrieves all the fps by resolution supported by the camera.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <param name="size">The size of required preview resolution.</param>
/// <returns>
/// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
/// </returns>
{
throw new NotSupportedException("Pan is not supported.");
}
+
return _panRange.Value;
}
}
{
throw new NotSupportedException("Tilt is not supported.");
}
+
return _tiltRange.Value;
}
}
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_input_buffer_used_cb")]
internal static extern int SetInputBufferUsedCb(IntPtr handle,
- InputBufferUsedCallback cb, IntPtr arg);
+ InputBufferUsedCallback cb, IntPtr arg = default(IntPtr));
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_input_buffer_used_cb")]
internal static extern int UnsetInputBufferUsedCb(IntPtr handle);
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_output_buffer_available_cb")]
internal static extern int SetOutputBufferAvailableCb(IntPtr handle,
- OutputBufferAvailableCallback cb, IntPtr arg);
+ OutputBufferAvailableCallback cb, IntPtr arg = default(IntPtr));
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_output_buffer_available_cb")]
internal static extern int UnsetOutputBufferAvailableCb(IntPtr handle);
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_error_cb")]
- internal static extern int SetErrorCb(IntPtr handle, ErrorCallback cb, IntPtr arg);
+ internal static extern int SetErrorCb(IntPtr handle, ErrorCallback cb, IntPtr arg = default(IntPtr));
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_error_cb")]
internal static extern int UnsetErrorCb(IntPtr handle);
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_eos_cb")]
- internal static extern int SetEosCb(IntPtr handle, EosCallback cb, IntPtr arg);
+ internal static extern int SetEosCb(IntPtr handle, EosCallback cb, IntPtr arg = default(IntPtr));
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_eos_cb")]
internal static extern int UnsetEosCb(IntPtr handle);
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_buffer_status_cb")]
internal static extern int SetBufferStatusCb(IntPtr handle, BufferStatusCallback cb,
- IntPtr arg);
+ IntPtr arg = default(IntPtr));
[DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_buffer_status_cb")]
internal static extern int UnsetBufferStatusCb(IntPtr handle);
+/*
+ * 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;
{
private const int CodecTypeMask = 0xFFFF;
private const int CodecKindMask = 0x3000;
-// private const int CodecKindAudio = 0x1000; // Not used
+ // private const int CodecKindAudio = 0x1000; // Not used
private const int CodecKindVideo = 0x2000;
private IntPtr _handle;
#region OutputAvailable event
private EventHandler<OutputAvailableEventArgs> _outputAvailable;
private Interop.MediaCodec.OutputBufferAvailableCallback _outputBufferAvailableCb;
+ private object _outputAvailableLock = new object();
/// <summary>
/// Occurs when an output buffer is available.
{
ValidateNotDisposed();
- if (_outputAvailable == null)
+ lock (_outputAvailableLock)
{
- RegisterOutputAvailableCallback();
+ if (_outputAvailable == null)
+ {
+ RegisterOutputAvailableCallback();
+ }
+ _outputAvailable += value;
}
- _outputAvailable += value;
-
}
remove
{
ValidateNotDisposed();
- _outputAvailable -= value;
- if (_outputAvailable == null)
+ lock (_outputAvailableLock)
{
- UnregisterOutputAvailableCallback();
+ _outputAvailable -= value;
+ if (_outputAvailable == null)
+ {
+ // We can remove handler first, because we know the method that unregisters callback does not throw.
+ UnregisterOutputAvailableCallback();
+ }
}
}
}
{
_outputBufferAvailableCb = (packetHandle, _) =>
{
- OutputAvailableEventArgs args = null;
+ if (_outputAvailable == null)
+ {
+ Interop.MediaPacket.Destroy(packetHandle);
+ return;
+ }
+ OutputAvailableEventArgs args = null;
try
{
args = new OutputAvailableEventArgs(packetHandle);
}
- catch (Exception)
+ catch (Exception e)
{
Interop.MediaPacket.Destroy(packetHandle);
- // TODO should we throw it to unmanaged code?
- throw;
+ MultimediaLog.Error(typeof(MediaCodec).FullName, "Failed to raise OutputAvailable event", e);
}
- //TODO dispose if no event handler registered
- _outputAvailable?.Invoke(this, args);
+ if (args != null)
+ {
+ _outputAvailable?.Invoke(this, args);
+ }
};
- int ret = Interop.MediaCodec.SetOutputBufferAvailableCb(_handle,
- _outputBufferAvailableCb, IntPtr.Zero);
+ int ret = Interop.MediaCodec.SetOutputBufferAvailableCb(_handle, _outputBufferAvailableCb);
MultimediaDebug.AssertNoError(ret);
}
InputProcessed?.Invoke(this, new InputProcessedEventArgs(packet));
};
- int ret = Interop.MediaCodec.SetInputBufferUsedCb(_handle,
- _inputBufferUsedCb, IntPtr.Zero);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- private void UnregisterInputProcessed()
- {
- int ret = Interop.MediaCodec.UnsetInputBufferUsedCb(_handle);
+ int ret = Interop.MediaCodec.SetInputBufferUsedCb(_handle, _inputBufferUsedCb);
MultimediaDebug.AssertNoError(ret);
}
ErrorOccurred?.Invoke(this, new MediaCodecErrorOccurredEventArgs(error));
};
- int ret = Interop.MediaCodec.SetErrorCb(_handle, _errorCb, IntPtr.Zero);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- private void UnregisterErrorOccurred()
- {
- int ret = Interop.MediaCodec.UnsetErrorCb(_handle);
+ int ret = Interop.MediaCodec.SetErrorCb(_handle, _errorCb);
MultimediaDebug.AssertNoError(ret);
}
#endregion
#region EosReached event
- private EventHandler<EventArgs> _eosReached;
private Interop.MediaCodec.EosCallback _eosCb;
- // TODO replace
/// <summary>
/// Occurs when the codec processes all input data.
/// </summary>
- public event EventHandler<EventArgs> EosReached
- {
- add
- {
- ValidateNotDisposed();
-
- if (_eosReached == null)
- {
- RegisterEosReached();
- }
- _eosReached += value;
-
- }
- remove
- {
- ValidateNotDisposed();
-
- _eosReached -= value;
- if (_eosReached == null)
- {
- UnregisterEosReached();
- }
- }
- }
+ public event EventHandler<EventArgs> EosReached;
private void RegisterEosReached()
{
- _eosCb = _ => _eosReached?.Invoke(this, EventArgs.Empty);
+ _eosCb = _ => EosReached?.Invoke(this, EventArgs.Empty);
- int ret = Interop.MediaCodec.SetEosCb(_handle, _eosCb, IntPtr.Zero);
+ int ret = Interop.MediaCodec.SetEosCb(_handle, _eosCb);
MultimediaDebug.AssertNoError(ret);
}
- private void UnregisterEosReached()
- {
- int ret = Interop.MediaCodec.UnsetEosCb(_handle);
-
- MultimediaDebug.AssertNoError(ret);
- }
#endregion
#region BufferStatusChanged event
- private EventHandler<BufferStatusChangedEventArgs> _bufferStatusChanged;
private Interop.MediaCodec.BufferStatusCallback _bufferStatusCb;
/// <summary>
/// Occurs when the codec needs more data or has enough data.
/// </summary>
- public event EventHandler<BufferStatusChangedEventArgs> BufferStatusChanged
- {
- add
- {
- ValidateNotDisposed();
-
- if (_bufferStatusChanged == null)
- {
- RegisterBufferStatusChanged();
- }
- _bufferStatusChanged += value;
-
- }
- remove
- {
- ValidateNotDisposed();
-
- _bufferStatusChanged -= value;
- if (_bufferStatusChanged == null)
- {
- UnregisterBufferStatusChanged();
- }
- }
- }
+ public event EventHandler<BufferStatusChangedEventArgs> BufferStatusChanged;
private void RegisterBufferStatusChanged()
{
Debug.Assert(Enum.IsDefined(typeof(MediaCodecStatus), statusCode),
$"{ statusCode } is not defined in MediaCodecStatus!");
- _bufferStatusChanged?.Invoke(this,
+ BufferStatusChanged?.Invoke(this,
new BufferStatusChangedEventArgs((MediaCodecStatus)statusCode));
};
- int ret = Interop.MediaCodec.SetBufferStatusCb(_handle, _bufferStatusCb, IntPtr.Zero);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- private void UnregisterBufferStatusChanged()
- {
- int ret = Interop.MediaCodec.UnsetBufferStatusCb(_handle);
+ int ret = Interop.MediaCodec.SetBufferStatusCb(_handle, _bufferStatusCb);
MultimediaDebug.AssertNoError(ret);
}
[DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_is_available")]
internal static extern PlayerErrorCode EqualizerIsAvailable(IntPtr player, out bool available);
}
-
}
internal static extern PlayerErrorCode GetVolume(IntPtr player, out float left, out float right);
[DllImport(Libraries.Player, EntryPoint = "player_set_sound_stream_info")]
- internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, IntPtr streamInfo);
+ internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, AudioStreamPolicyHandle streamInfo);
[DllImport(Libraries.Player, EntryPoint = "player_set_audio_latency_mode")]
internal static extern PlayerErrorCode SetAudioLatencyMode(IntPtr player, AudioLatencyMode latencyMode);
/// <value>The percentage of the buffering.</value>
public int Percent { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Percent={ Percent.ToString() }";
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
namespace Tizen.Multimedia
{
set;
}
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Start={ Start.ToString() }, Current={ Current.ToString() }";
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using System.Diagnostics;
using Native = Interop.AudioEffect;
/// <param name="value">The value indicating new gain in decibel(dB).</param>
/// <exception cref="ObjectDisposedException">The player that this EqualizerBand belongs to has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="value"/> is less than <see cref="AudioEffect.MinBandLevel"/>.\n
- /// -or-\n
- /// <paramref name="value"/> is greater than <see cref="AudioEffect.MaxBandLevel"/>.
+ /// <paramref name="value"/> is not inside of <see cref="AudioEffect.BandLevelRange"/>.
/// </exception>
public int Level
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using static Interop;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
namespace Tizen.Multimedia
{
/// <summary>
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
namespace Tizen.Multimedia
/// </summary>
public MediaStreamBufferStatus Status { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Status : { Status.ToString() }";
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using System.Diagnostics;
using static Interop;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
namespace Tizen.Multimedia
/// </summary>
public class MediaStreamSeekingOccurredEventArgs : EventArgs
{
- /// <summary>
+ /// <summary>
/// Initializes a new instance of the MediaStreamSeekingOccurredEventArgs class.
/// </summary>
/// <param name="offset">The value indicating the new position to seek.</param>
public MediaStreamSeekingOccurredEventArgs(ulong offset)
{
- Offset = offset;
+ Offset = offset;
}
/// <summary>
/// </summary>
public ulong Offset { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString() => $"Offset : { Offset.ToString() }";
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
private MediaStreamConfiguration CreateAudioConfiguration(AudioMediaFormat format)
{
- if( format == null )
+ if (format == null)
{
return null;
}
-/// Media Uri source
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using static Interop;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
namespace Tizen.Multimedia
/// </summary>
public PlaybackInterruptionReason Reason { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Reason : { Reason.ToString() }";
--- /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.Threading.Tasks;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.IO;
+using System.Threading;
+using static Interop;
+
+namespace Tizen.Multimedia
+{
+ public partial class Player
+ {
+ /// <summary>
+ /// Occurs when 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.
+ /// </summary>
+ public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterrupted;
+ private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback;
+
+ /// <summary>
+ /// Occurs when any error occurs.
+ /// </summary>
+ /// <remarks>The event handler will be executed on an internal thread.</remarks>
+ public event EventHandler<PlayerErrorOccurredEventArgs> ErrorOccurred;
+ private NativePlayer.PlaybackErrorCallback _playbackErrorCallback;
+
+ /// <summary>
+ /// Occurs when the video stream changed.
+ /// </summary>
+ /// <remarks>The event handler will be executed on an internal thread.</remarks>
+ public event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged;
+ private NativePlayer.VideoStreamChangedCallback _videoStreamChangedCallback;
+
+ /// <summary>
+ /// Occurs when the subtitle is updated.
+ /// </summary>
+ /// <remarks>The event handler will be executed on an internal thread.</remarks>
+ public event EventHandler<SubtitleUpdatedEventArgs> SubtitleUpdated;
+ private NativePlayer.SubtitleUpdatedCallback _subtitleUpdatedCallback;
+
+ /// <summary>
+ /// Occurs when there is a change in the buffering status of streaming.
+ /// </summary>
+ public event EventHandler<BufferingProgressChangedEventArgs> BufferingProgressChanged;
+ private NativePlayer.BufferingProgressCallback _bufferingProgressCallback;
+
+ internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamAudioBufferStatusChanged;
+ private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback;
+
+ internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamVideoBufferStatusChanged;
+ private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback;
+
+ internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamAudioSeekingOccurred;
+ private NativePlayer.MediaStreamSeekCallback _mediaStreamAudioSeekCallback;
+
+ internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamVideoSeekingOccurred;
+ private NativePlayer.MediaStreamSeekCallback _mediaStreamVideoSeekCallback;
+
+ private bool _callbackRegistered;
+
+ private void RegisterEvents()
+ {
+ if (_callbackRegistered)
+ {
+ return;
+ }
+ RegisterSubtitleUpdatedCallback();
+ RegisterErrorOccurredCallback();
+ RegisterPlaybackInterruptedCallback();
+ RegisterVideoStreamChangedCallback();
+ RegisterBufferingCallback();
+ RegisterMediaStreamBufferStatusCallback();
+ RegisterMediaStreamSeekCallback();
+ RegisterPlaybackCompletedCallback();
+
+ _callbackRegistered = true;
+ }
+
+ private void RegisterSubtitleUpdatedCallback()
+ {
+ _subtitleUpdatedCallback = (duration, text, _) =>
+ {
+ Log.Debug(PlayerLog.Tag, "duration : " + duration + ", text : " + text);
+ SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text));
+ };
+
+ NativePlayer.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback).
+ ThrowIfFailed("Failed to initialize the player");
+ }
+
+ private void RegisterPlaybackCompletedCallback()
+ {
+ _playbackCompletedCallback = _ =>
+ {
+ Log.Debug(PlayerLog.Tag, "completed callback");
+ PlaybackCompleted?.Invoke(this, EventArgs.Empty);
+ };
+ NativePlayer.SetCompletedCb(Handle, _playbackCompletedCallback).
+ ThrowIfFailed("Failed to set PlaybackCompleted");
+ }
+
+ private void RegisterPlaybackInterruptedCallback()
+ {
+ _playbackInterruptedCallback = (code, _) =>
+ {
+ if (!Enum.IsDefined(typeof(PlaybackInterruptionReason), code))
+ {
+ return;
+ }
+
+ if (code == PlaybackInterruptionReason.ResourceConflict)
+ {
+ OnUnprepared();
+ }
+
+ Log.Warn(PlayerLog.Tag, "interrupted reason : " + code);
+ PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code));
+ };
+
+ NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback).
+ ThrowIfFailed("Failed to set PlaybackInterrupted");
+ }
+
+ private void RegisterErrorOccurredCallback()
+ {
+ _playbackErrorCallback = (code, _) =>
+ {
+ //TODO handle service disconnected error.
+ Log.Warn(PlayerLog.Tag, "error code : " + code);
+ ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code));
+ };
+
+ NativePlayer.SetErrorCb(Handle, _playbackErrorCallback).
+ ThrowIfFailed("Failed to set PlaybackError");
+ }
+
+ #region VideoFrameDecoded event
+
+ private EventHandler<VideoFrameDecodedEventArgs> _videoFrameDecoded;
+
+ private NativePlayer.VideoFrameDecodedCallback _videoFrameDecodedCallback;
+
+ /// <summary>
+ /// Occurs when a video frame is decoded.
+ /// </summary>
+ /// <remarks>
+ /// <para>The event handler will be executed on an internal thread.</para>
+ /// <para>The <see cref="VideoFrameDecodedEventArgs.Packet"/> in event args should be disposed after use.</para>
+ /// </remarks>
+ /// <feature>http://tizen.org/feature/multimedia.raw_video</feature>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ /// <seealso cref="VideoFrameDecodedEventArgs.Packet"/>
+ public event EventHandler<VideoFrameDecodedEventArgs> VideoFrameDecoded
+ {
+ add
+ {
+ ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
+
+ _videoFrameDecoded += value;
+ }
+ remove
+ {
+ ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
+
+ _videoFrameDecoded -= value;
+ }
+ }
+
+ private void RegisterVideoFrameDecodedCallback()
+ {
+ _videoFrameDecodedCallback = (packetHandle, _) =>
+ {
+ var handler = _videoFrameDecoded;
+ if (handler != null)
+ {
+ Log.Debug(PlayerLog.Tag, "packet : " + packetHandle);
+ handler.Invoke(this,
+ new VideoFrameDecodedEventArgs(MediaPacket.From(packetHandle)));
+ }
+ else
+ {
+ MediaPacket.From(packetHandle).Dispose();
+ }
+ };
+
+ NativePlayer.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback).
+ ThrowIfFailed("Failed to register the VideoFrameDecoded");
+ }
+ #endregion
+
+ private void RegisterVideoStreamChangedCallback()
+ {
+ ValidatePlayerState(PlayerState.Idle);
+
+ _videoStreamChangedCallback = (width, height, fps, bitrate, _) =>
+ {
+ Log.Debug(PlayerLog.Tag, "height : " + height + ", width : " + width
+ + ", fps : " + fps + ", bitrate : " + bitrate);
+
+ VideoStreamChanged?.Invoke(this, new VideoStreamChangedEventArgs(height, width, fps, bitrate));
+ };
+
+ NativePlayer.SetVideoStreamChangedCb(Handle, _videoStreamChangedCallback).
+ ThrowIfFailed("Failed to set the video stream changed callback");
+ }
+
+ private void RegisterBufferingCallback()
+ {
+ _bufferingProgressCallback = (percent, _) =>
+ {
+ Log.Debug(PlayerLog.Tag, $"Buffering callback with percent { percent }");
+ BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent));
+ };
+
+ NativePlayer.SetBufferingCb(Handle, _bufferingProgressCallback).
+ ThrowIfFailed("Failed to set BufferingProgress");
+ }
+
+ private void RegisterMediaStreamBufferStatusCallback()
+ {
+ _mediaStreamAudioBufferStatusChangedCallback = (status, _) =>
+ {
+ Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
+ Log.Debug(PlayerLog.Tag, "audio buffer status : " + status);
+ MediaStreamAudioBufferStatusChanged?.Invoke(this,
+ new MediaStreamBufferStatusChangedEventArgs(status));
+ };
+ _mediaStreamVideoBufferStatusChangedCallback = (status, _) =>
+ {
+ Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
+ Log.Debug(PlayerLog.Tag, "video buffer status : " + status);
+ MediaStreamVideoBufferStatusChanged?.Invoke(this,
+ new MediaStreamBufferStatusChangedEventArgs(status));
+ };
+
+ RegisterMediaStreamBufferStatusCallback(StreamType.Audio, _mediaStreamAudioBufferStatusChangedCallback);
+ RegisterMediaStreamBufferStatusCallback(StreamType.Video, _mediaStreamVideoBufferStatusChangedCallback);
+ }
+
+ private void RegisterMediaStreamBufferStatusCallback(StreamType streamType,
+ NativePlayer.MediaStreamBufferStatusCallback cb)
+ {
+ NativePlayer.SetMediaStreamBufferStatusCb(Handle, streamType, cb).
+ ThrowIfFailed("Failed to SetMediaStreamBufferStatus");
+ }
+
+ private void RegisterMediaStreamSeekCallback()
+ {
+ _mediaStreamAudioSeekCallback = (offset, _) =>
+ {
+ Log.Debug(PlayerLog.Tag, "audio seeking offset : " + offset);
+ MediaStreamAudioSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
+ };
+ _mediaStreamVideoSeekCallback = (offset, _) =>
+ {
+ Log.Debug(PlayerLog.Tag, "video seeking offset : " + offset);
+ MediaStreamVideoSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
+ };
+
+ RegisterMediaStreamSeekCallback(StreamType.Audio, _mediaStreamAudioSeekCallback);
+ RegisterMediaStreamSeekCallback(StreamType.Video, _mediaStreamVideoSeekCallback);
+ }
+
+ private void RegisterMediaStreamSeekCallback(StreamType streamType, NativePlayer.MediaStreamSeekCallback cb)
+ {
+ NativePlayer.SetMediaStreamSeekCb(Handle, streamType, cb).
+ ThrowIfFailed("Failed to SetMediaStreamSeek");
+ }
+ }
+}
--- /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.Threading.Tasks;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.IO;
+using System.Threading;
+using static Interop;
+
+namespace Tizen.Multimedia
+{
+ public partial class Player
+ {
+ private void RetrieveProperties()
+ {
+ NativePlayer.GetAudioLatencyMode(Handle, out _audioLatencyMode).
+ ThrowIfFailed("Failed to initialize the player");
+
+ NativePlayer.IsLooping(Handle, out _isLooping).ThrowIfFailed("Failed to initialize the player");
+ }
+
+ /// <summary>
+ /// Gets the native handle of the player.
+ /// </summary>
+ /// <value>An IntPtr that contains the native handle of the player.</value>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ public IntPtr Handle
+ {
+ get
+ {
+ ValidateNotDisposed();
+ return _handle.DangerousGetHandle();
+ }
+ }
+
+ #region Network configuration
+ private string _cookie = "";
+ private string _userAgent = "";
+
+ /// <summary>
+ /// 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>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="ArgumentNullException">The value to set is null.</exception>
+ public string Cookie
+ {
+ get
+ {
+ Log.Info(PlayerLog.Tag, "get cookie : " + _cookie);
+ return _cookie;
+ }
+ set
+ {
+ ValidatePlayerState(PlayerState.Idle);
+
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value), "Cookie can't be null.");
+ }
+
+ NativePlayer.SetStreamingCookie(Handle, value, value.Length).
+ ThrowIfFailed("Failed to set the cookie to the player");
+
+ _cookie = value;
+ }
+ }
+
+ /// <summary>
+ /// 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>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="ArgumentNullException">The value to set is null.</exception>
+ public string UserAgent
+ {
+ get
+ {
+ Log.Info(PlayerLog.Tag, "get useragent : " + _userAgent);
+ return _userAgent;
+ }
+ set
+ {
+ ValidatePlayerState(PlayerState.Idle);
+
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value), "UserAgent can't be null.");
+ }
+
+ NativePlayer.SetStreamingUserAgent(Handle, value, value.Length).
+ ThrowIfFailed("Failed to set the user agent to the player");
+
+ _userAgent = value;
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Gets the state of the player.
+ /// </summary>
+ /// <value>The current state of the player.</value>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ public PlayerState State
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ if (IsPreparing())
+ {
+ return PlayerState.Preparing;
+ }
+
+ NativePlayer.GetState(Handle, out var state).ThrowIfFailed("Failed to retrieve the state of the player");
+
+ Debug.Assert(Enum.IsDefined(typeof(PlayerState), state));
+
+ return (PlayerState)state;
+ }
+ }
+
+ private AudioLatencyMode _audioLatencyMode;
+
+ /// <summary>
+ /// Gets or sets the audio latency mode.
+ /// </summary>
+ /// <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.
+ /// 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>
+ /// <exception cref="ArgumentException">The value is not valid.</exception>
+ public AudioLatencyMode AudioLatencyMode
+ {
+ get
+ {
+ Log.Info(PlayerLog.Tag, "get audio latency mode : " + _audioLatencyMode);
+ return _audioLatencyMode;
+ }
+ set
+ {
+ ValidateNotDisposed();
+
+ if (_audioLatencyMode == value)
+ {
+ return;
+ }
+ ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value);
+
+ NativePlayer.SetAudioLatencyMode(Handle, value).
+ ThrowIfFailed("Failed to set the audio latency mode of the player");
+
+ _audioLatencyMode = value;
+ }
+ }
+
+ private bool _isLooping;
+
+ /// <summary>
+ /// Gets or sets the looping state.
+ /// </summary>
+ /// <value>true if the playback is looping; otherwise, false. The default value is false.</value>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ public bool IsLooping
+ {
+ get
+ {
+ Log.Info(PlayerLog.Tag, "get looping : " + _isLooping);
+ return _isLooping;
+ }
+ set
+ {
+ ValidateNotDisposed();
+
+ if (_isLooping == value)
+ {
+ return;
+ }
+
+ NativePlayer.SetLooping(Handle, value).ThrowIfFailed("Failed to set the looping state of the player");
+
+ _isLooping = value;
+ }
+ }
+
+ #region Display methods
+ /// <summary>
+ /// Gets the display settings.
+ /// </summary>
+ /// <value>A <see cref="PlayerDisplaySettings"/> that specifies the display settings.</value>
+ public PlayerDisplaySettings DisplaySettings { get; }
+
+ private Display _display;
+
+ private PlayerErrorCode SetDisplay(Display display)
+ {
+ if (display == null)
+ {
+ Log.Info(PlayerLog.Tag, "set display to none");
+ return NativePlayer.SetDisplay(Handle, DisplayType.None, IntPtr.Zero);
+ }
+
+ return display.ApplyTo(this);
+ }
+
+ private void ReplaceDisplay(Display newDisplay)
+ {
+ _display?.SetOwner(null);
+ _display = newDisplay;
+ _display?.SetOwner(this);
+ }
+
+ /// <summary>
+ /// Gets or sets the display.
+ /// </summary>
+ /// <value>A <see cref="Multimedia.Display"/> that specifies the display.</value>
+ /// <remarks>The player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="ArgumentException">The value has already been assigned to another player.</exception>
+ /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
+ public Display Display
+ {
+ get
+ {
+ return _display;
+ }
+ set
+ {
+ ValidatePlayerState(PlayerState.Idle);
+
+ if (value?.Owner != null)
+ {
+ if (ReferenceEquals(this, value.Owner))
+ {
+ return;
+ }
+
+ throw new ArgumentException("The display has already been assigned to another.");
+ }
+ SetDisplay(value).ThrowIfFailed("Failed to set the display to the player");
+
+ ReplaceDisplay(value);
+ }
+ }
+
+ PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
+ {
+ Debug.Assert(IsDisposed == false);
+
+ Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
+
+ return NativePlayer.SetDisplay(Handle, type, evasObject);
+ }
+ #endregion
+
+ private PlayerTrackInfo _audioTrack;
+
+ /// <summary>
+ /// Gets the track info for audio.
+ /// </summary>
+ /// <value>A <see cref="PlayerTrackInfo"/> for audio.</value>
+ public PlayerTrackInfo AudioTrackInfo
+ {
+ get
+ {
+ if (_audioTrack == null)
+ {
+ _audioTrack = new PlayerTrackInfo(this, StreamType.Audio);
+ }
+ return _audioTrack;
+ }
+ }
+
+ private PlayerTrackInfo _subtitleTrackInfo;
+
+ /// <summary>
+ /// Gets the track info for subtitle.
+ /// </summary>
+ /// <value>A <see cref="PlayerTrackInfo"/> for subtitle.</value>
+ public PlayerTrackInfo SubtitleTrackInfo
+ {
+ get
+ {
+ if (_subtitleTrackInfo == null)
+ {
+ _subtitleTrackInfo = new PlayerTrackInfo(this, StreamType.Text);
+ }
+ return _subtitleTrackInfo;
+ }
+ }
+
+ private StreamInfo _streamInfo;
+
+ /// <summary>
+ /// Gets the stream information.
+ /// </summary>
+ /// <value>A <see cref="StreamInfo"/> for this player.</value>
+ public StreamInfo StreamInfo
+ {
+ get
+ {
+ if (_streamInfo == null)
+ {
+ _streamInfo = new StreamInfo(this);
+ }
+ return _streamInfo;
+ }
+ }
+
+ private readonly AudioEffect _audioEffect;
+
+ /// <summary>
+ /// Gets the audio effect.
+ /// </summary>
+ /// <feature>http://tizen.org/feature/multimedia.custom_audio_effect</feature>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ public AudioEffect AudioEffect
+ {
+ get
+ {
+ if (_audioEffect == null)
+ {
+ throw new NotSupportedException($"The feature({Features.AudioEffect}) is not supported.");
+ }
+
+ return _audioEffect;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the mute state.
+ /// </summary>
+ /// <value>true if the player is muted; otherwise, false.</value>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ public bool Muted
+ {
+ get
+ {
+ bool value = false;
+ NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player");
+
+ Log.Info(PlayerLog.Tag, "get mute : " + value);
+
+ return value;
+ }
+ set
+ {
+ NativePlayer.SetMute(Handle, value).ThrowIfFailed("Failed to set the mute state of the player");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the current volume.
+ /// </summary>
+ /// <remarks>Valid volume range is from 0 to 1.0, inclusive.</remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="value"/> is less than zero.\n
+ /// -or-\n
+ /// <paramref name="value"/> is greater than 1.0.
+ /// </exception>
+ public float Volume
+ {
+ get
+ {
+ float value = 0.0F;
+ NativePlayer.GetVolume(Handle, out value, out value).
+ ThrowIfFailed("Failed to get the volume of the player");
+ return value;
+ }
+ set
+ {
+ if (value < 0F || 1.0F < value)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ $"Valid volume range is 0 <= value <= 1.0, but got { value }.");
+ }
+
+ NativePlayer.SetVolume(Handle, value, value).
+ ThrowIfFailed("Failed to set the volume of the player");
+ }
+ }
+ }
+}
/// 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>
- public class Player : IDisposable, IDisplayable<PlayerErrorCode>
+ public partial class Player : IDisposable, IDisplayable<PlayerErrorCode>
{
private PlayerHandle _handle;
/// <summary>
- /// Occurs when 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.
- /// </summary>
- public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterrupted;
- private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback;
-
- /// <summary>
- /// Occurs when any error occurs.
- /// </summary>
- /// <remarks>The event handler will be executed on an internal thread.</remarks>
- public event EventHandler<PlayerErrorOccurredEventArgs> ErrorOccurred;
- private NativePlayer.PlaybackErrorCallback _playbackErrorCallback;
-
- /// <summary>
- /// Occurs when the video stream changed.
- /// </summary>
- /// <remarks>The event handler will be executed on an internal thread.</remarks>
- public event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged;
- private NativePlayer.VideoStreamChangedCallback _videoStreamChangedCallback;
-
- /// <summary>
- /// Occurs when the subtitle is updated.
- /// </summary>
- /// <remarks>The event handler will be executed on an internal thread.</remarks>
- public event EventHandler<SubtitleUpdatedEventArgs> SubtitleUpdated;
- private NativePlayer.SubtitleUpdatedCallback _subtitleUpdatedCallback;
-
- /// <summary>
- /// Occurs when there is a change in the buffering status of streaming.
- /// </summary>
- public event EventHandler<BufferingProgressChangedEventArgs> BufferingProgressChanged;
- private NativePlayer.BufferingProgressCallback _bufferingProgressCallback;
-
- internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamAudioBufferStatusChanged;
- private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback;
-
- internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamVideoBufferStatusChanged;
- private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback;
-
- internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamAudioSeekingOccurred;
- private NativePlayer.MediaStreamSeekCallback _mediaStreamAudioSeekCallback;
-
- internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamVideoSeekingOccurred;
- private NativePlayer.MediaStreamSeekCallback _mediaStreamVideoSeekCallback;
-
- /// <summary>
/// Initialize a new instance of the Player class.
/// </summary>
public Player()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
-
NativePlayer.Create(out _handle).ThrowIfFailed("Failed to create player");
Debug.Assert(_handle != null);
DisplaySettings = PlayerDisplaySettings.Create(this);
}
- private void RetrieveProperties()
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
-
- NativePlayer.GetAudioLatencyMode(Handle, out _audioLatencyMode).
- ThrowIfFailed("Failed to initialize the player");
-
- NativePlayer.IsLooping(Handle, out _isLooping).ThrowIfFailed("Failed to initialize the player");
-
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
- }
-
- private bool _callbackRegistered;
-
- private void RegisterCallbacks()
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
-
- if (_callbackRegistered)
- {
- return;
- }
- RegisterSubtitleUpdatedCallback();
- RegisterErrorOccurredCallback();
- RegisterPlaybackInterruptedCallback();
- RegisterVideoStreamChangedCallback();
- RegisterBufferingCallback();
- RegisterMediaStreamBufferStatusCallback();
- RegisterMediaStreamSeekCallback();
- RegisterPlaybackCompletedCallback();
-
- _callbackRegistered = true;
- }
-
- /// <summary>
- /// Gets the native handle of the player.
- /// </summary>
- /// <value>An IntPtr that contains the native handle of the player.</value>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public IntPtr Handle
- {
- get
- {
- ValidateNotDisposed();
- return _handle.DangerousGetHandle();
- }
- }
-
internal void ValidatePlayerState(params PlayerState[] desiredStates)
{
Debug.Assert(desiredStates.Length > 0);
$"Current State : { curState }, Valid State : { string.Join(", ", desiredStates) }.");
}
- #region Properties
- #region Network configuration
- private string _cookie = "";
- private string _userAgent = "";
-
- /// <summary>
- /// 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>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- /// <exception cref="ArgumentNullException">The value to set is null.</exception>
- public string Cookie
- {
- get
- {
- Log.Info(PlayerLog.Tag, "get cookie : " + _cookie);
- return _cookie;
- }
- set
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidatePlayerState(PlayerState.Idle);
-
- if (value == null)
- {
- Log.Error(PlayerLog.Tag, "cookie can't be null");
- throw new ArgumentNullException(nameof(value), "Cookie can't be null.");
- }
-
- NativePlayer.SetStreamingCookie(Handle, value, value.Length).
- ThrowIfFailed("Failed to set the cookie to the player");
-
- _cookie = value;
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
- }
- }
-
- /// <summary>
- /// 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>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- /// <exception cref="ArgumentNullException">The value to set is null.</exception>
- public string UserAgent
- {
- get
- {
- Log.Info(PlayerLog.Tag, "get useragent : " + _userAgent);
- return _userAgent;
- }
- set
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidatePlayerState(PlayerState.Idle);
-
- if (value == null)
- {
- Log.Error(PlayerLog.Tag, "UserAgent can't be null");
- throw new ArgumentNullException(nameof(value), "UserAgent can't be null.");
- }
-
- NativePlayer.SetStreamingUserAgent(Handle, value, value.Length).
- ThrowIfFailed("Failed to set the user agent to the player");
-
- _userAgent = value;
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
- }
- }
- #endregion
-
- /// <summary>
- /// Gets the state of the player.
- /// </summary>
- /// <value>The current state of the player.</value>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public PlayerState State
- {
- get
- {
- ValidateNotDisposed();
-
- if (IsPreparing())
- {
- return PlayerState.Preparing;
- }
-
- int state = 0;
- NativePlayer.GetState(Handle, out state).ThrowIfFailed("Failed to retrieve the state of the player");
-
- Debug.Assert(Enum.IsDefined(typeof(PlayerState), state));
-
- return (PlayerState)state;
- }
- }
-
- private AudioLatencyMode _audioLatencyMode;
-
- /// <summary>
- /// Gets or sets the audio latency mode.
- /// </summary>
- /// <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.
- /// 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>
- /// <exception cref="ArgumentException">The value is not valid.</exception>
- public AudioLatencyMode AudioLatencyMode
- {
- get
- {
- Log.Info(PlayerLog.Tag, "get audio latency mode : " + _audioLatencyMode);
- return _audioLatencyMode;
- }
- set
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidateNotDisposed();
-
- if (_audioLatencyMode == value)
- {
- return;
- }
- ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value);
-
- NativePlayer.SetAudioLatencyMode(Handle, value).
- ThrowIfFailed("Failed to set the audio latency mode of the player");
-
- _audioLatencyMode = value;
- }
- }
-
- private bool _isLooping;
-
- /// <summary>
- /// Gets or sets the looping state.
- /// </summary>
- /// <value>true if the playback is looping; otherwise, false. The default value is false.</value>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public bool IsLooping
- {
- get
- {
- Log.Info(PlayerLog.Tag, "get looping : " + _isLooping);
- return _isLooping;
- }
- set
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidateNotDisposed();
-
- if (_isLooping == value)
- {
- return;
- }
-
- NativePlayer.SetLooping(Handle, value).ThrowIfFailed("Failed to set the looping state of the player");
-
- _isLooping = value;
- }
- }
-
- #region Display methods
- /// <summary>
- /// Gets the display settings.
- /// </summary>
- /// <value>A <see cref="PlayerDisplaySettings"/> that specifies the display settings.</value>
- public PlayerDisplaySettings DisplaySettings { get; }
-
- private Display _display;
-
- private PlayerErrorCode SetDisplay(Display display)
- {
- if (display == null)
- {
- Log.Info(PlayerLog.Tag, "set display to none");
- return NativePlayer.SetDisplay(Handle, DisplayType.None, IntPtr.Zero);
- }
-
- return display.ApplyTo(this);
- }
-
- private void ReplaceDisplay(Display newDisplay)
- {
- _display?.SetOwner(null);
- _display = newDisplay;
- _display?.SetOwner(this);
- }
-
- /// <summary>
- /// Gets or sets the display.
- /// </summary>
- /// <value>A <see cref="Multimedia.Display"/> that specifies the display.</value>
- /// <remarks>The player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- /// <exception cref="ArgumentException">The value has already been assigned to another player.</exception>
- /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
- public Display Display
- {
- get
- {
- return _display;
- }
- set
- {
- ValidatePlayerState(PlayerState.Idle);
-
- if (value?.Owner != null)
- {
- if (ReferenceEquals(this, value.Owner))
- {
- return;
- }
-
- throw new ArgumentException("The display has already been assigned to another.");
- }
- SetDisplay(value).ThrowIfFailed("Failed to set the display to the player");
-
- ReplaceDisplay(value);
- }
- }
-
- PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
- {
- Debug.Assert(IsDisposed == false);
-
- Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
-
- return NativePlayer.SetDisplay(Handle, type, evasObject);
- }
- #endregion
-
- private PlayerTrackInfo _audioTrack;
-
- /// <summary>
- /// Gets the track info for audio.
- /// </summary>
- /// <value>A <see cref="PlayerTrackInfo"/> for audio.</value>
- public PlayerTrackInfo AudioTrackInfo
- {
- get
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- if (_audioTrack == null)
- {
- _audioTrack = new PlayerTrackInfo(this, StreamType.Audio);
- }
- return _audioTrack;
- }
- }
-
- private PlayerTrackInfo _subtitleTrackInfo;
-
- /// <summary>
- /// Gets the track info for subtitle.
- /// </summary>
- /// <value>A <see cref="PlayerTrackInfo"/> for subtitle.</value>
- public PlayerTrackInfo SubtitleTrackInfo
- {
- get
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- if (_subtitleTrackInfo == null)
- {
- _subtitleTrackInfo = new PlayerTrackInfo(this, StreamType.Text);
- }
- return _subtitleTrackInfo;
- }
- }
-
- private StreamInfo _streamInfo;
-
- /// <summary>
- /// Gets the stream information.
- /// </summary>
- /// <value>A <see cref="StreamInfo"/> for this player.</value>
- public StreamInfo StreamInfo
- {
- get
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- if (_streamInfo == null)
- {
- _streamInfo = new StreamInfo(this);
- }
- return _streamInfo;
- }
- }
-
- private readonly AudioEffect _audioEffect;
-
- /// <summary>
- /// Gets the audio effect.
- /// </summary>
- /// <feature>http://tizen.org/feature/multimedia.custom_audio_effect</feature>
- /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
- public AudioEffect AudioEffect
- {
- get
- {
- if (_audioEffect == null)
- {
- throw new NotSupportedException($"The feature({Features.AudioEffect}) is not supported.");
- }
-
- return _audioEffect;
- }
- }
-
- #endregion
-
#region Dispose support
private bool _disposed;
/// </summary>
public void Dispose()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
Dispose(true);
}
#region Methods
/// <summary>
- /// Gets or sets the mute state.
- /// </summary>
- /// <value>true if the player is muted; otherwise, false.</value>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public bool Muted
- {
- get
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
-
- bool value = false;
- NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player");
-
- Log.Info(PlayerLog.Tag, "get mute : " + value);
-
- return value;
- }
- set
- {
- NativePlayer.SetMute(Handle, value).ThrowIfFailed("Failed to set the mute state of the player");
- }
- }
-
- /// <summary>
/// Gets the streaming download Progress.
/// </summary>
/// <returns>The <see cref="DownloadProgress"/> containing current download progress.</returns>
return new DownloadProgress(start, current);
}
- #region Volume
- /// <summary>
- /// Gets or sets the current volume.
- /// </summary>
- /// <remarks>Valid volume range is from 0 to 1.0, inclusive.</remarks>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="value"/> is less than zero.\n
- /// -or-\n
- /// <paramref name="value"/> is greater than 1.0.
- /// </exception>
- public float Volume
- {
- get
- {
- float value = 0.0F;
- NativePlayer.GetVolume(Handle, out value, out value).
- ThrowIfFailed("Failed to get the volume of the player");
- return value;
- }
- set
- {
- if (value < 0F || 1.0F < value)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- $"Valid volume range is 0 <= value <= 1.0, but got { value }.");
- }
-
- NativePlayer.SetVolume(Handle, value, value).
- ThrowIfFailed("Failed to set the volume of the player");
- }
- }
-
- #endregion
-
/// <summary>
/// Sets the subtitle path for playback.
/// </summary>
/// <seealso cref="SetSubtitle(string)"/>
public void SetSubtitleOffset(int offset)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
var err = NativePlayer.SetSubtitlePositionOffset(Handle, offset);
private void Prepare()
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
NativePlayer.Prepare(Handle).ThrowIfFailed("Failed to prepare the player");
}
+ /// <summary>
+ /// Called when the <see cref="Prepare"/> is invoked.
+ /// </summary>
protected virtual void OnPreparing()
{
- RegisterCallbacks();
+ RegisterEvents();
}
/// <summary>
OnUnprepared();
}
+ /// <summary>
+ /// Called after the <see cref="Player"/> is unprepared.
+ /// </summary>
+ /// <seealso cref="Unprepare"/>
protected virtual void OnUnprepared()
{
_source?.DetachFrom(this);
/// Applies the audio stream policy.
/// </summary>
/// <param name="policy">The <see cref="AudioStreamPolicy"/> to apply.</param>
- /// <remarks>The player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
+ /// <remarks>
+ /// The player must be in the <see cref="PlayerState.Idle"/> state.\n
+ /// \n
+ /// <see cref="Player"/> does not support all <see cref="AudioStreamType"/>.\n
+ /// Supported types are <see cref="AudioStreamType.Media"/>, <see cref="AudioStreamType.System"/>,
+ /// <see cref="AudioStreamType.Alarm"/>, <see cref="AudioStreamType.Notification"/>,
+ /// <see cref="AudioStreamType.Emergency"/>, <see cref="AudioStreamType.VoiceInformation"/>,
+ /// <see cref="AudioStreamType.RingtoneVoip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
+ /// </remarks>
/// <exception cref="ObjectDisposedException">
/// The player has already been disposed of.\n
/// -or-\n
/// </exception>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ArgumentNullException"><paramref name="policy"/> is null.</exception>
+ /// <exception cref="NotSupportedException">
+ /// <see cref="AudioStreamType"/> of <paramref name="policy"/> is not supported by <see cref="Player"/>.
+ /// </exception>
+ /// <seealso cref="AudioStreamPolicy"/>
public void ApplyAudioStreamPolicy(AudioStreamPolicy policy)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (policy == null)
{
throw new ArgumentNullException(nameof(policy));
}
- if (policy.Handle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(policy));
- }
-
ValidatePlayerState(PlayerState.Idle);
NativePlayer.SetAudioPolicyInfo(Handle, policy.Handle).
}
#endregion
- #region Callback registrations
- private void RegisterSubtitleUpdatedCallback()
- {
- _subtitleUpdatedCallback = (duration, text, _) =>
- {
- Log.Debug(PlayerLog.Tag, "duration : " + duration + ", text : " + text);
- SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text));
- };
-
- NativePlayer.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback).
- ThrowIfFailed("Failed to initialize the player");
- }
-
- private void RegisterPlaybackCompletedCallback()
- {
- _playbackCompletedCallback = _ =>
- {
- Log.Debug(PlayerLog.Tag, "completed callback");
- PlaybackCompleted?.Invoke(this, EventArgs.Empty);
- };
- NativePlayer.SetCompletedCb(Handle, _playbackCompletedCallback).
- ThrowIfFailed("Failed to set PlaybackCompleted");
- }
-
- private void RegisterPlaybackInterruptedCallback()
- {
- _playbackInterruptedCallback = (code, _) =>
- {
- if (!Enum.IsDefined(typeof(PlaybackInterruptionReason), code))
- {
- return;
- }
-
- if (code == PlaybackInterruptionReason.ResourceConflict)
- {
- OnUnprepared();
- }
-
- Log.Warn(PlayerLog.Tag, "interrupted reason : " + code);
- PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code));
- };
-
- NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback).
- ThrowIfFailed("Failed to set PlaybackInterrupted");
- }
-
- private void RegisterErrorOccurredCallback()
- {
- _playbackErrorCallback = (code, _) =>
- {
- //TODO handle service disconnected error.
- Log.Warn(PlayerLog.Tag, "error code : " + code);
- ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code));
- };
-
- NativePlayer.SetErrorCb(Handle, _playbackErrorCallback).
- ThrowIfFailed("Failed to set PlaybackError");
- }
-
- #region VideoFrameDecoded event
-
- private EventHandler<VideoFrameDecodedEventArgs> _videoFrameDecoded;
-
- private NativePlayer.VideoFrameDecodedCallback _videoFrameDecodedCallback;
-
- /// <summary>
- /// Occurs when a video frame is decoded.
- /// </summary>
- /// <remarks>
- /// <para>The event handler will be executed on an internal thread.</para>
- /// <para>The <see cref="VideoFrameDecodedEventArgs.Packet"/> in event args should be disposed after use.</para>
- /// </remarks>
- /// <feature>http://tizen.org/feature/multimedia.raw_video</feature>
- /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
- /// <seealso cref="VideoFrameDecodedEventArgs.Packet"/>
- public event EventHandler<VideoFrameDecodedEventArgs> VideoFrameDecoded
- {
- add
- {
- ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
-
- _videoFrameDecoded += value;
- }
- remove
- {
- ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
-
- _videoFrameDecoded -= value;
- }
- }
-
- private void RegisterVideoFrameDecodedCallback()
- {
- _videoFrameDecodedCallback = (packetHandle, _) =>
- {
- var handler = _videoFrameDecoded;
- if (handler != null)
- {
- Log.Debug(PlayerLog.Tag, "packet : " + packetHandle);
- handler.Invoke(this,
- new VideoFrameDecodedEventArgs(MediaPacket.From(packetHandle)));
- }
- else
- {
- MediaPacket.From(packetHandle).Dispose();
- }
- };
-
- NativePlayer.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback).
- ThrowIfFailed("Failed to register the VideoFrameDecoded");
- }
- #endregion
-
- private void RegisterVideoStreamChangedCallback()
- {
- ValidatePlayerState(PlayerState.Idle);
-
- _videoStreamChangedCallback = (width, height, fps, bitrate, _) =>
- {
- Log.Debug(PlayerLog.Tag, "height : " + height + ", width : " + width
- + ", fps : " + fps + ", bitrate : " + bitrate);
-
- VideoStreamChanged?.Invoke(this, new VideoStreamChangedEventArgs(height, width, fps, bitrate));
- };
-
- NativePlayer.SetVideoStreamChangedCb(Handle, _videoStreamChangedCallback).
- ThrowIfFailed("Failed to set the video stream changed callback");
- }
-
- private void RegisterBufferingCallback()
- {
- _bufferingProgressCallback = (percent, _) =>
- {
- Log.Debug(PlayerLog.Tag, $"Buffering callback with percent { percent }");
- BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent));
- };
-
- NativePlayer.SetBufferingCb(Handle, _bufferingProgressCallback).
- ThrowIfFailed("Failed to set BufferingProgress");
- }
-
- private void RegisterMediaStreamBufferStatusCallback()
- {
- _mediaStreamAudioBufferStatusChangedCallback = (status, _) =>
- {
- Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
- Log.Debug(PlayerLog.Tag, "audio buffer status : " + status);
- MediaStreamAudioBufferStatusChanged?.Invoke(this,
- new MediaStreamBufferStatusChangedEventArgs(status));
- };
- _mediaStreamVideoBufferStatusChangedCallback = (status, _) =>
- {
- Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
- Log.Debug(PlayerLog.Tag, "video buffer status : " + status);
- MediaStreamVideoBufferStatusChanged?.Invoke(this,
- new MediaStreamBufferStatusChangedEventArgs(status));
- };
-
- RegisterMediaStreamBufferStatusCallback(StreamType.Audio, _mediaStreamAudioBufferStatusChangedCallback);
- RegisterMediaStreamBufferStatusCallback(StreamType.Video, _mediaStreamVideoBufferStatusChangedCallback);
- }
-
- private void RegisterMediaStreamBufferStatusCallback(StreamType streamType,
- NativePlayer.MediaStreamBufferStatusCallback cb)
- {
- NativePlayer.SetMediaStreamBufferStatusCb(Handle, streamType, cb).
- ThrowIfFailed("Failed to SetMediaStreamBufferStatus");
- }
-
- private void RegisterMediaStreamSeekCallback()
- {
- _mediaStreamAudioSeekCallback = (offset, _) =>
- {
- Log.Debug(PlayerLog.Tag, "audio seeking offset : " + offset);
- MediaStreamAudioSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
- };
- _mediaStreamVideoSeekCallback = (offset, _) =>
- {
- Log.Debug(PlayerLog.Tag, "video seeking offset : " + offset);
- MediaStreamVideoSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
- };
-
- RegisterMediaStreamSeekCallback(StreamType.Audio, _mediaStreamAudioSeekCallback);
- RegisterMediaStreamSeekCallback(StreamType.Video, _mediaStreamVideoSeekCallback);
- }
-
- private void RegisterMediaStreamSeekCallback(StreamType streamType, NativePlayer.MediaStreamSeekCallback cb)
- {
- NativePlayer.SetMediaStreamSeekCb(Handle, streamType, cb).
- ThrowIfFailed("Failed to SetMediaStreamSeek");
- }
- #endregion
-
#region Preparing state
private int _isPreparing;
/// This method supports the product infrastructure and is not intended to be used directly from application code.
/// </summary>
protected static Exception GetException(int errorCode, string message) =>
- ((PlayerErrorCode) errorCode).GetException(message);
+ ((PlayerErrorCode)errorCode).GetException(message);
}
}
/// </summary>
public class PlayerDisplaySettings
{
+ /// <summary>
+ /// This constructor supports the product infrastructure and is not intended to be used directly from application code.
+ /// </summary>
protected PlayerDisplaySettings(Player player)
{
if (player == null)
internal static PlayerDisplaySettings Create(Player player) => new PlayerDisplaySettings(player);
+ /// <summary>
+ /// Gets the player of this instance.
+ /// </summary>
+ /// <value>The <see cref="Player"/> of this <see cref="PlayerDisplaySettings"/> instance.</value>
protected Player Player { get; }
/// <summary>
/// <summary>
/// Specifies display modes for <see cref="Player"/>
/// </summary>
- /// <seealso cref="Display.Mode"/>
+ /// <seealso cref="PlayerDisplaySettings.Mode"/>
public enum PlayerDisplayMode
{
/// <summary>
OriginalOrFull,
/// <summary>
- /// Region of interest, See <see cref="Display.SetRoi(Rectangle)"/>.
+ /// Region of interest, See <see cref="PlayerDisplaySettings.SetRoi(Rectangle)"/>.
/// </summary>
Roi
}
/// </summary>
public PlayerError Error { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Error={ Error.ToString() }";
set;
}
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString() =>
$"SampleRate={ SampleRate.ToString() }, Channels={ Channels.ToString() }, BitRate={ BitRate.ToString() }";
}
set;
}
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Fps={ Fps.ToString() }, BitRate={ BitRate.ToString() }, Size=[{ Size.ToString() }]";
/// </summary>
public string Text { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Duration={ Duration.ToString() }, Text={ Text }";
-/// This File contains VideoStreamEventArgs class
-///
-/// Copyright 2016 by Samsung Electronics, Inc.,
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
/// </summary>
public class VideoStreamChangedEventArgs : EventArgs
{
-
/// <summary>
/// Initializes a new instance of the VideoStreamChangedEventArgs class.
/// </summary>
/// </summary>
public int BitRate { get; }
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return $"Size=({ Size.ToString() }), Fps={ Fps.ToString() }, BitRate={ BitRate.ToString() }";
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
internal static partial class Interop
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
using Tizen.Multimedia;
+/*
+ * 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;
using Tizen.Multimedia;
internal static extern RecorderError GetState(IntPtr handle, out RecorderState state);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")]
- internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
+ internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")]
internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Remoting;
internal static partial class Interop
{
--- /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.
+ */
+
+/// <summary>
+/// The System.Runtime.Remoting namespace provides classes and interfaces that work with remote process or device.
+/// </summary>
+namespace Tizen.Multimedia.Remoting
+{
+}
\ No newline at end of file
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
/// <summary>
/// Provides data for the <see cref="ScreenMirroring.StateChanged"/> event.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
internal static class InteropHelper
{
using System.Threading.Tasks;
using Native = Interop.ScreenMirroring;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
/// <summary>
/// Provides the ability to connect to and disconnect from a screen mirroring source,
/// </summary>
public class ScreenMirroring : IDisposable, IDisplayable<ScreenMirroringErrorCode>
{
- private const string LogTag = "Tizen.Multimedia.ScreenMirroring";
-
private const int Port = 2022;
- private ScreenMirroringVideoInfo _videoInfo;
- private ScreenMirroringAudioInfo _audioInfo;
private IntPtr _handle;
private AtomicState _state;
_state = new AtomicState();
- _audioInfo = new ScreenMirroringAudioInfo(this);
- _videoInfo = new ScreenMirroringVideoInfo(this);
+ AudioInfo = new ScreenMirroringAudioInfo(this);
+ VideoInfo = new ScreenMirroringVideoInfo(this);
RegisterStateChangedEvent();
-
- Log.Debug(LogTag, "screen mirroring sink created : " + _handle);
}
~ScreenMirroring()
/// <summary>
/// Gets the negotiated audio info.
/// </summary>
- /// <value>The <see cref="ScreenMirroringAudioInfo"/> if it has been connected, otherwise null.</value>
- public ScreenMirroringAudioInfo AudioInfo
- {
- get
- {
- if (IsConnected == false)
- {
- return null;
- }
-
- return _audioInfo;
- }
- }
+ public ScreenMirroringAudioInfo AudioInfo { get; }
/// <summary>
/// Gets the negotiated video info.
/// </summary>
- /// <value>The <see cref="ScreenMirroringVideoInfo"/> if it has been connected, otherwise null.</value>
- public ScreenMirroringVideoInfo VideoInfo
+ public ScreenMirroringVideoInfo VideoInfo { get; }
+
+ private bool IsConnected
{
get
{
- if (IsConnected == false)
- {
- return null;
- }
-
- return _videoInfo;
+ return _state.IsOneOf(ScreenMirroringState.Connected, ScreenMirroringState.Playing,
+ ScreenMirroringState.Paused);
}
}
- private bool IsConnected
+ internal void ThrowIfNotConnected()
{
- get
+ if (IsConnected == false)
{
- return _state.IsOneOf(ScreenMirroringState.Connected, ScreenMirroringState.Playing,
- ScreenMirroringState.Paused);
+ throw new InvalidOperationException("ScreenMirroring is not connected.");
}
}
*/
using System;
-using static Tizen.Multimedia.InteropHelper;
+using static Tizen.Multimedia.Remoting.InteropHelper;
using Native = Interop.ScreenMirroring;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
/// <summary>
/// Provides a means to retrieve the audio information which is negotiated with the source device.
/// <summary>
/// Gets the negotiated audio codec.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public ScreenMirroringAudioCodec Codec
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedAudioCodec, _owner.Handle, out ScreenMirroringAudioCodec value).
ThrowIfError("Failed to get audio codec.");
/// <summary>
/// Gets the negotiated audio channels.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public int Channels
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedAudioChannel, _owner.Handle, out int value).
ThrowIfError("Failed to get audio channels.");
/// <summary>
/// Gets the negotiated audio sample rate.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public int SampleRate
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedAudioSampleRate, _owner.Handle, out int value).
ThrowIfError("Failed to get audio sample rate.");
/// <summary>
/// Gets the negotiated audio bit width.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public int BitWidth
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedAudioBitwidth, _owner.Handle, out int value).
ThrowIfError("Failed to get audio bit width.");
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
/// <summary>
/// Specifies audio codecs for <see cref="ScreenMirroring"/>.
using System;
using Tizen.Internals.Errors;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
internal enum ScreenMirroringErrorCode
{
*/
using System;
-using static Tizen.Multimedia.InteropHelper;
+using static Tizen.Multimedia.Remoting.InteropHelper;
using Native = Interop.ScreenMirroring;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Remoting
{
/// <summary>
/// Provides a means to retrieve the video information which is negotiated with the source device.
/// <summary>
/// Gets the negotiated video codec.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public ScreenMirroringVideoCodec Codec
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedVideoCodec, _owner.Handle, out ScreenMirroringVideoCodec value).
ThrowIfError("Failed to get video codec.");
/// <summary>
/// Gets the negotiated video resolution.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public Size Resolution
{
get
{
+ _owner.ThrowIfNotConnected();
+
var handle = _owner.Handle;
Native.GetNegotiatedVideoResolution(ref handle, out var width, out var height).
ThrowIfError("Failed to get resolution.");
/// <summary>
/// Gets the negotiated video frame rate.
/// </summary>
- /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Not connected to a source.\n
+ /// \n
+ /// An internal error occurs.
+ /// </exception>
/// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
public int FrameRate
{
get
{
+ _owner.ThrowIfNotConnected();
+
GetValue(Native.GetNegotiatedVideoFrameRate, _owner.Handle, out int value).
ThrowIfError("Failed to get video frame rate.");
internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null)
{
StreamRecorderError err = (StreamRecorderError)errorCode;
- if(string.IsNullOrEmpty(errorMessage)) {
+ if (string.IsNullOrEmpty(errorMessage))
+ {
errorMessage = err.ToString();
}
- switch((StreamRecorderError)errorCode) {
- case StreamRecorderError.InvalidParameter:
- throw new ArgumentException(errorMessage, paramName);
- case StreamRecorderError.OutOfMemory:
- throw new OutOfMemoryException(errorMessage);
- case StreamRecorderError.PermissionDenied:
- throw new UnauthorizedAccessException(errorMessage);
- case StreamRecorderError.NotSupported:
- throw new NotSupportedException(errorMessage);
- case StreamRecorderError.InvalidState:
- case StreamRecorderError.InvalidOperation:
- case StreamRecorderError.OutOfStorage:
- throw new InvalidOperationException(errorMessage);
+ switch ((StreamRecorderError)errorCode)
+ {
+ case StreamRecorderError.InvalidParameter:
+ throw new ArgumentException(errorMessage, paramName);
+ case StreamRecorderError.OutOfMemory:
+ throw new OutOfMemoryException(errorMessage);
+ case StreamRecorderError.PermissionDenied:
+ throw new UnauthorizedAccessException(errorMessage);
+ case StreamRecorderError.NotSupported:
+ throw new NotSupportedException(errorMessage);
+ case StreamRecorderError.InvalidState:
+ case StreamRecorderError.InvalidOperation:
+ case StreamRecorderError.OutOfStorage:
+ throw new InvalidOperationException(errorMessage);
}
}
}
+/*
+ * 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;
using Tizen;
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Vision;
/// <summary>
/// Interop APIs
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Vision;
/// <summary>
/// Interop APIs
}
- internal static Tizen.Multimedia.Quadrangle ToApiStruct(this MediaVision.Quadrangle quadrangle)
+ internal static Quadrangle ToApiStruct(this MediaVision.Quadrangle quadrangle)
{
Tizen.Multimedia.Point[] points = new Tizen.Multimedia.Point[4];
for (int i = 0; i < 4; ++i)
{
points[i] = quadrangle.points[i].ToApiStruct();
}
- return new Tizen.Multimedia.Quadrangle(points);
+ return new Quadrangle(points);
}
- internal static MediaVision.Quadrangle ToMarshalable(this Tizen.Multimedia.Quadrangle quadrangle)
+ internal static MediaVision.Quadrangle ToMarshalable(this Quadrangle quadrangle)
{
MediaVision.Point[] points = new MediaVision.Point[4];
for (int i = 0; i < 4; ++i)
internal static extern int GetWidth(IntPtr source, out uint imageWidth);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_colorspace")]
- internal static extern int GetColorspace(IntPtr /* mv_source_h */ source, out Tizen.Multimedia.Colorspace colorspace);
+ internal static extern int GetColorspace(IntPtr /* mv_source_h */ source, out Colorspace colorspace);
}
/// <summary>
internal static extern int Destroy(IntPtr handle);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_double_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError SetDouble(IntPtr handle, string name, double value);
+ internal static extern MediaVisionError SetDouble(IntPtr handle, string name, double value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_int_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError SetInt(IntPtr handle, string name, int value);
+ internal static extern MediaVisionError SetInt(IntPtr handle, string name, int value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_bool_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError SetBool(IntPtr handle, string name, bool value);
+ internal static extern MediaVisionError SetBool(IntPtr handle, string name, bool value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_string_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError SetString(IntPtr handle, string name, string value);
+ internal static extern MediaVisionError SetString(IntPtr handle, string name, string value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_double_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError GetDouble(IntPtr handle, string name, out double value);
+ internal static extern MediaVisionError GetDouble(IntPtr handle, string name, out double value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_int_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError GetInt(IntPtr handle, string name, out int value);
+ internal static extern MediaVisionError GetInt(IntPtr handle, string name, out int value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_bool_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError GetBool(IntPtr handle, string name, out bool value);
+ internal static extern MediaVisionError GetBool(IntPtr handle, string name, out bool value);
[DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_string_attribute")]
- internal static extern Tizen.Multimedia.MediaVisionError GetString(IntPtr handle, string name, out IntPtr value);
+ internal static extern MediaVisionError GetString(IntPtr handle, string name, out IntPtr value);
}
}
}
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Vision;
/// <summary>
/// Interop APIs
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Vision;
/// <summary>
/// Interop APIs
using System;
using System.Runtime.InteropServices;
-using Tizen.Multimedia;
+using Tizen.Multimedia.Vision;
/// <summary>
/// Interop APIs
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a detected barcode.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="BarcodeDetector"/>.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the target of <see cref="BarcodeDetector"/>.
using InteropBarcode = Interop.MediaVision.BarcodeDetector;
using Unmanaged = Interop.MediaVision;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to detect barcodes on image sources.
using Tizen.Common;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="BarcodeGenerator"/> instances.
using System;
using InteropBarcode = Interop.MediaVision.BarcodeGenerator;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to generate barcodes and QR codes.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration for the image to be generated by <see cref="BarcodeGenerator"/>.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies supported image formats for <see cref="BarcodeGenerator"/>
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the supported barcode types.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies colorspaces for MediaVision.
using System.Runtime.InteropServices;
using static Interop.MediaVision;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// A base class for configuration classes.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the supported QR code error correction level.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the eyes state types.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="FaceDetector"/> instances.
using System.Threading.Tasks;
using InteropFace = Interop.MediaVision.Face;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to detect faces on image sources.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="FaceRecognizer"/> instances.
using System.Runtime.InteropServices;
using InteropModel = Interop.MediaVision.FaceRecognitionModel;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents the face recognition model interface.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the face recognition model learning algorithms.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents result of <see cref="FaceRecognizer"/> operations.
using System.Threading.Tasks;
using InteropFace = Interop.MediaVision.Face;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to recognize faces, face expressions and eye condition on image sources.
TaskCompletionSource<FacialExpression> tcsResult = new TaskCompletionSource<FacialExpression>();
- InteropFace.MvFaceFacialExpressionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle,
- global::Interop.MediaVision.Rectangle faceLocation, FacialExpression facialExpression, IntPtr _) =>
- {
- Log.Info(MediaVisionLog.Tag, $"Facial expression recognized, expression : {facialExpression}");
- if (!tcsResult.TrySetResult(facialExpression))
- {
- Log.Error(MediaVisionLog.Tag, "Failed to set facial result");
- }
- };
+ InteropFace.MvFaceFacialExpressionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle,
+ global::Interop.MediaVision.Rectangle faceLocation, FacialExpression facialExpression, IntPtr _) =>
+ {
+ Log.Info(MediaVisionLog.Tag, $"Facial expression recognized, expression : {facialExpression}");
+ if (!tcsResult.TrySetResult(facialExpression))
+ {
+ Log.Error(MediaVisionLog.Tag, "Failed to set facial result");
+ }
+ };
using (var cbKeeper = ObjectKeeper.Get(cb))
{
using System.Threading.Tasks;
using InteropFace = Interop.MediaVision.Face;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to track faces on image sources.
using System.IO;
using InteropModel = Interop.MediaVision.FaceTrackingModel;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents face tracking model.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents result of face tracking operation.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the expression types for faces.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of fill operations of <see cref="ImageObject"/> instances.
using System.IO;
using InteropImage = Interop.MediaVision.Image;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents an image object.
/// 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>
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="ImageRecognizer"/>.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a result of RecognizeAsync operations of <see cref="ImageRecognizer"/>.
using System.Threading.Tasks;
using InteropImage = Interop.MediaVision.Image;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to recognize images on image sources.
using System.Threading.Tasks;
using InteropImage = Interop.MediaVision.Image;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to track images on image sources.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="ImageTracker"/>.
using System.IO;
using InteropModel = Interop.MediaVision.ImageTrackingModel;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents the image tracking model interface.
using System.IO;
using Tizen.Internals.Errors;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
internal static class MediaVisionLog
{
using System.Diagnostics;
using InteropSource = Interop.MediaVision.MediaSource;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents the media vision source to keep information on image or video frame data as raw buffer.
{
fillAction(_handle);
}
- catch(Exception)
+ catch (Exception)
{
InteropSource.Destroy(_handle);
_disposed = true;
using System;
using System.Collections.Generic;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides data for the <see cref="MovementDetector.Detected"/> event.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="MovementDetector"/>.
using System;
using static Interop.MediaVision.Surveillance;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to detect movement on image sources.
using System;
using System.Collections.Generic;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides data for the <see cref="PersonAppearanceDetector.Detected"/> event.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="PersonAppearanceDetector"/> instances.
using System;
using static Interop.MediaVision.Surveillance;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to detect person appearance changes on image sources.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="PersonRecognizer"/> instances.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a result of <see cref="PersonRecognizer"/> instances.
using System;
using System.Collections.Generic;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides data for the <see cref="PersonRecognizer.Recognized"/> event.
using System;
using static Interop.MediaVision.Surveillance;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to recognize person on image sources.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a QR configuration of <see cref="BarcodeGenerator"/>.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Specifies the supported QR code encoding mode.
using System;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a region with 4 <see cref="Point"/>s.
* limitations under the License.
*/
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// SurveillanceEngineConfiguration is a base class for surveillance configurations.
using System.Runtime.InteropServices;
using static Interop.MediaVision.Surveillance;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// SurveillanceEngine is a base class for surveillance event triggers.
using System;
using static Interop.MediaVision.Surveillance;
-namespace Tizen.Multimedia
+namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Provides the ability to push source to surveillance engines.
--- /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.
+ */
+
+/// <summary>
+/// The Tizen.Multimedia.Vision namespace contains classes and interfaces that support vision processing including
+/// face detection, face recognition, face tracking, barcode detection, barcode generation, flat image detection,
+/// flat image recognition, flat image tracking, flat image features extraction, movement detection,
+/// person appearance/disappearance detection and person recognition.
+/// </summary>
+namespace Tizen.Multimedia.Vision
+{
+}
* limitations under the License.
*/
- // This file specifies any assembly atrributes.
- // Note that InternalsVisibleToAttribute can be removed or added and needs to be only Multimedia packages only.
+// This file specifies any assembly attributes.
+// Note that InternalsVisibleToAttribute can be removed or added and needs to be Multimedia packages only.
using System.Runtime.CompilerServices;
+[assembly: InternalsVisibleTo("Tizen.Multimedia.AudioIO, " +
+ "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" +
+ "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" +
+ "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" +
+ "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")]
+
[assembly: InternalsVisibleTo("Tizen.Multimedia.Camera, " +
"PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" +
"6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" +
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
- internal static class AudioDeviceLog
- {
- internal const string Tag = "Tizen.Multimedia.AudioDevice";
- }
-
/// <summary>
/// The Device API provides functions to query the information of sound devices.
/// </summary>
public class AudioDevice
{
private readonly int _id;
- private readonly string _name;
private readonly AudioDeviceType _type;
private readonly AudioDeviceIoDirection _ioDirection;
- private readonly AudioDeviceState _state;
- private readonly IntPtr _handle;
internal AudioDevice(IntPtr deviceHandle)
{
- _handle = deviceHandle;
- int ret;
-
- ret = Interop.AudioDevice.GetDeviceId(_handle, out _id);
- if (ret != 0)
- {
- Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device Id: " + (AudioManagerError)ret);
- }
- AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device Id");
-
- IntPtr name;
- ret = Interop.AudioDevice.GetDeviceName(_handle, out name);
- if (ret != 0)
- {
- Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device name" + (AudioManagerError)ret);
- }
- AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device name");
+ int ret = Interop.AudioDevice.GetDeviceId(deviceHandle, out _id);
+ MultimediaDebug.AssertNoError(ret);
- _name = Marshal.PtrToStringAnsi(name);
+ ret = Interop.AudioDevice.GetDeviceName(deviceHandle, out var name);
+ MultimediaDebug.AssertNoError(ret);
- ret = Interop.AudioDevice.GetDeviceType(_handle, out _type);
- if (ret != 0)
- {
- Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device type" + (AudioManagerError)ret);
- }
- AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device type");
+ Name = Marshal.PtrToStringAnsi(name);
- ret = Interop.AudioDevice.GetDeviceIoDirection(_handle, out _ioDirection);
- if (ret != 0)
- {
- Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device IoDirection" + (AudioManagerError)ret);
- }
- AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device IO Direction");
+ ret = Interop.AudioDevice.GetDeviceType(deviceHandle, out _type);
+ MultimediaDebug.AssertNoError(ret);
- ret = Interop.AudioDevice.GetDeviceState(_handle, out _state);
- if (ret != 0)
- {
- Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device state" + (AudioManagerError)ret);
- }
- AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device state");
+ ret = (int)Interop.AudioDevice.GetDeviceIoDirection(deviceHandle, out _ioDirection);
+ MultimediaDebug.AssertNoError(ret);
}
/// <summary>
- /// The id of the device.
+ /// Gets the id of the device.
/// </summary>
+ /// <value>The id of the device.</value>
public int Id => _id;
/// <summary>
- /// The name of the device.
+ /// Gets the name of the device.
/// </summary>
- public string Name => _name;
+ /// <value>The name of the device.</value>
+ public string Name { get; }
/// <summary>
- /// The type of the device.
+ /// Gets the type of the device.
/// </summary>
+ /// <value>The <see cref="AudioDeviceType"/> of the device.</value>
public AudioDeviceType Type => _type;
/// <summary>
- /// The io direction of the device.
+ /// Gets the IO direction of the device.
/// </summary>
+ /// <value>The IO direction of the device.</value>
public AudioDeviceIoDirection IoDirection => _ioDirection;
/// <summary>
- /// The state of the device.
+ /// Gets the state of the device.
+ /// </summary>
+ /// <value>The <see cref="AudioDeviceState"/> of the device.</value>
+ public AudioDeviceState State
+ {
+ get
+ {
+ Interop.AudioDevice.GetDeviceState(Id, out var state).
+ Validate("Failed to get the state of the device");
+
+ return state;
+ }
+ }
+
+ /// <summary>
+ /// Returns a string that represents the current object.
/// </summary>
- public AudioDeviceState State => _state;
+ /// <returns>A string that represents the current object.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Name={Name}, Type={Type}, IoDirection={IoDirection}, State={State}";
+
+ /// <summary>
+ /// Compares an object to an instance of <see cref="AudioDevice"/> for equality.
+ /// </summary>
+ /// <param name="obj">A <see cref="Object"/> to compare.</param>
+ /// <returns>true if the two devices are equal; otherwise, false.</returns>
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as AudioDevice;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ return Id == rhs.Id;
+ }
+
- internal IntPtr Handle => _handle;
+ /// <summary>
+ /// Gets the hash code for this instance of <see cref="AudioDevice"/>.
+ /// </summary>
+ /// <returns>The hash code for this instance of <see cref="AudioDevice"/>.</returns>
+ public override int GetHashCode()
+ {
+ return Id.GetHashCode();
+ }
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
/// <summary>
- /// Class extending EventArgs which contains parameters to be passed to event handler of DeviceConnected event
+ /// Provides data for the <see cref="AudioManager.DeviceConnectionChanged"/> event.
/// </summary>
public class AudioDeviceConnectionChangedEventArgs : EventArgs
{
}
/// <summary>
- /// The object of sound device
+ /// Gets the device.
/// </summary>
+ /// <value>The <see cref="AudioDevice"/>.</value>
public AudioDevice Device { get; }
/// <summary>
- /// The state of device connection: (true = connected, false = disconnected)
+ /// Gets the connection state of the device.
/// </summary>
+ /// <value>true if the device is connected; otherwise, false.</value>
public bool IsConnected { get; }
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
/// <summary>
- /// Class extending EventArgs which contains parameters to be passed to event handler of DeviceInformationChanged event
+ /// Provides data for the <see cref="AudioManager.DeviceStateChanged"/> event.
/// </summary>
public class AudioDeviceStateChangedEventArgs : EventArgs
{
internal AudioDeviceStateChangedEventArgs(AudioDevice device, AudioDeviceState changedState)
{
Device = device;
- ChangedState = changedState;
+ State = changedState;
}
/// <summary>
- /// The object of sound device
+ /// Gets the device.
/// </summary>
+ /// <value>The <see cref="AudioDevice"/>.</value>
public AudioDevice Device { get; }
/// <summary>
- /// The entry of sound device state
+ /// Gets the state of the device.
/// </summary>
- public AudioDeviceState ChangedState { get; }
+ /// <value>The <see cref="AudioDeviceState"/> of the device.</value>
+ public AudioDeviceState State { get; }
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
- internal static class AudioManagerLog
- {
- internal const string Tag = "Tizen.Multimedia.AudioManager";
- }
-
/// <summary>
- /// The Audio Manager class provides functions to get and set sound parameters like volume and devices.
+ /// Provides the ability to control volume levels and monitor audio devices.
/// </summary>
public static class AudioManager
{
- private static int _deviceConnectionChangedCallbackId = -1;
- private static int _deviceStateChangedCallbackId = -1;
-
- private static Interop.SoundDeviceConnectionChangedCallback _audioDeviceConnectionChangedCallback;
- private static Interop.SoundDeviceStateChangedCallback _audioDeviceStateChangedCallback;
-
- private static EventHandler<AudioDeviceConnectionChangedEventArgs> _audioDeviceConnectionChanged;
- private static EventHandler<AudioDeviceStateChangedEventArgs> _audioDeviceStateChanged;
-
- /// <summary>
- /// Constructor for AudioManager. Initializes the VolumeController property etc.
- /// </summary>
static AudioManager()
{
VolumeController = new AudioVolume();
}
/// <summary>
- /// Registers/Unregisters a function to be invoked when the state of connection of an Audio device was changed.
+ /// Gets the volume controller.
/// </summary>
- public static event EventHandler<AudioDeviceConnectionChangedEventArgs> DeviceConnectionChanged
+ /// <value>The <see cref="AudioVolume"/>.</value>
+ public static AudioVolume VolumeController { get; }
+
+ /// <summary>
+ /// Gets the all devices currently connected.
+ /// </summary>
+ /// <param name="options">The audio device options.</param>
+ /// <returns>An IEnumerable<AudioDevice> that contains connected devices.</returns>
+ public static IEnumerable<AudioDevice> GetConnectedDevices()
{
- add
+ IntPtr deviceListHandle = IntPtr.Zero;
+
+ try
{
- if (_audioDeviceConnectionChanged == null)
+ var ret = Interop.AudioDevice.GetDeviceList(AudioDeviceOptions.All, out deviceListHandle);
+
+ List<AudioDevice> result = new List<AudioDevice>();
+
+ if (ret == AudioManagerError.NoData)
{
- RegisterAudioDeviceEvent();
- Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event registered");
+ return result;
}
- _audioDeviceConnectionChanged += value;
- Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event added");
- }
- remove
- {
- if (_audioDeviceConnectionChanged?.GetInvocationList()?.GetLength(0) == 1)
+
+ ret.Validate("Failed to get connected devices");
+
+ while (ret == AudioManagerError.None)
{
- UnregisterDeviceConnectionChangedEvent();
+ ret = Interop.AudioDevice.GetNextDevice(deviceListHandle, out var deviceHandle);
+
+ if (ret == AudioManagerError.NoData)
+ {
+ break;
+ }
+
+ ret.Validate("Failed to get connected devices");
+
+ result.Add(new AudioDevice(deviceHandle));
}
- _audioDeviceConnectionChanged -= value;
- Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event removed");
+ return result;
+ }
+ finally
+ {
+ Interop.AudioDevice.FreeDeviceList(deviceListHandle);
}
}
+ #region DeviceConnectionChanged event
+ private static int _deviceConnectionChangedCallbackId = -1;
+
+ private static Interop.AudioDevice.ConnectionChangedCallback _audioDeviceConnectionChangedCallback;
+ private static EventHandler<AudioDeviceConnectionChangedEventArgs> _audioDeviceConnectionChanged;
+ private static object _audioDeviceConnectionLock = new object();
+
/// <summary>
- /// Registers/Unregisters a callback function to be invoked when the state of an Audio sound device was changed.
+ /// Occurs when the state of connection of an audio device changes.
/// </summary>
- public static event EventHandler<AudioDeviceStateChangedEventArgs> DeviceStateChanged
+ public static event EventHandler<AudioDeviceConnectionChangedEventArgs> DeviceConnectionChanged
{
add
{
- if (_audioDeviceStateChanged == null)
+ lock (_audioDeviceConnectionLock)
{
- RegisterDeviceStateChangedEvent();
+ if (_audioDeviceConnectionChanged == null)
+ {
+ RegisterAudioDeviceEvent();
+ }
+ _audioDeviceConnectionChanged += value;
}
- _audioDeviceStateChanged += value;
- Tizen.Log.Info(AudioManagerLog.Tag, "DeviceStateChanged event added");
}
remove
{
- if (_audioDeviceStateChanged?.GetInvocationList()?.GetLength(0) == 1)
+ if (value == null)
{
- UnregisterDeviceStateChangedEvent();
+ return;
+ }
+
+ lock (_audioDeviceConnectionLock)
+ {
+ if (_audioDeviceConnectionChanged == value)
+ {
+ UnregisterDeviceConnectionChangedEvent();
+ }
+ _audioDeviceConnectionChanged -= value;
}
- _audioDeviceStateChanged -= value;
- Tizen.Log.Info(AudioManagerLog.Tag, "DeviceStateChanged event removed");
}
}
- /// <summary>
- /// The VolumeController object (singleton) is-a part of SoundManager and its properties and methods are used via AudioManager
- /// </summary>
- public static AudioVolume VolumeController { get; }
+ private static void RegisterAudioDeviceEvent()
+ {
+ _audioDeviceConnectionChangedCallback = (IntPtr device, bool isConnected, IntPtr userData) =>
+ {
+ _audioDeviceConnectionChanged?.Invoke(null,
+ new AudioDeviceConnectionChangedEventArgs(new AudioDevice(device), isConnected));
+ };
+
+ Interop.AudioDevice.AddDeviceConnectionChangedCallback(AudioDeviceOptions.All,
+ _audioDeviceConnectionChangedCallback, IntPtr.Zero, out _deviceConnectionChangedCallbackId).
+ Validate("Unable to add device connection changed callback");
+ }
+
+ private static void UnregisterDeviceConnectionChangedEvent()
+ {
+ Interop.AudioDevice.RemoveDeviceConnectionChangedCallback(_deviceConnectionChangedCallbackId).
+ Validate("Unable to remove device connection changed callback");
+ }
+ #endregion
+
+ #region DeviceStateChanged event
+ private static int _deviceStateChangedCallbackId = -1;
+
+ private static Interop.AudioDevice.StateChangedCallback _audioDeviceStateChangedCallback;
+ private static EventHandler<AudioDeviceStateChangedEventArgs> _audioDeviceStateChanged;
+ private static object _audioDeviceStateLock = new object();
/// <summary>
- /// Gets the list consisting of all devices currently connected.
+ /// Occurs when the state of an audio device changes.
/// </summary>
- /// <param name="options">The audio device options</param>
- /// <returns>The list of connected devices: IEnumerable of Device objects</returns>
- public static IEnumerable<AudioDevice> GetCurrentDevices(AudioDeviceOptions options)
+ public static event EventHandler<AudioDeviceStateChangedEventArgs> DeviceStateChanged
{
- List<AudioDevice> audioDeviceList = new List<AudioDevice>();
- IntPtr deviceListHandle;
- IntPtr handlePosition;
- AudioDeviceIoDirection ioDirection;
-
- int ret = Interop.AudioDevice.GetCurrentDeviceList(options, out deviceListHandle);
- if (ret != (int)AudioManagerError.NoData)
- {
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to get next device");
- }
- while (ret == (int)AudioManagerError.None)
+ add
{
- ret = Interop.AudioDevice.GetNextDevice(deviceListHandle, out handlePosition);
- if (ret == (int)AudioManagerError.NoData)
+ lock (_audioDeviceStateLock)
{
- break;
+ if (_audioDeviceStateChanged == null)
+ {
+ RegisterDeviceStateChangedEvent();
+ }
+ _audioDeviceStateChanged += value;
}
- else if (ret != (int)AudioManagerError.None)
+ }
+ remove
+ {
+ if (value == null)
{
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to get next device");
+ return;
}
- if (options == AudioDeviceOptions.Input || (options == AudioDeviceOptions.Output))
+ lock (_audioDeviceStateLock)
{
- ret = Interop.AudioDevice.GetDeviceIoDirection(handlePosition, out ioDirection);
- if (ret != 0)
+ if (_audioDeviceStateChanged == value)
{
- Tizen.Log.Error(AudioManagerLog.Tag, "Unable to get device IoDirection" + (AudioManagerError)ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, handlePosition, "Unable to get device IO Direction");
- }
- else if (ioDirection == AudioDeviceIoDirection.InputAndOutput)
- {
- continue;
+ UnregisterDeviceStateChangedEvent();
}
+ _audioDeviceStateChanged -= value;
}
- audioDeviceList.Add(new AudioDevice(handlePosition));
}
- return audioDeviceList;
- }
-
- private static void RegisterAudioDeviceEvent()
- {
- _audioDeviceConnectionChangedCallback = (IntPtr device, bool isConnected, IntPtr userData) =>
- {
- AudioDeviceConnectionChangedEventArgs eventArgs = new AudioDeviceConnectionChangedEventArgs(new AudioDevice(device), isConnected);
- _audioDeviceConnectionChanged?.Invoke(null, eventArgs);
- };
- int ret = Interop.AudioDevice.AddDeviceConnectionChangedCallback(AudioDeviceOptions.All, _audioDeviceConnectionChangedCallback, IntPtr.Zero, out _deviceConnectionChangedCallbackId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device connection changed callback");
- Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceConnectionChanged Event registered");
}
private static void RegisterDeviceStateChangedEvent()
{
_audioDeviceStateChangedCallback = (IntPtr device, AudioDeviceState changedState, IntPtr userData) =>
{
- AudioDeviceStateChangedEventArgs eventArgs = new AudioDeviceStateChangedEventArgs(new AudioDevice(device), changedState);
- _audioDeviceStateChanged?.Invoke(null, eventArgs);
+ _audioDeviceStateChanged?.Invoke(null,
+ new AudioDeviceStateChangedEventArgs(new AudioDevice(device), changedState));
};
- int ret = Interop.AudioDevice.AddDeviceStateChangedCallback(AudioDeviceOptions.All, _audioDeviceStateChangedCallback, IntPtr.Zero, out _deviceStateChangedCallbackId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device state changed callback");
- Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceStateChangedEvent callback registered");
- }
- private static void UnregisterDeviceConnectionChangedEvent()
- {
- if (_deviceConnectionChangedCallbackId > 0)
- {
- int ret = Interop.AudioDevice.RemoveDeviceConnectionChangedCallback(_deviceConnectionChangedCallbackId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device connection changed callback");
- Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceConnectionChangedEvent callback unregistered");
- _deviceConnectionChangedCallbackId = -1;
- }
+ Interop.AudioDevice.AddDeviceStateChangedCallback(AudioDeviceOptions.All,
+ _audioDeviceStateChangedCallback, IntPtr.Zero, out _deviceStateChangedCallbackId).
+ Validate("Failed to add device state changed event");
}
private static void UnregisterDeviceStateChangedEvent()
{
- if (_deviceStateChangedCallbackId > 0)
- {
- int ret = Interop.AudioDevice.RemoveDeviceStateChangedCallback(_deviceStateChangedCallbackId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device state changed callback");
- Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceStateChanged callback unregistered");
- _deviceStateChangedCallbackId = -1;
- }
+ Interop.AudioDevice.RemoveDeviceStateChangedCallback(_deviceStateChangedCallbackId).
+ Validate("Failed to remove device state changed event");
}
+ #endregion
}
}
--- /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;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Specifies the flag for audio device options.
+ /// <para>
+ /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
+ /// </para>
+ /// </summary>
+ [Flags]
+ internal enum AudioDeviceOptions
+ {
+ /// <summary>
+ /// Input devices.
+ /// </summary>
+ Input = 0x0001,
+ /// <summary>
+ /// Output devices.
+ /// </summary>
+ Output = 0x0002,
+ /// <summary>
+ /// Input and output devices (both directions are available).
+ /// </summary>
+ InputAndOutput = 0x0004,
+ /// <summary>
+ /// Built-in devices.
+ /// </summary>
+ Internal = 0x00010,
+ /// <summary>
+ /// External devices.
+ /// </summary>
+ External = 0x0020,
+ /// <summary>
+ /// Deactivated devices.
+ /// </summary>
+ Deactivated = 0x1000,
+ /// <summary>
+ /// Activated devices.
+ /// </summary>
+ Activated = 0x2000,
+
+ /// <summary>
+ /// All devices.
+ /// </summary>
+ All = 0xFFFF
+ }
+
+ /// <summary>
+ /// Specifies audio device type.
+ /// </summary>
+ public enum AudioDeviceType
+ {
+ /// <summary>
+ /// Built-in speaker.
+ /// </summary>
+ BuiltinSpeaker,
+ /// <summary>
+ /// Built-in receiver.
+ /// </summary>
+ BuiltinReceiver,
+ /// <summary>
+ /// Built-in microphone.
+ /// </summary>
+ BuiltinMic,
+ /// <summary>
+ /// Audio jack that can be connected to wired accessory such as headphones and headsets.
+ /// </summary>
+ AudioJack,
+ /// <summary>
+ /// Bluetooth Media (A2DP).
+ /// </summary>
+ BluetoothMedia,
+ /// <summary>
+ /// HDMI.
+ /// </summary>
+ Hdmi,
+ /// <summary>
+ /// Device for forwarding.
+ /// </summary>
+ Forwarding,
+ /// <summary>
+ /// USB Audio.
+ /// </summary>
+ UsbAudio,
+ /// <summary>
+ /// Bluetooth Voice (SCO).
+ /// </summary>
+ BluetoothVoice
+ }
+
+ /// <summary>
+ /// Specifies audio device direction.
+ /// </summary>
+ public enum AudioDeviceIoDirection
+ {
+ /// <summary>
+ /// Input device.
+ /// </summary>
+ Input,
+ /// <summary>
+ /// Output device.
+ /// </summary>
+ Output,
+ /// <summary>
+ /// Input/output device (both directions are available).
+ /// </summary>
+ InputAndOutput
+ }
+
+ /// <summary>
+ /// Specifies audio device state.
+ /// </summary>
+ public enum AudioDeviceState
+ {
+ /// <summary>
+ /// Deactivated state.
+ /// </summary>
+ Deactivated,
+ /// <summary>
+ /// Activated state.
+ /// </summary>
+ Activated
+ }
+
+ /// <summary>
+ /// Specifies audio volume type.
+ /// </summary>
+ public enum AudioVolumeType
+ {
+ /// <summary>
+ /// System.
+ /// </summary>
+ System,
+ /// <summary>
+ /// Notification.
+ /// </summary>
+ Notification,
+ /// <summary>
+ /// Alarm.
+ /// </summary>
+ Alarm,
+ /// <summary>
+ /// Ringtone.
+ /// </summary>
+ Ringtone,
+ /// <summary>
+ /// Media.
+ /// </summary>
+ Media,
+ /// <summary>
+ /// Call.
+ /// </summary>
+ Call,
+ /// <summary>
+ /// VoIP.
+ /// </summary>
+ Voip,
+ /// <summary>
+ /// Voice.
+ /// </summary>
+ Voice,
+ /// <summary>
+ /// No volume exists.
+ /// </summary>
+ /// <seealso cref="AudioStreamPolicy.VolumeType"/>
+ None
+ }
+
+ /// <summary>
+ /// Specifies audio stream type.
+ /// </summary>
+ public enum AudioStreamType
+ {
+ /// <summary>
+ /// Media.
+ /// </summary>
+ Media,
+ /// <summary>
+ /// System.
+ /// </summary>
+ System,
+ /// <summary>
+ /// Alarm.
+ /// </summary>
+ Alarm,
+ /// <summary>
+ /// Notification.
+ /// </summary>
+ Notification,
+ /// <summary>
+ /// Emergency.
+ /// </summary>
+ Emergency,
+ /// <summary>
+ /// Voice information.
+ /// </summary>
+ VoiceInformation,
+ /// <summary>
+ /// Voice recognition.
+ /// </summary>
+ VoiceRecognition,
+ /// <summary>
+ /// Ringtone for VoIP.
+ /// </summary>
+ RingtoneVoip,
+ /// <summary>
+ /// VoIP.
+ /// </summary>
+ Voip,
+ /// <summary>
+ /// Media only for external devices.
+ /// </summary>
+ MediaExternalOnly
+ }
+
+ /// <summary>
+ /// Specifies change reason of audio stream focus state.
+ /// </summary>
+ public enum AudioStreamFocusChangedReason
+ {
+ /// <summary>
+ /// Media.
+ /// </summary>
+ Media,
+ /// <summary>
+ /// System.
+ /// </summary>
+ System,
+ /// <summary>
+ /// Alarm.
+ /// </summary>
+ Alarm,
+ /// <summary>
+ /// Notification.
+ /// </summary>
+ Notification,
+ /// <summary>
+ /// Emergency.
+ /// </summary>
+ Emergency,
+ /// <summary>
+ /// Voice information.
+ /// </summary>
+ VoiceInformation,
+ /// <summary>
+ /// Voice recognition.
+ /// </summary>
+ VoiceRecognition,
+ /// <summary>
+ /// Ringtone.
+ /// </summary>
+ RingtoneVoip,
+ /// <summary>
+ /// VoIP.
+ /// </summary>
+ Voip,
+ /// <summary>
+ /// Voice-call or video-call.
+ /// </summary>
+ Call,
+ /// <summary>
+ /// Media only for external devices.
+ /// </summary>
+ MediaExternalOnly
+ }
+
+ /// <summary>
+ /// Specifies the flag for audio stream focus options.
+ /// <para>
+ /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
+ /// </para>
+ /// </summary>
+ [Flags]
+ public enum AudioStreamFocusOptions
+ {
+ /// <summary>
+ /// Playback focus.
+ /// </summary>
+ Playback = 0x0001,
+ /// <summary>
+ /// Recording focus.
+ /// </summary>
+ Recording = 0x0002
+ }
+
+ /// <summary>
+ /// Specifies audio stream focus state.
+ /// </summary>
+ public enum AudioStreamFocusState
+ {
+ /// <summary>
+ /// Focus state for release.
+ /// </summary>
+ Released,
+ /// <summary>
+ /// Focus state for acquisition.
+ /// </summary>
+ Acquired
+ }
+
+ /// <summary>
+ /// Specifies the flag for audio stream behaviors.
+ /// <para>
+ /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
+ /// </para>
+ /// </summary>
+ [Flags]
+ public enum AudioStreamBehaviors
+ {
+ /// <summary>
+ /// No Resume.
+ /// </summary>
+ NoResume = 0x0001,
+ /// <summary>
+ /// Fading.
+ /// </summary>
+ Fading = 0x0002
+ }
+
+
+ internal static class AudioManagerEnumExtensions
+ {
+ internal static bool IsValid(this AudioStreamFocusOptions value)
+ {
+ int mask = (int)(AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording);
+
+ return (mask & (int)value) != 0;
+ }
+
+ internal static bool IsValid(this AudioStreamBehaviors value)
+ {
+ int mask = (int)(AudioStreamBehaviors.NoResume | AudioStreamBehaviors.Fading);
+
+ return ((~mask) & (int)value) == 0;
+ }
+ }
+
+}
--- /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 Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ internal enum AudioManagerError
+ {
+ SoundManagerError = -0x01960000,
+ /// <summary>
+ /// Successful
+ /// </summary>
+ None = ErrorCode.None,
+ /// <summary>
+ /// Out of memory
+ /// </summary>
+ OutOfMemory = ErrorCode.OutOfMemory,
+ /// <summary>
+ /// Invalid parameter
+ /// </summary>
+ InvalidParameter = ErrorCode.InvalidParameter,
+ /// <summary>
+ /// Invalid operation
+ /// </summary>
+ InvalidOperation = ErrorCode.InvalidOperation,
+ /// <summary>
+ /// Permission denied
+ /// </summary>
+ PermissionDenied = ErrorCode.PermissionDenied,
+ /// <summary>
+ /// Not supported
+ /// </summary>
+ NotSupported = ErrorCode.NotSupported,
+ /// <summary>
+ /// No data
+ /// </summary>
+ NoData = ErrorCode.NoData,
+ /// <summary>
+ /// Internal error inside the sound system
+ /// </summary>
+ Internal = SoundManagerError | 01,
+ /// <summary>
+ /// Noncompliance with the sound system policy
+ /// </summary>
+ Policy = SoundManagerError | 02,
+ /// <summary>
+ /// No playing sound
+ /// </summary>
+ NoPlayingSound = SoundManagerError | 03,
+ /// <summary>
+ /// Invalid state (Since 3.0)
+ /// </summary>
+ InvalidState = SoundManagerError | 04
+ }
+
+ internal static class AudioManagerErrorExtensions
+ {
+ internal static void Validate(this AudioManagerError err, string msg)
+ {
+ if (err == AudioManagerError.None)
+ {
+ return;
+ }
+
+ msg = msg ?? "";
+ msg += $" : {err}.";
+
+ switch (err)
+ {
+ case AudioManagerError.OutOfMemory:
+ throw new OutOfMemoryException(msg);
+
+ case AudioManagerError.InvalidParameter:
+ throw new ArgumentException(msg);
+
+ case AudioManagerError.PermissionDenied:
+ throw new UnauthorizedAccessException(msg);
+
+ case AudioManagerError.NotSupported:
+ throw new NotSupportedException(msg);
+
+ case AudioManagerError.Policy:
+ throw new AudioPolicyException(msg);
+
+ case AudioManagerError.NoData:
+ // TODO check when it is thrown
+ throw new InvalidOperationException(msg);
+
+ case AudioManagerError.Internal:
+ case AudioManagerError.InvalidOperation:
+ case AudioManagerError.NoPlayingSound:
+ case AudioManagerError.InvalidState:
+ throw new InvalidOperationException(msg);
+
+ default:
+ throw new InvalidOperationException("Unknown Error : " + msg);
+ }
+ }
+ }
+}
--- /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;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// The exception that is thrown when noncompliance with the sound system policy happens.
+ /// </summary>
+ public class AudioPolicyException : InvalidOperationException
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AudioPolicyException"/> class.
+ /// </summary>
+ public AudioPolicyException()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AudioPolicyException"/> class with a specified error message.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ public AudioPolicyException(string message) : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AudioPolicyException"/> class with a specified error message and inner exception.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception..</param>
+ public AudioPolicyException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
*/
using System;
+using System.Diagnostics;
namespace Tizen.Multimedia
{
- internal static class AudioStreamPolicyLog
- {
- internal const string Tag = "Tizen.Multimedia.AudioStreamPolicy";
- }
-
/// <summary>
- /// The Stream Policy API provides functions to control a sound stream.
+ /// Provides the ability to control a sound stream.
/// </summary>
public class AudioStreamPolicy : IDisposable
{
- private static int _focusStateWatchCounter = 0;
- private static EventHandler<FocusStateChangedEventArgs> _focusStateWatchForPlayback;
- private static EventHandler<FocusStateChangedEventArgs> _focusStateWatchForRecording;
- private static Interop.SoundStreamFocusStateWatchCallback _focusStateWatchCallback;
- private static int _focusWatchCbId;
-
- private IntPtr _streamInfo;
- private AudioStreamType _streamType;
+ private AudioStreamPolicyHandle _handle;
private bool _disposed = false;
- private EventHandler<StreamFocusStateChangedEventArgs> _focusStateChanged;
- private Interop.SoundStreamFocusStateChangedCallback _focusStateChangedCallback;
+ private Interop.AudioStreamPolicy.FocusStateChangedCallback _focusStateChangedCallback;
/// <summary>
- /// Creates and returns an AudioStreamPolicy object
+ /// 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, this object should be passed to other APIs
- /// related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
+ /// 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.)
/// </remarks>
- /// <param name="streamType">Type of sound stream for which policy needs to be created</param>
- /// <returns>StreamPolicy object</returns>
+ /// <param name="streamType">Type of sound stream for which policy needs to be created.</param>
public AudioStreamPolicy(AudioStreamType streamType)
{
- _streamType = streamType;
+ ValidationUtil.ValidateEnum(typeof(AudioStreamType), streamType, nameof(streamType));
- _focusStateChangedCallback = (IntPtr streamInfo, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, int reason, int audioStreamBehavior, string extraInfo, IntPtr userData) => {
- StreamFocusStateChangedEventArgs eventArgs = new StreamFocusStateChangedEventArgs((AudioStreamFocusChangedReason)reason, extraInfo);
- _focusStateChanged?.Invoke(this, eventArgs);
+ _focusStateChangedCallback = (IntPtr streamInfo, AudioStreamFocusOptions focusMask,
+ AudioStreamFocusState state, AudioStreamFocusChangedReason reason, AudioStreamBehaviors behaviors,
+ string extraInfo, IntPtr userData) =>
+ {
+ FocusStateChanged?.Invoke(this,
+ new AudioStreamPolicyFocusStateChangedEventArgs(focusMask, state, reason, behaviors, extraInfo));
};
- int ret = Interop.AudioStreamPolicy.CreateStreamInformation((int)streamType, _focusStateChangedCallback, IntPtr.Zero, out _streamInfo);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to create stream information");
- }
- ~AudioStreamPolicy()
- {
- Dispose(false);
- }
+ Interop.AudioStreamPolicy.Create(streamType, _focusStateChangedCallback,
+ IntPtr.Zero, out _handle).Validate("Unable to create stream information");
- /// <summary>
- /// Registers the watch function to be invoked when the focus state for each sound stream type is changed regardless of the process.
- /// <remarks>
- /// Remarks: You can set this only once per process.
- /// </remarks>
- /// </summary>
- public static event EventHandler<FocusStateChangedEventArgs> PlaybackFocusStateWatch {
- add {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _focusStateWatchCounter" + _focusStateWatchCounter);
- if(_focusStateWatchCounter == 0) {
- RegisterFocusStateWatchEvent();
- }
- _focusStateWatchCounter++;
- _focusStateWatchForPlayback += value;
- }
- remove {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _focusStateWatchCounter" + _focusStateWatchCounter);
- _focusStateWatchForPlayback -= value;
- _focusStateWatchCounter--;
- if(_focusStateWatchCounter == 0) {
- UnregisterFocusStateWatch();
- }
- }
+ Debug.Assert(_handle != null);
}
/// <summary>
- /// Registers the watch function to be invoked when the focus state for each sound stream type is changed regardless of the process.
+ /// Occurs when the state of focus that belongs to the current AudioStreamPolicy is changed.
+ /// </summary>
/// <remarks>
- /// Remarks: You can set this only once per process.
+ /// The event is raised in the internal thread.
/// </remarks>
- /// </summary>
- public static event EventHandler<FocusStateChangedEventArgs> RecordingFocusStateWatch {
- add {
- if(_focusStateWatchCounter == 0) {
- RegisterFocusStateWatchEvent();
- }
- _focusStateWatchCounter++;
- _focusStateWatchForRecording += value;
- }
- remove {
- _focusStateWatchForRecording -= value;
- _focusStateWatchCounter--;
- if(_focusStateWatchCounter == 0) {
- UnregisterFocusStateWatch();
- }
- }
- }
+ public event EventHandler<AudioStreamPolicyFocusStateChangedEventArgs> FocusStateChanged;
/// <summary>
- /// Registers function to be called when the state of focus that belongs to the current
- /// streamInfo is changed.
+ /// Gets the <see cref="AudioVolumeType"/>.
/// </summary>
/// <remarks>
- /// Remarks: This function is issued in the internal thread of the sound manager. Therefore it is recommended not to call UI update function in this function.
- /// Postcondition : Check PlaybackFocusState and RecordingFocusState in the registered event handler to figure out how the focus state of the StreamInfo has been changed.
+ /// If the <see cref="AudioStreamType"/> of the current AudioStreamPolicy is <see cref="AudioStreamType.Emergency"/>,
+ /// it returns <see cref="AudioVolumeType.None"/>.
/// </remarks>
- public event EventHandler<StreamFocusStateChangedEventArgs> StreamFocusStateChanged {
- add {
- _focusStateChanged += value;
- }
- remove {
- _focusStateChanged -= value;
- }
- }
-
- /// <summary>
- /// The sound type of the stream information.
- /// </summary>
- public AudioVolumeType VolumeType {
- get {
- AudioVolumeType soundType;
- int ret = Interop.AudioStreamPolicy.GetSoundType(_streamInfo, out soundType);
- if(ret != 0) {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get sound type:" + (AudioManagerError)ret);
+ /// <value>The <see cref="AudioVolumeType"/> of the policy instance.</value>
+ public AudioVolumeType VolumeType
+ {
+ get
+ {
+ AudioVolumeType type;
+ var ret = Interop.AudioStreamPolicy.GetSoundType(Handle, out type);
+ if (ret == AudioManagerError.NoData)
+ {
return AudioVolumeType.None;
}
- return soundType;
+
+ ret.Validate("Failed to get volume type");
+
+ return type;
}
}
+ private AudioStreamFocusState GetFocusState(bool playback)
+ {
+ int ret = Interop.AudioStreamPolicy.GetFocusState(Handle, out var stateForPlayback, out var stateForRecording);
+ MultimediaDebug.AssertNoError(ret);
+
+ return playback ? stateForPlayback : stateForRecording;
+ }
+
/// <summary>
- /// The state of focus for playback.
+ /// Gets the state of focus for playback.
/// </summary>
- public AudioStreamFocusState PlaybackFocusState {
- get {
- AudioStreamFocusState stateForPlayback;
- AudioStreamFocusState stateForRecording;
- int ret = Interop.AudioStreamPolicy.GetFocusState(_streamInfo, out stateForPlayback, out stateForRecording);
- if(ret != 0) {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus state" + (AudioManagerError)ret);
- return AudioStreamFocusState.Released;
- }
- return stateForPlayback;
- }
- }
+ /// <value>The state of focus for playback.</value>
+ public AudioStreamFocusState PlaybackFocusState => GetFocusState(true);
/// <summary>
- /// The state of focus for recording.
+ /// Gets the state of focus for recording.
/// </summary>
- public AudioStreamFocusState RecordingFocusState {
- get {
- AudioStreamFocusState stateForPlayback;
- AudioStreamFocusState stateForRecording;
- int ret = Interop.AudioStreamPolicy.GetFocusState(_streamInfo, out stateForPlayback, out stateForRecording);
- if(ret != 0) {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus state" + (AudioManagerError)ret);
- return AudioStreamFocusState.Released;
- }
- return stateForRecording;
- }
- }
+ /// <value>The state of focus for recording.</value>
+ public AudioStreamFocusState RecordingFocusState => GetFocusState(false);
/// <summary>
- /// Auto focus reacquisition property
+ /// Gets or sets the auto focus reacquisition.
/// </summary>
+ /// <value>
+ /// true if the auto focus reacquisition is enabled; otherwise, false.\n
+ /// The default is true.
+ /// </value>
/// <remarks>
- /// The focus reacquistion is set as default. If you don't want to reacquire the focus you've lost automatically, disable the focus reacqusition setting by using this API and vice versa.
+ /// If you don't want to reacquire the focus you've lost automatically,
+ /// disable the focus reacquisition.
/// </remarks>
- public bool FocusReacquisitionEnabled {
- get {
- bool enabled;
- int ret = Interop.AudioStreamPolicy.GetFocusReacquisition(_streamInfo, out enabled);
- if(ret != 0) {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus reacquisition" + (AudioManagerError)ret);
- return true;
- }
+ public bool FocusReacquisitionEnabled
+ {
+ get
+ {
+ Interop.AudioStreamPolicy.GetFocusReacquisition(Handle, out var enabled).
+ Validate("Failed to get focus reacquisition state");
+
return enabled;
}
- set {
- int ret = Interop.AudioStreamPolicy.SetFocusReacquisition(_streamInfo, value);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set focus reacquisition");
+ set
+ {
+ Interop.AudioStreamPolicy.SetFocusReacquisition(Handle, value).
+ Validate("Failed to set focus reacquisition");
}
}
- public IntPtr Handle {
- get {
- return _streamInfo;
+ internal AudioStreamPolicyHandle Handle
+ {
+ get
+ {
+ if (_disposed)
+ {
+ throw new ObjectDisposedException(nameof(AudioStreamPolicy));
+ }
+ return _handle;
}
}
/// <summary>
/// Acquires the stream focus.
/// </summary>
- /// <param name="options">The focus mask that user wants to acquire</param>
- /// <param name="audioStreamBehavior">The required action for releaser</param>
- /// <param name="extraInformation">The Extra information for this request (optional, this can be null)</param>
- /// <remarks>
- /// Do not call this API within event handlers of FocuStateChanged and StreamFocusStateWatch else it will throw and exception
- /// </remarks>
- public void AcquireFocus(AudioStreamFocusOptions options, AudioStreamBehavior audioStreamBehavior, string extraInformation)
+ /// <param name="options">The focuses that you want to acquire.</param>
+ /// <param name="behaviors">The requesting behaviors.</param>
+ /// <param name="extraInfo">The extra information for this request. This value can be null.</param>
+ public void AcquireFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
{
- int ret = Interop.AudioStreamPolicy.AcquireFocus(_streamInfo, options, (int)audioStreamBehavior, extraInformation);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Acquire focus return: " + ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to acquire focus");
+ if (options == 0)
+ {
+ throw new ArgumentException("options can't be zero.", nameof(options));
+ }
+
+ if (options.IsValid() == false)
+ {
+ throw new ArgumentOutOfRangeException(nameof(options), options, "options contains a invalid bit.");
+ }
+
+ if (behaviors.IsValid() == false)
+ {
+ throw new ArgumentOutOfRangeException(nameof(behaviors), behaviors, "behaviors contains a invalid bit.");
+ }
+
+ Interop.AudioStreamPolicy.AcquireFocus(Handle, options, behaviors, extraInfo).
+ Validate("Failed to acquire focus");
}
/// <summary>
/// Releases the acquired focus.
/// </summary>
- /// <param name="options">The focus mask that user wants to release</param>
- /// <param name="audioStreamBehavior">The required action for acquirer</param>
- /// <param name="extraInformation">he Extra information for this request (optional, this can be null)</param>
- /// <remarks>
- /// Do not call this API within event handlers of FocuStateChanged and StreamFocusStateWatch else it will throw and exception
- /// </remarks>
- public void ReleaseFocus(AudioStreamFocusOptions options, AudioStreamBehavior audioStreamBehavior, string extraInformation)
+ /// <param name="options">The focus mask that you want to release.</param>
+ /// <param name="behaviors">The requesting behaviors.</param>
+ /// <param name="extraInfo">The extra information for this request. This value can be null.</param>
+ public void ReleaseFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
{
- int ret = Interop.AudioStreamPolicy.ReleaseFocus(_streamInfo, options, (int)audioStreamBehavior, extraInformation);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Release focus return: " + ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to release focus");
+ if (options == 0)
+ {
+ throw new ArgumentException("options can't be zero.", nameof(options));
+ }
+
+ if (options.IsValid() == false)
+ {
+ throw new ArgumentOutOfRangeException(nameof(options), options, "options contains a invalid bit.");
+ }
+
+ if (behaviors.IsValid() == false)
+ {
+ throw new ArgumentOutOfRangeException(nameof(behaviors), behaviors, "behaviors contains a invalid bit.");
+ }
+
+ Interop.AudioStreamPolicy.ReleaseFocus(Handle, options, behaviors, extraInfo).
+ Validate("Failed to release focus");
}
/// <summary>
/// Applies the stream routing.
/// </summary>
/// <remarks>
- /// If the stream has not been made yet, this setting will be applied when the stream starts to play.
- /// Precondition: Call AddDeviceForStreamRouting() before calling this function.
+ /// If the stream has not been made yet, this will be applied when the stream starts to play.
/// </remarks>
+ /// <seealso cref="AddDeviceForStreamRouting(AudioDevice)"/>
+ /// <seealso cref="RemoveDeviceForStreamRouting(AudioDevice)"/>
public void ApplyStreamRouting()
{
- int ret = Interop.AudioStreamPolicy.ApplyStreamRouting(_streamInfo);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Apply Routing: " + (AudioManagerError)ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to apply stream routing");
+ Interop.AudioStreamPolicy.ApplyStreamRouting(Handle).Validate("Failed to apply stream routing");
}
/// <summary>
- /// Adds the device to the stream information for the stream routing.
+ /// Adds a device for the stream routing.
/// </summary>
+ /// <param name="device">The device to add.</param>
/// <remarks>
- /// Remarks: Use SoundManager.GetCurrentDeviceList() to get the device.
- /// The available types of the StreamInfo for this API are SoundStreamTypeVoip and SoundStreamTypeMediaExternalOnly.
- /// Postcondition: You can apply this setting by calling ApplyStreamRouting().
+ /// The available <see cref="AudioStreamType"/> is <see cref="AudioStreamType.Voip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
/// </remarks>
- /// <param name="soundDevice">The device item from the current sound devices list.</param>
- public void AddDeviceForStreamRouting(AudioDevice soundDevice)
+ /// <seealso cref="AudioManager.GetConnectedDevices()"/>
+ /// <seealso cref="ApplyStreamRouting"/>
+ public void AddDeviceForStreamRouting(AudioDevice device)
{
- int ret = Interop.AudioStreamPolicy.AddDeviceForStreamRouting(_streamInfo, soundDevice.Handle);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Add stream routing: " + (AudioManagerError)ret);
+ if (device == null)
+ {
+ throw new ArgumentNullException(nameof(device));
+ }
+ var ret = Interop.AudioStreamPolicy.AddDeviceForStreamRouting(Handle, device.Id);
+
+ if (ret == AudioManagerError.NoData)
+ {
+ throw new ArgumentException("The device seems not connected.", nameof(device));
+ }
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device for stream routing");
+ ret.Validate("Failed to add device for stream routing");
}
/// <summary>
- /// Removes the device to the stream information for the stream routing.
+ /// Removes the device for the stream routing.
/// </summary>
+ /// <param name="device">The device to remove.</param>
/// <remarks>
- /// Remarks: Use SoundManager.GetCurrentDeviceList() to get the device.
- /// The available types of the StreamInfo for this API are SoundStreamTypeVoip and SoundStreamTypeMediaExternalOnly.
- /// Postcondition: You can apply this setting by calling ApplyStreamRouting().
+ /// The available <see cref="AudioStreamType"/> is <see cref="AudioStreamType.Voip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
/// </remarks>
- /// <param name="soundDevice">The device item from the current sound devices list.</param>
- public void RemoveDeviceForStreamRouting(AudioDevice soundDevice)
+ public void RemoveDeviceForStreamRouting(AudioDevice device)
{
- int ret = Interop.AudioStreamPolicy.RemoveDeviceForStreamRouting(_streamInfo, soundDevice.Handle);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Remove stream routing: " + (AudioManagerError)ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device for stream routing");
+ if (device == null)
+ {
+ throw new ArgumentNullException(nameof(device));
+ }
+
+ Interop.AudioStreamPolicy.RemoveDeviceForStreamRouting(Handle, device.Id).
+ Validate("Failed to remove device for stream routing");
}
+ /// <summary>
+ /// Releases all resources used by the <see cref="AudioStreamPolicy"/>.
+ /// </summary>
public void Dispose()
{
Dispose(true);
- GC.SuppressFinalize(this);
}
+ /// <summary>
+ /// Releases the unmanaged resources used by the <see cref="AudioStreamPolicy"/>.
+ /// </summary>
+ /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
- if(!_disposed) {
- if(disposing) {
- // to be used if there are any other disposable objects
- }
- if(_streamInfo != IntPtr.Zero) {
- Interop.AudioStreamPolicy.DestroyStreamInformation(_streamInfo); // Destroy the handle
- _streamInfo = IntPtr.Zero;
+ if (!_disposed)
+ {
+ if (_handle != null)
+ {
+ _handle.Dispose();
}
_disposed = true;
}
}
- private static void RegisterFocusStateWatchEvent()
+ #region Static events
+
+ private static bool _isWatchCallbackRegistered;
+ private static EventHandler<StreamFocusStateChangedEventArgs> _streamFocusStateChanged;
+ private static Interop.AudioStreamPolicy.FocusStateWatchCallback _focusStateWatchCallback;
+ private static object _streamFocusEventLock = new object();
+
+ /// <summary>
+ /// Occurs when the focus state for stream types is changed regardless of the process.
+ /// </summary>
+ public static event EventHandler<StreamFocusStateChangedEventArgs> StreamFocusStateChanged
{
- _focusStateWatchCallback = (int id, AudioStreamFocusOptions options, AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData) => {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _Inside _focusStateWatchCallback : id = " + id + "options = " + options);
- FocusStateChangedEventArgs eventArgs = new FocusStateChangedEventArgs(focusState, reason, extraInfo);
- if(options == AudioStreamFocusOptions.Playback) {
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _eventArgs = " + eventArgs);
- _focusStateWatchForPlayback?.Invoke(null, eventArgs);
- } else if(options == AudioStreamFocusOptions.Recording) {
- _focusStateWatchForRecording?.Invoke(null, eventArgs);
- } else if(options == (AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording)) {
- _focusStateWatchForPlayback?.Invoke(null, eventArgs);
- _focusStateWatchForRecording?.Invoke(null, eventArgs);
+ add
+ {
+ lock (_streamFocusEventLock)
+ {
+ if (_isWatchCallbackRegistered == false)
+ {
+ RegisterFocusStateWatch();
+ _isWatchCallbackRegistered = true;
+ }
+ _streamFocusStateChanged += value;
}
- };
- int ret = Interop.AudioStreamPolicy.AddFocusStateWatchCallback(AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording, _focusStateWatchCallback, IntPtr.Zero, out _focusWatchCbId);
- Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _AddFocusStateWatchCallback : ret = " + ret + " ID = " + _focusWatchCbId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set focus state watch callback");
+ }
+ remove
+ {
+ lock (_streamFocusEventLock)
+ {
+ _streamFocusStateChanged -= value;
+ }
+ }
}
- private static void UnregisterFocusStateWatch()
+ private static void RegisterFocusStateWatch()
{
- int ret = Interop.AudioStreamPolicy.RemoveFocusStateWatchCallback(_focusWatchCbId);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to unset focus state watch callback");
+ _focusStateWatchCallback = (int id, AudioStreamFocusOptions options, AudioStreamFocusState focusState,
+ AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData) =>
+ {
+ _streamFocusStateChanged?.Invoke(null,
+ new StreamFocusStateChangedEventArgs(options, focusState, reason, extraInfo));
+ };
+
+ Interop.AudioStreamPolicy.AddFocusStateWatchCallback(
+ AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording,
+ _focusStateWatchCallback, IntPtr.Zero, out var cbId).
+ Validate("Failed to initialize focus state event");
}
+ #endregion
}
}
--- /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;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Provides data for the <see cref="AudioStreamPolicy.FocusStateChanged"/> event.
+ /// </summary>
+ public class AudioStreamPolicyFocusStateChangedEventArgs : EventArgs
+ {
+ internal AudioStreamPolicyFocusStateChangedEventArgs(AudioStreamFocusOptions options,
+ AudioStreamFocusState state, AudioStreamFocusChangedReason reason,
+ AudioStreamBehaviors behaviors, string extraInfo)
+ {
+ FocusOptions = options;
+ FocusState = state;
+ Reason = reason;
+ Behaviors = behaviors;
+ ExtraInfo = extraInfo;
+ }
+
+ /// <summary>
+ /// Gets the focus options.
+ /// </summary>
+ /// <value>The focus options.</value>
+ public AudioStreamFocusOptions FocusOptions { get; }
+
+ /// <summary>
+ /// Gets the focus state.
+ /// </summary>
+ /// <value>The focus state.</value>
+ public AudioStreamFocusState FocusState { get; }
+
+ /// <summary>
+ /// Gets the reason for state change of the focus.
+ /// </summary>
+ /// <value>The reason for state change of the focus.</value>
+ public AudioStreamFocusChangedReason Reason { get; }
+
+ /// <summary>
+ /// Gets the requested behaviors that should be followed
+ /// </summary>
+ /// <value>The requested behaviors that should be followed.</value>
+ public AudioStreamBehaviors Behaviors { get; }
+
+ /// <summary>
+ /// Gets the extra information.
+ /// </summary>
+ /// <value>
+ /// The extra information specified in <see cref="AudioStreamPolicy.AcquireFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/> or
+ /// <see cref="AudioStreamPolicy.ReleaseFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>.
+ /// </value>
+ /// <seealso cref="AudioStreamPolicy.AcquireFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>
+ /// <seealso cref="AudioStreamPolicy.ReleaseFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>
+ public string ExtraInfo { 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;
namespace Tizen.Multimedia
{
- internal static class AudioVolumeLog
- {
- internal const string Tag = "Tizen.Multimedia.AudioVolume";
- }
-
/// <summary>
- /// The AudioVolume API provides functions to check and control volumes.
+ /// Provides the ability to control the volume levels.
/// </summary>
+ /// <seealso cref="AudioManager"/>
public class AudioVolume
{
- private static int _volumeChangedCallbackId = -1;
+ private const string Tag = "Tizen.Multimedia.AudioVolume";
+
+ private int _volumeChangedCallbackId = -1;
private EventHandler<VolumeChangedEventArgs> _volumeChanged;
- private Interop.SoundManagerVolumeChangedCallback _volumeChangedCallback;
+ private Interop.AudioVolume.VolumeChangedCallback _volumeChangedCallback;
+
+ private object _eventLock = new object();
internal AudioVolume()
{
}
/// <summary>
- /// Registers a function to be invoked when the volume level is changed.
+ /// Occurs when the volume level is changed.
/// </summary>
- public event EventHandler<VolumeChangedEventArgs> Changed {
- add {
- Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed Event added....");
- if(_volumeChanged == null) {
- RegisterVolumeChangedEvent();
+ public event EventHandler<VolumeChangedEventArgs> Changed
+ {
+ add
+ {
+ lock (_eventLock)
+ {
+ if (_volumeChanged == null)
+ {
+ RegisterVolumeChangedEvent();
+ }
+ _volumeChanged += value;
}
- _volumeChanged += value;
}
- remove {
- Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed Event removed....");
- if(_volumeChanged?.GetInvocationList()?.GetLength(0) == 1) {
- UnregisterVolumeChangedEvent();
+ remove
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ lock (_eventLock)
+ {
+ if (_volumeChanged == value)
+ {
+ UnregisterVolumeChangedEvent();
+ }
+ _volumeChanged -= value;
}
- _volumeChanged -= value;
}
}
/// <summary>
- /// The Audio Manager has predefined volume types.(system, notification, alarm, ringtone, media, call, voip, voice).
- /// The volume type of the sound being currently played.
+ /// Gets the volume type of the sound being currently played.
/// </summary>
- public AudioVolumeType CurrentPlaybackType {
- get {
- AudioVolumeType currentType;
- int ret = Interop.AudioVolume.GetCurrentSoundType(out currentType);
- if(ret != 0) {
- Tizen.Log.Info(AudioVolumeLog.Tag, "Unable to get current playback sound type" + (AudioManagerError)ret);
+ /// <value>The volume type of the sound being currently played.</value>
+ public AudioVolumeType CurrentPlaybackType
+ {
+ get
+ {
+ var ret = Interop.AudioVolume.GetCurrentSoundType(out var currentType);
+ if (ret == AudioManagerError.NoPlayingSound)
+ {
return AudioVolumeType.None;
}
+ ret.Validate("Failed to get current volume type");
+
return currentType;
}
}
/// <summary>
- /// The indexer class which is used to get/set volume level specified for a particular sound type.
+ /// Gets the <see cref="VolumeLevel"/>.
/// </summary>
- public VolumeLevel Level;
+ /// <value>The <see cref="VolumeLevel"/>.</value>
+ public VolumeLevel Level { get; }
/// <summary>
- /// The indexer class which is used to get maximum volume level supported for a particular sound type.
+ /// Gets the <see cref="MaxVolumeLevel"/>.
/// </summary>
- public MaxVolumeLevel MaxLevel;
+ /// <value>The <see cref="MaxVolumeLevel"/>.</value>
+ public MaxVolumeLevel MaxLevel { get; }
private void RegisterVolumeChangedEvent()
{
- _volumeChangedCallback = (AudioVolumeType type, uint volume, IntPtr userData) => {
- VolumeChangedEventArgs eventArgs = new VolumeChangedEventArgs(type, volume);
- _volumeChanged.Invoke(this, eventArgs);
+ _volumeChangedCallback = (AudioVolumeType type, uint volume, IntPtr userData) =>
+ {
+ _volumeChanged?.Invoke(this, new VolumeChangedEventArgs(type, volume));
};
- int error = Interop.AudioVolume.AddVolumeChangedCallback(_volumeChangedCallback, IntPtr.Zero, out _volumeChangedCallbackId);
- Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Add Changed Event return id:" + _volumeChangedCallbackId + "error:" + error);
- AudioManagerErrorFactory.CheckAndThrowException(error, "unable to add level changed callback");
+ var error = Interop.AudioVolume.AddVolumeChangedCallback(_volumeChangedCallback, IntPtr.Zero,
+ out _volumeChangedCallbackId);
+ Log.Info(Tag, $"VolumeController callback id:{_volumeChangedCallbackId}");
+
+ error.Validate("Failed to add volume changed event");
}
private void UnregisterVolumeChangedEvent()
{
- if (_volumeChangedCallbackId > 0) {
- int error = Interop.AudioVolume.RemoveVolumeChangedCallback(_volumeChangedCallbackId);
- Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Remove Changed Event(id:" + _volumeChangedCallbackId + ") return error: " + error);
- AudioManagerErrorFactory.CheckAndThrowException(error, "unable to remove level changed callback");
- }
+ Interop.AudioVolume.RemoveVolumeChangedCallback(_volumeChangedCallbackId).
+ Validate("Failed to remove volume changed event");
}
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
- internal static class MaxVolumeLog
- {
- internal const string Tag = "Tizen.Multimedia.MaxVolume";
- }
-
/// <summary>
- /// This is a indexer class which is used to get the maximum volume level
- /// supported for a particular sound type.
+ /// Provides a means to get max volume levels.
/// </summary>
public class MaxVolumeLevel
{
- public int this [AudioVolumeType type] {
- get {
- if(type == AudioVolumeType.None)
- throw new ArgumentException("Wrong Audio volume type. Cannot get max volume level for AudioVolumeType.None");
- int maxVolume;
- int ret = Interop.AudioVolume.GetMaxVolume(type, out maxVolume);
- if(ret != 0) {
- Tizen.Log.Info(MaxVolumeLog.Tag, "Max Level Error: " + (AudioManagerError)ret);
- return -1;
+ internal MaxVolumeLevel()
+ {
+ }
+
+ /// <summary>
+ /// Gets the max volume level of the specified <see cref="AudioVolumeType"/>
+ /// </summary>
+ /// <param name="type">The <see cref="AudioVolumeType"/> to query.</param>
+ /// <value>The maximum volume level.</value>
+ /// <exception cref="ArgumentException"><paramref name="type"/> is invalid.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="type"/> is <see cref="AudioVolumeType.None"/>.</exception>
+ public int this[AudioVolumeType type]
+ {
+ get
+ {
+ ValidationUtil.ValidateEnum(typeof(AudioVolumeType), type, nameof(type));
+
+ if (type == AudioVolumeType.None)
+ {
+ throw new ArgumentOutOfRangeException(nameof(type),
+ "Cannot get max volume level for AudioVolumeType.None");
}
+
+ Interop.AudioVolume.GetMaxVolume(type, out var maxVolume).
+ Validate("Failed to get the max volume level");
+
return maxVolume;
}
}
}
-}
\ 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);
namespace Tizen.Multimedia
{
/// <summary>
- /// Class extending EventArgs and contains the necessary parameters to passed to FocusStateChanged event handler
+ /// Provides data for the <see cref="AudioStreamPolicy.StreamFocusStateChanged"/> event.
/// </summary>
public class StreamFocusStateChangedEventArgs : EventArgs
{
- /* FIXME */
- internal StreamFocusStateChangedEventArgs(AudioStreamFocusChangedReason reason, string extraInformation)
+ internal StreamFocusStateChangedEventArgs(AudioStreamFocusOptions options,
+ AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo)
{
- FocusChangedReason = reason;
- ExtraInformation = extraInformation;
+ FocusOptions = options;
+ FocusState = focusState;
+ Reason = reason;
+ ExtraInfo = extraInfo;
}
/// <summary>
- /// The reason for state change of the focus
+ /// Gets the focus options.
/// </summary>
- public AudioStreamFocusChangedReason FocusChangedReason { get; }
+ /// <value>The focus options.</value>
+ public AudioStreamFocusOptions FocusOptions { get; }
/// <summary>
- /// The extra information
+ /// Gets the changed focus state.
/// </summary>
- public string ExtraInformation { get; }
+ /// <value>The focus state.</value>
+ public AudioStreamFocusState FocusState { get; }
+
+ /// <summary>
+ /// Gets the reason for state change of the focus.
+ /// </summary>
+ /// <value>The reason for state change of the focus.</value>
+ public AudioStreamFocusChangedReason Reason { get; }
+
+ /// <summary>
+ /// Gets the extra information.
+ /// </summary>
+ /// <value>
+ /// The extra information specified in <see cref="AudioStreamPolicy.AcquireFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/> or
+ /// <see cref="AudioStreamPolicy.ReleaseFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>.
+ /// </value>
+ /// <seealso cref="AudioStreamPolicy.AcquireFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>
+ /// <seealso cref="AudioStreamPolicy.ReleaseFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)"/>
+ public string ExtraInfo { get; }
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
/// <summary>
- /// Extnded EventArgs which contains the parameteres to be passed to the AudioVolume Changed event
+ /// Provides data for the <see cref="AudioVolume.Changed"/> event.
/// </summary>
public class VolumeChangedEventArgs : EventArgs
{
internal VolumeChangedEventArgs(AudioVolumeType type, uint level)
{
Type = type;
- Level = level;
+ Level = (int)level;
}
/// <summary>
- /// The sound type of the changed volume
+ /// Gets the sound type that volume is changed.
/// </summary>
+ /// <value>The sound type that volume is changed.</value>
public AudioVolumeType Type { get; }
/// <summary>
- /// The new volume value
+ /// Gets the new volume.
/// </summary>
- public uint Level { get; }
+ /// <value>The new volume level.</value>
+ public int Level { get; }
}
}
- /*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen.Multimedia
{
- internal static class VolumeLevelLog
- {
- internal const string Tag = "Tizen.Multimedia.VolumeLevel";
- }
/// <summary>
- /// This is a indexer class which is used to get/set the volume level
- /// specified for a particular sound type.
+ /// Provides a means to control volume levels.
/// </summary>
public class VolumeLevel
{
- public int this [AudioVolumeType type] {
- get {
- if(type == AudioVolumeType.None)
- throw new ArgumentException("Wrong Audio volume type. Cannot get volume level for AudioVolumeType.None");
- int volume;
- int ret = Interop.AudioVolume.GetVolume(type, out volume);
- if(ret != 0) {
- Tizen.Log.Info(VolumeLevelLog.Tag, "Get Level Error: " + (AudioManagerError)ret);
- return -1;
+ internal VolumeLevel()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the volume level of the specified <see cref="AudioVolumeType"/>
+ /// </summary>
+ /// <param name="type">The <see cref="AudioVolumeType"/> to control.</param>
+ /// <value>The current volume level.</value>
+ /// <remarks>To set volumes, the specified privilege is required.</remarks>
+ /// <privilege>http://tizen.org/privilege/volume.set</privilege>
+ /// <exception cref="ArgumentException"><paramref name="type"/> is invalid.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="type"/> is <see cref="AudioVolumeType.None"/>.
+ /// -or-
+ /// <paramref name="value"/> is less than zero.
+ /// -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>
+ public int this[AudioVolumeType type]
+ {
+ get
+ {
+ ValidationUtil.ValidateEnum(typeof(AudioVolumeType), type, nameof(type));
+
+ if (type == AudioVolumeType.None)
+ {
+ throw new ArgumentOutOfRangeException(nameof(type),
+ "Cannot get volume level for AudioVolumeType.None");
}
+
+ Interop.AudioVolume.GetVolume(type, out var volume).Validate("Failed to get the volume level");
+
return volume;
}
- set {
- if(type == AudioVolumeType.None)
- throw new ArgumentException("Wrong Audio volume type. Cannot set volume level for AudioVolumeType.None");
- int ret = Interop.AudioVolume.SetVolume(type, value);
- if(ret != 0) {
- Tizen.Log.Info(VolumeLevelLog.Tag, "Set Level Error: " + (AudioManagerError)ret);
- AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set level");
+ set
+ {
+ ValidationUtil.ValidateEnum(typeof(AudioVolumeType), type, nameof(value));
+
+ if (type == AudioVolumeType.None)
+ {
+ throw new ArgumentOutOfRangeException(nameof(type),
+ "Cannot set volume level for AudioVolumeType.None");
+ }
+
+ var ret = Interop.AudioVolume.SetVolume(type, value);
+
+ if (ret == AudioManagerError.InvalidParameter)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ $"valid volume level range is 0 <= x <= {nameof(MaxVolumeLevel)}[{nameof(AudioVolumeType)}]");
}
+
+ ret.Validate("Failed to set the volume level");
}
}
}
-}
\ 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.
+ */
+
using System;
namespace Tizen.Multimedia
--- /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.Runtime.InteropServices;
+
+namespace Tizen.Multimedia
+{
+ internal class AudioStreamPolicyHandle : SafeHandle
+ {
+ protected AudioStreamPolicyHandle() : base(IntPtr.Zero, true)
+ {
+ }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+
+ protected override bool ReleaseHandle()
+ {
+ var ret = Interop.AudioStreamPolicy.Destroy(handle);
+ if (ret != AudioManagerError.None)
+ {
+ Log.Debug(GetType().FullName, $"Failed to release native {GetType()}");
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
{
internal static partial class Interop
{
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SoundDeviceConnectionChangedCallback(IntPtr device, bool isConnected, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SoundDeviceStateChangedCallback(IntPtr device, AudioDeviceState changedState, IntPtr userData);
-
internal static partial class AudioDevice
{
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_list")]
- internal static extern int GetCurrentDeviceList(AudioDeviceOptions deviceMask, out IntPtr deviceList);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ConnectionChangedCallback(IntPtr device, bool isConnected, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void StateChangedCallback(IntPtr device, AudioDeviceState changedState, IntPtr userData);
+
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_list")]
+ internal static extern AudioManagerError GetDeviceList(AudioDeviceOptions deviceMask, out IntPtr deviceList);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_free_device_list")]
- internal static extern int FreeDeviceList(IntPtr deviceList);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_free_device_list")]
+ internal static extern AudioManagerError FreeDeviceList(IntPtr deviceList);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_next_device")]
- internal static extern int GetNextDevice(IntPtr deviceList, out IntPtr device);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_next_device")]
+ internal static extern AudioManagerError GetNextDevice(IntPtr deviceList, out IntPtr device);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_type")]
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_type")]
internal static extern int GetDeviceType(IntPtr device, out AudioDeviceType type);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_io_direction")]
- internal static extern int GetDeviceIoDirection(IntPtr device, out AudioDeviceIoDirection ioDirection);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_io_direction")]
+ internal static extern AudioManagerError GetDeviceIoDirection(IntPtr device, out AudioDeviceIoDirection ioDirection);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_id")]
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_id")]
internal static extern int GetDeviceId(IntPtr device, out int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_name")]
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_name")]
internal static extern int GetDeviceName(IntPtr device, out IntPtr name);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_state")]
- internal static extern int GetDeviceState(IntPtr device, out AudioDeviceState state);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_state_by_id")]
+ internal static extern AudioManagerError GetDeviceState(int deviceId, out AudioDeviceState state);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_connection_changed_cb")]
- internal static extern int AddDeviceConnectionChangedCallback(AudioDeviceOptions deviceMask, SoundDeviceConnectionChangedCallback callback, IntPtr userData, out int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_connection_changed_cb")]
+ internal static extern AudioManagerError AddDeviceConnectionChangedCallback(
+ AudioDeviceOptions deviceMask, ConnectionChangedCallback callback, IntPtr userData, out int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_connection_changed_cb")]
- internal static extern int RemoveDeviceConnectionChangedCallback(int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_connection_changed_cb")]
+ internal static extern AudioManagerError RemoveDeviceConnectionChangedCallback(int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_state_changed_cb")]
- internal static extern int AddDeviceStateChangedCallback(AudioDeviceOptions deviceMask, SoundDeviceStateChangedCallback callback, IntPtr userData, out int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_state_changed_cb")]
+ internal static extern AudioManagerError AddDeviceStateChangedCallback(AudioDeviceOptions deviceMask,
+ StateChangedCallback callback, IntPtr userData, out int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_state_changed_cb")]
- internal static extern int RemoveDeviceStateChangedCallback(int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_state_changed_cb")]
+ internal static extern AudioManagerError RemoveDeviceStateChangedCallback(int id);
}
}
}
\ No newline at end of file
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
+/*
+ * 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;
[DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_buffer_size")]
internal static extern int SetBufferSize(IntPtr handle, ulong size);
-
[DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_allocated_buffer_size")]
internal static extern int GetAllocatedBufferSize(IntPtr handle, out int size);
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
{
internal static partial class Interop
{
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SoundStreamFocusStateChangedCallback(IntPtr streamInfo, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, int reason, int audioStreamBehavior, string extraInfo, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SoundStreamFocusStateWatchCallback(int id, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData);
-
internal static partial class AudioStreamPolicy
{
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_create_stream_information")]
- internal static extern int CreateStreamInformation(int streamType, SoundStreamFocusStateChangedCallback callback, IntPtr userData, out IntPtr streamInfo);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void FocusStateChangedCallback(IntPtr streamInfo, AudioStreamFocusOptions focusMask,
+ AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason,
+ AudioStreamBehaviors audioStreamBehavior, string extraInfo, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void FocusStateWatchCallback(int id, AudioStreamFocusOptions focusMask,
+ AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo,
+ IntPtr userData);
+
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_create_stream_information")]
+ internal static extern AudioManagerError Create(AudioStreamType streamType,
+ FocusStateChangedCallback callback, IntPtr userData, out AudioStreamPolicyHandle streamInfo);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_destroy_stream_information")]
- internal static extern int DestroyStreamInformation(IntPtr streamInfo);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_destroy_stream_information")]
+ internal static extern AudioManagerError Destroy(IntPtr streamInfo);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_for_stream_routing")]
- internal static extern int AddDeviceForStreamRouting(IntPtr streamInfo, IntPtr device);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_id_for_stream_routing")]
+ internal static extern AudioManagerError AddDeviceForStreamRouting(
+ AudioStreamPolicyHandle streamInfo, int deviceId);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_for_stream_routing")]
- internal static extern int RemoveDeviceForStreamRouting(IntPtr streamInfo, IntPtr device);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_id_for_stream_routing")]
+ internal static extern AudioManagerError RemoveDeviceForStreamRouting(
+ AudioStreamPolicyHandle streamInfo, int device);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_apply_stream_routing")]
- internal static extern int ApplyStreamRouting(IntPtr streamInfo);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_apply_stream_routing")]
+ internal static extern AudioManagerError ApplyStreamRouting(AudioStreamPolicyHandle streamInfo);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_acquire_focus")]
- internal static extern int AcquireFocus(IntPtr streamInfo, AudioStreamFocusOptions focusMask, int audioStreamBehavior, string extraInfo);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_acquire_focus")]
+ internal static extern AudioManagerError AcquireFocus(AudioStreamPolicyHandle streamInfo,
+ AudioStreamFocusOptions focusMask, AudioStreamBehaviors audioStreamBehavior, string extraInfo);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_release_focus")]
- internal static extern int ReleaseFocus(IntPtr streamInfo, AudioStreamFocusOptions focusMask, int audioStreamBehavior, string extraInfo);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_release_focus")]
+ internal static extern AudioManagerError ReleaseFocus(AudioStreamPolicyHandle streamInfo,
+ AudioStreamFocusOptions focusMask, AudioStreamBehaviors audioStreamBehavior, string extraInfo);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_state")]
- internal static extern int GetFocusState(IntPtr streaInfo, out AudioStreamFocusState stateForPlayback, out AudioStreamFocusState stateForRecording);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_state")]
+ internal static extern int GetFocusState(AudioStreamPolicyHandle streamInfo,
+ out AudioStreamFocusState stateForPlayback, out AudioStreamFocusState stateForRecording);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_set_focus_reacquisition")]
- internal static extern int SetFocusReacquisition(IntPtr streamInfo, bool enable);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_set_focus_reacquisition")]
+ internal static extern AudioManagerError SetFocusReacquisition(AudioStreamPolicyHandle streamInfo,
+ bool enable);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_reacquisition")]
- internal static extern int GetFocusReacquisition(IntPtr streamInfo, out bool enabled);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_reacquisition")]
+ internal static extern AudioManagerError GetFocusReacquisition(AudioStreamPolicyHandle streamInfo,
+ out bool enabled);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_sound_type")]
- internal static extern int GetSoundType(IntPtr streamInfo, out AudioVolumeType soundType);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_sound_type")]
+ internal static extern AudioManagerError GetSoundType(AudioStreamPolicyHandle streamInfo,
+ out AudioVolumeType soundType);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_focus_state_watch_cb")]
- internal static extern int AddFocusStateWatchCallback(AudioStreamFocusOptions focusMask, SoundStreamFocusStateWatchCallback callback, IntPtr userData, out int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_focus_state_watch_cb")]
+ internal static extern AudioManagerError AddFocusStateWatchCallback(AudioStreamFocusOptions focusMask,
+ FocusStateWatchCallback callback, IntPtr userData, out int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_focus_state_watch_cb")]
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_focus_state_watch_cb")]
internal static extern int RemoveFocusStateWatchCallback(int id);
}
}
-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.
+ */
+
+using System;
using System.Runtime.InteropServices;
namespace Tizen.Multimedia
{
internal static partial class Interop
{
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SoundManagerVolumeChangedCallback(AudioVolumeType type, uint volume, IntPtr userData);
-
internal static partial class AudioVolume
{
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_max_volume")]
- internal static extern int GetMaxVolume(AudioVolumeType type, out int max);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void VolumeChangedCallback(AudioVolumeType type, uint volume, IntPtr userData);
+
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_max_volume")]
+ internal static extern AudioManagerError GetMaxVolume(AudioVolumeType type, out int max);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_set_volume")]
- internal static extern int SetVolume(AudioVolumeType type, int volume);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_set_volume")]
+ internal static extern AudioManagerError SetVolume(AudioVolumeType type, int volume);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_volume")]
- internal static extern int GetVolume(AudioVolumeType type, out int volume);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_volume")]
+ internal static extern AudioManagerError GetVolume(AudioVolumeType type, out int volume);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_current_sound_type")]
- internal static extern int GetCurrentSoundType(out AudioVolumeType type);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_current_sound_type")]
+ internal static extern AudioManagerError GetCurrentSoundType(out AudioVolumeType type);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_volume_changed_cb")]
- internal static extern int AddVolumeChangedCallback(SoundManagerVolumeChangedCallback callback, IntPtr userData, out int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_volume_changed_cb")]
+ internal static extern AudioManagerError AddVolumeChangedCallback(VolumeChangedCallback callback,
+ IntPtr userData, out int id);
- [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_volume_changed_cb")]
- internal static extern int RemoveVolumeChangedCallback(int id);
+ [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_volume_changed_cb")]
+ internal static extern AudioManagerError RemoveVolumeChangedCallback(int id);
}
}
}
\ No newline at end of file
--- /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.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents an audio media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class AudioMediaFormat : MediaFormat
+ {
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
+ /// 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="sampleRate">The sample rate value of the format.</param>
+ /// <param name="bit">The bit 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.
+ /// </exception>
+ public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
+ int channel, int sampleRate, int bit, int bitRate)
+ : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class with the specified mime 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="sampleRate">The sample rate value of the format.</param>
+ /// <param name="bit">The bit 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
+ /// -or-\n
+ /// <paramref name="aacType"/> is not <see cref="MediaFormatAacType.None"/>, but <paramref name="mimeType"/> is one of aac types.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <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)
+ : base(MediaFormatType.Audio)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (channel < 0)
+ {
+ throw new ArgumentOutOfRangeException("Channel value can't be negative.");
+ }
+ if (sampleRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Sample rate value can't be negative.");
+ }
+ if (bit < 0)
+ {
+ throw new ArgumentOutOfRangeException("Bit value can't be negative.");
+ }
+ if (bitRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Bit rate value can't be negative.");
+ }
+ if (!Enum.IsDefined(typeof(MediaFormatAacType), aacType))
+ {
+ throw new ArgumentException($"Invalid aac type value : { (int)aacType }");
+ }
+ if (!IsAacSupportedMimeType(mimeType) && aacType != MediaFormatAacType.None)
+ {
+ throw new ArgumentException("Aac is supported only with aac mime types.");
+ }
+
+ MimeType = mimeType;
+ Channel = channel;
+ SampleRate = sampleRate;
+ Bit = bit;
+ BitRate = bitRate;
+ AacType = aacType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal AudioMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Audio)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ MediaFormatAudioMimeType mimeType;
+ int channel = 0;
+ int sampleRate = 0;
+ int bit = 0;
+ int bitRate = 0;
+ MediaFormatAacType aacType;
+ GetInfo(handle, out mimeType, out channel, out sampleRate, out bit, out bitRate);
+
+ if (IsAacSupportedMimeType(mimeType))
+ {
+ GetAacType(handle, out aacType);
+ }
+ else
+ {
+ aacType = MediaFormatAacType.None;
+ }
+
+ MimeType = mimeType;
+ Channel = channel;
+ SampleRate = sampleRate;
+ Bit = bit;
+ BitRate = bitRate;
+ AacType = aacType;
+ }
+
+ /// <summary>
+ /// Returns an indication whether a specified mime type is a aac type.
+ /// </summary>
+ /// <param name="mimeType">A mime type.</param>
+ private static bool IsAacSupportedMimeType(MediaFormatAudioMimeType mimeType)
+ {
+ return mimeType == MediaFormatAudioMimeType.AacLC ||
+ mimeType == MediaFormatAudioMimeType.AacHE ||
+ mimeType == MediaFormatAudioMimeType.AacHEPS;
+ }
+
+ /// <summary>
+ /// Retrieves audio properties of 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>
+ private static void GetInfo(IntPtr handle, out MediaFormatAudioMimeType mimeType,
+ out int channel, out int sampleRate, out int bit, out int bitRate)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetAudioInfo(handle,
+ out mimeTypeValue, out channel, out sampleRate, out bit, out bitRate);
+
+ mimeType = (MediaFormatAudioMimeType)mimeTypeValue;
+
+ MultimediaDebug.AssertNoError(ret);
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType),
+ "Invalid audio mime type!");
+ }
+
+ /// <summary>
+ /// Retrieves 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>
+ private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int aacTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetAudioAacType(handle, out aacTypeValue);
+
+ MultimediaDebug.AssertNoError(ret);
+
+ aacType = (MediaFormatAacType)aacTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatAacType), aacType), "Invalid aac type!");
+ }
+
+ internal override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Audio);
+
+ int ret = Interop.MediaFormat.SetAudioMimeType(handle, (int)MimeType);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioChannel(handle, Channel);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioSampleRate(handle, SampleRate);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioBit(handle, Bit);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioAverageBps(handle, BitRate);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioAacType(handle, (int)AacType);
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatAudioMimeType MimeType { get; }
+
+ /// <summary>
+ /// Gets the channel value of the current format.
+ /// </summary>
+ public int Channel { get; }
+
+ /// <summary>
+ /// Gets the sample rate value of the current format.
+ /// </summary>
+ public int SampleRate { get; }
+
+ /// <summary>
+ /// Gets the bit value of the current format.
+ /// </summary>
+ public int Bit { get; }
+
+ /// <summary>
+ /// Gets the bit rate value of the current format.
+ /// </summary>
+ public int BitRate { get; }
+
+ /// <summary>
+ /// Gets the aac type of the current format.
+ /// </summary>
+ public MediaFormatAacType AacType { get; }
+
+ public override string ToString()
+ {
+ return $@"MimeTyp={ MimeType.ToString() }, Channel={ Channel.ToString() }, SampleRate=
+ { SampleRate }, Bit={ Bit.ToString() }, BitRate={ BitRate.ToString() }, AacType={ AacType.ToString() }";
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as AudioMediaFormat;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ return MimeType == rhs.MimeType && Channel == rhs.Channel && SampleRate == rhs.SampleRate &&
+ Bit == rhs.Bit && BitRate == rhs.BitRate;
+ }
+
+ public override int GetHashCode()
+ {
+ return new { MimeType, Channel, SampleRate, Bit, BitRate }.GetHashCode();
+ }
+ }
+}
--- /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.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a container media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class ContainerMediaFormat : MediaFormat
+ {
+ /// <summary>
+ /// 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>
+ public ContainerMediaFormat(MediaFormatContainerMimeType mimeType)
+ : base(MediaFormatType.Container)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ MimeType = mimeType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the ContainerMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native media format handle.</param>
+ internal ContainerMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Container)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeType = 0;
+
+ int ret = Interop.MediaFormat.GetContainerMimeType(handle, out mimeType);
+
+ MultimediaDebug.AssertNoError(ret);
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType),
+ "Invalid container mime type!");
+
+ MimeType = (MediaFormatContainerMimeType)mimeType;
+ }
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatContainerMimeType MimeType
+ {
+ get;
+ }
+
+ internal override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Container);
+
+ int ret = Interop.MediaFormat.SetContainerMimeType(handle, (int)MimeType);
+
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ public override string ToString()
+ {
+ return $"MimeType={ MimeType.ToString() }";
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as ContainerMediaFormat;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ return MimeType == rhs.MimeType;
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)MimeType;
+ }
+ }
+}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using System.Diagnostics;
using Tizen.Internals.Errors;
/// <param name="handle">A native handle to be written.</param>
internal abstract void AsNativeHandle(IntPtr handle);
}
-
- /// <summary>
- /// Represents a container media format. This class cannot be inherited.
- /// </summary>
- public sealed class ContainerMediaFormat : MediaFormat
- {
- /// <summary>
- /// 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>
- public ContainerMediaFormat(MediaFormatContainerMimeType mimeType)
- : base(MediaFormatType.Container)
- {
- if (!Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
- MimeType = mimeType;
- }
-
- /// <summary>
- /// Initializes a new instance of the ContainerMediaFormat class from a native handle.
- /// </summary>
- /// <param name="handle">A native media format handle.</param>
- internal ContainerMediaFormat(IntPtr handle)
- : base(MediaFormatType.Container)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int mimeType = 0;
-
- int ret = Interop.MediaFormat.GetContainerMimeType(handle, out mimeType);
-
- MultimediaDebug.AssertNoError(ret);
-
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType),
- "Invalid container mime type!");
-
- MimeType = (MediaFormatContainerMimeType)mimeType;
- }
-
- /// <summary>
- /// Gets the mime type of the current format.
- /// </summary>
- public MediaFormatContainerMimeType MimeType
- {
- get;
- }
-
- internal override void AsNativeHandle(IntPtr handle)
- {
- Debug.Assert(Type == MediaFormatType.Container);
-
- int ret = Interop.MediaFormat.SetContainerMimeType(handle, (int)MimeType);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- public override string ToString()
- {
- return $"MimeType={ MimeType.ToString() }";
- }
-
- public override bool Equals(object obj)
- {
- var rhs = obj as ContainerMediaFormat;
- if (rhs == null)
- {
- return false;
- }
-
- return MimeType == rhs.MimeType;
- }
-
- public override int GetHashCode()
- {
- return (int)MimeType;
- }
- }
-
- /// <summary>
- /// Represents a video media format. This class cannot be inherited.
- /// </summary>
- public sealed class VideoMediaFormat : MediaFormat
- {
- private const int DefaultFrameRate = 0;
- private const int DefaultBitRate = 0;
-
- /// <summary>
- /// 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>
- public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height)
- : this(mimeType, width, height, DefaultFrameRate)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the VideoMediaFormat class with the specified mime type and size.
- /// </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>
- 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.
- /// </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)
- : 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.
- /// </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>
- 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.
- /// </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>
- 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.
- /// </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>
- public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size,
- int frameRate, int bitRate)
- : base(MediaFormatType.Video)
- {
- if (!Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
- if (size.Width < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(size), size.Width, "Size.Width value can't be less than zero.");
- }
- if (size.Height < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(size), size.Height, "Size.Height value can't be less than zero.");
- }
- if (frameRate < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(frameRate), frameRate, "Frame rate can't be less than zero.");
- }
- if (bitRate < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(bitRate), bitRate, "Bit rate value can't be less than zero.");
- }
-
- MimeType = mimeType;
- Size = size;
- FrameRate = frameRate;
- BitRate = bitRate;
- }
-
- /// <summary>
- /// Initializes a new instance of the VideoMediaForma class from a native handle.
- /// </summary>
- /// <param name="handle">A native handle.</param>
- internal VideoMediaFormat(IntPtr handle)
- : base(MediaFormatType.Video)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int width = 0;
- int height = 0;
- int bitRate = 0;
- int frameRate = 0;
- MediaFormatVideoMimeType mimeType;
- GetInfo(handle, out width, out height, out bitRate, out mimeType);
-
- GetFrameRate(handle, out frameRate);
-
- MimeType = mimeType;
- Size = new Size(width, height);
- FrameRate = frameRate;
- BitRate = bitRate;
- }
-
- /// <summary>
- /// Retrieves video properties of 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>
- private static void GetInfo(IntPtr handle, out int width, out int height, out int bitRate,
- out MediaFormatVideoMimeType mimeType)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int mimeTypeValue = 0;
- int maxBps = 0;
-
- int ret = Interop.MediaFormat.GetVideoInfo(handle,
- out mimeTypeValue, out width, out height, out bitRate, out maxBps);
-
- MultimediaDebug.AssertNoError(ret);
-
- mimeType = (MediaFormatVideoMimeType)mimeTypeValue;
-
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType),
- "Invalid video mime type!");
- }
-
- /// <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>
- private static void GetFrameRate(IntPtr handle, out int frameRate)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int ret = Interop.MediaFormat.GetVideoFrameRate(handle, out frameRate);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- internal override void AsNativeHandle(IntPtr handle)
- {
- Debug.Assert(Type == MediaFormatType.Video);
-
- int ret = Interop.MediaFormat.SetVideoMimeType(handle, (int)MimeType);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetVideoWidth(handle, Size.Width);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetVideoHeight(handle, Size.Height);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetVideoAverageBps(handle, BitRate);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetVideoFrameRate(handle, FrameRate);
- MultimediaDebug.AssertNoError(ret);
- }
-
- /// <summary>
- /// Gets the mime type of the current format.
- /// </summary>
- public MediaFormatVideoMimeType MimeType { get; }
-
- /// <summary>
- /// Gets the size of the current format.
- /// </summary>
- public Size Size { get; }
-
- /// <summary>
- /// Gets the frame rate value of the current format.
- /// </summary>
- public int FrameRate { get; }
-
- /// <summary>
- /// Gets the bit rate value of the current format.
- /// </summary>
- public int BitRate { get; }
-
- public override string ToString()
- {
- return $@"MimeType={ MimeType.ToString() }, Size=({ Size.ToString() }), FrameRate=
- { FrameRate.ToString() }, BitRate={ BitRate.ToString() }";
- }
-
- public override bool Equals(object obj)
- {
- var rhs = obj as VideoMediaFormat;
- if (rhs == null)
- {
- return false;
- }
-
- return MimeType == rhs.MimeType && Size == rhs.Size &&
- FrameRate == rhs.FrameRate && BitRate == rhs.BitRate;
- }
-
- public override int GetHashCode()
- {
- return new { MimeType, Size, FrameRate, BitRate }.GetHashCode();
- }
- }
-
- /// <summary>
- /// Represents an audio media format. This class cannot be inherited.
- /// </summary>
- public sealed class AudioMediaFormat : MediaFormat
- {
-
- /// <summary>
- /// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
- /// 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="sampleRate">The sample rate value of the format.</param>
- /// <param name="bit">The bit 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.
- /// </exception>
- public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
- int channel, int sampleRate, int bit, int bitRate)
- : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the AudioMediaFormat class with the specified mime 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="sampleRate">The sample rate value of the format.</param>
- /// <param name="bit">The bit 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
- /// -or-\n
- /// <paramref name="aacType"/> is not <see cref="MediaFormatAacType.None"/>, but <paramref name="mimeType"/> is one of aac types.
- /// </exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// <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)
- : base(MediaFormatType.Audio)
- {
- if (!Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
- if (channel < 0)
- {
- throw new ArgumentOutOfRangeException("Channel value can't be negative.");
- }
- if (sampleRate < 0)
- {
- throw new ArgumentOutOfRangeException("Sample rate value can't be negative.");
- }
- if (bit < 0)
- {
- throw new ArgumentOutOfRangeException("Bit value can't be negative.");
- }
- if (bitRate < 0)
- {
- throw new ArgumentOutOfRangeException("Bit rate value can't be negative.");
- }
- if (!Enum.IsDefined(typeof(MediaFormatAacType), aacType))
- {
- throw new ArgumentException($"Invalid aac type value : { (int)aacType }");
- }
- if (!IsAacSupportedMimeType(mimeType) && aacType != MediaFormatAacType.None)
- {
- throw new ArgumentException("Aac is supported only with aac mime types.");
- }
-
- MimeType = mimeType;
- Channel = channel;
- SampleRate = sampleRate;
- Bit = bit;
- BitRate = bitRate;
- AacType = aacType;
- }
-
- /// <summary>
- /// Initializes a new instance of the AudioMediaFormat class from a native handle.
- /// </summary>
- /// <param name="handle">A native handle.</param>
- internal AudioMediaFormat(IntPtr handle)
- : base(MediaFormatType.Audio)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- MediaFormatAudioMimeType mimeType;
- int channel = 0;
- int sampleRate = 0;
- int bit = 0;
- int bitRate = 0;
- MediaFormatAacType aacType;
- GetInfo(handle, out mimeType, out channel, out sampleRate, out bit, out bitRate);
-
- if (IsAacSupportedMimeType(mimeType))
- {
- GetAacType(handle, out aacType);
- }
- else
- {
- aacType = MediaFormatAacType.None;
- }
-
- MimeType = mimeType;
- Channel = channel;
- SampleRate = sampleRate;
- Bit = bit;
- BitRate = bitRate;
- AacType = aacType;
- }
-
- /// <summary>
- /// Returns an indication whether a specified mime type is a aac type.
- /// </summary>
- /// <param name="mimeType">A mime type.</param>
- private static bool IsAacSupportedMimeType(MediaFormatAudioMimeType mimeType)
- {
- return mimeType == MediaFormatAudioMimeType.AacLC ||
- mimeType == MediaFormatAudioMimeType.AacHE ||
- mimeType == MediaFormatAudioMimeType.AacHEPS;
- }
-
- /// <summary>
- /// Retrieves audio properties of 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>
- private static void GetInfo(IntPtr handle, out MediaFormatAudioMimeType mimeType,
- out int channel, out int sampleRate, out int bit, out int bitRate)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int mimeTypeValue = 0;
-
- int ret = Interop.MediaFormat.GetAudioInfo(handle,
- out mimeTypeValue, out channel, out sampleRate, out bit, out bitRate);
-
- mimeType = (MediaFormatAudioMimeType)mimeTypeValue;
-
- MultimediaDebug.AssertNoError(ret);
-
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType),
- "Invalid audio mime type!");
- }
-
- /// <summary>
- /// Retrieves 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>
- private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- int aacTypeValue = 0;
-
- int ret = Interop.MediaFormat.GetAudioAacType(handle, out aacTypeValue);
-
- MultimediaDebug.AssertNoError(ret);
-
- aacType = (MediaFormatAacType)aacTypeValue;
-
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatAacType), aacType), "Invalid aac type!");
- }
-
- internal override void AsNativeHandle(IntPtr handle)
- {
- Debug.Assert(Type == MediaFormatType.Audio);
-
- int ret = Interop.MediaFormat.SetAudioMimeType(handle, (int)MimeType);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetAudioChannel(handle, Channel);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetAudioSampleRate(handle, SampleRate);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetAudioBit(handle, Bit);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetAudioAverageBps(handle, BitRate);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetAudioAacType(handle, (int)AacType);
- MultimediaDebug.AssertNoError(ret);
- }
-
- /// <summary>
- /// Gets the mime type of the current format.
- /// </summary>
- public MediaFormatAudioMimeType MimeType { get; }
-
- /// <summary>
- /// Gets the channel value of the current format.
- /// </summary>
- public int Channel { get; }
-
- /// <summary>
- /// Gets the sample rate value of the current format.
- /// </summary>
- public int SampleRate { get; }
-
- /// <summary>
- /// Gets the bit value of the current format.
- /// </summary>
- public int Bit { get; }
-
- /// <summary>
- /// Gets the bit rate value of the current format.
- /// </summary>
- public int BitRate { get; }
-
- /// <summary>
- /// Gets the aac type of the current format.
- /// </summary>
- public MediaFormatAacType AacType { get; }
-
- public override string ToString()
- {
- return $@"MimeTyp={ MimeType.ToString() }, Channel={ Channel.ToString() }, SampleRate=
- { SampleRate }, Bit={ Bit.ToString() }, BitRate={ BitRate.ToString() }, AacType={ AacType.ToString() }";
- }
-
- public override bool Equals(object obj)
- {
- var rhs = obj as AudioMediaFormat;
- if (rhs == null)
- {
- return false;
- }
-
- return MimeType == rhs.MimeType && Channel == rhs.Channel && SampleRate == rhs.SampleRate &&
- Bit == rhs.Bit && BitRate == rhs.BitRate;
- }
-
- public override int GetHashCode()
- {
- return new { MimeType, Channel, SampleRate, Bit, BitRate }.GetHashCode();
- }
- }
-
- /// <summary>
- /// Represents a text media format. This class cannot be inherited.
- /// </summary>
- public sealed class TextMediaFormat : MediaFormat
- {
- /// <summary>
- /// Initializes a new instance of the TextMediaFormat class with the specified mime type
- /// and text type.
- /// </summary>
- /// <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>
- public TextMediaFormat(MediaFormatTextMimeType mimeType, MediaFormatTextType textType)
- : base(MediaFormatType.Text)
- {
- if (!Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
- if (!Enum.IsDefined(typeof(MediaFormatTextType), textType))
- {
- throw new ArgumentException($"Invalid text type value : { (int)textType }");
- }
- MimeType = mimeType;
- TextType = textType;
- }
-
- /// <summary>
- /// Initializes a new instance of the TextMediaFormat class from a native handle.
- /// </summary>
- /// <param name="handle">A native handle.</param>
- internal TextMediaFormat(IntPtr handle)
- : base(MediaFormatType.Text)
- {
- Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
-
- MediaFormatTextMimeType mimeType;
- MediaFormatTextType textType;
-
- GetInfo(handle, out mimeType, out textType);
-
- MimeType = mimeType;
- TextType = textType;
- }
-
- /// <summary>
- /// Retrieves text properties of 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>
- private static void GetInfo(IntPtr handle, out MediaFormatTextMimeType mimeType,
- out MediaFormatTextType textType)
- {
- int mimeTypeValue = 0;
- int textTypeValue = 0;
-
- int ret = Interop.MediaFormat.GetTextInfo(handle, out mimeTypeValue, out textTypeValue);
-
- MultimediaDebug.AssertNoError(ret);
-
- mimeType = (MediaFormatTextMimeType)mimeTypeValue;
- textType = (MediaFormatTextType)textTypeValue;
-
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType),
- "Invalid text mime type!");
- Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextType), textType),
- "Invalid text type!");
- }
-
- internal override void AsNativeHandle(IntPtr handle)
- {
- Debug.Assert(Type == MediaFormatType.Text);
-
- int ret = Interop.MediaFormat.SetTextMimeType(handle, (int)MimeType);
- MultimediaDebug.AssertNoError(ret);
-
- ret = Interop.MediaFormat.SetTextType(handle, (int)TextType);
- MultimediaDebug.AssertNoError(ret);
- }
-
- /// <summary>
- /// Gets the mime type of the current format.
- /// </summary>
- public MediaFormatTextMimeType MimeType { get; }
-
- /// <summary>
- /// Gets the text type of the current format.
- /// </summary>
- public MediaFormatTextType TextType { get; }
-
- public override string ToString()
- {
- return $"MimeType={ MimeType.ToString() }, TextType={ TextType.ToString() }";
- }
-
- public override bool Equals(object obj)
- {
- var rhs = obj as TextMediaFormat;
- if (rhs == null)
- {
- return false;
- }
-
- return MimeType == rhs.MimeType && TextType == rhs.TextType;
- }
-
- public override int GetHashCode()
- {
- return new { MimeType, TextType }.GetHashCode();
- }
- }
}
--- /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.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a packet for multimedia.
+ /// </summary>
+ public abstract partial class MediaPacket : IDisposable
+ {
+ private readonly LockState _lock = new LockState();
+
+ /// <summary>
+ /// Validate 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>
+ private void ValidateNotLocked()
+ {
+ ValidateNotDisposed();
+
+ if (_lock.IsLocked)
+ {
+ throw new InvalidOperationException("Can't perform any writing operation." +
+ "The packet is in use, internally.");
+ }
+ }
+
+ /// <summary>
+ /// Provides a thread-safe lock state controller.
+ /// </summary>
+ private sealed class LockState
+ {
+ const int LOCKED = 1;
+ const int UNLOCKED = 0;
+
+ private int _locked = UNLOCKED;
+
+ internal void SetLock()
+ {
+ if (Interlocked.CompareExchange(ref _locked, LOCKED, UNLOCKED) == LOCKED)
+ {
+ throw new InvalidOperationException("The packet is already locked.");
+ }
+ }
+
+ internal void SetUnlock()
+ {
+ if (Interlocked.CompareExchange(ref _locked, UNLOCKED, LOCKED) == UNLOCKED)
+ {
+ Debug.Fail("The packet to unlock is not locked. " +
+ "There must be an error somewhere that a lock isn't disposed correctly.");
+ }
+ }
+
+ internal bool IsLocked
+ {
+ get
+ {
+ return Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Provides a thread-safe lock controller.
+ /// </summary>
+ /// <example>
+ /// using (var lock = BaseMediaPacket.Lock(mediaPacket))
+ /// {
+ /// ....
+ /// }
+ /// </example>
+ internal sealed class Lock : IDisposable
+ {
+ private readonly MediaPacket _packet;
+ private readonly GCHandle _gcHandle;
+ private int _lockCount;
+
+ internal static Lock Get(MediaPacket packet)
+ {
+ Debug.Assert(packet != null);
+
+ lock (packet)
+ {
+ Lock lck = FromHandle(packet._handle);
+
+ if (lck == null)
+ {
+ lck = new Lock(packet);
+ }
+
+ lck._lockCount++;
+
+ return lck;
+ }
+ }
+
+ private Lock(MediaPacket packet)
+ {
+ Debug.Assert(packet != null, "The packet is null!");
+
+ packet.ValidateNotDisposed();
+
+ _packet = packet;
+
+ _packet._lock.SetLock();
+
+ _gcHandle = GCHandle.Alloc(this);
+
+ SetExtra(GCHandle.ToIntPtr(_gcHandle));
+ }
+
+ internal static Lock FromHandle(IntPtr handle)
+ {
+ Debug.Assert(handle != IntPtr.Zero);
+
+ IntPtr extra = GetExtra(handle);
+
+ if (extra == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ return (Lock)GCHandle.FromIntPtr(extra).Target;
+ }
+
+ private void SetExtra(IntPtr ptr)
+ {
+ int ret = Interop.MediaPacket.SetExtra(_packet._handle, ptr);
+
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ private static IntPtr GetExtra(IntPtr handle)
+ {
+ IntPtr value;
+
+ int ret = Interop.MediaPacket.GetExtra(handle, out value);
+
+ MultimediaDebug.AssertNoError(ret);
+
+ return value;
+ }
+
+ internal IntPtr GetHandle()
+ {
+ return _packet.GetHandle();
+ }
+
+ internal MediaPacket MediaPacket
+ {
+ get
+ {
+ return _packet;
+ }
+ }
+
+ private bool _isDisposed = false;
+
+ public void Dispose()
+ {
+ if (!_isDisposed)
+ {
+ lock (_packet)
+ {
+ _lockCount--;
+
+ if (_lockCount == 0)
+ {
+ SetExtra(IntPtr.Zero);
+
+ if (_gcHandle.IsAllocated)
+ {
+ _gcHandle.Free();
+ }
+
+ //We can assure that at this point '_packet' is always locked by this lock.
+ _packet._lock.SetUnlock();
+ }
+ }
+
+ _isDisposed = true;
+ }
+ }
+ }
+ }
+}
/// <summary>
/// Represents a packet for multimedia.
/// </summary>
- public abstract class MediaPacket : IDisposable
+ public abstract partial class MediaPacket : IDisposable
{
private IntPtr _handle = IntPtr.Zero;
}
/// <summary>
- /// Validate 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>
- private void ValidateNotLocked()
- {
- ValidateNotDisposed();
-
- if (_lock.IsLocked)
- {
- throw new InvalidOperationException("Can't perform any writing operation." +
- "The packet is in use, internally.");
- }
- }
- /// <summary>
/// Ensures whether the packet is writable.
/// </summary>
/// <exception cref="ObjectDisposedException">The MediaPacket already has been disposed of.</exception>
return new MediaPacketBuffer(this, dataHandle, size);
}
- #region Lock operations
- private readonly LockState _lock = new LockState();
-
- /// <summary>
- /// Provides a thread-safe lock state controller.
- /// </summary>
- private sealed class LockState
- {
- const int LOCKED = 1;
- const int UNLOCKED = 0;
-
- private int _locked = UNLOCKED;
-
- internal void SetLock()
- {
- if (Interlocked.CompareExchange(ref _locked, LOCKED, UNLOCKED) == LOCKED)
- {
- throw new InvalidOperationException("The packet is already locked.");
- }
- }
-
- internal void SetUnlock()
- {
- if (Interlocked.CompareExchange(ref _locked, UNLOCKED, LOCKED) == UNLOCKED)
- {
- Debug.Fail("The packet to unlock is not locked. " +
- "There must be an error somewhere that a lock isn't disposed correctly.");
- }
- }
-
- internal bool IsLocked
- {
- get
- {
- return Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED;
- }
- }
- }
-
- /// <summary>
- /// Provides a thread-safe lock controller.
- /// </summary>
- /// <example>
- /// using (var lock = BaseMediaPacket.Lock(mediaPacket))
- /// {
- /// ....
- /// }
- /// </example>
- internal sealed class Lock : IDisposable
- {
- private readonly MediaPacket _packet;
- private readonly GCHandle _gcHandle;
- private int _lockCount;
-
- internal static Lock Get(MediaPacket packet)
- {
- Debug.Assert(packet != null);
-
- lock (packet)
- {
- Lock lck = FromHandle(packet._handle);
-
- if (lck == null)
- {
- lck = new Lock(packet);
- }
-
- lck._lockCount++;
-
- return lck;
- }
- }
-
- private Lock(MediaPacket packet)
- {
- Debug.Assert(packet != null, "The packet is null!");
-
- packet.ValidateNotDisposed();
-
- _packet = packet;
-
- _packet._lock.SetLock();
-
- _gcHandle = GCHandle.Alloc(this);
-
- SetExtra(GCHandle.ToIntPtr(_gcHandle));
- }
-
- internal static Lock FromHandle(IntPtr handle)
- {
- Debug.Assert(handle != IntPtr.Zero);
-
- IntPtr extra = GetExtra(handle);
-
- if (extra == IntPtr.Zero)
- {
- return null;
- }
-
- return (Lock)GCHandle.FromIntPtr(extra).Target;
- }
-
- private void SetExtra(IntPtr ptr)
- {
- int ret = Interop.MediaPacket.SetExtra(_packet._handle, ptr);
-
- MultimediaDebug.AssertNoError(ret);
- }
-
- private static IntPtr GetExtra(IntPtr handle)
- {
- IntPtr value;
-
- int ret = Interop.MediaPacket.GetExtra(handle, out value);
-
- MultimediaDebug.AssertNoError(ret);
-
- return value;
- }
-
- internal IntPtr GetHandle()
- {
- return _packet.GetHandle();
- }
-
- internal MediaPacket MediaPacket
- {
- get
- {
- return _packet;
- }
- }
-
- private bool _isDisposed = false;
-
- public void Dispose()
- {
- if (!_isDisposed)
- {
- lock (_packet)
- {
- _lockCount--;
-
- if (_lockCount == 0)
- {
- SetExtra(IntPtr.Zero);
-
- if (_gcHandle.IsAllocated)
- {
- _gcHandle.Free();
- }
-
- //We can assure that at this point '_packet' is always locked by this lock.
- _packet._lock.SetUnlock();
- }
- }
-
- _isDisposed = true;
- }
- }
- }
- #endregion
-
/// <summary>
/// Creates an object of the MediaPacket with the specified <see cref="MediaFormat"/>.
/// </summary>
--- /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.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a text media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class TextMediaFormat : MediaFormat
+ {
+ /// <summary>
+ /// Initializes a new instance of the TextMediaFormat class with the specified mime type
+ /// and text type.
+ /// </summary>
+ /// <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>
+ public TextMediaFormat(MediaFormatTextMimeType mimeType, MediaFormatTextType textType)
+ : base(MediaFormatType.Text)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (!Enum.IsDefined(typeof(MediaFormatTextType), textType))
+ {
+ throw new ArgumentException($"Invalid text type value : { (int)textType }");
+ }
+ MimeType = mimeType;
+ TextType = textType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the TextMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal TextMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Text)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ MediaFormatTextMimeType mimeType;
+ MediaFormatTextType textType;
+
+ GetInfo(handle, out mimeType, out textType);
+
+ MimeType = mimeType;
+ TextType = textType;
+ }
+
+ /// <summary>
+ /// Retrieves text properties of 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>
+ private static void GetInfo(IntPtr handle, out MediaFormatTextMimeType mimeType,
+ out MediaFormatTextType textType)
+ {
+ int mimeTypeValue = 0;
+ int textTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetTextInfo(handle, out mimeTypeValue, out textTypeValue);
+
+ MultimediaDebug.AssertNoError(ret);
+
+ mimeType = (MediaFormatTextMimeType)mimeTypeValue;
+ textType = (MediaFormatTextType)textTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType),
+ "Invalid text mime type!");
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextType), textType),
+ "Invalid text type!");
+ }
+
+ internal override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Text);
+
+ int ret = Interop.MediaFormat.SetTextMimeType(handle, (int)MimeType);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetTextType(handle, (int)TextType);
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatTextMimeType MimeType { get; }
+
+ /// <summary>
+ /// Gets the text type of the current format.
+ /// </summary>
+ public MediaFormatTextType TextType { get; }
+
+ public override string ToString()
+ {
+ return $"MimeType={ MimeType.ToString() }, TextType={ TextType.ToString() }";
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as TextMediaFormat;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ return MimeType == rhs.MimeType && TextType == rhs.TextType;
+ }
+
+ public override int GetHashCode()
+ {
+ return new { MimeType, TextType }.GetHashCode();
+ }
+ }
+}
--- /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.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a video media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class VideoMediaFormat : MediaFormat
+ {
+ private const int DefaultFrameRate = 0;
+ private const int DefaultBitRate = 0;
+
+ /// <summary>
+ /// 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>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height)
+ : this(mimeType, width, height, DefaultFrameRate)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaFormat class with the specified mime type and size.
+ /// </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>
+ 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.
+ /// </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)
+ : 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.
+ /// </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>
+ 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.
+ /// </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>
+ 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.
+ /// </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>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size,
+ int frameRate, int bitRate)
+ : base(MediaFormatType.Video)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (size.Width < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(size), size.Width, "Size.Width value can't be less than zero.");
+ }
+ if (size.Height < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(size), size.Height, "Size.Height value can't be less than zero.");
+ }
+ if (frameRate < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(frameRate), frameRate, "Frame rate can't be less than zero.");
+ }
+ if (bitRate < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(bitRate), bitRate, "Bit rate value can't be less than zero.");
+ }
+
+ MimeType = mimeType;
+ Size = size;
+ FrameRate = frameRate;
+ BitRate = bitRate;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaForma class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal VideoMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Video)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int width = 0;
+ int height = 0;
+ int bitRate = 0;
+ int frameRate = 0;
+ MediaFormatVideoMimeType mimeType;
+ GetInfo(handle, out width, out height, out bitRate, out mimeType);
+
+ GetFrameRate(handle, out frameRate);
+
+ MimeType = mimeType;
+ Size = new Size(width, height);
+ FrameRate = frameRate;
+ BitRate = bitRate;
+ }
+
+ /// <summary>
+ /// Retrieves video properties of 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>
+ private static void GetInfo(IntPtr handle, out int width, out int height, out int bitRate,
+ out MediaFormatVideoMimeType mimeType)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeTypeValue = 0;
+ int maxBps = 0;
+
+ int ret = Interop.MediaFormat.GetVideoInfo(handle,
+ out mimeTypeValue, out width, out height, out bitRate, out maxBps);
+
+ MultimediaDebug.AssertNoError(ret);
+
+ mimeType = (MediaFormatVideoMimeType)mimeTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType),
+ "Invalid video mime type!");
+ }
+
+ /// <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>
+ private static void GetFrameRate(IntPtr handle, out int frameRate)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int ret = Interop.MediaFormat.GetVideoFrameRate(handle, out frameRate);
+
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ internal override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Video);
+
+ int ret = Interop.MediaFormat.SetVideoMimeType(handle, (int)MimeType);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoWidth(handle, Size.Width);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoHeight(handle, Size.Height);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoAverageBps(handle, BitRate);
+ MultimediaDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoFrameRate(handle, FrameRate);
+ MultimediaDebug.AssertNoError(ret);
+ }
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatVideoMimeType MimeType { get; }
+
+ /// <summary>
+ /// Gets the size of the current format.
+ /// </summary>
+ public Size Size { get; }
+
+ /// <summary>
+ /// Gets the frame rate value of the current format.
+ /// </summary>
+ public int FrameRate { get; }
+
+ /// <summary>
+ /// Gets the bit rate value of the current format.
+ /// </summary>
+ public int BitRate { get; }
+
+ public override string ToString()
+ {
+ return $@"MimeType={ MimeType.ToString() }, Size=({ Size.ToString() }), FrameRate=
+ { FrameRate.ToString() }, BitRate={ BitRate.ToString() }";
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as VideoMediaFormat;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ return MimeType == rhs.MimeType && Size == rhs.Size &&
+ FrameRate == rhs.FrameRate && BitRate == rhs.BitRate;
+ }
+
+ public override int GetHashCode()
+ {
+ return new { MimeType, Size, FrameRate, BitRate }.GetHashCode();
+ }
+ }
+}
+/*
+ * 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 ElmSharp;
namespace Tizen.System
{
/// <summary>
- /// Class for event arguments of the media key.
+ /// The class for event arguments of the media key.
/// </summary>
public class MediaKeyEventArgs : EventArgs
{
/// <summary>
- /// Enumeration for Key value.
+ /// Enumeration for the key value.
/// </summary>
- /// <since_tizen>3</since_tizen>
+ /// <since_tizen> 3 </since_tizen>
public enum KeyValue
{
/// <summary>
- /// Play key.
+ /// The play key.
/// </summary>
Play,
/// <summary>
- /// Stop key.
+ /// The stop key.
/// </summary>
Stop,
/// <summary>
- /// Pause key.
+ /// The pause key.
/// </summary>
Pause,
/// <summary>
- /// Previous key.
+ /// The previous key.
/// </summary>
Previous,
/// <summary>
- /// Next key.
+ /// The next key.
/// </summary>
Next,
/// <summary>
- /// Fast forward key.
+ /// The fast forward key.
/// </summary>
FastForward,
/// <summary>
- /// Rewind key.
+ /// The rewind key.
/// </summary>
Rewind,
/// <summary>
- /// Play-pause key.
+ /// The play-pause key.
/// </summary>
PlayPause,
/// <summary>
- /// Media key for earjack.
+ /// The media key for the earjack.
/// </summary>
Media,
/// <summary>
- /// Unknown key.
+ /// The unknown key.
/// </summary>
Unknown
}
/// <summary>
- /// Enumeration for Key status.
+ /// Enumeration for the key status.
/// </summary>
- /// <since_tizen>3</since_tizen>
+ /// <since_tizen> 3 </since_tizen>
public enum KeyStatus
{
/// <summary>
- /// Pressed status.
+ /// The pressed status.
/// </summary>
Pressed,
/// <summary>
- /// Released status.
+ /// The released status.
/// </summary>
Released,
/// <summary>
- /// Unknown status.
+ /// The unknown status.
/// </summary>
Unknown
}
/// <summary>
- /// Key value.
+ /// The key value.
/// </summary>
- /// <since_tizen>3</since_tizen>
+ /// <since_tizen> 3 </since_tizen>
public KeyValue Value { get; internal set; }
/// <summary>
- /// Key status.
+ /// The key status.
/// </summary>
- /// <since_tizen>3</since_tizen>
+ /// <since_tizen> 3 </since_tizen>
public KeyStatus Status { get; internal set; }
}
/// <summary>
- /// Class for receiving events of media keys.
+ /// The class for receiving events of media keys.
/// </summary>
public static class MediaKey
{
/// <summary>
/// Adds or removes events for all media keys.
/// </summary>
- /// <since_tizen>3</since_tizen>
- /// <exception cref="InvalidOperationException">Failed to reserve or release key.</exception>
+ /// <since_tizen> 3 </since_tizen>
+ /// <exception cref="InvalidOperationException">Failed to reserve or release the key.</exception>
public static event EventHandler<MediaKeyEventArgs> Event
{
add
/// <summary>
-/// Partial Interop Class
+/// Partial interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Partial Libraries Class
+ /// Partial libraries class.
/// </summary>
internal static partial class Libraries
{
using System.Runtime.InteropServices;
/// <summary>
-/// Partial Interop Class
+/// Partial interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Stt Interop Class
+ /// Stt interop class.
/// </summary>
internal static class Stt
{
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This class holds information about the DefaultLanguageChanged Event
+ /// This class holds information about the DefaultLanguageChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class DefaultLanguageChangedEventArgs
}
/// <summary>
- /// The previous language
+ /// The previous language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string PreviousLanguage
}
/// <summary>
- /// The current language
+ /// The current language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string CurrentLanguage
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This class holds information related to Engine Changed Event
+ /// This class holds information related to the EngineChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class EngineChangedEventArgs
}
/// <summary>
- /// Engine Id
+ /// The Engine ID.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string EngineId
}
/// <summary>
- /// Default Language
+ /// The default language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string Language
}
/// <summary>
- /// The necessity of credential
+ /// The necessity of the credential.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool NeedCredential
}
/// <summary>
- /// Whether the silence detection is supported or not
+ /// Whether silence detection is supported or not.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool SupportSilence
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This class holds information related to the STT ErrorOccurred Event
+ /// This class holds information related to the STT ErrorOccurred event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ErrorOccurredEventArgs
}
/// <summary>
- /// The Error Value
+ /// The error value.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public Error ErrorValue
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// string error message
+ /// String error message.
/// </returns>
public string ErrorMessage
{
}
/// <summary>
- /// The result event
+ /// The result event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public ResultEvent Result
}
/// <summary>
- /// Result texts.
+ /// The result text.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public IEnumerable<string> Data
}
/// <summary>
- /// Returns the Result text count.
+ /// Returns the result text count.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int DataCount
}
/// <summary>
- /// Engine message
+ /// The engine message.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public ResultMessage Message
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This Class represents the result of recognition result from the engine.
+ /// This class represents the result of recognition result from the engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ResultTime
}
/// <summary>
- /// The result index
+ /// The result index.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int Index
}
/// <summary>
- /// The token event
+ /// The token event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public TimeEvent TokenEvent
}
/// <summary>
- /// The result text
+ /// The result text.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string Text
}
/// <summary>
- /// The start time of result text
+ /// The start time of result text.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public long StartTime
}
/// <summary>
- /// The end time of result text
+ /// The end time of result text.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public long EndTime
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This class holds information related to the STT StateChanged event
+ /// This class holds information related to the STT StateChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class StateChangedEventArgs
}
/// <summary>
- /// A previous state
+ /// The previous state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public State Previous
internal set;
}
/// <summary>
- /// A current state
+ /// The current state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public State Current
namespace Tizen.Uix.Stt
{
/// <summary>
- /// The token event
+ /// The token event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum ResultEvent
{
/// <summary>
- /// Event when the recognition full or last result is ready
+ /// Event when the recognition for full or last result is ready.
/// </summary>
/// <since_tizen> 3 </since_tizen>
FinalResult = 0,
/// <summary>
- /// Event when the recognition partial result is ready
+ /// Event when the recognition for partial result is ready.
/// </summary>
/// <since_tizen> 3 </since_tizen>
PartialResult,
/// <summary>
- /// Event when the recognition has failed
+ /// Event when the recognition has failed.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Error
};
/// <summary>
- /// Enumeration representing the result message
+ /// Enumeration for representing the result message.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum ResultMessage
{
/// <summary>
- /// No Error
+ /// No Error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
None,
};
/// <summary>
- /// Enumeration for the Token type
+ /// Enumeration for the token types.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum TimeEvent
{
/// <summary>
- /// Event when the token is beginning type
+ /// Event when the token is beginning type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Beginning = 0,
/// <summary>
- /// Event when the token is middle type
+ /// Event when the token is middle type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Middle = 1,
/// <summary>
- /// Event when the token is end type
+ /// Event when the token is end type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
End = 2
};
/// <summary>
- /// Enum for Error values that can occur
+ /// Enumeration for the error values that can occur.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum Error
{
/// <summary>
- /// Successful, No error
+ /// Successful, No error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
None,
/// <summary>
- /// Out of Memory
+ /// Out of Memory.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
+ /// <since_tizen> 3 </since_tizen>.
OutOfMemory,
/// <summary>
- /// I/O error
+ /// I/O error.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
+ /// <since_tizen> 3 </since_tizen>.
IoError,
/// <summary>
- /// Invalid parameter
+ /// Invalid parameter.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InvalidParameter,
/// <summary>
- /// No answer from the STT service
+ /// No answer from the STT service.
/// </summary>
/// <since_tizen> 3 </since_tizen>
TimedOut,
/// <summary>
- /// Device or resource busy
+ /// Device or resource busy.
/// </summary>
/// <since_tizen> 3 </since_tizen>
RecorderBusy,
/// <summary>
- /// Network is down
+ /// Network is down.
/// </summary>
/// <since_tizen> 3 </since_tizen>
OutOfNetwork,
/// <summary>
- /// Permission denied
+ /// Permission denied.
/// </summary>
/// <since_tizen> 3 </since_tizen>
PermissionDenied,
/// <summary>
- /// STT NOT supported
+ /// STT NOT supported.
/// </summary>
/// <since_tizen> 3 </since_tizen>
NotSupported,
/// <summary>
- /// Invalid state
+ /// Invalid state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InvalidState,
/// <summary>
- /// Invalid language
+ /// Invalid language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InvalidLanguage,
/// <summary>
- /// No available engine
+ /// No available engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
EngineNotFound,
/// <summary>
- /// Operation failed
+ /// Operation failed.
/// </summary>
/// <since_tizen> 3 </since_tizen>
OperationFailed,
/// <summary>
- /// Not supported feature of current engine
+ /// Not supported feature of current engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
NotSupportedFeature,
/// <summary>
- /// Recording timed out
+ /// Recording timed out.
/// </summary>
/// <since_tizen> 3 </since_tizen>
RecordingTimedOut,
/// <summary>
- /// No speech while recording
+ /// No speech while recording.
/// </summary>
/// <since_tizen> 3 </since_tizen>
NoSpeech,
/// <summary>
- /// Progress to ready is not finished
+ /// Progress to ready is not finished.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InProgressToReady,
/// <summary>
- /// Progress to recording is not finished
+ /// Progress to recording is not finished.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InProgressToRecording,
/// <summary>
- /// Progress to processing is not finished
+ /// Progress to processing is not finished.
/// </summary>
/// <since_tizen> 3 </since_tizen>
InProgressToProcessing,
/// <summary>
- /// Service reset
+ /// Service reset.
/// </summary>
/// <since_tizen> 3 </since_tizen>
ServiceReset
};
/// <summary>
- /// Enumeration for Recognition Types
+ /// Enumeration for the recognition types.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum RecognitionType
{
/// <summary>
- /// Free form dictation
+ /// Free form dictation.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Free,
/// <since_tizen> 3 </since_tizen>
Partial,
/// <summary>
- /// Search
+ /// Search.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Search,
/// <summary>
- /// Web Search
+ /// Web search.
/// </summary>
/// <since_tizen> 3 </since_tizen>
WebSearch,
/// <summary>
- /// Map
+ /// Map.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Map
};
/// <summary>
- /// Enumeration for the State types
+ /// Enumeration for the state types.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum State
{
/// <summary>
- /// Created state
+ /// Created state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Created = 0,
/// <summary>
- /// Ready state
+ /// Ready state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Ready = 1,
/// <summary>
- /// Recording state
+ /// Recording state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Recording = 2,
/// <summary>
- /// Processing state
+ /// Processing state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Processing = 3,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Unavailable
};
/// <summary>
- /// Enumeration for the Silence Detection types
+ /// Enumeration for the silence detection types.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum SilenceDetection
{
/// <summary>
- /// Silence detection type - False
+ /// Silence detection type - False.
/// </summary>
/// <since_tizen> 3 </since_tizen>
False = 0,
/// <summary>
- /// Silence detection type - True
+ /// Silence detection type - True.
/// </summary>
/// <since_tizen> 3 </since_tizen>
True = 1,
/// <summary>
- /// Silence detection type - Auto
+ /// Silence detection type - Auto.
/// </summary>
/// <since_tizen> 3 </since_tizen>
Auto = 2
/// <summary>
/// A main function of Speech-To-Text (below STT) API recognizes sound data recorded by users.
- /// After choosing a language, applications will start recording and recognizing.
+ /// After choosing a language, the applications will start recording and recognizing.
/// After recording, the applications will receive the recognized result.
/// The STT has a client-server for the service of multi-applications.
- /// The STT service always works in the background as a server. If the service is not working, client library will invoke it and client will communicate with it.
- /// The service has engines and the recorder so client does not have the recorder itself. Only the client request commands to the STT service for using STT.
+ /// The STT service always works in the background as a server. If the service is not working, client library will invoke it and the client will communicate with it.
+ /// The service has engines and a recorder, so that the client does not have the recorder itself. Only the client request commands to the STT service for using STT.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class SttClient : IDisposable
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out of Memory. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public SttClient()
{
IntPtr handle;
}
/// <summary>
- /// Event to be invoked when STT state changes.
+ /// Event to be invoked when the STT state changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler<StateChangedEventArgs> StateChanged
}
/// <summary>
- /// Event to be invoked when default language change.
+ /// Event to be invoked when the default language changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler<DefaultLanguageChangedEventArgs> DefaultLanguageChanged
}
/// <summary>
- /// Event to be invoked to detect engine change.
+ /// Event to be invoked to detect the engine change.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler<EngineChangedEventArgs> EngineChanged
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <pre>
- /// The State must be Recording.
+ /// The state must be recording.
/// </pre>
public float RecordingVolume
{
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <returns>
- /// Current STT State value.
+ /// Current STT state value.
/// </returns>
public State CurrentState
{
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <exception cref="InvalidOperationException">
- /// This Exception can occur while setting due to the following reasons
+ /// This exceptioncan occur while setting due to the following reasons:
/// 1. Operation Failed
/// 2. Invalid State
/// </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out of Memory. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="ArgumentException"> This can happen if Improper EngineId is provided while setting the value. </exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This can happen if improper EngineId is provided while setting the value.</exception>
/// <pre>
- /// The State must be Created.
+ /// The state must be created.
/// </pre>
public string Engine
{
}
/// <summary>
- /// Retrieves the time stamp of the current recognition result
+ /// Retrieves the time stamp of the current recognition result.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// list of ResultTime
+ /// List of ResultTime.
/// </returns>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// http://tizen.org/feature/microphone
/// </feature>
/// <remarks>
- /// This function should only be called in RecognitionResult Event
+ /// This function should only be called in the RecognitionResult event.
/// </remarks>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public IEnumerable<ResultTime> GetDetailedResult()
{
List<ResultTime> list = new List<ResultTime>();
/// <summary>
- /// Gets the private data from stt engine.
+ /// Gets the private data from the STT engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="key">
- /// The key string
+ /// The key string.
/// </param>
/// <returns>
- /// The Data Corresponding to the Key provided
+ /// The data corresponding to the key is provided.
/// </returns>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="TimeoutException"> This Exception can be due to No Answer from STT Service. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to invalid state.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="TimeoutException">This exception can be due to No Answer from STT Service.</exception>
/// <pre>
- /// The State must be Ready.
+ /// The state must be ready.
/// </pre>
public string GetPrivateData(string key)
{
}
/// <summary>
- /// Sets the private data to stt engine.
+ /// Sets the private data to the STT engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="key">
- /// The key string
+ /// The key string.
/// </param>
/// <param name="data">
- /// The data string
+ /// The data string.
/// </param>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="TimeoutException"> This Exception can be due to No Answer from STT Service. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to invalid state.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="TimeoutException">This exception can be due to No Answer from STT Service.</exception>
/// <exception cref="ArgumentException"> This can happen if Improper value is provided while setting the value. </exception>
/// <pre>
- /// The State must be Ready.
+ /// The state must be ready.
/// </pre>
public void SetPrivateData(string key, string data)
{
}
/// <summary>
- /// Gets the list of Supported Engine
+ /// Gets the list of supported engines.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// IEnumerable<SupportedEngine> list of supported engines
+ /// IEnumerable<SupportedEngine> list of supported engines.
/// </returns>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out of Memory. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public IEnumerable<SupportedEngine> GetSupportedEngines()
{
List<SupportedEngine> engineList = new List<SupportedEngine>();
}
/// <summary>
- /// Sets the app credential
+ /// Sets the application credential.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="credential">
- /// The credential string
+ /// The credential string.
/// </param>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
+ /// This exceptioncan be due to the following reasons:
/// 1. Operation Failed
/// 2. Invalid State
/// </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out of Memory. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <exception cref="ArgumentException"> This can happen if Improper value is provided while setting the value. </exception>
/// <pre>
- /// The State must be Created.
+ /// The state must be created.
/// </pre>
public void SetCredential(string credential)
{
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to invalid state.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State must be Created.
+ /// The state must be created.
/// </pre>
/// <post>
- /// If this function is successful, the STT state will be Ready
- /// If this function is unsuccessful, ErrorOccurred event will be invoked
+ /// If this function is successful, the STT state will be ready.
+ /// If this function is unsuccessful, ErrorOccurred event will be invoked.
/// </post>
public void Prepare()
{
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to invalid state.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State must be Ready.
+ /// The state must be ready.
/// </pre>
/// <post>
- /// If this function is successful, the STT state will be Created
+ /// If this function is successful, the STT state will be Created.
/// </post>
public void Unprepare()
{
}
/// <summary>
- /// Retrieves all supported languages of current engine.
+ /// Retrieves all the supported languages of the current engine.
/// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.
/// For example, "ko_KR" for Korean, "en_US" for American English.
/// </summary>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <returns>
- /// list of strings of supported languages.
+ /// List of strings for supported languages.
/// </returns>
/// <feature>
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
+ /// This exception can be due to the following reasons:
/// 1. Engine Not Found.
/// 2. Operation Failed.
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public IEnumerable<string> GetSupportedLanguages()
{
List<string> languageList = new List<string>();
/// RecognitionType value.
/// </param>
/// <returns>
- /// bool value indicating whether the recognition type is supported.
+ /// Bool value indicating whether the recognition type is supported.
/// </returns>
/// <feature>
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
+ /// This exception can be due to the following reasons:
/// 1. Invalid State
- /// 2. Engine Not Found.
- /// 3. Operation Failed.
+ /// 2. Engine Not Found
+ /// 3. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public bool IsRecognitionTypeSupported(RecognitionType type)
{
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
+ /// This exception can be due to the following reasons:
/// 1. Invalid State
- /// 2. Not supported feature of current engine.
- /// 3. Operation Failed.
+ /// 2. Not supported feature of current engine
+ /// 3. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public void SetSilenceDetection(SilenceDetection type)
{
/// <summary>
/// Sets the sound to start recording.
- /// Sound file type should be wav type.
+ /// Sound file type should be .wav type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="filePath">
- /// File Path for the sound.
+ /// File path for the sound.
/// </param>
/// <feature>
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <exception cref="ArgumentException"> If an Invalid Parameter is provided. </exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public void SetStartSound(string filePath)
{
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public void UnsetStartSound()
{
/// <summary>
/// Sets the sound to stop recording.
- /// Sound file type should be wav type.
+ /// Sound file type should be .wav type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="ArgumentException"> If an Invalid Parameter is provided. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to Invalid Parameter.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public void SetStopSound(string filePath)
{
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException"> his exception can be due to permission denied.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
public void UnsetStopSound()
{
}
/// <summary>
- /// Starts recording and recognition asynchronously.
- /// This function starts recording in the STT service and sending recording data to engine.
- /// This work continues until Stop, Cancel or silence detected by engine
+ /// Starts the recording and recognition asynchronously.
+ /// This function starts recording in the STT service and sends the recording data to the engine.
+ /// This work continues until stop, cancel, or silence is detected by engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="language">
- /// The language selected
+ /// The language selected.
/// </param>
/// <param name="type">
- /// The type for recognition
+ /// The type for recognition.
/// </param>
/// <feature>
/// http://tizen.org/feature/speech.recognition
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
- /// 3. Recorder Busy.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Recorder Busy
/// 4. Progress to recording is not finished
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="ArgumentException"> If an Invalid Language is provided. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid language.</exception>
/// <pre>
- /// The state should be Ready.
+ /// The state should be ready.
/// </pre>
/// <post>
- /// It will invoke StateChanged Event if registered.
- /// If this function succeeds, the STT state will be Recording.
- /// If you call this function again before state changes, you will receive ErrorINProgressToRecording.
+ /// It will invoke the StateChanged event, if registered.
+ /// If this function succeeds, the STT state will be recording.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToRecording.
/// </post>
public void Start(string language, RecognitionType type)
{
}
/// <summary>
- /// Finishes the recording and starts recognition processing in engine asynchronously.
+ /// Finishes the recording and starts recognition processing in the engine asynchronously.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
- /// 3. Progress to ready is not finished.
- /// 4. Progress to recording is not finished.
- /// 5. Progress to processing is not finished.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Progress to ready is not finished
+ /// 4. Progress to recording is not finished
+ /// 5. Progress to processing is not finished
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
/// The state should be Recording.
/// </pre>
/// <post>
- /// It will invoke StateChanged Event if registered.
- /// If this function succeeds, the STT state will be Processing.
- /// If you call this function again before state changes, you will receive ErrorINProgressToProcessing.
- /// After processing of engine, RecognitionResult event is invoked
+ /// It will invoke the StateChanged Event, if registered.
+ /// If this function succeeds, the STT state will be processing.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToProcessing.
+ /// After processing of engine, the RecognitionResult event is invoked.
/// </post>
public void Stop()
{
}
/// <summary>
- /// Cancels processing recognition and recording asynchronously.
- /// This function cancels recording and engine cancels recognition processing.
- /// After successful cancel, StateChanged event is invoked otherwise if error is occurred, ErrorOccurred event is invoked.
+ /// Cancels processing the recognition and recording asynchronously.
+ /// This function cancels recording and the engine cancels recognition processing.
+ /// After successful cancellation, the StateChanged event is invoked, otherwise if an error is occurs, the ErrorOccurred event is invoked.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. Invalid State.
- /// 2. Operation Failed.
- /// 3. Progress to ready is not finished.
- /// 4. Progress to recording is not finished.
- /// 5. Progress to processing is not finished.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Progress to ready is not finished
+ /// 4. Progress to recording is not finished
+ /// 5. Progress to processing is not finished
/// </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
/// The state should be Recording or Processing.
/// </pre>
/// <post>
- /// It will invoke StateChanged Event if registered.
- /// If this function succeeds, the STT state will be Ready.
- /// If you call this function again before state changes, you will receive ErrorINProgressToReady.
+ /// It will invoke the StateChanged event, if registered.
+ /// If this function succeeds, the STT state will be ready.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToReady.
/// </post>
public void Cancel()
{
}
/// <summary>
- /// Method to release resources
+ /// A method to release resources.
/// </summary>
public void Dispose()
{
namespace Tizen.Uix.Stt
{
/// <summary>
- /// This Class provideds the Information related to STT Engine.
+ /// This class provides the information related to STT engine.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class SupportedEngine
this._engineName = name;
}
/// <summary>
- /// The Engine Id
+ /// The engine ID.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// The string Engine Id
+ /// The string engine ID.
/// </returns>
public string EngineId
{
}
/// <summary>
- /// The Engine Name
+ /// The engine name.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// The string Engine Name
+ /// The string engine name.
/// </returns>
public string EngineName
{
*/
/// <summary>
-/// Partial Interop Class
+/// Partial interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Partial Libraries Class
+ /// Partial libraries class.
/// </summary>
internal static partial class Libraries
{
using static Interop.VoiceControlCommand;
/// <summary>
-/// Partial Interop Class
+/// Partial interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// VoiceControl Interop Class
+ /// VoiceControl interop class.
/// </summary>
internal static class VoiceControl
{
-/*
+/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
using Tizen.Uix.VoiceControl;
/// <summary>
-/// Partial Interop Class
+/// Partial interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// VoiceControlCommand Interop Class
+ /// VoiceControlCommand interop class.
/// </summary>
internal static class VoiceControlCommand
{
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// This class holds information about the CurrentLanguageChanged Event
+ /// This class holds information about the CurrentLanguageChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class CurrentLanguageChangedEventArgs
}
/// <summary>
- /// The previous language
+ /// The previous language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string PreviousLanguage
}
/// <summary>
- /// The current language
+ /// The current language.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string CurrentLanguage
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// This class holds information related to the VoiceControl ErrorOccured Event
+ /// This class holds information related to the VoiceControl ErrorOccured event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ErrorOccuredEventArgs
}
/// <summary>
- /// The Error Value
+ /// The error value.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public Error ErrorValue
{
/// <summary>
/// The recognition result from the engine.
- /// If the duplicated commands are recognized, the event(e.g. Result.Rejected) of command may be rejected
- /// for selecting command as priority.If you set similar or same commands or the recognized results are multi-results, CommandList has the multi commands.
+ /// If the duplicated commands are recognized, the event(e.g. Result.Rejected) of a command may be rejected
+ /// for selecting the command as a priority. If you set similar or same commands, or the recognized results are multi-results, the CommandList has multi commands.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class RecognitionResult
}
/// <summary>
- /// The result event
+ /// The result event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public ResultEvent Result
}
/// <summary>
- /// The spoken text
+ /// The spoken text.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string ResultMessage
/// <summary>
- /// The recognized command list
+ /// The recognized command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public VoiceCommandList CommandList
}
/// <summary>
- /// Gets the Recognition result
+ /// Gets the recognition result.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public RecognitionResult Result
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// This class holds information related to the VoiceControl service ServiceStateChanged event
+ /// This class holds information related to the VoiceControl service ServiceStateChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ServiceStateChangedEventArgs
}
/// <summary>
- /// A previous state
+ /// The previous state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public ServiceState Previous
}
/// <summary>
- /// A current state
+ /// The current state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public ServiceState Current
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// This class holds information related to the VoiceControl client StateChanged event
+ /// This class holds information related to the VoiceControl client StateChanged event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class StateChangedEventArgs
}
/// <summary>
- /// A previous state
+ /// The previous state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public State Previous
}
/// <summary>
- /// A current state
+ /// The current state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public State Current
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// Enumeration for Command Format
+ /// Enumeration for the command format.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum CommandFormat
{
/// <summary>
- /// fixed command format.
+ /// The fixed command format.
/// </summary>
Fixed = 0,
/// <summary>
- /// fixed and variable fixed command format.
+ /// The fixed and variable fixed command format.
/// </summary>
FixedAndVFixed = 1,
/// <summary>
- /// variable fixed and fixed command format.
+ /// The variable fixed and fixed command format.
/// </summary>
VFixedAndFixed = 2,
/// <summary>
- /// fixed and non-fixed command format.
+ /// The fixed and non-fixed command format.
/// </summary>
FixedAndNonFixed = 3,
/// <summary>
- /// non-fixed and fixed command format.
+ /// The non-fixed and fixed command format.
/// </summary>
NonFixedAndFixed = 4,
/// <summary>
- /// Undefined
+ /// Undefined.
/// </summary>
Undefined = 5
};
/// <summary>
- /// This class represents a Voice Command
+ /// This class represents a voice command.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class VoiceCommand
internal SafeCommandHandle _handle;
/// <summary>
- /// Public Constructor
+ /// The public constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out Of Memory. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out Of memory.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public VoiceCommand()
{
SafeCommandHandle handle;
/// <summary>
/// Gets the unfixed command.
/// This property should be used for commands which have non-fixed format.
- /// empty string will be returned in case of some internal error
+ /// An empty string will be returned in case of some internal error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string UnfixedCommand
}
/// <summary>
- /// Gets/Sets command type.
+ /// Gets or sets the command type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <remarks>If you do not set the command type, the default value is Undefined. You should set type if command is valid</remarks>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <remarks>If you do not set the command type, the default value is undefined. You should set the type if the command is valid.</remarks>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public CommandType Type
{
get
}
/// <summary>
- /// Gets/Sets the command format.
+ /// Gets or sets the command format.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <remarks>The default format is Fixed</remarks>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <remarks>The default format is Fixed.</remarks>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public CommandFormat Format
{
get
}
/// <summary>
- /// Gets/Sets command
- /// in case of get empty string will be returned in case of some internal error
+ /// Gets or sets the command.
+ /// A get empty string will be returned in case of some internal error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public string Command
{
get
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// this class represents list of Voice Commands
+ /// This class represents a list of the voice commands.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class VoiceCommandList
internal SafeCommandListHandle _handle;
private List<VoiceCommand> _list;
private VcCmdListCb _callback;
+ private int _index;
/// <summary>
- /// Public Constructor
+ /// The public constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out of memory. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public VoiceCommandList()
{
SafeCommandListHandle handle;
throw ExceptionFactory.CreateException(error);
}
_handle = handle;
+ _list = new List<VoiceCommand>();
+ _index = 0;
}
internal VoiceCommandList(SafeCommandListHandle handle)
{
_handle = handle;
+ _index = 0;
+
+ _list = new List<VoiceCommand>();
+ _callback = (IntPtr vcCommand, IntPtr userData) =>
+ {
+ SafeCommandHandle cmdHandle = new SafeCommandHandle(vcCommand);
+ cmdHandle._ownership = false;
+ _list.Add(new VoiceCommand(cmdHandle));
+ return true;
+ };
+ ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "GetAllCommands Failed with error " + error);
+ throw ExceptionFactory.CreateException(error);
+ }
}
/// <summary>
- /// Gets command count of list.
- /// -1 is returned in case of internal failure.
+ /// Gets a command count of the list.
+ /// -1 is returned in case of an internal failure.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// Command counts of the list.
+ /// Command count of the list.
/// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
}
/// <summary>
- /// Get current command from command list by index.
- /// null will be returned in case of Empty List
+ /// Gets the current command from the command list by index.
+ /// Null will be returned in case of an empty list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
{
SafeCommandHandle current;
ErrorCode error = VcCmdListGetCurrent(_handle, out current);
- if (error != ErrorCode.None)
+ if (ErrorCode.None != error)
{
Log.Error(LogTag, "Current Failed with error " + error);
return null;
}
- current._ownership = false;
- return new VoiceCommand(current);
+
+ return _list[_index];
}
}
/// <summary>
- /// Adds command to command list.
+ /// Adds a command to the command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <param name="command">The command</param>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="NullReferenceException"> This will occur if the provide parameter is null. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="NullReferenceException">This will occur if the provided parameter is null.</exception>
public void Add(VoiceCommand command)
{
ErrorCode error = VcCmdListAdd(_handle, command._handle);
Log.Error(LogTag, "Add Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+
+ _list.Add(command);
}
/// <summary>
- /// Removes command from command list.
+ /// Removes a command from the command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <param name="command">The command</param>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="NullReferenceException"> This will occur if the provide parameter is null. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="NullReferenceException">This will occur if the provided parameter is null.</exception>
public void Remove(VoiceCommand command)
{
ErrorCode error = VcCmdListRemove(_handle, command._handle);
Log.Error(LogTag, "Remove Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+
+ _list.Remove(command);
}
/// <summary>
- /// Retrieves all commands of command list.
+ /// Retrieves all commands from the command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public IEnumerable<VoiceCommand> GetAllCommands()
{
- _list = new List<VoiceCommand>();
+ List<VoiceCommand> commandList = new List<VoiceCommand>();
_callback = (IntPtr vcCommand, IntPtr userData) =>
{
SafeCommandHandle handle = new SafeCommandHandle(vcCommand);
handle._ownership = false;
- _list.Add(new VoiceCommand(handle));
+ commandList.Add(new VoiceCommand(handle));
return true;
};
ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero);
}
/// <summary>
- /// Moves index to first command.
+ /// Moves an index to the first command.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to List Empty. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to list empty.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public void First()
{
ErrorCode error = VcCmdListFirst(_handle);
- if (error != ErrorCode.None)
+ if (ErrorCode.None != error)
{
Log.Error(LogTag, "First Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+ _index = 0;
}
/// <summary>
- /// Moves index to last command.
+ /// Moves an index to the last command.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to List Empty. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to list empty.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public void Last()
{
ErrorCode error = VcCmdListLast(_handle);
- if (error != ErrorCode.None)
+ if (ErrorCode.None != error)
{
Log.Error(LogTag, "Last Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+ _index = Count - 1;
}
/// <summary>
- /// Moves index to next command.
+ /// Moves an index to the next command.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. List Empty
+ /// This exception can be due to the following reasons:
+ /// 1. List empty
/// 2. List reached end
/// </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public void Next()
{
ErrorCode error = VcCmdListNext(_handle);
- if (error != ErrorCode.None)
+ if (ErrorCode.None != error)
{
Log.Error(LogTag, "Next Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+ _index++;
}
/// <summary>
- /// Moves index to previous command.
+ /// Moves an index to the previous command.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. List Empty
+ /// This exception can be due to the following reasons:
+ /// 1. List empty
/// 2. List reached end
/// </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
public void Previous()
{
ErrorCode error = VcCmdListPrev(_handle);
- if (error != ErrorCode.None)
+ if (ErrorCode.None != error)
{
Log.Error(LogTag, "Previous Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+ _index--;
}
}
}
namespace Tizen.Uix.VoiceControl
{
/// <summary>
- /// Enum for Error values that can occur
+ /// Enumeration for the error values that can occur.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum Error
{
/// <summary>
- /// Successful, No error
+ /// Successful, no error.
/// </summary>
None,
/// <summary>
- /// Out of Memory
+ /// Out of memory.
/// </summary>
OutOfMemory,
/// <summary>
- /// I/O error
+ /// I/O error.
/// </summary>
IoError,
/// <summary>
- /// Invalid parameter
+ /// Invalid parameter.
/// </summary>
InvalidParameter,
/// <summary>
- /// No answer from the STT service
+ /// No answer from the STT service.
/// </summary>
TimedOut,
/// <summary>
- /// Device or resource busy
+ /// Device or resource busy.
/// </summary>
RecorderBusy,
/// <summary>
- /// Permission denied
+ /// Permission denied.
/// </summary>
PermissionDenied,
/// <summary>
- /// VC NOT supported
+ /// VC NOT supported.
/// </summary>
NotSupported,
/// <summary>
- /// Invalid state
+ /// Invalid state.
/// </summary>
InvalidState,
/// <summary>
- /// Invalid language
+ /// Invalid language.
/// </summary>
InvalidLanguage,
/// <summary>
- /// No available engine
+ /// No available engine.
/// </summary>
EngineNotFound,
/// <summary>
- /// Operation failed
+ /// Operation failed.
/// </summary>
OperationFailed,
/// <summary>
- /// Operation Rejected
+ /// Operation rejected.
/// </summary>
OperationRejected,
/// <summary>
- /// List reached end
+ /// List reached end.
/// </summary>
IterationEnd,
/// <summary>
- /// List Empty
+ /// List empty.
/// </summary>
Empty,
/// <summary>
- /// Service reset
+ /// Service reset.
/// </summary>
ServiceReset,
/// <summary>
- /// Progress to ready is not finished
+ /// Progress to ready is not finished.
/// </summary>
InProgressToReady,
/// <summary>
- /// Progress to recording is not finished
+ /// Progress to recording is not finished.
/// </summary>
InProgressToRecording,
/// <summary>
- /// Progress to processing is not finished
+ /// Progress to processing is not finished.
/// </summary>
InProgressToProcessing
};
public enum State
{
/// <summary>
- /// 'None' state
+ /// 'None' state.
/// </summary>
None = 0,
/// <summary>
- /// 'Initialized' state
+ /// 'Initialized' state.
/// </summary>
Initialized = 1,
/// <summary>
- /// 'Ready' state
+ /// 'Ready' state.
/// </summary>
Ready = 2,
/// <summary>
- /// state cannot be determined
+ /// The state cannot be determined.
/// </summary>
Unavailable
};
/// <summary>
- /// Enumerations of service state.
+ /// Enumeration for the service state.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum ServiceState
{
/// <summary>
- /// 'None' state
+ /// 'None' state.
/// </summary>
None = 0,
/// <summary>
- /// 'Ready' state
+ /// 'Ready' state.
/// </summary>
Ready = 1,
/// <summary>
- /// 'Recording' state
+ /// 'Recording' state.
/// </summary>
Recording = 2,
/// <summary>
- /// 'Processing' state
+ /// 'Processing' state.
/// </summary>
Processing = 3,
/// <summary>
- /// state cannot be determined
+ /// The state cannot be determined.
/// </summary>
Unavailable
};
/// <summary>
- /// Enumerations of result event.
+ /// Enumeration for the result event.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum ResultEvent
{
/// <summary>
- /// Normal result
+ /// Normal result.
/// </summary>
Success = 0,
/// <summary>
- /// Rejected result
+ /// Rejected result.
/// </summary>
Rejected = 1
};
/// <summary>
- /// Enumerations of command type.
+ /// Enumeration for the command type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public enum CommandType
{
/// <summary>
- /// Foreground command by client
+ /// Foreground command by the client.
/// </summary>
Foreground = 1,
/// <summary>
- /// Background command by client
+ /// Background command by the client.
/// </summary>
Background = 2,
/// <summary>
- /// Undefined command
+ /// The undefined command.
/// </summary>
Undefined = -1
};
/// <summary>
- /// A main function of Voice Control API register command and gets notification for recognition result.
- /// Applications can add their own commands and be provided result when their command is recognized by user voice input.
+ /// A main function of the voice control API registers the command and gets a notification for the recognition result.
+ /// Applications can add their own commands and provide results when their command is recognized by the user voice input.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static class VoiceControlClient
{
- /// <summary>
- /// Called when client gets the recognition result.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <remarks>
- /// If the duplicated commands are recognized, the event(e.g. Result.Rejected) of command may be rejected
- /// for selecting command as priority.If you set similar or same commands or the recognized results are multi-results, cmdList has the multi commands.
- /// </remarks>
- /// <param name="evt">The ResultEvent</param>
- /// <param name="cmdList">Command List</param>
- /// <param name="result">Result</param>
-
private static event EventHandler<RecognitionResultEventArgs> _recognitionResult;
private static event EventHandler<StateChangedEventArgs> _stateChanged;
private static event EventHandler<ServiceStateChangedEventArgs> _serviceStateChanged;
private static RecognitionResult s_recognitionResult;
/// <summary>
- /// Gets current language.
+ /// Gets the current language.
/// A language is specified as an ISO 3166 alpha-2 two letter country-code
/// followed by ISO 639-1 for the two-letter language code.
/// For example, "ko_KR" for Korean, "en_US" for American English.
- /// Empty string is returned incase of some internal error
+ /// An empty string is returned in case of some internal error.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// Current language in voice control.
+ /// The current language in voice control.
/// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <pre>
- /// The State must be Initialized or Ready.
+ /// The state must be initialized or ready.
/// </pre>
public static string CurrentLanguage
{
}
/// <summary>
- /// Gets current state of voice control client.
+ /// Gets the current state of the voice control client.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// Current state of voice control client.
+ /// The current state of the voice control client.
/// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <pre>
- /// The State must be Initialized or Ready.
+ /// The state must be initialized or ready.
/// </pre>
public static State State
{
}
/// <summary>
- /// Gets current state of voice control service.
+ /// Gets the current state of the voice control service.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// Current state of voice control service.
+ /// The current state of the voice control service.
/// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <pre>
- /// The State must be Ready.
+ /// The state must be ready.
/// </pre>
public static ServiceState ServiceState
{
/// http://tizen.org/feature/microphone
/// </feature>
/// <remarks>
- /// Invocation name is used to activate background commands. The invocation name can be the same as the application name or any other phrase.
+ /// The invocation name is used to activate background commands. The invocation name can be same as the application name or any other phrase.
/// For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample".
/// In order to activate the background command, users can say "Tizen Sample, Play music". The invocation name is dependent on the current language.
/// For example, if the current language is "en_US"(English), the invocation name is also "en_US".
/// If the current language is "ja_JP"(Japanese) and the invocation name is "en_US", the invocation name will not be recognized.
- /// This function should be called before SetCommandList().
+ /// This function should be called before the SetCommandList().
/// </remarks>
- /// <param name="name">Invocation name that an application wants to be invoked by</param>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <param name="name">Invocation name to be invoked by an application.</param>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State must be Ready.
+ /// The state must be ready.
/// </pre>
public static void SetInvocationName(string name)
{
}
/// <summary>
- /// Initializes voice control.
+ /// Initializes the voice control.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="OutOfMemoryException"> This Exception can be due to Out Of Memory. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out Of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <post>
- /// The State will be Initialized.
+ /// The state will be initialized.
/// </post>
public static void Initialize()
{
}
/// <summary>
- /// Deinitializes voice control.
+ /// Deinitializes the voice control.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public static void Deinitialize()
{
ErrorCode error = VcDeinitialize();
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
/// <post>
- /// The State will be Ready
+ /// The state must be ready.
/// </post>
public static void Prepare()
{
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready
+ /// The state must be ready.
/// </pre>
/// <post>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </post>
public static void Unprepare()
{
}
/// <summary>
- /// Retrieves all supported languages.
+ /// Retrieves all the supported languages.
/// A language is specified as an ISO 3166 alpha-2 two letter country-code
/// followed by ISO 639-1 for the two-letter language code.
/// For example, "ko_KR" for Korean, "en_US" for American English.
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready or Initialized
+ /// The state must be ready or initialized.
/// </pre>
public static IEnumerable<string> GetSupportedLanguages()
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// The Command List else null in case of no System Commands
+ /// The command list, else null in case of no system commands.
/// </returns>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <privlevel>
- /// public
+ /// public.
/// </privlevel>
/// <feature>
/// http://tizen.org/feature/speech.control
/// </feature>
/// <remarks>
/// In the system command list, there are system commands predefined by product manufacturers.
- /// Those commands have the highest priority. Therefore, the user can not set any commands same with the system commands.
+ /// Those commands have the highest priority. Therefore, the user cannot set any commands similar to system commands.
/// </remarks>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready
+ /// The state must be ready.
/// </pre>
public static VoiceCommandList GetSystemCommandList()
{
/// <summary>
/// Requests to start the dialogue.
- /// Using this function, the developer can request starting the dialogue to the framework.
- /// When the developer requests the dialogue, two types of texts, dispText and uttText, can be sent by this function.dispText is a text for displaying, and uttText is that for uttering.
+ /// By using this function, the developer can start requesting the dialogue to the framework.
+ /// When the developer requests the dialogue, two types of texts, dispText and uttText can be sent by this function. dispText is a text for displaying and uttText is that for uttering.
/// For example, if dispText is "October 10th" and uttText is "Today is October 10th.", "October 10th" will be displayed on the screen and "Today is October 10th." will be spoken.
/// Also, the developer can set whether the dialogue starts automatically or not, using autoStart.
- /// If the developer sets autoStart as true, the framework will start to record next speech and continue the dialogue.
+ /// If the developer sets autoStart as True, the framework will start to record the next speech and continue the dialogue.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <remarks>
- /// If autoStart is true, the recognition will start again. In this case, it can be restarted up to 4 times.
+ /// If autoStart is True, the recognition will start again. In this case, it can be restarted up to 4 times.
/// </remarks>
- /// <param name="dispText"> Text to be displayed on the screen/// </param>
- /// <param name="uttText">Text to be spoken</param>
- /// <param name="autoStart">A variable for setting whether the dialog session will be restarted automatically or not</param>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <param name="dispText">Text to be displayed on the screen.</param>
+ /// <param name="uttText">Text to be spoken.</param>
+ /// <param name="autoStart">A variable for setting whether the dialog session will be restarted automatically or not.</param>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready
+ /// The state must be ready.
/// </pre>
public static void RequestDialog(string dispText, string uttText, bool autoStart)
{
}
/// <summary>
- /// Sets command list.
+ /// Sets the command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </feature>
/// <remarks>
/// The command type is valid for CommandType 'Foreground' or 'Background'.
- /// The matched commands of command list should be set and they should include type and command text at least.
+ /// The matched commands of the command list should be set and they should include type and command text at least.
/// </remarks>
/// <param name="list">Command list</param>
/// <param name="type">Command type</param>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready
+ /// The state must be ready.
/// </pre>
public static void SetCommandList(VoiceCommandList list, CommandType type)
{
}
/// <summary>
- /// Unsets command list.
+ /// Unsets the command list.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/feature/microphone
/// </feature>
/// <param name="type">Command type</param>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
/// <pre>
- /// The State should be Ready
+ /// The state should be ready.
/// </pre>
public static void UnsetCommandList(CommandType type)
{
/// http://tizen.org/feature/speech.control
/// http://tizen.org/feature/microphone
/// </feature>
- /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
- /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
- /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
- /// <returns>The Recognition Result if possible else a null object</returns>
+ /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
+ /// <returns>The recognition result if possible, else a null object.</returns>
/// <pre>
- /// The State should be Ready
+ /// The state must be ready.
/// </pre>
public static RecognitionResult GetResult()
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
public static event EventHandler<RecognitionResultEventArgs> RecognitionResult
{
}
/// <summary>
- /// Event to be invoked when VoiceControl service state changes.
+ /// Event to be invoked when the VoiceControl service state changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
public static event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
{
}
/// <summary>
- /// Event to be invoked when VoiceControl client state changes.
+ /// Event to be invoked when the VoiceControl client state changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
public static event EventHandler<StateChangedEventArgs> StateChanged
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
public static event EventHandler<ErrorOccuredEventArgs> ErrorOccured
{
}
/// <summary>
- /// Event to be invoked when default laungage change.
+ /// Event to be invoked when the default language changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <pre>
- /// The State should be Initialized
+ /// The state must be initialized.
/// </pre>
public static event EventHandler<CurrentLanguageChangedEventArgs> CurrentLanguageChanged
{