# Properties
OUTDIR=$SCRIPT_DIR/Artifacts
-
-
+NUGET_CMD="mono $SCRIPT_DIR/tools/NuGet.exe"
usage() {
echo "Usage: $0 [options] [args]"
echo " -b, --build [module] Build a module"
echo " -f, --full Build all modules in src/ directory. The module should be added in pkg/Tizen.NET.Private.sln"
echo " -d, --dummy Build dummy modules"
+ echo " -p, --pack Make nuget packages"
echo " -c, --clean Clean all artifacts"
}
cmd_full_build() {
dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Private.sln --configuration=Release --output=$OUTDIR/bin
- nuget pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
- nuget pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
+}
+
+cmd_pack() {
+ VERSION_FILE=$OUTDIR/Version.txt
+ if [ -f $VERSION_FILE ]; then
+ NUGET_VERSION_PREFIX=$(cat $VERSION_FILE | grep Prefix | cut -d: -f2 | sed 's/\r$//')
+ NUGET_VERSION_SUFFIX=$(cat $VERSION_FILE | grep Suffix | cut -d: -f2 | sed 's/\r$//')
+ NUGET_VERSION_OPT="-Version $NUGET_VERSION_PREFIX-$NUGET_VERSION_SUFFIX"
+ fi
+ $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $OUTDIR -OutputDirectory $OUTDIR
+ $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $OUTDIR -OutputDirectory $OUTDIR
}
cmd_dummy_build() {
dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Dummy.csproj --configuration=Release
}
-OPTS=`getopt -o hcbfd --long help,clean,build,full,dummy -n 'build' -- "$@"`
+OPTS=`getopt -o hcbfpd --long help,clean,build,full,pack,dummy -n 'build' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; usage; exit 1 ; fi
eval set -- "$OPTS"
FLAG_BUILD=false
FLAG_CLEAN=false
FLAG_DUMMY=false
+FLAG_PACK=false
while true; do
case "$1" in
-b|--build) FLAG_BUILD=true; shift ;;
-f|--full) FLAG_FULL=true; shift ;;
-d|--dummy) FLAG_DUMMY=true; shift ;;
+ -p|--pack) FLAG_PACK=true; shift ;;
-c|--clean) FLAG_CLEAN=true; shift ;;
--) shift; break ;;
*) break ;;
esac
done
-if $FLAG_HELP; then usage; exit 1; fi
-if $FLAG_CLEAN; then cmd_clean; exit 1; fi
-if $FLAG_FULL; then cmd_full_build; exit 1; fi
-if $FLAG_BUILD; then cmd_build $@; exit 1; fi
-if $FLAG_DUMMY; then cmd_dummy_build; exit 1; fi
+if $FLAG_HELP; then usage; exit 0; fi
+if $FLAG_CLEAN; then cmd_clean; exit 0; fi
+if $FLAG_FULL; then cmd_full_build; exit 0; fi
+if $FLAG_BUILD; then cmd_build $@; exit 0; fi
+if $FLAG_PACK; then cmd_pack $@; exit 0; fi
+if $FLAG_DUMMY; then cmd_dummy_build; exit 0; fi
-usage;
\ No newline at end of file
+usage;
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+# !! IMPORTANT !!
+# This packaging spec file is for developer testing only.
+# For Tizen release, the spec file in the tizen branch should be used.
+
+%define DOTNET_ASSEMBLY_PATH /usr/share/dotnet.tizen/framework
+%define DOTNET_ASSEMBLY_DUMMY_PATH %{DOTNET_ASSEMBLY_PATH}/ref
+%define DOTNET_ASSEMBLY_RES_PATH %{DOTNET_ASSEMBLY_PATH}/res
+%define DOTNET_NUGET_SOURCE /nuget
+
+%define _tizenfx_bin_path Artifacts
+
+Name: csapi-tizenfx
+Summary: Assemblies of Tizen .NET
+Version: 99.99.99
+Release: 1
+Group: Development/Libraries
+License: Apache-2.0
+URL: https://www.tizen.org
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+
+BuildRequires: dotnet-build-tools
+
+BuildArch: noarch
+AutoReqProv: no
+
+%description
+%{summary}
+
+%package nuget
+Summary: NuGet package for %{name}
+Group: Development/Libraries
+AutoReqProv: no
+
+%description nuget
+NuGet package for %{name}
+
+%package dummy
+Summary: Dummy assemblies of Tizen .NET
+Group: Development/Libraries
+AutoReqProv: no
+
+%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 debug
+Summary: All .pdb files of Tizen .NET
+Group: Development/Libraries
+AutoReqProv: no
+
+%description debug
+All .pdb files of Tizen .NET
+
+%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
+Requires: csapi-tizenfx-dummy
+AutoReqProv: no
+
+%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
+
+GetFileList() {
+ PROFILE=$1
+ cat pkg/PlatformFileList.txt | grep -E "#$PROFILE[[:space:]]|#$PROFILE$" | cut -d# -f1 | sed "s#^#%{DOTNET_ASSEMBLY_PATH}/#"
+}
+
+GetFileList common > common.filelist
+GetFileList mobile > mobile.filelist
+GetFileList mobile-emul > mobile-emul.filelist
+GetFileList tv > tv.filelist
+GetFileList ivi > ivi.filelist
+GetFileList wearable > wearable.filelist
+
+rm -fr %{_tizenfx_bin_path}/bin
+rm -f %{_tizenfx_bin_path}/*.nupkg
+export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
+./build.sh --full
+./build.sh --dummy
+./build.sh --pack
+
+%install
+mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
+mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
+mkdir -p %{buildroot}%{DOTNET_NUGET_SOURCE}
+
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/res/* %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
+
+%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 debug
+%attr(644,root,root) %{DOTNET_ASSEMBLY_PATH}/*.pdb
+
+%files common -f common.filelist
+%manifest %{name}.manifest
+%license LICENSE
+
+%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 wearable -f wearable.filelist
+%manifest %{name}.manifest
+%license LICENSE
--- /dev/null
+ElmSharp.dll #common #mobile #mobile-emul #tv #ivi #wearable
+ElmSharp.Wearable.dll #wearable
+res/maps_marker_pin_48.png #mobile #mobile-emul #tv
+res/maps_marker_pin_72.png #mobile #mobile-emul #tv
+res/maps_marker_sticker_48.png #mobile #mobile-emul #tv
+res/maps_marker_sticker_72.png #mobile #mobile-emul #tv
+Tizen.Account.AccountManager.dll #mobile #mobile-emul #ivi
+Tizen.Account.FidoClient.dll #mobile #mobile-emul
+Tizen.Account.OAuth2.dll #mobile #mobile-emul #ivi
+Tizen.Applications.Alarm.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.AttachPanel.dll
+Tizen.Applications.Badge.dll #mobile #mobile-emul #ivi
+Tizen.Applications.Common.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.DataControl.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.MessagePort.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.Notification.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.NotificationEventListener.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.PackageManager.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.Preference.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.RemoteView.dll #mobile #mobile-emul #tv
+Tizen.Applications.Service.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.ToastMessage.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.UI.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Applications.WatchApplication.dll #wearable
+Tizen.Applications.WidgetApplication.dll #mobile #mobile-emul #tv #ivi
+Tizen.Applications.WidgetControl.dll #mobile #mobile-emul #tv #ivi
+Tizen.Content.Download.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Content.MediaContent.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Content.MimeType.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Context.dll #mobile #mobile-emul
+Tizen.Convergence.dll #common #mobile #mobile-emul #ivi #wearable
+Tizen.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Location.dll #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Location.Geofence.dll #mobile #mobile-emul
+Tizen.Log.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Maps.dll #mobile #mobile-emul #tv
+Tizen.Messaging.dll #mobile #mobile-emul
+Tizen.Messaging.Push.dll #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.AudioIO.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Camera.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.MediaCodec.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.MediaPlayer.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Metadata.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Radio.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Recorder.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Remoting.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.StreamRecorder.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Util.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Multimedia.Vision.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Network.Bluetooth.dll #common #mobile #tv #ivi #wearable
+Tizen.Network.Connection.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Network.IoTConnectivity.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Network.Mtp.dll
+Tizen.Network.Nfc.dll #mobile #mobile-emul #ivi #wearable
+Tizen.Network.Nsd.dll #common #mobile #mobile-emul #wearable
+Tizen.Network.Smartcard.dll #mobile #mobile-emul #ivi #wearable
+Tizen.Network.WiFi.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Network.WiFiDirect.dll #mobile #tv #ivi
+Tizen.NUI.dll #common #mobile #mobile-emul #tv
+Tizen.PhonenumberUtils.dll #mobile #mobile-emul
+Tizen.Pims.Calendar.dll #common #mobile #mobile-emul
+Tizen.Pims.Contacts.dll #mobile #mobile-emul
+Tizen.Security.dll #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Security.SecureRepository.dll #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Security.TEEC.dll #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Sensor.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.System.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.System.Feedback.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.System.Information.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.System.MediaKey.dll #common #mobile #mobile-emul #ivi #wearable
+Tizen.System.PlatformConfig.dll
+Tizen.System.Storage.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.System.SystemSettings.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Tapi.dll
+Tizen.Telephony.dll #mobile #mobile-emul #ivi
+Tizen.Tracer.dll #common #mobile #mobile-emul #tv #ivi #wearable
+Tizen.Uix.InputMethod.dll #common #mobile #mobile-emul #ivi
+Tizen.Uix.InputMethodManager.dll #common #mobile #mobile-emul #tv #ivi
+Tizen.Uix.Stt.dll #mobile #mobile-emul #tv
+Tizen.Uix.SttEngine.dll #mobile #mobile-emul
+Tizen.Uix.Tts.dll #mobile #mobile-emul #tv
+Tizen.Uix.TtsEngine.dll #mobile #mobile-emul
+Tizen.Uix.VoiceControl.dll #mobile #mobile-emul #tv #ivi
+Tizen.WebView.dll #common #mobile #mobile-emul #tv #ivi #wearable
<!-- Properties for directories -->
<PropertyGroup>
- <ToolsDir>$(MSBuildThisFileDirectory)..\tools\</ToolsDir>
+ <ToolsDir>$(MSBuildThisFileDirectory)..\tools\GenAPI\</ToolsDir>
<GenAPISourceDir>$(MSBuildThisFileDirectory)\..\Artifacts\bin\</GenAPISourceDir>
<GenAPILibDir>$(MSBuildThisFileDirectory)obj\_ref_lib\</GenAPILibDir>
<GenAPITargetDir>$(MSBuildThisFileDirectory)obj\_ref_api\</GenAPITargetDir>
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.WebView", "..\src\Tizen.WebView\Tizen.WebView.csproj", "{8D3289A5-591B-421D-A79C-776B9AC74B95}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.CallManager", "..\src\Tizen.CallManager\Tizen.CallManager.csproj", "{05DD16B8-2027-4728-AEB6-6296E7457533}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x64.Build.0 = Release|x64
{8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x86.ActiveCfg = Release|x86
{8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x86.Build.0 = Release|x86
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|x64.ActiveCfg = Debug|x64
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|x64.Build.0 = Debug|x64
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|x86.ActiveCfg = Debug|x86
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Debug|x86.Build.0 = Debug|x86
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|Any CPU.Build.0 = Release|Any CPU
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|x64.ActiveCfg = Release|x64
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|x64.Build.0 = Release|x64
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|x86.ActiveCfg = Release|x86
+ {05DD16B8-2027-4728-AEB6-6296E7457533}.Release|x86.Build.0 = Release|x86
EndGlobalSection
EndGlobal
}
/// <summary>
+ /// Gets the current known default pointer coordinates.
+ /// This function returns the current known canvas unit coordinates of the mouse pointer.
+ /// </summary>
+ public Point Pointer
+ {
+ get
+ {
+ int mx, my;
+ Interop.Evas.evas_pointer_canvas_xy_get(_handle, out mx, out my);
+ return new Point { X = mx, Y = my };
+ }
+ }
+
+ /// <summary>
/// Gets or sets the image cache.
/// This function returns the image cache size of canvas in bytes.
/// </summary>
[DllImport(Libraries.Evas)]
internal static extern void evas_image_cache_set(IntPtr obj, int size);
+ [DllImport(Libraries.Evas)]
+ internal static extern void evas_pointer_canvas_xy_get(IntPtr obj, out int mx, out int my);
+
[DllImport(Libraries.Evas, EntryPoint = "evas_load_error_str")]
internal static extern IntPtr _evas_load_error_str(LoadError error);
evas_object_color_set(obj, r * a / 255, g * a / 255, b * a / 255, a);
}
}
-}
+}
\ No newline at end of file
/// <summary>
/// Instance for the window
/// </summary>
- protected Widget Window;
+ protected Window Window;
/// <summary>
/// Occurs whenever the application is resumed.
Interop.Watch.GetWin(out win);
Window = new WatchWindow(win);
+ Window.Show();
}
/// <summary>
namespace Tizen.Applications
{
- internal class WatchWindow : Widget
+ internal class WatchWindow : Window
{
private IntPtr _handle;
--- /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;
+using Tizen.CallManager;
+
+/// <summary>
+/// Interop class for CallManager
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// CallManager Native Apis
+ /// </summary>
+ internal static partial class CallManager
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void CallStatusChangedCallback(CallStatus callStatus, string number, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void CallMuteStatusChangedCallback(CallMuteStatus muteStatus, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void DialStatusChangedCallback(DialStatus dialStatus, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void DtmfIndicationChangedCallback(DtmfIndication indiType, string number, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void AudioStateChangedCallback(AudioState state, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void GoForegroundCallback(IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void VoiceRecordStatusChangedCallback(VrStatus vrStatus, VrStatusExtraType extraType, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void CallEventNotificationCallback(CallEvent callEvent, IntPtr eventData, IntPtr userData);
+
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_init")]
+ internal static extern int InitCm(out IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_deinit")]
+ internal static extern int DeinitCm(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_reject_call")]
+ internal static extern int RejectCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_stop_alert")]
+ internal static extern int StopAlert(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_call_status")]
+ internal static extern int GetStatus(IntPtr handle, out CallStatus callStatus);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_call_status_cb")]
+ internal static extern int SetCallStatusCallback(IntPtr handle, CallStatusChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_call_status_cb")]
+ internal static extern int UnsetCallstatusCallback(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_mute_status")]
+ internal static extern int GetMuteStatus(IntPtr handle, out CallMuteStatus muteStatus);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_mute_status_cb")]
+ internal static extern int SetCallMuteStatusCallback(IntPtr handle, CallMuteStatusChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_mute_status_cb")]
+ internal static extern int UnsetCallMuteStatusCallback(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_enable_recovery")]
+ internal static extern int EnableRecovery(IntPtr handle, string appId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_dial_call")]
+ internal static extern int DialCall(IntPtr handle, string number, CallType type, MultiSimSlot simSlot);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_swap_call")]
+ internal static extern int SwapCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_join_call")]
+ internal static extern int JoinCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_split_call")]
+ internal static extern int SplitCall(IntPtr handle, uint callId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_transfer_call")]
+ internal static extern int TransferCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_answer_call_ex")]
+ internal static extern int AnswerCallEx(IntPtr handle, CallAnswerType answerType, CallType callType);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_answer_call")]
+ internal static extern int AnswerCall(IntPtr handle, CallAnswerType answerType);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_upgrade_call")]
+ internal static extern int UpgradeCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_downgrade_call")]
+ internal static extern int DowngradeCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_confirm_upgrade_call")]
+ internal static extern int ConfirmUpgradeCall(IntPtr handle, CallUpgradeResponseType respType);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_speaker_on")]
+ internal static extern int SpeakerOn(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_speaker_off")]
+ internal static extern int SpeakerOff(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_bluetooth_on")]
+ internal static extern int BluetoothOn(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_bluetooth_off")]
+ internal static extern int BluetoothOff(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_extra_vol")]
+ internal static extern int SetExtraVolume(IntPtr handle, bool isExtraVolume);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_noise_reduction")]
+ internal static extern int SetNoiseReduction(IntPtr handle, bool isNoiseReduction);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_mute_state")]
+ internal static extern int SetMuteState(IntPtr handle, bool isMuteState);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_start_dtmf")]
+ internal static extern int StartDtmf(IntPtr handle, byte dtmfDigit);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_stop_dtmf")]
+ internal static extern int StopDtmf(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_burst_dtmf")]
+ internal static extern int BurstDtmf(IntPtr handle, string dtmfDigits);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_send_dtmf_resp")]
+ internal static extern int SendDtmfResponse(IntPtr handle, DtmfResponseType respType);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_audio_state")]
+ internal static extern int GetAudioState(IntPtr handle, out AudioState state);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_activate_ui")]
+ internal static extern int ActivateUi(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_lcd_timeout")]
+ internal static extern int SetLcdTimeOut(IntPtr handle, LcdTimeOut timeOut);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_all_call_list")]
+ internal static extern int GetAllCallList(IntPtr handle, out IntPtr list);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_conference_call_list")]
+ internal static extern int GetConferenceCallList(IntPtr handle, out IntPtr list);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_get_all_calldata")]
+ internal static extern int GetAllCallData(IntPtr handle, out IntPtr incoming, out IntPtr active, out IntPtr held);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_start_voice_record")]
+ internal static extern int StartVoiceRecord(IntPtr handle, string number);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_stop_voice_record")]
+ internal static extern int StopVoiceRecord(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_dial_status_cb")]
+ internal static extern int SetDialStatusCb(IntPtr handle, DialStatusChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_dial_status_cb")]
+ internal static extern int UnsetDialStatusCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_audio_state_changed_cb")]
+ internal static extern int SetAudioStateChangedCb(IntPtr handle, AudioStateChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_audio_state_changed_cb")]
+ internal static extern int UnsetAudioStateChangedCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_dtmf_indication_cb")]
+ internal static extern int SetDtmfIndicationCb(IntPtr handle, DtmfIndicationChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_dtmf_indication_cb")]
+ internal static extern int UnsetDtmfIndicationCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_foreground_cb")]
+ internal static extern int SetForegroundCb(IntPtr handle, GoForegroundCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_foreground_cb")]
+ internal static extern int UnsetForegroundCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_voice_record_status_cb")]
+ internal static extern int SetVoiceRecordStatusCb(IntPtr handle, VoiceRecordStatusChangedCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_voice_record_status_cb")]
+ internal static extern int UnsetVoiceRecordStatusCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_person_id")]
+ internal static extern int GetPersonId(IntPtr handle, out int personId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_member_count")]
+ internal static extern int GetCallMemberCount(IntPtr handle, out int memberCount);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_is_emergency_call")]
+ internal static extern int IsEmergencyCall(IntPtr handle, out bool isEmergency);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_is_voicemail_number")]
+ internal static extern int IsVoiceMailNumber(IntPtr handle, out bool isVoiceMailNumber);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_start_time")]
+ internal static extern int GetStartTime(IntPtr handle, out long startTime);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_session_id")]
+ internal static extern int GetSessionId(IntPtr handle, out int sessionId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_hd_icon_state")]
+ internal static extern int GetHdIconState(IntPtr handle, out int IsHdEnable);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_is_wifi_calling")]
+ internal static extern int IsWiFiCalling(IntPtr handle, out int isWiFiCalling);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_upgrade_downgrade_state")]
+ internal static extern int GetUpgradeDowngradeState(IntPtr handle, out int isUpgradeDowngradeEnable);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_is_added_to_conf")]
+ internal static extern int IsAddedToConference(IntPtr handle, out int isAddedToConf);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_is_remote_on_hold")]
+ internal static extern int IsRemoteOnHold(IntPtr handle, out int isRemoteOnHold);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_conf_call_data_get_call_id")]
+ internal static extern int GetConfCallId(IntPtr handle, out uint callId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_conf_call_data_get_call_number")]
+ internal static extern int GetConfCallNumber(IntPtr handle, out string number);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_conf_call_data_get_person_id")]
+ internal static extern int GetConfCallPersonId(IntPtr handle, out int personId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_conf_call_data_get_name_mode")]
+ internal static extern int GetConfCallNameMode(IntPtr handle, out CallNameMode nameMode);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_conf_call_data_free")]
+ internal static extern int FreeConfCallData(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_lcd_state")]
+ internal static extern int SetLcdState(LcdControlState state);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_start_alert")]
+ internal static extern int StartAlert(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_set_call_event_cb")]
+ internal static extern int SetCallEventCb(IntPtr handle, CallEventNotificationCallback callback, IntPtr userData);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unset_call_event_cb")]
+ internal static extern int UnsetCallEventCb(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_free")]
+ internal static extern int FreeCallData(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_id")]
+ internal static extern int GetCallId(IntPtr handle, out uint callId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_direction")]
+ internal static extern int GetCallDirection(IntPtr handle, out CallDirection direction);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_number")]
+ internal static extern int GetCallNumber(IntPtr handle, out string number);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_calling_name")]
+ internal static extern int GetCallingName(IntPtr handle, out string name);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_type")]
+ internal static extern int GetCallType(IntPtr handle, out CallType type);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_state")]
+ internal static extern int GetCallState(IntPtr handle, out CallState state);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_call_domain")]
+ internal static extern int GetCallDomain(IntPtr handle, out CallDomain domain);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_name_mode")]
+ internal static extern int GetNameMode(IntPtr handle, out CallNameMode nameMode);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_data_get_mt_forwarded")]
+ internal static extern int IsForwardedCall(IntPtr handle, out bool isForwarded);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_sim_slot")]
+ internal static extern int GetSimSlot(IntPtr handle, out MultiSimSlot simSlot);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_incom_call")]
+ internal static extern int GetIncomingCallData(IntPtr handle, out IntPtr incomCall);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_call_id")]
+ internal static extern int GetEventDataCallId(IntPtr handle, out uint callId);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_active_call")]
+ internal static extern int GetActiveCall(IntPtr handle, out IntPtr activeCall);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_held_call")]
+ internal static extern int GetHeldCall(IntPtr handle, out IntPtr heldCall);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_call_event_data_get_end_cause")]
+ internal static extern int GetEndCause(IntPtr handle, out CallEndCause endCause);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_hold_call")]
+ internal static extern int HoldCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_unhold_call")]
+ internal static extern int UnholdCall(IntPtr handle);
+ [DllImport(Libraries.CallManager, EntryPoint = "cm_end_call")]
+ internal static extern int EndCall(IntPtr handle, uint callId, CallReleaseType releaseType);
+ }
+}
--- /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.
+ */
+
+internal static partial class Interop
+{
+ internal static partial class Libraries
+ {
+ public const string CallManager = "libcall-manager.so.0";
+ public const string Glib = "libglib-2.0.so.0";
+ public const string Libc = "libc.so.6";
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="../../build/common.props" />
+
+ <PropertyGroup>
+ <TargetFramework>netstandard1.6</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen\Tizen.csproj" />
+ <ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
+ </ItemGroup>
+
+ <Import Project="../../build/common.targets" />
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.13
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.CallManager", "Tizen.CallManager.csproj", "{18DF1A45-32B3-4577-84DF-BB3A1537ADC9}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{D06D0004-6A5F-4D6C-98C4-ADD3766A867A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{78875590-41AB-4382-B64E-73A50DE0851C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|x64.Build.0 = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Debug|x86.Build.0 = Debug|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|x64.ActiveCfg = Release|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|x64.Build.0 = Release|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|x86.ActiveCfg = Release|Any CPU
+ {18DF1A45-32B3-4577-84DF-BB3A1537ADC9}.Release|x86.Build.0 = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|x64.Build.0 = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Debug|x86.Build.0 = Debug|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|x64.ActiveCfg = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|x64.Build.0 = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|x86.ActiveCfg = Release|Any CPU
+ {D06D0004-6A5F-4D6C-98C4-ADD3766A867A}.Release|x86.Build.0 = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|x64.Build.0 = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Debug|x86.Build.0 = Debug|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|x64.ActiveCfg = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|x64.Build.0 = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|x86.ActiveCfg = Release|Any CPU
+ {78875590-41AB-4382-B64E-73A50DE0851C}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /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.CallManager
+{
+ /// <summary>
+ /// A class which defines the properties of call.
+ /// </summary>
+ public class CallData
+ {
+ internal uint CallId;
+ internal CallDirection CallDirection;
+ internal string Number;
+ internal string Name;
+ internal CallType CallType;
+ internal CallState CallState;
+ internal int Count;
+ internal bool IsEcc;
+ internal bool IsVoiceMail;
+ internal CallDomain CallDomain;
+ internal int PersonIndex;
+ internal long CallStartTime;
+ internal CallNameMode CallNameMode;
+ internal int SessionIdIms;
+ internal bool IsHdEnableIms;
+ internal bool IsWiFiCall;
+ internal bool IsUpgradeDowngrade;
+ internal bool IsRemoteHold;
+ internal bool IsAddedToConf;
+ internal bool IsForwardedCall;
+
+ internal CallData()
+ {
+ }
+
+ /// <summary>
+ /// Gets call id.
+ /// </summary>
+ public uint Id
+ {
+ get
+ {
+ return CallId;
+ }
+ }
+
+ /// <summary>
+ /// Gets call direction(MO or MT).
+ /// </summary>
+ public CallDirection Direction
+ {
+ get
+ {
+ return CallDirection;
+ }
+ }
+
+ /// <summary>
+ /// Get the call number.
+ /// </summary>
+ public string CallNumber
+ {
+ get
+ {
+ return Number;
+ }
+ }
+
+ /// <summary>
+ /// Get the contact name of calling number.
+ /// </summary>
+ public string CallingName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
+ /// <summary>
+ /// Get the call type(Voice call or Video call).
+ /// </summary>
+ public CallType Type
+ {
+ get
+ {
+ return CallType;
+ }
+ }
+
+ /// <summary>
+ /// Get the call state(Incoming, Active, etc).
+ /// </summary>
+ public CallState State
+ {
+ get
+ {
+ return CallState;
+ }
+ }
+
+ /// <summary>
+ /// Get the member count.
+ /// </summary>
+ public int MemberCount
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the call is emergency call.
+ /// </summary>
+ public bool IsEmergency
+ {
+ get
+ {
+ return IsEcc;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the number is voice mail number.
+ /// </summary>
+ public bool IsVoiceMailNumber
+ {
+ get
+ {
+ return IsVoiceMail;
+ }
+ }
+
+ /// <summary>
+ /// Get the call domain(PS call, CS call, etc).
+ /// </summary>
+ public CallDomain Domain
+ {
+ get
+ {
+ return CallDomain;
+ }
+ }
+
+ /// <summary>
+ /// Get the person ID.
+ /// </summary>
+ public int PersonId
+ {
+ get
+ {
+ return PersonIndex;
+ }
+ }
+
+ /// <summary>
+ /// Get the start time of the call.
+ /// </summary>
+ public long StartTime
+ {
+ get
+ {
+ return CallStartTime;
+ }
+ }
+
+ /// <summary>
+ /// Get the contact name mode.
+ /// </summary>
+ public CallNameMode Mode
+ {
+ get
+ {
+ return CallNameMode;
+ }
+ }
+
+ /// <summary>
+ /// Get the session ID of the call.
+ /// </summary>
+ public int SessionId
+ {
+ get
+ {
+ return SessionIdIms;
+ }
+ }
+
+ /// <summary>
+ /// Checks if HD is enabled for calling.
+ /// </summary>
+ public bool IsHdEnable
+ {
+ get
+ {
+ return IsHdEnableIms;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the call is a WiFi call.
+ /// </summary>
+ public bool IsWiFiCalling
+ {
+ get
+ {
+ return IsWiFiCall;
+ }
+ }
+
+ /// <summary>
+ /// Checks if upgrade/downgrade is enabled.
+ /// </summary>
+ public bool IsUpgradeDowngradeEnable
+ {
+ get
+ {
+ return IsUpgradeDowngrade;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the remote call is on hold.
+ /// </summary>
+ public bool IsRemoteOnHold
+ {
+ get
+ {
+ return IsRemoteHold;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the call is added to conference.
+ /// </summary>
+ public bool IsAddedToConference
+ {
+ get
+ {
+ return IsAddedToConf;
+ }
+ }
+
+ /// <summary>
+ /// Checks if the incoming call is a forwarded call.
+ /// </summary>
+ public bool IsMtForwarded
+ {
+ get
+ {
+ return IsForwardedCall;
+ }
+ }
+ }
+}
--- /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.CallManager
+{
+ /// <summary>
+ /// A class which contains information about call event data.
+ /// </summary>
+ public class CallEventData
+ {
+ internal uint EventId;
+ internal MultiSimSlot Slot;
+ internal CallEndCause Cause;
+ internal CallData Incoming;
+ internal CallData Active;
+ internal CallData Held;
+ internal CallEventData()
+ {
+ }
+
+ /// <summary>
+ /// Get the Call id of the number for which Call event has occurred.
+ /// </summary>
+ public uint Id
+ {
+ get
+ {
+ return EventId;
+ }
+ }
+
+ /// <summary>
+ /// Get the Sim slot type.
+ /// </summary>
+ public MultiSimSlot SimSlot
+ {
+ get
+ {
+ return Slot;
+ }
+ }
+
+ /// <summary>
+ /// Get call end cause type.
+ /// </summary>
+ public CallEndCause EndCause
+ {
+ get
+ {
+ return Cause;
+ }
+ }
+
+ /// <summary>
+ /// Get incoming call data.
+ /// </summary>
+ public CallData IncomingData
+ {
+ get
+ {
+ return Incoming;
+ }
+ }
+
+ /// <summary>
+ /// Get active call data.
+ /// </summary>
+ public CallData ActiveData
+ {
+ get
+ {
+ return Active;
+ }
+ }
+
+ /// <summary>
+ /// Get the call data for held call.
+ /// </summary>
+ public CallData HeldData
+ {
+ get
+ {
+ return Held;
+ }
+ }
+ }
+}
--- /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.CallManager
+{
+ /// <summary>
+ /// A class which manages the use of Call Manager APIs.
+ /// </summary>
+ public static class CallManager
+ {
+ /// <summary>
+ /// Initializes the call manager.
+ /// </summary>
+ /// <returns>An instance of CmClientHandle class to use call manager APIs.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public static CmClientHandle InitCm()
+ {
+ int ret = Interop.CallManager.InitCm(out IntPtr handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to initialize call manager, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret);
+ }
+
+ return new CmClientHandle(handle);
+ }
+
+ /// <summary>
+ /// Deinitializes the Call Manager handle.
+ /// </summary>
+ /// <param name="handle">The Call Manager handle to be deinitialized.</param>
+ /// <exception cref="ArgumentNullException">Thrown when CmClientHandle is passed as null.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public static void DeinitCm(CmClientHandle handle)
+ {
+ if (handle == null)
+ {
+ throw new ArgumentNullException("Call manager client handle is null");
+ }
+
+ int ret = Interop.CallManager.DeinitCm(handle._handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to deinitialize call manager, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, handle._handle);
+ }
+
+ handle._handle = IntPtr.Zero;
+ }
+
+ /// <summary>
+ /// Sets LCD state for the device display.
+ /// </summary>
+ /// <param name="state">LCD state to be set.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public static void SetLcdState(LcdControlState state)
+ {
+ int ret = Interop.CallManager.SetLcdState(state);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set LCD state, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Tizen.CallManager
+{
+ /// <summary>
+ /// A class which manages call manager events, properties and functions.
+ /// </summary>
+ public class CmClientHandle
+ {
+ internal IntPtr _handle = IntPtr.Zero;
+ private event EventHandler<CallStatusChangedEventArgs> _callStatusChanged;
+ private event EventHandler<CallMuteStatusChangedEventArgs> _callMuteStatusChanged;
+ private event EventHandler<CallEventEventArgs> _callEvent;
+ private event EventHandler<DialStatusEventArgs> _dialStatusChanged;
+ private event EventHandler<AudioStatusChangedEventArgs> _audioStateChanged;
+ private event EventHandler<DtmfIndicationEventArgs> _dtmfIndication;
+ private event EventHandler<EventArgs> _goForeGround;
+ private event EventHandler<VoiceRecordStatusEventArgs> _voiceRecordStatusChanged;
+
+ private Interop.CallManager.CallStatusChangedCallback _callStatusChangedCb;
+ private Interop.CallManager.CallMuteStatusChangedCallback _callMuteStatusChangedCb;
+ private Interop.CallManager.CallEventNotificationCallback _callEventCb;
+ private Interop.CallManager.DialStatusChangedCallback _dialStatusChangedCb;
+ private Interop.CallManager.AudioStateChangedCallback _audioStateChangedCb;
+ private Interop.CallManager.DtmfIndicationChangedCallback _dtmfIndicationChangedCb;
+ private Interop.CallManager.GoForegroundCallback _goForeGroundCb;
+ private Interop.CallManager.VoiceRecordStatusChangedCallback _voiceRecordStatusChangedCb;
+
+ internal CmClientHandle(IntPtr handle)
+ {
+ _handle = handle;
+ }
+
+ /// <summary>
+ /// This event is raised when call status changes.
+ /// </summary>
+ public event EventHandler<CallStatusChangedEventArgs> CallStatusChanged
+ {
+ add
+ {
+ if (_callStatusChanged == null)
+ {
+ RegisterCallStatusChangedEvent();
+ }
+
+ _callStatusChanged += value;
+ }
+
+ remove
+ {
+ _callStatusChanged -= value;
+ if (_callStatusChanged == null)
+ {
+ UnregisterCallStatusChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when the mute status changes.
+ /// </summary>
+ public event EventHandler<CallMuteStatusChangedEventArgs> CallMuteStatusChanged
+ {
+ add
+ {
+ if (_callMuteStatusChanged == null)
+ {
+ RegisterCallMuteStatusChangedEvent();
+ }
+
+ _callMuteStatusChanged += value;
+ }
+
+ remove
+ {
+ _callMuteStatusChanged -= value;
+ if (_callMuteStatusChanged == null)
+ {
+ UnregisterCallMuteStatusChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when call events change.
+ /// </summary>
+ public event EventHandler<CallEventEventArgs> CallEvent
+ {
+ add
+ {
+ if (_callEvent == null)
+ {
+ RegisterCallEventNotification();
+ }
+
+ _callEvent += value;
+ }
+
+ remove
+ {
+ _callEvent -= value;
+ if (_callEvent == null)
+ {
+ UnregisterCallEventNotification();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when dial status changes.
+ /// </summary>
+ public event EventHandler<DialStatusEventArgs> DialStatusChanged
+ {
+ add
+ {
+ if (_dialStatusChanged == null)
+ {
+ RegisterDialStatusEvent();
+ }
+
+ _dialStatusChanged += value;
+ }
+
+ remove
+ {
+ _dialStatusChanged -= value;
+ if (_dialStatusChanged == null)
+ {
+ UnregisterDialStatusEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when audio status changes.
+ /// </summary>
+ public event EventHandler<AudioStatusChangedEventArgs> AudioStateChanged
+ {
+ add
+ {
+ if (_audioStateChanged == null)
+ {
+ RegisterAudioStateChangedEvent();
+ }
+
+ _audioStateChanged += value;
+ }
+
+ remove
+ {
+ _audioStateChanged -= value;
+ if (_audioStateChanged == null)
+ {
+ UnregisterAudioStateChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised during DTMF indication.
+ /// </summary>
+ public event EventHandler<DtmfIndicationEventArgs> DtmfIndication
+ {
+ add
+ {
+ if (_dtmfIndication == null)
+ {
+ RegisterDtmfIndicationEvent();
+ }
+
+ _dtmfIndication += value;
+ }
+
+ remove
+ {
+ _dtmfIndication -= value;
+ if (_dtmfIndication == null)
+ {
+ UnregisterDtmfIndicationEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when call comes to foreground.
+ /// </summary>
+ public event EventHandler<EventArgs> GoForeground
+ {
+ add
+ {
+ if (_goForeGround == null)
+ {
+ RegisterGoForegroundEvent();
+ }
+
+ _goForeGround += value;
+ }
+
+ remove
+ {
+ _goForeGround -= value;
+ if (_goForeGround == null)
+ {
+ UnregisterGoForegroundEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// This event is raised when voice record status is changed.
+ /// </summary>
+ public event EventHandler<VoiceRecordStatusEventArgs> VoiceRecordStatusChanged
+ {
+ add
+ {
+ if (_voiceRecordStatusChanged == null)
+ {
+ RegisterVoiceRecordStatusEvent();
+ }
+
+ _voiceRecordStatusChanged += value;
+ }
+
+ remove
+ {
+ _voiceRecordStatusChanged -= value;
+ if (_voiceRecordStatusChanged == null)
+ {
+ UnregisterVoiceRecordStatusEvent();
+ }
+ }
+ }
+
+ private void RegisterCallStatusChangedEvent()
+ {
+ _callStatusChangedCb = (CallStatus status, string number, IntPtr userData) =>
+ {
+ _callStatusChanged?.Invoke(null, new CallStatusChangedEventArgs(status, number));
+ };
+ int ret = Interop.CallManager.SetCallStatusCallback(_handle, _callStatusChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set call status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterCallStatusChangedEvent()
+ {
+ int ret = Interop.CallManager.UnsetCallstatusCallback(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset call status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterCallMuteStatusChangedEvent()
+ {
+ _callMuteStatusChangedCb = (CallMuteStatus muteStatus, IntPtr userData) =>
+ {
+ _callMuteStatusChanged?.Invoke(null, new CallMuteStatusChangedEventArgs(muteStatus));
+ };
+ int ret = Interop.CallManager.SetCallMuteStatusCallback(_handle, _callMuteStatusChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set call mute status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterCallMuteStatusChangedEvent()
+ {
+ int ret = Interop.CallManager.UnsetCallMuteStatusCallback(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset call mute status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterCallEventNotification()
+ {
+ _callEventCb = (CallEvent callEvent, IntPtr eventData, IntPtr userData) =>
+ {
+ _callEvent?.Invoke(null, new CallEventEventArgs(callEvent, CmUtility.GetCallEventData(eventData)));
+ };
+ int ret = Interop.CallManager.SetCallEventCb(_handle, _callEventCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set call event notification callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterCallEventNotification()
+ {
+ int ret = Interop.CallManager.UnsetCallEventCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset call event notification callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterDialStatusEvent()
+ {
+ _dialStatusChangedCb = (DialStatus status, IntPtr userData) =>
+ {
+ _dialStatusChanged?.Invoke(null, new DialStatusEventArgs(status));
+ };
+ int ret = Interop.CallManager.SetDialStatusCb(_handle, _dialStatusChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set dial status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterDialStatusEvent()
+ {
+ int ret = Interop.CallManager.UnsetDialStatusCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset dial status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterAudioStateChangedEvent()
+ {
+ _audioStateChangedCb = (AudioState state, IntPtr userData) =>
+ {
+ _audioStateChanged?.Invoke(null, new AudioStatusChangedEventArgs(state));
+ };
+ int ret = Interop.CallManager.SetAudioStateChangedCb(_handle, _audioStateChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set audio state changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterAudioStateChangedEvent()
+ {
+ int ret = Interop.CallManager.UnsetAudioStateChangedCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset audio state changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterDtmfIndicationEvent()
+ {
+ _dtmfIndicationChangedCb = (DtmfIndication indiType, string number, IntPtr userData) =>
+ {
+ _dtmfIndication?.Invoke(null, new DtmfIndicationEventArgs(indiType, number));
+ };
+ int ret = Interop.CallManager.SetDtmfIndicationCb(_handle, _dtmfIndicationChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set DTMF indication changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterDtmfIndicationEvent()
+ {
+ int ret = Interop.CallManager.UnsetDtmfIndicationCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset DTMF indication changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterGoForegroundEvent()
+ {
+ _goForeGroundCb = (IntPtr userData) =>
+ {
+ _goForeGround?.Invoke(null, EventArgs.Empty);
+ };
+ int ret = Interop.CallManager.SetForegroundCb(_handle, _goForeGroundCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set go foreground callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterGoForegroundEvent()
+ {
+ int ret = Interop.CallManager.UnsetForegroundCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset go foreground callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void RegisterVoiceRecordStatusEvent()
+ {
+ _voiceRecordStatusChangedCb = (VrStatus vrStatus, VrStatusExtraType extraType, IntPtr userData) =>
+ {
+ _voiceRecordStatusChanged?.Invoke(null, new VoiceRecordStatusEventArgs(vrStatus, extraType));
+ };
+ int ret = Interop.CallManager.SetVoiceRecordStatusCb(_handle, _voiceRecordStatusChangedCb, IntPtr.Zero);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set voice record status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ private void UnregisterVoiceRecordStatusEvent()
+ {
+ int ret = Interop.CallManager.UnsetVoiceRecordStatusCb(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unset voice record status changed callback, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ public CallStatus CallStatus
+ {
+ get
+ {
+ int ret = Interop.CallManager.GetStatus(_handle, out CallStatus status);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call status, Error: " + (CmError)ret);
+ return default(CallStatus);
+ }
+
+ return status;
+ }
+ }
+
+ /// <summary>
+ /// Gets the mute status.
+ /// </summary>
+ public CallMuteStatus CallMuteStatus
+ {
+ get
+ {
+ int ret = Interop.CallManager.GetMuteStatus(_handle, out CallMuteStatus status);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call mute status, Error: " + (CmError)ret);
+ return default(CallMuteStatus);
+ }
+
+ return status;
+ }
+ }
+
+ /// <summary>
+ /// Gets the audio state.
+ /// </summary>
+ public AudioState AudioState
+ {
+ get
+ {
+ int ret = Interop.CallManager.GetAudioState(_handle, out AudioState state);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get audio state, Error: " + (CmError)ret);
+ return default(AudioState);
+ }
+
+ return state;
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of call data.
+ /// </summary>
+ public IEnumerable<CallData> AllCalls
+ {
+ get
+ {
+ int ret = Interop.CallManager.GetAllCallList(_handle, out IntPtr list);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get all call list, Error: " + (CmError)ret);
+ return null;
+ }
+
+ List<CallData> callList = new List<CallData>();
+ int offset = 0;
+ IntPtr data = Marshal.ReadIntPtr(list, offset);
+ if (data != IntPtr.Zero)
+ {
+ do
+ {
+ offset += Marshal.SizeOf(data);
+ callList.Add(CmUtility.GetCallData(data));
+ Interop.CallManager.FreeCallData(data);
+ data = IntPtr.Zero;
+ }
+
+ while ((data = Marshal.ReadIntPtr(list, offset)) != IntPtr.Zero);
+ }
+
+ return callList;
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of conference call data.
+ /// </summary>
+ public IEnumerable<ConferenceCallData> AllConferenceCalls
+ {
+ get
+ {
+ int ret = Interop.CallManager.GetConferenceCallList(_handle, out IntPtr list);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get conference call list, Error: " + (CmError)ret);
+ return null;
+ }
+
+ List<ConferenceCallData> confList = new List<ConferenceCallData>();
+ int offset = 0;
+ IntPtr data = Marshal.ReadIntPtr(list, offset);
+ if (data != IntPtr.Zero)
+ {
+ do
+ {
+ offset += Marshal.SizeOf(data);
+ confList.Add(CmUtility.GetConfCallData(data));
+ Interop.CallManager.FreeConfCallData(data);
+ data = IntPtr.Zero;
+ }
+
+ while ((data = Marshal.ReadIntPtr(list, offset)) != IntPtr.Zero);
+ }
+
+ return confList;
+ }
+ }
+
+ /// <summary>
+ /// Rejects the incoming call.
+ /// </summary>
+ /// <privlevel>partner</privlevel>
+ /// <privilege>http://developer.samsung.com/tizen/privilege/call.reject</privilege>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void RejectCall()
+ {
+ int ret = Interop.CallManager.RejectCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to reject call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle, "http://developer.samsung.com/tizen/privilege/call.reject");
+ }
+ }
+
+ /// <summary>
+ /// Starts incoming call alert ringtone.
+ /// </summary>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StartAlert()
+ {
+ int ret = Interop.CallManager.StartAlert(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to start incoming call alert, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Stops incoming call alert ringtone.
+ /// </summary>
+ /// <privlevel>partner</privlevel>
+ /// <privilege>http://developer.samsung.com/tizen/privilege/call.reject</privilege>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StopAlert()
+ {
+ int ret = Interop.CallManager.StopAlert(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to stop incoming call alert, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle, "http://developer.samsung.com/tizen/privilege/call.reject");
+ }
+ }
+
+ /// <summary>
+ /// Enables call recovery.
+ /// </summary>
+ /// <param name="appId">App ID to be recovered.</param>
+ /// <exception cref="ArgumentNullException">Thrown appId is passed as null.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void EnableRecovery(string appId)
+ {
+ if (appId == null)
+ {
+ throw new ArgumentNullException("App ID is null");
+ }
+
+ int ret = Interop.CallManager.EnableRecovery(_handle, appId);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to enable recovery, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Dials a call.
+ /// </summary>
+ /// <param name="number">Calling number to be dialed.</param>
+ /// <param name="type">Type of the call to be dialed.</param>
+ /// <param name="slot">Multi sim slot type in which the call is dialed.</param>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown number is passed as null.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void DialCall(string number, CallType type, MultiSimSlot slot)
+ {
+ if (number == null)
+ {
+ throw new ArgumentNullException("Calling number is null");
+ }
+
+ int ret = Interop.CallManager.DialCall(_handle, number, type, slot);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to dial call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Swaps the calls.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SwapCall()
+ {
+ int ret = Interop.CallManager.SwapCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to swap call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Joins a call with another.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void JoinCall()
+ {
+ int ret = Interop.CallManager.JoinCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to join call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Splits a call.
+ /// </summary>
+ /// <param name="id">Call id to be splitted.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SplitCall(uint id)
+ {
+ int ret = Interop.CallManager.SplitCall(_handle, id);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to split call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Transfers a call.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void TransferCall()
+ {
+ int ret = Interop.CallManager.TransferCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to transfer call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Accepts MT ViLTE call as VoLTE.
+ /// </summary>
+ /// <param name="answerType">Call answer type.</param>
+ /// <param name="type">Call type.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void AnswerCallEx(CallAnswerType answerType, CallType type)
+ {
+ int ret = Interop.CallManager.AnswerCallEx(_handle, answerType, type);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to answer call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Answers an incoming call.
+ /// </summary>
+ /// <param name="answerType">Call answer type.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void AnswerCall(CallAnswerType answerType)
+ {
+ int ret = Interop.CallManager.AnswerCall(_handle, answerType);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to answer call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Upgrades a call.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void UpgradeCall()
+ {
+ int ret = Interop.CallManager.UpgradeCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to upgrade call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Downgrades a call.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void DowngradeCall()
+ {
+ int ret = Interop.CallManager.DowngradeCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to downgrade call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Confirms upgrade call request.
+ /// </summary>
+ /// <param name="response">Upgrade response type.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void ConfirmUpgradeCall(CallUpgradeResponseType response)
+ {
+ int ret = Interop.CallManager.ConfirmUpgradeCall(_handle, response);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to confirm upgrade call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets the speaker on/off.
+ /// </summary>
+ /// <param name="status">Status of the speaker to be set.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void ManageSpeaker(FeatureStatus status)
+ {
+ int ret = -1;
+ if (status == FeatureStatus.Off)
+ {
+ ret = Interop.CallManager.SpeakerOff(_handle);
+ }
+
+ else if (status == FeatureStatus.On)
+ {
+ ret = Interop.CallManager.SpeakerOn(_handle);
+ }
+
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to manage speaker, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets the bluetooth feature on/off.
+ /// </summary>
+ /// <param name="status">Status of the bluetooth to be set.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void ManageBluetooth(FeatureStatus status)
+ {
+ int ret = -1;
+ if (status == FeatureStatus.Off)
+ {
+ ret = Interop.CallManager.BluetoothOff(_handle);
+ }
+
+ else if (status == FeatureStatus.On)
+ {
+ ret = Interop.CallManager.BluetoothOn(_handle);
+ }
+
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to manage bluetooth, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets extra volume if needed.
+ /// </summary>
+ /// <param name="isExtraVolume">Boolean value to indicate if the call is set to have extra volume.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SetExtraVolume(bool isExtraVolume)
+ {
+ int ret = Interop.CallManager.SetExtraVolume(_handle, isExtraVolume);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set extra volume, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets the noise reduction feature during call.
+ /// </summary>
+ /// <param name="isNoiceReduction">Boolean value to indicate whether the call needs noise reduction.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SetNoiseReduction(bool isNoiceReduction)
+ {
+ int ret = Interop.CallManager.SetNoiseReduction(_handle, isNoiceReduction);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set noise reduction, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets the mute state of the call.
+ /// </summary>
+ /// <param name="isMuteState">Mute state to be set.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SetMuteState(bool isMuteState)
+ {
+ int ret = Interop.CallManager.SetMuteState(_handle, isMuteState);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set mute state, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Starts sending signal through DTMF digit.
+ /// </summary>
+ /// <param name="dtmfDigit">DTMF digit to be pressed on the phone.</param>
+ /// <exception cref="ArgumentException">Thrown when method failed due to invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StartDtmf(byte dtmfDigit)
+ {
+ int ret = Interop.CallManager.StartDtmf(_handle, dtmfDigit);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to start DTMF, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Stops sending DTMF signal.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StopDtmf()
+ {
+ int ret = Interop.CallManager.StopDtmf(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to stop DTMF, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sends signal through DTMF digits.
+ /// </summary>
+ /// <param name="dtmfDigits">DTMF digits.</param>
+ /// <exception cref="ArgumentNullException">Thrown when dtmfDigits is passed as null.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void BurstDtmf(string dtmfDigits)
+ {
+ if (dtmfDigits == null)
+ {
+ throw new ArgumentNullException("DTMF digits is null");
+ }
+
+ int ret = Interop.CallManager.BurstDtmf(_handle, dtmfDigits);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to burst DTMF, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sends DTMF response.
+ /// </summary>
+ /// <param name="response">DTMF response type.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SendDtmfResponse(DtmfResponseType response)
+ {
+ int ret = Interop.CallManager.SendDtmfResponse(_handle, response);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to send DTMF response, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Activates call manager UI.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void ActivateUi()
+ {
+ int ret = Interop.CallManager.ActivateUi(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to activate UI, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Sets device LCD time out.
+ /// </summary>
+ /// <param name="timeout">LCD timeout to be set.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void SetLcdTimeout(LcdTimeOut timeout)
+ {
+ int ret = Interop.CallManager.SetLcdTimeOut(_handle, timeout);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to set LCD timeout, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Starts voice recording.
+ /// </summary>
+ /// <param name="number">Call number.</param>
+ /// <exception cref="ArgumentNullException">Thrown when number is passed as null.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StartVoiceRecord(string number)
+ {
+ if (number == null)
+ {
+ throw new ArgumentNullException("Call number is null");
+ }
+
+ int ret = Interop.CallManager.StartVoiceRecord(_handle, number);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to start voice record, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Stops voice record.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void StopVoiceRecord()
+ {
+ int ret = Interop.CallManager.StopVoiceRecord(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to stop voice record, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+ }
+
+ /// <summary>
+ /// Gets all current call data.
+ /// </summary>
+ /// <param name="incoming">Incoming calldata instance to be filled.</param>
+ /// <param name="active">Active calldata instance to be filled.</param>
+ /// <param name="held">Held calldata instance to be filled.</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void GetAllCallData(out CallData incoming, out CallData active, out CallData held)
+ {
+ int ret = Interop.CallManager.GetAllCallData(_handle, out IntPtr incomingCall, out IntPtr activeCall, out IntPtr heldCall);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get all call data, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle);
+ }
+
+ incoming = CmUtility.GetCallData(incomingCall);
+ active = CmUtility.GetCallData(activeCall);
+ held = CmUtility.GetCallData(heldCall);
+ }
+
+ /// <summary>
+ /// Holds the active call.
+ /// </summary>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://developer.samsung.com/tizen/privilege/call.admin</privilege>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void HoldCall()
+ {
+ int ret = Interop.CallManager.HoldCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to hold call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle, "http://developer.samsung.com/tizen/privilege/call.admin");
+ }
+ }
+
+ /// <summary>
+ /// Unholds the active call.
+ /// </summary>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://developer.samsung.com/tizen/privilege/call.admin</privilege>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void UnholdCall()
+ {
+ int ret = Interop.CallManager.UnholdCall(_handle);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to unhold call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle, "http://developer.samsung.com/tizen/privilege/call.admin");
+ }
+ }
+
+ /// <summary>
+ /// Ends ongoing call.
+ /// </summary>
+ /// <param name="id">ID of the call which is to be ended.</param>
+ /// <param name="type">Call release type.</param>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://developer.samsung.com/tizen/privilege/call.admin</privilege>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
+ public void EndCall(uint id, CallReleaseType type)
+ {
+ int ret = Interop.CallManager.EndCall(_handle, id, type);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to end call, Error: " + (CmError)ret);
+ CmUtility.ThrowCmException(ret, _handle, "http://developer.samsung.com/tizen/privilege/call.admin");
+ }
+ }
+ }
+}
--- /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.
+ */
+
+namespace Tizen.CallManager
+{
+ /// <summary>
+ /// Enumeration for Call status.
+ /// </summary>
+ public enum CallStatus
+ {
+ /// <summary>
+ /// Call is in idle state.
+ /// </summary>
+ Idle,
+ /// <summary>
+ /// A new call arrived and is ringing or waiting.
+ /// </summary>
+ Ringing,
+ /// <summary>
+ /// At least one call exist that is in dialing, alerting, active, on hold state.
+ /// </summary>
+ OffHook,
+ /// <summary>
+ /// Max state.
+ /// </summary>
+ Max
+ }
+
+ /// <summary>
+ /// Enumeration for Mute status.
+ /// </summary>
+ public enum CallMuteStatus
+ {
+ /// <summary>
+ /// Mute state is off.
+ /// </summary>
+ Off,
+ /// <summary>
+ /// Mute state is on.
+ /// </summary>
+ On,
+ /// <summary>
+ /// Max status.
+ /// </summary>
+ Max
+ }
+
+ /// <summary>
+ /// Enumeration for call dial status.
+ /// </summary>
+ public enum DialStatus
+ {
+ /// <summary>
+ /// Dial status is success.
+ /// </summary>
+ Success = 0,
+ /// <summary>
+ /// Dial status is cancel.
+ /// </summary>
+ Cancel,
+ /// <summary>
+ /// Dial status is fail.
+ /// </summary>
+ Fail,
+ /// <summary>
+ /// Dial status is fail SS.
+ /// </summary>
+ FailSS,
+ /// <summary>
+ /// Dial status is fail FDN.
+ /// </summary>
+ FailFdn,
+ /// <summary>
+ /// Dial status is fail flight mode.
+ /// </summary>
+ FailFlightMode
+ }
+
+ /// <summary>
+ /// Enumeration for DTMF indication type.
+ /// </summary>
+ public enum DtmfIndication
+ {
+ /// <summary>
+ /// DTMF indication type is idle.
+ /// </summary>
+ Idle = 0,
+ /// <summary>
+ /// DTMF indication type is progressing.
+ /// </summary>
+ Progressing,
+ /// <summary>
+ /// DTMF indication type is wait.
+ /// </summary>
+ Wait
+ }
+
+ /// <summary>
+ /// Enumeration for audio state type.
+ /// </summary>
+ public enum AudioState
+ {
+ /// <summary>
+ /// None.
+ /// </summary>
+ None,
+ /// <summary>
+ /// System LoudSpeaker path.
+ /// </summary>
+ Speaker,
+ /// <summary>
+ /// System Receiver.
+ /// </summary>
+ Receiver,
+ /// <summary>
+ /// Earjack path.
+ /// </summary>
+ EarJack,
+ /// <summary>
+ /// System BT Headset path.
+ /// </summary>
+ BTHeadset
+ }
+
+ /// <summary>
+ /// Enumeration for video record status.
+ /// </summary>
+ public enum VrStatus
+ {
+ /// <summary>
+ /// Video recording is started.
+ /// </summary>
+ Started = 0,
+ /// <summary>
+ /// Video recording is stopped.
+ /// </summary>
+ Stopped
+ }
+
+ /// <summary>
+ /// Enumeration for Video record status extra type.
+ /// </summary>
+ public enum VrStatusExtraType
+ {
+ /// <summary>
+ /// Start.
+ /// </summary>
+ Start = 0x00,
+ /// <summary>
+ /// Normal recording.
+ /// </summary>
+ StartNormal,
+ /// <summary>
+ /// Answering message.
+ /// </summary>
+ StartAnswerMessage,
+ /// <summary>
+ /// Start max.
+ /// </summary>
+ StartMax = 0x0f,
+ /// <summary>
+ /// Stop.
+ /// </summary>
+ Stop = 0x10,
+ /// <summary>
+ /// Stop by normal.
+ /// </summary>
+ StopByNormal,
+ /// <summary>
+ /// Stop by max size.
+ /// </summary>
+ StopByMaxSize,
+ /// <summary>
+ /// Stop by no free space.
+ /// </summary>
+ StopByNoFreeSpace,
+ /// <summary>
+ /// Stop by time limit.
+ /// </summary>
+ StopByTimeLimit,
+ /// <summary>
+ /// Error.
+ /// </summary>
+ StopError,
+ /// <summary>
+ /// Stop by max.
+ /// </summary>
+ StopMax = 0x1f
+ }
+
+ /// <summary>
+ /// Enumeration for call type.
+ /// </summary>
+ public enum CallType
+ {
+ /// <summary>
+ /// Voice call type.
+ /// </summary>
+ Voice,
+ /// <summary>
+ /// Video call type.
+ /// </summary>
+ Video,
+ /// <summary>
+ /// Invalid call type.
+ /// </summary>
+ Invalid
+ }
+
+ /// <summary>
+ /// Enumeration for sim slot type.
+ /// </summary>
+ public enum MultiSimSlot
+ {
+ /// <summary>
+ /// Sim slot 1.
+ /// </summary>
+ Slot1,
+ /// <summary>
+ /// Sim slot 2.
+ /// </summary>
+ Slot2,
+ /// <summary>
+ /// Follow system configuration.
+ /// </summary>
+ Default
+ }
+
+ /// <summary>
+ /// Enumeration for call answer types for accepting the incoming call.
+ /// </summary>
+ public enum CallAnswerType
+ {
+ /// <summary>
+ /// Only single call exist, Accept the Incoming call.
+ /// </summary>
+ Normal = 0,
+ /// <summary>
+ /// Put the active call on hold and accepts the call.
+ /// </summary>
+ HoldActiveAndAccept,
+ /// <summary>
+ /// Releases the active call and accept the call.
+ /// </summary>
+ ReleaseActiveAndAccept,
+ /// <summary>
+ /// Releases the held call and accept the call.
+ /// </summary>
+ ReleaseHoldAndAccept,
+ /// <summary>
+ /// Releases all calls and accept the call.
+ /// </summary>
+ ReleaseAllAndAccept
+ }
+
+ /// <summary>
+ /// Enumeration for call upgrade response type while receiving upgrade request.
+ /// </summary>
+ public enum CallUpgradeResponseType
+ {
+ /// <summary>
+ /// Accept incoming upgrade request.
+ /// </summary>
+ Accept,
+ /// <summary>
+ /// Reject Incoming upgrade request.
+ /// </summary>
+ Reject
+ }
+
+ /// <summary>
+ /// Enumeration for feature(speaker/bluetooth) status.
+ /// </summary>
+ public enum FeatureStatus
+ {
+ /// <summary>
+ /// On.
+ /// </summary>
+ On,
+ /// <summary>
+ /// Off.
+ /// </summary>
+ Off
+ }
+
+ /// <summary>
+ /// Enumeration for DTMF response type.
+ /// </summary>
+ public enum DtmfResponseType
+ {
+ /// <summary>
+ /// Cancel.
+ /// </summary>
+ Cancel = 0,
+ /// <summary>
+ /// Continue.
+ /// </summary>
+ Continue
+ }
+
+ /// <summary>
+ /// Enumeration for LCD time out.
+ /// </summary>
+ public enum LcdTimeOut
+ {
+ /// <summary>
+ /// Set.
+ /// </summary>
+ Set = 1,
+ /// <summary>
+ /// Unset.
+ /// </summary>
+ Unset,
+ /// <summary>
+ /// After lock-screen comes in Connected state LCD goes to OFF in 5 secs.
+ /// </summary>
+ LockscreenSet,
+ /// <summary>
+ /// When Keypad is ON, LCD goes to DIM in 3 secs then goes to OFF in 5 secs.
+ /// </summary>
+ KeypadSet,
+ /// <summary>
+ /// Default.
+ /// </summary>
+ Default
+ }
+
+ /// <summary>
+ /// Enumeration for contact name mode.
+ /// </summary>
+ public enum CallNameMode
+ {
+ /// <summary>
+ /// None.
+ /// </summary>
+ None,
+ /// <summary>
+ /// Unknown.
+ /// </summary>
+ Unknown,
+ /// <summary>
+ /// Private.
+ /// </summary>
+ Private,
+ /// <summary>
+ /// Payphone.
+ /// </summary>
+ PayPhone
+ }
+
+ /// <summary>
+ /// Enumeration for LCD control state.
+ /// </summary>
+ public enum LcdControlState
+ {
+ /// <summary>
+ /// Off.
+ /// </summary>
+ Off = 1,
+ /// <summary>
+ /// On.
+ /// </summary>
+ On,
+ /// <summary>
+ /// On lock.
+ /// </summary>
+ OnLock,
+ /// <summary>
+ /// On unlock.
+ /// </summary>
+ OnUnlock,
+ /// <summary>
+ /// Off sleep lock.
+ /// </summary>
+ OffSleepLock,
+ /// <summary>
+ /// Off sleep unlock.
+ /// </summary>
+ OffSleepUnlock
+ }
+
+ /// <summary>
+ /// Enumeration for call event type.
+ /// </summary>
+ public enum CallEvent
+ {
+ /// <summary>
+ /// Call Idle event.
+ /// </summary>
+ Idle = 0,
+ /// <summary>
+ /// Call Dialling event.
+ /// </summary>
+ Dialing,
+ /// <summary>
+ /// Call Active event.
+ /// </summary>
+ Active,
+ /// <summary>
+ /// Call Held event.
+ /// </summary>
+ Held,
+ /// <summary>
+ /// Call Alert event.
+ /// </summary>
+ Alert,
+ /// <summary>
+ /// Call Incoming event.
+ /// </summary>
+ Incoming,
+ /// <summary>
+ /// Call Waiting event.
+ /// </summary>
+ Waiting,
+ /// <summary>
+ /// Call Join event.
+ /// </summary>
+ Join,
+ /// <summary>
+ /// Call Split event.
+ /// </summary>
+ Split,
+ /// <summary>
+ /// Call Swapped event.
+ /// </summary>
+ Swapped,
+ /// <summary>
+ /// Call Retrieved event.
+ /// </summary>
+ Retrieved,
+ /// <summary>
+ /// Sat call control event.
+ /// </summary>
+ SatCallControl,
+ /// <summary>
+ /// Call upgrade request event.
+ /// </summary>
+ UpgradeRequest,
+ /// <summary>
+ /// Call downgraded event.
+ /// </summary>
+ Downgraded,
+ /// <summary>
+ /// Call upgrade success event.
+ /// </summary>
+ UpgradeSuccess,
+ /// <summary>
+ /// Call upgrade failure event.
+ /// </summary>
+ UpgradeFailure,
+ /// <summary>
+ /// Call downgrade success event.
+ /// </summary>
+ DowngradeSuccess,
+ /// <summary>
+ /// Call downgrade failure event.
+ /// </summary>
+ DowngradeFailure,
+ /// <summary>
+ /// Call confirm upgrade success event.
+ /// </summary>
+ ConfirmUpgradeSuccess,
+ /// <summary>
+ /// Call confirm upgrade failure event.
+ /// </summary>
+ ConfirmUpgradeFailure,
+ /// <summary>
+ /// VoWiFi ~ LTE hand-over update event.
+ /// </summary>
+ VoWiFiLteHandoverUpdate
+ }
+
+ /// <summary>
+ /// Enumeration for call direction
+ /// </summary>
+ public enum CallDirection
+ {
+ /// <summary>
+ /// MO call.
+ /// </summary>
+ MO,
+ /// <summary>
+ /// MT call.
+ /// </summary>
+ MT
+ }
+
+ /// <summary>
+ /// Enumeration for the call state.
+ /// </summary>
+ public enum CallState
+ {
+ /// <summary>
+ /// Call is in idle state.
+ /// </summary>
+ Idle,
+ /// <summary>
+ /// Call is in connected and conversation state.
+ /// </summary>
+ Active,
+ /// <summary>
+ /// Call is in held state.
+ /// </summary>
+ Held,
+ /// <summary>
+ /// Call is in dialing state.
+ /// </summary>
+ Dialing,
+ /// <summary>
+ /// Call is in alerting state.
+ /// </summary>
+ Alert,
+ /// <summary>
+ /// Call is in incoming state.
+ /// </summary>
+ Incoming,
+ /// <summary>
+ /// Call is in answered state, and waiting for connected indication event.
+ /// </summary>
+ Waiting
+ }
+
+ /// <summary>
+ /// Enumeration for call domain.
+ /// </summary>
+ public enum CallDomain
+ {
+ /// <summary>
+ /// CS call domain.
+ /// </summary>
+ Cs,
+ /// <summary>
+ /// PS call domain.
+ /// </summary>
+ Ps,
+ /// <summary>
+ /// Wearable call through BT handsfree profile.
+ /// </summary>
+ Hfp
+ }
+
+ /// <summary>
+ /// Enumeration for call end cause type.
+ /// </summary>
+ public enum CallEndCause
+ {
+ /// <summary>
+ /// Call ended.
+ /// </summary>
+ Ended,
+ /// <summary>
+ /// Call disconnected.
+ /// </summary>
+ Disconnected,
+ /// <summary>
+ /// Service not allowed.
+ /// </summary>
+ ServiceNotAllowed,
+ /// <summary>
+ /// Call barred.
+ /// </summary>
+ Barred,
+ /// <summary>
+ /// No service.
+ /// </summary>
+ NoService,
+ /// <summary>
+ /// Network busy.
+ /// </summary>
+ NwBusy,
+ /// <summary>
+ /// Network failed.
+ /// </summary>
+ NwFailed,
+ /// <summary>
+ /// No answer from other party.
+ /// </summary>
+ NoAnswer,
+ /// <summary>
+ /// No credit available.
+ /// </summary>
+ NoCredit,
+ /// <summary>
+ /// Call rejected.
+ /// </summary>
+ Rejected,
+ /// <summary>
+ /// User busy.
+ /// </summary>
+ UserBusy,
+ /// <summary>
+ /// Wrong group.
+ /// </summary>
+ WrongGroup,
+ /// <summary>
+ /// Call not allowed.
+ /// </summary>
+ NotAllowed,
+ /// <summary>
+ /// Tapi error.
+ /// </summary>
+ TapiError,
+ /// <summary>
+ /// Call failed.
+ /// </summary>
+ Failed,
+ /// <summary>
+ /// User not responding.
+ /// </summary>
+ NoUserResponding,
+ /// <summary>
+ /// User alerting no answer.
+ /// </summary>
+ UserAlertingNoAnswer,
+ /// <summary>
+ /// Circuit Channel Unavailable,Network is out of Order,Switching equipment congestion,Temporary Failure.
+ /// </summary>
+ ServiceTempUnavailable,
+ /// <summary>
+ /// Called Party Rejects the Call.
+ /// </summary>
+ UserUnavailable,
+ /// <summary>
+ /// Entered number is invalid or incomplete.
+ /// </summary>
+ InvalidNumberFormat,
+ /// <summary>
+ /// Entered number has been changed.
+ /// </summary>
+ NumberChanged,
+ /// <summary>
+ /// Unassigned/Unallocated number.
+ /// </summary>
+ UnassignedNumber,
+ /// <summary>
+ /// Called Party does not respond.
+ /// </summary>
+ UserDoesNotRespond,
+ /// <summary>
+ /// IMEI rejected.
+ /// </summary>
+ ImeiRejected,
+ /// <summary>
+ /// FDN number only.
+ /// </summary>
+ FixedDialingNumberOnly,
+ /// <summary>
+ /// SAT call control reject.
+ /// </summary>
+ SatCallControlReject,
+ /// <summary>
+ /// This number cannot receive video calls.
+ /// </summary>
+ CannotReceiveVideoCall
+ }
+
+ /// <summary>
+ /// Enumeration for call release type.
+ /// </summary>
+ public enum CallReleaseType
+ {
+ /// <summary>
+ /// Release call using given call handle.
+ /// </summary>
+ ByCallHandle = 0,
+ /// <summary>
+ /// Release all Calls.
+ /// </summary>
+ AllCalls,
+ /// <summary>
+ /// Releases all hold calls.
+ /// </summary>
+ AllHoldCalls,
+ /// <summary>
+ /// Releases all active calls.
+ /// </summary>
+ AllActiveCalls
+ }
+}
--- /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.CallManager
+{
+ /// <summary>
+ /// An extended EventArgs class which contains information about DTMF indication.
+ /// </summary>
+ public class DtmfIndicationEventArgs : EventArgs
+ {
+ private DtmfIndication _indication;
+ private string _dtmfNumber;
+
+ internal DtmfIndicationEventArgs(DtmfIndication indication, string dtmfNumber)
+ {
+ _indication = indication;
+ _dtmfNumber = dtmfNumber;
+ }
+
+ /// <summary>
+ /// DTMF indication.
+ /// </summary>
+ public DtmfIndication Indication
+ {
+ get
+ {
+ return _indication;
+ }
+ }
+
+ /// <summary>
+ /// DTMF number.
+ /// </summary>
+ public string DtmfNumber
+ {
+ get
+ {
+ return _dtmfNumber;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed audio status.
+ /// </summary>
+ public class AudioStatusChangedEventArgs : EventArgs
+ {
+ private AudioState _state;
+
+ internal AudioStatusChangedEventArgs(AudioState state)
+ {
+ _state = state;
+ }
+
+ /// <summary>
+ /// Audio state.
+ /// </summary>
+ public AudioState State
+ {
+ get
+ {
+ return _state;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed voice record status.
+ /// </summary>
+ public class VoiceRecordStatusEventArgs : EventArgs
+ {
+ private VrStatus _status;
+ private VrStatusExtraType _extraType;
+
+ internal VoiceRecordStatusEventArgs(VrStatus status, VrStatusExtraType extraType)
+ {
+ _status = status;
+ _extraType = extraType;
+ }
+
+ /// <summary>
+ /// Voice record status.
+ /// </summary>
+ public VrStatus Status
+ {
+ get
+ {
+ return _status;
+ }
+ }
+
+ /// <summary>
+ /// Voice record status extra type.
+ /// </summary>
+ public VrStatusExtraType ExtraType
+ {
+ get
+ {
+ return _extraType;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed call mute status.
+ /// </summary>
+ public class CallMuteStatusChangedEventArgs : EventArgs
+ {
+ private CallMuteStatus _Status;
+
+ internal CallMuteStatusChangedEventArgs(CallMuteStatus status)
+ {
+ _Status = status;
+ }
+
+ /// <summary>
+ /// Call mute status.
+ /// </summary>
+ public CallMuteStatus Status
+ {
+ get
+ {
+ return _Status;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed call status.
+ /// </summary>
+ public class CallStatusChangedEventArgs : EventArgs
+ {
+ private CallStatus _status;
+ private string _callNumber;
+
+ internal CallStatusChangedEventArgs(CallStatus status, string number)
+ {
+ _status = status;
+ _callNumber = number;
+ }
+
+ /// <summary>
+ /// Call status.
+ /// </summary>
+ public CallStatus Status
+ {
+ get
+ {
+ return _status;
+ }
+ }
+
+ /// <summary>
+ /// Call number.
+ /// </summary>
+ public string CallNumber
+ {
+ get
+ {
+ return _callNumber;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed dial status.
+ /// </summary>
+ public class DialStatusEventArgs : EventArgs
+ {
+ private DialStatus _status;
+
+ internal DialStatusEventArgs(DialStatus status)
+ {
+ _status = status;
+ }
+
+ /// <summary>
+ /// Dial status.
+ /// </summary>
+ public DialStatus Status
+ {
+ get
+ {
+ return _status;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed call event.
+ /// </summary>
+ public class CallEventEventArgs : EventArgs
+ {
+ private CallEvent _event;
+ private CallEventData _eventData;
+
+ internal CallEventEventArgs(CallEvent callEvent, CallEventData data)
+ {
+ _event = callEvent;
+ _eventData = data;
+ }
+
+ /// <summary>
+ /// Call event.
+ /// </summary>
+ public CallEvent Event
+ {
+ get
+ {
+ return _event;
+ }
+ }
+
+ /// <summary>
+ /// Call event data.
+ /// </summary>
+ public CallEventData EventData
+ {
+ get
+ {
+ return _eventData;
+ }
+ }
+ }
+}
--- /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.CallManager
+{
+ internal enum CmError
+ {
+ None = ErrorCode.None,
+ OutOfMemory = ErrorCode.OutOfMemory,
+ InvalidParameter = ErrorCode.InvalidParameter,
+ PermissionDenied = ErrorCode.PermissionDenied,
+ NotSupported = ErrorCode.NotSupported,
+ NotRegistered = -0x00000000 | 0x01,
+ AlreadyRegistered = -0x00000000 | 0x02,
+ OperationFailed = -0x00000000 | 0x03,
+ InvalidState = -0x00000000 | 0x04
+ }
+
+ internal static class CmUtility
+ {
+ internal const string LogTag = "Tizen.CallManager";
+
+ internal static CallData GetCallData(IntPtr handle)
+ {
+ CallData data = new CallData();
+ int ret = Interop.CallManager.GetCallId(handle, out uint id);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call ID from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallId = id;
+ }
+
+ ret = Interop.CallManager.GetCallDirection(handle, out CallDirection direction);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call direction from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallDirection = direction;
+ }
+
+ ret = Interop.CallManager.GetCallNumber(handle, out string number);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call number from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.Number = number;
+ }
+
+ ret = Interop.CallManager.GetCallingName(handle, out string name);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get calling name from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.Name = name;
+ }
+
+ ret = Interop.CallManager.GetCallType(handle, out CallType type);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call type from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallType = type;
+ }
+
+ ret = Interop.CallManager.GetCallState(handle, out CallState state);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call state from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallState = state;
+ }
+
+ ret = Interop.CallManager.GetCallMemberCount(handle, out int count);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call member count from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.Count = count;
+ }
+
+ ret = Interop.CallManager.IsEmergencyCall(handle, out bool isEmergency);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to check if the call is emergency from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsEcc = isEmergency;
+ }
+
+ ret = Interop.CallManager.IsVoiceMailNumber(handle, out bool isVoiceMail);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to check if the number is voicemail number from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsVoiceMail = isVoiceMail;
+ }
+
+ ret = Interop.CallManager.GetCallDomain(handle, out CallDomain domain);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get call domain from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallDomain = domain;
+ }
+
+ ret = Interop.CallManager.GetPersonId(handle, out int personId);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get person ID from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.PersonIndex = personId;
+ }
+
+ ret = Interop.CallManager.GetStartTime(handle, out long startTime);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get start time from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallStartTime = startTime;
+ }
+
+ ret = Interop.CallManager.GetNameMode(handle, out CallNameMode nameMode);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get name mode from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.CallNameMode = nameMode;
+ }
+
+ ret = Interop.CallManager.GetSessionId(handle, out int sessionId);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get session ID from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.SessionIdIms = sessionId;
+ }
+
+ ret = Interop.CallManager.GetHdIconState(handle, out int isHdEnable);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get HD icon state from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsHdEnableIms = (isHdEnable == 1) ? true : false;
+ }
+
+ ret = Interop.CallManager.IsWiFiCalling(handle, out int isWiFiCalling);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to identify WiFi calling from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsWiFiCall = (isWiFiCalling == 1) ? true : false;
+ }
+
+ ret = Interop.CallManager.GetUpgradeDowngradeState(handle, out int isEnable);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get updagrade downgrade state from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsUpgradeDowngrade = (isEnable == 1) ? true : false;
+ }
+
+ ret = Interop.CallManager.IsRemoteOnHold(handle, out int isHold);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get remote on hold state from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsRemoteHold = (isHold == 1) ? true : false;
+ }
+
+ ret = Interop.CallManager.IsAddedToConference(handle, out int isAdded);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to check if the call is in conf state from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsAddedToConf = (isAdded == 1) ? true : false;
+ }
+
+ ret = Interop.CallManager.IsForwardedCall(handle, out bool isForwarded);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to check if the call is forwarded call from call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ data.IsForwardedCall = isForwarded;
+ }
+
+ return data;
+ }
+
+ internal static ConferenceCallData GetConfCallData(IntPtr handle)
+ {
+ ConferenceCallData confData = new ConferenceCallData();
+ int ret = Interop.CallManager.GetConfCallId(handle, out uint callId);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get conf call ID, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ confData.CallId = callId;
+ }
+
+ ret = Interop.CallManager.GetConfCallNumber(handle, out string number);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get conf call number, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ confData.Number = number;
+ }
+
+ ret = Interop.CallManager.GetConfCallPersonId(handle, out int personId);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get conf call person ID, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ confData.PersonIndex = personId;
+ }
+
+ ret = Interop.CallManager.GetConfCallNameMode(handle, out CallNameMode nameMode);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get conf call name mode, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ confData.NameMode = nameMode;
+ }
+
+ return confData;
+ }
+
+ internal static CallEventData GetCallEventData(IntPtr handle)
+ {
+ CallEventData eventData = new CallEventData();
+ int ret = Interop.CallManager.GetEventDataCallId(handle, out uint id);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get event data call ID, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.EventId = id;
+ }
+
+ ret = Interop.CallManager.GetSimSlot(handle, out MultiSimSlot simSlot);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get event data sim slot, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.Slot = simSlot;
+ }
+
+ ret = Interop.CallManager.GetEndCause(handle, out CallEndCause endCause);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get end cause, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.Cause = endCause;
+ }
+
+ ret = Interop.CallManager.GetIncomingCallData(handle, out IntPtr incoming);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get incoming call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.Incoming = GetCallData(incoming);
+ }
+
+ ret = Interop.CallManager.GetActiveCall(handle, out IntPtr active);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get active call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.Active = GetCallData(active);
+ }
+
+ ret = Interop.CallManager.GetHeldCall(handle, out IntPtr held);
+ if (ret != (int)CmError.None)
+ {
+ Log.Error(CmUtility.LogTag, "Failed to get held call data, Error: " + (CmError)ret);
+ }
+
+ else
+ {
+ eventData.Held = GetCallData(held);
+ }
+
+ return eventData;
+ }
+
+ internal static void ThrowCmException(int exception)
+ {
+ _throwException(exception, false, "");
+ }
+
+ internal static void ThrowCmException(int exception, IntPtr handle)
+ {
+ _throwException(exception, (handle == IntPtr.Zero), "");
+ }
+
+ internal static void ThrowCmException(int exception, IntPtr handle, string message)
+ {
+ _throwException(exception, (handle == IntPtr.Zero), message);
+ }
+
+ private static void _throwException(int exception, bool isHandleNull, string message)
+ {
+ CmError _error = (CmError)exception;
+ switch(_error)
+ {
+ case CmError.NotSupported:
+ throw new NotSupportedException("Unsupported feature: http://tizen.org/feature/network.telephony");
+ case CmError.PermissionDenied:
+ throw new UnauthorizedAccessException("Permission denied: " + message);
+ case CmError.OutOfMemory:
+ throw new OutOfMemoryException("System out of memory");
+ case CmError.InvalidParameter:
+ if (isHandleNull)
+ {
+ throw new InvalidOperationException("Invalid instance (object may have been disposed or released)");
+ }
+
+ throw new ArgumentException("Invalid parameter");
+ default:
+ throw new InvalidOperationException(_error.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;
+
+namespace Tizen.CallManager
+{
+ /// <summary>
+ /// A class which defines the properties of conference call.
+ /// </summary>
+ public class ConferenceCallData
+ {
+ internal uint CallId;
+ internal string Number;
+ internal int PersonIndex;
+ internal CallNameMode NameMode;
+ internal ConferenceCallData()
+ {
+ }
+
+ /// <summary>
+ /// Conference call ID.
+ /// </summary>
+ public uint Id
+ {
+ get
+ {
+ return CallId;
+ }
+ }
+
+ /// <summary>
+ /// Call number.
+ /// </summary>
+ public string CallNumber
+ {
+ get
+ {
+ return Number;
+ }
+ }
+
+ /// <summary>
+ /// Person ID.
+ /// </summary>
+ public int PersonId
+ {
+ get
+ {
+ return PersonIndex;
+ }
+ }
+
+ /// <summary>
+ /// Call name mode.
+ /// </summary>
+ public CallNameMode Mode
+ {
+ get
+ {
+ return NameMode;
+ }
+ }
+ }
+}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class Album
+ {
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_count_from_db")]
+ internal static extern MediaContentError GetAlbumCountFromDb(FilterHandle filter, out int count);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_media_count_from_db")]
+ internal static extern MediaContentError GetMediaCountFromDb(int albumId, FilterHandle filter, out int count);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_destroy")]
+ internal static extern MediaContentError Destroy(IntPtr album);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_clone")]
+ internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_id")]
+ internal static extern MediaContentError GetId(IntPtr album, out int albumId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_name")]
+ internal static extern MediaContentError GetName(IntPtr album, out IntPtr value);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_artist")]
+ internal static extern MediaContentError GetArtist(IntPtr album, out IntPtr value);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_art")]
+ internal static extern MediaContentError GetAlbumArt(IntPtr album, out IntPtr value);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_from_db")]
+ internal static extern MediaContentError GetAlbumFromDb(int albumId, out IntPtr album);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_album_from_db")]
+ internal static extern MediaContentError ForeachAlbumFromDb(FilterHandle filter,
+ Common.ItemCallback cb, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_media_from_db")]
+ internal static extern MediaContentError ForeachMediaFromDb(int albumId, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
+ }
+}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class AudioInfo
+ {
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError Destroy(IntPtr handle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetAlbum(IntPtr handle, out IntPtr albumName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_artist", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetArtist(IntPtr handle, out IntPtr artistName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetAlbumArtist(IntPtr handle, out IntPtr albumArtistName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_genre", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetGenre(IntPtr handle, out IntPtr genreName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_composer", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetComposer(IntPtr handle, out IntPtr composerName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_year", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetYear(IntPtr handle, out IntPtr year);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetRecordedDate(IntPtr handle, out IntPtr recordedDate);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetCopyright(IntPtr handle, out IntPtr copyright);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetTrackNum(IntPtr handle, out IntPtr trackNum);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetBitRate(IntPtr handle, out int bitRate);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bitpersample", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetBitPerSample(IntPtr handle, out int bitPerSample);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_sample_rate", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetSampleRate(IntPtr handle, out int sampleRate);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_channel", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetChannel(IntPtr handle, out int channel);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_duration", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetDuration(IntPtr handle, out int duration);
+ }
+}
+++ /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;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static partial class AudioInformation
- {
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Destroy(IntPtr media);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_clone", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Clone(out SafeAudioInformationHandle dst, SafeAudioInformationHandle src);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaId(SafeAudioInformationHandle audioInformationHandle, out IntPtr mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAlbum(SafeAudioInformationHandle audioInformationHandle, out IntPtr albumName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_artist", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetArtist(SafeAudioInformationHandle audioInformationHandle, out IntPtr artistName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAlbumArtist(SafeAudioInformationHandle audioInformationHandle, out IntPtr albumArtistName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_genre", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetGenre(SafeAudioInformationHandle audioInformationHandle, out IntPtr genreName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_composer", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetComposer(SafeAudioInformationHandle audioInformationHandle, out IntPtr composerName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_year", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetYear(SafeAudioInformationHandle audioInformationHandle, out IntPtr year);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetRecordedDate(SafeAudioInformationHandle audioInformationHandle, out IntPtr recordedDate);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetCopyright(SafeAudioInformationHandle audioInformationHandle, out IntPtr copyright);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetTrackNum(SafeAudioInformationHandle audioInformationHandle, out IntPtr trackNum);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetBitRate(SafeAudioInformationHandle audioInformationHandle, out int bitRate);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bitpersample", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetBitPerSample(SafeAudioInformationHandle audioInformationHandle, out int bitPerSample);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_sample_rate", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetSampleRate(SafeAudioInformationHandle audioInformationHandle, out int sampleRate);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_channel", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetChannel(SafeAudioInformationHandle audioInformationHandle, out int channel);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_duration", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetDuration(SafeAudioInformationHandle audioInformationHandle, out int duration);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedCount(SafeAudioInformationHandle audioInformationHandle, out int playedCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedTime(SafeAudioInformationHandle audioInformationHandle, out int playedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_position", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedPosition(SafeAudioInformationHandle audioInformationHandle, out int playedPosition);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedCount(SafeAudioInformationHandle audioInformationHandle, int playedCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedTime(SafeAudioInformationHandle audioInformationHandle, int playedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_position", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedPosition(SafeAudioInformationHandle audioInformationHandle, int playedPosition);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError UpdateToDB(IntPtr audioInformationHandle);
-
- internal sealed class SafeAudioInformationHandle : SafeHandle
- {
- public SafeAudioInformationHandle()
- : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return this.handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- AudioInformation.Destroy(this.handle);
- this.SetHandle(IntPtr.Zero);
- return true;
- }
- }
- }
-}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
internal partial class Interop
{
- internal static partial class MediaBookmark
+ internal static partial class Bookmark
{
- [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_insert_to_db")]
- internal static extern MediaContentError InsertToDb(string media_id, uint time, string thumbnail_path);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_create")]
+ internal static extern MediaContentError Create(string mediaId, int time, out IntPtr handle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_insert_to_db_v2")]
+ internal static extern MediaContentError Insert(IntPtr handle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_delete_from_db")]
- internal static extern MediaContentError DeleteFromDb(int bookmark_id);
+ internal static extern MediaContentError Delete(int id);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_bookmark_count_from_db")]
- internal static extern MediaContentError GetBookmarkCountFromDb(IntPtr filter, out int bookmark_count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
+ internal static extern MediaContentError GetCount(FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_destroy")]
internal static extern MediaContentError Destroy(IntPtr bookmark);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_bookmark_id")]
- internal static extern MediaContentError GetBookmarkId(IntPtr bookmark, out int bookmark_id);
+ internal static extern MediaContentError GetId(IntPtr bookmark, out int id);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_marked_time")]
- internal static extern MediaContentError GetMarkedTime(IntPtr bookmark, out uint marked_time);
+ internal static extern MediaContentError GetMarkedTime(IntPtr bookmark, out int time);
[DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_thumbnail_path")]
internal static extern MediaContentError GetThumbnailPath(IntPtr bookmark, out IntPtr filePath);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_set_thumbnail_path")]
+ internal static extern MediaContentError SetThumbnailPath(IntPtr bookmark, string filePath);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_name")]
+ internal static extern MediaContentError GetName(IntPtr bookmark, out IntPtr name);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_set_name")]
+ internal static extern MediaContentError SetName(IntPtr bookmark, string name);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_foreach_bookmark_from_db")]
+ internal static extern MediaContentError ForeachFromDb(FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class Glib
+ internal static partial class Common
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool GSourceFunc(IntPtr userData);
-
- [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint IdleAdd(GSourceFunc d, IntPtr data);
+ internal delegate bool ItemCallback(IntPtr itemHandle, IntPtr data);
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
internal static extern MediaContentError Destroy(IntPtr face);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_face_id")]
- internal static extern MediaContentError GetFaceId(IntPtr face, out IntPtr face_id);
+ internal static extern MediaContentError GetId(IntPtr face, out IntPtr faceId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_media_id")]
- internal static extern MediaContentError GetMediaId(IntPtr face, out IntPtr media_id);
+ internal static extern MediaContentError GetMediaId(IntPtr face, out IntPtr mediaId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_face_rect")]
- internal static extern MediaContentError GetFaceRect(IntPtr face, out int rect_x, out int rect_y, out int rect_w, out int IntPtr);
+ internal static extern MediaContentError GetFaceRect(IntPtr face,
+ out int x, out int y, out int w, out int h);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_orientation")]
- internal static extern MediaContentError GetOrientation(IntPtr face, out int orientation);
+ internal static extern MediaContentError GetOrientation(IntPtr face, out Orientation orientation);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_tag")]
internal static extern MediaContentError GetTag(IntPtr face, out IntPtr tag);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_create")]
- internal static extern MediaContentError Create(string media_id, out IntPtr face);
+ internal static extern MediaContentError Create(string mediaId, out IntPtr face);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_face_rect")]
- internal static extern MediaContentError SetFaceRect(IntPtr face, int rect_x, int rect_y, int rect_w, int IntPtr);
+ internal static extern MediaContentError SetFaceRect(IntPtr face, int x, int y, int w, int h);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_orientation")]
- internal static extern MediaContentError SetOrientation(IntPtr face, int orientation);
+ internal static extern MediaContentError SetOrientation(IntPtr face, Orientation orientation);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_tag")]
internal static extern MediaContentError SetTag(IntPtr face, string tag);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_insert_to_db")]
- internal static extern MediaContentError InsertToDb(IntPtr face);
+ internal static extern MediaContentError InsertToDb(IntPtr handle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_update_to_db")]
- internal static extern MediaContentError UpdateToDb(IntPtr face);
+ internal static extern MediaContentError Update(IntPtr face);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_delete_from_db")]
- internal static extern MediaContentError DeleteFromDb(string face_id);
+ internal static extern MediaContentError DeleteFromDb(string faceId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_face_foreach_face_from_db")]
+ internal static extern MediaContentError ForeachFromDb(FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
+using Tizen;
using Tizen.Content.MediaContent;
internal static partial class Interop
internal static partial class Filter
{
[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_create")]
- internal static extern MediaContentError Create(out IntPtr filter);
+ internal static extern MediaContentError Create(out FilterHandle filter);
[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_destroy")]
internal static extern MediaContentError Destroy(IntPtr filter);
[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_offset")]
- internal static extern MediaContentError SetOffset(IntPtr filter, int offset, int count);
+ internal static extern MediaContentError SetOffset(FilterHandle filter, int offset, int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_condition")]
- internal static extern MediaContentError SetCondition(IntPtr filter, string condition, ContentCollation type);
+ internal static extern MediaContentError SetCondition(FilterHandle filter, string condition,
+ Collation type);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_order")]
- internal static extern MediaContentError SetOrder(IntPtr filter, ContentOrder order, string keyword, ContentCollation type);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_order_v2")]
+ internal static extern MediaContentError SetOrder(FilterHandle filter, string orderExpression);
[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_storage")]
- internal static extern MediaContentError SetStorage(IntPtr filter, string storageId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_offset")]
- internal static extern MediaContentError GetOffset(IntPtr filter, out int offset, out int count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_condition")]
- internal static extern MediaContentError GetCondition(IntPtr filter, out IntPtr condition, out ContentCollation type);
+ internal static extern MediaContentError SetStorage(FilterHandle filter, string storageId);
+ }
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_order")]
- internal static extern MediaContentError GetOrder(IntPtr filter, out ContentOrder order, out IntPtr keyword, out ContentCollation type);
+ internal class FilterHandle : MediaContentCriticalHandle
+ {
+ public static readonly FilterHandle Null = new FilterHandle();
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_storage")]
- internal static extern MediaContentError GetStorage(IntPtr filter, out IntPtr storageId);
+ protected override MediaContentError DestroyHandle()
+ {
+ return Filter.Destroy(handle);
+ }
}
}
internal static partial class Folder
{
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_count_from_db")]
- internal static extern MediaContentError GetFolderCountFromDb(IntPtr filter, out int folder_count);
+ internal static extern MediaContentError GetFolderCountFromDb(FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(string folder_id, IntPtr filter, out int media_count);
+ internal static extern MediaContentError GetMediaCountFromDb(string folder_id, FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_clone")]
internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
internal static extern MediaContentError GetName(IntPtr folder, out IntPtr folder_name);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_modified_time")]
- internal static extern MediaContentError GetModifiedTime(IntPtr folder, out DateTime date);
+ internal static extern MediaContentError GetModifiedTime(IntPtr folder, out IntPtr date);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_type")]
- internal static extern MediaContentError GetStorageType(IntPtr folder, out ContentStorageType storage_type);
+ internal static extern MediaContentError GetStorageType(IntPtr folder, out StorageType storage_type);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_id")]
internal static extern MediaContentError GetStorageId(IntPtr folder, out IntPtr storage_id);
internal static extern MediaContentError GetOrder(IntPtr folder, out int order);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_from_db")]
- internal static extern MediaContentError GetFolderFromDb(string folder_id, out IntPtr folder);
+ internal static extern MediaContentError GetFolderFromDb(string id, out IntPtr folder);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_set_name")]
internal static extern MediaContentError SetName(IntPtr folder, string name);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_update_to_db")]
internal static extern MediaContentError UpdateToDb(IntPtr folder);
- //Callbacks
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaFolderCallback(IntPtr folderHandle, IntPtr data);
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaInfoCallback(IntPtr handle, IntPtr data);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_foreach_folder_from_db")]
- internal static extern MediaContentError ForeachFolderFromDb(IntPtr filter, MediaFolderCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachFolderFromDb(FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(string folder_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachMediaFromDb(string id, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr user_data);
}
}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class Group
+ {
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_group_count_from_db")]
+ internal static extern MediaContentError GetGroupCount(FilterHandle filter,
+ MediaInfoColumnKey group, out int count);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_media_count_from_db")]
+ internal static extern MediaContentError GetMediaCount(string groupName,
+ MediaInfoColumnKey groupType, FilterHandle filter, out int count);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool MediaGroupCallback(string groupName, IntPtr data);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_group_from_db")]
+ internal static extern MediaContentError ForeachGroup(FilterHandle filter,
+ MediaInfoColumnKey group, MediaGroupCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_media_from_db")]
+ internal static extern MediaContentError ForeachMedia(string groupName, MediaInfoColumnKey group,
+ FilterHandle filter, Common.ItemCallback callback, IntPtr userData = default(IntPtr));
+ }
+}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class ImageInfo
+ {
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError Destroy(IntPtr media);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_orientation", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetOrientation(IntPtr handle, out Orientation orientation);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_date_taken", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetDateTaken(IntPtr handle, out IntPtr dateTaken);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_burst_id", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetBurstId(IntPtr handle, out IntPtr burstId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_exposure_time", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetExposureTime(IntPtr handle, out IntPtr exposureTime);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_fnumber", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetFNumber(IntPtr handle, out double fNumber);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_iso", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetISO(IntPtr handle, out int iso);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetModel(IntPtr handle, out IntPtr model);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_is_burst_shot", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError IsBurstShot(IntPtr handle, out bool isBurstShot);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetMediaId(IntPtr handle, out IntPtr mediaId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetWidth(IntPtr handle, out int width);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetHeight(IntPtr handle, out int width);
+ }
+}
+++ /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;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static partial class ImageInformation
- {
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Destroy(IntPtr media);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_clone", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Clone(out SafeImageInformationHandle dst, SafeImageInformationHandle src);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_orientation", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetOrientation(SafeImageInformationHandle imageInformationHandle, out MediaContentOrientation orientation);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_date_taken", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetDateTaken(SafeImageInformationHandle imageInformationHandle, out IntPtr dateTaken);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_burst_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetBurstId(SafeImageInformationHandle imageInformationHandle, out IntPtr burstId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_exposure_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetExposureTime(SafeImageInformationHandle imageInformationHandle, out IntPtr exposureTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_fnumber", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetFNumber(SafeImageInformationHandle imageInformationHandle, out double fNumber);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_iso", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetISO(SafeImageInformationHandle imageInformationHandle, out int iso);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetModel(SafeImageInformationHandle imageInformationHandle, out IntPtr model);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_is_burst_shot", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError IsBurstShot(SafeImageInformationHandle imageInformationHandle, out bool isBurstShot);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_set_orientation", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetOrientation(SafeImageInformationHandle imageInformationHandle, MediaContentOrientation orientation);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaId(SafeImageInformationHandle imageInformationHandle, out IntPtr mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetWidth(SafeImageInformationHandle imageInformationHandle, out int width);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetHeight(SafeImageInformationHandle imageInformationHandle, out int width);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError UpdateToDB(IntPtr imageInformationHandle);
-
- internal sealed class SafeImageInformationHandle : SafeHandle
- {
- public SafeImageInformationHandle()
- : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return this.handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- ImageInformation.Destroy(this.handle);
- this.SetHandle(IntPtr.Zero);
- return true;
- }
- }
- }
-}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
* limitations under the License.
*/
-
internal static partial class Interop
{
internal static partial class Libraries
{
public const string MediaContent = "libcapi-content-media-content.so.0";
- public const string Glib = "libglib-2.0.so.0";
public const string Libc = "libc.so.6";
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
-
internal static partial class Interop
{
internal static partial class Content
[DllImport(Libraries.MediaContent, EntryPoint = "media_content_cancel_scan_folder")]
internal static extern MediaContentError CancelScanFolder(string folderPath);
- // Callback
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void MediaScanCompletedCallback(MediaContentError error, IntPtr data);
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void MediaContentDBUpdatedCallback(MediaContentError error, int pid, MediaContentUpdateItemType updateItem, MediaContentDBUpdateType updateType, MediaContentType mediaType, string uuid, string filePath, string mimeType, IntPtr data);
+ internal delegate void MediaContentDBUpdatedCallback(MediaContentError error, int pid, ItemType updateItem,
+ OperationType updateType, MediaType mediaType, string uuid, string filePath, string mimeType, IntPtr data);
[DllImport(Libraries.MediaContent, EntryPoint = "media_content_scan_folder")]
- internal static extern MediaContentError ScanFolder(string folderPath, bool is_recursive, MediaScanCompletedCallback scanCompletedCallback, IntPtr userData);
+ internal static extern MediaContentError ScanFolder(string folderPath,
+ bool recursive, MediaScanCompletedCallback scanCompletedCallback, IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "media_content_add_db_updated_cb")]
- internal static extern MediaContentError AddDbUpdatedCb(MediaContentDBUpdatedCallback mediaContentDBUpdatedCallback, IntPtr userData, out IntPtr noti_handle);
+ internal static extern MediaContentError AddDbUpdatedCb(MediaContentDBUpdatedCallback mediaContentDBUpdatedCallback,
+ IntPtr userData, out IntPtr notiHandle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_content_remove_db_updated_cb")]
- internal static extern MediaContentError RemoveDbUpdatedCb(IntPtr noti_handle);
+ internal static extern MediaContentError RemoveDbUpdatedCb(IntPtr notiHandle);
}
}
--- /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;
+using Tizen;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal abstract class MediaContentCriticalHandle : CriticalHandle
+ {
+ public MediaContentCriticalHandle() : base(IntPtr.Zero)
+ {
+ }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+
+ protected override bool ReleaseHandle()
+ {
+ var result = DestroyHandle();
+ if (result != MediaContentError.None)
+ {
+ Log.Error(GetType().Name, $"Failed to destroy handle : {result}");
+ return false;
+ }
+
+ return true;
+ }
+
+ protected abstract MediaContentError DestroyHandle();
+ }
+}
+++ /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;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static partial class Group
- {
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_count_from_db")]
- internal static extern MediaContentError MediaAlbumGetAlbumCountFromDb(IntPtr filter, out int album_count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_media_count_from_db")]
- internal static extern MediaContentError MediaAlbumGetMediaCountFromDb(int album_id, IntPtr filter, out int media_count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_destroy")]
- internal static extern MediaContentError MediaAlbumDestroy(IntPtr album);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_clone")]
- internal static extern MediaContentError MediaAlbumClone(out IntPtr dst, IntPtr src);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_id")]
- internal static extern MediaContentError MediaAlbumGetAlbumId(IntPtr album, out int album_id);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_name")]
- internal static extern MediaContentError MediaAlbumGetName(IntPtr album, out IntPtr album_name);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_artist")]
- internal static extern MediaContentError MediaAlbumGetArtist(IntPtr album, out IntPtr artist);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_art")]
- internal static extern MediaContentError MediaAlbumGetAlbumArt(IntPtr album, out IntPtr album_art);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_from_db")]
- internal static extern MediaContentError MediaAlbumGetAlbumFromDb(int album_id, out IntPtr album);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_group_count_from_db")]
- internal static extern MediaContentError GetGroupCountFromDb(IntPtr filter, MediaGroupType group, out int group_count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(string group_name, MediaGroupType group, IntPtr filter, out int media_count);
-
- //Callbacks
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaGroupCallback(string groupName, IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaAlbumCallback(IntPtr albumHandle, IntPtr data);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_album_from_db")]
- internal static extern MediaContentError MediaAlbumForeachAlbumFromDb(IntPtr filter, MediaAlbumCallback callback, IntPtr user_data);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_media_from_db")]
- internal static extern MediaContentError MediaAlbumForeachMediaFromDb(int albumId, IntPtr filter, MediaInfoCallback callback, IntPtr user_data);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_group_from_db")]
- internal static extern MediaContentError ForeachGroupFromDb(IntPtr filter, MediaGroupType group, MediaGroupCallback callback, IntPtr user_data);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(string groupName, MediaGroupType group, IntPtr filter, MediaInfoCallback callback, IntPtr user_data);
- }
-}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class MediaInfo
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ThumbnailCompletedCallback(MediaContentError error, string filePath, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void FaceDetectionCompletedCallback(MediaContentError error, int count, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void InsertCompletedCallback(MediaContentError error, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void InsertBurstShotCompletedCallback(MediaContentError error, IntPtr userData);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_to_db")]
+ internal static extern MediaContentError Insert(string filePath, out MediaInfoHandle info);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_batch_to_db")]
+ internal static extern MediaContentError BatchInsert(string[] filePathArray, int arrayLength,
+ InsertCompletedCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_burst_shot_to_db")]
+ internal static extern MediaContentError BurstShotInsert(string[] filePathArray, int arrayLength,
+ InsertBurstShotCompletedCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_from_db")]
+ internal static extern MediaContentError Delete(string mediaId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_batch_from_db")]
+ internal static extern MediaContentError BatchDelete(FilterHandle filter);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_destroy")]
+ internal static extern MediaContentError Destroy(IntPtr handle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_count_from_db")]
+ internal static extern MediaContentError GetMediaCount(FilterHandle filter, out int mediaCount);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_media_from_db")]
+ internal static extern MediaContentError ForeachMedia(FilterHandle filter, Common.ItemCallback callback,
+ IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_tag_count_from_db")]
+ internal static extern MediaContentError GetTagCount(string mediaId, FilterHandle filter, out int tagCount);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_tag_from_db")]
+ internal static extern MediaContentError ForeachTags(string mediaId, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_bookmark_count_from_db")]
+ internal static extern MediaContentError GetBookmarkCount(string mediaId, FilterHandle filter, out int bookmarkCount);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_bookmark_from_db")]
+ internal static extern MediaContentError ForeachBookmarks(string mediaId, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_face_count_from_db")]
+ internal static extern MediaContentError GetFaceCount(string mediaId, FilterHandle filter, out int bookmarkCount);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_face_from_db")]
+ internal static extern MediaContentError ForeachFaces(string mediaId, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_image")]
+ internal static extern MediaContentError GetImage(MediaInfoHandle handle, out IntPtr imageHandle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_video")]
+ internal static extern MediaContentError GetVideo(MediaInfoHandle handle, out IntPtr videoHandle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_audio")]
+ internal static extern MediaContentError GetAudio(MediaInfoHandle handle, out IntPtr audioHandle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_id")]
+ internal static extern MediaContentError GetMediaId(MediaInfoHandle mediaInformationHandle, out IntPtr mediaId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_file_path")]
+ internal static extern MediaContentError GetFilePath(MediaInfoHandle mediaInformationHandle, out IntPtr filePath);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_display_name")]
+ internal static extern MediaContentError GetDisplayName(MediaInfoHandle mediaInformationHandle, out IntPtr name);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_type")]
+ internal static extern MediaContentError GetMediaType(MediaInfoHandle mediaInformationHandle, out MediaType type);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_mime_type")]
+ internal static extern MediaContentError GetMimeType(MediaInfoHandle mediaInformationHandle, out IntPtr mimeType);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_size")]
+ internal static extern MediaContentError GetSize(MediaInfoHandle mediaInformationHandle, out long size);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_added_time")]
+ internal static extern MediaContentError GetAddedTime(MediaInfoHandle handle, out IntPtr posixTime);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_modified_time")]
+ internal static extern MediaContentError GetModifiedTime(MediaInfoHandle handle, out IntPtr posixTime);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_timeline")]
+ internal static extern MediaContentError GetTimeline(MediaInfoHandle handle, out IntPtr posixTime);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_thumbnail_path")]
+ internal static extern MediaContentError GetThumbnailPath(MediaInfoHandle mediaInformationHandle, out IntPtr filePath);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_description")]
+ internal static extern MediaContentError GetDescription(MediaInfoHandle mediaInformationHandle, out IntPtr description);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_longitude")]
+ internal static extern MediaContentError GetLongitude(MediaInfoHandle mediaInformationHandle, out double longitude);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_latitude")]
+ internal static extern MediaContentError GetLatitude(MediaInfoHandle mediaInformationHandle, out double latitude);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_altitude")]
+ internal static extern MediaContentError GetAltitude(MediaInfoHandle mediaInformationHandle, out double altitude);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_weather")]
+ internal static extern MediaContentError GetWeather(MediaInfoHandle mediaInformationHandle, out IntPtr weather);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_rating")]
+ internal static extern MediaContentError GetRating(MediaInfoHandle mediaInformationHandle, out int rating);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_favorite")]
+ internal static extern MediaContentError GetFavorite(MediaInfoHandle mediaInformationHandle, out bool favorite);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_provider")]
+ internal static extern MediaContentError GetProvider(MediaInfoHandle mediaInformationHandle, out IntPtr provider);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_title")]
+ internal static extern MediaContentError GetTitle(MediaInfoHandle mediaInformationHandle, out IntPtr title);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_category")]
+ internal static extern MediaContentError GetCategory(MediaInfoHandle mediaInformationHandle, out IntPtr category);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_location_tag")]
+ internal static extern MediaContentError GetLocationTag(MediaInfoHandle mediaInformationHandle, out IntPtr locationTag);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_age_rating")]
+ internal static extern MediaContentError GetAgeRating(MediaInfoHandle mediaInformationHandle, out IntPtr ageRating);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_id")]
+ internal static extern MediaContentError GetStorageId(MediaInfoHandle mediaInformationHandle, out IntPtr storageId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_is_drm")]
+ internal static extern MediaContentError IsDrm(MediaInfoHandle mediaInformationHandle, out bool isDrm);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_type")]
+ internal static extern MediaContentError GetStorageType(MediaInfoHandle mediaInformationHandle, out StorageType storageType);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db")]
+ internal static extern MediaContentError GetMediaFromDB(string mediaId, out MediaInfoHandle handle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_weather")]
+ internal static extern MediaContentError SetWeather(MediaInfoHandle mediaInformationHandle, string weather);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_favorite")]
+ internal static extern MediaContentError SetFavorite(MediaInfoHandle mediaInformationHandle, bool favorite);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_provider")]
+ internal static extern MediaContentError SetProvider(MediaInfoHandle mediaInformationHandle, string provider);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_category")]
+ internal static extern MediaContentError SetCategory(MediaInfoHandle mediaInformationHandle, string category);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_location_tag")]
+ internal static extern MediaContentError SetLocationTag(MediaInfoHandle mediaInformationHandle, string locationTag);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_age_rating")]
+ internal static extern MediaContentError SetAgeRating(MediaInfoHandle mediaInformationHandle, string ageRating);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_update_to_db")]
+ internal static extern MediaContentError UpdateToDB(MediaInfoHandle mediaInformationHandle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_move_to_db")]
+ internal static extern MediaContentError MoveToDB(MediaInfoHandle mediaInformationHandle, string dstPath);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_create_thumbnail")]
+ internal static extern MediaContentError CreateThumbnail(MediaInfoHandle handle,
+ ThumbnailCompletedCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_cancel_thumbnail")]
+ internal static extern MediaContentError CancelThumbnail(MediaInfoHandle mediaInformationHandle);
+
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_start_face_detection")]
+ internal static extern MediaContentError StartFaceDetection(MediaInfoHandle handle,
+ FaceDetectionCompletedCallback callback, IntPtr userData = default(IntPtr));
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_info_cancel_face_detection")]
+ internal static extern MediaContentError CancelFaceDetection(MediaInfoHandle handle);
+ }
+
+ internal sealed class MediaInfoHandle : SafeHandle
+ {
+ public MediaInfoHandle()
+ : base(IntPtr.Zero, true)
+ {
+ }
+
+ public MediaInfoHandle(IntPtr handle)
+ : this()
+ {
+ SetHandle(handle);
+ }
+
+ public override bool IsInvalid
+ {
+ get { return handle == IntPtr.Zero; }
+ }
+
+ protected override bool ReleaseHandle()
+ {
+ MediaInfo.Destroy(handle);
+ return true;
+ }
+ }
+}
+++ /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;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static partial class MediaInformation
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void MediaThumbnailCompletedCallback(MediaContentError error, string filePath, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaTagCallback(IntPtr tagHandle, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaBookmarkCallback(IntPtr bookmarkHandle, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaFaceCallback(IntPtr bookmarkHandle, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void MediaInsertCompletedCallback(MediaContentError error, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void MediaInsertBurstShotCompletedCallback(MediaContentError error, IntPtr UserData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaInformationCallback(IntPtr mediaInformationHandle, IntPtr UserData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Insert(string filePath, out SafeMediaInformationHandle info);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_batch_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError BatchInsert(string[] filePathArray, int arrayLength, MediaInsertCompletedCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_burst_shot_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError BurstShotInsert(string[] filePathArray, int arrayLength, MediaInsertBurstShotCompletedCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Delete(string mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_batch_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError BatchDelete(IntPtr filter);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_destroy", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Destroy(IntPtr mediaInformationHandle);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_clone", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Clone(out SafeMediaInformationHandle dst, IntPtr src);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_count_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaCount(IntPtr filter, out int mediaCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_media_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAllMedia(IntPtr filter, MediaInformationCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_tag_count_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetTagCount(string mediaId, IntPtr filter, out int tagCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_tag_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAllTags(string mediaId, IntPtr filter, MediaTagCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_bookmark_count_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetBookmarkCount(string mediaId, IntPtr filter, out int bookmarkCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_bookmark_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAllBookmarks(string mediaId, IntPtr filter, MediaBookmarkCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_face_count_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetFaceCount(string mediaId, IntPtr filter, out int bookmarkCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_face_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAllFaces(string mediaId, IntPtr filter, MediaFaceCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_image", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetImage(IntPtr mediaInformationHandle, out Interop.ImageInformation.SafeImageInformationHandle image);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_video", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetVideo(IntPtr mediaInformationHandle, out Interop.VideoInformation.SafeVideoInformationHandle video);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_audio", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAudio(IntPtr mediaInformationHandle, out Interop.AudioInformation.SafeAudioInformationHandle audio);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaId(SafeMediaInformationHandle mediaInformationHandle, out IntPtr mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_file_path", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetFilePath(SafeMediaInformationHandle mediaInformationHandle, out IntPtr filePath);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_display_name", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetDisplayName(SafeMediaInformationHandle mediaInformationHandle, out IntPtr name);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_type", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaType(SafeMediaInformationHandle mediaInformationHandle, out MediaContentType type);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_mime_type", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMimeType(SafeMediaInformationHandle mediaInformationHandle, out IntPtr mimeType);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_size", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetSize(SafeMediaInformationHandle mediaInformationHandle, out long size);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_added_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAddedTime(SafeMediaInformationHandle mediaInformationHandle, out int addedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_modified_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetModifiedTime(SafeMediaInformationHandle mediaInformationHandle, out int time);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_timeline", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetTimeline(SafeMediaInformationHandle mediaInformationHandle, out int time);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_thumbnail_path", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetThumbnailPath(SafeMediaInformationHandle mediaInformationHandle, out IntPtr filePath);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_description", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetDescription(SafeMediaInformationHandle mediaInformationHandle, out IntPtr description);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_longitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetLongitude(SafeMediaInformationHandle mediaInformationHandle, out double longitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_latitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetLatitude(SafeMediaInformationHandle mediaInformationHandle, out double latitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_altitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAltitude(SafeMediaInformationHandle mediaInformationHandle, out double altitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_weather", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetWeather(SafeMediaInformationHandle mediaInformationHandle, out IntPtr weather);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_rating", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetRating(SafeMediaInformationHandle mediaInformationHandle, out int rating);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_favorite", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetFavorite(SafeMediaInformationHandle mediaInformationHandle, out bool favorite);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_author", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAuthor(SafeMediaInformationHandle mediaInformationHandle, out IntPtr author);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_provider", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetProvider(SafeMediaInformationHandle mediaInformationHandle, out IntPtr provider);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_content_name", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetContentName(SafeMediaInformationHandle mediaInformationHandle, out IntPtr contentName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_title", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetTitle(SafeMediaInformationHandle mediaInformationHandle, out IntPtr title);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_category", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetCategory(SafeMediaInformationHandle mediaInformationHandle, out IntPtr category);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_location_tag", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetLocationTag(SafeMediaInformationHandle mediaInformationHandle, out IntPtr locationTag);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_age_rating", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAgeRating(SafeMediaInformationHandle mediaInformationHandle, out IntPtr ageRating);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_keyword", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetKeyword(SafeMediaInformationHandle mediaInformationHandle, out IntPtr keyword);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetStorageId(SafeMediaInformationHandle mediaInformationHandle, out IntPtr storageId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_is_drm", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError IsDrm(SafeMediaInformationHandle mediaInformationHandle, out bool isDrm);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_type", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetStorageType(SafeMediaInformationHandle mediaInformationHandle, out ContentStorageType storageType);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedCount(SafeMediaInformationHandle mediaInformationHandle, out int playedCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedAt(SafeMediaInformationHandle mediaInformationHandle, out int playedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaFromDB(string mediaId, out SafeMediaInformationHandle mediaInformationHandle);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_increase_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError IncreasePlayedCount(SafeMediaInformationHandle mediaInformationHandle);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedAt(SafeMediaInformationHandle mediaInformationHandle);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_display_name", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetDisplayName(SafeMediaInformationHandle mediaInformationHandle, string displayName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_description", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetDescription(SafeMediaInformationHandle mediaInformationHandle, string description);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_longitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetLongitude(SafeMediaInformationHandle mediaInformationHandle, double longitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_latitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetLatitude(SafeMediaInformationHandle mediaInformationHandle, double latitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_altitude", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetAltitude(SafeMediaInformationHandle mediaInformationHandle, double altitude);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_weather", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetWeather(SafeMediaInformationHandle mediaInformationHandle, string weather);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_rating", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetRating(SafeMediaInformationHandle mediaInformationHandle, int rating);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_favorite", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetFavorite(SafeMediaInformationHandle mediaInformationHandle, bool favorite);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_author", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetAuthor(SafeMediaInformationHandle mediaInformationHandle, string author);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_provider", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetProvider(SafeMediaInformationHandle mediaInformationHandle, string provider);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_content_name", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetContentName(SafeMediaInformationHandle mediaInformationHandle, string contentName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_category", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetCategory(SafeMediaInformationHandle mediaInformationHandle, string category);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_location_tag", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetLocationTag(SafeMediaInformationHandle mediaInformationHandle, string locationTag);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_age_rating", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetAgeRating(SafeMediaInformationHandle mediaInformationHandle, string ageRating);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_keyword", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetKeyword(SafeMediaInformationHandle mediaInformationHandle, string keyword);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_update_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError UpdateToDB(IntPtr mediaInformationHandle);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_refresh_metadata_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError RefreshMetadataToDB(string mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_added_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetAddedTime(SafeMediaInformationHandle mediaInformationHandle, int addedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_move_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError MoveToDB(SafeMediaInformationHandle mediaInformationHandle, string dstPath);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_create_thumbnail", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError CreateThumbnail(SafeMediaInformationHandle mediaInformationHandle, MediaThumbnailCompletedCallback callback, IntPtr userData);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_cancel_thumbnail", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError CancelThumbnail(SafeMediaInformationHandle mediaInformationHandle);
-
- internal sealed class SafeMediaInformationHandle : SafeHandle
- {
- public SafeMediaInformationHandle(IntPtr handle)
- : base(handle, true)
- {
- }
- public SafeMediaInformationHandle()
- : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return this.handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- MediaInformation.Destroy(this.handle);
- this.SetHandle(IntPtr.Zero);
- return true;
- }
- }
- }
-}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
{
internal static partial class Playlist
{
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_create")]
+ internal static extern MediaContentError Create(out IntPtr handle);
+
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_count_from_db")]
- internal static extern MediaContentError GetPlaylistCountFromDb(IntPtr filter, out int playlist_count);
+ internal static extern MediaContentError GetPlaylistCount(FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(int playlist_id, IntPtr filter, out int media_count);
+ internal static extern MediaContentError GetMediaCountFromDb(int playlistId,
+ FilterHandle filter, out int count);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_insert_to_db")]
- internal static extern MediaContentError InsertToDb(string name, out IntPtr playlist);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_insert_to_db_v2")]
+ internal static extern MediaContentError Insert(IntPtr playlist);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_delete_from_db")]
- internal static extern MediaContentError DeleteFromDb(int playlist_id);
+ internal static extern MediaContentError Delete(int id);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_update_to_db_v2")]
+ internal static extern MediaContentError Update(int id, IntPtr playlist);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_from_db")]
- internal static extern MediaContentError GetPlaylistFromDb(int playlist_id, out IntPtr playlist);
+ internal static extern MediaContentError GetPlaylistFromDb(int id, out IntPtr playlist);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_destroy")]
internal static extern MediaContentError Destroy(IntPtr playlist);
internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_id")]
- internal static extern MediaContentError GetPlaylistId(IntPtr playlist, out int playlist_id);
+ internal static extern MediaContentError GetId(IntPtr playlist, out int id);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_name")]
- internal static extern MediaContentError GetName(IntPtr playlist, out IntPtr playlist_name);
+ internal static extern MediaContentError GetName(IntPtr playlist, out IntPtr name);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_set_name")]
- internal static extern MediaContentError SetName(IntPtr playlist, string playlist_name);
+ internal static extern MediaContentError SetName(IntPtr playlist, string name);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_thumbnail_path")]
internal static extern MediaContentError GetThumbnailPath(IntPtr playlist, out IntPtr filePath);
internal static extern MediaContentError SetThumbnailPath(IntPtr playlist, string filePath);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_set_play_order")]
- internal static extern MediaContentError SetPlayOrder(IntPtr playlist, int playlist_member_id, int play_order);
+ internal static extern MediaContentError SetPlayOrder(IntPtr playlist, int memberId, int order);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_add_media")]
- internal static extern MediaContentError AddMedia(IntPtr playlist, string media_id);
+ internal static extern MediaContentError AddMedia(IntPtr playlist, string mediaId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_remove_media")]
- internal static extern MediaContentError RemoveMedia(IntPtr playlist, int playlist_member_id);
+ internal static extern MediaContentError RemoveMedia(IntPtr playlist, int memberId);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_play_order")]
- internal static extern MediaContentError GetPlayOrder(IntPtr playlist, int playlist_member_id, out int play_order);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_update_to_db")]
- internal static extern MediaContentError UpdateToDb(IntPtr playlist);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_play_order_v2")]
+ internal static extern MediaContentError GetPlayOrder(int playlistId, int memberId, out int order);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_import_from_file")]
- internal static extern MediaContentError ImportFromFile(string playlist_name, string filePath, out IntPtr playlist);
+ internal static extern MediaContentError ImportFromFile(string path, string name, out IntPtr playlist);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_export_to_file")]
internal static extern MediaContentError ExportToFile(IntPtr playlist, string filePath);
- //Callbacks
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaPlaylistCallback(IntPtr playListHandle, IntPtr data);
-
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool PlaylistMemberCallback(int playListMemberId, IntPtr mediaInformation, IntPtr data);
+ internal delegate bool PlaylistMemberCallback(int memberId, IntPtr mediaInfo, IntPtr data);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_foreach_playlist_from_db")]
- internal static extern MediaContentError ForeachPlaylistFromDb(IntPtr filter, MediaPlaylistCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachPlaylistFromDb(FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(int playlist_id, IntPtr filter, PlaylistMemberCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachMediaFromDb(int playlistId, FilterHandle filter,
+ PlaylistMemberCallback callback, IntPtr userData = default(IntPtr));
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
internal static partial class Interop
{
- internal static partial class Storage
+ internal static class Storage
{
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_info_from_db")]
- internal static extern MediaContentError GetStorageInfoFromDb(string storage_id, out IntPtr storage);
+ internal static extern MediaContentError GetStorageInfoFromDb(string id, out IntPtr storage);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_count_from_db")]
- internal static extern MediaContentError GetStorageCountFromDb(IntPtr filter, out int storage_count);
+ internal static extern MediaContentError GetStorageCountFromDb(FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(string storage_id, IntPtr filter, out int media_count);
+ internal static extern MediaContentError GetMediaCountFromDb(string id, FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_destroy")]
internal static extern MediaContentError Destroy(IntPtr storage);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_id")]
- internal static extern MediaContentError GetId(IntPtr storage, out IntPtr storage_id);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_name")]
- internal static extern MediaContentError GetName(IntPtr storage, out IntPtr storage_name);
+ internal static extern MediaContentError GetId(IntPtr storage, out IntPtr id);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_path")]
- internal static extern MediaContentError GetPath(IntPtr storage, out IntPtr storage_path);
+ internal static extern MediaContentError GetPath(IntPtr storage, out IntPtr path);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_type")]
- internal static extern MediaContentError GetType(IntPtr storage, out ContentStorageType storage_type);
-
- //Callbacks
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaStorageCallback(IntPtr mediaStorageHandle, IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data);
+ internal static extern MediaContentError GetType(IntPtr storage, out StorageType type);
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_storage_from_db")]
- internal static extern MediaContentError ForeachStorageFromDb(IntPtr filter, MediaStorageCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachStorageFromDb(FilterHandle filter, Common.ItemCallback callback,
+ IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(string storage_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachMediaFromDb(string id, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
}
}
* limitations under the License.
*/
-
using System;
using System.Runtime.InteropServices;
using Tizen.Content.MediaContent;
{
internal static partial class Tag
{
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_create")]
+ internal static extern MediaContentError Create(out IntPtr handle);
+
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_insert_to_db")]
- internal static extern MediaContentError InsertToDb(string tag_name, out IntPtr tag);
+ internal static extern MediaContentError Insert(string name, out IntPtr handle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_delete_from_db")]
- internal static extern MediaContentError DeleteFromDb(int tag_id);
+ internal static extern MediaContentError Delete(int tagId);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_update_to_db_v2")]
+ internal static extern MediaContentError Update(int tagId, IntPtr tag);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_from_db")]
+ internal static extern MediaContentError GetTagFromDb(int tagId, out IntPtr tag);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_count_from_db")]
- internal static extern MediaContentError GetTagCountFromDb(IntPtr filter, out int tag_count);
+ internal static extern MediaContentError GetTagCount(FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(int tag_id, IntPtr filter, out int media_count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
+ internal static extern MediaContentError GetMediaCount(int tagId, FilterHandle filter, out int count);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_destroy")]
internal static extern MediaContentError Destroy(IntPtr tag);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_id")]
- internal static extern MediaContentError GetTagId(IntPtr tag, out int tag_id);
+ internal static extern MediaContentError GetId(IntPtr tag, out int value);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_name")]
- internal static extern MediaContentError GetName(IntPtr tag, out IntPtr tag_name);
+ internal static extern MediaContentError GetName(IntPtr tag, out IntPtr value);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_from_db")]
- internal static extern MediaContentError GetTagFromDb(int tag_id, out IntPtr tag);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_set_name")]
+ internal static extern MediaContentError SetName(IntPtr tag, string value);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_add_media")]
- internal static extern MediaContentError AddMedia(IntPtr tag, string media_id);
+ internal static extern MediaContentError AddMedia(IntPtr tag, string mediaId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_remove_media")]
- internal static extern MediaContentError RemoveMedia(IntPtr tag, string media_id);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_set_name")]
- internal static extern MediaContentError SetName(IntPtr tag, string tag_name);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_update_to_db")]
- internal static extern MediaContentError UpdateToDb(IntPtr tag);
-
- //Callbacks
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool MediaTagCallback(IntPtr tag, IntPtr data);
+ internal static extern MediaContentError RemoveMedia(IntPtr tag, string mediaId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_foreach_tag_from_db")]
- internal static extern MediaContentError ForeachTagFromDb(IntPtr filter, MediaTagCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachTagFromDb(FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "media_tag_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(int tag_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data);
+ internal static extern MediaContentError ForeachMediaFromDb(int tagId, FilterHandle filter,
+ Common.ItemCallback callback, IntPtr userData = default(IntPtr));
}
}
--- /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;
+using Tizen.Content.MediaContent;
+
+internal static partial class Interop
+{
+ internal static partial class VideoInfo
+ {
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError Destroy(IntPtr handle);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetAlbum(IntPtr handle, out IntPtr albumName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_artist", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetArtist(IntPtr handle, out IntPtr artistName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetAlbumArtist(IntPtr handle, out IntPtr albumArtistName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_genre", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetGenre(IntPtr handle, out IntPtr genreName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_composer", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetComposer(IntPtr handle, out IntPtr composerName);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_year", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetYear(IntPtr handle, out IntPtr year);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetRecordedDate(IntPtr handle, out IntPtr recordedDate);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetCopyright(IntPtr handle, out IntPtr copyright);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetTrackNum(IntPtr handle, out IntPtr trackNum);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetBitRate(IntPtr handle, out int bitRate);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_duration", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetDuration(IntPtr handle, out int duration);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetWidth(IntPtr handle, out int width);
+
+ [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern MediaContentError GetHeight(IntPtr handle, out int width);
+ }
+}
+++ /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;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static partial class VideoInformation
- {
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Destroy(IntPtr media);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_clone", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError Clone(out SafeVideoInformationHandle dst, SafeVideoInformationHandle src);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaId(SafeVideoInformationHandle videoInformationHandle, out IntPtr mediaId);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAlbum(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_artist", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr artistName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetAlbumArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumArtistName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_genre", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetGenre(SafeVideoInformationHandle videoInformationHandle, out IntPtr genreName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_composer", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetComposer(SafeVideoInformationHandle videoInformationHandle, out IntPtr composerName);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_year", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetYear(SafeVideoInformationHandle videoInformationHandle, out IntPtr year);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetRecordedDate(SafeVideoInformationHandle videoInformationHandle, out IntPtr recordedDate);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetCopyright(SafeVideoInformationHandle videoInformationHandle, out IntPtr copyright);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetTrackNum(SafeVideoInformationHandle videoInformationHandle, out IntPtr trackNum);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetBitRate(SafeVideoInformationHandle videoInformationHandle, out int bitRate);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_duration", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetDuration(SafeVideoInformationHandle videoInformationHandle, out int duration);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetWidth(SafeVideoInformationHandle videoInformationHandle, out int width);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetHeight(SafeVideoInformationHandle videoInformationHandle, out int width);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedCount(SafeVideoInformationHandle videoInformationHandle, out int playedCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedTime(SafeVideoInformationHandle videoInformationHandle, out int playedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_position", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, out int playedPosition);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_count", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedCount(SafeVideoInformationHandle videoInformationHandle, int playedCount);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedTime(SafeVideoInformationHandle videoInformationHandle, int playedTime);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_position", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError SetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, int playedPosition);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError UpdateToDB(IntPtr videoInformationHandle);
-
- internal sealed class SafeVideoInformationHandle : SafeHandle
- {
- public SafeVideoInformationHandle()
- : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return this.handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- VideoInformation.Destroy(this.handle);
- this.SetHandle(IntPtr.Zero);
- return true;
- }
- }
- }
-}
<ItemGroup>
<ProjectReference Include="..\Tizen\Tizen.csproj" />
<ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
+ <ProjectReference Include="..\Tizen.System.Information\Tizen.System.Information.csproj" />
</ItemGroup>
<Import Project="../../build/common.targets" />
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
namespace Tizen.Content.MediaContent
{
/// <summary>
- /// An album is a logical collection or grouping of related audio files. It is also used for filtering media items.
- /// The Media Album API allows to manage media albums which contains all video and audio items from the same album.
+ /// Represents a logical collection grouping of related media info.
/// </summary>
- public class Album : ContentCollection
+ /// <seealso cref="AlbumCommand"/>
+ public class Album
{
- private IntPtr _albumHandle = IntPtr.Zero;
-
- private IntPtr Handle
+ internal Album(IntPtr handle)
{
- get
- {
- if (_albumHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(Album));
- }
+ Id = InteropHelper.GetValue<int>(handle, Interop.Album.GetId);
- return _albumHandle;
- }
+ Artist = InteropHelper.GetString(handle, Interop.Album.GetArtist);
+ AlbumArtPath = InteropHelper.GetString(handle, Interop.Album.GetAlbumArt);
+ Name = InteropHelper.GetString(handle, Interop.Album.GetName);
}
- /// <summary>
- /// The media album ID
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Id
- {
- get
- {
- int id = 0;
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetAlbumId(Handle, out id), "Failed to get value");
-
- return id;
- }
- }
+ internal static Album FromHandle(IntPtr handle) => new Album(handle);
/// <summary>
- /// The name of the media artist
- /// If the media content has no album info, the property returns empty string.
+ /// Get the id of the album.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Artist
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetArtist(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
+ /// <value>The unique id of the album.</value>
+ public int Id { get; }
/// <summary>
- /// The path of the media album art
+ /// Gets the artist name of the album.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Art
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetAlbumArt(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
+ /// <value>The artist name.</value>
+ public string Artist { get; }
/// <summary>
- /// The name of the media album
- /// If the media content has no album info, the property returns empty string.
+ /// Gets the path to the album art.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetName(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- internal Album(IntPtr handle)
- {
- _albumHandle = handle;
- }
+ /// <value>The path to the album art.</value>
+ public string AlbumArtPath { get; }
/// <summary>
- /// Gets the number of MediaInformation Items for the given album present in the media database.
- /// If NULL is passed to the filter, no filtering is applied.
+ /// Gets the name of the album.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
- {
- int mediaCount = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
-
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count");
-
- return mediaCount;
- }
-
- public override void Dispose()
- {
- if (_albumHandle != IntPtr.Zero)
- {
- Interop.Group.MediaAlbumDestroy(_albumHandle);
- _albumHandle = IntPtr.Zero;
- }
- }
+ /// <value>The album name.</value>
+ public string Name { get; }
/// <summary>
- /// Iterates through the media files with a filter in the given media album from the media database.
- /// This function gets all media files associated with the given media album and meeting desired filter option.
- /// If NULL is passed to the filter, no filtering is applied.
+ /// Returns a string representation of the album.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- List<MediaInformation> mediaContents = new List<MediaInformation>();
-
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.Group.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information");
-
- return mediaContents;
- }
+ /// <returns>A string representation of the current album.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Name={Name}, Artist={Artist}, AlbumArtPath={AlbumArtPath}";
}
}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage albums in the database.
+ /// </summary>
+ /// <seealso cref="Album"/>
+ public class AlbumCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AlbumCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public AlbumCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of albums.
+ /// </summary>
+ /// <returns>The number of albums.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count()
+ {
+ return Count(null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of albums with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of albums.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Album.GetAlbumCountFromDb, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves all the albums.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Album> Select()
+ {
+ return Select(null);
+ }
+
+ /// <summary>
+ /// Retrieves the albums with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Album> Select(SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(filter, Interop.Album.ForeachAlbumFromDb, Album.FromHandle);
+ }
+
+ /// <summary>
+ /// Retrieves an album with an album id.
+ /// </summary>
+ /// <param name="albumId">The id of the album to query with.</param>
+ /// <returns>The <see cref="Album"/> if <paramref name="albumId"/> exists, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="albumId"/> is equal to or less than zero.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public Album Select(int albumId)
+ {
+ ValidateDatabase();
+
+ if (albumId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(albumId), albumId,
+ "The album id can't be equal to or less than zero.");
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ try
+ {
+ Interop.Album.GetAlbumFromDb(albumId, out handle).ThrowIfError("Failed to query");
+
+ return handle == IntPtr.Zero ? null : new Album(handle);
+ }
+ finally
+ {
+ Interop.Album.Destroy(handle);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info that belongs to the album.
+ /// </summary>
+ /// <param name="albumId">The id of the album to query with.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="albumId"/> is equal to or less than zero.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int CountMember(int albumId)
+ {
+ return CountMember(albumId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info that belongs to the album with <see cref="CountArguments"/>..
+ /// </summary>
+ /// <param name="albumId">The id of the album to count media.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="albumId"/> is equal to or less than zero.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int CountMember(int albumId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ if (albumId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(albumId), albumId,
+ "The album id can't be equal to or less than zero.");
+ }
+
+ return CommandHelper.Count(Interop.Album.GetMediaCountFromDb, albumId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of an album.
+ /// </summary>
+ /// <param name="albumId">The id of the album to select media.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<MediaInfo> SelectMember(int albumId)
+ {
+ return SelectMember(albumId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of an album with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="albumId">The id of the album to query with.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<MediaInfo> SelectMember(int albumId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ if (albumId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(albumId), albumId,
+ "The album id can't be equal to or less than zero.");
+ }
+
+ return CommandHelper.SelectMedia(Interop.Album.ForeachMediaFromDb, albumId, filter);
+ }
+ }
+}
--- /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;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Represents an audio media information.
+ /// </summary>
+ public class AudioInfo : MediaInfo
+ {
+ internal AudioInfo(Interop.MediaInfoHandle handle) : base(handle)
+ {
+ IntPtr audioHandle = IntPtr.Zero;
+
+ try
+ {
+ Interop.MediaInfo.GetAudio(handle, out audioHandle).ThrowIfError("Failed to retrieve data");
+
+ Debug.Assert(audioHandle != IntPtr.Zero);
+
+ Album = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbum);
+ Artist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetArtist);
+ AlbumArtist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbumArtist);
+ Genre = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetGenre);
+ Composer = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetComposer);
+ Year = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetYear);
+ DateRecorded = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetRecordedDate);
+ Copyright = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetCopyright);
+ TrackNumber = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetTrackNum);
+
+ BitRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitRate);
+ BitPerSample = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitPerSample);
+ SampleRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetSampleRate);
+ Channels = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetChannel);
+
+ Duration = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetDuration);
+ }
+ finally
+ {
+ Interop.AudioInfo.Destroy(audioHandle);
+ }
+ }
+
+ /// <summary>
+ /// Gets the album name.
+ /// </summary>
+ /// <value>The album from the metadata.</value>
+ public string Album { get; }
+
+ /// <summary>
+ /// Gets the artist name.
+ /// </summary>
+ /// <value>The artist from the metadata.</value>
+ public string Artist { get; }
+
+ /// <summary>
+ /// Gets the album artist name.
+ /// </summary>
+ /// <value>The album artist from the metadata.</value>
+ public string AlbumArtist { get; }
+
+ /// <summary>
+ /// Gets the genre.
+ /// </summary>
+ /// <value>The genre from the metadata.</value>
+ public string Genre { get; }
+
+ /// <summary>
+ /// Gets the composer.
+ /// </summary>
+ /// <value>The composer from the metadata.</value>
+ public string Composer { get; }
+
+ /// <summary>
+ /// Gets the year.
+ /// </summary>
+ /// <value>The year from the metadata.</value>
+ public string Year { get; }
+
+ /// <summary>
+ /// Gets the recorded date.
+ /// </summary>
+ /// <value>The recorded date from the metadata.</value>
+ public string DateRecorded { get; }
+
+ /// <summary>
+ /// Gets the copyright.
+ /// </summary>
+ /// <value>The copyright from the metadata.</value>
+ public string Copyright { get; }
+
+ /// <summary>
+ /// Gets the track number.
+ /// </summary>
+ /// <value>The track number from the metadata.</value>
+ public string TrackNumber { get; }
+
+ /// <summary>
+ /// Gets the bit rate in bit per second.
+ /// </summary>
+ /// <value>The bit rate in bit per second.</value>
+ public int BitRate { get; }
+
+ /// <summary>
+ /// Gets the bit per sample.
+ /// </summary>
+ /// <value>The bit per sample.</value>
+ public int BitPerSample { get; }
+
+ /// <summary>
+ /// Gets the sample rate in hertz.
+ /// </summary>
+ /// <value>The sample rate in hertz.</value>
+ public int SampleRate { get; }
+
+ /// <summary>
+ /// Gets the number of channels.
+ /// </summary>
+ /// <value>The number of channels.</value>
+ public int Channels { get; }
+
+ /// <summary>
+ /// Gets the track duration in milliseconds.
+ /// </summary>
+ /// <value>The track duration in milliseconds.</value>
+ public int Duration { get; }
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-using System.Collections.ObjectModel;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// AudioContent class API gives the information related to the audio media stored in the device
- /// Its purpose is threefold:
- /// - to provide information about audio content
- /// - to organize audio content logically(grouping)
- /// </summary>
- public class AudioInformation : MediaInformation
- {
- private readonly Interop.AudioInformation.SafeAudioInformationHandle _handle;
-
- /// <summary>
- /// Gets the ID of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MediaId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetMediaId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the album name.
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Album
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetAlbum(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the artist name.
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Artist
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetArtist(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the album artist name.
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string AlbumArtist
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetAlbumArtist(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the genre.
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Genre
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetGenre(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the composer name.
- /// If the value is an empty string, the property returns "Unknown".
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Composer
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetComposer(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the year.
- /// If the media content has no album info, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Year
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetYear(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the recorded date.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string RecordedDate
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetRecordedDate(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the copyright.
- /// If the media content has no copyright information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Copyright
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetCopyright(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the track number.
- /// If the media content has no track information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string TrackNumber
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetTrackNum(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the bitrate in bit per second [bps].
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int BitRate
- {
- get
- {
- int bitrate = 0;
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetBitRate(_handle, out bitrate), "Failed to get value");
-
- return bitrate;
- }
- }
-
- /// <summary>
- /// Gets bit per sample.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int BitPerSample
- {
- get
- {
- int bitPerSample = 0;
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetBitPerSample(_handle, out bitPerSample), "Failed to get value");
-
- return bitPerSample;
- }
- }
-
- /// <summary>
- /// Gets the sample rate in hz.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int SampleRate
- {
- get
- {
- int sampleRate = 0;
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetSampleRate(_handle, out sampleRate), "Failed to get value");
-
- return sampleRate;
- }
- }
-
- /// <summary>
- /// Gets the channel.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Channel
- {
- get
- {
- int channel = 0;
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetChannel(_handle, out channel), "Failed to get value");
-
- return channel;
- }
- }
-
- /// <summary>
- /// Gets the track duration in Milliseconds.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Duration
- {
- get
- {
- int duration = 0;
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.GetDuration(_handle, out duration), "Failed to get value");
-
- return duration;
- }
- }
-
- /// <summary>
- /// Gets the number of MediaBookmark for the passed filter in the given media ID from the media database.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// int count</returns>
- /// <param name="filter">The Filter for matching Bookmarks</param>
- public int GetMediaBookmarkCount(ContentFilter filter)
- {
- int count = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetBookmarkCount(MediaId, handle, out count), "Failed to get count");
-
- return count;
- }
-
- /// <summary>
- /// Returns the MediaBookmarks for the given media info from the media database.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// Task to get all the Bookmarks
- /// </returns>
- /// <param name="filter"> filter for the Tags</param>
- public IEnumerable<MediaBookmark> GetMediaBookmarks(ContentFilter filter)
- {
- Collection<MediaBookmark> coll = new Collection<MediaBookmark>();
- IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.MediaInformation.MediaBookmarkCallback callback = (IntPtr handle, IntPtr userData) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.Clone(out newHandle, handle), "Failed to clone");
-
- coll.Add(new MediaBookmark(newHandle));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAllBookmarks(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value");
-
- return coll;
- }
-
- /// <summary>
- /// Adds a MediaBookmark to the audio
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="offset">Offset of the audio in seconds</param>
- /// <returns>
- /// Task with newly added MediaBookmark instance.
- /// </returns>
- public MediaBookmark AddBookmark(uint offset)
- {
- MediaBookmark result = null;
- ContentManager.Database.Insert(MediaId, offset, null);
- ContentFilter bookmarkfilter = new ContentFilter();
- bookmarkfilter.Condition = ContentColumns.Bookmark.Offset + " = " + offset;
- IEnumerable<MediaBookmark> bookmarksList = null;
- bookmarksList = GetMediaBookmarks(bookmarkfilter);
- foreach (MediaBookmark bookmark in bookmarksList)
- {
- if (bookmark.Offset == offset)
- {
- result = bookmark;
- break;
- }
- }
-
- bookmarkfilter.Dispose();
- return result;
- }
-
- /// <summary>
- /// Deletes a MediaBookmark item from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="bookmark">The MediaBookmark instance to be deleted</param>
- public void DeleteBookmark(MediaBookmark bookmark)
- {
- ContentManager.Database.Delete(bookmark);
- }
-
- internal IntPtr AudioHandle
- {
- get
- {
- return _handle.DangerousGetHandle();
- }
- }
-
- internal AudioInformation(Interop.AudioInformation.SafeAudioInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle)
- : base(mediaInformationHandle)
- {
- _handle = handle;
- }
- }
-}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Represents a media bookmark that allows you to mark interesting moment
+ /// in media(video and audio) to enable fast searching.
+ /// </summary>
+ public class Bookmark
+ {
+ internal Bookmark(IntPtr handle)
+ {
+ Id = InteropHelper.GetValue<int>(handle, Interop.Bookmark.GetId);
+ ThumbnailPath = InteropHelper.GetString(handle, Interop.Bookmark.GetThumbnailPath);
+ Offset = InteropHelper.GetValue<int>(handle, Interop.Bookmark.GetMarkedTime);
+ Name = InteropHelper.GetString(handle, Interop.Bookmark.GetName);
+ }
+
+ /// <summary>
+ /// Gets the id of the bookmark.
+ /// </summary>
+ /// <value>The id of the bookmark.</value>
+ public int Id { get; }
+
+ /// <summary>
+ /// Gets the thumbnail path of the bookmark.
+ /// </summary>
+ /// <value>The thumbnail path of the bookmark.</value>
+ public string ThumbnailPath { get; }
+
+ /// <summary>
+ /// Gets the offset in milliseconds.
+ /// </summary>
+ /// <value>The offset of the bookmark in media in milliseconds.</value>
+ public int Offset { get; }
+
+ /// <summary>
+ /// Gets the name of the bookmark.
+ /// </summary>
+ /// <value>The name of the bookmark.</value>
+ public string Name { get; }
+
+ internal static Bookmark FromHandle(IntPtr handle) => new Bookmark(handle);
+
+ /// <summary>
+ /// Returns a string representation of the bookmark.
+ /// </summary>
+ /// <returns>A string representation of the current bookmark.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Name={Name}, ThumbnailPath={ThumbnailPath}, Offset={Offset}";
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage bookmarks in database.
+ /// </summary>
+ /// <seealso cref="Bookmark"/>
+ public class BookmarkCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BookmarkCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public BookmarkCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of bookmarks.
+ /// </summary>
+ /// <returns>The number of bookmarks.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count()
+ {
+ return Count(null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of bookmarks with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of bookmarks.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Bookmark.GetCount, arguments);
+ }
+
+ /// <summary>
+ /// Inserts new bookmark into the database with the specified media and offset.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to be associated with.</param>
+ /// <param name="offset">The time offset in milliseconds.</param>
+ /// <returns>The <see cref="Bookmark"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Bookmark Insert(string mediaId, int offset)
+ {
+ return Insert(mediaId, offset, null);
+ }
+
+ /// <summary>
+ /// Inserts new bookmark into the database with the specified media id, offset and name.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to be associated with.</param>
+ /// <param name="offset">The time offset in milliseconds.</param>
+ /// <param name="name">The name of the bookmark. This value can be null.</param>
+ /// <returns>The <see cref="Bookmark"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Bookmark Insert(string mediaId, int offset, string name)
+ {
+ return Insert(mediaId, offset, name, null);
+ }
+
+ /// <summary>
+ /// Inserts new bookmark into the database with the specified media id, offset, name and thumbnail path.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <remarks>
+ /// Thumbnail may be useful only when the media is video.
+ /// </remarks>
+ /// <param name="mediaId">The media id to be associated with.</param>
+ /// <param name="offset">The time offset in milliseconds.</param>
+ /// <param name="name">The name of the bookmark. This value can be null.</param>
+ /// <param name="thumbnailPath">The thumbnail path of the bookmark. This value can be null.</param>
+ /// <returns>The <see cref="Bookmark"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Bookmark Insert(string mediaId, int offset, string name, string thumbnailPath)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ Interop.Bookmark.Create(mediaId, offset, out var handle).ThrowIfError("Failed to insert new bookmark");
+
+ try
+ {
+ Interop.Bookmark.SetName(handle, name).ThrowIfError("Failed to insert new bookmark");
+
+ if (thumbnailPath != null)
+ {
+ Interop.Bookmark.SetThumbnailPath(handle, thumbnailPath).
+ ThrowIfError("Failed to insert new bookmark");
+ }
+
+ Interop.Bookmark.Insert(handle).ThrowIfError("Failed to insert new bookmark");
+
+ return new Bookmark(handle);
+ }
+ finally
+ {
+ Interop.Bookmark.Destroy(handle);
+ }
+ }
+
+ /// <summary>
+ /// Deletes a bookmark from the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="bookmarkId">The bookmark id to delete.</param>
+ /// <returns>true if the matched record was found and deleted, otherwise false.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="bookmarkId"/> is less than zero.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Delete(int bookmarkId)
+ {
+ ValidateDatabase();
+
+ if (bookmarkId < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(bookmarkId), bookmarkId,
+ "Bookmark id shouldn't be negative.");
+ }
+
+ if (CommandHelper.Count(Interop.Bookmark.GetCount, $"{BookmarkColumns.Id}={bookmarkId}") == 0)
+ {
+ return false;
+ }
+
+ CommandHelper.Delete(Interop.Bookmark.Delete, bookmarkId);
+
+ return true;
+ }
+
+
+ /// <summary>
+ /// Retrieves the bookmarks.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Bookmark> Select()
+ {
+ return Select(null);
+ }
+
+ /// <summary>
+ /// Retrieves the bookmarks with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Bookmark> Select(SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(filter, Interop.Bookmark.ForeachFromDb, Bookmark.FromHandle);
+ }
+
+ }
+
+}
--- /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.
+ */
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Provides the column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="AlbumCommand.Count(CountArguments)"/>
+ /// <seealso cref="AlbumCommand.CountMember(int, CountArguments)"/>
+ /// <seealso cref="AlbumCommand.Select(SelectArguments)"/>
+ /// <seealso cref="AlbumCommand.SelectMember(int, SelectArguments)"/>
+ /// <seealso cref="BookmarkCommand.Count(CountArguments)"/>
+ /// <seealso cref="BookmarkCommand.Select(SelectArguments)"/>
+ /// <seealso cref="FaceInfoCommand.Select(SelectArguments)"/>
+ /// <seealso cref="FolderCommand.Count(CountArguments)"/>
+ /// <seealso cref="FolderCommand.CountMedia(string, CountArguments)"/>
+ /// <seealso cref="FolderCommand.Select(SelectArguments)"/>
+ /// <seealso cref="FolderCommand.SelectMedia(string, SelectArguments)"/>
+ /// <seealso cref="MediaInfoCommand.CountMedia(CountArguments)"/>
+ /// <seealso cref="MediaInfoCommand.SelectMedia(SelectArguments)"/>
+ /// <seealso cref="PlaylistCommand.Count(CountArguments)"/>
+ /// <seealso cref="PlaylistCommand.Select(SelectArguments)"/>
+ /// <seealso cref="PlaylistCommand.CountMember(int, CountArguments)"/>
+ /// <seealso cref="PlaylistCommand.SelectMember(int, SelectArguments)"/>
+ /// <seealso cref="TagCommand.Count(CountArguments)"/>
+ /// <seealso cref="TagCommand.CountMedia(int, CountArguments)"/>
+ /// <seealso cref="TagCommand.Select(SelectArguments)"/>
+ /// <seealso cref="TagCommand.SelectMedia(int, SelectArguments)"/>
+ public static class MediaInfoColumns
+ {
+ /// <summary>
+ /// Gets the column name for the id of media.
+ /// </summary>
+ /// <value>The column name for the id of media.</value>
+ /// <remarks>The value type is string.</remarks>
+ /// <seealso cref="MediaInfo.Id"/>
+ public static string Id => "MEDIA_ID";
+
+ /// <summary>
+ /// Gets the column name for the path of media.
+ /// </summary>
+ /// <value>The column name for the file path of media.</value>
+ /// <remarks>The value type is string.</remarks>
+ /// <seealso cref="MediaInfo.Path"/>
+ public static string Path => "MEDIA_PATH";
+
+ /// <summary>
+ /// Gets the column name for display name of media.
+ /// </summary>
+ /// <value>The column name for the display name of media.</value>
+ /// <remarks>The value type is string.</remarks>
+ /// <seealso cref="MediaInfo.DisplayName"/>
+ public static string DisplayName => "MEDIA_DISPLAY_NAME";
+
+ /// <summary>
+ /// Gets the column name for the type of media.
+ /// </summary>
+ /// <value>The column name for the type of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// The value should be an integer that is one of <see cref="MediaContent.MediaType"/> values.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.MediaType"/>
+ public static string MediaType => "MEDIA_TYPE";
+
+ /// <summary>
+ /// Gets the column name for the mime type of media.
+ /// </summary>
+ /// <value>The column name for the mime type of media.</value>
+ /// <remarks>The value type is string.</remarks>
+ /// <seealso cref="MediaInfo.MimeType"/>
+ public static string MimeType => "MEDIA_MIME_TYPE";
+
+ /// <summary>
+ /// Gets the column name for the file size of media.
+ /// </summary>
+ /// <value>The column name for the file size of media.</value>
+ /// <remarks>The value type is integer.</remarks>
+ /// <seealso cref="MediaInfo.FileSize"/>
+ public static string FileSize => "MEDIA_SIZE";
+
+ /// <summary>
+ /// Gets the column name for the date added of media.
+ /// </summary>
+ /// <value>The column name for the date added of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// <see cref="System.DateTimeOffset"/> needs to be converted into the unix time.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.DateAdded"/>
+ /// <seealso cref="System.DateTimeOffset.ToUnixTimeSeconds"/>
+ public static string DateAdded => "MEDIA_ADDED_TIME";
+
+ /// <summary>
+ /// Gets the column name for the date modified of media.
+ /// </summary>
+ /// <value>The column name for the date modified of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// <see cref="System.DateTimeOffset"/> needs to be converted into the unix time.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.DateModified"/>
+ /// <seealso cref="System.DateTimeOffset.ToUnixTimeSeconds"/>
+ public static string DateModified => "MEDIA_MODIFIED_TIME";
+
+ /// <summary>
+ /// Gets the column name for the timeline of media.
+ /// </summary>
+ /// <value>The column name for the timeline of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// <see cref="System.DateTimeOffset"/> needs to be converted into the unix time.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Timeline"/>
+ /// <seealso cref="System.DateTimeOffset.ToUnixTimeSeconds"/>
+ public static string Timeline => "MEDIA_TIMELINE";
+
+ /// <summary>
+ /// Gets the column name for the thumbnail path of media.
+ /// </summary>
+ /// <value>The column name for the thumbnail path of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.ThumbnailPath"/>
+ public static string ThumbnailPath => "MEDIA_THUMBNAIL_PATH";
+
+ /// <summary>
+ /// Gets the column name for the title of media.
+ /// </summary>
+ /// <value>The column name for the title of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.ThumbnailPath"/>
+ public static string Title => "MEDIA_TITLE";
+
+ /// <summary>
+ /// Gets the column name for the album of media.
+ /// </summary>
+ /// <value>The column name for the album of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Album"/>
+ public static string Album => "MEDIA_ALBUM";
+
+ /// <summary>
+ /// Gets the column name for the artist of media.
+ /// </summary>
+ /// <value>The column name for the artist of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Artist"/>
+ /// <seealso cref="VideoInfo.Artist"/>
+ public static string Artist => "MEDIA_ARTIST";
+
+ /// <summary>
+ /// Gets the column name for the album artist of media.
+ /// </summary>
+ /// <value>The column name for the album artist of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.AlbumArtist"/>
+ /// <seealso cref="VideoInfo.AlbumArtist"/>
+ public static string AlbumArtist => "MEDIA_ALBUM_ARTIST";
+
+ /// <summary>
+ /// Gets the column name for the genre of media.
+ /// </summary>
+ /// <value>The column name for the genre of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Genre"/>
+ /// <seealso cref="VideoInfo.Genre"/>
+ public static string Genre => "MEDIA_GENRE";
+
+ /// <summary>
+ /// Gets the column name for the composer of media.
+ /// </summary>
+ /// <value>The column name for the composer of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Composer"/>
+ /// <seealso cref="VideoInfo.Composer"/>
+ public static string Composer => "MEDIA_COMPOSER";
+
+ /// <summary>
+ /// Gets the column name for the year of media.
+ /// </summary>
+ /// <value>The column name for the year of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Year"/>
+ /// <seealso cref="VideoInfo.Year"/>
+ public static string Year => "MEDIA_YEAR";
+
+ /// <summary>
+ /// Gets the column name for the date recorded of media.
+ /// </summary>
+ /// <value>The column name for the date recorded of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.DateRecorded"/>
+ /// <seealso cref="VideoInfo.DateRecorded"/>
+ public static string DateRecorded => "MEDIA_RECORDED_DATE";
+
+ /// <summary>
+ /// Gets the column name for the copyright of media.
+ /// </summary>
+ /// <value>The column name for the copyright of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Copyright"/>
+ /// <seealso cref="VideoInfo.Copyright"/>
+ public static string Copyright => "MEDIA_COPYRIGHT";
+
+ /// <summary>
+ /// Gets the column name for the track number of media.
+ /// </summary>
+ /// <value>The column name for the track number of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.TrackNumber"/>
+ /// <seealso cref="VideoInfo.TrackNumber"/>
+ public static string TrackNumber => "MEDIA_TRACK_NUM";
+
+ /// <summary>
+ /// Gets the column name for the description of media.
+ /// </summary>
+ /// <value>The column name for the description of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Description"/>
+ public static string Description => "MEDIA_DESCRIPTION";
+
+ /// <summary>
+ /// Gets the column name for the bit rate of media.
+ /// </summary>
+ /// <value>The column name for the bit rate of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.BitRate"/>
+ /// <seealso cref="VideoInfo.BitRate"/>
+ public static string BitRate => "MEDIA_BITRATE";
+
+ /// <summary>
+ /// Gets the column name for the bit per sample of media.
+ /// </summary>
+ /// <value>The column name for the bit per sample of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.BitPerSample"/>
+ public static string BitPerSample => "MEDIA_BITPERSAMPLE";
+
+ /// <summary>
+ /// Gets the column name for the sample rate of media.
+ /// </summary>
+ /// <value>The column name for the sample rate of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.SampleRate"/>
+ public static string SampleRate => "MEDIA_SAMPLERATE";
+
+ /// <summary>
+ /// Gets the column name for the channels of media.
+ /// </summary>
+ /// <value>The column name for the channels of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Channels"/>
+ public static string Channels => "MEDIA_CHANNEL";
+
+ /// <summary>
+ /// Gets the column name for the duration of media.
+ /// </summary>
+ /// <value>The column name for the duration of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="AudioInfo.Duration"/>
+ /// <seealso cref="VideoInfo.Duration"/>
+ public static string Duration => "MEDIA_DURATION";
+
+ /// <summary>
+ /// Gets the column name for the longitude of media.
+ /// </summary>
+ /// <value>The column name for the longitude of media.</value>
+ /// <remarks>
+ /// The value type is real.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Longitude"/>
+ public static string Longitude => "MEDIA_LONGITUDE";
+
+ /// <summary>
+ /// Gets the column name for the latitude of media.
+ /// </summary>
+ /// <value>The column name for the latitude of media.</value>
+ /// <remarks>
+ /// The value type is real.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Latitude"/>
+ public static string Latitude => "MEDIA_LATITUDE";
+
+ /// <summary>
+ /// Gets the column name for the altitude of media.
+ /// </summary>
+ /// <value>The column name for the altitude of media.</value>
+ /// <remarks>
+ /// The value type is real.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Altitude"/>
+ public static string Altitude => "MEDIA_ALTITUDE";
+
+ /// <summary>
+ /// Gets the column name for the width of media.
+ /// </summary>
+ /// <value>The column name for the width of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.Width"/>
+ /// <seealso cref="VideoInfo.Width"/>
+ public static string Width => "MEDIA_WIDTH";
+
+ /// <summary>
+ /// Gets the column name for the height of media.
+ /// </summary>
+ /// <value>The column name for the height of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.Height"/>
+ /// <seealso cref="VideoInfo.Height"/>
+ public static string Height => "MEDIA_HEIGHT";
+
+ /// <summary>
+ /// Gets the column name for the date taken of media.
+ /// </summary>
+ /// <value>The column name for the date taken of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.DateTaken"/>
+ public static string DateTaken => "MEDIA_DATETAKEN";
+
+ /// <summary>
+ /// Gets the column name for the orientation of media.
+ /// </summary>
+ /// <value>The column name for the orientation of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// The value should be an integer that is one of <see cref="MediaContent.Orientation"/> values.
+ /// </remarks>
+ /// <seealso cref="MediaContent.Orientation"/>
+ /// <seealso cref="ImageInfo.Orientation"/>
+ public static string Orientation => "MEDIA_ORIENTATION";
+
+ /// <summary>
+ /// Gets the column name for the burst id of media.
+ /// </summary>
+ /// <value>The column name for the burst id of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.BurstId"/>
+ public static string BurstId => "BURST_ID";
+
+ /// <summary>
+ /// Gets the column name for the rating of media.
+ /// </summary>
+ /// <value>The column name for the rating of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Rating"/>
+ public static string Rating => "MEDIA_RATING";
+
+ /// <summary>
+ /// Gets the column name for the favorite status of media.
+ /// </summary>
+ /// <value>The column name for the favorite status of media.</value>
+ /// <remarks>
+ /// The value type is integer(1 : true, 0 : false).
+ /// </remarks>
+ /// <seealso cref="MediaInfo.IsFavorite"/>
+ public static string Favorite => "MEDIA_FAVOURITE";
+
+ /// <summary>
+ /// Gets the column name for the provider of media.
+ /// </summary>
+ /// <value>The column name for the provider of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Provider"/>
+ public static string Provider => "MEDIA_PROVIDER";
+
+ /// <summary>
+ /// Gets the column name for the category of media.
+ /// </summary>
+ /// <value>The column name for the category of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Category"/>
+ public static string Category => "MEDIA_CATEGORY";
+
+
+ /// <summary>
+ /// Gets the column name for the location tag of media.
+ /// </summary>
+ /// <value>The column name for the location tag of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.LocationTag"/>
+ public static string LocationTag => "MEDIA_LOCATION_TAG";
+
+ /// <summary>
+ /// Gets the column name for the age rating of media.
+ /// </summary>
+ /// <value>The column name for the age rating of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.AgeRating"/>>
+ public static string AgeRating => "MEDIA_AGE_RATING";
+
+ /// <summary>
+ /// Gets the column name for the weather information of media.
+ /// </summary>
+ /// <value>The column name for the weather information of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.Weather"/>
+ public static string Weather => "MEDIA_WEATHER";
+
+ /// <summary>
+ /// Gets the column name for the drm of media.
+ /// </summary>
+ /// <value>The column name for the drm of media.</value>
+ /// <remarks>
+ /// The value type is integer(1 : true, 0 : false).
+ /// </remarks>
+ /// <seealso cref="MediaInfo.IsDrm"/>
+ public static string IsDrm => "MEDIA_IS_DRM";
+
+ /// <summary>
+ /// Gets the column name for the storage type of media.
+ /// </summary>
+ /// <value>The column name for the storage type of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// The value should be an integer that is one of <see cref="MediaContent.StorageType"/> values.
+ /// </remarks>
+ /// <seealso cref="MediaInfo.StorageType"/>
+ public static string StorageType => "MEDIA_STORAGE_TYPE";
+
+ /// <summary>
+ /// Gets the column name for the exposure time of media.
+ /// </summary>
+ /// <value>The column name for the exposure time of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.ExposureTime"/>
+ public static string ExposureTime => "MEDIA_EXPOSURE_TIME";
+
+ /// <summary>
+ /// Gets the column name for the FNumber of media.
+ /// </summary>
+ /// <value>The column name for the FNumber of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.FNumber"/>
+ public static string FNumber => "MEDIA_FNUMBER";
+
+ /// <summary>
+ /// Gets the column name for the iso of media.
+ /// </summary>
+ /// <value>The column name for the iso of media.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.Iso"/>
+ public static string Iso => "MEDIA_ISO";
+
+ /// <summary>
+ /// Gets the column name for the model of media.
+ /// </summary>
+ /// <value>The column name for the model of media.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="ImageInfo.Model"/>
+ public static string Model => "MEDIA_MODEL";
+ }
+
+
+ /// <summary>
+ /// Provides the folder column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="AlbumCommand.Count(CountArguments)"/>
+ /// <seealso cref="AlbumCommand.Select(SelectArguments)"/>
+ public static class AlbumColumns
+ {
+ /// <summary>
+ /// Gets the column name for the name of album.
+ /// </summary>
+ /// <value>The column name for the name of album.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Album.Name"/>
+ public static string Name => "MEDIA_ALBUM";
+
+ /// <summary>
+ /// Gets the column name for the artist of album.
+ /// </summary>
+ /// <value>The column name for the artist of album.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Album.Artist"/>
+ public static string Artist => "MEDIA_ARTIST";
+ }
+
+ /// <summary>
+ /// Provides the folder column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="FolderCommand.Count(CountArguments)"/>
+ /// <seealso cref="FolderCommand.Select(SelectArguments)"/>
+ public static class FolderColumns
+ {
+ /// <summary>
+ /// Gets the column name for the id of folder.
+ /// </summary>
+ /// <value>The column name for the id of folder.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Folder.Id"/>
+ public static string Id => "FOLDER_ID";
+
+ /// <summary>
+ /// Gets the column name for the path of folder.
+ /// </summary>
+ /// <value>The column name for the path of folder.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Folder.Path"/>
+ public static string Path => "FOLDER_PATH";
+
+ /// <summary>
+ /// Gets the column name for the name of folder.
+ /// </summary>
+ /// <value>The column name for the name of folder.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Folder.Name"/>
+ public static string Name => "FOLDER_NAME";
+
+ /// <summary>
+ /// Gets the column name for the storage type of folder.
+ /// </summary>
+ /// <value>The column name for the storage type of folder.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// The value should be an integer that is one of <see cref="MediaContent.StorageType"/> values.
+ /// </remarks>
+ /// <seealso cref="Folder.StorageType"/>
+ public static string StorageType => "FOLDER_STORAGE_TYPE";
+ }
+
+ /// <summary>
+ /// Provides the playlist column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="PlaylistCommand.Count(CountArguments)"/>
+ /// <seealso cref="PlaylistCommand.Select(SelectArguments)"/>
+ public static class PlaylistColumns
+ {
+ /// <summary>
+ /// Gets the column name for the name of playlist.
+ /// </summary>
+ /// <value>The column name for the name of playlist.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Playlist.Name"/>
+ public static string Name => "PLAYLIST_NAME";
+
+ /// <summary>
+ /// Gets the column name for the id of playlist.
+ /// </summary>
+ /// <value>The column name for the id of playlist.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="Playlist.Id"/>
+ public static string Id => "PLAYLIST_ID";
+
+ /// <summary>
+ /// Gets the column name for the member order of playlist.
+ /// </summary>
+ /// <value>The column name for the member order of playlist.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="PlaylistCommand.UpdatePlayOrder(int, PlayOrder)"/>
+ public static string MemberOrder => "PLAYLIST_MEMBER_ORDER";
+
+ /// <summary>
+ /// Gets the column name for the number of members of playlist.
+ /// </summary>
+ /// <value>The column name for the number of members of playlist.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="PlaylistCommand.AddMember(int, string)"/>
+ /// <seealso cref="PlaylistCommand.RemoveMember(int, int)"/>
+ public static string Count => "PLAYLIST_MEDIA_COUNT";
+ }
+
+ /// <summary>
+ /// Provides the tag column names that can be used for <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="MediaInfoCommand.CountTag(string, CountArguments)"/>
+ /// <seealso cref="MediaInfoCommand.SelectTag(string, SelectArguments)"/>
+ /// <seealso cref="TagCommand.Count(CountArguments)"/>
+ /// <seealso cref="TagCommand.CountMedia(int, CountArguments)"/>
+ /// <seealso cref="TagCommand.Select(SelectArguments)"/>
+ /// <seealso cref="TagCommand.SelectMedia(int, SelectArguments)"/>
+ public static class TagColumns
+ {
+ /// <summary>
+ /// Gets the column name for the name of tag.
+ /// </summary>
+ /// <value>The column name for the name of tag.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Tag.Name"/>
+ public static string Name => "TAG_NAME";
+
+ /// <summary>
+ /// Gets the column name for the number of media of tag.
+ /// </summary>
+ /// <value>The column name for the number of media of tag.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="TagCommand.AddMedia(int, string)"/>
+ /// <seealso cref="TagCommand.RemoveMedia(int, string)"/>
+ public static string Count => "TAG_MEDIA_COUNT";
+
+ /// <summary>
+ /// Gets the column name for the id of tag.
+ /// </summary>
+ /// <value>The column name for the id of tag.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="Tag.Id"/>
+ public static string Id => "TAG_ID";
+ }
+
+ /// <summary>
+ /// Provides the bookmark column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="BookmarkCommand.Count(CountArguments)"/>
+ /// <seealso cref="BookmarkCommand.Select(SelectArguments)"/>
+ /// <seealso cref="MediaInfoCommand.CountBookmark(string, CountArguments)"/>
+ /// <seealso cref="MediaInfoCommand.SelectBookmark(string, SelectArguments)"/>
+ public static class BookmarkColumns
+ {
+ /// <summary>
+ /// Gets the column name for offset of bookmark.
+ /// </summary>
+ /// <value>The column name for the offset of bookmark.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="Bookmark.Offset"/>
+ public static string Offset => "BOOKMARK_MARKED_TIME";
+
+ /// <summary>
+ /// Gets the column name for the id of bookmark.
+ /// </summary>
+ /// <value>The column name for the id of bookmark.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// </remarks>
+ /// <seealso cref="Bookmark.Id"/>
+ public static string Id => "BOOKMARK_ID";
+
+ /// <summary>
+ /// Gets the column name for the name of bookmark.
+ /// </summary>
+ /// <value>The column name for the name of bookmark.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Bookmark.Name"/>
+ public static string Name => "BOOKMARK_NAME";
+ }
+
+ /// <summary>
+ /// Provides the face info column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="FaceInfoCommand.Select(SelectArguments)"/>
+ /// <seealso cref="MediaInfoCommand.CountFaceInfo(string, CountArguments)"/>
+ /// <seealso cref="MediaInfoCommand.SelectFaceInfo(string, SelectArguments)"/>
+ public static class FaceInfoColumns
+ {
+ /// <summary>
+ /// Gets the column name for the tag of face info.
+ /// </summary>
+ /// <value>The column name for the tag of face info.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="FaceInfo.Tag"/>
+ public static string Tag => "MEDIA_FACE_TAG";
+
+ /// <summary>
+ /// Gets the column name for the id of face info.
+ /// </summary>
+ /// <value>The column name for the id of face info.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="FaceInfo.Id"/>
+ public static string Id => "MEDIA_FACE_ID";
+ }
+
+ /// <summary>
+ /// Provides the storage column names that can be used for Select and Count commands.
+ /// </summary>
+ /// <seealso cref="SelectArguments"/>
+ /// <seealso cref="CountArguments"/>
+ /// <seealso cref="QueryArguments.FilterExpression"/>
+ /// <seealso cref="SelectArguments.SortOrder"/>
+ /// <seealso cref="StorageCommand.Count(CountArguments)"/>
+ /// <seealso cref="StorageCommand.Select(SelectArguments)"/>
+ public static class StorageColumns
+ {
+ /// <summary>
+ /// Gets the column name for the id of storage.
+ /// </summary>
+ /// <value>The column name for the id of storage.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Storage.Id"/>
+ public static string Id => "STORAGE_ID";
+
+ /// <summary>
+ /// Gets the column name for the path of storage.
+ /// </summary>
+ /// <value>The column name for the path of storage.</value>
+ /// <remarks>
+ /// The value type is string.
+ /// </remarks>
+ /// <seealso cref="Storage.Path"/>
+ public static string Path => "STORAGE_PATH";
+
+ /// <summary>
+ /// Gets the column name for the type of storage.
+ /// </summary>
+ /// <value>The column name for the type of storage.</value>
+ /// <remarks>
+ /// The value type is integer.
+ /// The value should be an integer that is one of <see cref="MediaContent.StorageType"/> values.
+ /// </remarks>
+ /// <seealso cref="Storage.Type"/>
+ public static string Type => "MEDIA_STORAGE_TYPE";
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using FilterHandle = Interop.FilterHandle;
+
+namespace Tizen.Content.MediaContent
+{
+ internal static class CommandHelper
+ {
+ internal delegate MediaContentError CountFunc(FilterHandle filter, out int count);
+
+ internal delegate MediaContentError CountFunc<T>(T param, FilterHandle filter,
+ out int count);
+
+ internal static int Count(CountFunc countFunc, CountArguments arguments)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ countFunc(filter, out var count).ThrowIfError("Failed to query count");
+ return count;
+ }
+ }
+
+ internal static int Count(CountFunc countFunc, string filter)
+ {
+ return Count(countFunc, new CountArguments { FilterExpression = filter });
+ }
+
+ internal static int Count<T>(CountFunc<T> countFunc, T param, CountArguments arguments)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ countFunc(param, filter, out var count).ThrowIfError("Failed to query count");
+ return count;
+ }
+ }
+
+ internal static void Delete<T>(Func<T, MediaContentError> func, T param)
+ {
+ func(param).ThrowIfError("Failed to execute the command");
+ }
+
+ internal delegate MediaContentError ForeachFunc<T>(T param, FilterHandle filter,
+ Interop.Common.ItemCallback callback, IntPtr data = default(IntPtr));
+
+ internal static MediaDataReader<MediaInfo> SelectMedia<T>(ForeachFunc<T> func, T param,
+ SelectArguments arguments)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ var items = new List<MediaInfo>();
+ Exception exception = null;
+
+ func(param, filter, (mediaInfoHandle, _) =>
+ {
+ try
+ {
+ items.Add(MediaInfo.FromHandle(mediaInfoHandle));
+ return true;
+ }
+ catch (Exception e)
+ {
+ exception = e;
+ return false;
+ }
+ }).ThrowIfError("Failed to query");
+
+ if (exception != null)
+ {
+ throw exception;
+ }
+
+ return new MediaDataReader<MediaInfo>(items);
+ }
+ }
+
+ internal delegate MediaContentError ForeachFunc(FilterHandle filter,
+ Interop.Common.ItemCallback callback, IntPtr data = default(IntPtr));
+
+ internal static MediaDataReader<TRecord> Select<TRecord>(SelectArguments arguments,
+ ForeachFunc foreachFunc,
+ Func<IntPtr, TRecord> factoryFunc)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ Exception caught = null;
+ var items = new List<TRecord>();
+
+ foreachFunc(filter, (itemHandle, _) =>
+ {
+ try
+ {
+ items.Add(factoryFunc(itemHandle));
+ return true;
+ }
+ catch (Exception e)
+ {
+ caught = e;
+ return false;
+ }
+ }).ThrowIfError("Failed to execute query");
+
+ if (caught != null)
+ {
+ throw caught;
+ }
+
+ return new MediaDataReader<TRecord>(items);
+ }
+ }
+
+
+ internal delegate MediaContentError CloneFunc(out IntPtr output, IntPtr input);
+
+ internal static IntPtr SelectScalar(ForeachFunc foreachFunc, string filterExpression,
+ CloneFunc cloneFunc)
+ {
+ using (var filter = QueryArguments.CreateNativeHandle(filterExpression))
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ foreachFunc(filter, (itemHandle, _) =>
+ {
+ cloneFunc(out handle, itemHandle);
+ return false;
+ }).ThrowIfError("Failed to execute query");
+
+ return handle;
+ }
+ }
+
+ internal delegate MediaContentError ForeachMemberFunc<TParam>(TParam param,
+ FilterHandle filter, Interop.Common.ItemCallback callback, IntPtr data = default(IntPtr));
+
+ internal static MediaDataReader<TRecord> SelectMembers<TParam, TRecord>(TParam param,
+ SelectArguments arguments, ForeachMemberFunc<TParam> foreachFunc,
+ Func<IntPtr, TRecord> factoryFunc)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ Exception caught = null;
+ var items = new List<TRecord>();
+
+ foreachFunc(param, filter, (itemHandle, _) =>
+ {
+ try
+ {
+ items.Add(factoryFunc(itemHandle));
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ caught = e;
+ return false;
+ }
+ }).ThrowIfError("Failed to execute query");
+
+ if (caught != null)
+ {
+ throw caught;
+ }
+
+ return new MediaDataReader<TRecord>(items);
+ }
+ }
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Tizen.Content.MediaContent
-{
- public abstract class ContentCollection : IDisposable
- {
- /// <summary>
- /// Gets the media count for this content store matching the passed filter
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">the media filter</param>
- /// <returns>Media count</returns>
- public abstract int GetMediaInformationCount(ContentFilter filter);
-
- /// <summary>
- /// Destroys the unmanaged handles.
- /// Call Dispose API once Contentcollection operations are completed.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public abstract void Dispose();
-
- /// <summary>
- /// Gets the media matching the passed filter for this content store, asynchronously
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">The media filter</param>
- /// <returns>Task with Media Information list</returns>
- public abstract IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter);
- }
-}
+++ /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.
-*/
-
-
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// A ContentColumns class defines the keyword used for filter condition or sorting.
- /// </summary>
- public static class ContentColumns
- {
- /// <summary>
- /// Media column set. \n
- /// You can use this define to set the condition of media filter and order keyword.
- /// </summary>
- public class Media
- {
- /// <summary>
- /// Media UUID
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Id
- {
- get
- {
- return "MEDIA_ID";
- }
- }
-
- /// <summary>
- /// Media path
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Path
- {
- get
- {
- return "MEDIA_PATH";
- }
- }
-
- /// <summary>
- /// Display name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string DisplayName
- {
- get
- {
- return "MEDIA_DISPLAY_NAME";
- }
- }
-
- /// <summary>
- /// The type of media (0-image, 1-video, 2-sound, 3-music, 4-other)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string MediaType
- {
- get
- {
- return "MEDIA_TYPE";
- }
- }
-
- /// <summary>
- /// Mime type
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string MimeType
- {
- get
- {
- return "MEDIA_MIME_TYPE";
- }
- }
-
-
- /// <summary>
- /// File size
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Size
- {
- get
- {
- return "MEDIA_SIZE";
- }
- }
-
- /// <summary>
- /// Added time
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string AddedTime
- {
- get
- {
- return "MEDIA_ADDED_TIME";
- }
- }
-
- /// <summary>
- /// Modified time
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ModifiedTime
- {
- get
- {
- return "MEDIA_MODIFIED_TIME";
- }
- }
-
- /// <summary>
- /// Timeline. Normally, creation date of media
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Timeline
- {
- get
- {
- return "MEDIA_TIMELINE";
- }
- }
-
- /// <summary>
- /// The path of thumbnail
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ThumbnailPath
- {
- get
- {
- return "MEDIA_THUMBNAIL_PATH";
- }
- }
-
- /// <summary>
- /// Title
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Title
- {
- get
- {
- return "MEDIA_TITLE";
- }
- }
-
- /// <summary>
- /// Album name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Album
- {
- get
- {
- return "MEDIA_ALBUM";
- }
- }
-
- /// <summary>
- /// Artist
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Artist
- {
- get
- {
- return "MEDIA_ARTIST";
- }
- }
-
- /// <summary>
- /// Album artist
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string AlbumArtist
- {
- get
- {
- return "MEDIA_ALBUM_ARTIST";
- }
- }
-
- /// <summary>
- /// Genre
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Genre
- {
- get
- {
- return "MEDIA_GENRE";
- }
- }
-
- /// <summary>
- /// Composer
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Composer
- {
- get
- {
- return "MEDIA_COMPOSER";
- }
- }
-
- /// <summary>
- /// Release year
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Year
- {
- get
- {
- return "MEDIA_YEAR";
- }
- }
-
- /// <summary>
- /// Recorded date
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string RecordedDate
- {
- get
- {
- return "MEDIA_RECORDED_DATE";
- }
- }
-
- /// <summary>
- /// Copyright
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Copyright
- {
- get
- {
- return "MEDIA_COPYRIGHT";
- }
- }
-
- /// <summary>
- /// Track Number
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string TrackNumber
- {
- get
- {
- return "MEDIA_TRACK_NUM";
- }
- }
-
- /// <summary>
- /// Description
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Description
- {
- get
- {
- return "MEDIA_DESCRIPTION";
- }
- }
-
- /// <summary>
- /// Bitrate
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Bitrate
- {
- get
- {
- return "MEDIA_BITRATE";
- }
- }
-
- /// <summary>
- /// Bit per sample
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string BitPerSample
- {
- get
- {
- return "MEDIA_BITPERSAMPLE";
- }
- }
-
- /// <summary>
- /// Samplerate
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Samplerate
- {
- get
- {
- return "MEDIA_SAMPLERATE";
- }
- }
-
- /// <summary>
- /// Channel
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Channel
- {
- get
- {
- return "MEDIA_CHANNEL";
- }
- }
-
- /// <summary>
- /// Duration
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Duration
- {
- get
- {
- return "MEDIA_DURATION";
- }
- }
-
- /// <summary>
- /// Longitude
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Longitude
- {
- get
- {
- return "MEDIA_LONGITUDE";
- }
- }
-
- /// <summary>
- /// Latitude
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Latitude
- {
- get
- {
- return "MEDIA_LATITUDE";
- }
- }
-
- /// <summary>
- /// Altitude
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Altitude
- {
- get
- {
- return "MEDIA_ALTITUDE";
- }
- }
- /// <summary>
- /// Width
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Width
- {
- get
- {
- return "MEDIA_WIDTH";
- }
- }
-
- /// <summary>
- /// Height
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Height
- {
- get
- {
- return "MEDIA_HEIGHT";
- }
- }
-
- /// <summary>
- /// Datetaken
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Datetaken
- {
- get
- {
- return "MEDIA_DATETAKEN";
- }
- }
-
- /// <summary>
- /// Orientation
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Orientation
- {
- get
- {
- return "MEDIA_ORIENTATION";
- }
- }
-
- /// <summary>
- /// Burst shot ID
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string BurstId
- {
- get
- {
- return "BURST_ID";
- }
- }
-
- /// <summary>
- /// Played count
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string PlayedCount
- {
- get
- {
- return "MEDIA_PLAYED_COUNT";
- }
- }
-
- /// <summary>
- /// Last played time
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string PlayedTime
- {
- get
- {
- return "MEDIA_LAST_PLAYED_TIME";
- }
- }
-
- /// <summary>
- /// Last played position
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string PlayedPosition
- {
- get
- {
- return "MEDIA_LAST_PLAYED_POSITION";
- }
- }
-
- /// <summary>
- /// Rating
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Rating
- {
- get
- {
- return "MEDIA_RATING";
- }
- }
-
- /// <summary>
- /// Favourite
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Favourite
- {
- get
- {
- return "MEDIA_FAVOURITE";
- }
- }
-
- /// <summary>
- /// Author
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Author
- {
- get
- {
- return "MEDIA_AUTHOR";
- }
- }
-
- /// <summary>
- /// Provider
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Provider
- {
- get
- {
- return "MEDIA_PROVIDER";
- }
- }
- /// <summary>
- /// Content name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ContentName
- {
- get
- {
- return "MEDIA_CONTENT_NAME";
- }
- }
-
- /// <summary>
- /// Category
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Category
- {
- get
- {
- return "MEDIA_CATEGORY";
- }
- }
- /// <summary>
- /// Location tag
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string LocationTag
- {
- get
- {
- return "MEDIA_LOCATION_TAG";
- }
- }
-
- /// <summary>
- /// Age rating
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string AgeRating
- {
- get
- {
- return "MEDIA_AGE_RATING";
- }
- }
-
- /// <summary>
- /// Keyword
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Keyword
- {
- get
- {
- return "MEDIA_KEYWORD";
- }
- }
-
- /// <summary>
- /// Weather
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Weather
- {
- get
- {
- return "MEDIA_WEATHER";
- }
- }
-
- /// <summary>
- /// Whether DRM(1) or not(0)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string IsDRM
- {
- get
- {
- return "MEDIA_IS_DRM";
- }
- }
-
- /// <summary>
- /// Storage type
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string StorageType
- {
- get
- {
- return "MEDIA_STORAGE_TYPE";
- }
- }
-
- /// <summary>
- /// Exposure time
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ExposureTime
- {
- get
- {
- return "MEDIA_EXPOSURE_TIME";
- }
- }
-
- /// <summary>
- /// f-number
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string FNumber
- {
- get
- {
- return "MEDIA_FNUMBER";
- }
- }
-
- /// <summary>
- /// ISO
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Iso
- {
- get
- {
- return "MEDIA_ISO";
- }
- }
-
- /// <summary>
- /// Model
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Model
- {
- get
- {
- return "MEDIA_MODEL";
- }
- }
-
- /// <summary>
- /// 360 content
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Media360
- {
- get
- {
- return "MEDIA_360";
- }
- }
-
- /// <summary>
- /// Keyword for pinyin
- /// </summary>
- public class Pinyin
- {
- /// <summary>
- /// File name (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string FileName
- {
- get
- {
- return "MEDIA_FILE_NAME_PINYIN";
- }
- }
-
- /// <summary>
- /// Title (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Title
- {
- get
- {
- return "MEDIA_TITLE_PINYIN";
- }
- }
-
- /// <summary>
- /// Album (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Album
- {
- get
- {
- return "MEDIA_ALBUM_PINYIN";
- }
- }
-
- /// <summary>
- /// Artist (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Artist
- {
- get
- {
- return "MEDIA_ARTIST_PINYIN";
- }
- }
-
- /// <summary>
- /// Album artist (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string AlbumArtist
- {
- get
- {
- return "MEDIA_ALBUM_ARTIST_PINYIN";
- }
- }
-
- /// <summary>
- /// Genre (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Genre
- {
- get
- {
- return "MEDIA_GENRE_PINYIN";
- }
- }
-
- /// <summary>
- /// Composer (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Composer
- {
- get
- {
- return "MEDIA_COMPOSER_PINYIN";
- }
- }
-
- /// <summary>
- /// Copyright (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Copyright
- {
- get
- {
- return "MEDIA_COPYRIGHT_PINYIN";
- }
- }
-
- /// <summary>
- /// Description (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Description
- {
- get
- {
- return "MEDIA_DESCRIPTION_PINYIN";
- }
- }
-
- /// <summary>
- /// Author (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Author
- {
- get
- {
- return "MEDIA_AUTHOR_PINYIN";
- }
- }
-
- /// <summary>
- /// Provider (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Provider
- {
- get
- {
- return "MEDIA_PROVIDER_PINYIN";
- }
- }
-
- /// <summary>
- /// Content name (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ContentName
- {
- get
- {
- return "MEDIA_CONTENT_NAME_PINYIN";
- }
- }
-
- /// <summary>
- /// Category (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Category
- {
- get
- {
- return "MEDIA_CATEGORY_PINYIN";
- }
- }
-
- /// <summary>
- /// Location tag (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string LocationTag
- {
- get
- {
- return "MEDIA_LOCATION_TAG_PINYIN";
- }
- }
-
- /// <summary>
- /// Age rating (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string AgeRating
- {
- get
- {
- return "MEDIA_AGE_RATING_PINYIN";
- }
- }
-
- /// <summary>
- /// Keyword (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Keyword
- {
- get
- {
- return "MEDIA_KEYWORD_PINYIN";
- }
- }
- }
- }
-
- /// <summary>
- /// Folder column set. \n
- /// You can use this define to set the condition of folder filter and order keyword.
- /// </summary>
- public class Folder
- {
-
- /// <summary>
- ///Folder UUID
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Id
- {
- get
- {
- return "FOLDER_ID";
- }
- }
-
- /// <summary>
- /// Folder path
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Path
- {
- get
- {
- return "FOLDER_PATH";
- }
- }
-
- /// <summary>
- /// Folder name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Name
- {
- get
- {
- return "FOLDER_NAME";
- }
- }
-
- /// <summary>
- /// Folder modified time
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ModifiedTime
- {
- get
- {
- return "FOLDER_MODIFIED_TIME";
- }
- }
-
- /// <summary>
- /// Folder storage type
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string StorageType
- {
- get
- {
- return "FOLDER_STORAGE_TYPE";
- }
- }
-
- /// <summary>
- /// Keyword for pinyin
- /// </summary>
- public class Pinyin
- {
- /// <summary>
- /// Folder name (pinyin)
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Name
- {
- get
- {
- return "FOLDER_NAME_PINYIN";
- }
- }
-
- }
-
- /// <summary>
- /// Folder order. Default is 0
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Order
- {
- get
- {
- return "FOLDER_ORDER";
- }
- }
-
- /// <summary>
- /// Parent folder UUID
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string ParentId
- {
- get
- {
- return "FOLDER_PARENT_FOLDER_ID";
- }
- }
- }
-
- /// <summary>
- /// Playlist column set. \n
- /// You can use this define to set the condition of playlist filter and order keyword.
- /// </summary>
- public class Playlist
- {
- /// <summary>
- /// Playlist name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Name
- {
- get
- {
- return "PLAYLIST_NAME";
- }
- }
- /// <summary>
- /// Playlist member's play order
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Order
- {
- get
- {
- return "PLAYLIST_MEMBER_ORDER";
- }
- }
-
- /// <summary>
- /// Count of media in the playlist
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Count
- {
- get
- {
- return "PLAYLIST_MEDIA_COUNT";
- }
- }
- }
-
- /// <summary>
- /// Tag column set. \n
- /// You can use this define to set the condition of tag filter and order keyword.
- /// </summary>
- public class Tag
- {
- /// <summary>
- /// Tag name
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Name
- {
- get
- {
- return "TAG_NAME";
- }
- }
-
- /// <summary>
- /// Count of media in the tag
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Count
- {
- get
- {
- return "TAG_MEDIA_COUNT";
- }
- }
- }
-
- /// <summary>
- /// Bookmark column set. \n
- /// You can use this define to set the condition of bookmark filter and order keyword.
- /// </summary>
- public class Bookmark
- {
- /// <summary>
- /// Bookmarked offset
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Offset
- {
- get
- {
- return "BOOKMARK_MARKED_TIME";
- }
- }
- }
-
- /// <summary>
- /// Storage column set. \n
- /// You can use this define to set the condition of storage filter and order keyword.
- /// </summary>
- public class Storage
- {
- /// <summary>
- /// Storage UUID
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Id
- {
- get
- {
- return "STORAGE_ID";
- }
- }
-
- /// <summary>
- /// Storage path
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Path
- {
- get
- {
- return "STORAGE_PATH";
- }
- }
- }
-
- /// <summary>
- /// Face column set. \n
- /// You can use this define to set the condition of face filter and order keyword.
- /// </summary>
- public class Face
- {
- /// <summary>
- /// face tag
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static string Tag
- {
- get
- {
- return "MEDIA_FACE_TAG";
- }
- }
- }
- }
-}
\ 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.Collections.Generic;
-using System.Threading.Tasks;
-/// <summary>
-/// The Media Content API provides functions, enumerations used in the entire Content Service.
-/// </summary>
-/// <remarks>
-/// The Media Content API provides functions and enumerations used in the entire Content Service.
-/// The information about media items i.e.image, audio and video, are managed in the content database
-/// and operations that involve database requires an active connection with the media content service.
-/// During media scanning, Media Service extract media information automatically. media information
-/// include basic file info like path, size, modified time etc and some metadata like ID3tag, EXIF,
-/// thumbnail, etc. (thumbnail extracted only in Internal and SD card storage.
-/// Media content services do not manage hidden files.
-/// The API provides functions for connecting (media_content_connect()) and disconnecting(media_content_disconnect())
-/// from the media content service.
-/// </remarks>
-
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// ContentDatabase class is the interface class for managing the ContentCollection and MediaInformation from/to the database.
- /// This class allows usre to access/create/update db operations for media content.
- /// </summary>
- public class ContentDatabase
- {
- private static IntPtr _updateHandle = IntPtr.Zero;
-
- /// <summary>
- /// Connect to the media database to search, insert, remove or modify media information.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- /// <remarks>
- /// For information security, disconnect() after use media database.
- /// </remarks>
- public static void Connect()
- {
- MediaContentValidator.ThrowIfError(Interop.Content.Connect(), "Connect failed");
- }
-
- /// <summary>
- /// Disconnect from the media database.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public static void Disconnect()
- {
- MediaContentValidator.ThrowIfError(Interop.Content.Disconnect(), "Disconnect failed");
- }
-
- private static readonly Interop.Content.MediaContentDBUpdatedCallback s_contentUpdatedCallback = (
- MediaContentError error,
- int pid,
- MediaContentUpdateItemType updateItem,
- MediaContentDBUpdateType updateType,
- MediaContentType mediaType,
- string uuid,
- string filePath,
- string mimeType,
- IntPtr userData) =>
- {
- _contentUpdated?.Invoke(
- null, new ContentUpdatedEventArgs(error, pid, updateItem, updateType, mediaType, uuid, filePath, mimeType));
- };
-
- private static event EventHandler<ContentUpdatedEventArgs> _contentUpdated;
- /// <summary>
- /// ContentUpdated event is triggered when the media DB changes.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="sender"></param>
- /// <param name="e">A ContentUpdatedEventArgs object that contains information about the update operation.</param>
- public static event EventHandler<ContentUpdatedEventArgs> ContentUpdated
- {
- add
- {
- if (_contentUpdated == null)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Content.AddDbUpdatedCb(s_contentUpdatedCallback, IntPtr.Zero, out _updateHandle), "Failed to set callback");
- }
-
- _contentUpdated += value;
- }
-
- remove
- {
- _contentUpdated -= value;
- if (_contentUpdated == null)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Content.RemoveDbUpdatedCb(_updateHandle), "Failed to unset callback");
- }
- }
- }
-
- /// <summary>
- /// Gets the count of ContentCollections for the ContentCollectionType and passed filter from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">The media filter</param>
- /// <returns>The count of contents present in the media database for a ContentSourceType</returns>
- public int GetCount<T>(ContentFilter filter) where T : class
- {
- int count = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaGroupType groupType = MediaGroupType.DisplayName;
- if (handle != IntPtr.Zero)
- {
- groupType = filter.GroupType;
- }
-
- if (typeof(T) == typeof(MediaInformation))
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetMediaCount(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(MediaBookmark))
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.GetBookmarkCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(Album))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetAlbumCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(MediaFolder))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetFolderCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(Storage))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetStorageCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(Tag))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.GetTagCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(PlayList))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetPlaylistCountFromDb(handle, out count), "Failed to get count");
- }
- else if (typeof(T) == typeof(Group))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.GetGroupCountFromDb(handle, groupType, out count), "Failed to get count");
- }
- else
- {
- throw new ArgumentException("Wrong type");
- }
-
- return count;
- }
-
- /// <summary>
- /// Gets the MediaInformation object for the passed media Id.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="id">The media id to fetch the respective MediaInformation instance</param>
- /// <returns>MediaInformation instance for the associated id.It throws Exception for invalid Id.</returns>
- public MediaInformation Select(string id)
- {
- Interop.MediaInformation.SafeMediaInformationHandle mediaHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetMediaFromDB(id, out mediaHandle), "Failed to get information");
-
- MediaContentType type;
- MediaInformation res;
- Interop.MediaInformation.GetMediaType(mediaHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information");
-
- res = new ImageInformation(imageInfo, mediaHandle);
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information");
-
- res = new AudioInformation(audioInfo, mediaHandle);
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information");
-
- res = new VideoInformation(videoInfo, mediaHandle);
- }
- else
- {
- res = new MediaInformation(mediaHandle);
- }
-
- return res;
- }
-
- /// <summary>
- /// Gets the ContentCollection object for the passed media Id.
- /// Applicable for MediaFolder and Storage types.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="id">The ContentCollection id to fetch the respective MediaInformation instance</param>
- /// <returns>ContentCollection instance for the associated id.It throws Exception for invalid Id.</returns>
- public T Select<T>(string id) where T : ContentCollection
- {
- ContentCollection result = null;
- IntPtr handle = IntPtr.Zero;
-
- if (typeof(T) == typeof(MediaFolder))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetFolderFromDb(id, out handle), "Failed to get information");
-
- if (handle != IntPtr.Zero)
- {
- result = new MediaFolder(handle);
- return (T)result;
- }
-
- }
- else if (typeof(T) == typeof(Storage))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetStorageInfoFromDb(id, out handle), "Failed to get information");
-
- if (handle != IntPtr.Zero)
- {
- result = new Storage(handle);
- return (T)result;
- }
- }
-
- return null;
- }
-
-
- /// <summary>
- /// Gets the ContentCollection object for the passed media Id.
- /// Applicable for PlayList, Album and Tag types.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="id">The ContentCollection id to fetch the respective MediaInformation instance</param>
- /// <returns>ContentCollection instance for the associated id.It throws Exception for invalid Id.</returns>
- public T Select<T>(int id) where T : ContentCollection
- {
- ContentCollection result = null;
- IntPtr handle = IntPtr.Zero;
-
- if (typeof(T) == typeof(PlayList))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetPlaylistFromDb(id, out handle), "Failed to get information");
-
- if (handle != IntPtr.Zero)
- {
- result = new PlayList(handle);
- return (T)result;
- }
- }
- else if (typeof(T) == typeof(Album))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumGetAlbumFromDb(id, out handle), "Failed to get information");
-
- if (handle != IntPtr.Zero)
- {
- result = new Album(handle);
- return (T)result;
- }
- }
- else if (typeof(T) == typeof(Tag))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.GetTagFromDb(id, out handle), "Failed to get information");
-
- if (handle != IntPtr.Zero)
- {
- result = new Tag(handle);
- return (T)result;
- }
- }
-
- return null;
- }
-
- private static IEnumerable<MediaFolder> ForEachFolder(ContentFilter filter)
- {
- List<MediaFolder> result = new List<MediaFolder>();
- Interop.Folder.MediaFolderCallback callback = (IntPtr handle, IntPtr data) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.Clone(out newHandle, handle), "Failed to clone");
-
- result.Add(new MediaFolder(newHandle));
- return true;
- };
- IntPtr filterHandle = filter != null ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.ForeachFolderFromDb(filterHandle, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- private static IEnumerable<Album> ForEachAlbum(ContentFilter filter)
- {
- List<Album> result = new List<Album>();
- Interop.Group.MediaAlbumCallback callback = (IntPtr handle, IntPtr data) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumClone(out newHandle, handle), "Failed to clone");
-
- result.Add(new Album(newHandle));
- return true;
- };
- IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Group.MediaAlbumForeachAlbumFromDb(filterHandle, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- private static IEnumerable<Group> ForEachGroup(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaGroupType groupType;
- if (filter == null)
- {
- groupType = MediaGroupType.DisplayName;
- }
- else
- {
- groupType = filter.GroupType;
- }
-
- List<Group> result = new List<Group>();
- Interop.Group.MediaGroupCallback callback = (string groupName, IntPtr data) =>
- {
- result.Add(new Group(groupName, groupType));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Group.ForeachGroupFromDb(handle, groupType, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- private static IEnumerable<Storage> ForEachStorage(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- List<Storage> result = new List<Storage>();
- Interop.Storage.MediaStorageCallback callback = (IntPtr storageHandle, IntPtr data) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Storage.Clone(out newHandle, storageHandle), "Failed to clone");
-
- result.Add(new Storage(newHandle));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Storage.ForeachStorageFromDb(handle, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- private static IEnumerable<Tag> ForEachTag(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
-
- List<Tag> result = new List<Tag>();
- Interop.Tag.MediaTagCallback callback = (IntPtr tagHandle, IntPtr data) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Tag.Clone(out newHandle, tagHandle), "Failed to clone");
-
- result.Add(new Tag(newHandle));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Tag.ForeachTagFromDb(handle, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- private static IEnumerable<PlayList> ForEachPlayList(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
-
- List<PlayList> result = new List<PlayList>();
- Interop.Playlist.MediaPlaylistCallback callback = (IntPtr playListHandle, IntPtr data) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.Clone(out newHandle, playListHandle), "Failed to clone");
-
- result.Add(new PlayList(newHandle));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.ForeachPlaylistFromDb(handle, callback, IntPtr.Zero), "Failed to get information");
-
- return result;
- }
-
- /// <summary>
- /// Returns the ContentCollections with optional filter from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <remarks>
- /// This function gets all ContentCollections matching the given filter. If NULL is passed to the filter, no filtering is applied.
- /// </remarks>
- /// <param name="filter">Filter for content items</param>
- /// <returns>
- /// Task with the list of the ContentCollection
- /// </returns>
- public IEnumerable<T> SelectAll<T>(ContentFilter filter)
- {
- if (typeof(T) == typeof(MediaInformation))
- {
- IEnumerable<MediaInformation> mediaList = GetMediaInformations(filter);
- return (IEnumerable<T>)mediaList;
- }
- else if (typeof(T) == typeof(Album))
- {
- IEnumerable<Album> collectionList = ForEachAlbum(filter);
- return (IEnumerable<T>)collectionList;
- }
- else if (typeof(T) == typeof(MediaFolder))
- {
- IEnumerable<MediaFolder> collectionList = ForEachFolder(filter);
- return (IEnumerable<T>)collectionList;
- }
- else if (typeof(T) == typeof(Group))
- {
- IEnumerable<Group> collectionList = ForEachGroup(filter);
- return (IEnumerable<T>)collectionList;
- }
- else if (typeof(T) == typeof(Storage))
- {
- IEnumerable<Storage> collectionList = ForEachStorage(filter);
- return (IEnumerable<T>)collectionList;
- }
- else if (typeof(T) == typeof(Tag))
- {
- IEnumerable<Tag> collectionList = ForEachTag(filter);
- return (IEnumerable<T>)collectionList;
- }
- else if (typeof(T) == typeof(PlayList))
- {
- IEnumerable<PlayList> collectionList = ForEachPlayList(filter);
- return (IEnumerable<T>)collectionList;
- }
-
- return null;
- }
-
- /// <summary>
- /// Returns media from the media database.
- /// This function gets all media meeting the given filter
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">The media filter</param>
- /// <returns>List of media</returns>
- private IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- List<MediaInformation> mediaInformationList = new List<MediaInformation>();
- Interop.MediaInformation.MediaInformationCallback callback = (IntPtr mediaHandle, IntPtr userData) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaInformationList.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaInformationList.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaInformationList.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaInformationList.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAllMedia(handle, callback, IntPtr.Zero), "Failed to get media information");
-
- return mediaInformationList;
- }
-
- /// <summary>
- /// Deletes a MediaInformation from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="mediaInfo">The MediaInformation to be deleted</param>
- public void Delete(MediaInformation mediaInfo)
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Delete(mediaInfo.MediaId), "Failed to remove information");
- }
-
-
- /// <summary>
- /// Deletes a content collection from the media database.
- /// Applicable for Tag and PlayList only.
- /// For other types ArgumentException is thrown.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="contentcollection">The ContentCollection instance to be deleted</param>
- public void Delete(ContentCollection contentcollection)
- {
- Type type = contentcollection.GetType();
-
- if (type == typeof(Tag))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.DeleteFromDb(((Tag)contentcollection).Id), "Failed to remove information");
- }
- else if (type == typeof(PlayList))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.DeleteFromDb(((PlayList)contentcollection).Id), "Failed to remove information");
- }
- else
- {
- throw new ArgumentException("The type of content collection is wrong");
- }
- }
-
- internal void Delete(MediaBookmark bookmark)
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.DeleteFromDb(bookmark.Id), "Failed to remove information");
- }
-
- internal void Delete(MediaFace face)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.DeleteFromDb(face.Id), "Failed to remove face information");
- }
-
- /// <summary>
- /// Updates a content collection in the media database
- /// Applicable for Tag, PlayList and MediagFolder types only.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="contentCollection">The content collection to be updated</param>
- public void Update(ContentCollection contentCollection)
- {
- Type type = contentCollection.GetType();
- if (type == typeof(Tag))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.UpdateToDb(((Tag)contentCollection).Handle), "Failed to update DB");
- }
- else if (type == typeof(PlayList))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.UpdateToDb(((PlayList)contentCollection).Handle), "Failed to update DB");
- }
- else if (type == typeof(MediaFolder))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.UpdateToDb(((MediaFolder)contentCollection).Handle), "Failed to update DB");
- }
- else
- {
- throw new ArgumentException("The type of content collection is wrong");
- }
- }
-
- /// <summary>
- /// Updates a media information instance in the media database
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="mediaInfo">The MediaInformation object to be updated</param>
- public void Update(MediaInformation mediaInfo)
- {
- Type type = mediaInfo.GetType();
- if (type == typeof(ImageInformation))
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.UpdateToDB(((ImageInformation)mediaInfo).ImageHandle), "Failed to update DB");
-
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
- }
- else if (type == typeof(AudioInformation))
- {
- MediaContentValidator.ThrowIfError(
- Interop.AudioInformation.UpdateToDB(((AudioInformation)mediaInfo).AudioHandle), "Failed to update DB");
-
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
- }
- else if (type == typeof(VideoInformation))
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.UpdateToDB(((VideoInformation)mediaInfo).VideoHandle), "Failed to update DB");
-
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
- }
- else if (type == typeof(MediaInformation))
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
- }
- else
- {
- throw new ArgumentException("Invalid information type");
- }
- }
-
- internal void Update(MediaFace face)
- {
- MediaContentValidator.ThrowIfError(Interop.Face.UpdateToDb(face.Handle), "Failed to update DB");
- }
-
- /// <summary>
- /// Inserts a content collection to the media database.
- /// Applicable for Tag and PlayList types only.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="contentCollection">The content collection to be inserted</param>
- public void Insert(ContentCollection contentCollection)
- {
- Type type = contentCollection.GetType();
- IntPtr handle = IntPtr.Zero;
- if (type == typeof(Tag))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.InsertToDb(((Tag)contentCollection).Name, out handle), "Failed to insert collection");
- ((Tag)contentCollection).Handle = handle;
- }
- else if (type == typeof(PlayList))
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.InsertToDb(((PlayList)contentCollection).Name, out handle), "Failed to insert collection");
- ((PlayList)contentCollection).Handle = handle;
- }
- else
- {
- throw new ArgumentException("collection type is wrong");
- }
- }
-
- internal void Insert(string mediaId, uint offset, string thumbnailPath)
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.InsertToDb(mediaId, offset, thumbnailPath), "Failed to insert information");
- }
-
- internal void Insert(MediaFace face)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.InsertToDb(((MediaFace)face).Handle), "Failed to insert information");
- }
- }
-}
+++ /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.Content.MediaContent
-{
- /// <summary>
- /// Event arguments passed when content is updated in the media database
- /// </summary>
- public class ContentUpdatedEventArgs : EventArgs
- {
- internal ContentUpdatedEventArgs(MediaContentError error, int pid, MediaContentUpdateItemType updateItem,
- MediaContentDBUpdateType updateType, MediaContentType mediaType, string uuid, string filePath, string mimeType)
- {
- Error = error;
- Pid = pid;
- UpdateItem = updateItem;
- UpdateType = updateType;
- MediaType = mediaType;
- Uuid = uuid;
- FilePath = filePath;
- MimeType = mimeType;
- }
- /// <summary>
- /// The error code
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentError Error
- {
- get;
- internal set;
- }
-
- /// <summary>
- /// The PID which publishes notification
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Pid
- {
- get; set;
- }
-
- /// <summary>
- /// The update item of notification
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentUpdateItemType UpdateItem
- {
- get; set;
- }
-
- /// <summary>
- /// The update type of notification
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentDBUpdateType UpdateType
- {
- get; set;
- }
-
- /// <summary>
- /// The type of the media content
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentType MediaType
- {
- get; set;
- }
-
- /// <summary>
- /// The UUID of media or directory, which is updated
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Uuid
- {
- get; set;
- }
-
- /// <summary>
- /// The path of the media or directory
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string FilePath
- {
- get; set;
- }
-
- /// <summary>
- /// The mime type of the media info
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MimeType
- {
- get; set;
- }
- }
-}
+++ /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.Content.MediaContent
-{
- /// <summary>
- /// The Content Filter API provides functions to manage media filters.
- /// </summary>
- /// <remarks>
- /// A Content filter is required for filtering information associated with Media Folder, Tag, Audio, MediaBookmark and Media Information on basis of details like offset, count, order and condition for searching.
- /// It provide functionality to set properties associated with a given content filter.
- /// Setting content filter properties helps to limit the number of filtered items as following:
- /// <list>
- /// <item><description>
- /// Offset - Used to set starting position of the filter's search
- /// </description></item>
- /// <item><description>
- /// Count - Used to set number of items to be searched from offset
- /// </description></item>
- /// <item><description>
- /// Condition - Used to set keyword which user want to search
- /// </description></item>
- /// <item><description>
- /// Order - Used to set type of media to be ordered by the filter
- /// </description></item>
- /// </list>
- /// Searchable expression can use one of the following forms:
- /// <list>
- /// <item><description>
- /// column = value
- /// </description></item>
- /// <item><description>
- /// column > value
- /// </description></item>
- /// <item><description>
- /// column >= value
- /// </description></item>
- /// <item><description>
- /// column < value
- /// </description></item>
- /// <item><description>
- /// column <= value
- /// </description></item>
- /// <item><description>
- /// value = column
- /// </description></item>
- /// <item><description>
- /// value >= column
- /// </description></item>
- /// <item><description>
- /// value < column
- /// </description></item>
- /// <item><description>
- /// value <= column
- /// </description></item>
- /// <item><description>
- /// column IN (value)
- /// </description></item>
- /// <item><description>
- /// column IN(value-list)
- /// </description></item>
- /// <item><description>
- /// column NOT IN(value)
- /// </description></item>
- /// <item><description>
- /// column NOT IN(value-list)
- /// </description></item>
- /// <item><description>
- /// column LIKE value
- /// </description></item>
- /// <item><description>
- /// expression1 AND expression2 OR expression3
- /// </description></item>
- /// </list>
- /// Note that if you want to set qoutation(" ' " or " " ") as value of LIKE operator, you should use two times.(" '' " or " "" ") \n And the optional ESCAPE clause is supported. Both percent symbol("%") and underscore symbol("_") are used in the LIKE pattern.
- /// If these characters are used as value of LIKE operation, then the expression following the ESCAPE caluse of sqlite.
- /// </remarks>
- public class ContentFilter : IDisposable
- {
- private IntPtr _filterHandle = IntPtr.Zero;
- private bool _disposedValue = false;
- private ContentCollation _conditionCollate = ContentCollation.Default;
- private ContentCollation _orderCollate = ContentCollation.Default;
- private ContentOrder _orderType = ContentOrder.Asc;
- private string _orderKeyword = null;
- private string _conditionMsg = null;
-
- internal IntPtr Handle
- {
- get
- {
- if (_filterHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(ContentFilter));
- }
-
- return _filterHandle;
- }
- }
- /// <summary>
- /// The start position of the given filter Starting from zero.
- /// Please note that count value has to be set properly for correct result.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Offset
- {
- get
- {
- int offset;
- int count;
- MediaContentValidator.ThrowIfError(
- Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get offset");
-
- return offset;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetOffset(Handle, value, this.Count), "Failed to set offset");
- }
- }
-
- public ContentFilter()
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.Create(out _filterHandle), "Failed to Create Filter handle.");
- }
-
- /// <summary>
- /// The number of items to be searched with respect to the offset
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Count
- {
- get
- {
- int offset;
- int count;
- MediaContentValidator.ThrowIfError(
- Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get count");
-
- return count;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetOffset(Handle, this.Offset, value), "Failed to set count");
- }
- }
-
- /// <summary>
- /// Gets the media filter content order and order keyword.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentOrder Order
- {
- get
- {
- return _orderType;
- }
-
- set
- {
- if (_orderKeyword != null)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetOrder(Handle, value, _orderKeyword, _orderCollate), "Failed to set order");
- }
-
- _orderType = value;
- }
- }
-
- /// <summary>
- /// The search order keyword
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string OrderKey
- {
- get
- {
- ContentOrder order;
- IntPtr val = IntPtr.Zero;
- ContentCollation type;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.GetOrder(Handle, out order, out val, out type), "Failed to GetOrder for OrderKey");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetOrder(Handle, _orderType, value, _orderCollate), "Failed to set OrderKey");
-
- _orderKeyword = value;
- }
- }
-
- /// <summary>
- /// The collate type for comparing two strings
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentCollation OrderCollationType
- {
- get
- {
- return _orderCollate;
- }
-
- set
- {
- if (_orderKeyword != null)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetOrder(Handle, _orderType, _orderKeyword, value), "Failed to set collation");
- }
-
- _orderCollate = value;
- }
- }
-
- /// <summary>
- /// Gets/Sets the condition for the given filter.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Condition
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- ContentCollation type;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.GetCondition(Handle, out val, out type), "Failed to get condition");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetCondition(Handle, value, _conditionCollate), "Failed to set condition");
-
- _conditionMsg = value;
- }
- }
-
- /// <summary>
- /// The collate type for comparing two strings
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentCollation ConditionCollationType
- {
- get
- {
- return _conditionCollate;
- }
-
- set
- {
- if (_conditionMsg != null)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetCondition(Handle, _conditionMsg, value), "Failed to set collation");
- }
-
- _conditionCollate = value;
- }
- }
-
- /// <summary>
- /// Sets the storage id for the given filter.
- /// You can use this property when you want to search items only in the specific storage
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string StorageId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.GetStorage(Handle, out val), "Failed to get condition");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Filter.SetStorage(Handle, value), "Failed to set condition");
- }
- }
-
- /// <summary>
- /// The type of the media group
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaGroupType GroupType { get; set; }
-
- /// <summary>
- /// Dispose API for closing the internal resources.
- /// This function can be used to stop all effects started by Vibrate().
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (_filterHandle != IntPtr.Zero)
- {
- Interop.Filter.Destroy(_filterHandle);
- _filterHandle = IntPtr.Zero;
- }
-
- _disposedValue = true;
- }
- }
- }
-}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Threading;
-
-/// <summary>
-/// The Media Content API provides functions, enumerations used in the entire Content Service.
-/// </summary>
-/// <remarks>
-/// The Media Content API provides functions and enumerations used in the entire Content Service.
-/// The information about media items i.e.image, audio and video, are managed in the content database
-/// and operations that involve database requires an active connection with the media content service.
-/// During media scanning, Media Service extract media information automatically. media information
-/// include basic file info like path, size, modified time etc and some metadata like ID3tag, EXIF,
-/// thumbnail, etc. (thumbnail extracted only in Internal and SD card storage.
-/// Media content services do not manage hidden files.
-/// The API provides functions for connecting (media_content_connect()) and disconnecting(media_content_disconnect())
-/// from the media content service.
-/// </remarks>
-
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// ContentManager class is the interface class for accessing the ContentCollection and MediaInformation.
- /// This class allows usre to create/update db operations for media content.
- /// </summary>
- public static class ContentManager
- {
- private static readonly ContentDatabase s_contentDB = new ContentDatabase();
-
- /// <summary>
- /// Database instance to do all the Database oprtions for media content management.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static ContentDatabase Database
- {
- get
- {
- return s_contentDB;
- }
- }
-
- /// <summary>
- /// Requests to scan a media file.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filePath">File path of the media to be scanned</param>
- /// <returns>A reference to the MediaInformation object scanned</returns>
- /// <remarks>
- /// This function requests to scan a media file to the media server. If media file is not registered to DB yet,
- /// that media file information will be added to the media DB. If it is already registered to the DB,
- /// then this tries to refresh information. If requested file does not exist on file system,
- /// information of the media file will be removed from the media DB.
- /// </remarks>
- public static void Scan(string filePath)
- {
- MediaContentValidator.ThrowIfError(Interop.Content.ScanFile(filePath), "Failed scan");
- }
-
- /// <summary>
- /// Inserts a media to the media database
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filePath">File path of the media to be inserted</param>
- /// <returns>the MediaInformation instance about added media path</returns>
- public static MediaInformation AddMediaInformation(string filePath)
- {
- Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Insert(filePath, out mediaInformationHandle), "Failed to Insert MediaInformation to DB");
-
- MediaContentType type;
- MediaInformation res;
- Interop.MediaInformation.GetMediaType(mediaInformationHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaInformationHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information");
-
- res = new ImageInformation(imageInfo, mediaInformationHandle);
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaInformationHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information");
-
- res = new AudioInformation(audioInfo, mediaInformationHandle);
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaInformationHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information");
-
- res = new VideoInformation(videoInfo, mediaInformationHandle);
- }
- else
- {
- res = new MediaInformation(mediaInformationHandle);
- }
-
- return res;
- }
-
- /// <summary>
- /// Requests to scan a media folder, asynchronously.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="folderPath">The folder path</param>
- /// <param name="recursive">Indicate sif the folder is to recursively scanned. Default value: true</param>
- /// <remarks>
- /// This function requests to scan a media folder to the media server with given completed callback function.
- /// The sub folders are also scanned,if there are sub folders in that folder.
- /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
- /// </remarks>
- /// <returns>Task with scanning result</returns>
- public static Task<MediaContentError> ScanFolderAsync(string folderPath, bool recursive = true)
- {
- var task = new TaskCompletionSource<MediaContentError>();
-
- Interop.Content.MediaScanCompletedCallback scanCompleted = (MediaContentError scanResult, IntPtr data) =>
- {
- MediaContentValidator.ThrowIfError(scanResult, "Failed to scan");
- task.SetResult(scanResult);
- };
-
- MediaContentValidator.ThrowIfError(
- Interop.Content.ScanFolder(folderPath, recursive, scanCompleted, IntPtr.Zero), "Failed to scan");
-
- return task.Task;
- }
-
- internal static Interop.Content.MediaScanCompletedCallback scanCompletedWithToken = null;
- internal static Object l = new Object();
- /// <summary>
- /// Requests to scan a media folder, asynchronously.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="folderPath">The folder path</param>
- /// <param name="cancellationToken">Cancellation token required to cancel the current scan</param>
- /// <param name="recursive">Indicate sif the folder is to recursively scanned. Default value: true</param>
- /// <remarks>
- /// This function requests to scan a media folder to the media server with given completed callback function.
- /// The sub folders are also scanned,if there are sub folders in that folder.
- /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
- /// </remarks>
- /// <returns>Task with scanning result</returns>
- public static Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken, bool recursive = true)
- {
- var task = new TaskCompletionSource<int>();
- bool taskCompleted = false;
-
- cancellationToken.Register(() =>
- {
- lock (l)
- {
- if (!taskCompleted)
- {
- taskCompleted = true;
- MediaContentValidator.ThrowIfError(
- Interop.Content.CancelScanFolder(folderPath), "Failed CancelScanFolder");
-
- task.SetCanceled();
- }
- }
- });
- scanCompletedWithToken = (MediaContentError scanResult, IntPtr data) =>
- {
- lock (l)
- {
- if (!taskCompleted)
- {
- taskCompleted = true;
- MediaContentValidator.ThrowIfError(scanResult, "Failed scan");
- task.SetResult((int)scanResult);
- }
- }
- };
-
- MediaContentValidator.ThrowIfError(
- Interop.Content.ScanFolder(folderPath, recursive, scanCompletedWithToken, IntPtr.Zero), "Failed to scan");
-
- return task.Task;
-
- }
-
- /// <summary>
- /// Inserts media files into the media database, asynchronously.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filePaths">The path array to the media files</param>
- /// <returns>
- /// Task with the result of batch insertion
- /// </returns>
- public static Task AddMediaInformationBatchAsync(IEnumerable<string> filePaths)
- {
- var task = new TaskCompletionSource<int>();
- string[] paths = ((List<string>)filePaths).ToArray();
- Interop.MediaInformation.MediaInsertCompletedCallback callback = (MediaContentError error, IntPtr userData) =>
- {
- MediaContentValidator.ThrowIfError(error, "Failed to batch insert");
- task.SetResult((int)error);
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.BatchInsert(paths, paths.Length, callback, IntPtr.Zero), "Failed to add batch media");
-
- return task.Task;
- }
-
- /// <summary>
- /// Inserts the burst shot images into the media database, asynchronously.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filePaths">The path array to the burst shot images</param>
- /// <returns>
- /// Task with the result of the burstshot insertion
- /// </returns>
- public static Task AddBurstShotImagesAsync(IEnumerable<string> filePaths)
- {
- var task = new TaskCompletionSource<int>();
- string[] paths = ((List<string>)filePaths).ToArray();
- Interop.MediaInformation.MediaInsertBurstShotCompletedCallback callback = (MediaContentError error, IntPtr userData) =>
- {
- MediaContentValidator.ThrowIfError(error, "Failed to add burstshot");
- task.SetResult((int)error);
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.BurstShotInsert(paths, paths.Length, callback, IntPtr.Zero), "Failed to add burst shots to db");
-
- return task.Task;
- }
-
- /// <summary>
- /// Deletes media files from the media database. The media files for deletion can be specified as a condition in a filter.
- /// This function deletes the media items from the content storage.Normally, deleting media files in the database are done automatically by the media server,
- /// without calling this function.This function is only called when the media server is busy and user needs to get quick result of deleting.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">The content filter to which media will be matched</param>
- public static void RemoveMediaInformationBatch(ContentFilter filter)
- {
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.BatchDelete(handle), "Failed to remove items");
- }
- }
-}
--- /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.
+ */
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Specifies how the strings are compared.
+ /// </summary>
+ internal enum Collation
+ {
+ /// <summary>
+ /// Default collation, binary.
+ /// </summary>
+ Default,
+ /// <summary>
+ /// Case-insensitive.
+ /// </summary>
+ NoCase,
+ /// <summary>
+ /// Trailing space characters are ignored.
+ /// </summary>
+ Rtrim,
+ /// <summary>
+ /// Localized, NoCase also applied.
+ /// </summary>
+ Localized
+ }
+
+ /// <summary>
+ /// Specifies storage types.
+ /// </summary>
+ public enum StorageType
+ {
+ /// <summary>
+ /// The device's internal storage.
+ /// </summary>
+ Internal = 0,
+
+ /// <summary>
+ /// The device's external storage like sd card.
+ /// </summary>
+ External = 1,
+
+ /// <summary>
+ /// The external usb storage.
+ /// </summary>
+ ExternalUsb = 2
+ }
+
+ /// <summary>
+ /// Specifies database operation types.
+ /// </summary>
+ public enum OperationType
+ {
+ /// <summary>
+ /// Insert operation.
+ /// </summary>
+ Insert,
+
+ /// <summary>
+ /// Delete operation.
+ /// </summary>
+ Delete,
+
+ /// <summary>
+ /// Update operation.
+ /// </summary>
+ Update
+ }
+
+ internal enum ItemType
+ {
+ File,
+ Directory
+ }
+
+ /// <summary>
+ /// Specifies types of <see cref="MediaInfo"/>.
+ /// </summary>
+ public enum MediaType
+ {
+ /// <summary>
+ /// The type of an image.
+ /// </summary>
+ /// <seealso cref="ImageInfo"/>
+ Image = 0,
+
+ /// <summary>
+ /// The type of a video.
+ /// </summary>
+ /// <seealso cref="VideoInfo"/>
+ Video = 1,
+
+ /// <summary>
+ /// The type of sound.
+ /// </summary>
+ /// <seealso cref="AudioInfo"/>
+ Sound = 2,
+
+ /// <summary>
+ /// The type of music.
+ /// </summary>
+ /// <seealso cref="AudioInfo"/>
+ Music = 3,
+
+ /// <summary>
+ /// The type of other.
+ /// </summary>
+ Other = 4
+ }
+
+ /// <summary>
+ /// Specifies orientation types of media.
+ /// </summary>
+ public enum Orientation
+ {
+ /// <summary>
+ /// None.
+ /// </summary>
+ Rotate0 = 0,
+ /// <summary>
+ /// Normal.
+ /// </summary>
+ Normal = 1,
+ /// <summary>
+ /// Rotate 90 degrees.
+ /// </summary>
+ Rotate90 = 6,
+ /// <summary>
+ /// Rotate 180 degrees.
+ /// </summary>
+ Rotate180 = 3,
+ /// <summary>
+ /// Rotate 270 degrees.
+ /// </summary>
+ Rotate270 = 8,
+ /// <summary>
+ /// Flip horizontal.
+ /// </summary>
+ FlipHorizontal = 2,
+ /// <summary>
+ /// Flip vertical.
+ /// </summary>
+ FlipVertical = 4,
+ /// <summary>
+ /// Transpose.
+ /// </summary>
+ Transpose = 5,
+ /// <summary>
+ /// Transverse.
+ /// </summary>
+ Transverse = 7,
+ }
+}
--- /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.Content.MediaContent
+{
+
+ /// <summary>
+ /// Provides data for the <see cref="MediaDatabase.MediaInfoUpdated"/> event.
+ /// </summary>
+ public class MediaInfoUpdatedEventArgs : EventArgs
+ {
+ internal MediaInfoUpdatedEventArgs(int pid,
+ OperationType operationType, MediaType mediaType, string id, string path, string mimeType)
+ {
+ ProcessId = pid;
+ OperationType = operationType;
+ Id = id;
+ Path = path;
+
+ MediaType = mediaType;
+ MimeType = mimeType;
+ }
+
+ /// <summary>
+ /// Gets the process id which triggers the event.
+ /// </summary>
+ /// <value>The process id which triggers the event.</value>
+ public int ProcessId
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the operation type.
+ /// </summary>
+ /// <value>The operation type which triggers the event.</value>
+ public OperationType OperationType
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the id of the media updated.
+ /// </summary>
+ /// <value>The id of the media updated.</value>
+ public string Id
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the path of the media updated.
+ /// </summary>
+ /// <value>The path of the media updated.</value>
+ public string Path
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the type of the media updated.
+ /// </summary>
+ /// <value>The <see cref="MediaType"/> of the media updated.</value>
+ public MediaType MediaType
+ {
+ get;
+ }
+
+ /// <summary>
+ /// The mime type of the media updated.
+ /// </summary>
+ /// <value>The mime type of the media updated.</value>
+ public string MimeType
+ {
+ get;
+ }
+ }
+
+
+ /// <summary>
+ /// Provides data for the <see cref="MediaDatabase.FolderUpdated"/> event.
+ /// </summary>
+ public class FolderUpdatedEventArgs : EventArgs
+ {
+ internal FolderUpdatedEventArgs(OperationType operationType, string id, string path)
+ {
+ OperationType = operationType;
+ Id = id;
+ Path = path;
+ }
+
+ /// <summary>
+ /// Gets the operation type.
+ /// </summary>
+ /// <value>The operation type which triggers the event.</value>
+ public OperationType OperationType
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the id of the folder updated.
+ /// </summary>
+ /// <value>The id of the folder updated.</value>
+ public string Id
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the path of the folder updated.
+ /// </summary>
+ /// <value>The path of the folder updated.</value>
+ public string Path
+ {
+ get;
+ }
+ }
+
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Represents the face information for media.
+ /// </summary>
+ public class FaceInfo
+ {
+ internal FaceInfo(IntPtr handle)
+ {
+ Id = InteropHelper.GetString(handle, Interop.Face.GetId);
+ MediaInfoId = InteropHelper.GetString(handle, Interop.Face.GetMediaId);
+
+ Tag = InteropHelper.GetString(handle, Interop.Face.GetTag);
+ Orientation = InteropHelper.GetValue<IntPtr, Orientation>(handle, Interop.Face.GetOrientation);
+
+ Rect = GetRect(handle);
+ }
+
+ private static Rectangle GetRect(IntPtr faceHandle)
+ {
+ Interop.Face.GetFaceRect(faceHandle, out var x, out var y, out var width, out var height).
+ ThrowIfError("Failed to get rect for the face info");
+
+ return new Rectangle(x, y, width, height);
+ }
+
+ /// <summary>
+ /// Gets the region.
+ /// </summary>
+ /// <value>The region of face in the media.</value>
+ /// <remarks>
+ /// The coordinates of the rectangle are orientation-applied values.
+ /// </remarks>
+ public Rectangle Rect { get; }
+
+ /// <summary>
+ /// Gets the id of face info.
+ /// </summary>
+ public string Id { get; }
+
+ /// <summary>
+ /// Gets the media id that the face info is added.
+ /// </summary>
+ /// <value>The media id that the face info is added.</value>
+ public string MediaInfoId { get; }
+
+ /// <summary>
+ /// Gets the tag name.
+ /// </summary>
+ /// <value>The tag name of face info.</value>
+ public string Tag { get; }
+
+ /// <summary>
+ /// Gets the orientation of face info.
+ /// </summary>
+ /// <value>The orientation of face info.</value>
+ public Orientation Orientation { get; }
+
+ internal static FaceInfo FromHandle(IntPtr handle)
+ {
+ return new FaceInfo(handle);
+ }
+
+ /// <summary>
+ /// Returns a string representation of the face info.
+ /// </summary>
+ /// <returns>A string representation of the current face info.</returns>
+ public override string ToString() =>
+ $"Id={Id}, MediaInfoId={MediaInfoId}, Rect=({Rect}), Tag={Tag}";
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage face infos in the database.
+ /// </summary>
+ /// <seealso cref="Album"/>
+ public class FaceInfoCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FaceInfoCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public FaceInfoCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Deletes a face info from the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="faceInfoId">The face info id to delete.</param>
+ /// <returns>true if the matched record was found and deleted, otherwise false.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="faceInfoId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="faceInfoId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Delete(string faceInfoId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(faceInfoId, nameof(faceInfoId));
+
+ var reader = Select(new SelectArguments { FilterExpression = $"{FaceInfoColumns.Id}='{faceInfoId}'" });
+
+ if (reader.Read() == false)
+ {
+ return false;
+ }
+
+ CommandHelper.Delete(Interop.Face.DeleteFromDb, faceInfoId);
+ return true;
+ }
+
+ /// <summary>
+ /// Retrieves the face info.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<FaceInfo> Select()
+ {
+ return Select(null);
+ }
+
+ /// <summary>
+ /// Retrieves the face info with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<FaceInfo> Select(SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(filter, Interop.Face.ForeachFromDb, FaceInfo.FromHandle);
+ }
+
+ /// <summary>
+ /// Updates a tag with the specified tag.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="faceInfoId">The face info id to update.</param>
+ /// <param name="tag">The tag value for update.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>Only values set in <see cref="PlaylistUpdateValues"/> are updated.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="faceInfoId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="faceInfoId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool UpdateTag(string faceInfoId, string tag)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(faceInfoId, nameof(faceInfoId));
+
+ if (tag == null)
+ {
+ throw new ArgumentNullException(nameof(tag));
+ }
+
+ var handle = CommandHelper.SelectScalar(Interop.Face.ForeachFromDb, $"{FaceInfoColumns.Id}='{faceInfoId}'",
+ Interop.Face.Clone);
+
+ if (handle == IntPtr.Zero)
+ {
+ return false;
+ }
+
+ try
+ {
+ Interop.Face.SetTag(handle, tag).ThrowIfError("Failed to update(setting tag)");
+
+ Interop.Face.Update(handle).ThrowIfError("Failed to update(executing query)");
+ return true;
+ }
+ finally
+ {
+ Interop.Face.Destroy(handle);
+ }
+ }
+ }
+}
+++ /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.
-*/
-
-
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// FaceRect represents a rectangle dimension to create a Face in an image.
- /// It is used to create or tag a MediaFace in an image file.
- /// </summary>
- public class FaceRect
- {
- public FaceRect(int x, int y, int width, int height)
- {
- X = x;
- Y = y;
- Width = width;
- Height = height;
- }
-
- /// <summary>
- /// X coordinate of the FaceRect
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public readonly int X;
-
- /// <summary>
- /// Y coordinate of the FaceRect
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public readonly int Y;
-
- /// <summary>
- /// Width of the FaceRect
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public readonly int Width;
-
- /// <summary>
- /// Height of the FaceRect
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public readonly int Height;
- }
-}
--- /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 Tizen.System;
+
+static internal class Features
+{
+ internal const string FaceRecognition = "http://tizen.org/feature/vision.face_recognition";
+
+ internal static bool IsSupported(string key)
+ {
+ if (SystemInfo.TryGetValue(key, out bool value))
+ {
+ return value;
+ }
+ return false;
+ }
+}
\ 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;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Represents the folder information for media.
+ /// </summary>
+ /// <remarks>
+ /// A <see cref="Folder"/> is used to organize media content files i.e. image, audio, video files,
+ /// in the physical storage of the device.
+ /// </remarks>
+ public class Folder
+ {
+ internal Folder(IntPtr handle)
+ {
+ Id = InteropHelper.GetString(handle, Interop.Folder.GetFolderId);
+ Path = InteropHelper.GetString(handle, Interop.Folder.GetPath);
+ Name = InteropHelper.GetString(handle, Interop.Folder.GetName);
+
+ StorageType = InteropHelper.GetValue<StorageType>(handle, Interop.Folder.GetStorageType);
+ StorageId = InteropHelper.GetString(handle, Interop.Folder.GetStorageId);
+ }
+
+ internal static Folder FromHandle(IntPtr handle) => new Folder(handle);
+
+ /// <summary>
+ /// Gets the id of folder.
+ /// </summary>
+ /// <value>The unique id of folder.</value>
+ public string Id { get; }
+
+ /// <summary>
+ /// Gets the path of folder.
+ /// </summary>
+ /// <value>The path of folder.</value>
+ public string Path { get; }
+
+ /// <summary>
+ /// Gets the name of folder.
+ /// </summary>
+ /// <value>The name of folder.</value>
+ public string Name { get; }
+
+ /// <summary>
+ /// Gets the <see cref="StorageType"/> of the storage that the folder exists.
+ /// </summary>
+ /// <value>The <see cref="StorageType"/> of the storage that the folder exists.</value>
+ public StorageType StorageType { get; }
+
+ /// <summary>
+ /// Gets the storage id of the storage that the folder exists.
+ /// </summary>
+ /// <value>The storage id of the storage that the folder exists.</value>
+ public string StorageId { get; }
+
+ /// <summary>
+ /// Returns a string representation of the folder.
+ /// </summary>
+ /// <returns>A string representation of the current folder.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Name={Name}, Path={Path}, StorageType={StorageType}, StorageId={StorageType}";
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage folders and query related media items in the database.
+ /// </summary>
+ public class FolderCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FolderCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public FolderCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of folders.
+ /// </summary>
+ /// <returns>The number of folders.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count()
+ {
+ return Count(null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of folders with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of folders.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Folder.GetFolderCountFromDb, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the folders.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Folder> Select()
+ {
+ return Select(arguments: null);
+ }
+
+ /// <summary>
+ /// Retrieves the folders with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Folder> Select(SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(arguments, Interop.Folder.ForeachFolderFromDb, Folder.FromHandle);
+ }
+
+ /// <summary>
+ /// Retrieves the folder.
+ /// </summary>
+ /// <param name="folderId">The folder id to query with.</param>
+ /// <returns>The <see cref="Folder"/> instance if the matched record was found in the database, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
+ public Folder Select(string folderId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(folderId, nameof(folderId));
+
+ Interop.Folder.GetFolderFromDb(folderId, out var handle).ThrowIfError("Failed to query");
+
+ if (handle == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ try
+ {
+ return new Folder(handle);
+ }
+ finally
+ {
+ Interop.Folder.Destroy(handle);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info under the folder.
+ /// </summary>
+ /// <param name="folderId">The id of the folder to count media in the folder.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
+ public int CountMedia(string folderId)
+ {
+ return CountMedia(folderId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info under the folder with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="folderId">The id of the folder to count media in the folder.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
+ public int CountMedia(string folderId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(folderId, nameof(folderId));
+
+ return CommandHelper.Count(Interop.Folder.GetMediaCountFromDb, folderId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the media info under the folder.
+ /// </summary>
+ /// <param name="folderId">The id of the folder to select media in the folder.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(string folderId)
+ {
+ return SelectMedia(folderId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the media info under the folder with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="folderId">The id of the folder to select media in the folder.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="folderId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(string folderId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(folderId, nameof(folderId));
+
+ return CommandHelper.SelectMedia(Interop.Folder.ForeachMediaFromDb, folderId, filter);
+ }
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// A Media Group represents logical grouping of media files with respect to their group name.
- /// It is also used for filtering media items.
- /// </summary>
- public class Group : ContentCollection
- {
- private readonly string _groupName;
- private readonly MediaGroupType _groupType;
- private bool _disposedValue = false;
-
- /// <summary>
- /// The name of the media group
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get { return _groupName; }
- }
-
- internal Group(string name, MediaGroupType groupType)
- {
- _groupName = name;
- _groupType = groupType;
- }
-
- public override void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- _disposedValue = true;
- }
- }
-
- /// <summary>
- /// Gets the count of the media info for the given media group present in the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
- {
- int mediaCount = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Group.GetMediaCountFromDb(Name, _groupType, handle, out mediaCount), "Failed to GetMediaCountFromDb");
-
- return mediaCount;
- }
-
-
- /// <summary>
- /// Iterates through the media files with an optional filter in the given group from the media database.
- /// This function gets all media files associated with the given group and meeting desired filter option.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- List<MediaInformation> mediaContents = new List<MediaInformation>();
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.Group.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone MediaInformation instance");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Group.ForeachMediaFromDb(Name, _groupType, handle, callback, IntPtr.Zero), "Failed to get media information for the group");
-
- return mediaContents;
- }
- }
-}
--- /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;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Represents the image media stored in the device.
+ /// </summary>
+ public class ImageInfo : MediaInfo
+ {
+ internal ImageInfo(Interop.MediaInfoHandle handle) : base(handle)
+ {
+ IntPtr imageHandle = IntPtr.Zero;
+
+ try
+ {
+ Interop.MediaInfo.GetImage(handle, out imageHandle).ThrowIfError("Failed to retrieve data");
+
+ Debug.Assert(imageHandle != IntPtr.Zero);
+
+ Width = InteropHelper.GetValue<int>(imageHandle, Interop.ImageInfo.GetWidth);
+ Height = InteropHelper.GetValue<int>(imageHandle, Interop.ImageInfo.GetHeight);
+
+ Orientation = InteropHelper.GetValue<Orientation>(imageHandle, Interop.ImageInfo.GetOrientation);
+
+ DateTaken = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetDateTaken);
+ BurstId = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetBurstId);
+ ExposureTime = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetExposureTime);
+
+ FNumber = InteropHelper.GetValue<double>(imageHandle, Interop.ImageInfo.GetFNumber);
+ Iso = InteropHelper.GetValue<int>(imageHandle, Interop.ImageInfo.GetISO);
+
+ Model = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetModel);
+
+ IsBurstShot = InteropHelper.GetValue<bool>(imageHandle, Interop.ImageInfo.IsBurstShot);
+
+ }
+ finally
+ {
+ Interop.ImageInfo.Destroy(imageHandle);
+ }
+ }
+
+ /// <summary>
+ /// Gets the image width in pixels.
+ /// </summary>
+ /// <value>The image width in pixels.</value>
+ public int Width { get; }
+
+ /// <summary>
+ /// Gets the image height in pixels.
+ /// </summary>
+ /// <value>The image height in pixels.</value>
+ public int Height { get; }
+
+ /// <summary>
+ /// Gets the orientation of image.
+ /// </summary>
+ /// <value>The orientation of image.</value>
+ public Orientation Orientation { get; }
+
+ /// <summary>
+ /// Gets the date of the creation time as a formatted string.
+ /// </summary>
+ /// <value>The date of the creation time as a formatted string.</value>
+ public string DateTaken { get; }
+
+ /// <summary>
+ /// Gets the burst shot id.
+ /// </summary>
+ /// <value>The burst shot id if it is a burst shot, otherwise an empty string.</value>
+ /// <seealso cref="IsBurstShot"/>
+ public string BurstId { get; }
+
+ /// <summary>
+ /// Gets the exposure time from exif.
+ /// </summary>
+ /// <value>The exposure time from exif.</value>
+ public string ExposureTime { get; }
+
+ /// <summary>
+ /// Gets the FNumber from exif.
+ /// </summary>
+ /// <value>The FNumber from exif.</value>
+ public double FNumber { get; }
+
+ /// <summary>
+ /// Gets the iso from exif.
+ /// </summary>
+ /// <value>The iso from exif.</value>
+ public int Iso { get; }
+
+ /// <summary>
+ /// Gets the model from exif.
+ /// </summary>
+ /// <value>The model from exif.</value>
+ public string Model { get; }
+
+ /// <summary>
+ /// Gets the value indicating whether the media is a burst shot image.
+ /// </summary>
+ /// <value>true if the media is a burst shot image, otherwise false.</value>
+ public bool IsBurstShot { get; }
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Collections.ObjectModel;
-using System.Runtime.InteropServices;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// ImageContent class API gives the information related to the image media stored in the device</summary>
- public class ImageInformation : MediaInformation
- {
- private readonly Interop.ImageInformation.SafeImageInformationHandle _handle;
-
- /// <summary>
- /// Gets the id of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MediaId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetMediaId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the image width in pixels.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Width
- {
- get
- {
- int width = 0;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetWidth(_handle, out width), "Failed to get value");
-
- return width;
- }
- }
-
- /// <summary>
- /// Gets the image height in pixels.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Height
- {
- get
- {
- int height = 0;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetHeight(_handle, out height), "Failed to get value");
-
- return height;
- }
- }
-
- /// <summary>
- /// Image orientation.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentOrientation Orientation
- {
- get
- {
- MediaContentOrientation orientation = MediaContentOrientation.NotAvailable;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetOrientation(_handle, out orientation), "Failed to get value");
-
- return orientation;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.SetOrientation(_handle, value), "Failed to set value");
- }
- }
-
- /// <summary>
- /// Gets the image creation time in seconds, since the Epoch.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string TakenDate
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetDateTaken(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the burst shot ID.
- /// If BurstId is null, this is not a burst shot
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string BurstId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetBurstId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the exposure time from exif.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ExposureTime
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetExposureTime(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the fnumber from exif.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public double FNumber
- {
- get
- {
- double fNumber = 0.0;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetFNumber(_handle, out fNumber), "Failed to get value");
-
- return fNumber;
- }
- }
-
- /// <summary>
- /// Gets the iso from exif.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Iso
- {
- get
- {
- int iso = 0;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetISO(_handle, out iso), "Failed to get value");
-
- return iso;
- }
- }
-
- /// <summary>
- /// Gets the model from exif.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Model
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.GetModel(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Checks whether the media is a burst shot image.
- /// The value is true if the media is a burst shot image,
- /// otherwise false if the media is not a burst shot image.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool IsBurstShot
- {
- get
- {
- bool isBurst = false;
- MediaContentValidator.ThrowIfError(
- Interop.ImageInformation.IsBurstShot(_handle, out isBurst), "Failed to get value");
-
- return isBurst;
- }
- }
-
- /// <summary>
- /// Iterates through the media faces with filter in the given media file from the media database.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// Task to get all the MediaFaces </returns>
- /// <param name="filter"> filter for the Tags</param>
- public IEnumerable<MediaFace> GetMediaFaces(ContentFilter filter)
- {
- Collection<MediaFace> coll = new Collection<MediaFace>();
-
- Interop.MediaInformation.MediaFaceCallback callback = (IntPtr faceHandle, IntPtr userData) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Face.Clone(out newHandle, faceHandle), "Failed to clone Tag");
-
- coll.Add(new MediaFace(newHandle));
- return true;
- };
- IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAllFaces(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value");
-
- return coll;
- }
-
- /// <summary>
- /// Gets the number of faces for the passed filter in the given media ID from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// int count</returns>
- /// <param name="filter">The Filter for matching Face</param>
- public int GetMediaFaceCount(ContentFilter filter)
- {
- int count = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetFaceCount(MediaId, handle, out count), "Failed to get value");
-
- return count;
- }
-
-
- /// <summary>
- /// Inserts a MediaFace item to the media database
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="image">The image on which face is to be added</param>
- /// <param name="rect">The dimensions of the face</param>
- /// <returns>The MediaFace instance</returns>
- public MediaFace AddFace(ImageInformation image, FaceRect rect)
- {
- MediaFace face = new MediaFace(image, rect);
- ContentManager.Database.Insert(face);
- return face;
- }
-
- /// <summary>
- /// Deletes the MediaFace from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="face">The face instance to be deleted</param>
- public void DeleteFace(MediaFace face)
- {
- ContentManager.Database.Delete(face);
- }
-
- /// <summary>
- /// Updates the MediaFace in the media database
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="face">The MediaFace object to be updated</param>
- public void UpdateFace(MediaFace face)
- {
- ContentManager.Database.Update(face);
- }
-
- internal IntPtr ImageHandle
- {
- get
- {
- return _handle.DangerousGetHandle();
- }
- }
-
- internal ImageInformation(Interop.ImageInformation.SafeImageInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle)
- : base(mediaInformationHandle)
- {
- _handle = handle;
- }
- }
-}
--- /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.Content.MediaContent
+{
+ internal static class InteropHelper
+ {
+ internal delegate MediaContentError GetStringFunc<T>(T handle, out IntPtr value);
+
+ internal static string GetString<T>(T handle, GetStringFunc<T> func)
+ {
+ IntPtr val = IntPtr.Zero;
+ try
+ {
+ func(handle, out val).ThrowIfError("Failed to get value");
+
+ if (val == IntPtr.Zero)
+ {
+ return string.Empty;
+ }
+
+ return Marshal.PtrToStringAnsi(val);
+ }
+ finally
+ {
+ Interop.Libc.Free(val);
+ }
+ }
+
+ internal delegate MediaContentError GetValueFunc<T, TValue>(T handle, out TValue value);
+
+ internal static TValue GetValue<T, TValue>(T handle, GetValueFunc<T, TValue> func)
+ {
+ func(handle, out var val).ThrowIfError("Failed to get value");
+
+ return val;
+ }
+
+ internal static TValue GetValue<TValue>(IntPtr handle, GetValueFunc<IntPtr, TValue> func)
+ {
+ func(handle, out var val).ThrowIfError("Failed to get value");
+
+ return val;
+ }
+
+ internal static TValue GetValue<TValue>(Interop.MediaInfoHandle handle,
+ GetValueFunc<Interop.MediaInfoHandle, TValue> func)
+ {
+ func(handle, out var val).ThrowIfError("Failed to get value");
+
+ return val;
+ }
+
+ internal static DateTimeOffset GetDateTime<T>(T handle,
+ GetValueFunc<T, IntPtr> func)
+ {
+ IntPtr time = IntPtr.Zero;
+
+ func(handle, out time).ThrowIfError("Failed to get value");
+
+ return DateTimeOffset.FromUnixTimeSeconds(time.ToInt64());
+ }
+ }
+}
+++ /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.Content.MediaContent
-{
- /// <summary>
- /// A MediaBookmark allows you to mark interesting moment in a media(video and audio) to enable fast searching.
- /// The MediaBookmark Information API provides functions to get information about bookmarks associated with video and audio items.
- /// </summary>
- public class MediaBookmark : IDisposable
- {
- private IntPtr _bookmarkHandle = IntPtr.Zero;
- private bool _disposedValue = false;
-
- private IntPtr Handle
- {
- get
- {
- if (_bookmarkHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(MediaBookmark));
- }
-
- return _bookmarkHandle;
- }
- }
- internal MediaBookmark(IntPtr handle)
- {
- _bookmarkHandle = handle;
- }
-
- ~MediaBookmark()
- {
- Dispose(false);
- }
- /// <summary>
- /// The media bookmark ID
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Id
- {
- get
- {
- int id;
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.GetBookmarkId(Handle, out id), "Failed to get bookmark id");
-
- return id;
- }
- }
-
- /// <summary>
- /// The thumbnail path of media bookmark
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ThumbnailPath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.GetThumbnailPath(Handle, out val), "Failed to get bookmark thumbnail");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// The bookmark time offset (in milliseconds)
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public uint Offset
- {
- get
- {
- uint offset;
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.GetMarkedTime(Handle, out offset), "Failed to get bookmarked time");
-
- return offset;
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (_bookmarkHandle != IntPtr.Zero)
- {
- Interop.MediaBookmark.Destroy(_bookmarkHandle);
- _bookmarkHandle = IntPtr.Zero;
- }
-
- _disposedValue = true;
- }
- }
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// <see cref="MediaCommand"/> is a base class for command classes.
+ /// </summary>
+ public abstract class MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MediaCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ protected MediaCommand(MediaDatabase database)
+ {
+ Database = database ?? throw new ArgumentNullException(nameof(database));
+
+ if (database.IsDisposed)
+ {
+ throw new ObjectDisposedException(nameof(database));
+ }
+ }
+
+ internal void ValidateDatabase()
+ {
+ Database.ValidateState();
+ }
+
+ /// <summary>
+ /// Gets the <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <value>The <see cref="MediaDatabase"/> which commands execute on.</value>
+ public MediaDatabase Database { get; }
+ }
+
+ /// <summary>
+ /// Provides a means of reading results obtained by executing a query.
+ /// </summary>
+ public interface IMediaDataReader
+ {
+ /// <summary>
+ /// Advances to the next record.
+ /// </summary>
+ /// <returns>true if there are more rows; otherwise false.</returns>
+ bool Read();
+
+ /// <summary>
+ /// Gets the current record.
+ /// </summary>
+ /// <value>The current record object.</value>
+ object Current { get; }
+ }
+
+ /// <summary>
+ /// Provides a means of reading results obtained by executing a query.
+ /// </summary>
+ /// <typeparam name="TRecord"></typeparam>
+ public class MediaDataReader<TRecord> : IMediaDataReader, IDisposable
+ {
+ private readonly IEnumerator<TRecord> _enumerator;
+
+ internal MediaDataReader(IEnumerable<TRecord> items)
+ {
+ _enumerator = items.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Gets the current record.
+ /// </summary>
+ /// <value>The current record if the position is valid; otherwise null.</value>
+ public TRecord Current
+ {
+ get
+ {
+ ValidateNotDisposed();
+ return _enumerator.Current;
+ }
+ }
+
+ /// <summary>
+ /// Advances to the next record.
+ /// </summary>
+ /// <returns>true if there are more rows; otherwise false.</returns>
+ public bool Read()
+ {
+ ValidateNotDisposed();
+ return _enumerator.MoveNext();
+ }
+
+ object IMediaDataReader.Current => Current;
+
+ #region IDisposable Support
+ private bool _disposed = false;
+
+ /// <summary>
+ /// Disposes of the resources (other than memory) used by the MediaDataReader.
+ /// </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)
+ {
+ _disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by the current instance.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ internal void ValidateNotDisposed()
+ {
+ if (_disposed)
+ {
+ throw new ObjectDisposedException(GetType().Name);
+ }
+ }
+ #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.
-*/
-
-
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// Enumeration for ordering
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum ContentOrder
- {
- /// <summary>
- /// Ascending order
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Asc,
- /// <summary>
- /// Descending order
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Desc
- }
-
- /// <summary>
- /// Enumeration for collations.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum ContentCollation
- {
- /// <summary>
- /// Default collation BINARY
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Default,
- /// <summary>
- /// Collation NOCASE, not case sensitive
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Nocase,
- /// <summary>
- /// Collation RTRIM, trailing space characters are ignored
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Rtim,
- /// <summary>
- /// Collation LOCALIZATION, NOCASE also applied
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Localized
- }
-
- /// <summary>
- /// Enumeration for a media group.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum MediaGroupType
- {
- /// <summary>
- /// Media group ID for display name
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- DisplayName,
- /// <summary>
- /// Media group ID for a media type
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Type,
- /// <summary>
- /// Media group ID for a mime type
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- MimeType,
- /// <summary>
- /// Media group ID for content size
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Size,
- /// <summary>
- /// Media group ID for the added time
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- AddedTime,
- /// <summary>
- /// Media group ID for the modified time
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ModifiedTime,
- /// <summary>
- /// Media group ID for a content title
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Title,
- /// <summary>
- /// Media group ID for an artist
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Artist,
- /// <summary>
- /// Media group ID for an album artist
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- AlbumArtist,
- /// <summary>
- /// Media group ID for a genre
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Genre,
- /// <summary>
- /// Media group ID for a composer
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Composer,
- /// <summary>
- /// Media group ID for a year
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Year,
- /// <summary>
- /// Media group ID for the recorded date
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- RecordedDate,
- /// <summary>
- /// Media group ID for the copyright
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Copyright,
- /// <summary>
- /// Media group ID for a track number
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Tracknum,
- /// <summary>
- /// Media group ID for a description
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Description,
- /// <summary>
- /// Media group ID for the longitude
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Longitude,
- /// <summary>
- /// Media group ID for the latitude
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Latitude,
- /// <summary>
- /// Media group ID for the altitude
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Altitude,
- /// <summary>
- /// Media group ID for the burst shot
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- BurstImage,
- /// <summary>
- /// Media group ID for a rating
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Rating,
- /// <summary>
- /// Media group ID for an author
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Author,
- /// <summary>
- /// Media group ID for a provide
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Provider,
- /// <summary>
- /// Media group ID for the content name
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ContentName,
- /// <summary>
- /// Media group ID for a category
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Category,
- /// <summary>
- /// Media group ID for a location tag
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- LocationTag,
- /// <summary>
- /// Media group ID for an age rating
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- AgeRating,
- /// <summary>
- /// Media group ID for a keyword
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Keyword,
- /// <summary>
- /// Media group ID for the weather
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Weather,
- /// <summary>
- /// Invalid media group ID
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Max
- }
-
- /// <summary>
- /// Enum to give the type of storage.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum ContentStorageType : int
- {
- /// <summary>
- /// The device's internal storage
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Internal = 0,
- /// <summary>
- /// The device's external storage like sd card
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- External = 1,
- /// <summary>
- /// The external USB storage
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ExternalUSB = 2
- };
-
- /// <summary>
- /// Enums for media database update type
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum MediaContentDBUpdateType
- {
- /// <summary>
- /// Updating the database with inserts.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Insert,
- /// <summary>
- /// Updating the database with removes.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Delete,
- /// <summary>
- /// Updating the database with updates.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Update
- }
-
- /// <summary>
- /// Enums for the type of item updated in media database
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum MediaContentUpdateItemType
- {
- /// <summary>
- /// The file information is updated.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- File,
- /// <summary>
- /// The folder information and the file information included in the folder are updated.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Directory
- }
-
- /// <summary>
- /// Enums for content collection types
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum ContentCollectionType
- {
- /// <summary>
- ///Content Collection type folder
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Folder,
- /// <summary>
- ///Content Collection type storage
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Storage,
- /// <summary>
- /// Content Collection type album
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Album,
- /// <summary>
- ///Content Collection type playlist
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- PlayList,
- /// <summary>
- ///Content Collection type tag
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Tag,
- /// <summary>
- ///Content Collection type group
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Group
- }
- /// <summary>
- /// Enum to give the type of media information.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum MediaContentType : int
- {
- /// <summary>
- /// The type of an image.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Image = 0,
- /// <summary>
- /// The type of a video.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Video = 1,
- /// <summary>
- /// The type of sound.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Sound = 2,
- /// <summary>
- /// The type of music.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Music = 3,
- /// <summary>
- /// The type of other.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Others = 4
- };
-
- /// <summary>
- /// Enum to give the orientation type of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum MediaContentOrientation : int
- {
- /// <summary>
- /// Not available.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- NotAvailable = 0,
- /// <summary>
- /// Normal.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Normal = 1,
- /// <summary>
- /// Flip horizontal.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- HFlip = 2,
- /// <summary>
- /// Rotate 180 degrees.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Rot180 = 3,
- /// <summary>
- /// Flip vertical.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- VFlip = 4,
- /// <summary>
- /// Transpose.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Transpose = 5,
- /// <summary>
- /// Rotate 90 degrees.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Rot90 = 6,
- /// <summary>
- /// Transverse.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Transverse = 7,
- /// <summary>
- /// Rotate 270 degrees.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- Rot270 = 8
- };
-}
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using System;
+using System.Diagnostics;
using System.IO;
+using System.Linq;
using Tizen.Internals.Errors;
namespace Tizen.Content.MediaContent
{
- /// <summary>
- /// Enumeration for media content's error code
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <remarks><paramref name="NotSupported"/> error occurs when the device does not support the function.</remarks>
- public enum MediaContentError
+ internal enum MediaContentError
{
None = ErrorCode.None,
InvalidParameter = ErrorCode.InvalidParameter,
NotSupported = ErrorCode.NotSupported,
}
- internal class MediaContentValidator
+ internal static class MediaContentErrorExtensions
{
- internal const string LogTag = "Tizen.Content.MediaContent";
+ internal static MediaContentError Ignore(this MediaContentError err, params MediaContentError[] ignores)
+ {
+ if (ignores.Contains(err))
+ {
+ return MediaContentError.None;
+ }
+ return err;
+ }
- internal static void ThrowIfError(MediaContentError err, string msg)
+
+ internal static void ThrowIfError(this MediaContentError err, string msg)
{
+ if (err == MediaContentError.None)
+ {
+ return;
+ }
+
+ throw err.AsException(msg);
+ }
+
+ internal static Exception AsException(this MediaContentError err, string msg)
+ {
+ Debug.Assert(err != MediaContentError.None);
+
switch (err)
{
case MediaContentError.InvalidParameter:
- throw new ArgumentException(msg);
+ return new ArgumentException($"{msg}.");
case MediaContentError.OutOfMemory:
- throw new OutOfMemoryException(msg);
+ return new OutOfMemoryException($"{msg}.");
case MediaContentError.InvalidOperation:
- throw new InvalidOperationException(msg);
+ return new InvalidOperationException($"{msg}.");
case MediaContentError.FileNoSpaceOnDevice:
- throw new IOException(msg);
+ return new IOException($"{msg} : {err}.");
case MediaContentError.PermissionDenied:
- throw new UnauthorizedAccessException(msg);
+ return new UnauthorizedAccessException($"{msg}.");
case MediaContentError.DatabaseFailed:
- throw new InvalidOperationException("[DB Failed]" + msg);
+ return new MediaDatabaseException(MediaDatabaseError.OperationFailed);
case MediaContentError.DatabaseBusy:
- throw new InvalidOperationException("[DB Busy]" + msg);
+ return new MediaDatabaseException(MediaDatabaseError.DatabaseBusy);
case MediaContentError.NetworkFailed:
- throw new InvalidOperationException("[Network Error]" + msg);
+ return new InvalidOperationException($"{msg} : {err}.");
case MediaContentError.UnsupportedContent:
- throw new PlatformNotSupportedException(msg);
- }
- }
+ return new UnsupportedContentException();
- internal static string CheckString(string value)
- {
- return (value != null) ? value : "";
+ default:
+ return new InvalidOperationException($"Unknown Error : {err.ToString()}, {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;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Provides the ability to connect to and manage the database.
+ /// </summary>
+ public class MediaDatabase : IDisposable
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MediaDatabase"/> class.
+ /// </summary>
+ public MediaDatabase()
+ {
+ }
+
+ private object _lock = new object();
+
+ /// <summary>
+ /// Connects to the database.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The database is already connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while connecting.</exception>
+ public void Connect()
+ {
+ ValidateNotDisposed();
+
+ lock (_lock)
+ {
+ if (IsConnected)
+ {
+ throw new InvalidOperationException("The database is already connected.");
+ }
+
+ Interop.Content.Connect().ThrowIfError("Failed to connect");
+
+ IsConnected = true;
+ }
+ }
+
+ /// <summary>
+ /// Disconnects from the media database.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while connecting.</exception>
+ public void Disconnect()
+ {
+ ValidateNotDisposed();
+
+ lock (_lock)
+ {
+ if (!IsConnected)
+ {
+ throw new InvalidOperationException("The database is not connected.");
+ }
+
+ Interop.Content.Disconnect().ThrowIfError("Failed to disconnect");
+
+ IsConnected = false;
+ }
+ }
+
+ private static readonly Interop.Content.MediaContentDBUpdatedCallback _mediaInfoUpdatedCb = (
+ MediaContentError error, int pid, ItemType updateItem, OperationType updateType,
+ MediaType mediaType, string uuid, string filePath, string mimeType, IntPtr _) =>
+ {
+ if (updateItem == ItemType.Directory)
+ {
+ return;
+ }
+
+ _mediaInfoUpdated?.Invoke(
+ null, new MediaInfoUpdatedEventArgs(pid, updateType, mediaType, uuid, filePath, mimeType));
+ };
+
+ private static IntPtr _mediaInfoUpdatedHandle = IntPtr.Zero;
+ private static event EventHandler<MediaInfoUpdatedEventArgs> _mediaInfoUpdated;
+ private static readonly object _mediaInfoUpdatedLock = new object();
+
+ /// <summary>
+ /// Occurs when there is a change for media in the database.
+ /// </summary>
+ public static event EventHandler<MediaInfoUpdatedEventArgs> MediaInfoUpdated
+ {
+ add
+ {
+ lock (_mediaInfoUpdatedLock)
+ {
+ if (_mediaInfoUpdated == null)
+ {
+ Interop.Content.AddDbUpdatedCb(_mediaInfoUpdatedCb, IntPtr.Zero,
+ out _mediaInfoUpdatedHandle).ThrowIfError("Failed to register an event handler");
+ }
+
+ _mediaInfoUpdated += value;
+ }
+ }
+ remove
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ lock (_mediaInfoUpdatedLock)
+ {
+ if (_mediaInfoUpdated == value)
+ {
+ Interop.Content.RemoveDbUpdatedCb(_mediaInfoUpdatedHandle).ThrowIfError("Failed to unregister");
+ }
+
+ _mediaInfoUpdated -= value;
+ }
+ }
+ }
+
+
+ private static readonly Interop.Content.MediaContentDBUpdatedCallback _folderUpdatedCb = (
+ MediaContentError error, int pid, ItemType updateItem, OperationType updateType,
+ MediaType mediaType, string uuid, string filePath, string mimeType, IntPtr _) =>
+ {
+ if (updateItem == ItemType.File)
+ {
+ return;
+ }
+
+ _folderUpdated?.Invoke(null, new FolderUpdatedEventArgs(updateType, uuid, filePath));
+ };
+
+ private static IntPtr _folderUpdatedHandle = IntPtr.Zero;
+ private static event EventHandler<FolderUpdatedEventArgs> _folderUpdated;
+ private static readonly object _folderUpdatedLock = new object();
+
+ /// <summary>
+ /// Occurs when there is a change for folder in the database.
+ /// </summary>
+ public static event EventHandler<FolderUpdatedEventArgs> FolderUpdated
+ {
+ add
+ {
+ lock (_folderUpdatedLock)
+ {
+ if (_folderUpdated == null)
+ {
+ Interop.Content.AddDbUpdatedCb(_folderUpdatedCb, IntPtr.Zero,
+ out _folderUpdatedHandle).ThrowIfError("Failed to register an event handler");
+ }
+
+ _folderUpdated += value;
+ }
+ }
+ remove
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ lock (_folderUpdatedLock)
+ {
+ if (_folderUpdated == value)
+ {
+ Interop.Content.RemoveDbUpdatedCb(_folderUpdatedHandle).ThrowIfError("Failed to unregister");
+ }
+
+ _folderUpdated -= value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Requests to scan a media file.
+ /// </summary>
+ /// <param name="path">The path of the media to be scanned.</param>
+ /// <remarks>
+ /// It requests to scan a media file to the media server.\n
+ /// If the specified file is not registered to the database yet,
+ /// the media file information will be added to the database.\n
+ /// If it is already registered to the database, the media information is refreshed.\n
+ /// If the specified file does not exist,
+ /// the record of the media file will be deleted from the database.\n
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="path"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="path"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="path"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public void ScanFile(string path)
+ {
+ ValidateState();
+
+ ValidationUtil.ValidateNotNullOrEmpty(path, nameof(path));
+
+ Interop.Content.ScanFile(path).Ignore(MediaContentError.InvalidParameter).ThrowIfError("Failed to scan");
+ }
+
+ /// <summary>
+ /// Requests to scan a folder, recursively.
+ /// </summary>
+ /// <remarks>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="folderPath">The path to scan.</param>
+ /// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
+ /// <returns>A task that represents the asynchronous scan operation.</returns>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ public Task ScanFolderAsync(string folderPath)
+ {
+ return ScanFolderAsync(folderPath, true);
+ }
+
+ /// <summary>
+ /// Requests to scan a folder.
+ /// </summary>
+ /// <remarks>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="folderPath">The path to scan.</param>
+ /// <param name="recursive">The value indicating if the folder is to recursively scanned.</param>
+ /// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
+ /// <returns>A task that represents the asynchronous scan operation.</returns>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ public Task ScanFolderAsync(string folderPath, bool recursive)
+ {
+ return ScanFolderAsync(folderPath, recursive, CancellationToken.None);
+ }
+
+ /// <summary>
+ /// Requests to scan a folder, recursively.
+ /// </summary>
+ /// <remarks>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="folderPath">The path to scan.</param>
+ /// <param name="cancellationToken">The token to stop scanning.</param>
+ /// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
+ /// <returns>A task that represents the asynchronous scan operation.</returns>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ public Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken)
+ {
+ return ScanFolderAsync(folderPath, true, cancellationToken);
+ }
+
+ /// <summary>
+ /// Requests to scan a folder, recursively.
+ /// </summary>
+ /// <remarks>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="folderPath">The path to scan.</param>
+ /// <param name="recursive">The value indicating if the folder is to recursively scanned.</param>
+ /// <param name="cancellationToken">The token to stop scanning.</param>
+ /// <remarks>Folders that contains a file named ".scan_ignore" will not be scanned.</remarks>
+ /// <returns>A task that represents the asynchronous scan operation.</returns>
+ /// <exception cref="InvalidOperationException">The database is not connected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="folderPath"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="folderPath"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="folderPath"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ public Task ScanFolderAsync(string folderPath, bool recursive, CancellationToken cancellationToken)
+ {
+ ValidateState();
+
+ ValidationUtil.ValidateNotNullOrEmpty(folderPath, nameof(folderPath));
+
+ return cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
+ ScanFolderAsyncCore(folderPath, recursive, cancellationToken);
+ }
+
+ private async Task ScanFolderAsyncCore(string folderPath, bool recursive, CancellationToken cancellationToken)
+ {
+ var tcs = new TaskCompletionSource<bool>();
+
+ using (var cbKeeper = ObjectKeeper.Get(GetScanCompletedCallback(tcs)))
+ using (RegisterCancellationAction(tcs, folderPath, cancellationToken))
+ {
+
+ Interop.Content.ScanFolder(folderPath, recursive, cbKeeper.Target)
+ .ThrowIfError("Failed to scan");
+
+ await tcs.Task;
+ }
+ }
+
+ private static Interop.Content.MediaScanCompletedCallback GetScanCompletedCallback(TaskCompletionSource<bool> tcs)
+ {
+ return (scanResult, _) =>
+ {
+ if (scanResult == MediaContentError.None)
+ {
+ tcs.TrySetResult(true);
+ }
+ else
+ {
+ tcs.TrySetException(scanResult.AsException("Failed to scan"));
+ }
+ };
+ }
+
+ private static IDisposable RegisterCancellationAction(TaskCompletionSource<bool> tcs,
+ string folderPath, CancellationToken cancellationToken)
+ {
+ if (cancellationToken.CanBeCanceled == false)
+ {
+ return null;
+ }
+
+ return cancellationToken.Register(() =>
+ {
+ if (tcs.Task.IsCompleted)
+ {
+ return;
+ }
+
+ Interop.Content.CancelScanFolder(folderPath).ThrowIfError("Failed to cancel scanning");
+ tcs.TrySetCanceled();
+ });
+ }
+
+ internal bool IsConnected { get; set; }
+
+ internal void ValidateState()
+ {
+ ValidateNotDisposed();
+
+ if (IsConnected == false)
+ {
+ throw new InvalidOperationException("Database is not connected.");
+ }
+ }
+
+ private void ValidateNotDisposed()
+ {
+ if (IsDisposed)
+ {
+ throw new ObjectDisposedException(nameof(MediaDatabase));
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposed = false;
+
+ /// <summary>
+ /// Disposes of the resources (other than memory) used by the MediaDatabase.
+ /// </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 (IsConnected)
+ {
+ var disconnectResult = Interop.Content.Disconnect();
+
+ if (disconnectResult != MediaContentError.None)
+ {
+ Log.Warn(nameof(MediaDatabase), $"Failed to disconnect {disconnectResult.ToString()}.");
+ }
+ }
+
+ _disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ /// <summary>
+ /// Gets the value indicating whether the database has been disposed of.
+ /// </summary>
+ /// <value>true if the database has been disposed of; otherwise, false.</value>
+ public bool IsDisposed => _disposed;
+ #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.Content.MediaContent
+{
+ /// <summary>
+ /// Specifies database errors.
+ /// </summary>
+ public enum MediaDatabaseError
+ {
+ /// <summary>
+ /// Operation failed.
+ /// </summary>
+ OperationFailed,
+
+ /// <summary>
+ /// Operation failed because the database is busy.
+ /// </summary>
+ DatabaseBusy
+ }
+
+ /// <summary>
+ /// The exception that is thrown when an database operation failed.
+ /// </summary>
+ public class MediaDatabaseException : Exception
+ {
+ internal MediaDatabaseException(MediaDatabaseError error) : this(error, error.ToString())
+ {
+ }
+
+ internal MediaDatabaseException(MediaDatabaseError error, string message) : this(error, message, null)
+ {
+ }
+
+ internal MediaDatabaseException(MediaDatabaseError error, string message, Exception innerException) :
+ base(message, innerException)
+ {
+ Error = error;
+ }
+
+ /// <summary>
+ /// Gets the error that causes the exception.
+ /// </summary>
+ /// <value>The <see cref="MediaDatabaseError"/> that causes the exception.</value>
+ public MediaDatabaseError Error { get; }
+ }
+}
+++ /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.Content.MediaContent
-{
- /// <summary>
- /// The Media Face Information API provides functions to manage the face information in the image files.
- /// </summary>
- public class MediaFace : IDisposable
- {
- private IntPtr _faceHandle = IntPtr.Zero;
- private bool _disposedValue = false;
- internal IntPtr Handle
- {
- get
- {
- if (_faceHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(MediaFace));
- }
-
- return _faceHandle;
- }
- }
-
-
- internal MediaFace(IntPtr handle)
- {
- _faceHandle = handle;
- }
-
- /// <summary>
- /// Create Face for Given Image
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="image">
- ///image item through which FaceRect has to be tagged.
- ///</param>
- ///<param name="rect">Position about the detacted face in the media</param>
- internal MediaFace(MediaInformation image, FaceRect rect)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.Create(image.MediaId, out _faceHandle), "Failed to create MediaFace");
-
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.SetFaceRect(Handle, rect.X, rect.Y, rect.Width, rect.Height), "Failed to set Rect to MediaFace");
- }
- catch (Exception)
- {
- Interop.Face.Destroy(_faceHandle);
- throw;
- }
- }
-
- ~MediaFace()
- {
- Dispose(false);
- }
-
- /// <summary>
- /// The Media Face Information API provides functions to manage the face information in the image files.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public FaceRect Rect
- {
- get
- {
- int x;
- int y;
- int width;
- int height;
- MediaContentValidator.ThrowIfError(
- Interop.Face.GetFaceRect(Handle, out x, out y, out width, out height), "Failed to get Rect for the Face");
-
- return new FaceRect(x, y, width, height);
- }
-
- set
- {
- FaceRect rect = (FaceRect)value;
- MediaContentValidator.ThrowIfError(
- Interop.Face.SetFaceRect(Handle, rect.X, rect.Y, rect.Width, rect.Height), "Failed to set Rect for the Face");
- }
- }
-
- /// <summary>
- /// Face id.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Id
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.GetFaceId(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Media uuid from the face
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MediaInformationId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.GetMediaId(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
- /// <summary>
- /// Tag name for the MediaFace.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Tag
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.GetTag(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.SetTag(Handle, value), "Failed to set value");
- }
- }
-
- /// <summary>
- /// Orientation Value for the face
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentOrientation Orientation
- {
- get
- {
- int orientation;
- MediaContentValidator.ThrowIfError(
- Interop.Face.GetOrientation(Handle, out orientation), "Failed to value");
-
- return (MediaContentOrientation)orientation;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Face.SetOrientation(Handle, (int)value), "Failed to set value");
- }
- }
-
- /// <summary>
- /// Dispose API for closing the internal resources.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (_faceHandle != IntPtr.Zero)
- {
- Interop.Face.Destroy(_faceHandle);
- _faceHandle = IntPtr.Zero;
- }
-
- _disposedValue = true;
- }
- }
- }
-}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// A Folder is used to organize media content files i.e. image, audio, video files, in the physical storage of the device.
- /// The Media Folder API provides functions to get basic information about existing folders e.g. folder name, path and storage type.
- /// It also provides functions to get information related to media items present in the folder.
- /// </summary>
- public class MediaFolder : ContentCollection
- {
- private IntPtr _folderHandle = IntPtr.Zero;
- private bool _disposedValue = false;
- internal IntPtr Handle
- {
- get
- {
- if (_folderHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(MediaFolder));
- }
-
- return _folderHandle;
- }
- }
- /// <summary>
- /// The ID of the media folder. For each MediaFolder this id is unique.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Id
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetFolderId(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// ParentId of the MediaFolder that is the ID of the upper media folder (parent folder).
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ParentId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetParentFolderId(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// The path of the media folder
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string FolderPath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetPath(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// The name of the media folder
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetName(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.SetName(Handle, value), "Failed to set value");
- }
- }
-
- /// <summary>
- /// The storage type of the media folder.
- /// Storage types give information about the location of storage like Internal memory, USB or External Storage etc...
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentStorageType StorageType
- {
- get
- {
- ContentStorageType type;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetStorageType(Handle, out type), "Failed to get value");
-
- return type;
- }
- }
-
- /// <summary>
- /// The storage id of the media folder
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string StorageId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetStorageId(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// The modified date of the media folder
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public DateTime ModifiedTime
- {
- get
- {
- DateTime date;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetModifiedTime(Handle, out date), "Failed to get value");
-
- return date;
- }
- }
-
- /// <summary>
- /// The folder order value. Get/Set the folder viewing order.
- /// Default Order value is zero.
- /// If you set the order value for each folder, you can sort in ascending or descending order as the set order values using the filter.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Order
- {
- get
- {
- int order;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetOrder(Handle, out order), "Failed to get value");
-
- return order;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Folder.SetOrder(Handle, value), "Failed to set value");
- }
- }
-
- internal MediaFolder(IntPtr handle)
- {
- _folderHandle = handle;
- }
-
- /// <summary>
- /// Gets the count of media files for the passed filter in the given folder from the media database.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from teh media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
- {
- int mediaCount;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Folder.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count");
-
- return mediaCount;
- }
-
- ~MediaFolder()
- {
- Dispose(false);
- }
-
- public override void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (_folderHandle != IntPtr.Zero)
- {
- Interop.Folder.Destroy(_folderHandle);
- _folderHandle = IntPtr.Zero;
- }
-
- _disposedValue = true;
- }
- }
-
- /// <summary>
- /// Iterates through the media files with an filter in the given folder from the media database.
- /// This function gets all media files associated with the given folder and meeting desired filter option.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- List<MediaInformation> mediaContents = new List<MediaInformation>();
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
-
- Interop.Folder.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Folder.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information");
-
- return mediaContents;
- }
- }
-}
--- /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.Content.MediaContent
+{
+
+ /// <summary>
+ /// Represents the information related to the media stored.
+ /// </summary>
+ /// <seealso cref="MediaInfoCommand"/>
+ /// <seealso cref="MediaInfoUpdateValues"/>
+ public class MediaInfo
+ {
+ internal MediaInfo(Interop.MediaInfoHandle handle)
+ {
+ Id = InteropHelper.GetString(handle, Interop.MediaInfo.GetMediaId);
+
+ Path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath);
+ DisplayName = InteropHelper.GetString(handle, Interop.MediaInfo.GetDisplayName);
+
+ MediaType = InteropHelper.GetValue<MediaType>(handle, Interop.MediaInfo.GetMediaType);
+
+ MimeType = InteropHelper.GetString(handle, Interop.MediaInfo.GetMimeType);
+
+ FileSize = InteropHelper.GetValue<long>(handle, Interop.MediaInfo.GetSize);
+
+ DateAdded = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetAddedTime);
+ DateModified = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetModifiedTime);
+ Timeline = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetTimeline);
+
+ ThumbnailPath = InteropHelper.GetString(handle, Interop.MediaInfo.GetThumbnailPath);
+ Description = InteropHelper.GetString(handle, Interop.MediaInfo.GetDescription);
+
+ Longitude = InteropHelper.GetValue<double>(handle, Interop.MediaInfo.GetLongitude);
+ Latitude = InteropHelper.GetValue<double>(handle, Interop.MediaInfo.GetLatitude);
+ Altitude = InteropHelper.GetValue<double>(handle, Interop.MediaInfo.GetAltitude);
+
+ Weather = InteropHelper.GetString(handle, Interop.MediaInfo.GetWeather);
+ Rating = InteropHelper.GetValue<int>(handle, Interop.MediaInfo.GetRating);
+ IsFavorite = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.GetFavorite);
+ Provider = InteropHelper.GetString(handle, Interop.MediaInfo.GetProvider);
+ Title = InteropHelper.GetString(handle, Interop.MediaInfo.GetTitle);
+ Category = InteropHelper.GetString(handle, Interop.MediaInfo.GetCategory);
+ LocationTag = InteropHelper.GetString(handle, Interop.MediaInfo.GetLocationTag);
+ AgeRating = InteropHelper.GetString(handle, Interop.MediaInfo.GetAgeRating);
+ StorageId = InteropHelper.GetString(handle, Interop.MediaInfo.GetStorageId);
+ IsDrm = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.IsDrm);
+
+ StorageType = InteropHelper.GetValue<StorageType>(handle, Interop.MediaInfo.GetStorageType);
+ }
+
+ /// <summary>
+ /// Gets the id of media.
+ /// </summary>
+ /// <value>The unique id of media.</value>
+ public string Id { get; }
+
+ /// <summary>
+ /// Gets the path to media.
+ /// </summary>
+ /// <value>The full path of the media file.</value>
+ public string Path { get; }
+
+ /// <summary>
+ /// Gets the name of media.
+ /// </summary>
+ /// <value>The base name of the media file.</value>
+ public string DisplayName { get; }
+
+ /// <summary>
+ /// Gets the <see cref="MediaType"/> of media.
+ /// </summary>
+ /// <value>The <see cref="MediaType"/> of media.</value>
+ public MediaType MediaType { get; }
+
+ /// <summary>
+ /// Gets the mime type from media.
+ /// </summary>
+ /// <value>The mime type of media.</value>
+ public string MimeType { get; }
+
+ /// <summary>
+ /// Gets the file size of media in bytes.
+ /// </summary>
+ /// <value>The file size of media in bytes.</value>
+ public long FileSize { get; }
+
+ /// <summary>
+ /// Gets the date of addition of media.
+ /// </summary>
+ /// <value>The date of addition of media.</value>
+ public DateTimeOffset DateAdded { get; }
+
+ /// <summary>
+ /// Gets the date of modification of media.
+ /// </summary>
+ /// <value>The date of modification of media.</value>
+ public DateTimeOffset DateModified { get; }
+
+ /// <summary>
+ /// Gets the timeline of media.
+ /// </summary>
+ /// <value>
+ /// The creation date if the file has the creation information (like recorded date or Image creation date),
+ /// otherwise the modified date.
+ /// </value>
+ public DateTimeOffset Timeline { get; }
+
+ /// <summary>
+ /// Gets the thumbnail of media.
+ /// </summary>
+ /// <value>The thumbnail path of media.</value>
+ public string ThumbnailPath { get; }
+
+ /// <summary>
+ /// Gets the description of media.
+ /// </summary>
+ /// <value>The description from the metadata.</value>
+ public string Description { get; }
+
+ /// <summary>
+ /// Gets the longitude of media.
+ /// </summary>
+ /// <value>The longitude.</value>
+ public double Longitude { get; }
+
+ /// <summary>
+ /// Gets the latitude of media.
+ /// </summary>
+ /// <value>The latitude.</value>
+ public double Latitude { get; }
+
+ /// <summary>
+ /// Gets the altitude of media.
+ /// </summary>
+ /// <value>The altitude.</value>
+ public double Altitude { get; }
+
+ /// <summary>
+ /// Gets the weather information of media.
+ /// </summary>
+ /// <value>The weather information which a user sets.</value>
+ public string Weather { get; }
+
+ /// <summary>
+ /// Gets the rating of media.
+ /// </summary>
+ /// <value>The rating from the metadata.</value>
+ public int Rating { get; }
+
+ /// <summary>
+ /// Gets the favorite status of media.
+ /// </summary>
+ /// <value>true if media is set as favorite, otherwise false.</value>
+ public bool IsFavorite { get; }
+
+ /// <summary>
+ /// Gets the provider of media.
+ /// </summary>
+ /// <value>The provider which a user sets.</value>
+ public string Provider { get; }
+
+ /// <summary>
+ /// Gets the title of media.
+ /// </summary>
+ /// <value>The title of media.</value>
+ public string Title { get; }
+
+ /// <summary>
+ /// Gets the category of media.
+ /// </summary>
+ /// <value>The category which a user sets.</value>
+ public string Category { get; }
+
+ /// <summary>
+ /// Gets the location tag of media.
+ /// </summary>
+ /// <value>The location tag which a user sets.</value>
+ public string LocationTag { get; }
+
+ /// <summary>
+ /// Gets the age rating of media.
+ /// </summary>
+ /// <value>The age rating which a user sets.</value>
+ public string AgeRating { get; }
+
+ /// <summary>
+ /// Gets the storage id of the storage that the media is stored on.
+ /// </summary>
+ /// <value>The storage id of the storage that the media is stored on.</value>
+ public string StorageId { get; }
+
+ /// <summary>
+ /// Gets the value indicating whether the media is DRM-protected.
+ /// </summary>
+ /// <value>A bool value indicating whether the media is DRM-protected.</value>
+ public bool IsDrm { get; }
+
+ /// <summary>
+ /// Gets the storage type of the storage that the media is stored on.
+ /// </summary>
+ /// <value>The storage type of the storage that the media is stored on.</value>
+ public StorageType StorageType { get; }
+
+ /// <summary>
+ /// Returns a string representation of the media info.
+ /// </summary>
+ /// <returns>A string representation of the current media info.</returns>
+ public override string ToString() => $"Id={Id}, Path={Path}, MediaType={MediaType}";
+
+ internal static MediaInfo FromHandle(Interop.MediaInfoHandle handle)
+ {
+ if (handle == null || handle.IsInvalid)
+ {
+ return null;
+ }
+
+ var type = InteropHelper.GetValue<MediaType>(handle, Interop.MediaInfo.GetMediaType);
+
+ switch (type)
+ {
+ case MediaType.Image:
+ return new ImageInfo(handle);
+
+ case MediaType.Music:
+ case MediaType.Sound:
+ return new AudioInfo(handle);
+
+ case MediaType.Video:
+ return new VideoInfo(handle);
+ }
+
+ return new MediaInfo(handle);
+ }
+
+ internal static MediaInfo FromHandle(IntPtr handle)
+ {
+ var safeHandle = new Interop.MediaInfoHandle(handle);
+ try
+ {
+ return FromHandle(safeHandle);
+ }
+ finally
+ {
+ safeHandle.SetHandleAsInvalid();
+ }
+ }
+ }
+}
--- /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.
+ */
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Specifies group keys for <see cref="MediaInfo"/>.
+ /// </summary>
+ public enum MediaInfoColumnKey
+ {
+ /// <summary>
+ /// Display name.
+ /// </summary>
+ DisplayName,
+ /// <summary>
+ /// Media type.
+ /// </summary>
+ Type,
+ /// <summary>
+ /// Mime type.
+ /// </summary>
+ MimeType,
+ /// <summary>
+ /// File size.
+ /// </summary>
+ Size,
+ /// <summary>
+ /// Date added.
+ /// </summary>
+ DateAdded,
+ /// <summary>
+ /// Date modified.
+ /// </summary>
+ DateModified,
+ /// <summary>
+ /// Content title.
+ /// </summary>
+ Title,
+ /// <summary>
+ /// Artist.
+ /// </summary>
+ Artist,
+ /// <summary>
+ /// Album artist.
+ /// </summary>
+ AlbumArtist,
+ /// <summary>
+ /// Genre.
+ /// </summary>
+ Genre,
+ /// <summary>
+ /// Composer.
+ /// </summary>
+ Composer = 10,
+ /// <summary>
+ /// Year.
+ /// </summary>
+ Year,
+ /// <summary>
+ /// Date recorded.
+ /// </summary>
+ DateRecorded,
+ /// <summary>
+ /// Copyright.
+ /// </summary>
+ Copyright,
+ /// <summary>
+ /// Track number.
+ /// </summary>
+ TrackNumber,
+ /// <summary>
+ /// Description.
+ /// </summary>
+ Description,
+ /// <summary>
+ /// Longitude.
+ /// </summary>
+ Longitude,
+ /// <summary>
+ /// Latitude.
+ /// </summary>
+ Latitude,
+ /// <summary>
+ /// Altitude.
+ /// </summary>
+ Altitude,
+ /// <summary>
+ /// Burst shot.
+ /// </summary>
+ BurstImage,
+ /// <summary>
+ /// Rating.
+ /// </summary>
+ Rating = 20,
+
+ /// <summary>
+ /// Provider.
+ /// </summary>
+ Provider = 22,
+
+ /// <summary>
+ /// Category.
+ /// </summary>
+ Category = 24,
+ /// <summary>
+ /// Location tag.
+ /// </summary>
+ LocationTag,
+ /// <summary>
+ /// Age rating.
+ /// </summary>
+ AgeRating,
+ /// <summary>
+ /// Weather.
+ /// </summary>
+ Weather = 28
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage media info and query related items in the database.
+ /// </summary>
+ public class MediaInfoCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FolderCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public MediaInfoCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of the bookmarks added to the media.
+ /// </summary>
+ /// <param name="mediaId">The media id to count bookmarks added to the media.</param>
+ /// <returns>The number of bookmarks.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountBookmark(string mediaId)
+ {
+ return CountBookmark(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of the bookmarks added to the media with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="mediaId">The media id to count bookmarks added to the media.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of bookmarks.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountBookmark(string mediaId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.Count(Interop.MediaInfo.GetBookmarkCount, mediaId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the bookmarks added to the media.
+ /// </summary>
+ /// <param name="mediaId">The media id to select bookmarks added to the media.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<Bookmark> SelectBookmark(string mediaId)
+ {
+ return SelectBookmark(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the bookmarks added to the media with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="mediaId">The media id to select bookmarks added to the media.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<Bookmark> SelectBookmark(string mediaId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.SelectMembers(mediaId, filter, Interop.MediaInfo.ForeachBookmarks,
+ Bookmark.FromHandle);
+ }
+
+
+ /// <summary>
+ /// Retrieves the number of the face info added to or detected from the media.
+ /// </summary>
+ /// <param name="mediaId">The media id to count face info added to the media.</param>
+ /// <returns>The number of face info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountFaceInfo(string mediaId)
+ {
+ return CountFaceInfo(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of the face info added to or detected from the media with filter.
+ /// </summary>
+ /// <param name="mediaId">The media id to count face info added to the media.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of face info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountFaceInfo(string mediaId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.Count(Interop.MediaInfo.GetFaceCount, mediaId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the face info added to or detected from the media.
+ /// </summary>
+ /// <param name="mediaId">The media id to select face info added to the media.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<FaceInfo> SelectFaceInfo(string mediaId)
+ {
+ return SelectFaceInfo(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the face info added to or detected from the media with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="mediaId">The media id to select face info added to the media.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<FaceInfo> SelectFaceInfo(string mediaId, SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.SelectMembers(mediaId, arguments, Interop.MediaInfo.ForeachFaces,
+ FaceInfo.FromHandle);
+ }
+
+ /// <summary>
+ /// Retrieves the number of tags that the media has.
+ /// </summary>
+ /// <returns>The number of tags.</returns>
+ /// <param name="mediaId">The media id to count tags added to the media.</param>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountTag(string mediaId)
+ {
+ return CountTag(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of tags that the media has with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="mediaId">The media id to count tags added to the media.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of tags.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int CountTag(string mediaId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.Count(Interop.MediaInfo.GetTagCount, mediaId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the tags that the media has.
+ /// </summary>
+ /// <param name="mediaId">The media id to select tags added to the media.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<Tag> SelectTag(string mediaId)
+ {
+ return SelectTag(mediaId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the tags that the media has with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="mediaId">The media id to select tags added to the media.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<Tag> SelectTag(string mediaId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return CommandHelper.SelectMembers(mediaId, filter, Interop.MediaInfo.ForeachTags,
+ Tag.FromHandle);
+ }
+
+
+ /// <summary>
+ /// Retrieves the number of the media info.
+ /// </summary>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int CountMedia()
+ {
+ return CountMedia(null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of the media info with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int CountMedia(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.MediaInfo.GetMediaCount, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the media.
+ /// </summary>
+ /// <param name="mediaId">The media id to retrieve.</param>
+ /// <returns>The <see cref="MediaInfo"/> instance if the matched record was found in the database, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public MediaInfo SelectMedia(string mediaId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ Interop.MediaInfo.GetMediaFromDB(mediaId, out var handle).Ignore(MediaContentError.InvalidParameter).
+ ThrowIfError("Failed to query");
+
+ try
+ {
+ return MediaInfo.FromHandle(handle);
+ }
+ finally
+ {
+ handle.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of values grouped by the specified column with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="columnKey">The column key.</param>
+ /// <returns>The number of groups.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentException"><paramref name="columnKey"/> is invalid.</exception>
+ public int CountGroupBy(MediaInfoColumnKey columnKey)
+ {
+ return CountGroupBy(columnKey, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of values grouped by the specified column with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="columnKey">The column key.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of groups.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentException"><paramref name="columnKey"/> is invalid.</exception>
+ public int CountGroupBy(MediaInfoColumnKey columnKey, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateEnum(typeof(MediaInfoColumnKey), columnKey, nameof(columnKey));
+
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ Interop.Group.GetGroupCount(filter, columnKey, out var count).ThrowIfError("Failed to query count");
+ return count;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the group values of the specified column.
+ /// </summary>
+ /// <param name="columnKey">The column key.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentException"><paramref name="columnKey"/> is invalid.</exception>
+ public MediaDataReader<string> SelectGroupBy(MediaInfoColumnKey columnKey)
+ {
+ return SelectGroupBy(columnKey, null);
+ }
+
+ /// <summary>
+ /// Retrieves the group values of the specified column. with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="columnKey">The column key.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentException"><paramref name="columnKey"/> is invalid.</exception>
+ public MediaDataReader<string> SelectGroupBy(MediaInfoColumnKey columnKey, SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateEnum(typeof(MediaInfoColumnKey), columnKey, nameof(columnKey));
+
+ List<string> list = new List<string>();
+
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ Interop.Group.ForeachGroup(filter, columnKey, (name, _) =>
+ {
+ list.Add(name);
+
+ return true;
+ }).ThrowIfError("Failed to query");
+
+ return new MediaDataReader<string>(list);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves all the media.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia()
+ {
+ return SelectMedia(arguments: null);
+ }
+
+ /// <summary>
+ /// Retrieves the media with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ return new MediaDataReader<MediaInfo>(QueryMedia(arguments));
+ }
+
+ private static List<MediaInfo> QueryMedia(SelectArguments arguments)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ List<MediaInfo> list = new List<MediaInfo>();
+
+ Exception caught = null;
+
+ Interop.MediaInfo.ForeachMedia(filter, (handle, _) =>
+ {
+ try
+ {
+ list.Add(MediaInfo.FromHandle(handle));
+ return true;
+ }
+ catch (Exception e)
+ {
+ caught = e;
+ return false;
+ }
+ });
+
+ if (caught != null)
+ {
+ throw caught;
+ }
+
+ return list;
+ }
+ }
+
+ /// <summary>
+ /// Deletes a media from the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to delete.</param>
+ /// <returns>true if the matched record was found and deleted, otherwise false.</returns>
+ /// <remarks><see cref="MediaDatabase.ScanFile(string)"/> or <see cref="MediaDatabase.ScanFolderAsync(string)"/> can be used instead.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Delete(string mediaId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ if (CommandHelper.Count(
+ Interop.MediaInfo.GetMediaCount, $"{MediaInfoColumns.Id}='{mediaId}'") == 0)
+ {
+ return false;
+ }
+
+ CommandHelper.Delete(Interop.MediaInfo.Delete, mediaId);
+ return true;
+ }
+
+ /// <summary>
+ /// Adds media to the database.
+ /// </summary>
+ /// <param name="path">The file path to add.</param>
+ /// <returns>The <see cref="MediaInfo"/> instance that contains the record information in the database.</returns>
+ /// <remarks>
+ /// If the media already exists in the database, it returns existing information.\n
+ /// \n
+ /// <see cref="MediaDatabase.ScanFile(string)"/> or <see cref="MediaDatabase.ScanFolderAsync(string)"/> can be used instead.\n
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="path"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="path"/> contains a hidden path that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="path"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public MediaInfo Add(string path)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(path, nameof(path));
+
+ if (File.Exists(path) == false)
+ {
+ throw new FileNotFoundException("destination is not valid path.", path);
+ }
+
+ if (File.GetAttributes(path).HasFlag(FileAttributes.Hidden))
+ {
+ throw new ArgumentException($"{nameof(path)} contains a hidden path.", nameof(path));
+ }
+
+ Interop.MediaInfoHandle handle = null;
+
+ try
+ {
+ Interop.MediaInfo.Insert(path, out handle).ThrowIfError("Failed to insert");
+
+ return MediaInfo.FromHandle(handle);
+ }
+ finally
+ {
+ if (handle != null)
+ {
+ handle.Dispose();
+ }
+ }
+ }
+
+ private static void ValidatePaths(IEnumerable<string> paths)
+ {
+ if (paths == null)
+ {
+ throw new ArgumentNullException(nameof(paths));
+ }
+
+ if (paths.Count() > 300)
+ {
+ throw new ArgumentException("Too many paths to add.");
+ }
+
+ foreach (var path in paths)
+ {
+ if (path == null)
+ {
+ throw new ArgumentException($"{nameof(paths)} contains null.", nameof(paths));
+ }
+
+ if (File.Exists(path) == false)
+ {
+ throw new FileNotFoundException($"{nameof(paths)} contains a path that does not exist. Path={path}.", path);
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Adds media files into the media database.
+ /// </summary>
+ /// <remarks>
+ /// The paths that already exist in the database will be ignored.\n
+ /// At most 300 items can be added at once.\n
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="paths">The paths of the media files to add.</param>
+ /// <returns>A task that represents the asynchronous add operation.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="paths"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="paths"/> contains null.\n
+ /// -or-\n
+ /// <paramref name="paths"/> contains invalid path.\n
+ /// -or-\n
+ /// The number of <paramref name="paths"/> is 300 or more items.
+ /// </exception>
+ /// <exception cref="FileNotFoundException"><paramref name="paths"/> contains a path that does not exist.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public async Task AddAsync(IEnumerable<string> paths)
+ {
+ ValidateDatabase();
+
+ ValidatePaths(paths);
+
+ var pathArray = paths.ToArray();
+ var tcs = new TaskCompletionSource<bool>();
+
+ Interop.MediaInfo.InsertCompletedCallback callback = (error, _) =>
+ {
+ if (error == MediaContentError.None)
+ {
+ tcs.TrySetResult(true);
+ }
+ else
+ {
+ tcs.TrySetException(error.AsException("Failed to add"));
+ }
+ };
+
+ using (ObjectKeeper.Get(callback))
+ {
+ Interop.MediaInfo.BatchInsert(pathArray, pathArray.Length, callback).ThrowIfError("Failed to add");
+
+ await tcs.Task;
+ }
+ }
+
+ /// <summary>
+ /// Adds burst shot images into the media database.
+ /// </summary>
+ /// <param name="paths">The paths of the burst shot images to add.</param>
+ /// <returns>A task that represents the asynchronous add operation.</returns>
+ /// <remarks>
+ /// The paths that already exist in the database.\n
+ /// At most 300 items can be added at once.
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="paths"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="paths"/> contains null.\n
+ /// -or-\n
+ /// <paramref name="paths"/> contains invalid path.\n
+ /// -or-\n
+ /// The number of <paramref name="paths"/> is 300 or more items.
+ /// </exception>
+ /// <exception cref="FileNotFoundException"><paramref name="paths"/> contains a path that does not exist.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public async Task AddBurstShotImagesAsync(IEnumerable<string> paths)
+ {
+ ValidateDatabase();
+
+ ValidatePaths(paths);
+
+ var tcs = new TaskCompletionSource<bool>();
+ string[] pathArray = paths.ToArray();
+
+ Interop.MediaInfo.InsertBurstShotCompletedCallback callback = (error, _) =>
+ {
+ if (error == MediaContentError.None)
+ {
+ tcs.TrySetResult(true);
+ }
+ else
+ {
+ tcs.TrySetException(error.AsException("Failed to add burst shot images"));
+ }
+ };
+
+ using (ObjectKeeper.Get(callback))
+ {
+ Interop.MediaInfo.BurstShotInsert(pathArray, pathArray.Length, callback).
+ ThrowIfError("Failed to add burst shots to db");
+
+ await tcs.Task;
+ }
+ }
+
+ private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, T value,
+ Func<Interop.MediaInfoHandle, T, MediaContentError> func)
+ {
+ if (value != null)
+ {
+ func(handle, value).ThrowIfError("Failed to update");
+ }
+ }
+
+
+ private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, Nullable<T> value,
+ Func<Interop.MediaInfoHandle, T, MediaContentError> func) where T : struct
+ {
+ if (value.HasValue)
+ {
+ func(handle, value.Value).ThrowIfError("Failed to update");
+ }
+ }
+
+ /// <summary>
+ /// Updates a media with the specified values.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to update.</param>
+ /// <param name="values">The values for update.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>Only values set in <see cref="MediaInfoUpdateValues"/> are updated.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="mediaId"/> is null.\n
+ /// -or-\n
+ /// <paramref name="values"/> is null.
+ /// </exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Update(string mediaId, MediaInfoUpdateValues values)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ if (values == null)
+ {
+ throw new ArgumentNullException(nameof(values));
+ }
+
+ if (CommandHelper.Count(
+ Interop.MediaInfo.GetMediaCount, $"{MediaInfoColumns.Id}='{mediaId}'") == 0)
+ {
+ return false;
+ }
+
+ Interop.MediaInfo.GetMediaFromDB(mediaId, out var handle).ThrowIfError("Failed to update");
+
+ if (handle.IsInvalid)
+ {
+ return false;
+ }
+
+ try
+ {
+ SetUpdateValue(handle, values.Weather, Interop.MediaInfo.SetWeather);
+ SetUpdateValue(handle, values.IsFavorite, Interop.MediaInfo.SetFavorite);
+ SetUpdateValue(handle, values.Provider, Interop.MediaInfo.SetProvider);
+ SetUpdateValue(handle, values.Category, Interop.MediaInfo.SetCategory);
+ SetUpdateValue(handle, values.LocationTag, Interop.MediaInfo.SetLocationTag);
+ SetUpdateValue(handle, values.AgeRating, Interop.MediaInfo.SetAgeRating);
+
+ Interop.MediaInfo.UpdateToDB(handle).ThrowIfError("Failed to update");
+ return true;
+ }
+ finally
+ {
+ handle.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Updates the path of the media to the specified destination path in the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="mediaId">The media id to move.</param>
+ /// <param name="newPath">The path that the media has been moved to.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>
+ /// Usually, it is used after the media file is moved to another path.\n
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="mediaId"/> is null.\n
+ /// -or-\n
+ /// <paramref name="newPath"/> is null.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="newPath"/> is a zero-length string, contains only white space.\n
+ /// -or-\n
+ /// <paramref name="newPath"/> contains a hidden directory that starts with '.'.\n
+ /// -or-\n
+ /// <paramref name="newPath"/> contains a directory containing the ".scan_ignore" file.
+ /// </exception>
+ /// <exception cref="FileNotFoundException"><paramref name="newPath"/> does not exists.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Move(string mediaId, string newPath)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ ValidationUtil.ValidateNotNullOrEmpty(newPath, nameof(newPath));
+
+ if (File.Exists(newPath) == false)
+ {
+ throw new FileNotFoundException("destination is not valid path.", newPath);
+ }
+
+ if (File.GetAttributes(newPath).HasFlag(FileAttributes.Hidden))
+ {
+ throw new ArgumentException($"{nameof(newPath)} contains a hidden path.", nameof(newPath));
+ }
+
+ //TODO can be improved if MoveToDB supports result value.
+ Interop.MediaInfo.GetMediaFromDB(mediaId, out var handle).
+ Ignore(MediaContentError.InvalidParameter).ThrowIfError("Failed to move");
+
+ if (handle.IsInvalid)
+ {
+ return false;
+ }
+
+ try
+ {
+ Interop.MediaInfo.MoveToDB(handle, newPath).ThrowIfError("Failed to move");
+ }
+ finally
+ {
+ handle.Dispose();
+ }
+
+ return true;
+ }
+
+ #region CreateThumbnailAsync
+ /// <summary>
+ /// Creates a thumbnail image for the given media.
+ /// If a thumbnail already exists for the given media, the existing path will be returned.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to create thumbnail.</param>
+ /// <returns>A task that represents the asynchronous operation. The task result contains the thumbnail path.</returns>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="MediaDatabase"/> is disconnected.\n
+ /// -or-\n
+ /// An internal error occurred while executing.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="RecordNotFoundException"><paramref name="mediaId"/> does not exist in the database.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.
+ /// </exception>
+ /// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
+ /// <exception cref="UnsupportedContentException">
+ /// Thumbnail is not available for the given media.\n
+ /// -or-\n
+ /// The media is in external usb storage(<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// </exception>
+ public Task<string> CreateThumbnailAsync(string mediaId)
+ {
+ return CreateThumbnailAsync(mediaId, CancellationToken.None);
+ }
+
+ /// <summary>
+ /// Creates a thumbnail image for the given media.
+ /// If a thumbnail already exists for the given media, the existing path will be returned.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media id to create thumbnail.</param>
+ /// <param name="cancellationToken">The token to cancel the operation.</param>
+ /// <returns>A task that represents the asynchronous operation. The task result contains the thumbnail path.</returns>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="MediaDatabase"/> is disconnected.\n
+ /// -or-\n
+ /// An internal error occurred while executing.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="RecordNotFoundException"><paramref name="mediaId"/> does not exist in the database.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.
+ /// </exception>
+ /// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
+ /// <exception cref="UnsupportedContentException">
+ /// Thumbnail is not available for the given media.\n
+ /// -or-\n
+ /// The media is in external usb storage(<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// </exception>
+ public Task<string> CreateThumbnailAsync(string mediaId, CancellationToken cancellationToken)
+ {
+ ValidateDatabase();
+
+ return cancellationToken.IsCancellationRequested ? Task.FromCanceled<string>(cancellationToken) :
+ CreateThumbnailAsyncCore(mediaId, cancellationToken);
+ }
+
+ private async Task<string> CreateThumbnailAsyncCore(string mediaId, CancellationToken cancellationToken)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ var tcs = new TaskCompletionSource<string>();
+
+ Interop.MediaInfo.GetMediaFromDB(mediaId, out var handle).ThrowIfError("Failed to create thumbnail");
+
+ if (handle.IsInvalid)
+ {
+ throw new RecordNotFoundException("Media does not exist.");
+ }
+
+ using (handle)
+ {
+ if (InteropHelper.GetValue<StorageType>(handle, Interop.MediaInfo.GetStorageType) == StorageType.ExternalUsb)
+ {
+ throw new UnsupportedContentException("The media is in external usb storage.");
+ }
+
+ var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath);
+
+ if (File.Exists(path) == false)
+ {
+ throw new FileNotFoundException($"The media file does not exist. Path={path}.", path);
+ }
+
+ using (RegisterCancelThumbnail(cancellationToken, tcs, handle))
+ using (var cbKeeper = ObjectKeeper.Get(GetCreateThumbnailCallback(tcs)))
+ {
+ Interop.MediaInfo.CreateThumbnail(handle, cbKeeper.Target).ThrowIfError("Failed to create thumbnail");
+
+ return await tcs.Task;
+ }
+ }
+ }
+
+ private static Interop.MediaInfo.ThumbnailCompletedCallback GetCreateThumbnailCallback(
+ TaskCompletionSource<string> tcs)
+ {
+ return (error, path, _) =>
+ {
+ if (error != MediaContentError.None)
+ {
+ tcs.TrySetException(error.AsException("Failed to create thumbnail"));
+ }
+ else
+ {
+ tcs.TrySetResult(path);
+ }
+ };
+ }
+
+ private static IDisposable RegisterCancelThumbnail(CancellationToken cancellationToken,
+ TaskCompletionSource<string> tcs, Interop.MediaInfoHandle handle)
+ {
+ if (cancellationToken.CanBeCanceled == false)
+ {
+ return null;
+ }
+
+ return cancellationToken.Register(() =>
+ {
+ if (tcs.Task.IsCompleted)
+ {
+ return;
+ }
+
+ Interop.MediaInfo.CancelThumbnail(handle).ThrowIfError("Failed to cancel");
+ tcs.TrySetCanceled();
+ });
+ }
+ #endregion
+
+ #region DetectFaceAsync
+ /// <summary>
+ /// Detects faces from the given media.
+ /// If a thumbnail already exists for the given media, the existing path will be returned.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <feature>http://tizen.org/feature/vision.face_recognition</feature>
+ /// <param name="mediaId">The media id to create thumbnail.</param>
+ /// <returns>A task that represents the asynchronous add operation. The task result contains the number of faces detected.</returns>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="MediaDatabase"/> is disconnected.\n
+ /// -or-\n
+ /// An internal error occurred while executing.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="RecordNotFoundException"><paramref name="mediaId"/> does not exist in the database.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.
+ /// </exception>
+ /// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
+ /// <exception cref="UnsupportedContentException">Feace detection is not available for the given media.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Task<int> DetectFaceAsync(string mediaId)
+ {
+ return DetectFaceAsync(mediaId, CancellationToken.None);
+ }
+
+ /// <summary>
+ /// Creates a thumbnail image for the given media.
+ /// If a thumbnail already exists for the given media, the existing path will be returned.
+ /// </summary>
+ /// <remarks>
+ /// Media in external storage is not supported, with the exception of MMC.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <feature>http://tizen.org/feature/vision.face_recognition</feature>
+ /// <param name="mediaId">The media id to create thumbnail.</param>
+ /// <param name="cancellationToken">The token to cancel the operation.</param>
+ /// <returns>A task that represents the asynchronous operation. The task result contains the number of faces detected.</returns>
+ /// <exception cref="InvalidOperationException">
+ /// The <see cref="MediaDatabase"/> is disconnected.\n
+ /// -or-\n
+ /// An internal error occurred while executing.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="RecordNotFoundException"><paramref name="mediaId"/> does not exist in the database.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.
+ /// </exception>
+ /// <exception cref="FileNotFoundException">The file of the media does not exists; moved or deleted.</exception>
+ /// <exception cref="UnsupportedContentException">
+ /// Face detection is not available for the given media.\n
+ /// -or-\n
+ /// The media is in external usb storage(<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// </exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ public Task<int> DetectFaceAsync(string mediaId, CancellationToken cancellationToken)
+ {
+ if (Features.IsSupported(Features.FaceRecognition) == false)
+ {
+ throw new NotSupportedException($"The feature({Features.FaceRecognition}) is not supported.");
+ }
+
+ ValidateDatabase();
+
+ return cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) :
+ DetectFaceAsyncCore(mediaId, cancellationToken);
+ }
+
+ private static async Task<int> DetectFaceAsyncCore(string mediaId, CancellationToken cancellationToken)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ var tcs = new TaskCompletionSource<int>();
+
+ Interop.MediaInfo.GetMediaFromDB(mediaId, out var handle).ThrowIfError("Failed to detect faces");
+
+ if (handle.IsInvalid)
+ {
+ throw new RecordNotFoundException("Media does not exist.");
+ }
+
+ using (handle)
+ {
+ if (InteropHelper.GetValue<StorageType>(handle, Interop.MediaInfo.GetStorageType) == StorageType.ExternalUsb)
+ {
+ throw new UnsupportedContentException("The media is in external usb storage.");
+ }
+
+ if (InteropHelper.GetValue<MediaType>(handle, Interop.MediaInfo.GetMediaType) != MediaType.Image)
+ {
+ throw new UnsupportedContentException("Only image is supported.");
+ }
+
+ var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath);
+
+ if (File.Exists(path) == false)
+ {
+ throw new FileNotFoundException($"The media file does not exist. Path={path}.", path);
+ }
+
+ using (RegisterCancelFaceDetection(cancellationToken, tcs, handle))
+ using (var cbKeeper = ObjectKeeper.Get(GetFaceDetectionCallback(tcs)))
+ {
+ Interop.MediaInfo.StartFaceDetection(handle, cbKeeper.Target).ThrowIfError("Failed to detect faces");
+
+ return await tcs.Task;
+ }
+ }
+ }
+
+ private static Interop.MediaInfo.FaceDetectionCompletedCallback GetFaceDetectionCallback(
+ TaskCompletionSource<int> tcs)
+ {
+ return (error, count, _) =>
+ {
+ if (error != MediaContentError.None)
+ {
+ tcs.TrySetException(error.AsException("Failed to detect faces"));
+ }
+ else
+ {
+ tcs.TrySetResult(count);
+ }
+ };
+ }
+
+ private static IDisposable RegisterCancelFaceDetection(CancellationToken cancellationToken,
+ TaskCompletionSource<int> tcs, Interop.MediaInfoHandle handle)
+ {
+ if (cancellationToken.CanBeCanceled == false)
+ {
+ return null;
+ }
+
+ return cancellationToken.Register(() =>
+ {
+ if (tcs.Task.IsCompleted)
+ {
+ return;
+ }
+
+ Interop.MediaInfo.CancelFaceDetection(handle).ThrowIfError("Failed to cancel");
+ tcs.TrySetCanceled();
+ });
+ }
+ #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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides means to set values used for the update command.
+ /// </summary>
+ /// <remarks>
+ /// The values only set in the object will be affected to the update command.
+ /// </remarks>
+ /// <seealso cref="MediaInfoCommand.Update(string, MediaInfoUpdateValues)"/>
+ public class MediaInfoUpdateValues
+ {
+ /// <summary>
+ /// Gets or sets the weather information for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for weather; the field will not be updated if null.</value>
+ public string Weather { get; set; }
+
+ /// <summary>
+ /// Gets or sets the favorite status for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A value indicating whether the media is favorite; the field will not be updated if null.</value>
+ public bool? IsFavorite { get; set; }
+
+ /// <summary>
+ /// Gets or sets the provider information for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for provider; the field will not be updated if null.</value>
+ public string Provider { get; set; }
+
+ /// <summary>
+ /// Gets or sets the category information for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for category; the field will not be updated if null.</value>
+ public string Category { get; set; }
+
+
+ /// <summary>
+ /// Gets or sets the location tag for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for location tag; the field will not be updated if null.</value>
+ public string LocationTag { get; set; }
+
+ /// <summary>
+ /// Gets or sets the age rating information for update.
+ /// </summary>
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for age rating; the field will not be updated if null.</value>
+ public string AgeRating { get; set; }
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// MediaContent class API gives the information related to the media stored in the device</summary>
- /// <remarks>
- /// The API's provide the functionlity to insert, clone, delete, get the number and content of files from DB.
- /// You can get and set properties and parameters such as storage type, provider, and category of media info,
- /// handling with thumbnail and updating media info to DB.</remarks>
- public class MediaInformation
- {
- private readonly Interop.MediaInformation.SafeMediaInformationHandle _handle;
-
- /// <summary>
- /// Gets the count of media tags for the passed filter in the given mediaId from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// int count</returns>
- /// <param name="filter">The Filter for matching Tags</param>
- public int GetTagCount(ContentFilter filter)
- {
- int count = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetTagCount(MediaId, handle, out count), "Failed to get count");
-
- return count;
- }
-
- /// <summary>
- /// Moves the media info to the given destination path in the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// void </returns>
- /// <param name="destination">The Destination path</param>
- public void Move(string destination)
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.MoveToDB(_handle, destination), "Failed to move");
- }
-
- /// <summary>
- /// Refreshes the media metadata to the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// void </returns>
- public void Refresh()
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.RefreshMetadataToDB(MediaId), "Failed to refresh");
- }
-
- /// <summary>
- /// Creates a thumbnail image for the given media, asynchronously
- /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// Task for creation of Thumbnail </returns>
- public Task<string> CreateThumbnailAsync()
- {
- var task = new TaskCompletionSource<string>();
- Interop.MediaInformation.MediaThumbnailCompletedCallback thumbnailResult = (MediaContentError createResult, string path, IntPtr userData) =>
- {
- if (createResult != MediaContentError.None)
- {
- task.SetException(new InvalidOperationException("Failed to create thumbnail:" + createResult));
- }
-
- task.SetResult(path);
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.CreateThumbnail(_handle, thumbnailResult, IntPtr.Zero), "Failed to create thumbnail");
-
- return task.Task;
- }
-
- /// <summary>
- /// Creates a thumbnail image for the given media, asynchronously
- /// which can be cancelled
- /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="cancellationToken">Token to cancel the requested operation</param>
- /// <returns>
- /// Task for creation of Thumbnail
- /// </returns>
- public Task<string> CreateThumbnailAsync(CancellationToken cancellationToken)
- {
- var task = new TaskCompletionSource<string>();
- cancellationToken.Register(() =>
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.CancelThumbnail(_handle), "Failed to cancel");
-
- task.SetCanceled();
- });
-
- Interop.MediaInformation.MediaThumbnailCompletedCallback thumbnailResult = (MediaContentError createResult, string path, IntPtr userData) =>
- {
- if (createResult != MediaContentError.None)
- {
- task.SetException(new InvalidOperationException("Failed to create thumbnail:" + createResult));
- }
-
- task.SetResult(path);
- };
-
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.CreateThumbnail(_handle, thumbnailResult, IntPtr.Zero), "Failed to create thumbnail");
-
- return task.Task;
- }
-
- /// <summary>
- /// Iterates through the media tag in the given media info from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// Task to get all the Tags </returns>
- /// <param name="filter"> The filter for the Tags</param>
- public IEnumerable<Tag> GetTags(ContentFilter filter)
- {
- Collection<Tag> coll = new Collection<Tag>();
-
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.MediaInformation.MediaTagCallback tagsCallback = (IntPtr tagHandle, IntPtr userData) =>
- {
- IntPtr newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.Tag.Clone(out newHandle, tagHandle), "Failed to clone");
- coll.Add(new Tag(newHandle));
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAllTags(MediaId, handle, tagsCallback, IntPtr.Zero), "Failed to get information");
-
- return coll;
- }
-
- /// <summary>
- /// Gets the ID of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public virtual string MediaId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetMediaId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the path to the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string FilePath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetFilePath(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Name of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string DisplayName
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetDisplayName(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetDisplayName(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Gets the content type of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public MediaContentType MediaType
- {
- get
- {
- MediaContentType contentType = MediaContentType.Others;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetMediaType(_handle, out contentType), "Failed to get value");
-
- return contentType;
- }
- }
-
- /// <summary>
- /// Gets the MIME type from the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MimeType
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetMimeType(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the media file size in bytes.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public long Size
- {
- get
- {
- long size;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetSize(_handle, out size), "Failed to get value");
-
- return size;
- }
- }
-
- /// <summary>
- /// Addition time of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public DateTime AddedAt
- {
- get
- {
- int time;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAddedTime(_handle, out time), "Failed to get value");
-
- DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
-
- return utc.ToLocalTime();
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetAddedTime(_handle, (int)value.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds), "failed to set time");
- }
- }
-
- /// <summary>
- /// Gets the date of modification of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public DateTime ModifiedAt
- {
- get
- {
- int time;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetModifiedTime(_handle, out time), "Failed to get value");
-
- DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
-
- return utc.ToLocalTime();
- }
- }
-
- /// <summary>
- /// Gets the timeline of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public DateTime TimeLine
- {
- get
- {
- int time;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetTimeline(_handle, out time), "Failed to get value");
-
- DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
-
- return utc.ToLocalTime();
- }
- }
-
- /// <summary>
- /// Gets the thumbnail of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ThumbnailPath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetThumbnailPath(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Description of media.
- /// If the media info has no description, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Description
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetDescription(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetDescription(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Longitude of media.
- /// Default Value is 0.0.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public double Longitude
- {
- get
- {
- double longitude = 0.0;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetLongitude(_handle, out longitude), "Failed to get value");
-
- return longitude;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetLongitude(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Latitude of media.
- /// Default Value is 0.0.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public double Latitude
- {
- get
- {
- double latitude = 0.0;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetLatitude(_handle, out latitude), "Failed to get value");
-
- return latitude;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetLatitude(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Altitude of media.
- /// Default Value is 0.0.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public double Altitude
- {
- get
- {
- double altitude = 0.0;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAltitude(_handle, out altitude), "Failed to get value");
-
- return altitude;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetAltitude(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Weather information of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Weather
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetWeather(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetWeather(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Rating of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Rating
- {
- get
- {
- int rating = 0;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetRating(_handle, out rating), "Failed to get value");
- return rating;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetRating(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Favorite status of media.
- /// true if media info is set as favorite, otherwise false if media info is not set as favorite.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool IsFavourite
- {
- get
- {
- bool isFavourtite = false;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetFavorite(_handle, out isFavourtite), "Failed to get value");
-
- return isFavourtite;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetFavorite(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Author of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Author
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAuthor(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetAuthor(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Provider of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Provider
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetProvider(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetProvider(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Content name of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ContentName
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetContentName(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetContentName(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Gets the title of media.
- /// If the media content has no title, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Title
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetTitle(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Category of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Category
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetCategory(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetCategory(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// location tag of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string LocationTag
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetLocationTag(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetLocationTag(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Age Rating of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string AgeRating
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAgeRating(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetAgeRating(_handle, value), "Failed to set value");
- }
- }
-
- /// <summary>
- /// Keyword of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Keyword
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetKeyword(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetKeyword(_handle, value), "failed to set value");
- }
- }
-
- /// <summary>
- /// Gets the storage id of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string StorageId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetStorageId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Checks whether the media is protected via DRM.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool IsDrm
- {
- get
- {
- bool isDRM = false;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.IsDrm(_handle, out isDRM), "Failed to get value");
-
- return isDRM;
- }
- }
-
- /// <summary>
- /// Gets the storage type of media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentStorageType StorageType
- {
- get
- {
- ContentStorageType storageType = ContentStorageType.Internal;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetStorageType(_handle, out storageType), "Failed to get value");
-
- return storageType;
- }
- }
-
- /// <summary>
- /// Number which represents how many times given content has been played.
- /// While Setting the played count, it will only be incremented by 1, the value provided will be ignored.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int PlayedCount
- {
- get
- {
- int playedCount = 0;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetPlayedCount(_handle, out playedCount), "Failed to get value");
-
- return playedCount;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.IncreasePlayedCount(_handle), "failed to set value");
- }
- }
-
- /// <summary>
- /// Content's latest played(opened) time of the media file.
- /// for set the current time is automatically taken from the system, the value provided will be ignored.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public DateTime PlayedAt
- {
- get
- {
- int time;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetPlayedAt(_handle, out time), "Failed to get value");
-
- DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
-
- return utc.ToLocalTime();
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.SetPlayedAt(_handle), "failed to set value");
- }
- }
-
- internal IntPtr MediaHandle
- {
- get
- {
- return _handle.DangerousGetHandle();
- }
- }
-
- internal MediaInformation(Interop.MediaInformation.SafeMediaInformationHandle handle)
- {
- _handle = handle;
- }
- }
-}
--- /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.Content.MediaContent namespace provides types used in the entire content service.
+/// The information about media items(i.e. image, audio and video) are managed in the content database
+/// and operations that involve database require an active connection with the media content service.
+/// During media scanning, Media content service extracts media information automatically. Media information
+/// includes basic file info like path, size, modified time etc and some metadata like ID3 tag, EXIF,
+/// thumbnail, etc. (thumbnail extracted only in Internal and SD card storage.
+/// </summary>
+/// <remarks>Media content service does not manage hidden files.</remarks>
+namespace Tizen.Content.MediaContent { }
\ 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.Runtime.InteropServices;
+
+namespace Tizen.Content.MediaContent
+{
+ internal abstract class ObjectKeeper : IDisposable
+ {
+ private ObjectKeeper()
+ {
+ }
+
+ public abstract void Dispose();
+
+ public static ObjectKeeperImpl<T> Get<T>(T target)
+ {
+ return new ObjectKeeperImpl<T>(target);
+ }
+
+ internal class ObjectKeeperImpl<T> : ObjectKeeper
+ {
+ private readonly GCHandle _handle;
+
+ internal ObjectKeeperImpl(T obj)
+ {
+ Target = obj;
+ _handle = GCHandle.Alloc(obj);
+ }
+
+ ~ObjectKeeperImpl()
+ {
+ Dispose(false);
+ }
+
+ private bool disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ _handle.Free();
+ }
+
+ disposedValue = true;
+ }
+ }
+
+ public override void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ public T Target
+ {
+ get;
+ }
+ }
+ }
+}
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
namespace Tizen.Content.MediaContent
{
/// <summary>
- /// The PlayList API provides functions to manage media playlists.
+ /// Represents a playlist that is a group of media(usually songs).
/// </summary>
- /// <remarks>
- /// A PlayList is a list of songs which can be played in some sequence i.e. sequential or shuffled order.
- /// The Media PlayList API provides functions to insert, delete or updates a media playlist in the database.
- /// </remarks>
- public class PlayList : ContentCollection
+ public class Playlist
{
- private readonly IDictionary<string, int> _dictionary = new Dictionary<string, int>();
- private IntPtr _playlistHandle = IntPtr.Zero;
- internal IntPtr Handle
+ internal Playlist(IntPtr handle)
{
- get
- {
- if (_playlistHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(PlayList));
- }
-
- return _playlistHandle;
- }
+ Name = InteropHelper.GetString(handle, Interop.Playlist.GetName);
+ ThumbnailPath = InteropHelper.GetString(handle, Interop.Playlist.GetThumbnailPath);
- set
- {
- _playlistHandle = value;
- }
+ Id = InteropHelper.GetValue<IntPtr, int>(handle, Interop.Playlist.GetId);
}
- private void RefreshPlaylistDictionary()
- {
- _dictionary.Clear();
- Interop.Playlist.PlaylistMemberCallback callback = (int memberId, IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
-
- Interop.MediaInformation.GetMediaId(newHandle, out val);
- _dictionary.Add(Marshal.PtrToStringAnsi(val), memberId);
- return true;
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- };
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.ForeachMediaFromDb(Id, IntPtr.Zero, callback, IntPtr.Zero), "Failed to get playlist items");
- }
+ internal static Playlist FromHandle(IntPtr handle) => new Playlist(handle);
/// <summary>
- /// The ID of the media playlist
+ /// Gets the ID of the playlist.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Id
- {
- get
- {
- int id;
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetPlaylistId(Handle, out id), "Failed to get value");
+ /// <value>The unique id of the playlist.</value>
+ public int Id { get; }
- return id;
- }
- }
-
- internal string _playListName;
/// <summary>
- /// The playlist name
+ /// Gets the name of the playlist.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get
- {
- return _playListName;
- }
+ /// <value>The name of the playlist.</value>
+ public string Name { get; }
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.SetName(Handle, value), "Failed to set value");
- _playListName = value;
- }
- }
/// <summary>
- /// The path of the thumbnail
+ /// Gets the path to the thumbnail.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string ThumbnailPath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetThumbnailPath(Handle, out val), "Failed to get value");
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.SetThumbnailPath(Handle, value), "Failed to set value");
- }
- }
+ /// <value>The path to the thumbnail.</value>
+ public string ThumbnailPath { get; }
/// <summary>
- /// The constructor to create a new playlist with the given name in the media database.
+ /// Returns a string representation of the playlist.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="name">The name of the inserted playlist</param>
- public PlayList(string name)
- {
- _playListName = name;
- }
-
- internal PlayList(IntPtr handle)
- {
- _playlistHandle = handle;
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetName(handle, out val), "Failed to get value");
- _playListName = Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
-
- /// <summary>
- /// Adds a new media info to the playlist.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="mediaContent">The AudioContent obect to be added</param>
- public void AddItem(MediaInformation mediaContent)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.AddMedia(Handle, mediaContent.MediaId), "Failed to add item");
- }
-
- /// <summary>
- /// Removes the playlist members related with the media from the given playlist.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="media">The AudioContent object to be removed</param>
- public void RemoveItem(MediaInformation media)
- {
- int memberId = 0;
- RefreshPlaylistDictionary();
- _dictionary.TryGetValue(media.MediaId, out memberId);
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.RemoveMedia(Handle, memberId), "Failed to remove item");
- }
+ /// <returns>A string representation of the current playlist.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Name={Name}, ThumbnailPath={ThumbnailPath}";
+ }
+ /// <summary>
+ /// Provides means to set values used for the update command.
+ /// </summary>
+ /// <remarks>
+ /// The values only set in the object will be affected to the update command.
+ /// </remarks>
+ /// <seealso cref="PlaylistCommand.Update(int, PlaylistUpdateValues)"/>
+ public class PlaylistUpdateValues
+ {
/// <summary>
- /// Sets the playing order in the playlist.
+ /// Gets or sets the name of playlist for update.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="media">The playlist reference</param>
- /// <param name="playOrder">The playing order</param>
- public void SetPlayOrder(MediaInformation media, int playOrder)
- {
- int memberId;
- RefreshPlaylistDictionary();
- _dictionary.TryGetValue(media.MediaId, out memberId);
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.SetPlayOrder(Handle, memberId, playOrder), "Failed to set play order");
- }
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for name; the field will not be updated if null.</value>
+ public string Name { get; set; }
/// <summary>
- /// Gets the playing order in the playlist for the passed member id.
+ /// Gets or sets the thumbnail path of playlist for update.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="media">The MediaInformation instance</param>
- /// <returns>The number of play order</returns>
- public int GetPlayOrder(MediaInformation media)
- {
- int playOrder;
- int memberId;
- RefreshPlaylistDictionary();
- _dictionary.TryGetValue(media.MediaId, out memberId);
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetPlayOrder(Handle, memberId, out playOrder), "Failed to get play order");
-
- return playOrder;
- }
+ /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
+ /// <value>A string for thumbnail path; the field will not be updated if null.</value>
+ public string ThumbnailPath { get; set; }
+ }
+ /// <summary>
+ /// Represents an order of a member of a playlist.
+ /// </summary>
+ public class PlayOrder
+ {
/// <summary>
- /// Imports the playlist from m3u playlist file.
+ /// Initializes a new instance of the <see cref="Playlist"/> class with the specified member id and order value.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="name">The name of the playlist to save</param>
- /// <param name="filePath">The path to import the playlist file</param>
- /// <returns>The imported PlayList object</returns>
- public static PlayList Import(string name, string filePath)
+ /// <param name="memberId">The id of member.</param>
+ /// <param name="orderValue">The order value.</param>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="memberId"/> is less than or equal to zero.\n
+ /// -or-\n
+ /// <paramref name="orderValue"/> is less than zero.
+ /// </exception>
+ public PlayOrder(int memberId, int orderValue)
{
- PlayList playList = null;
- IntPtr playlistHandle;
-
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.ImportFromFile(name, filePath, out playlistHandle), "Failed to import");
-
- playList = new PlayList(name);
- playList.Handle = playlistHandle;
- return playList;
+ MemberId = memberId;
+ Value = orderValue;
}
- /// <summary>
- /// Exports the playlist to m3u playlist file.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="list">The playlist instance to export</param>
- /// <param name="filePath">The path to save exported playlist</param>
- /// <returns>path The path to export the playlist</returns>
- public static void Export(PlayList list, string filePath)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.ExportToFile(list.Handle, filePath), "Failed to export playlist:" + filePath);
- }
+ private int _memberId;
/// <summary>
- /// Gets the number of the media info for the given playlist present in the media database.
+ /// Gets or sets the member id.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
+ /// <value>The member id.</value>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="value"/> is less than or equal to zero.
+ /// </exception>
+ public int MemberId
{
- int mediaCount;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get media count");
-
- return mediaCount;
- }
-
- public override void Dispose()
- {
- if (_playlistHandle != IntPtr.Zero)
+ get => _memberId;
+ set
{
- Interop.Playlist.Destroy(_playlistHandle);
- _playlistHandle = IntPtr.Zero;
+ if (value <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ "Member id can't be less than or equal to zero.");
+ }
+ _memberId = value;
}
}
+ private int _value;
+
/// <summary>
- /// Iterates through the media files with an optional filter in the given audio playlist from the media database.
- /// This function gets all media files associated with the given media playlist and meeting desired filter option.
- /// If NULL is passed to the filter, no filtering is applied.
+ /// Gets or sets the value indicating the order of the member in a playlist.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
+ /// <value>A integer value indicating the order of the member in a playlist.</value>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="value"/> is less than zero.
+ /// </exception>
+ public int Value
{
- List<MediaInformation> mediaContents = new List<MediaInformation>();
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.Playlist.PlaylistMemberCallback callback = (int memberId, IntPtr mediaHandle, IntPtr data) =>
+ get => _value;
+ set
{
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
+ if (value < 0)
{
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ "Order can't be less than zero.");
}
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Playlist.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get media information");
-
- return mediaContents;
+ _value = value;
+ }
}
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage playlists in the database.
+ /// </summary>
+ /// <seealso cref="Playlist"/>
+ public class PlaylistCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PlaylistCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public PlaylistCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of playlists.
+ /// </summary>
+ /// <returns>The number of playlists.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count()
+ {
+ return Count(null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of playlists with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of playlists.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Playlist.GetPlaylistCount, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the play order of the member.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="memberId">The member id of the playlist.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="playlistId"/> is less than or equal to zero.\n
+ /// -or-\n
+ /// <paramref name="memberId"/> is less than or equal to zero.
+ /// </exception>
+ public int GetPlayOrder(int playlistId, int memberId)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (memberId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(memberId), memberId,
+ "Member id can't be less than or equal to zero.");
+ }
+
+ Interop.Playlist.GetPlayOrder(playlistId, memberId, out var order).ThrowIfError("Failed to query");
+
+ return order;
+ }
+
+ /// <summary>
+ /// Deletes a playlist from the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="playlistId">The playlist id to delete.</param>
+ /// <returns>true if the matched record was found and deleted, otherwise false.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Delete(int playlistId)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (Select(playlistId) == null)
+ {
+ return false;
+ }
+
+ CommandHelper.Delete(Interop.Playlist.Delete, playlistId);
+ return true;
+ }
+
+ /// <summary>
+ /// Inserts a playlist into the database from the specified m3u file.
+ /// </summary>
+ /// <remarks>
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="name">The name of playlist.</param>
+ /// <param name="path">The path to a m3u file to import.</param>
+ /// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="name"/> is null.\n
+ /// -or-\n
+ /// <paramref name="path"/> is null.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="name"/> is a zero-length string.\n
+ /// -or-\n
+ /// <paramref name="path"/> is a zero-length string, contains only white space.
+ /// </exception>
+ /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Playlist InsertFromFile(string name, string path)
+ {
+ ValidateDatabase();
+
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (name.Length == 0)
+ {
+ throw new ArgumentException("Playlist name can't be an empty string.");
+ }
+
+ ValidationUtil.ValidateNotNullOrEmpty(path, nameof(path));
+
+ if (File.Exists(path) == false)
+ {
+ throw new FileNotFoundException("The specified path does not exists.", path);
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Playlist.ImportFromFile(path, name, out handle).ThrowIfError("Failed to insert");
+
+ try
+ {
+ return new Playlist(handle);
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+ /// <summary>
+ /// Exports a playlist to a m3u file.
+ /// </summary>
+ /// <remarks>
+ /// If the file already exists in the file system, then it will be overwritten.\n
+ /// \n
+ /// If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.\n
+ /// If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
+ /// </remarks>
+ /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ /// <param name="playlistId">The playlist id to export.</param>
+ /// <param name="path">The path to a m3u file.</param>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <exception cref="RecordNotFoundException">No matching playlist exists.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public void ExportToFile(int playlistId, string path)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(path, nameof(path));
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ try
+ {
+ Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
+
+ if (handle == IntPtr.Zero)
+ {
+ throw new RecordNotFoundException("No matching playlist exists.");
+ }
+
+ Interop.Playlist.ExportToFile(handle, path).ThrowIfError("Failed to export");
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Inserts a playlist into the database with the specified name.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="name">The name of playlist.</param>
+ /// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="name"/> is a zero-length string.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Playlist Insert(string name)
+ {
+ return Insert(name, null);
+ }
+
+ /// <summary>
+ /// Inserts a playlist into the database with the specified name and thumbnail path.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="name">The name of playlist.</param>
+ /// <param name="thumbnailPath">The path of thumbnail for playlist. This value can be null.</param>
+ /// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="name"/> is a zero-length string.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Playlist Insert(string name, string thumbnailPath)
+ {
+ ValidateDatabase();
+
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (name.Length == 0)
+ {
+ throw new ArgumentException("Playlist name can't be an empty string.");
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Playlist.Create(out handle).ThrowIfError("Failed to insert");
+
+ try
+ {
+ Interop.Playlist.SetName(handle, name).ThrowIfError("Failed to insert");
+
+ if (thumbnailPath != null)
+ {
+ Interop.Playlist.SetThumbnailPath(handle, thumbnailPath).ThrowIfError("Failed to insert");
+ }
+
+ Interop.Playlist.Insert(handle).ThrowIfError("Failed to insert");
+ return new Playlist(handle);
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the playlists.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Playlist> Select()
+ {
+ return Select(null);
+ }
+
+ /// <summary>
+ /// Retrieves the playlists with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Playlist> Select(SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(filter, Interop.Playlist.ForeachPlaylistFromDb,
+ Playlist.FromHandle);
+ }
+
+ /// <summary>
+ /// Retrieves the playlist with the specified playlist id.
+ /// </summary>
+ /// <param name="playlistId">The playlist id to select.</param>
+ /// <returns>The <see cref="Playlist"/> instance if the matched record was found in the database, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public Playlist Select(int playlistId)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ IntPtr handle = IntPtr.Zero;
+
+ try
+ {
+ Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
+
+ if (handle == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ return new Playlist(handle);
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info of the playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id to count media added to the playlist.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public int CountMember(int playlistId)
+ {
+ return CountMember(playlistId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info of the playlist with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="playlistId">The playlist id to count media added to the playlist.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public int CountMember(int playlistId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ return CommandHelper.Count(Interop.Playlist.GetMediaCountFromDb, playlistId, arguments);
+
+ }
+
+ private static List<PlaylistMember> GetMembers(int playlistId, SelectArguments arguments)
+ {
+ using (var filter = QueryArguments.ToNativeHandle(arguments))
+ {
+ Exception caught = null;
+ List<PlaylistMember> list = new List<PlaylistMember>();
+
+ Interop.Playlist.ForeachMediaFromDb(playlistId, filter, (memberId, mediaInfoHandle, _) =>
+ {
+ try
+ {
+ list.Add(new PlaylistMember(memberId, MediaInfo.FromHandle(mediaInfoHandle)));
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ caught = e;
+ return false;
+ }
+ }).ThrowIfError("Failed to query");
+
+ if (caught != null)
+ {
+ throw caught;
+ }
+
+ return list;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the member id of the media in the playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="mediaId">The media id.</param>
+ /// <returns>The member id if the member was found in the playlist, otherwise -1.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ public int GetMemberId(int playlistId, string mediaId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ var reader = SelectMember(playlistId, new SelectArguments()
+ {
+ FilterExpression = $"{MediaInfoColumns.Id}='{mediaId}'"
+ });
+ reader.Read();
+
+ return reader.Current?.MemberId ?? -1;
+ }
+
+ /// <summary>
+ /// Retrieves the media info of the playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id to query with.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public MediaDataReader<PlaylistMember> SelectMember(int playlistId)
+ {
+ return SelectMember(playlistId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of the playlist with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="playlistId">The playlist id to query with.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public MediaDataReader<PlaylistMember> SelectMember(int playlistId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ return new MediaDataReader<PlaylistMember>(GetMembers(playlistId, filter));
+ }
+
+ /// <summary>
+ /// Updates a playlist with the specified values.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="playlistId">The playlist id to update.</param>
+ /// <param name="values">The values for update.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>Only values set in <see cref="PlaylistUpdateValues"/> are updated.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="values"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Update(int playlistId, PlaylistUpdateValues values)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (values == null)
+ {
+ throw new ArgumentNullException(nameof(values));
+ }
+
+ if (CommandHelper.Count(
+ Interop.Playlist.GetPlaylistCount, $"{PlaylistColumns.Id}={playlistId}") == 0)
+ {
+ return false;
+ }
+
+ Interop.Playlist.Create(out var handle).ThrowIfError("Failed to update");
+
+ try
+ {
+ if (values.Name != null)
+ {
+ Interop.Playlist.SetName(handle, values.Name).ThrowIfError("Failed to update");
+ }
+
+ if (values.ThumbnailPath != null)
+ {
+ Interop.Playlist.SetThumbnailPath(handle, values.ThumbnailPath).ThrowIfError("Failed to update");
+ }
+
+ Interop.Playlist.Update(playlistId, handle).ThrowIfError("Failed to update");
+ return true;
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds media to a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id that the media will be added to.</param>
+ /// <param name="mediaId">The media id to add to the playlist.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid media id will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public bool AddMember(int playlistId, string mediaId)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return AddMembers(playlistId, new string[] { mediaId });
+ }
+
+ /// <summary>
+ /// Adds a media set to a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id that the media will be added to.</param>
+ /// <param name="mediaIds">The collection of media id to add to the playlist.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid media ids will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaIds"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaIds"/> has no element.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains null value.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains a zero-length string or white space.\n
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public bool AddMembers(int playlistId, IEnumerable<string> mediaIds)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (mediaIds == null)
+ {
+ throw new ArgumentNullException(nameof(mediaIds));
+ }
+
+ if (mediaIds.Count() == 0)
+ {
+ throw new ArgumentException("mediaIds has no element.", nameof(mediaIds));
+ }
+
+ if (CommandHelper.Count(
+ Interop.Playlist.GetPlaylistCount, $"{PlaylistColumns.Id}={playlistId}") == 0)
+ {
+ return false;
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Playlist.Create(out handle).ThrowIfError("Failed to add member");
+
+ try
+ {
+ foreach (var mediaId in mediaIds)
+ {
+ if (mediaId == null)
+ {
+ throw new ArgumentException("Media id should not be null.", nameof(mediaIds));
+ }
+
+ if (string.IsNullOrWhiteSpace(mediaId))
+ {
+ throw new ArgumentException("Media id should not be empty.", nameof(mediaId));
+ }
+
+ Interop.Playlist.AddMedia(handle, mediaId).ThrowIfError("Failed to add member");
+ }
+
+ Interop.Playlist.Update(playlistId, handle).ThrowIfError("Failed to add member");
+ return true;
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes a member from a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="memberId">The member id to be removed.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid id will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="playlistId"/> is less than or equal to zero.\n
+ /// -or-\n
+ /// <paramref name="memberId"/> is less than or equal to zero.\n
+ /// </exception>
+ public bool RemoveMember(int playlistId, int memberId)
+ {
+ if (memberId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(memberId), memberId,
+ "Member id can't be less than or equal to zero.");
+ }
+
+ return RemoveMembers(playlistId, new int[] { memberId });
+ }
+
+ /// <summary>
+ /// Removes a media set from a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="memberIds">The collection of member id to remove from to the playlist.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid ids will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="memberIds"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="memberIds"/> has no element.\n
+ /// -or-\n
+ /// <paramref name="memberIds"/> contains a value which is less than or equal to zero.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public bool RemoveMembers(int playlistId, IEnumerable<int> memberIds)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (memberIds == null)
+ {
+ throw new ArgumentNullException(nameof(memberIds));
+ }
+
+ if (memberIds.Count() == 0)
+ {
+ throw new ArgumentException("memberIds has no element.", nameof(memberIds));
+ }
+
+ if (CommandHelper.Count(
+ Interop.Playlist.GetPlaylistCount, $"{PlaylistColumns.Id}={playlistId}") == 0)
+ {
+ return false;
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Playlist.Create(out handle).ThrowIfError("Failed to add member");
+
+ try
+ {
+ foreach (var memberId in memberIds)
+ {
+ if (memberId <= 0)
+ {
+ throw new ArgumentException(nameof(memberIds),
+ "Member id can't be less than or equal to zero.");
+ }
+
+ Interop.Playlist.RemoveMedia(handle, memberId).ThrowIfError("Failed to add member");
+ }
+
+ Interop.Playlist.Update(playlistId, handle).ThrowIfError("Failed to add member");
+ return true;
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Updates a play order of a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="playOrder">The <see cref="PlayOrder"/> to apply.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The <see cref="PlayOrder.MemberId"/> that is invalid will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="playOrder"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public bool UpdatePlayOrder(int playlistId, PlayOrder playOrder)
+ {
+ if (playOrder == null)
+ {
+ throw new ArgumentNullException(nameof(playOrder));
+ }
+ return UpdatePlayOrders(playlistId, new PlayOrder[] { playOrder });
+ }
+
+ /// <summary>
+ /// Updates play orders of a playlist.
+ /// </summary>
+ /// <param name="playlistId">The playlist id.</param>
+ /// <param name="orders">The collection of <see cref="PlayOrder"/> to apply.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The <see cref="PlayOrder.MemberId"/> that is invalid will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="orders"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="orders"/> has no element.\n
+ /// -or-\n
+ /// <paramref name="orders"/> contains a null value.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ public bool UpdatePlayOrders(int playlistId, IEnumerable<PlayOrder> orders)
+ {
+ ValidateDatabase();
+
+ if (playlistId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(playlistId), playlistId,
+ "Playlist id can't be less than or equal to zero.");
+ }
+
+ if (orders == null)
+ {
+ throw new ArgumentNullException(nameof(orders));
+ }
+
+ if (orders.Count() == 0)
+ {
+ throw new ArgumentException("memberIds has no element.", nameof(orders));
+ }
+
+ if (CommandHelper.Count(
+ Interop.Playlist.GetPlaylistCount, $"{PlaylistColumns.Id}={playlistId}") == 0)
+ {
+ return false;
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Playlist.Create(out handle).ThrowIfError("Failed to add member");
+
+ try
+ {
+ foreach (var order in orders)
+ {
+ if (order == null)
+ {
+ throw new ArgumentException(nameof(orders),
+ "orders should not contain null value.");
+ }
+ Interop.Playlist.SetPlayOrder(handle, order.MemberId, order.Value).ThrowIfError("Failed to add member");
+ }
+
+ Interop.Playlist.Update(playlistId, handle).ThrowIfError("Failed to add member");
+ return true;
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Playlist.Destroy(handle);
+ }
+ }
+ }
+ }
+}
\ 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.
+ */
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Represents a member of <see cref="Playlist"/>.
+ /// </summary>
+ public class PlaylistMember
+ {
+ /// <summary>
+ /// Gets the member id.
+ /// </summary>
+ /// <value>The member id of playlist.</value>
+ public int MemberId { get; }
+
+ /// <summary>
+ /// Gets the media info of the member.
+ /// </summary>
+ /// <value>The <see cref="MediaInfo"/> of the member.</value>
+ public MediaInfo MediaInfo { get; }
+
+ internal PlaylistMember(int memberId, MediaInfo mediaInfo)
+ {
+ MemberId = memberId;
+ MediaInfo = mediaInfo;
+ }
+ }
+}
--- /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 FilterHandle = Interop.FilterHandle;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Base class for query arguments.
+ /// </summary>
+ /// <remarks>
+ /// A filter is required for filtering information associated with Album, Folder, Tag, Bookmark, Playlist
+ /// and MediaInfo on basis of details like limit, order and condition.
+ /// </remarks>
+ public class QueryArguments
+ {
+ private string _filter;
+
+ /// <summary>
+ /// Gets or sets the filtering expression that is applied.
+ /// </summary>
+ /// <value>A string that represents a filtering expression applied when data is retrieved.</value>
+ /// <remarks>
+ /// Expressions for the filter can be one of the following forms:
+ /// <list>
+ /// <item><description>column = value</description></item>
+ /// <item><description>column > value</description></item>
+ /// <item><description>column >= value</description></item>
+ /// <item><description>column < value</description></item>
+ /// <item><description>column <= value</description></item>
+ /// <item><description>value = column</description></item>
+ /// <item><description>value >= column</description></item>
+ /// <item><description>value < column</description></item>
+ /// <item><description>value <= column</description></item>
+ /// <item><description>column IN (value)</description></item>
+ /// <item><description>column IN(value-list)</description></item>
+ /// <item><description>column NOT IN(value)</description></item>
+ /// <item><description>column NOT IN(value-list)</description></item>
+ /// <item><description>column LIKE value</description></item>
+ /// <item><description>expression COLLATE NOCASE</description></item>
+ /// <item><description>expression COLLATE RTRIM</description></item>
+ /// <item><description>expression COLLATE LOCALIZED</description></item>
+ /// <item><description>expression1 AND expression2 OR expression3 ... </description></item>
+ /// </list>
+ ///
+ /// Note that if you want to set quotation(" ' " or " " ") as value of LIKE operator, you should use two times.(" '' " or " "" ").
+ /// And the optional ESCAPE clause is supported. Both percent symbol("%") and underscore symbol("_") are used in the LIKE pattern.
+ /// If these characters are used as value of LIKE operation, then the expression following the ESCAPE clause of sqlite will be ignored.\n
+ /// \n
+ /// For example,\n
+ /// - column LIKE('#%') ESCAPE('#') - "#" is escape character, it will be ignored.
+ /// </remarks>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is a zero-length string, contains only white space.</exception>
+ /// <seealso cref="MediaInfoColumns"/>
+ /// <seealso cref="AlbumColumns"/>
+ /// <seealso cref="FolderColumns"/>
+ /// <seealso cref="PlaylistColumns"/>
+ /// <seealso cref="TagColumns"/>
+ /// <seealso cref="BookmarkColumns"/>
+ /// <seealso cref="FaceInfoColumns"/>
+ public string FilterExpression
+ {
+ get => _filter;
+ set
+ {
+ if (value != null)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(value, nameof(value));
+ }
+
+ _filter = value;
+ }
+ }
+
+ private string _storageId;
+
+ /// <summary>
+ /// Gets or sets the storage id for the given filter.
+ /// You can use this property when you want to search items only in the specific storage.
+ /// </summary>
+ /// <value>The storage id to restrict storage to search, or null for all storages.</value>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is a zero-length string, contains only white space.</exception>
+ public string StorageId
+ {
+ get => _storageId;
+ set
+ {
+ if (value != null)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(value, nameof(value));
+ }
+
+ _storageId = value;
+ }
+ }
+
+ internal static FilterHandle ToNativeHandle(QueryArguments arguments)
+ {
+ if (arguments == null || arguments.IsEmpty())
+ {
+ return FilterHandle.Null;
+ }
+
+ Interop.Filter.Create(out var handle).ThrowIfError("Failed to apply arguments.");
+
+ try
+ {
+ arguments.FillHandle(handle);
+ }
+ catch (Exception)
+ {
+ handle.Dispose();
+ throw;
+ }
+
+ return handle;
+ }
+
+ internal static FilterHandle CreateNativeHandle(string filterExpression)
+ {
+ Debug.Assert(filterExpression != null);
+
+ Interop.Filter.Create(out var handle).ThrowIfError("Failed to apply arguments.");
+
+ Interop.Filter.SetCondition(handle, filterExpression, Collation.Default).
+ ThrowIfError("Failed to create filter handle.");
+
+ return handle;
+ }
+
+ internal virtual bool IsEmpty()
+ {
+ return StorageId == null && FilterExpression == null;
+ }
+
+ internal virtual void FillHandle(FilterHandle handle)
+ {
+ if (FilterExpression != null)
+ {
+ Interop.Filter.SetCondition(handle, FilterExpression, Collation.Default).
+ ThrowIfError("Failed to create filter handle(condition)");
+ }
+
+ if (StorageId != null)
+ {
+ Interop.Filter.SetStorage(handle, StorageId).
+ ThrowIfError("Failed to create filter handle(storage id)"); ;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Provides the ability to filter the result of a Select command.
+ /// </summary>
+ /// <remarks>
+ /// A filter is required for filtering information associated with Album, Folder, Tag, Bookmark, Playlist
+ /// and MediaInfo.
+ /// </remarks>
+ public class SelectArguments : QueryArguments
+ {
+ private int _startRowIndex;
+
+ /// <summary>
+ /// Gets or sets the starting row position of a query(starting from zero).
+ /// </summary>
+ /// <value>An integer value that indicates the starting row position of a query.</value>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.\n</exception>
+ public int StartRowIndex
+ {
+ get => _startRowIndex;
+ set
+ {
+ if (value < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value, "StartRowIndex can't be less than zero.");
+ }
+
+ _startRowIndex = value;
+ }
+ }
+
+ private int _totalRowCount;
+
+ /// <summary>
+ /// Gets or sets the number of rows to be retrieved.
+ /// </summary>
+ /// <value>An integer value that indicates the limit of rows of the result.</value>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception>
+ public int TotalRowCount
+ {
+ get => _totalRowCount;
+ set
+ {
+ if (value < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value, "TotalRowCount can't be less than zero.");
+ }
+
+ _totalRowCount = value;
+ }
+ }
+
+ private string _sortOrder;
+
+ /// <summary>
+ /// Gets or sets the sort order of the results.
+ /// </summary>
+ /// <value>The expression for the sort order.</value>
+ /// <remarks>
+ /// Expressions for the sort order can be:\n
+ /// column [COLLATE NOCASE/RTRIM/LOCALIZED] [ASC/DESC], column2 ...
+ /// </remarks>
+ /// <exception cref="ArgumentException"><paramref name="value"/> is a zero-length string, contains only white space.</exception>
+ /// <seealso cref="MediaInfoColumns"/>
+ /// <seealso cref="AlbumColumns"/>
+ /// <seealso cref="FolderColumns"/>
+ /// <seealso cref="PlaylistColumns"/>
+ /// <seealso cref="TagColumns"/>
+ /// <seealso cref="BookmarkColumns"/>
+ /// <seealso cref="FaceInfoColumns"/>
+ public string SortOrder
+ {
+ get => _sortOrder;
+ set
+ {
+ if (value != null)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(value, nameof(value));
+ }
+
+ _sortOrder = value;
+ }
+ }
+
+ internal override bool IsEmpty()
+ {
+ return base.IsEmpty() && StartRowIndex == 0 && TotalRowCount == 0 && SortOrder == null;
+ }
+
+ internal override void FillHandle(FilterHandle handle)
+ {
+ base.FillHandle(handle);
+
+ if (StartRowIndex != 0 || TotalRowCount != 0)
+ {
+ Interop.Filter.SetOffset(handle, StartRowIndex, TotalRowCount).
+ ThrowIfError("Failed to create filter handle(limit)");
+ }
+
+ if (SortOrder != null)
+ {
+ Interop.Filter.SetOrder(handle, SortOrder).ThrowIfError("Failed to create filter handle(order)");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Provides the ability to filter the result of a Count command.
+ /// </summary>
+ /// <remarks>
+ /// A filter is required for filtering information associated with Album, Folder, Tag, Bookmark, Playlist
+ /// and MediaInfo.
+ /// </remarks>
+ public class CountArguments : QueryArguments
+ {
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// The exception that is thrown when no record is found in the database.
+ /// </summary>
+ public class RecordNotFoundException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RecordNotFoundException"/> class.
+ /// </summary>
+ public RecordNotFoundException() : base("No record found.")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RecordNotFoundException"/> class with a specified error message.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ public RecordNotFoundException(string message) : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RecordNotFoundException"/> class with a specified error message
+ /// and a reference to the inner exception that is the cause of this exception.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception.</param>
+ public RecordNotFoundException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Represents location of the object bounded by rectangle defined by
+ /// coordinates of top left corner, width and height.
+ /// </summary>
+ public struct Rectangle
+ {
+ /// <summary>
+ /// Initializes a new instance of the Rectangle with the specified values.
+ /// </summary>
+ /// <param name="x">The x-coordinate of the upper-left corner of the rectangle.</param>
+ /// <param name="y">The y-coordinate of the upper-left corner of the rectangle.</param>
+ /// <param name="width">The Width of the rectangle.</param>
+ /// <param name="height">The Height of the rectangle.</param>
+ public Rectangle(int x, int y, int width, int height)
+ {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+
+ /// <summary>
+ /// Gets or sets the x-coordinate of the upper-left corner of the rectangle.
+ /// </summary>
+ /// <value>The x-coordinate of the upper-left edge of the rectangle.</value>
+ public int X { get; set; }
+
+ /// <summary>
+ /// Gets or sets the y-coordinate of the upper-left corner of the rectangle.
+ /// </summary>
+ /// <value>The y-coordinate of the upper-left edge of the rectangle.</value>
+ public int Y { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width of the rectangle.
+ /// </summary>
+ /// <value>The width of the rectangle.</value>
+ public int Width { get; set; }
+
+ /// <summary>
+ /// Gets or sets the height of the rectangle.
+ /// </summary>
+ /// <value>The height of the rectangle.</value>
+ public int Height { get; set; }
+
+ /// <summary>
+ /// Gets the x-coordinate of the left edge of the rectangle.
+ /// </summary>
+ /// <value>The x-coordinate of the left edge of the rectangle.</value>
+ public int Left => X;
+
+ /// <summary>
+ /// Gets the y-coordinate of the top edge of the rectangle.
+ /// </summary>
+ /// <value>The y-coordinate of the top edge of the rectangle.</value>
+ public int Top => Y;
+
+ /// <summary>
+ /// Gets the x-coordinate of the right edge of the rectangle.
+ /// </summary>
+ /// <value>The x-coordinate of the right edge of the rectangle.</value>
+ public int Right => X + Width;
+
+ /// <summary>
+ /// Gets the y-coordinate of the bottom edge of the rectangle.
+ /// </summary>
+ /// <value>The y-coordinate of the bottom edge of the rectangle.</value>
+ public int Bottom => Y + Height;
+
+ /// <summary>
+ /// Returns a string representation of the rectangle.
+ /// </summary>
+ /// <returns>A string representation of the current rectangle.</returns>
+ public override string ToString() =>
+ $"X={X.ToString()}, Y={Y.ToString()}, Width={Width.ToString()}, Height={Height.ToString()}";
+
+ /// <summary>
+ /// Returns the hash code for this Rectangle structure.
+ /// </summary>
+ /// <returns>An integer that represents the hash code for this rectangle.</returns>
+ public override int GetHashCode() => new { X, Y, Width, Height }.GetHashCode();
+
+ /// <summary>
+ /// Tests whether obj is a Rectangle structure with the same location and size of this Rectangle structure.
+ /// </summary>
+ /// <param name="obj">A <see cref="Object"/> to compare.</param>
+ /// <returns>
+ /// true if obj is a Rectangle structure and its X, Y, Width and Height properties are
+ /// equal to the corresponding properties of this Rectangle structure; otherwise, false.
+ /// </returns>
+ public override bool Equals(object obj) => obj is Rectangle && this == (Rectangle)obj;
+
+ /// <summary>
+ /// Tests whether two Rectangle structures have equal location and size.
+ /// </summary>
+ /// <param name="rect1">A <see cref="Rectangle"/> to compare.</param>
+ /// <param name="rect2">A <see cref="Rectangle"/> to compare.</param>
+ /// <returns>true if the two Rectangle structures have equal X, Y, Width, and Height properties; otherwise, false.</returns>
+ public static bool operator ==(Rectangle rect1, Rectangle rect2)
+ => rect1.X == rect2.X && rect1.Y == rect2.Y && rect1.Width == rect2.Width && rect1.Height == rect2.Height;
+
+ /// <summary>
+ /// Tests whether two Rectangle structures differ in location or size.
+ /// </summary>
+ /// <param name="rect1">A <see cref="Rectangle"/> to compare.</param>
+ /// <param name="rect2">A <see cref="Rectangle"/> to compare.</param>
+ /// <returns>true if any of the X, Y, Width or Height properties of the two Rectangle structures are unequal; otherwise false.</returns>
+ public static bool operator !=(Rectangle rect1, Rectangle rect2) => !(rect1 == rect2);
+ }
+}
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
namespace Tizen.Content.MediaContent
{
/// <summary>
- /// A Storage allows you to manage external storage.
- /// The system generates the storage id when the external storage is added.And the system manages the media information in each of the storage by using storage id.
- /// So you can get the information from the storage that you want to view.
+ /// Represents the storage information for media.
/// </summary>
- public class Storage : ContentCollection
+ /// <remarks>
+ /// The system generates the storage id when the external storage is added. and manages the media information
+ /// in each of the storage by using storage id.
+ /// </remarks>
+ public class Storage
{
- private IntPtr _storageHandle = IntPtr.Zero;
- private IntPtr Handle
+ internal Storage(IntPtr handle)
{
- get
- {
- if (_storageHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(Storage));
- }
-
- return _storageHandle;
- }
+ Path = InteropHelper.GetString(handle, Interop.Storage.GetPath);
+ Id = InteropHelper.GetString(handle, Interop.Storage.GetId);
+ Type = InteropHelper.GetValue<StorageType>(handle, Interop.Storage.GetType);
}
- /// <summary>
- /// The storage id of the media storage
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Id
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetId(Handle, out val), "Failed to get value");
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
+ internal static Storage FromHandle(IntPtr handle) => new Storage(handle);
/// <summary>
- /// The storage path of the media storage
+ /// Gets the id of the storage.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string StoragePath
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetPath(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
+ /// <value>The unique id of the storage.</value>
+ public string Id { get; }
/// <summary>
- /// The storage name of the media storage
+ /// Gets the path of the storage.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetName(Handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
+ /// <value>The path of the storage.</value>
+ public string Path { get; }
/// <summary>
- /// The storage type of the media storage
+ /// Gets the type of the storage.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ContentStorageType StorageType
- {
- get
- {
- ContentStorageType storageType;
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetType(Handle, out storageType), "Failed to get value");
-
- return storageType;
- }
- }
-
- internal Storage(IntPtr handle)
- {
- _storageHandle = handle;
- }
-
- /// <summary>
- /// Gets the count of media files for the passed filter in the given storage from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
- {
- int mediaCount;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Storage.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count");
-
- return mediaCount;
- }
-
- public override void Dispose()
- {
- if (_storageHandle != IntPtr.Zero)
- {
- Interop.Storage.Destroy(_storageHandle);
- _storageHandle = IntPtr.Zero;
- }
- }
+ /// <value>The type of the storage.</value>
+ public StorageType Type { get; }
/// <summary>
- /// Iterates through the media files with an optional filter in the given storage from the media database.
- /// This function gets all media files associated with the given storage and meeting desired filter option.
- /// If NULL is passed to the filter, no filtering is applied.
+ /// Returns a string representation of the storage.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- List<MediaInformation> mediaContents = new List<MediaInformation>();
-
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.Storage.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.Storage.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information");
-
- return mediaContents;
- }
+ /// <returns>A string representation of the current storage.</returns>
+ public override string ToString() =>
+ $"Id={Id}, Path={Path}, Type={Type}";
}
}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage external storages in the database.
+ /// </summary>
+ /// <remarks>
+ /// Internal storage is not managed.
+ /// </remarks>
+ /// <seealso cref="Storage"/>
+ public class StorageCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public StorageCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of storages.
+ /// </summary>
+ /// <returns>The number of storages.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count() => Count(arguments: null);
+
+ /// <summary>
+ /// Retrieves the number of storages with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of storages filtered.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Storage.GetStorageCountFromDb, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the storage with the specified id.
+ /// </summary>
+ /// <param name="storageId">The storage id to select.</param>
+ /// <returns>The <see cref="Storage"/> instance if the matched record was found in the database, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
+ public Storage Select(string storageId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(storageId, nameof(storageId));
+
+ IntPtr handle = IntPtr.Zero;
+
+ try
+ {
+ Interop.Storage.GetStorageInfoFromDb(storageId, out handle).ThrowIfError("Failed to query");
+
+ return handle == IntPtr.Zero ? null : new Storage(handle);
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Storage.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Retrieves all the storages.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Storage> Select() => Select(arguments: null);
+
+ /// <summary>
+ /// Retrieves the storages with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Storage> Select(SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(arguments, Interop.Storage.ForeachStorageFromDb, Storage.FromHandle);
+ }
+
+ private bool Exists(string storageId)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(storageId, nameof(storageId));
+
+ return Count(new CountArguments { FilterExpression = $"{StorageColumns.Id}='{storageId}'" }) != 0;
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info of the storage.
+ /// </summary>
+ /// <param name="storageId">The storage id.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
+ public int CountMedia(string storageId) => CountMedia(storageId, null);
+
+ /// <summary>
+ /// Retrieves the number of media info of the storage with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="storageId">The storage id to query with.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
+ public int CountMedia(string storageId, CountArguments arguments)
+ {
+ if (Exists(storageId) == false)
+ {
+ return 0;
+ }
+
+ return CommandHelper.Count(Interop.Storage.GetMediaCountFromDb, storageId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of the storage.
+ /// </summary>
+ /// <param name="storageId">The storage id.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(string storageId) => SelectMedia(storageId, null);
+
+ /// <summary>
+ /// Retrieves the media info of the storage with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="storageId">The storage id.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(string storageId, SelectArguments filter)
+ {
+ if (Exists(storageId) == false)
+ {
+ return new MediaDataReader<MediaInfo>(new MediaInfo[0]);
+ }
+
+ return CommandHelper.SelectMedia(Interop.Storage.ForeachMediaFromDb, storageId, filter);
+ }
+
+ }
+}
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
namespace Tizen.Content.MediaContent
{
/// <summary>
- /// A Tag is a special piece of information that may be associated with media content items.
- /// Tagging allows a user to organize large number of items into logical groups providing a simplified and faster way of accessing media content items.
+ /// Represents a special piece of information that may be associated with media.\n
+ /// Tagging allows a user to organize large number of items into logical groups providing
+ /// a simplified and faster way of accessing media items.
/// </summary>
- public class Tag : ContentCollection
+ public class Tag
{
- private IntPtr _tagHandle = IntPtr.Zero;
- private string _tagName = "";
-
- internal IntPtr Handle
+ internal Tag(IntPtr handle)
{
- get
- {
- if (_tagHandle == IntPtr.Zero)
- {
- throw new ObjectDisposedException(nameof(Tag));
- }
-
- return _tagHandle;
- }
-
- set
- {
- _tagHandle = value;
- }
- }
- /// <summary>
- /// The ID of the media tag
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Id
- {
- get
- {
- int id;
- MediaContentValidator.ThrowIfError(
- Interop.Tag.GetTagId(Handle, out id), "Failed to get value");
- return id;
- }
+ Name = InteropHelper.GetString(handle, Interop.Tag.GetName);
+ Id = InteropHelper.GetValue<int>(handle, Interop.Tag.GetId);
}
/// <summary>
- /// The name of the tag
+ /// Gets the id of the tag.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Name
- {
- get
- {
- return _tagName;
- }
-
- set
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.SetName(Handle, value), "Failed to set value");
- _tagName = value;
- }
- }
-
- internal Tag(IntPtr tagHandle)
- {
- _tagHandle = tagHandle;
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.GetName(Handle, out val), "Failed to get value");
- _tagName = Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
+ /// <value>The unique id of the tag.</value>
+ public int Id { get; }
/// <summary>
- /// Creates a Tag object which can be inserted to the media database using ContentManager:InsertToDatabaseAsync(ContentCollection)
+ /// Gets the name of the tag.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="tagName">The name of the media tag</param>
- public Tag(string tagName)
- {
- _tagName = tagName;
- }
+ /// <value>The name of the tag.</value>
+ public string Name { get; }
- /// <summary>
- /// Adds a new media info to the tag.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="mediaContent">The media info which is added</param>
- public void AddItem(MediaInformation mediaContent)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.AddMedia(Handle, mediaContent.MediaId), "Failed to add item");
- }
+ internal static Tag FromHandle(IntPtr handle) => new Tag(handle);
/// <summary>
- /// Removes the media info from the given tag.
+ /// Returns a string representation of the tag.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="mediaContent">The media info which is removed</param>
- public void RemoveItem(MediaInformation mediaContent)
- {
- MediaContentValidator.ThrowIfError(
- Interop.Tag.RemoveMedia(Handle, mediaContent.MediaId), "Failed to remove item");
- }
+ /// <returns>A string representation of the current tag.</returns>
+ public override string ToString() => $"Id={Id}, Name={Name}";
- /// <summary>
- /// Gets the number of media files for the passed filter in the given tag from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>The number of media contents matching the filter passed</returns>
- public override int GetMediaInformationCount(ContentFilter filter)
- {
- int mediaCount;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.Tag.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count");
-
- return mediaCount;
- }
-
- public override void Dispose()
- {
- if (_tagHandle != IntPtr.Zero)
- {
- Interop.Tag.Destroy(_tagHandle);
- _tagHandle = IntPtr.Zero;
- }
- }
-
- /// <summary>
- /// Iterates through media items for a given tag from the media database.
- /// This function gets all media items associated with a given tag and meeting a desired filter.
- /// If NULL is passed to the filter, no filtering is applied.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="filter">ContentFilter used to match media content from the media database.</param>
- /// <returns>List of content media items matching the passed filter</returns>
- public override IEnumerable<MediaInformation> GetMediaInformations(ContentFilter filter)
- {
- List<MediaInformation> mediaContents = new List<MediaInformation>();
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
-
- Interop.Tag.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) =>
- {
- Interop.MediaInformation.SafeMediaInformationHandle newHandle;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
-
- MediaContentType type;
- Interop.MediaInformation.GetMediaType(newHandle, out type);
- if (type == MediaContentType.Image)
- {
- Interop.ImageInformation.SafeImageInformationHandle imageInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
-
- mediaContents.Add(new ImageInformation(imageInfo, newHandle));
- }
- else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
- {
- Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
-
- mediaContents.Add(new AudioInformation(audioInfo, newHandle));
- }
- else if (type == MediaContentType.Video)
- {
- Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
-
- mediaContents.Add(new VideoInformation(videoInfo, newHandle));
- }
- else if (type == MediaContentType.Others)
- {
- mediaContents.Add(new MediaInformation(newHandle));
- }
-
- return true;
- };
-
- MediaContentValidator.ThrowIfError(
- Interop.Tag.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information");
-
- return mediaContents;
- }
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Provides commands to manage tags in the database.
+ /// </summary>
+ /// <seealso cref="Tag"/>
+ public class TagCommand : MediaCommand
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TagCommand"/> class with the specified <see cref="MediaDatabase"/>.
+ /// </summary>
+ /// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ public TagCommand(MediaDatabase database) : base(database)
+ {
+ }
+
+ /// <summary>
+ /// Retrieves the number of tags.
+ /// </summary>
+ /// <returns>The number of tags.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count()
+ {
+ return Count(arguments: null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of tags with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of tags filtered.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public int Count(CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Count(Interop.Tag.GetTagCount, arguments);
+ }
+
+
+ /// <summary>
+ /// Deletes a tag from the database.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="tagId">The tag id to delete.</param>
+ /// <returns>true if the matched record was found and deleted, otherwise false.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool Delete(int tagId)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ if (CommandHelper.Count(Interop.Tag.GetTagCount, $"{TagColumns.Id}={tagId}") == 0)
+ {
+ return false;
+ }
+
+ CommandHelper.Delete(Interop.Tag.Delete, tagId);
+ return true;
+ }
+
+
+ /// <summary>
+ /// Inserts a tag into the database with the specified name.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="name">The name of tag.</param>
+ /// <returns>The <see cref="Tag"/> instance that contains the record information inserted.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public Tag Insert(string name)
+ {
+ ValidateDatabase();
+
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (name.Length == 0)
+ {
+ throw new ArgumentException("Tag name can't be an empty string.");
+ }
+
+ Interop.Tag.Insert(name, out var handle).ThrowIfError("Failed to insert a new tag");
+
+ try
+ {
+ return new Tag(handle);
+ }
+ finally
+ {
+ Interop.Tag.Destroy(handle);
+ }
+ }
+
+ /// <summary>
+ /// Updates a tag with the specified name.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="tagId">The tag id to update.</param>
+ /// <param name="name">The new name.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ public bool UpdateName(int tagId, string name)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (CommandHelper.Count(Interop.Tag.GetTagCount, $"{TagColumns.Id}={tagId}") == 0)
+ {
+ return false;
+ }
+
+ Interop.Tag.Create(out var handle).ThrowIfError("Failed to update");
+
+ try
+ {
+ Interop.Tag.SetName(handle, name).ThrowIfError("Failed to update");
+ Interop.Tag.Update(tagId, handle).ThrowIfError("Failed to update");
+
+ return true;
+ }
+ finally
+ {
+ Interop.Tag.Destroy(handle);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the tag with the specified id.
+ /// </summary>
+ /// <param name="tagId">The tag id to select.</param>
+ /// <returns>The <see cref="Tag"/> instance if the matched record was found in the database, otherwise null.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public Tag Select(int tagId)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ IntPtr handle = IntPtr.Zero;
+
+ try
+ {
+ Interop.Tag.GetTagFromDb(tagId, out handle).ThrowIfError("Failed to query");
+
+ if (handle == IntPtr.Zero)
+ {
+ return null;
+ }
+ return new Tag(handle);
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Tag.Destroy(handle);
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Retrieves all the tags.
+ /// </summary>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Tag> Select()
+ {
+ return Select(arguments: null);
+ }
+
+ /// <summary>
+ /// Retrieves the tags with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ public MediaDataReader<Tag> Select(SelectArguments arguments)
+ {
+ ValidateDatabase();
+
+ return CommandHelper.Select(arguments, Interop.Tag.ForeachTagFromDb, Tag.FromHandle);
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info of the tag.
+ /// </summary>
+ /// <param name="tagId">The tag id.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public int CountMedia(int tagId)
+ {
+ return CountMedia(tagId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the number of media info of the tag with <see cref="CountArguments"/>.
+ /// </summary>
+ /// <param name="tagId">The tag id to query with.</param>
+ /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The number of media info.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public int CountMedia(int tagId, CountArguments arguments)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ return CommandHelper.Count(Interop.Tag.GetMediaCount, tagId, arguments);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of the tag.
+ /// </summary>
+ /// <param name="tagId">The tag id.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(int tagId)
+ {
+ return SelectMedia(tagId, null);
+ }
+
+ /// <summary>
+ /// Retrieves the media info of the tag with <see cref="SelectArguments"/>.
+ /// </summary>
+ /// <param name="tagId">The tag id.</param>
+ /// <param name="filter">The criteria to use to filter. This value can be null.</param>
+ /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public MediaDataReader<MediaInfo> SelectMedia(int tagId, SelectArguments filter)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ return CommandHelper.SelectMedia(Interop.Tag.ForeachMediaFromDb, tagId, filter);
+ }
+
+ private bool UpdateMember(int tagId, IEnumerable<string> mediaIds,
+ Func<IntPtr, string, MediaContentError> func)
+ {
+ ValidateDatabase();
+
+ if (tagId <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(tagId), tagId,
+ "Tag id can't be less than or equal to zero.");
+ }
+
+ if (mediaIds == null)
+ {
+ throw new ArgumentNullException(nameof(mediaIds));
+ }
+
+ if (mediaIds.Count() == 0)
+ {
+ throw new ArgumentException("mediaIds has no element.", nameof(mediaIds));
+ }
+
+ if (CommandHelper.Count(Interop.Tag.GetTagCount, $"{TagColumns.Id}={tagId}") == 0)
+ {
+ return false;
+ }
+
+ IntPtr handle = IntPtr.Zero;
+ Interop.Tag.Create(out handle).ThrowIfError("Failed to initialize update member operation");
+
+ try
+ {
+ foreach (var mediaId in mediaIds)
+ {
+ if (mediaId == null)
+ {
+ throw new ArgumentException("Media id should not be null.", nameof(mediaIds));
+ }
+
+ if (string.IsNullOrWhiteSpace(mediaId))
+ {
+ throw new ArgumentException("Media id should not be a zero-length string.", nameof(mediaId));
+ }
+
+ func(handle, mediaId).ThrowIfError("Failed to update member");
+ }
+
+ Interop.Tag.Update(tagId, handle).ThrowIfError("Failed to run member update");
+ return true;
+ }
+ finally
+ {
+ if (handle != IntPtr.Zero)
+ {
+ Interop.Tag.Destroy(handle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds media to a tag.
+ /// </summary>
+ /// <param name="tagId">The tag id that the media will be added to.</param>
+ /// <param name="mediaId">The media id to add to the tag.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid media id will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public bool AddMedia(int tagId, string mediaId)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return AddMedia(tagId, new string[] { mediaId });
+ }
+
+ /// <summary>
+ /// Adds a media set to a tag.
+ /// </summary>
+ /// <param name="tagId">The tag id that the media will be added to.</param>
+ /// <param name="mediaIds">The media id to add to the tag.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid media ids will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaIds"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaIds"/> has no element.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains null value.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains a zero-length string, contains only white space.\n
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public bool AddMedia(int tagId, IEnumerable<string> mediaIds)
+ {
+ return UpdateMember(tagId, mediaIds, Interop.Tag.AddMedia);
+ }
+
+ /// <summary>
+ /// Removes media from a tag.
+ /// </summary>
+ /// <param name="tagId">The tag id.</param>
+ /// <param name="mediaId">The media id to remove from the tag.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid media id will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public bool RemoveMedia(int tagId, string mediaId)
+ {
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+
+ return RemoveMedia(tagId, new string[] { mediaId });
+ }
+
+ /// <summary>
+ /// Removes a media set from a tag.
+ /// </summary>
+ /// <param name="tagId">The tag id.</param>
+ /// <param name="mediaIds">The collection of media id to remove from the tag.</param>
+ /// <returns>true if the matched record was found and updated, otherwise false.</returns>
+ /// <remarks>The invalid ids will be ignored.</remarks>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaIds"/> is null.</exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaIds"/> has no element.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains null value.\n
+ /// -or-\n
+ /// <paramref name="mediaIds"/> contains a zero-length string or white space.\n
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="tagId"/> is less than or equal to zero.</exception>
+ public bool RemoveMedia(int tagId, IEnumerable<string> mediaIds)
+ {
+ return UpdateMember(tagId, mediaIds, Interop.Tag.RemoveMedia);
+ }
+ }
+}
--- /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.Content.MediaContent
+{
+ /// <summary>
+ /// The exception that is thrown when a requested operation is not supported for content.
+ /// </summary>
+ public class UnsupportedContentException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UnsupportedContentException"/> class.
+ /// </summary>
+ public UnsupportedContentException() : base("The operation is not supported for the given media.")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UnsupportedContentException"/> class with a specified error message.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ public UnsupportedContentException(string message) : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UnsupportedContentException"/> class with a specified error message
+ /// and a reference to the inner exception that is the cause of this exception.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception.</param>
+ public UnsupportedContentException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}
--- /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.Content.MediaContent
+{
+ internal static class ValidationUtil
+ {
+ internal static void ValidateEnum(Type enumType, object value, string paramName)
+ {
+ if (!Enum.IsDefined(enumType, value))
+ {
+ throw new ArgumentException($"Invalid { enumType.Name } value : { value }", paramName);
+ }
+ }
+
+ internal static void ValidateNotNullOrEmpty(string value, string paramName)
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(paramName);
+ }
+
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException($"{paramName} is a zero-length string.", paramName);
+ }
+ }
+ }
+}
--- /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;
+
+namespace Tizen.Content.MediaContent
+{
+ /// <summary>
+ /// Represents a video media information.
+ /// </summary>
+ public class VideoInfo : MediaInfo
+ {
+ internal VideoInfo(Interop.MediaInfoHandle handle) : base(handle)
+ {
+ IntPtr videoHandle = IntPtr.Zero;
+
+ try
+ {
+ Interop.MediaInfo.GetVideo(handle, out videoHandle).ThrowIfError("Failed to retrieve data");
+
+ Debug.Assert(videoHandle != IntPtr.Zero);
+
+ Album = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbum);
+ Artist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetArtist);
+ AlbumArtist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbumArtist);
+ Genre = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetGenre);
+ Composer = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetComposer);
+ Year = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetYear);
+ DateRecorded = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetRecordedDate);
+ Copyright = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetCopyright);
+ TrackNumber = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetTrackNum);
+
+ BitRate = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetBitRate);
+ Duration = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetDuration);
+ Width = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetWidth);
+ Height = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetHeight);
+ }
+ finally
+ {
+ Interop.VideoInfo.Destroy(videoHandle);
+ }
+ }
+
+ /// <summary>
+ /// Gets the album name.
+ /// </summary>
+ /// <value>The album name from the metadata.</value>
+ public string Album { get; }
+
+ /// <summary>
+ /// Gets the artist name.
+ /// </summary>
+ /// <value>The artist name from the metadata.</value>
+ public string Artist { get; }
+
+ /// <summary>
+ /// Gets the album artist name.
+ /// </summary>
+ /// <value>The album artist name from the metadata.</value>
+ public string AlbumArtist { get; }
+
+ /// <summary>
+ /// Gets the genre.
+ /// </summary>
+ /// <value>The genre name from the metadata.</value>
+ public string Genre { get; }
+
+ /// <summary>
+ /// Gets the composer name.
+ /// </summary>
+ /// <value>The composer name from the metadata.</value>
+ public string Composer { get; }
+
+ /// <summary>
+ /// Gets the year.
+ /// </summary>
+ /// <value>The year from the metadata.</value>
+ public string Year { get; }
+
+ /// <summary>
+ /// Gets the recorded date.
+ /// </summary>
+ /// <value>The recorded date information from the metadata if exists; otherwise, the modified date of the file.</value>
+ public string DateRecorded { get; }
+
+ /// <summary>
+ /// Gets the copyright notice.
+ /// </summary>
+ /// <value>The copyright notice from the metadata.</value>
+ public string Copyright { get; }
+
+ /// <summary>
+ /// Gets the track number.
+ /// </summary>
+ /// <value>The track number from the metadata.</value>
+ public string TrackNumber { get; }
+
+ /// <summary>
+ /// Gets the bitrate in bit per second.
+ /// </summary>
+ /// <value>The bit rate of the video.</value>
+ public int BitRate { get; }
+
+ /// <summary>
+ /// Gets the track duration in milliseconds.
+ /// </summary>
+ /// <value>The track duration of the video in milliseconds.</value>
+ public int Duration { get; }
+
+ /// <summary>
+ /// Gets the video width in pixels.
+ /// </summary>
+ /// <value>The width of the video in pixels.</value>
+ public int Width { get; }
+
+ /// <summary>
+ /// Gets the video height in pixels.
+ /// </summary>
+ /// <value>The height of the video in pixels.</value>
+ public int Height { get; }
+
+ }
+}
+++ /dev/null
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-using System.Collections.ObjectModel;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// VideoContent class API gives the information related to the image media stored in the device
- /// </summary>
- public class VideoInformation : MediaInformation
- {
- /// <summary>
- /// Gets the ID of the media.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string MediaId
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetMediaId(_handle, out val), "Failed to get value");
-
- return Marshal.PtrToStringAnsi(val);
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the album name.
- /// If the media content has no album information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Album
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetAlbum(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the artist name.
- /// If the media content has no artist information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Artist
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetArtist(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the album artist name.
- /// If the media content has no album artist information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string AlbumArtist
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetAlbumArtist(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the genre name.
- /// If the media content has no genre information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Genre
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetGenre(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the composer name.
- /// If the media content has no composer information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Composer
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetComposer(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the year.
- /// If the media content has no year information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Year
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetYear(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the recorded date.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string RecordedDate
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetRecordedDate(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the copyright notice.
- /// If the media content has no copyright information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Copyright
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetCopyright(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the track number.
- /// If the media content has no track information, the property returns empty string.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string TrackNumber
- {
- get
- {
- IntPtr val = IntPtr.Zero;
- try
- {
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetTrackNum(_handle, out val), "Failed to get value");
-
- return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val));
- }
- finally
- {
- Interop.Libc.Free(val);
- }
- }
- }
-
- /// <summary>
- /// Gets the bitrate in bit per second [bps].
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int BitRate
- {
- get
- {
- int bitrate = 0;
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetBitRate(_handle, out bitrate), "Failed to get value");
-
- return bitrate;
- }
- }
-
- /// <summary>
- /// Gets the track duration in Milliseconds.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Duration
- {
- get
- {
- int duration = 0;
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetDuration(_handle, out duration), "Failed to get value");
-
- return duration;
- }
- }
-
- /// <summary>
- /// Gets the video width in pixels.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Width
- {
- get
- {
- int width = 0;
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetWidth(_handle, out width), "Failed to get value");
-
- return width;
- }
- }
-
- /// <summary>
- /// Gets the video height in pixels.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Height
- {
- get
- {
- int height = 0;
- MediaContentValidator.ThrowIfError(
- Interop.VideoInformation.GetHeight(_handle, out height), "Failed to get value");
-
- return height;
- }
- }
-
- /// <summary>
- /// Gets the number of bookmarks for the passed filter in the given media ID from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// int count</returns>
- /// <param name="filter">The Filter for matching Bookmarks</param>
- public int GetMediaBookmarkCount(ContentFilter filter)
- {
- int count = 0;
- IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetBookmarkCount(MediaId, handle, out count), "Failed to get count");
-
- return count;
- }
-
- /// <summary>
- /// Iterates through the media bookmark in the given media info from the media database.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <returns>
- /// Task to get all the Bookmarks </returns>
- /// <param name="filter"> filter for the Tags</param>
- public IEnumerable<MediaBookmark> GetMediaBookmarks(ContentFilter filter)
- {
- Collection<MediaBookmark> result = new Collection<MediaBookmark>();
- IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero;
- Interop.MediaInformation.MediaBookmarkCallback callback = (IntPtr handle, IntPtr userData) =>
- {
- IntPtr newHandle = IntPtr.Zero;
- MediaContentValidator.ThrowIfError(
- Interop.MediaBookmark.Clone(out newHandle, handle), "Failed to clone Tag");
- result.Add(new MediaBookmark(newHandle));
- return true;
- };
- MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.GetAllBookmarks(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value");
-
- return result;
- }
-
- /// <summary>
- /// Adds a bookmark to the video
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="offset">Offset of the video in seconds</param>
- /// <param name="thumbnailPath">Thumbnail path for the bookmark</param>
- /// <returns>Task with added MediaBookmark instance </returns>
- public MediaBookmark AddBookmark(uint offset, string thumbnailPath)
- {
- MediaBookmark result = null;
- ContentManager.Database.Insert(MediaId, offset, thumbnailPath);
- ContentFilter bookmarkfilter = new ContentFilter();
- bookmarkfilter.Condition = ContentColumns.Bookmark.Offset + " = " + offset;
- IEnumerable<MediaBookmark> bookmarksList = null;
- bookmarksList = GetMediaBookmarks(bookmarkfilter);
- foreach (MediaBookmark bookmark in bookmarksList)
- {
- if (bookmark.Offset == offset)
- {
- result = bookmark;
- break;
- }
- }
-
- bookmarkfilter.Dispose();
- return result;
- }
-
- /// <summary>
- /// Deletes a bookmark from the media database.
- /// For other types Unsupported exception is thrown.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// <param name="bookmark">The bookmark to be deleted</param>
- public void DeleteBookmark(MediaBookmark bookmark)
- {
- ContentManager.Database.Delete(bookmark);
- }
-
- internal IntPtr VideoHandle
- {
- get
- {
- return _handle.DangerousGetHandle();
- }
- }
-
- private readonly Interop.VideoInformation.SafeVideoInformationHandle _handle;
-
- internal VideoInformation(Interop.VideoInformation.SafeVideoInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle)
- : base(mediaInformationHandle)
- {
- _handle = handle;
- }
- }
-}
{
get
{
- if (_disposed)
- {
- throw new ObjectDisposedException(nameof(ScreenMirroring));
- }
+ ThrowIfDisposed();
return _handle;
}
internal void ThrowIfNotConnected()
{
+ ThrowIfDisposed();
+
if (IsConnected == false)
{
throw new InvalidOperationException("ScreenMirroring is not connected.");
DetachDisplay();
}
+ private void ThrowIfDisposed()
+ {
+ if (_disposed)
+ {
+ throw new ObjectDisposedException(nameof(ScreenMirroring));
+ }
+ }
+
/// <summary>
/// Releases all resource used by the <see cref="ScreenMirroring"/> object.
/// </summary>
/// <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()
{
/// 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>
+ /// <exception cref="ArgumentException"><paramref name="streamType"/> is invalid.</exception>
public AudioStreamPolicy(AudioStreamType streamType)
{
ValidationUtil.ValidateEnum(typeof(AudioStreamType), streamType, nameof(streamType));
/// it returns <see cref="AudioVolumeType.None"/>.
/// </remarks>
/// <value>The <see cref="AudioVolumeType"/> of the policy instance.</value>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public AudioVolumeType VolumeType
{
get
/// Gets the state of focus for playback.
/// </summary>
/// <value>The state of focus for playback.</value>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public AudioStreamFocusState PlaybackFocusState => GetFocusState(true);
/// <summary>
/// Gets the state of focus for recording.
/// </summary>
/// <value>The state of focus for recording.</value>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public AudioStreamFocusState RecordingFocusState => GetFocusState(false);
/// <summary>
/// If you don't want to reacquire the focus you've lost automatically,
/// disable the focus reacquisition.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public bool FocusReacquisitionEnabled
{
get
/// <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>
+ /// <exception cref="ArgumentException"><paramref name="options"/> is zero.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="options"/> contain a invalid bit.\n
+ /// -or-\n
+ /// <paramref name="behaviors"/> contain a invalid bit.\n
+ /// </exception>
+ /// <exception cref="InvalidOperationException">The focus has already been acquired.</exception>
+ /// <exception cref="AudioPolicyException">Called in <see cref="FocusStateChanged"/> raised by releasing focus.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public void AcquireFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
{
if (options == 0)
/// <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>
+ /// <exception cref="ArgumentException"><paramref name="options"/> is zero.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="options"/> contain a invalid bit.\n
+ /// -or-\n
+ /// <paramref name="behaviors"/> contain a invalid bit.\n
+ /// </exception>
+ /// <exception cref="InvalidOperationException">The focus has not been acquired.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public void ReleaseFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
{
if (options == 0)
/// </remarks>
/// <seealso cref="AddDeviceForStreamRouting(AudioDevice)"/>
/// <seealso cref="RemoveDeviceForStreamRouting(AudioDevice)"/>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
public void ApplyStreamRouting()
{
Interop.AudioStreamPolicy.ApplyStreamRouting(Handle).Validate("Failed to apply stream routing");
/// <remarks>
/// The available <see cref="AudioStreamType"/> is <see cref="AudioStreamType.Voip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
/// </remarks>
+ /// <exception cref="InvalidOperationException">
+ /// The device is not connected.\n
+ /// -or-\n
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ArgumentNullException"><paramref name="device"> is null.</exception>
+ /// <exception cref="AudioPolicyException"><see cref="AudioStreamType"/> of <paramref name="device"/> is unavailable for this.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
/// <seealso cref="AudioManager.GetConnectedDevices()"/>
/// <seealso cref="ApplyStreamRouting"/>
public void AddDeviceForStreamRouting(AudioDevice device)
{
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));
+ throw new InvalidOperationException("The device seems not connected.");
}
ret.Validate("Failed to add device for stream routing");
/// <remarks>
/// The available <see cref="AudioStreamType"/> is <see cref="AudioStreamType.Voip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
/// </remarks>
+ /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="device"> is null.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="AudioStreamPolicy"/> has already been disposed of.</exception>
+ /// <seealso cref="AudioManager.GetConnectedDevices()"/>
public void RemoveDeviceForStreamRouting(AudioDevice device)
{
if (device == null)
* limitations under the License.
*/
-using System;
using System.Runtime.InteropServices;
/// <summary>
* limitations under the License.
*/
-using System;
using System.Runtime.InteropServices;
/// <summary>
internal enum ContactsUsageType
{
- None, /**< None */
- OutgoingCall, /**< Outgoing Call */
- OutgoingMsg, /**< Outgoing message */
- OutgoingEmail, /**< Outgoing Email (Since 3.0) */
- IncomingCall, /**< Incoming Call (Since 3.0) */
- IncomingMsg, /**< Incoming message (Since 3.0) */
- IncomingEmail,/**< Incoming Email (Since 3.0) */
- MissedCall, /**< Missed Call (Since 3.0) */
- RejectedCall, /**< Rejected Call (Since 3.0) */
- BlockedCall, /**< Blocked Call (Since 3.0) */
- BlockedMsg /**< Blocked message (Since 3.0) */
+ None,
+ OutgoingCall,
+ OutgoingMsg,
+ OutgoingEmail,
+ IncomingCall,
+ IncomingMsg,
+ IncomingEmail,
+ MissedCall,
+ RejectedCall,
+ BlockedCall,
+ BlockedMsg
};
internal static partial class Person
* limitations under the License.
*/
-using System;
using System.Runtime.InteropServices;
/// <summary>
/// <summary>
/// Contacts Interop Class
/// </summary>
- internal static class Contacts
+ internal static class Service
{
[DllImport(Libraries.Contacts, EntryPoint = "contacts_connect")]
internal static extern int Connect();
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Tizen.Pims.Contacts
{
/// <summary>
+ /// Delegate for detecting the contacts database changes
+ /// </summary>
+ /// <param name="uri">The contacts view URI</param>
+ /// <remarks>
+ /// The delegate must be registered using AddDBChangedDelegate.
+ /// It's invoked when the designated view changes.
+ /// </remarks>
+ public delegate void ContactsDBChanged(string uri);
+
+ /// <summary>
/// ContactsDatabase provides methods to manage contacts information from/to the database.
/// </summary>
/// <remarks>
{
private Object thisLock = new Object();
private Interop.Database.ContactsDBStatusChangedCallback _contactsDBStatusChangedCallback;
- private event EventHandler<DBStatusChangedEventArgs> _dbStatusChanged;
- private Dictionary<string, ContactsDBChangedDelegate> _callbackMap = new Dictionary<string, ContactsDBChangedDelegate>();
- private Dictionary<string, Interop.Database.ContactsDBChangedCallback> _delegateMap = new Dictionary<string, Interop.Database.ContactsDBChangedCallback>();
+ private EventHandler<DBStatusChangedEventArgs> _dbStatusChanged;
+ private Dictionary<string, ContactsDBChanged> _delegateMap = new Dictionary<string, ContactsDBChanged>();
+ private Dictionary<string, Interop.Database.ContactsDBChangedCallback> _callbackMap = new Dictionary<string, Interop.Database.ContactsDBChangedCallback>();
private Interop.Database.ContactsDBChangedCallback _dbChangedDelegate;
- /// <summary>
- /// Delegete for detecting the contacts database changes
- /// </summary>
- /// <param name="uri">The contacts view URI</param>
- /// <remarks>
- /// The delegate must be registered using AddDBChangedDelegate.
- /// It's invoked when the designated view changes.
- /// </remarks>
- /// <see cref="AddDBChangedDelegate"/>
- public delegate void ContactsDBChangedDelegate(string uri);
internal ContactsDatabase()
{
- ///To be created in ContactsManager only.
+ /*To be created in ContactsManager only.*/
}
/// <summary>
/// <summary>
/// Enumeration for Contacts search range.
/// </summary>
- public enum SearchRange
+ [Flags]
+ public enum SearchRanges
{
/// <summary>
+ /// None
+ /// </summary>
+ None = 0,
+ /// <summary>
/// Search record from name
/// </summary>
Name = 0x00000001,
{
lock (thisLock)
{
- _contactsDBStatusChangedCallback = (DBStatus status, IntPtr userData) =>
+ if (_contactsDBStatusChangedCallback == null)
{
- DBStatusChangedEventArgs args = new DBStatusChangedEventArgs(status);
- _dbStatusChanged?.Invoke(this, args);
- };
-
- int error = Interop.Database.AddStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero);
- if ((int)ContactsError.None != error)
- {
- Log.Error(Globals.LogTag, "Add StatusChanged Failed with error " + error);
+ _contactsDBStatusChangedCallback = (DBStatus status, IntPtr userData) =>
+ {
+ DBStatusChangedEventArgs args = new DBStatusChangedEventArgs(status);
+ _dbStatusChanged?.Invoke(this, args);
+ };
}
- else
+
+ if (_dbStatusChanged == null)
{
- _dbStatusChanged += value;
+ int error = Interop.Database.AddStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero);
+ if ((int)ContactsError.None != error)
+ {
+ Log.Error(Globals.LogTag, "Add StatusChanged Failed with error " + error);
+ }
}
+
+ _dbStatusChanged += value;
}
}
{
lock (thisLock)
{
- int error = Interop.Database.RemoveStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero);
- if ((int)ContactsError.None != error)
+ _dbStatusChanged -= value;
+
+ if (_dbStatusChanged == null)
{
- Log.Error(Globals.LogTag, "Remove StatusChanged Failed with error " + error);
+ int error = Interop.Database.RemoveStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero);
+ if ((int)ContactsError.None != error)
+ {
+ Log.Error(Globals.LogTag, "Remove StatusChanged Failed with error " + error);
+ }
}
-
- _dbStatusChanged -= value;
}
}
/// <summary>
/// The current contacts database version.
/// </summary>
+ /// <value>The current contacts database version.</value>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public int Version
{
get
/// <summary>
/// The last successful changed contacts database version on the current connection.
/// </summary>
+ /// <value>The last successful changed contacts database version on the current connection.</value>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public int LastChangeVersion
{
get
/// <summary>
/// The contacts database status.
/// </summary>
+ /// <value>The contacts database status.</value>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public DBStatus Status
{
get
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public int Insert(ContactsRecord record)
{
int id = -1;
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public int[] Insert(ContactsList list)
{
IntPtr ids;
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsRecord Get(string viewUri, int recordId)
{
IntPtr handle;
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void Update(ContactsRecord record)
{
int error = Interop.Database.Update(record._recordHandle);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void Update(ContactsList list)
{
int error = Interop.Database.UpdateRecords(list._listHandle);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public void Delete(string viewUri, int recordId)
{
int error = Interop.Database.Delete(viewUri, recordId);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public void Delete(string viewUri, int[] idArray)
{
int error = Interop.Database.DeleteRecords(viewUri, idArray, idArray.Length);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void Replace(ContactsRecord record, int recordId)
{
int error = Interop.Database.Replace(record._recordHandle, recordId);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void Replace(ContactsList list, int[] idArray)
{
int error = Interop.Database.ReplaceRecords(list._listHandle, idArray, idArray.Length);
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsList GetAll(string viewUri, int offset, int limit)
{
IntPtr handle;
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public ContactsList GetRecordsWithQuery(ContactsQuery query, int offset, int limit)
{
IntPtr handle;
/// Retrieves records changes since the given database version.
/// </summary>
/// <param name="viewUri">The view URI to get records</param>
- /// <param name="addressbookId">The address book ID to filter</param>
+ /// <param name="addressBookId">The address book ID to filter</param>
/// <param name="contactsDBVersion">The contacts database version</param>
/// <param name="currentDBVersion">The current contacts database version</param>
/// <returns>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
- public ContactsList GetChangesByVersion(string viewUri, int addressbookId, int contactsDBVersion, out int currentDBVersion)
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
+ public ContactsList GetChangesByVersion(string viewUri, int addressBookId, int contactsDBVersion, out int currentDBVersion)
{
IntPtr recordList;
- int error = Interop.Database.GetChangesByVersion(viewUri, addressbookId, contactsDBVersion, out recordList,out currentDBVersion);
+ int error = Interop.Database.GetChangesByVersion(viewUri, addressBookId, contactsDBVersion, out recordList,out currentDBVersion);
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "GetChangesByVersion Failed with error " + error);
/// <param name="keyword">The keyword</param>
/// <param name="offset">The index from which to get results</param>
/// <param name="limit">The number to limit results(value 0 is used for get all records)</param>
- /// <returns></returns>
+ /// <returns>The record list</returns>
/// <privilege>http://tizen.org/privilege/contact.read</privilege>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsList Search(string viewUri, string keyword, int offset, int limit)
{
IntPtr recordList;
/// <param name="offset">The index from which to get results</param>
/// <param name="limit">The number to limit results(value 0 used for get all records)</param>
/// <returns>The record list</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public ContactsList Search(ContactsQuery query, string keyword, int offset, int limit)
{
IntPtr recordList;
/// <param name="limit">The number to limit results(value 0 is used for get all records)</param>
/// <param name="range">The search range, it should be a element of SearchRange or bitwise OR operation of them</param>
/// <returns>The record list</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsList Search(string viewUri, string keyword, int offset, int limit, int range)
{
IntPtr recordList;
/// <param name="endMatch">The text which is inserted into the fragment after the keyword(If NULL, default is "]")</param>
/// <param name="tokenNumber">The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home")</param>
/// <returns>The record list</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsList Search(string viewUri, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber)
{
IntPtr recordList;
/// <param name="endMatch">The text which is inserted into the fragment after the keyword(If NULL, default is "]")</param>
/// <param name="tokenNumber">The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home")</param>
/// <returns>The record list</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public ContactsList Search(ContactsQuery query, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber)
{
IntPtr recordList;
/// <param name="endMatch">The text which is inserted into the fragment after the keyword(If NULL, default is "]")</param>
/// <param name="tokenNumber">The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home")</param>
/// <returns>The record list</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsList Search(string viewUri, string keyword, int offset, int limit, int range, string startMatch, string endMatch, int tokenNumber)
{
IntPtr recordList;
/// </summary>
/// <param name="viewUri">The view URI</param>
/// <returns>The count of records</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public int GetCount(string viewUri)
{
int count = -1;
/// </summary>
/// <param name="query">The query used for filtering the results</param>
/// <returns>The count of records</returns>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public int GetCount(ContactsQuery query)
{
int count = -1;
/// </summary>
/// <param name="viewUri">The view URI of records whose changes are monitored</param>
/// <param name="callback">The callback function to register</param>
- public void AddDBChangedDelegate(string viewUri, ContactsDBChangedDelegate callback)
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
+ public void AddDBChangedDelegate(string viewUri, ContactsDBChanged callback)
{
- _dbChangedDelegate = (string uri, IntPtr userData) =>
+ if (_callbackMap[viewUri] == null)
{
- _callbackMap[uri](uri);
- };
- int error = Interop.Database.AddChangedCb(viewUri, _dbChangedDelegate, IntPtr.Zero);
- if ((int)ContactsError.None != error)
- {
- Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error);
- throw ContactsErrorFactory.CheckAndCreateException(error);
+ _callbackMap[viewUri] = (string uri, IntPtr userData) =>
+ {
+ _delegateMap[uri](uri);
+ };
+
+ int error = Interop.Database.AddChangedCb(viewUri, _callbackMap[viewUri], IntPtr.Zero);
+ if ((int)ContactsError.None != error)
+ {
+ Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error);
+ throw ContactsErrorFactory.CheckAndCreateException(error);
+ }
}
- _callbackMap[viewUri] = callback;
- _delegateMap[viewUri] = _dbChangedDelegate;
+
+ _delegateMap[viewUri] += callback;
}
/// <summary>
- /// Unregisters a callback function.
+ /// Deregisters a callback function.
/// </summary>
/// <param name="viewUri">The view URI of records whose changes are monitored</param>
/// <param name="callback">The callback function to register</param>
- public void RemoveDBChangedDelegate(string viewUri, ContactsDBChangedDelegate callback)
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
+ public void RemoveDBChangedDelegate(string viewUri, ContactsDBChanged callback)
{
- int error = Interop.Database.RemoveChangedCb(viewUri, _delegateMap[viewUri], IntPtr.Zero);
- if ((int)ContactsError.None != error)
+ _delegateMap[viewUri] -= callback;
+
+ if (_delegateMap[viewUri] == null)
{
- Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error);
- throw ContactsErrorFactory.CheckAndCreateException(error);
+ int error = Interop.Database.RemoveChangedCb(viewUri, _callbackMap[viewUri], IntPtr.Zero);
+ if ((int)ContactsError.None != error)
+ {
+ Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error);
+ throw ContactsErrorFactory.CheckAndCreateException(error);
+ }
+ _callbackMap.Remove(viewUri);
}
- _callbackMap.Remove(viewUri);
- _delegateMap.Remove(viewUri);
}
}
}
*/
using System;
-using System.Collections.Generic;
-using static Interop.Contacts;
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.Pims.Contacts
{
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsFilter(string viewUri, uint propertyId, StringMatchType matchType, string matchValue)
{
int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle);
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, int matchValue)
{
int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle);
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, long matchValue)
{
int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle);
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, double matchValue)
{
int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle);
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsFilter(string viewUri, uint propertyId, bool matchValue)
{
int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle);
}
}
+ /// <summary>
+ /// Destructor
+ /// </summary>
~ContactsFilter()
{
Dispose(false);
/// </summary>
public enum LogicalOperator
{
+ /// <summary>
+ /// AND
+ /// </summary>
And,
+ /// <summary>
+ /// OR
+ /// </summary>
Or,
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+ /// <summary>
+ /// Releases all resources used by the ContactsFilter.
+ /// </summary>
+ /// <param name="disposing">Disposing by User</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here
+ }
+
if (!disposedValue)
{
int error = Interop.Filter.ContactsFilterDestroy(_filterHandle);
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
Log.Error(Globals.LogTag, "ContactsList Failed with error " + error);
throw ContactsErrorFactory.CheckAndCreateException(error);
}
- _memoryPressure += count * ContactsViews.AverageSizeOfRecord;
+ _memoryPressure += count * ContactsViews.Record.AverageSize;
GC.AddMemoryPressure(_memoryPressure);
}
GC.AddMemoryPressure(_memoryPressure);
}
+ /// <summary>
+ /// Destructor
+ /// </summary>
~ContactsList()
{
Dispose(false);
/// <summary>
/// The count of contact entity.
/// </summary>
+ /// <value>The count of contact entity.</value>
public int Count
{
get
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+ /// <summary>
+ /// Releases all resources used by the ContactsList.
+ /// </summary>
+ /// <param name="disposing">Disposing by User</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here
+ }
+
if (!disposedValue)
{
int error = Interop.List.ContactsListDestroy(_listHandle, true);
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
throw ContactsErrorFactory.CheckAndCreateException(error);
}
record._disposedValue = true;
- _memoryPressure += ContactsViews.AverageSizeOfRecord;
+ _memoryPressure += ContactsViews.Record.AverageSize;
}
/// <summary>
throw ContactsErrorFactory.CheckAndCreateException(error);
}
record._disposedValue = false;
- _memoryPressure -= ContactsViews.AverageSizeOfRecord;
+ _memoryPressure -= ContactsViews.Record.AverageSize;
}
/// <summary>
*/
using System;
-using System.Collections.Generic;
-using static Interop.Contacts;
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.Pims.Contacts
{
{
private ContactsDatabase _db = null;
private Object thisLock = new Object();
- private Interop.Setting.DisplayOrderChangedCallback _displayOrderDelegate;
- private Interop.Setting.SortingOrderChangedCallback _sortingOrderDelegate;
+ private Interop.Setting.DisplayOrderChangedCallback _displayOrderChangedCallback;
+ private Interop.Setting.SortingOrderChangedCallback _sortingOrderChangedCallback;
/// <summary>
/// Creates a ContactsManager.
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
public ContactsManager()
{
- int error = Interop.Contacts.Connect();
+ int error = Interop.Service.Connect();
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Connect Failed with error " + error);
_db = new ContactsDatabase();
}
+ /// <summary>
+ /// Destructor
+ /// </summary>
~ContactsManager()
{
Dispose(false);
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+ /// <summary>
+ /// Releases all resources used by the ContactsManager.
+ /// </summary>
+ /// <param name="disposing">Disposing by User</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here
+ }
+
if (!disposedValue)
{
- int error = Interop.Contacts.Disconnect();
+ int error = Interop.Service.Disconnect();
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Disconnect Failed with error " + error);
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
- private event EventHandler<NameDisplayOrderChangedEventArgs> _nameDisplayOrderChanged;
- private event EventHandler<NameSortingOrderChangedEventArgs> _nameSortingOrderChanged;
+ private EventHandler<NameDisplayOrderChangedEventArgs> _nameDisplayOrderChanged;
+ private EventHandler<NameSortingOrderChangedEventArgs> _nameSortingOrderChanged;
/// <summary>
/// (event) NameDisplayOrderChanged is raised when changing setting value of contacts name display order
{
lock (thisLock)
{
- if (_displayOrderDelegate == null)
+ if (_displayOrderChangedCallback == null)
{
- _displayOrderDelegate = (ContactDisplayOrder nameDisplayOrder, IntPtr userData) =>
+ _displayOrderChangedCallback = (ContactDisplayOrder nameDisplayOrder, IntPtr userData) =>
{
NameDisplayOrderChangedEventArgs args = new NameDisplayOrderChangedEventArgs(nameDisplayOrder);
_nameDisplayOrderChanged?.Invoke(this, args);
if (_nameDisplayOrderChanged == null)
{
- int error = Interop.Setting.AddNameDisplayOrderChangedCB(_displayOrderDelegate, IntPtr.Zero);
+ int error = Interop.Setting.AddNameDisplayOrderChangedCB(_displayOrderChangedCallback, IntPtr.Zero);
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Add NameDisplayOrderChangedCB Failed with error " + error);
if (_nameDisplayOrderChanged == null)
{
- int error = Interop.Setting.RemoveNameDisplayOrderChangedCB(_displayOrderDelegate, IntPtr.Zero);
+ int error = Interop.Setting.RemoveNameDisplayOrderChangedCB(_displayOrderChangedCallback, IntPtr.Zero);
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Remove StateChanged Failed with error " + error);
{
lock (thisLock)
{
- if (_sortingOrderDelegate == null)
+ if (_sortingOrderChangedCallback == null)
{
- _sortingOrderDelegate = (ContactSortingOrder nameSortingOrder, IntPtr userData) =>
+ _sortingOrderChangedCallback = (ContactSortingOrder nameSortingOrder, IntPtr userData) =>
{
NameSortingOrderChangedEventArgs args = new NameSortingOrderChangedEventArgs(nameSortingOrder);
_nameSortingOrderChanged?.Invoke(this, args);
if (_nameSortingOrderChanged == null)
{
- int error = Interop.Setting.AddNameSortingOrderChangedCB(_sortingOrderDelegate, IntPtr.Zero);
+ int error = Interop.Setting.AddNameSortingOrderChangedCB(_sortingOrderChangedCallback, IntPtr.Zero);
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Add NameSortingOrderChangedCB Failed with error " + error);
if (_nameSortingOrderChanged == null)
{
- int error = Interop.Setting.RemoveNameSortingOrderChangedCB(_sortingOrderDelegate, IntPtr.Zero);
+ int error = Interop.Setting.RemoveNameSortingOrderChangedCB(_sortingOrderChangedCallback, IntPtr.Zero);
if ((int)ContactsError.None != error)
{
Log.Error(Globals.LogTag, "Remove StateChanged Failed with error " + error);
/// <summary>
/// A ContactsDatabase
/// </summary>
+ /// <value>A ContactsDatabase</value>
public ContactsDatabase Database
{
get
/// <summary>
/// A setting value of contacts name display order
/// </summary>
+ /// <value>A setting value of contacts name display order</value>
/// <remarks>
/// DisplayName of contacts returned from database are determined by this property
/// </remarks>
/// <privilege>http://tizen.org/privilege/contact.read</privilege>
/// <privilege>http://tizen.org/privilege/contact.write</privilege>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public ContactDisplayOrder NameDisplayOrder
{
get
/// <summary>
/// A setting value of contacts name sorting order
/// </summary>
+ /// <value>A setting value of contacts name sorting order</value>
/// <remarks>
/// Contacts returned from database are first sorted based on the first name or last name by this property
/// </remarks>
/// <privilege>http://tizen.org/privilege/contact.read</privilege>
/// <privilege>http://tizen.org/privilege/contact.write</privilege>
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public ContactSortingOrder NameSortingOrder
{
get
*/
using System;
-using static Interop.Contacts;
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.Pims.Contacts
{
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsQuery(string viewUri)
{
int error = Interop.Query.ContactsQueryCreate(viewUri, out _queryHandle);
_queryHandle = handle;
}
+ /// <summary>
+ /// Destructor
+ /// </summary>
~ContactsQuery()
{
Dispose(false);
#region IDisposable Support
private bool disposedValue = false;
+ /// <summary>
+ /// Releases all resources used by the ContactsQuery.
+ /// </summary>
+ /// <param name="disposing">Disposing by User</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here
+ }
+
if (!disposedValue)
{
int error = Interop.Query.ContactsQueryDestroy(_queryHandle);
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
*/
using System;
-using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Tizen.Pims.Contacts
{
private string _uri = null;
private uint _id;
- private Int64 _memoryPressure = ContactsViews.AverageSizeOfRecord;
+ private Int64 _memoryPressure = ContactsViews.Record.AverageSize;
internal IntPtr _recordHandle;
internal ContactsRecord(IntPtr handle)
/// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
public ContactsRecord(string viewUri)
{
int error = Interop.Record.Create(viewUri, out _recordHandle);
GC.AddMemoryPressure(_memoryPressure);
}
+ /// <summary>
+ /// Destructor
+ /// </summary>
~ContactsRecord()
{
Dispose(false);
/// <summary>
/// The URI of the record
/// </summary>
+ /// <value>The URI of the record</value>
+ [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
public string Uri
{
get
#region IDisposable Support
internal bool _disposedValue = false; // To detect redundant calls
+ /// <summary>
+ /// Releases all resources used by the ContactsRecord.
+ /// </summary>
+ /// <param name="disposing">Disposing by User</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here
+ }
+
if (!_disposedValue)
{
int error = Interop.Record.Destroy(_recordHandle, true);
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
*/
using System;
-using System.Collections.Generic;
-using static Interop.Contacts;
namespace Tizen.Pims.Contacts
{
- using static ContactsViews;
+ using ContactsViews;
+
+ /// <summary>
+ /// Delegate for getting a record parsed from a vCard file
+ /// </summary>
+ /// <param name="record">The contacts record</param>
+ /// <returns></returns>
+ public delegate bool ParseCallback(ContactsRecord record);
+
/// <summary>
/// A class for parsing and making vCards.
/// </summary>
/// </remarks>
public static class ContactsVcard
{
- public delegate bool ParseDelegate(ContactsRecord record);
-
/// <summary>
/// Retrieves the vCard stream from a contacts record.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
/// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
- public static void ParseForEach(string path, ParseDelegate callback)
+ public static void ParseForEach(string path, ParseCallback callback)
{
Interop.Vcard.ContactsVcardParseCallback cb = (IntPtr handle, IntPtr data) =>
{
* limitations under the License.
*/
+
using System;
-using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.Pims.Contacts
{
/// <summary>
- /// This class provides information about views with properties.
+ /// This namespace provides information about views with properties.
/// </summary>
/// <remarks>
/// Views are provided to access and handle entities. A view is a structure, which has property elements.
/// A "record" represents a single row of the views.
/// A record can have basic properties of five types: integer, string, boolean, long, double.
/// </remarks>
- public static class ContactsViews
+ namespace ContactsViews
{
- private const uint PropertyAddressBook = 0x00100000;
- private const uint PropertyGroup = 0x00200000;
- private const uint PropertyPerson = 0x00300000;
- private const uint PropertyData = 0x00600000;
- private const uint PropertySpeedDial = 0x00700000;
- private const uint PropertyPhonelog = 0x00800000;
- private const uint PropertyUpdateInfo = 0x00900000;
- private const uint PropertyPhonelogStat = 0x00B00000;
-
- private const uint PropertyContact = 0x01000000;
- private const uint PropertyName = 0x01100000;
- private const uint PropertyNumber = 0x01200000;
- private const uint PropertyEmail = 0x01300000;
- private const uint PropertyAddress = 0x01400000;
- private const uint PropertyUrl = 0x01500000;
- private const uint PropertyEvent = 0x01600000;
- private const uint PropertyGroupRelation = 0x01700000;
- private const uint PropertyRelationship = 0x01800000;
- private const uint PropertyCompany = 0x01900000;
- private const uint PropertyNickname = 0x01A00000;
- private const uint PropertyMessenger = 0x01B00000;
- private const uint PropertyNote = 0x01C00000;
- private const uint PropertyProfile = 0x01D00000;
- private const uint PropertyImage = 0x01E00000;
- private const uint PropertyExtension = 0x01F00000;
- private const uint PropertyMyProfile = 0x02000000;
- private const uint PropertyActivityPhoto = 0x02100000;
- private const uint PropertySip = 0x02200000;
-
- /* data_type mask 0x000FF000 */
- private const uint DataTypeBool = 0x00010000;
- private const uint DataTypeInt = 0x00020000;
- private const uint DataTypeLong = 0x00030000;
- private const uint DataTypeString = 0x00040000;
- private const uint DataTypeDouble = 0x00050000;
- private const uint DataTypeRecord = 0x00060000;
-
- private const uint ReadOnly = 0x00001000;
-
- private enum PropertyIds : uint
+ internal static class Property
+ {
+ private const uint AddressBook = 0x00100000;
+ private const uint Group = 0x00200000;
+ private const uint Person = 0x00300000;
+ private const uint Data = 0x00600000;
+ private const uint SpeedDial = 0x00700000;
+ private const uint Phonelog = 0x00800000;
+ private const uint UpdateInfo = 0x00900000;
+ private const uint PhonelogStat = 0x00B00000;
+
+ private const uint Contact = 0x01000000;
+ private const uint Name = 0x01100000;
+ private const uint Number = 0x01200000;
+ private const uint Email = 0x01300000;
+ private const uint Address = 0x01400000;
+ private const uint URL = 0x01500000;
+ private const uint Event = 0x01600000;
+ private const uint GroupRelation = 0x01700000;
+ private const uint Relationship = 0x01800000;
+ private const uint Company = 0x01900000;
+ private const uint Nickname = 0x01A00000;
+ private const uint Messenger = 0x01B00000;
+ private const uint Note = 0x01C00000;
+ private const uint Profile = 0x01D00000;
+ private const uint Image = 0x01E00000;
+ private const uint Extension = 0x01F00000;
+ private const uint MyProfile = 0x02000000;
+ private const uint ActivityPhoto = 0x02100000;
+ private const uint Sip = 0x02200000;
+
+ /* data_type mask 0x000FF000 */
+ private const uint DataTypeBool = 0x00010000;
+ private const uint DataTypeInt = 0x00020000;
+ private const uint DataTypeLong = 0x00030000;
+ private const uint DataTypeString = 0x00040000;
+ private const uint DataTypeDouble = 0x00050000;
+ private const uint DataTypeRecord = 0x00060000;
+
+ private const uint ReadOnly = 0x00001000;
+
+ internal enum Id : uint
+ {
+ None,
+
+ /* address book */
+ AddressBookId = (AddressBook | DataTypeInt | ReadOnly),
+ AddressBookAccountId = (AddressBook | DataTypeInt) + 1,
+ AddressBookName = (AddressBook | DataTypeString) + 2,
+ AddressBookMode = (AddressBook | DataTypeInt) + 3,
+
+ /* group */
+ GroupId = (Group | DataTypeInt | ReadOnly),
+ GroupAddressBookId = (Group | DataTypeInt) + 1,
+ GroupName = (Group | DataTypeString) + 2,
+ GroupRingtone = (Group | DataTypeString) + 3,
+ GroupImage = (Group | DataTypeString) + 4,
+ GroupVibration = (Group | DataTypeString) + 5,
+ GroupExtraData = (Group | DataTypeString) + 6,
+ GroupIsReadOnly = (Group | DataTypeBool) + 7,
+ GroupMessageAlert = (Group | DataTypeString) + 8,
+
+ /* person */
+ PersonId = (Person | DataTypeInt | ReadOnly),
+ PersonDisplayName = (Person | DataTypeString | ReadOnly) + 1,
+ PersonDisplayContactId = (Person | DataTypeInt) + 2,
+ PersonRingtone = (Person | DataTypeString) + 3,
+ PersonThumbnail = (Person | DataTypeString | ReadOnly) + 4,
+ PersonVibration = (Person | DataTypeString) + 5,
+ PersonIsFavorite = (Person | DataTypeBool) + 6,
+ PersonFavoritePriority = (Person | DataTypeDouble | ReadOnly) + 7,
+ PersonLinkCount = (Person | DataTypeInt | ReadOnly) + 8,
+ PersonAddressBookIds = (Person | DataTypeString | ReadOnly) + 9,
+ PersonHasPhoneNumber = (Person | DataTypeBool | ReadOnly) + 10,
+ PersonHasEmail = (Person | DataTypeBool | ReadOnly) + 11,
+ PersonDisplayNameIndex = (Person | DataTypeString | ReadOnly) + 12,
+ PersonStatus = (Person | DataTypeString | ReadOnly) + 13,
+ PersonMessageAlert = (Person | DataTypeString) + 14,
+ PersonSnippetType = (Person | DataTypeInt | ReadOnly) + 15,
+ PersonSnippetString = (Person | DataTypeString | ReadOnly) + 16,
+
+ /* person-stat */
+ PersonUsageType = (Person | DataTypeInt) + 100,
+ PersonTimesUsed = (Person | DataTypeInt) + 101,
+
+ /* simple contact : read only */
+ /* contact */
+ ContactId = (Contact | DataTypeInt | ReadOnly),
+ ContactDisplayName = (Contact | DataTypeString | ReadOnly) + 1,
+ ContactDisplaySourceDataId = (Contact | DataTypeInt | ReadOnly) + 2,
+ ContactAddressBookId = (Contact | DataTypeInt) + 3,
+ ContactRingtone = (Contact | DataTypeString) + 4,
+ ContactImage = (Contact | DataTypeRecord) + 5,
+ ContactThumbnail = (Contact | DataTypeString | ReadOnly) + 6,
+ ContactIsFavorite = (Contact | DataTypeBool) + 7,
+ ContactHasPhoneNumber = (Contact | DataTypeBool | ReadOnly) + 8,
+ ContactHasEmail = (Contact | DataTypeBool | ReadOnly) + 9,
+ ContactPersonId = (Contact | DataTypeInt) + 10,
+ ContactUId = (Contact | DataTypeString) + 11,
+ ContactVibration = (Contact | DataTypeString) + 12,
+ ContactChangedTime = (Contact | DataTypeInt | ReadOnly) + 13,
+ ContactName = (Contact | DataTypeRecord) + 14,
+ ContactCompany = (Contact | DataTypeRecord) + 15,
+ ContactNote = (Contact | DataTypeRecord) + 16,
+ ContactNumber = (Contact | DataTypeRecord) + 17,
+ ContactEmail = (Contact | DataTypeRecord) + 18,
+ ContactEvent = (Contact | DataTypeRecord) + 19,
+ ContactMessenger = (Contact | DataTypeRecord) + 20,
+ ContactAddress = (Contact | DataTypeRecord) + 21,
+ ContactURL = (Contact | DataTypeRecord) + 22,
+ ContactNickname = (Contact | DataTypeRecord) + 23,
+ ContactProfile = (Contact | DataTypeRecord) + 24,
+ ContactRelationship = (Contact | DataTypeRecord) + 25,
+ ContactGroupRelation = (Contact | DataTypeRecord) + 26,
+ ContactExtension = (Contact | DataTypeRecord) + 27,
+ ContactLinkMode = (Contact | DataTypeInt) + 28,
+ ContactMessageAlert = (Contact | DataTypeString) + 29,
+ ContactSip = (Contact | DataTypeRecord) + 30,
+
+ /* my_profile */
+ MyProfileId = (MyProfile | DataTypeInt | ReadOnly),
+ MyProfileDisplayName = (MyProfile | DataTypeString | ReadOnly) + 1,
+ MyProfileAddressBookId = (MyProfile | DataTypeInt) + 2,
+ MyProfileImage = (MyProfile | DataTypeRecord) + 3,
+ MyProfileThumbnail = (MyProfile | DataTypeString | ReadOnly) + 4,
+ MyProfileUId = (MyProfile | DataTypeString) + 5,
+ MyProfileChangedTime = (MyProfile | DataTypeInt) + 6,
+ MyProfileName = (MyProfile | DataTypeRecord) + 7,
+ MyProfileCompany = (MyProfile | DataTypeRecord) + 8,
+ MyProfileNote = (MyProfile | DataTypeRecord) + 9,
+ MyProfileNumber = (MyProfile | DataTypeRecord) + 10,
+ MyProfileEmail = (MyProfile | DataTypeRecord) + 11,
+ MyProfileEvent = (MyProfile | DataTypeRecord) + 12,
+ MyProfileMessenger = (MyProfile | DataTypeRecord) + 13,
+ MyProfileAddress = (MyProfile | DataTypeRecord) + 14,
+ MyProfileURL = (MyProfile | DataTypeRecord) + 15,
+ MyProfileNickname = (MyProfile | DataTypeRecord) + 16,
+ MyProfileProfile = (MyProfile | DataTypeRecord) + 17,
+ MyProfileRelationship = (MyProfile | DataTypeRecord) + 18,
+ MyProfileExtension = (MyProfile | DataTypeRecord) + 19,
+ MyProfileSip = (MyProfile | DataTypeRecord) + 20,
+
+ /* data */
+ DataId = (Data | DataTypeInt),
+ DataContactId = (Data | DataTypeInt) + 1,
+ DataType = (Data | DataTypeInt) + 2,
+ DataIsPrimaryDefault = (Data | DataTypeBool) + 3,
+ DataIsDefault = (Data | DataTypeBool) + 4,
+ DataData1 = (Data | DataTypeInt) + 5,
+ DataData2 = (Data | DataTypeString) + 6,
+ DataData3 = (Data | DataTypeString) + 7,
+ DataData4 = (Data | DataTypeString) + 8,
+ DataData5 = (Data | DataTypeString) + 9,
+ DataData6 = (Data | DataTypeString) + 10,
+ DataData7 = (Data | DataTypeString) + 11,
+ DataData8 = (Data | DataTypeString) + 12,
+ DataData9 = (Data | DataTypeString) + 13,
+ DataData10 = (Data | DataTypeString) + 14,
+
+ /* contact_name */
+ NameId = (Name | DataTypeInt | ReadOnly),
+ NameContactId = (Name | DataTypeInt) + 1,
+ NameFirst = (Name | DataTypeString) + 2,
+ NameLast = (Name | DataTypeString) + 3,
+ NameAddition = (Name | DataTypeString) + 4,
+ NameSuffix = (Name | DataTypeString) + 5,
+ NamePrefix = (Name | DataTypeString) + 6,
+ NamePhoneticFirst = (Name | DataTypeString) + 7,
+ NamePhoneticMiddle = (Name | DataTypeString) + 8,
+ NamePhoneticLast = (Name | DataTypeString) + 9,
+
+ /* contact_number */
+ NumberId = (Number | DataTypeInt | ReadOnly),
+ NumberContactId = (Number | DataTypeInt) + 1,
+ NumberType = (Number | DataTypeInt) + 2,
+ NumberLabel = (Number | DataTypeString) + 3,
+ NumberIsDefault = (Number | DataTypeBool) + 4,
+ NumberNumber = (Number | DataTypeString) + 5,
+ NumberNumberFilter = (Number | DataTypeString) + 6,
+ NumberNormalizedNumber = (Number | DataTypeString | ReadOnly) + 7,
+ NumberCleanedNumber = (Number | DataTypeString | ReadOnly) + 8,
+
+ /* contact_email */
+ EmailId = (Email | DataTypeInt | ReadOnly),
+ EmailContactId = (Email | DataTypeInt) + 1,
+ EmailType = (Email | DataTypeInt) + 2,
+ EmailLabel = (Email | DataTypeString) + 3,
+ EmailIsDefault = (Email | DataTypeBool) + 4,
+ EmailEmail = (Email | DataTypeString) + 5,
+
+ /* contact_address */
+ AddressId = (Address | DataTypeInt | ReadOnly),
+ AddressContactId = (Address | DataTypeInt) + 1,
+ AddressType = (Address | DataTypeInt) + 2,
+ AddressLabel = (Address | DataTypeString) + 3,
+ AddressPostbox = (Address | DataTypeString) + 4,
+ AddressPostalCode = (Address | DataTypeString) + 5,
+ AddressRegion = (Address | DataTypeString) + 6,
+ AddressLocality = (Address | DataTypeString) + 7,
+ AddressStreet = (Address | DataTypeString) + 8,
+ AddressCountry = (Address | DataTypeString) + 9,
+ AddressExtended = (Address | DataTypeString) + 10,
+ AddressIsDefault = (Address | DataTypeBool) + 11,
+
+ /* contact_url */
+ URLId = (URL | DataTypeInt | ReadOnly),
+ URLContactId = (URL | DataTypeInt) + 1,
+ URLType = (URL | DataTypeInt) + 2,
+ URLLabel = (URL | DataTypeString) + 3,
+ URLData = (URL | DataTypeString) + 4,
+
+ /* contact_event */
+ EventId = (Event | DataTypeInt | ReadOnly),
+ EventContactId = (Event | DataTypeInt) + 1,
+ EventType = (Event | DataTypeInt) + 2,
+ EventLabel = (Event | DataTypeString) + 3,
+ EventDate = (Event | DataTypeInt) + 4,
+ EventCalendarType = (Event | DataTypeInt) + 5,
+ EventIsLeapMonth = (Event | DataTypeBool) + 6,
+
+ /* contact_grouprelation */
+ GroupRelationId = (GroupRelation | DataTypeInt | ReadOnly),
+ GroupRelationGroupId = (GroupRelation | DataTypeInt) + 1,
+ GroupRelationContactId = (GroupRelation | DataTypeInt) + 2,
+ GroupRelationGroupName = (GroupRelation | DataTypeString) + 3,
+
+ /* contact_relationship */
+ RelationshipId = (Relationship | DataTypeInt | ReadOnly),
+ RelationshipContactId = (Relationship | DataTypeInt) + 1,
+ RelationshipType = (Relationship | DataTypeInt) + 2,
+ RelationshipLabel = (Relationship | DataTypeString) + 3,
+ RelationshipName = (Relationship | DataTypeString) + 4,
+
+ /* contact_image */
+ ImageId = (Image | DataTypeInt | ReadOnly),
+ ImageContactId = (Image | DataTypeInt) + 1,
+ ImageType = (Image | DataTypeInt) + 2,
+ ImageLabel = (Image | DataTypeString) + 3,
+ ImagePath = (Image | DataTypeString) + 4,
+ ImageIsDefault = (Image | DataTypeBool) + 5,
+
+ /* contact_company */
+ CompanyId = (Company | DataTypeInt | ReadOnly),
+ CompanyContactId = (Company | DataTypeInt) + 1,
+ CompanyType = (Company | DataTypeInt) + 2,
+ CompanyLabel = (Company | DataTypeString) + 3,
+ CompanyName = (Company | DataTypeString) + 4,
+ CompanyDepartment = (Company | DataTypeString) + 5,
+ CompanyJobTitle = (Company | DataTypeString) + 6,
+ CompanyRole = (Company | DataTypeString) + 7,
+ CompanyAssistantName = (Company | DataTypeString) + 8,
+ CompanyLogo = (Company | DataTypeString) + 9,
+ CompanyLocation = (Company | DataTypeString) + 10,
+ CompanyDescription = (Company | DataTypeString) + 11,
+ CompanyPhoneticName = (Company | DataTypeString) + 12,
+
+ /* contact_nickname */
+ NicknameId = (Nickname | DataTypeInt | ReadOnly),
+ NicknameContactId = (Nickname | DataTypeInt) + 1,
+ NicknameName = (Nickname | DataTypeString) + 2,
+
+ /* contact_messenger */
+ MessengerId = (Messenger | DataTypeInt | ReadOnly),
+ MessengerContactId = (Messenger | DataTypeInt) + 1,
+ MessengerType = (Messenger | DataTypeInt) + 2,
+ MessengerLabel = (Messenger | DataTypeString) + 3,
+ MessengerIMId = (Messenger | DataTypeString) + 4,
+
+ /* contact_note */
+ NoteId = (Note | DataTypeInt | ReadOnly),
+ NoteContactId = (Note | DataTypeInt) + 1,
+ NoteNote = (Note | DataTypeString) + 2,
+
+ /* contact sip */
+ SipId = (Sip | DataTypeInt | ReadOnly),
+ SipContactId = (Sip | DataTypeInt) + 1,
+ SipAddress = (Sip | DataTypeString) + 2,
+ SipType = (Sip | DataTypeInt) + 3,
+ SipLabel = (Sip | DataTypeString) + 4,
+
+ /* contact_profile */
+ ProfileId = (Profile | DataTypeInt | ReadOnly),
+ ProfileContactId = (Profile | DataTypeInt) + 1,
+ ProfileUId = (Profile | DataTypeString) + 2,
+ ProfileText = (Profile | DataTypeString) + 3,
+ ProfileOrder = (Profile | DataTypeInt) + 4,
+ ProfileServiceOperation = (Profile | DataTypeString) + 5,
+ ProfileMIME = (Profile | DataTypeString) + 6,
+ ProfileAppId = (Profile | DataTypeString) + 7,
+ ProfileUri = (Profile | DataTypeString) + 8,
+ ProfileCategory = (Profile | DataTypeString) + 9,
+ ProfileExtraData = (Profile | DataTypeString) + 10,
+
+ ExtensionId = (Extension | DataTypeInt | ReadOnly),
+ ExtensionContactId = (Extension | DataTypeInt) + 1,
+ ExtensionData1 = (Extension | DataTypeInt) + 2,
+ ExtensionData2 = (Extension | DataTypeString) + 3,
+ ExtensionData3 = (Extension | DataTypeString) + 4,
+ ExtensionData4 = (Extension | DataTypeString) + 5,
+ ExtensionData5 = (Extension | DataTypeString) + 6,
+ ExtensionData6 = (Extension | DataTypeString) + 7,
+ ExtensionData7 = (Extension | DataTypeString) + 8,
+ ExtensionData8 = (Extension | DataTypeString) + 9,
+ ExtensionData9 = (Extension | DataTypeString) + 10,
+ ExtensionData10 = (Extension | DataTypeString) + 11,
+ ExtensionData11 = (Extension | DataTypeString) + 12,
+ ExtensionData12 = (Extension | DataTypeString) + 13,
+
+ /* speeddial */
+ SpeedDialDialNumber = (SpeedDial | DataTypeInt),
+ SpeedDialNumberId = (SpeedDial | DataTypeInt) + 1,
+ SpeedDialNumber = (SpeedDial | DataTypeString | ReadOnly) + 2,
+ SpeedDialNumberLabel = (SpeedDial | DataTypeString | ReadOnly) + 3,
+ SpeedDialNumberType = (SpeedDial | DataTypeInt | ReadOnly) + 4,
+ SpeedDialPersonId = (SpeedDial | DataTypeInt | ReadOnly) + 5,
+ SpeedDialDisplayName = (SpeedDial | DataTypeString | ReadOnly) + 6,
+ SpeedDialThumbnail = (SpeedDial | DataTypeString | ReadOnly) + 7,
+ SpeedDialNormalizedNumber = (SpeedDial | DataTypeString | ReadOnly) + 8,
+ SpeedDialCleanedNumber = (SpeedDial | DataTypeString | ReadOnly) + 9,
+ SpeedDialNumberFilter = (SpeedDial | DataTypeString | ReadOnly) + 10,
+
+ /* phonelog */
+ PhonelogId = (Phonelog | DataTypeInt | ReadOnly),
+ PhonelogPersonId = (Phonelog | DataTypeInt) + 1,
+ PhonelogAddress = (Phonelog | DataTypeString) + 2,
+ PhonelogLogTime = (Phonelog | DataTypeInt) + 3,
+ PhonelogLogType = (Phonelog | DataTypeInt) + 4,
+ PhonelogExtraData1 = (Phonelog | DataTypeInt) + 5,
+ PhonelogExtraData2 = (Phonelog | DataTypeString) + 6,
+ PhonelogNormalizedAddress = (Phonelog | DataTypeString | ReadOnly) + 7,
+ PhonelogCleanedAddress = (Phonelog | DataTypeString | ReadOnly) + 8,
+ PhonelogAddressFilter = (Phonelog | DataTypeString | ReadOnly) + 9,
+ PhonelogSIMSlotNo = (Phonelog | DataTypeInt) + 10,
+
+ /* phonelog_stat */
+ PhonelogStatLogCount = (PhonelogStat | DataTypeInt | ReadOnly),
+ PhonelogStatLogType = (PhonelogStat | DataTypeInt | ReadOnly) + 1,
+ PhonelogStatSIMSlotNo = (PhonelogStat | DataTypeInt | ReadOnly) + 2,
+
+ /* updated_info : read only */
+ UpdateInfoId = (UpdateInfo | DataTypeInt),
+ UpdateInfoAddressBookId = (UpdateInfo | DataTypeInt) + 1,
+ UpdateInfoType = (UpdateInfo | DataTypeInt) + 2,
+ UpdateInfoVersion = (UpdateInfo | DataTypeInt) + 3,
+ UpdateInfoImageChanged = (UpdateInfo | DataTypeBool) + 4,
+ UpdateInfoLastChangedType = (UpdateInfo | DataTypeInt) + 5,
+ }
+ }
+
+ internal static class Record
{
- /* addressbook */
- AddressbookId = (PropertyAddressBook | DataTypeInt | ReadOnly),
- AddressbookAccountId = (PropertyAddressBook | DataTypeInt) + 1,
- AddressbookName = (PropertyAddressBook | DataTypeString) + 2,
- AddressbookMode = (PropertyAddressBook | DataTypeInt) + 3,
-
- /* group */
- GroupId = (PropertyGroup | DataTypeInt | ReadOnly),
- GroupAddressbookId = (PropertyGroup | DataTypeInt) + 1,
- GroupName = (PropertyGroup | DataTypeString) + 2,
- GroupRingtone = (PropertyGroup | DataTypeString) + 3,
- GroupImage = (PropertyGroup | DataTypeString) + 4,
- GroupVibration = (PropertyGroup | DataTypeString) + 5,
- GroupExtraData = (PropertyGroup | DataTypeString) + 6,
- GroupIsReadOnly = (PropertyGroup | DataTypeBool) + 7,
- GroupMessageAlert = (PropertyGroup | DataTypeString) + 8,
-
- /* person */
- PersonId = (PropertyPerson | DataTypeInt | ReadOnly),
- PersonDisplayName = (PropertyPerson | DataTypeString | ReadOnly) + 1,
- PersonDisplayContactId = (PropertyPerson | DataTypeInt) + 2,
- PersonRingtone = (PropertyPerson | DataTypeString) + 3,
- PersonThumbnail = (PropertyPerson | DataTypeString | ReadOnly) + 4,
- PersonVibration = (PropertyPerson | DataTypeString) + 5,
- PersonIsFavorite = (PropertyPerson | DataTypeBool) + 6,
- PersonFavoritePriority = (PropertyPerson | DataTypeDouble | ReadOnly) + 7,
- PersonLinkCount = (PropertyPerson | DataTypeInt | ReadOnly) + 8,
- PersonAddressbookIds = (PropertyPerson | DataTypeString | ReadOnly) + 9,
- PersonHasPhoneNumber = (PropertyPerson | DataTypeBool | ReadOnly) + 10,
- PersonHasEmail = (PropertyPerson | DataTypeBool | ReadOnly) + 11,
- PersonDisplayNameIndex = (PropertyPerson | DataTypeString | ReadOnly) + 12,
- PersonStatus = (PropertyPerson | DataTypeString | ReadOnly) + 13,
- PersonMessageAlert = (PropertyPerson | DataTypeString) + 14,
- PersonSnippetType = (PropertyPerson | DataTypeInt | ReadOnly) + 15,
- PersonSnippetString = (PropertyPerson | DataTypeString | ReadOnly) + 16,
-
- /* person-stat */
- PersonUsageType = (PropertyPerson | DataTypeInt) + 100,
- PersonTimesUsed = (PropertyPerson | DataTypeInt) + 101,
-
- /* simple contact : read only */
- /* contact */
- ContactId = (PropertyContact | DataTypeInt | ReadOnly),
- ContactDisplayName = (PropertyContact | DataTypeString | ReadOnly) + 1,
- ContactDisplaySourceDataId = (PropertyContact | DataTypeInt | ReadOnly) + 2,
- ContactAddressbookId = (PropertyContact | DataTypeInt) + 3,
- ContactRingtone = (PropertyContact | DataTypeString) + 4,
- ContactImage = (PropertyContact | DataTypeRecord) + 5,
- ContactThumbnail = (PropertyContact | DataTypeString | ReadOnly) + 6,
- ContactIsFavorite = (PropertyContact | DataTypeBool) + 7,
- ContactHasPhoneNumber = (PropertyContact | DataTypeBool | ReadOnly) + 8,
- ContactHasEmail = (PropertyContact | DataTypeBool | ReadOnly) + 9,
- ContactPersonId = (PropertyContact | DataTypeInt) + 10,
- ContactUid = (PropertyContact | DataTypeString) + 11,
- ContactVibration = (PropertyContact | DataTypeString) + 12,
- ContactChangedTime = (PropertyContact | DataTypeInt | ReadOnly) + 13,
- ContactName = (PropertyContact | DataTypeRecord) + 14,
- ContactCompany = (PropertyContact | DataTypeRecord) + 15,
- ContactNote = (PropertyContact | DataTypeRecord) + 16,
- ContactNumber = (PropertyContact | DataTypeRecord) + 17,
- ContactEmail = (PropertyContact | DataTypeRecord) + 18,
- ContactEvent = (PropertyContact | DataTypeRecord) + 19,
- ContactMessenger = (PropertyContact | DataTypeRecord) + 20,
- ContactAddress = (PropertyContact | DataTypeRecord) + 21,
- ContactUrl = (PropertyContact | DataTypeRecord) + 22,
- ContactNickname = (PropertyContact | DataTypeRecord) + 23,
- ContactProfile = (PropertyContact | DataTypeRecord) + 24,
- ContactRelationship = (PropertyContact | DataTypeRecord) + 25,
- ContactGroupRelation = (PropertyContact | DataTypeRecord) + 26,
- ContactExtension = (PropertyContact | DataTypeRecord) + 27,
- ContactLinkMode = (PropertyContact | DataTypeInt) + 28,
- ContactMessageAlert = (PropertyContact | DataTypeString) + 29,
- ContactSip = (PropertyContact | DataTypeRecord) + 30,
-
- /* my_profile */
- MyProfileId = (PropertyMyProfile | DataTypeInt | ReadOnly),
- MyProfileDisplayName = (PropertyMyProfile | DataTypeString | ReadOnly) + 1,
- MyProfileAddressbookId = (PropertyMyProfile | DataTypeInt) + 2,
- MyProfileImage = (PropertyMyProfile | DataTypeRecord) + 3,
- MyProfileThumbnail = (PropertyMyProfile | DataTypeString | ReadOnly) + 4,
- MyProfileUid = (PropertyMyProfile | DataTypeString) + 5,
- MyProfileChangedTime = (PropertyMyProfile | DataTypeInt) + 6,
- MyProfileName = (PropertyMyProfile | DataTypeRecord) + 7,
- MyProfileCompany = (PropertyMyProfile | DataTypeRecord) + 8,
- MyProfileNote = (PropertyMyProfile | DataTypeRecord) + 9,
- MyProfileNumber = (PropertyMyProfile | DataTypeRecord) + 10,
- MyProfileEmail = (PropertyMyProfile | DataTypeRecord) + 11,
- MyProfileEvent = (PropertyMyProfile | DataTypeRecord) + 12,
- MyProfileMessenger = (PropertyMyProfile | DataTypeRecord) + 13,
- MyProfileAddress = (PropertyMyProfile | DataTypeRecord) + 14,
- MyProfileUrl = (PropertyMyProfile | DataTypeRecord) + 15,
- MyProfileNickname = (PropertyMyProfile | DataTypeRecord) + 16,
- MyProfileProfile = (PropertyMyProfile | DataTypeRecord) + 17,
- MyProfileRelationship = (PropertyMyProfile | DataTypeRecord) + 18,
- MyProfileExtension = (PropertyMyProfile | DataTypeRecord) + 19,
- MyProfileSip = (PropertyMyProfile | DataTypeRecord) + 20,
-
- /* data */
- DataId = (PropertyData | DataTypeInt),
- DataContactId = (PropertyData | DataTypeInt) + 1,
- DataType = (PropertyData | DataTypeInt) + 2,
- DataIsPrimaryDefault = (PropertyData | DataTypeBool) + 3,
- DataIsDefault = (PropertyData | DataTypeBool) + 4,
- DataData1 = (PropertyData | DataTypeInt) + 5,
- DataData2 = (PropertyData | DataTypeString) + 6,
- DataData3 = (PropertyData | DataTypeString) + 7,
- DataData4 = (PropertyData | DataTypeString) + 8,
- DataData5 = (PropertyData | DataTypeString) + 9,
- DataData6 = (PropertyData | DataTypeString) + 10,
- DataData7 = (PropertyData | DataTypeString) + 11,
- DataData8 = (PropertyData | DataTypeString) + 12,
- DataData9 = (PropertyData | DataTypeString) + 13,
- DataData10 = (PropertyData | DataTypeString) + 14,
-
- /* contact_name */
- NameId = (PropertyName | DataTypeInt | ReadOnly),
- NameContactId = (PropertyName | DataTypeInt) + 1,
- NameFirst = (PropertyName | DataTypeString) + 2,
- NameLast = (PropertyName | DataTypeString) + 3,
- NameAddition = (PropertyName | DataTypeString) + 4,
- NameSuffix = (PropertyName | DataTypeString) + 5,
- NamePrefix = (PropertyName | DataTypeString) + 6,
- NamePhoneticFirst = (PropertyName | DataTypeString) + 7,
- NamePhoneticMiddle = (PropertyName | DataTypeString) + 8,
- NamePhoneticLast = (PropertyName | DataTypeString) + 9,
-
- /* contact_number */
- NumberId = (PropertyNumber | DataTypeInt | ReadOnly),
- NumberContactId = (PropertyNumber | DataTypeInt) + 1,
- NumberType = (PropertyNumber | DataTypeInt) + 2,
- NumberLabel = (PropertyNumber | DataTypeString) + 3,
- NumberIsDefault = (PropertyNumber | DataTypeBool) + 4,
- NumberNumber = (PropertyNumber | DataTypeString) + 5,
- NumberNumberFilter = (PropertyNumber | DataTypeString) + 6,
- NumberNormalizedNumber = (PropertyNumber | DataTypeString | ReadOnly) + 7,
- NumberCleanedNumber = (PropertyNumber | DataTypeString | ReadOnly) + 8,
-
- /* contact_email */
- EmailId = (PropertyEmail | DataTypeInt | ReadOnly),
- EmailContactId = (PropertyEmail | DataTypeInt) + 1,
- EmailType = (PropertyEmail | DataTypeInt) + 2,
- EmailLabel = (PropertyEmail | DataTypeString) + 3,
- EmailIsDefault = (PropertyEmail | DataTypeBool) + 4,
- EmailEmail = (PropertyEmail | DataTypeString) + 5,
-
- /* contact_address */
- AddressId = (PropertyAddress | DataTypeInt | ReadOnly),
- AddressContactId = (PropertyAddress | DataTypeInt) + 1,
- AddressType = (PropertyAddress | DataTypeInt) + 2,
- AddressLabel = (PropertyAddress | DataTypeString) + 3,
- AddressPostbox = (PropertyAddress | DataTypeString) + 4,
- AddressPostalCode = (PropertyAddress | DataTypeString) + 5,
- AddressRegion = (PropertyAddress | DataTypeString) + 6,
- AddressLocality = (PropertyAddress | DataTypeString) + 7,
- AddressStreet = (PropertyAddress | DataTypeString) + 8,
- AddressCountry = (PropertyAddress | DataTypeString) + 9,
- AddressExtended = (PropertyAddress | DataTypeString) + 10,
- AddressIsDefault = (PropertyAddress | DataTypeBool) + 11,
-
- /* contact_url */
- UrlId = (PropertyUrl | DataTypeInt | ReadOnly),
- UrlContactId = (PropertyUrl | DataTypeInt) + 1,
- UrlType = (PropertyUrl | DataTypeInt) + 2,
- UrlLabel = (PropertyUrl | DataTypeString) + 3,
- UrlUrl = (PropertyUrl | DataTypeString) + 4,
-
- /* contact_event */
- EventId = (PropertyEvent | DataTypeInt | ReadOnly),
- EventContactId = (PropertyEvent | DataTypeInt) + 1,
- EventType = (PropertyEvent | DataTypeInt) + 2,
- EventLabel = (PropertyEvent | DataTypeString) + 3,
- EventDate = (PropertyEvent | DataTypeInt) + 4,
- EventCalendarType = (PropertyEvent | DataTypeInt) + 5,
- EventIsLeapMonth = (PropertyEvent | DataTypeBool) + 6,
-
- /* contact_grouprelation */
- GroupRelationId = (PropertyGroupRelation | DataTypeInt | ReadOnly),
- GroupRelationGroupId = (PropertyGroupRelation | DataTypeInt) + 1,
- GroupRelationContactId = (PropertyGroupRelation | DataTypeInt) + 2,
- GroupRelationGroupName = (PropertyGroupRelation | DataTypeString) + 3,
-
- /* contact_relationship */
- RelationshipId = (PropertyRelationship | DataTypeInt | ReadOnly),
- RelationshipContactId = (PropertyRelationship | DataTypeInt) + 1,
- RelationshipType = (PropertyRelationship | DataTypeInt) + 2,
- RelationshipLabel = (PropertyRelationship | DataTypeString) + 3,
- RelationshipName = (PropertyRelationship | DataTypeString) + 4,
-
- /* contact_image */
- ImageId = (PropertyImage | DataTypeInt | ReadOnly),
- ImageContactId = (PropertyImage | DataTypeInt) + 1,
- ImageType = (PropertyImage | DataTypeInt) + 2,
- ImageLabel = (PropertyImage | DataTypeString) + 3,
- ImagePath = (PropertyImage | DataTypeString) + 4,
- ImageIsDefault = (PropertyImage | DataTypeBool) + 5,
-
- /* contact_company */
- CompanyId = (PropertyCompany | DataTypeInt | ReadOnly),
- CompanyContactId = (PropertyCompany | DataTypeInt) + 1,
- CompanyType = (PropertyCompany | DataTypeInt) + 2,
- CompanyLabel = (PropertyCompany | DataTypeString) + 3,
- CompanyName = (PropertyCompany | DataTypeString) + 4,
- CompanyDepartment = (PropertyCompany | DataTypeString) + 5,
- CompanyJobTitle = (PropertyCompany | DataTypeString) + 6,
- CompanyRole = (PropertyCompany | DataTypeString) + 7,
- CompanyAssistantName = (PropertyCompany | DataTypeString) + 8,
- CompanyLogo = (PropertyCompany | DataTypeString) + 9,
- CompanyLocation = (PropertyCompany | DataTypeString) + 10,
- CompanyDescription = (PropertyCompany | DataTypeString) + 11,
- CompanyPhoneticName = (PropertyCompany | DataTypeString) + 12,
-
- /* contact_nickname */
- NicknameId = (PropertyNickname | DataTypeInt | ReadOnly),
- NicknameContactId = (PropertyNickname | DataTypeInt) + 1,
- NicknameName = (PropertyNickname | DataTypeString) + 2,
-
- /* contact_messenger */
- MessengerId = (PropertyMessenger | DataTypeInt | ReadOnly),
- MessengerContactId = (PropertyMessenger | DataTypeInt) + 1,
- MessengerType = (PropertyMessenger | DataTypeInt) + 2,
- MessengerLabel = (PropertyMessenger | DataTypeString) + 3,
- MessengerIMId = (PropertyMessenger | DataTypeString) + 4,
-
- /* contact_note */
- NoteId = (PropertyNote | DataTypeInt | ReadOnly),
- NoteContactId = (PropertyNote | DataTypeInt) + 1,
- NoteNote = (PropertyNote | DataTypeString) + 2,
-
- /* contact sip */
- SipId = (PropertySip | DataTypeInt | ReadOnly),
- SipContactId = (PropertySip | DataTypeInt) + 1,
- SipAddress = (PropertySip | DataTypeString) + 2,
- SipType = (PropertySip | DataTypeInt) + 3,
- SipLabel = (PropertySip | DataTypeString) + 4,
-
- /* contact_profile */
- ProfileId = (PropertyProfile | DataTypeInt | ReadOnly),
- ProfileContactId = (PropertyProfile | DataTypeInt) + 1,
- ProfileUid = (PropertyProfile | DataTypeString) + 2,
- ProfileText = (PropertyProfile | DataTypeString) + 3,
- ProfileOrder = (PropertyProfile | DataTypeInt) + 4,
- ProfileServiceOperation = (PropertyProfile | DataTypeString) + 5,
- ProfileMIME = (PropertyProfile | DataTypeString) + 6,
- ProfileAppId = (PropertyProfile | DataTypeString) + 7,
- ProfileUri = (PropertyProfile | DataTypeString) + 8,
- ProfileCategory = (PropertyProfile | DataTypeString) + 9,
- ProfileExtraData = (PropertyProfile | DataTypeString) + 10,
-
- ExtensionId = (PropertyExtension | DataTypeInt | ReadOnly),
- ExtensionContactId = (PropertyExtension | DataTypeInt) +1,
- ExtensionData1 = (PropertyExtension | DataTypeInt) +2,
- ExtensionData2 = (PropertyExtension | DataTypeString) +3,
- ExtensionData3 = (PropertyExtension | DataTypeString) +4,
- ExtensionData4 = (PropertyExtension | DataTypeString) +5,
- ExtensionData5 = (PropertyExtension | DataTypeString) +6,
- ExtensionData6 = (PropertyExtension | DataTypeString) +7,
- ExtensionData7 = (PropertyExtension | DataTypeString) +8,
- ExtensionData8 = (PropertyExtension | DataTypeString) +9,
- ExtensionData9 = (PropertyExtension | DataTypeString) +10,
- ExtensionData10 = (PropertyExtension | DataTypeString) +11,
- ExtensionData11 = (PropertyExtension | DataTypeString) +12,
- ExtensionData12 = (PropertyExtension | DataTypeString) +13,
-
- /* speeddial */
- SpeedDialDialNumber = (PropertySpeedDial | DataTypeInt),
- SpeedDialNumberId = (PropertySpeedDial | DataTypeInt) +1,
- SpeedDialNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +2,
- SpeedDialNumberLabel = (PropertySpeedDial | DataTypeString | ReadOnly) +3,
- SpeedDialNumberType = (PropertySpeedDial | DataTypeInt | ReadOnly) +4,
- SpeedDialPersonId = (PropertySpeedDial | DataTypeInt | ReadOnly) +5,
- SpeedDialDisplayName = (PropertySpeedDial | DataTypeString | ReadOnly) +6,
- SpeedDialThumbnail = (PropertySpeedDial | DataTypeString | ReadOnly) +7,
- SpeedDialNormalizedNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +8,
- SpeedDialCleanedNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +9,
- SpeedDialNumberFilter = (PropertySpeedDial | DataTypeString | ReadOnly) +10,
-
- /* phonelog */
- PhonelogId = (PropertyPhonelog | DataTypeInt | ReadOnly),
- PhonelogPersonId = (PropertyPhonelog | DataTypeInt) + 1,
- PhonelogAddress = (PropertyPhonelog | DataTypeString) + 2,
- PhonelogLogTime = (PropertyPhonelog | DataTypeInt) + 3,
- PhonelogLogType = (PropertyPhonelog | DataTypeInt) + 4,
- PhonelogExtraData1 = (PropertyPhonelog | DataTypeInt) + 5, /* duration, message_id, email_id */
- PhonelogExtraData2 = (PropertyPhonelog | DataTypeString) + 6, /* short message, subject */
- PhonelogNormalizedAddress = (PropertyPhonelog | DataTypeString | ReadOnly) + 7, /* for search by calllog number */
- PhonelogCleanedAddress = (PropertyPhonelog | DataTypeString | ReadOnly) + 8, /* for search by calllog number */
- PhonelogAddressFilter = (PropertyPhonelog | DataTypeString | ReadOnly) + 9, /* for search by calllog number */
- PhonelogSIMSlotNo = (PropertyPhonelog | DataTypeInt) + 10,
-
- /* phonelog_stat */
- PhonelogStatLogCount = (PropertyPhonelogStat | DataTypeInt | ReadOnly),
- PhonelogStatLogType = (PropertyPhonelogStat | DataTypeInt | ReadOnly) + 1,
- PhonelogStatSIMSlotNo = (PropertyPhonelogStat | DataTypeInt | ReadOnly) + 2,
-
- /* updated_info : read only */
- UpdateInfoId = (PropertyUpdateInfo | DataTypeInt),
- UpdateInfoAddressbookId = (PropertyUpdateInfo | DataTypeInt) +1,
- UpdateInfoType = (PropertyUpdateInfo | DataTypeInt) +2,
- UpdateInfoVersion = (PropertyUpdateInfo | DataTypeInt) +3,
- UpdateInfoImageChanged = (PropertyUpdateInfo | DataTypeBool) +4,
- UpdateInfoLastChangedType = (PropertyUpdateInfo | DataTypeInt)+5, /* now, it is used for _contacts_my_profile_updated_info */
+ internal const uint AverageSize = 120; /* average size of person record */
}
/// <summary>
/// Enumeration for contact change state.
/// </summary>
- public enum ChangeTypes
+ public enum ChangeType
{
/// <summary>
/// Inserted
Deleted,
}
- internal const uint AverageSizeOfRecord = 120; /* average size of person record */
-
/// <summary>
- /// Describes properies of a Address book record.
+ /// Describes properties of a Address book record.
/// </summary>
- public static class Addressbook
+ public static class AddressBook
{
/// <summary>
- /// Identifier of this contacts addressbook view
+ /// Identifier of this contacts address book view
/// </summary>
public const string Uri = "tizen.contacts_view.addressbook";
/// <summary>
- /// integer, read only, DB record ID of the addressbook
+ /// integer, read only, DB record ID of the address book
/// </summary>
- public const uint Id = (uint)PropertyIds.AddressbookId;
+ public const uint Id = (uint)Property.Id.AddressBookId;
/// <summary>
- /// integer, read/write once, Account ID that the addressbook belongs to
+ /// integer, read/write once, Account ID that the address book belongs to
/// </summary>
- public const uint AccountId = (uint)PropertyIds.AddressbookAccountId;
+ public const uint AccountId = (uint)Property.Id.AddressBookAccountId;
/// <summary>
/// string, read/write, It cannot be NULL. Duplicate names are not allowed.
/// </summary>
- public const uint Name = (uint)PropertyIds.AddressbookName;
+ public const uint Name = (uint)Property.Id.AddressBookName;
/// <summary>
- /// integer, read/write, Addressbook mode, refer to the Modes
+ /// integer, read/write, AddressBook mode, refer to the ModeValue
/// </summary>
- public const uint Mode = (uint)PropertyIds.AddressbookMode;
+ public const uint Mode = (uint)Property.Id.AddressBookMode;
/// <summary>
/// Enumeration for Address book mode.
/// </summary>
- public enum Modes
+ public enum ModeValue
{
/// <summary>
/// All module can read and write contacts of this address_book
}
/// <summary>
- /// Describes properies of a Group record.
+ /// Describes properties of a Group record.
/// </summary>
public static class Group
{
/// <summary>
/// DB record ID of the group
/// </summary>
- public const uint Id = (uint)PropertyIds.GroupId;
+ public const uint Id = (uint)Property.Id.GroupId;
/// <summary>
- /// Addressbook ID that the group belongs to
+ /// AddressBook ID that the group belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.GroupAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.GroupAddressBookId;
/// <summary>
/// Group name
/// </summary>
- public const uint Name = (uint)PropertyIds.GroupName;
+ public const uint Name = (uint)Property.Id.GroupName;
/// <summary>
/// Ringtone path of the group
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.GroupRingtone;
+ public const uint RingtonePath = (uint)Property.Id.GroupRingtone;
/// <summary>
/// Image path of the group
/// </summary>
- public const uint ImagePath = (uint)PropertyIds.GroupImage;
+ public const uint ImagePath = (uint)Property.Id.GroupImage;
/// <summary>
/// Vibration path of the group
/// </summary>
- public const uint Vibration = (uint)PropertyIds.GroupVibration;
+ public const uint Vibration = (uint)Property.Id.GroupVibration;
/// <summary>
/// Extra data for default group name
/// </summary>
- public const uint ExtraData = (uint)PropertyIds.GroupExtraData;
+ public const uint ExtraData = (uint)Property.Id.GroupExtraData;
/// <summary>
/// The group is read only or not
/// </summary>
- public const uint IsReadOnly = (uint)PropertyIds.GroupIsReadOnly;
+ public const uint IsReadOnly = (uint)Property.Id.GroupIsReadOnly;
/// <summary>
/// Message alert path of the group
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.GroupMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.GroupMessageAlert;
}
/// <summary>
- /// Describes properies of a Person record.
+ /// Describes properties of a Person record.
/// </summary>
public static class Person
{
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint Id = (uint)PropertyIds.PersonId;
+ public const uint Id = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// Status of social account
/// </summary>
- public const uint Status = (uint)PropertyIds.PersonStatus;
+ public const uint Status = (uint)Property.Id.PersonStatus;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The priority of favorite contacts. it can be used as sorting key
/// </summary>
- public const uint FavoritePriority = (uint)PropertyIds.PersonFavoritePriority;
+ public const uint FavoritePriority = (uint)Property.Id.PersonFavoritePriority;
/// <summary>
/// Link count of contact records (projection)
/// </summary>
- public const uint LinkCount = (uint)PropertyIds.PersonLinkCount;
+ public const uint LinkCount = (uint)Property.Id.PersonLinkCount;
/// <summary>
- /// Addressbook IDs that the person belongs to (projection)
+ /// AddressBook IDs that the person belongs to (projection)
/// </summary>
- public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds;
+ public const uint AddressBookIds = (uint)Property.Id.PersonAddressBookIds;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
- /// kerword matched data type
+ /// keyword matched data type
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
}
/// <summary>
- /// Describes properies of a Contact record.
+ /// Describes properties of a Contact record.
/// </summary>
public static class Contact
{
/// <summary>
/// DB record ID of the contact
/// </summary>
- public const uint Id = (uint)PropertyIds.ContactId;
+ public const uint Id = (uint)Property.Id.ContactId;
/// <summary>
/// Display name of the contact
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.ContactDisplayName;
+ public const uint DisplayName = (uint)Property.Id.ContactDisplayName;
/// <summary>
- /// The source type of display name, refer to the DisplayNameSourceTypes
+ /// The source type of display name, refer to the DisplayNameSourceType
/// </summary>
- public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId;
+ public const uint DisplaySourceType = (uint)Property.Id.ContactDisplaySourceDataId;
/// <summary>
- /// Addressbook ID that the contact belongs to
+ /// AddressBook ID that the contact belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
/// Ringtone path of the contact
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.ContactRingtone;
+ public const uint RingtonePath = (uint)Property.Id.ContactRingtone;
/// <summary>
/// Image thumbnail path of the contact
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.ContactThumbnail;
/// <summary>
/// The contact is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.ContactIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.ContactIsFavorite;
/// <summary>
/// The contact has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.ContactHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.ContactHasPhoneNumber;
/// <summary>
/// The contact has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.ContactHasEmail;
+ public const uint HasEmail = (uint)Property.Id.ContactHasEmail;
/// <summary>
/// Person ID that the contact belongs to. If set when inserting, a contact will be linked to person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.ContactPersonId;
+ public const uint PersonId = (uint)Property.Id.ContactPersonId;
/// <summary>
/// Unique identifier
/// </summary>
- public const uint Uid = (uint)PropertyIds.ContactUid;
+ public const uint UId = (uint)Property.Id.ContactUId;
/// <summary>
/// Vibration path of the contact
/// </summary>
- public const uint Vibration = (uint)PropertyIds.ContactVibration;
+ public const uint Vibration = (uint)Property.Id.ContactVibration;
/// <summary>
/// Message alert path of the contact
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.ContactMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.ContactMessageAlert;
/// <summary>
/// Last changed contact time
/// </summary>
- public const uint ChangedTime = (uint)PropertyIds.ContactChangedTime;
+ public const uint ChangedTime = (uint)Property.Id.ContactChangedTime;
/// <summary>
- /// The link mode, refer to the LinkModes. If the person_id was set, this value will be ignored
+ /// The link mode, refer to the LinkModeValue. If the person_id was set, this value will be ignored
/// </summary>
- public const uint LinkMode = (uint)PropertyIds.ContactLinkMode;
+ public const uint LinkMode = (uint)Property.Id.ContactLinkMode;
/// <summary>
/// Name child record (single)
/// </summary>
- public const uint Name = (uint)PropertyIds.ContactName;
+ public const uint Name = (uint)Property.Id.ContactName;
/// <summary>
/// Company child record (multiple)
/// </summary>
- public const uint Company = (uint)PropertyIds.ContactCompany;
+ public const uint Company = (uint)Property.Id.ContactCompany;
/// <summary>
/// Note child record (multiple)
/// </summary>
- public const uint Note = (uint)PropertyIds.ContactNote;
+ public const uint Note = (uint)Property.Id.ContactNote;
/// <summary>
/// Number child record (multiple)
/// </summary>
- public const uint Number = (uint)PropertyIds.ContactNumber;
+ public const uint Number = (uint)Property.Id.ContactNumber;
/// <summary>
/// Email child record (multiple)
/// </summary>
- public const uint Email = (uint)PropertyIds.ContactEmail;
+ public const uint Email = (uint)Property.Id.ContactEmail;
/// <summary>
/// Event child record (multiple)
/// </summary>
- public const uint Event = (uint)PropertyIds.ContactEvent;
+ public const uint Event = (uint)Property.Id.ContactEvent;
/// <summary>
/// Messenger child record (multiple)
/// </summary>
- public const uint Messenger = (uint)PropertyIds.ContactMessenger;
+ public const uint Messenger = (uint)Property.Id.ContactMessenger;
/// <summary>
/// Address child record (multiple)
/// </summary>
- public const uint Address = (uint)PropertyIds.ContactAddress;
+ public const uint Address = (uint)Property.Id.ContactAddress;
/// <summary>
- /// Url child record (multiple)
+ /// URL child record (multiple)
/// </summary>
- public const uint Url = (uint)PropertyIds.ContactUrl;
+ public const uint URL = (uint)Property.Id.ContactURL;
/// <summary>
/// Nickname child record (multiple)
/// </summary>
- public const uint Nickname = (uint)PropertyIds.ContactNickname;
+ public const uint Nickname = (uint)Property.Id.ContactNickname;
/// <summary>
/// Profile child record (multiple)
/// </summary>
- public const uint Profile = (uint)PropertyIds.ContactProfile;
+ public const uint Profile = (uint)Property.Id.ContactProfile;
/// <summary>
/// Relationship child record (multiple)
/// </summary>
- public const uint Relationship = (uint)PropertyIds.ContactRelationship;
+ public const uint Relationship = (uint)Property.Id.ContactRelationship;
/// <summary>
/// Image child record (multiple)
/// </summary>
- public const uint Image = (uint)PropertyIds.ContactImage;
+ public const uint Image = (uint)Property.Id.ContactImage;
/// <summary>
/// GroupRelation child record (multiple)
/// </summary>
- public const uint GroupRelation = (uint)PropertyIds.ContactGroupRelation;
+ public const uint GroupRelation = (uint)Property.Id.ContactGroupRelation;
/// <summary>
/// Extension child record (multiple)
/// </summary>
- public const uint Extension = (uint)PropertyIds.ContactExtension;
+ public const uint Extension = (uint)Property.Id.ContactExtension;
/// <summary>
/// Sip child record (multiple)
/// </summary>
- public const uint Sip = (uint)PropertyIds.ContactSip;
+ public const uint Sip = (uint)Property.Id.ContactSip;
/// <summary>
/// Enumeration for link mode when inserting contact.
/// </summary>
- public enum LinkModes
+ public enum LinkModeValue
{
/// <summary>
/// Auto link immediately
/// <summary>
/// Enumeration for Contact display name source type.
/// </summary>
- public enum DisplayNameSourceTypes
+ public enum DisplayNameSourceType
{
/// <summary>
/// Invalid source of display name
/// <summary>
/// Enumeration for contacts data type.
/// </summary>
- public enum DataTypes
+ public enum DataType
{
+ /// <summary>
+ /// None
+ /// </summary>
+ None,
+ /// <summary>
+ /// Name
+ /// </summary>
Name = 1,
+ /// <summary>
+ /// Address
+ /// </summary>
Address = 2,
+ /// <summary>
+ /// Messenger
+ /// </summary>
Messenger = 3,
- Url = 4,
+ /// <summary>
+ /// URL
+ /// </summary>
+ URL = 4,
+ /// <summary>
+ /// Event
+ /// </summary>
Event = 5,
+ /// <summary>
+ /// Company
+ /// </summary>
Company = 6,
+ /// <summary>
+ /// Nickname
+ /// </summary>
Nickname = 7,
+ /// <summary>
+ /// Number
+ /// </summary>
Number = 8,
+ /// <summary>
+ /// Email
+ /// </summary>
Email = 9,
+ /// <summary>
+ /// Profile
+ /// </summary>
Profile = 10,
- Relationsip = 11,
+ /// <summary>
+ /// Relationship
+ /// </summary>
+ Relationship = 11,
+ /// <summary>
+ /// Note
+ /// </summary>
Note = 12,
+ /// <summary>
+ /// Image
+ /// </summary>
Image = 13,
+ /// <summary>
+ /// SIP
+ /// </summary>
Sip = 14,
+ /// <summary>
+ /// Extension
+ /// </summary>
Extension = 100
}
}
/// <summary>
- /// Describes properies of a Simple contact record.
+ /// Describes properties of a Simple contact record.
/// </summary>
public static class SimpleContact
{
/// <summary>
/// DB record ID of the contact
/// </summary>
- public const uint Id = (uint)PropertyIds.ContactId;
+ public const uint Id = (uint)Property.Id.ContactId;
/// <summary>
/// Display name of the contact
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.ContactDisplayName;
+ public const uint DisplayName = (uint)Property.Id.ContactDisplayName;
/// <summary>
- /// The source type of display name, refer to the Contact.DisplayNameSourceTypes
+ /// The source type of display name, refer to the Contact.DisplayNameSourceType
/// </summary>
- public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId;
+ public const uint DisplaySourceType = (uint)Property.Id.ContactDisplaySourceDataId;
/// <summary>
- /// Addressbook that the contact belongs to
+ /// AddressBook that the contact belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
/// Ringtone path of the contact
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.ContactRingtone;
+ public const uint RingtonePath = (uint)Property.Id.ContactRingtone;
/// <summary>
/// Image thumbnail path of the contact
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.ContactThumbnail;
/// <summary>
/// The contact is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.ContactIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.ContactIsFavorite;
/// <summary>
/// The contact has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.ContactHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.ContactHasPhoneNumber;
/// <summary>
/// The contact has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.ContactHasEmail;
+ public const uint HasEmail = (uint)Property.Id.ContactHasEmail;
/// <summary>
/// Person ID that the contact belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.ContactPersonId;
+ public const uint PersonId = (uint)Property.Id.ContactPersonId;
/// <summary>
/// Unique identifier
/// </summary>
- public const uint Uid = (uint)PropertyIds.ContactUid;
+ public const uint UId = (uint)Property.Id.ContactUId;
/// <summary>
/// Vibration path of the contact
/// </summary>
- public const uint Vibration = (uint)PropertyIds.ContactVibration;
+ public const uint Vibration = (uint)Property.Id.ContactVibration;
/// <summary>
/// Message alert path of the contact
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.ContactMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.ContactMessageAlert;
/// <summary>
/// Last changed contact time
/// </summary>
- public const uint ChangedTime = (uint)PropertyIds.ContactChangedTime;
+ public const uint ChangedTime = (uint)Property.Id.ContactChangedTime;
}
/// <summary>
- /// Describes properies of a My profile record.
+ /// Describes properties of a My profile record.
/// </summary>
public static class MyProfile
{
/// <summary>
/// DB record ID of the my profile
/// </summary>
- public const uint Id = (uint)PropertyIds.MyProfileId;
+ public const uint Id = (uint)Property.Id.MyProfileId;
/// <summary>
/// Display name of the profile
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.MyProfileDisplayName;
+ public const uint DisplayName = (uint)Property.Id.MyProfileDisplayName;
/// <summary>
- /// Addressbook ID that the profile belongs to
+ /// AddressBook ID that the profile belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.MyProfileAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.MyProfileAddressBookId;
/// <summary>
/// Image thumbnail path of the profile
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.MyProfileThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.MyProfileThumbnail;
/// <summary>
/// Unique identifier
/// </summary>
- public const uint Uid = (uint)PropertyIds.MyProfileUid;
+ public const uint UId = (uint)Property.Id.MyProfileUId;
/// <summary>
/// Last changed profile time
/// </summary>
- public const uint ChangedTime = (uint)PropertyIds.MyProfileChangedTime;
+ public const uint ChangedTime = (uint)Property.Id.MyProfileChangedTime;
/// <summary>
/// Name child record (single)
/// </summary>
- public const uint Name = (uint)PropertyIds.MyProfileName;
+ public const uint Name = (uint)Property.Id.MyProfileName;
/// <summary>
/// Company child record (multiple)
/// </summary>
- public const uint Company = (uint)PropertyIds.MyProfileCompany;
+ public const uint Company = (uint)Property.Id.MyProfileCompany;
/// <summary>
/// Note child record (multiple)
/// </summary>
- public const uint Note = (uint)PropertyIds.MyProfileNote;
+ public const uint Note = (uint)Property.Id.MyProfileNote;
/// <summary>
/// Number child record (multiple)
/// </summary>
- public const uint Number = (uint)PropertyIds.MyProfileNumber;
+ public const uint Number = (uint)Property.Id.MyProfileNumber;
/// <summary>
/// Email child record (multiple)
/// </summary>
- public const uint Email = (uint)PropertyIds.MyProfileEmail;
+ public const uint Email = (uint)Property.Id.MyProfileEmail;
/// <summary>
/// Event child record (multiple)
/// </summary>
- public const uint Event = (uint)PropertyIds.MyProfileEvent;
+ public const uint Event = (uint)Property.Id.MyProfileEvent;
/// <summary>
/// Messenger child record (multiple)
/// </summary>
- public const uint Messenger = (uint)PropertyIds.MyProfileMessenger;
+ public const uint Messenger = (uint)Property.Id.MyProfileMessenger;
/// <summary>
/// Address child record (multiple)
/// </summary>
- public const uint Address = (uint)PropertyIds.MyProfileAddress;
+ public const uint Address = (uint)Property.Id.MyProfileAddress;
/// <summary>
- /// Url child record (multiple)
+ /// URL child record (multiple)
/// </summary>
- public const uint Url = (uint)PropertyIds.MyProfileUrl;
+ public const uint URL = (uint)Property.Id.MyProfileURL;
/// <summary>
/// Nickname child record (multiple)
/// </summary>
- public const uint Nickname = (uint)PropertyIds.MyProfileNickname;
+ public const uint Nickname = (uint)Property.Id.MyProfileNickname;
/// <summary>
/// Profile child record (multiple)
/// </summary>
- public const uint Profile = (uint)PropertyIds.MyProfileProfile;
+ public const uint Profile = (uint)Property.Id.MyProfileProfile;
/// <summary>
/// Relationship child record (multiple)
/// </summary>
- public const uint Relationship = (uint)PropertyIds.MyProfileRelationship;
+ public const uint Relationship = (uint)Property.Id.MyProfileRelationship;
/// <summary>
/// Image child record (multiple)
/// </summary>
- public const uint Image = (uint)PropertyIds.MyProfileImage;
+ public const uint Image = (uint)Property.Id.MyProfileImage;
/// <summary>
/// Extension child record (multiple)
/// </summary>
- public const uint Extension = (uint)PropertyIds.MyProfileExtension;
+ public const uint Extension = (uint)Property.Id.MyProfileExtension;
/// <summary>
/// Sip child record (multiple)
/// </summary>
- public const uint Sip = (uint)PropertyIds.MyProfileSip;
+ public const uint Sip = (uint)Property.Id.MyProfileSip;
}
/// <summary>
- /// Describes properies of a Name record.
+ /// Describes properties of a Name record.
/// </summary>
public static class Name
{
/// <summary>
/// DB record ID of the name
/// </summary>
- public const uint Id = (uint)PropertyIds.NameId;
+ public const uint Id = (uint)Property.Id.NameId;
/// <summary>
/// Contacts ID that the name record belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.NameContactId;
+ public const uint ContactId = (uint)Property.Id.NameContactId;
/// <summary>
/// First name
/// </summary>
- public const uint First = (uint)PropertyIds.NameFirst;
+ public const uint First = (uint)Property.Id.NameFirst;
/// <summary>
/// Last name
/// </summary>
- public const uint Last = (uint)PropertyIds.NameLast;
+ public const uint Last = (uint)Property.Id.NameLast;
/// <summary>
/// Middle name
/// </summary>
- public const uint Addition = (uint)PropertyIds.NameAddition;
+ public const uint Addition = (uint)Property.Id.NameAddition;
/// <summary>
/// Suffix
/// </summary>
- public const uint Suffix = (uint)PropertyIds.NameSuffix;
+ public const uint Suffix = (uint)Property.Id.NameSuffix;
/// <summary>
/// Prefix
/// </summary>
- public const uint Prefix = (uint)PropertyIds.NamePrefix;
+ public const uint Prefix = (uint)Property.Id.NamePrefix;
/// <summary>
/// Pronounce the first name
/// </summary>
- public const uint PhoneticFirst = (uint)PropertyIds.NamePhoneticFirst;
+ public const uint PhoneticFirst = (uint)Property.Id.NamePhoneticFirst;
/// <summary>
/// Pronounce the middle name
/// </summary>
- public const uint PhoneticMiddle = (uint)PropertyIds.NamePhoneticMiddle;
+ public const uint PhoneticMiddle = (uint)Property.Id.NamePhoneticMiddle;
/// <summary>
/// Pronounce the last name
/// </summary>
- public const uint PhoneticLast = (uint)PropertyIds.NamePhoneticLast;
+ public const uint PhoneticLast = (uint)Property.Id.NamePhoneticLast;
}
/// <summary>
- /// Describes properies of a Number record.
+ /// Describes properties of a Number record.
/// </summary>
public static class Number
{
/// <summary>
/// DB record ID of the number
/// </summary>
- public const uint Id = (uint)PropertyIds.NumberId;
+ public const uint Id = (uint)Property.Id.NumberId;
/// <summary>
/// Contact ID that the number belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.NumberContactId;
+ public const uint ContactId = (uint)Property.Id.NumberContactId;
/// <summary>
/// Number type, refer to the Types
/// </summary>
- public const uint Type = (uint)PropertyIds.NumberType;
+ public const uint Type = (uint)Property.Id.NumberType;
/// <summary>
/// Custom number type label, when the number type is Types.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.NumberLabel;
+ public const uint Label = (uint)Property.Id.NumberLabel;
/// <summary>
/// The number is default number or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.NumberIsDefault;
+ public const uint IsDefault = (uint)Property.Id.NumberIsDefault;
/// <summary>
/// Number
/// </summary>
- public const uint NumberData = (uint)PropertyIds.NumberNumber;
+ public const uint NumberData = (uint)Property.Id.NumberNumber;
/// <summary>
/// You can only use this property for search filter.
/// </summary>
- public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber;
+ public const uint NormalizedNumber = (uint)Property.Id.NumberNormalizedNumber;
/// <summary>
/// You can only use this property for search filter.
/// </summary>
- public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber;
+ public const uint CleanedNumber = (uint)Property.Id.NumberCleanedNumber;
/// <summary>
/// You can only use this property for search filter.
/// </summary>
- public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter;
+ public const uint NumberFilter = (uint)Property.Id.NumberNumberFilter;
/// <summary>
/// Enumeration for number type.
/// </summary>
+ [Flags]
public enum Types
{
/// <summary>
}
/// <summary>
- /// Describes properies of a Email record.
+ /// Describes properties of a Email record.
/// </summary>
public static class Email
{
/// <summary>
/// DB record ID of the email
/// </summary>
- public const uint Id = (uint)PropertyIds.EmailId;
+ public const uint Id = (uint)Property.Id.EmailId;
/// <summary>
/// Contact ID that the email belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.EmailContactId;
+ public const uint ContactId = (uint)Property.Id.EmailContactId;
/// <summary>
/// Email type, refer to the Types
/// </summary>
- public const uint Type = (uint)PropertyIds.EmailType;
+ public const uint Type = (uint)Property.Id.EmailType;
/// <summary>
/// Custom mail type label, when the email type is Types.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.EmailLabel;
+ public const uint Label = (uint)Property.Id.EmailLabel;
/// <summary>
/// The email is default email or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.EmailIsDefault;
+ public const uint IsDefault = (uint)Property.Id.EmailIsDefault;
/// <summary>
/// Email address
/// </summary>
- public const uint Address = (uint)PropertyIds.EmailEmail;
+ public const uint Address = (uint)Property.Id.EmailEmail;
/// <summary>
/// Enumeration for Contact email type.
/// </summary>
+ [Flags]
public enum Types
{
/// <summary>
}
/// <summary>
- /// Describes properies of a Address record.
+ /// Describes properties of a Address record.
/// </summary>
public static class Address
{
/// <summary>
/// DB record ID of the address
/// </summary>
- public const uint Id = (uint)PropertyIds.AddressId;
+ public const uint Id = (uint)Property.Id.AddressId;
/// <summary>
/// Contact ID that the address belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.AddressContactId;
+ public const uint ContactId = (uint)Property.Id.AddressContactId;
/// <summary>
/// Address type, refer to the Types
/// </summary>
- public const uint Type = (uint)PropertyIds.AddressType;
+ public const uint Type = (uint)Property.Id.AddressType;
/// <summary>
/// Address type label, when the address type is Types.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.AddressLabel;
+ public const uint Label = (uint)Property.Id.AddressLabel;
/// <summary>
/// Post office box
/// </summary>
- public const uint Postbox = (uint)PropertyIds.AddressPostbox;
+ public const uint Postbox = (uint)Property.Id.AddressPostbox;
/// <summary>
/// Postal code
/// </summary>
- public const uint PostalCode = (uint)PropertyIds.AddressPostalCode;
+ public const uint PostalCode = (uint)Property.Id.AddressPostalCode;
/// <summary>
/// Region
/// </summary>
- public const uint Region = (uint)PropertyIds.AddressRegion;
+ public const uint Region = (uint)Property.Id.AddressRegion;
/// <summary>
/// Locality
/// </summary>
- public const uint Locality = (uint)PropertyIds.AddressLocality;
+ public const uint Locality = (uint)Property.Id.AddressLocality;
/// <summary>
/// Street
/// </summary>
- public const uint Street = (uint)PropertyIds.AddressStreet;
+ public const uint Street = (uint)Property.Id.AddressStreet;
/// <summary>
/// Country
/// </summary>
- public const uint Country = (uint)PropertyIds.AddressCountry;
+ public const uint Country = (uint)Property.Id.AddressCountry;
/// <summary>
/// Extended address
/// </summary>
- public const uint Extended = (uint)PropertyIds.AddressExtended;
+ public const uint Extended = (uint)Property.Id.AddressExtended;
/// <summary>
/// The address is default or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.AddressIsDefault;
+ public const uint IsDefault = (uint)Property.Id.AddressIsDefault;
/// <summary>
/// Enumeration for Contact address type.
/// </summary>
+ [Flags]
public enum Types
{
/// <summary>
}
/// <summary>
- /// Describes properies of a Note record.
+ /// Describes properties of a Note record.
/// </summary>
public static class Note
{
/// <summary>
/// DB record ID of the note
/// </summary>
- public const uint Id = (uint)PropertyIds.NoteId;
+ public const uint Id = (uint)Property.Id.NoteId;
/// <summary>
/// Contact ID that the note belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.NoteContactId;
+ public const uint ContactId = (uint)Property.Id.NoteContactId;
/// <summary>
/// Note contents
/// </summary>
- public const uint Contents = (uint)PropertyIds.NoteNote;
+ public const uint Contents = (uint)Property.Id.NoteNote;
}
/// <summary>
- /// Describes properies of a Url record.
+ /// Describes properties of a URL record.
/// </summary>
- public static class Url
+ public static class URL
{
/// <summary>
/// Identifier of this contacts URL view
/// <summary>
/// DB record ID of the URL
/// </summary>
- public const uint Id = (uint)PropertyIds.UrlId;
+ public const uint Id = (uint)Property.Id.URLId;
/// <summary>
/// Contact ID that the URL belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.UrlContactId;
+ public const uint ContactId = (uint)Property.Id.URLContactId;
/// <summary>
- /// URL type, refer to the Types
+ /// URL type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.UrlType;
+ public const uint Type = (uint)Property.Id.URLType;
/// <summary>
- /// Custom URL type label, when the URL type is Types.Custom
+ /// Custom URL type label, when the URL type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.UrlLabel;
+ public const uint Label = (uint)Property.Id.URLLabel;
/// <summary>
/// URL
/// </summary>
- public const uint UrlData = (uint)PropertyIds.UrlUrl;
+ public const uint URLData = (uint)Property.Id.URLData;
/// <summary>
/// Enumeration for Contact URL type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other URL type
}
/// <summary>
- /// Describes properies of a Event record.
+ /// Describes properties of a Event record.
/// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
public static class Event
{
/// <summary>
/// <summary>
/// DB record ID of the event
/// </summary>
- public const uint Id = (uint)PropertyIds.EventId;
+ public const uint Id = (uint)Property.Id.EventId;
/// <summary>
/// Contact ID that the event belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.EventContactId;
+ public const uint ContactId = (uint)Property.Id.EventContactId;
/// <summary>
- /// Event type, refer to the Types
+ /// Event type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.EventType;
+ public const uint Type = (uint)Property.Id.EventType;
/// <summary>
- /// Custom event type label, when the event type is Types.Custom
+ /// Custom event type label, when the event type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.EventLabel;
+ public const uint Label = (uint)Property.Id.EventLabel;
/// <summary>
/// Event date(YYYYMMDD). e.g. 2014/1/1 : 20140101. Even if the calendar_type is set as CONTACTS_EVENT_CALENDAR_TYPE_CHINESE, you SHOULD set Gregorian date
/// </summary>
- public const uint Date = (uint)PropertyIds.EventDate;
+ public const uint Date = (uint)Property.Id.EventDate;
/// <summary>
- /// Calendar type, refer to the CalendarTypes
+ /// Calendar type, refer to the CalendarType
/// </summary>
- public const uint IsLeapMonth = (uint)PropertyIds.EventIsLeapMonth;
+ public const uint IsLeapMonth = (uint)Property.Id.EventIsLeapMonth;
/// <summary>
/// Enumeration for Contact event type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other event type
/// <summary>
/// Enumeration for Contact event calendar type.
/// </summary>
- public enum CalendarTypes
+ public enum CalendarType
{
/// <summary>
/// Gregorian calendar
/// </summary>
Gregorian,
/// <summary>
- /// Chinese calenadr
+ /// Chinese calendar
/// </summary>
Chinese
}
}
/// <summary>
- /// Describes properies of a Relationship record.
+ /// Describes properties of a Relationship record.
/// </summary>
public static class Relationship
{
/// <summary>
/// DB record ID of the relationship
/// </summary>
- public const uint Id = (uint)PropertyIds.RelationshipId;
+ public const uint Id = (uint)Property.Id.RelationshipId;
/// <summary>
/// Contact ID that the relationship belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.RelationshipContactId;
+ public const uint ContactId = (uint)Property.Id.RelationshipContactId;
/// <summary>
- /// Relationship type, refer to the Types
+ /// Relationship type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.RelationshipType;
+ public const uint Type = (uint)Property.Id.RelationshipType;
/// <summary>
- /// Custom relationship type label, when the relationship type is Types.Custom
+ /// Custom relationship type label, when the relationship type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.RelationshipLabel;
+ public const uint Label = (uint)Property.Id.RelationshipLabel;
/// <summary>
/// Selected contact name that the relationship belongs to
/// </summary>
- public const uint Name = (uint)PropertyIds.RelationshipName;
+ public const uint Name = (uint)Property.Id.RelationshipName;
/// <summary>
/// Enumeration for Contact relationship type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other relationship type
}
/// <summary>
- /// Describes properies of a Image record.
+ /// Describes properties of a Image record.
/// </summary>
public static class Image
{
/// <summary>
/// DB record ID of the image
/// </summary>
- public const uint Id = (uint)PropertyIds.ImageId;
+ public const uint Id = (uint)Property.Id.ImageId;
/// <summary>
/// Contact ID that the image belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ImageContactId;
+ public const uint ContactId = (uint)Property.Id.ImageContactId;
/// <summary>
- /// Image type, refer to the Types
+ /// Image type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.ImageType;
+ public const uint Type = (uint)Property.Id.ImageType;
/// <summary>
- /// Custom image type label, when the image type is Types.Custom
+ /// Custom image type label, when the image type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.ImageLabel;
+ public const uint Label = (uint)Property.Id.ImageLabel;
/// <summary>
/// Image thumbnail path
/// </summary>
- public const uint Path = (uint)PropertyIds.ImagePath;
+ public const uint Path = (uint)Property.Id.ImagePath;
/// <summary>
/// The Image is default or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.ImageIsDefault;
+ public const uint IsDefault = (uint)Property.Id.ImageIsDefault;
/// <summary>
/// Enumeration for Contact image type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other type
}
/// <summary>
- /// Describes properies of a Company record.
+ /// Describes properties of a Company record.
/// </summary>
public static class Company
{
/// <summary>
/// DB record ID of the company
/// </summary>
- public const uint Id = (uint)PropertyIds.CompanyId;
+ public const uint Id = (uint)Property.Id.CompanyId;
/// <summary>
/// Contact ID that the company belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.CompanyContactId;
+ public const uint ContactId = (uint)Property.Id.CompanyContactId;
/// <summary>
- /// Company type, refer to the Types
+ /// Company type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.CompanyType;
+ public const uint Type = (uint)Property.Id.CompanyType;
/// <summary>
- /// Custom company type label, when the company type is Types.Custom
+ /// Custom company type label, when the company type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.CompanyLabel;
+ public const uint Label = (uint)Property.Id.CompanyLabel;
/// <summary>
/// Company name
/// </summary>
- public const uint Name = (uint)PropertyIds.CompanyName;
+ public const uint Name = (uint)Property.Id.CompanyName;
/// <summary>
/// Department
/// </summary>
- public const uint Department = (uint)PropertyIds.CompanyDepartment;
+ public const uint Department = (uint)Property.Id.CompanyDepartment;
/// <summary>
/// Job title
/// </summary>
- public const uint JobTitle = (uint)PropertyIds.CompanyJobTitle;
+ public const uint JobTitle = (uint)Property.Id.CompanyJobTitle;
/// <summary>
/// Assistant name
/// </summary>
- public const uint AssistantName = (uint)PropertyIds.CompanyAssistantName;
+ public const uint AssistantName = (uint)Property.Id.CompanyAssistantName;
/// <summary>
/// Role
/// </summary>
- public const uint Role = (uint)PropertyIds.CompanyRole;
+ public const uint Role = (uint)Property.Id.CompanyRole;
/// <summary>
/// Company logo image file path
/// </summary>
- public const uint Logo = (uint)PropertyIds.CompanyLogo;
+ public const uint Logo = (uint)Property.Id.CompanyLogo;
/// <summary>
/// Company location
/// </summary>
- public const uint Location = (uint)PropertyIds.CompanyLocation;
+ public const uint Location = (uint)Property.Id.CompanyLocation;
/// <summary>
/// Description
/// </summary>
- public const uint Description = (uint)PropertyIds.CompanyDescription;
+ public const uint Description = (uint)Property.Id.CompanyDescription;
/// <summary>
/// Pronounce the company name
/// </summary>
- public const uint PhoneticName = (uint)PropertyIds.CompanyPhoneticName;
+ public const uint PhoneticName = (uint)Property.Id.CompanyPhoneticName;
/// <summary>
/// Enumeration for Contact company type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
- Other = 0, /**< Other company type */
- Custom = 1 << 0, /**< Custom company type */
- Work = 1 << 1, /**< Work company type */
+ /// <summary>
+ /// Other type
+ /// </summary>
+ Other = 0,
+ /// <summary>
+ /// Custom type
+ /// </summary>
+ Custom = 1 << 0,
+ /// <summary>
+ /// Work type
+ /// </summary>
+ Work = 1 << 1,
}
}
/// <summary>
- /// Describes properies of a Nickname record.
+ /// Describes properties of a Nickname record.
/// </summary>
public static class Nickname
{
/// <summary>
/// DB record ID of the nickname
/// </summary>
- public const uint Id = (uint)PropertyIds.NicknameId;
+ public const uint Id = (uint)Property.Id.NicknameId;
/// <summary>
/// Contact ID that the nickname belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.NicknameContactId;
+ public const uint ContactId = (uint)Property.Id.NicknameContactId;
/// <summary>
/// Nickname
/// </summary>
- public const uint Name = (uint)PropertyIds.NicknameName;
+ public const uint Name = (uint)Property.Id.NicknameName;
}
/// <summary>
- /// Describes properies of a Messenger record.
+ /// Describes properties of a Messenger record.
/// </summary>
public static class Messenger
{
/// <summary>
/// DB record ID of the messenger
/// </summary>
- public const uint Id = (uint)PropertyIds.MessengerId;
+ public const uint Id = (uint)Property.Id.MessengerId;
/// <summary>
/// Contact ID that the messenger belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.MessengerContactId;
+ public const uint ContactId = (uint)Property.Id.MessengerContactId;
/// <summary>
- /// Messenger type, refer to the Types
+ /// Messenger type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.MessengerType;
+ public const uint Type = (uint)Property.Id.MessengerType;
/// <summary>
- /// Custom messenger type label, when the messenger type is Types.Custom
+ /// Custom messenger type label, when the messenger type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.MessengerLabel;
+ public const uint Label = (uint)Property.Id.MessengerLabel;
/// <summary>
/// Messenger ID (email address or email ID...)
/// </summary>
- public const uint IMId = (uint)PropertyIds.MessengerIMId;
+ public const uint IMId = (uint)Property.Id.MessengerIMId;
/// <summary>
/// Enumeration for Contact messenger type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other messenger type
}
/// <summary>
- /// Describes properies of a Profile record.
+ /// Describes properties of a Profile record.
/// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
public static class Profile
{
/// <summary>
/// <summary>
/// DB record ID of profile
/// </summary>
- public const uint Id = (uint)PropertyIds.ProfileId;
+ public const uint Id = (uint)Property.Id.ProfileId;
/// <summary>
/// Contacts ID that the profile belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ProfileContactId;
+ public const uint ContactId = (uint)Property.Id.ProfileContactId;
/// <summary>
/// Unique identifier
/// </summary>
- public const uint Uid = (uint)PropertyIds.ProfileUid;
+ public const uint UId = (uint)Property.Id.ProfileUId;
/// <summary>
/// Profile contents
/// </summary>
- public const uint Text = (uint)PropertyIds.ProfileText;
+ public const uint Text = (uint)Property.Id.ProfileText;
/// <summary>
/// Priority to display the profile
/// </summary>
- public const uint Order = (uint)PropertyIds.ProfileOrder;
+ public const uint Order = (uint)Property.Id.ProfileOrder;
/// <summary>
/// Data for app_control_set_operation
/// </summary>
- public const uint ServiceOperation = (uint)PropertyIds.ProfileServiceOperation;
+ public const uint ServiceOperation = (uint)Property.Id.ProfileServiceOperation;
/// <summary>
/// Data for app_control_set_mime
/// </summary>
- public const uint Mime = (uint)PropertyIds.ProfileMIME;
+ public const uint Mime = (uint)Property.Id.ProfileMIME;
/// <summary>
/// Data for app_control_set_app_id
/// </summary>
- public const uint AppId = (uint)PropertyIds.ProfileAppId;
+ public const uint AppId = (uint)Property.Id.ProfileAppId;
/// <summary>
/// Data for app_control_set_uri
/// </summary>
- public const uint ProfileUri = (uint)PropertyIds.ProfileUri;
+ public const uint ProfileUri = (uint)Property.Id.ProfileUri;
/// <summary>
/// Data for app_control_set_category
/// </summary>
- public const uint Category = (uint)PropertyIds.ProfileCategory;
+ public const uint Category = (uint)Property.Id.ProfileCategory;
/// <summary>
/// It includes "key:value,key:value," pairs. You should parse it. And you must base64 encode each key and value
/// </summary>
- public const uint ExtraData = (uint)PropertyIds.ProfileExtraData;
+ public const uint ExtraData = (uint)Property.Id.ProfileExtraData;
}
/// <summary>
- /// Describes properies of a Sip record.
+ /// Describes properties of a Sip record.
/// </summary>
public static class Sip
{
/// <summary>
/// DB record ID of the sip
/// </summary>
- public const uint Id = (uint)PropertyIds.SipId;
+ public const uint Id = (uint)Property.Id.SipId;
/// <summary>
/// Contact ID that the sip belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.SipContactId;
+ public const uint ContactId = (uint)Property.Id.SipContactId;
/// <summary>
/// SIP address
/// </summary>
- public const uint Address = (uint)PropertyIds.SipAddress;
+ public const uint Address = (uint)Property.Id.SipAddress;
/// <summary>
- /// sip type, refer to the Types
+ /// sip type, refer to the TypeValue
/// </summary>
- public const uint Type = (uint)PropertyIds.SipType;
+ public const uint Type = (uint)Property.Id.SipType;
/// <summary>
- /// Custom sip type label, when the sip type is Types.Custom
+ /// Custom sip type label, when the sip type is TypeValue.Custom
/// </summary>
- public const uint Label = (uint)PropertyIds.SipLabel;
+ public const uint Label = (uint)Property.Id.SipLabel;
/// <summary>
/// Enumeration for Contact SIP type.
/// </summary>
- public enum Types
+ public enum TypeValue
{
/// <summary>
/// Other SIP type
}
/// <summary>
- /// Describes properies of a Extension record.
+ /// Describes properties of a Extension record.
/// </summary>
public static class Extension
{
/// <summary>
/// DB record ID of the contact extension
/// </summary>
- public const uint Id = (uint)PropertyIds.ExtensionId;
+ public const uint Id = (uint)Property.Id.ExtensionId;
/// <summary>
/// Contact ID that the contact extension belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ExtensionContactId;
+ public const uint ContactId = (uint)Property.Id.ExtensionContactId;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data1 = (uint)PropertyIds.ExtensionData1;
+ public const uint Data1 = (uint)Property.Id.ExtensionData1;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data2 = (uint)PropertyIds.ExtensionData2;
+ public const uint Data2 = (uint)Property.Id.ExtensionData2;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data3 = (uint)PropertyIds.ExtensionData3;
+ public const uint Data3 = (uint)Property.Id.ExtensionData3;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data4 = (uint)PropertyIds.ExtensionData4;
+ public const uint Data4 = (uint)Property.Id.ExtensionData4;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data5 = (uint)PropertyIds.ExtensionData5;
+ public const uint Data5 = (uint)Property.Id.ExtensionData5;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data6 = (uint)PropertyIds.ExtensionData6;
+ public const uint Data6 = (uint)Property.Id.ExtensionData6;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data7 = (uint)PropertyIds.ExtensionData7;
+ public const uint Data7 = (uint)Property.Id.ExtensionData7;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data8 = (uint)PropertyIds.ExtensionData8;
+ public const uint Data8 = (uint)Property.Id.ExtensionData8;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data9 = (uint)PropertyIds.ExtensionData9;
+ public const uint Data9 = (uint)Property.Id.ExtensionData9;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data10 = (uint)PropertyIds.ExtensionData10;
+ public const uint Data10 = (uint)Property.Id.ExtensionData10;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data11 = (uint)PropertyIds.ExtensionData11;
+ public const uint Data11 = (uint)Property.Id.ExtensionData11;
/// <summary>
/// The extra child record format for non-provided from contacts-service
/// </summary>
- public const uint Data12 = (uint)PropertyIds.ExtensionData12;
+ public const uint Data12 = (uint)Property.Id.ExtensionData12;
}
/// <summary>
- /// Describes properies of a Group relation record.
+ /// Describes properties of a Group relation record.
/// </summary>
public static class GroupRelation
{
/// <summary>
/// DB record ID of the group relation (can not be used as filter)
/// </summary>
- public const uint Id = (uint)PropertyIds.GroupRelationId;
+ public const uint Id = (uint)Property.Id.GroupRelationId;
/// <summary>
/// DB record ID of the group
/// </summary>
- public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId;
+ public const uint GroupId = (uint)Property.Id.GroupRelationGroupId;
/// <summary>
/// DB record ID of the contact
/// </summary>
- public const uint ContactId = (uint)PropertyIds.GroupRelationContactId;
+ public const uint ContactId = (uint)Property.Id.GroupRelationContactId;
/// <summary>
/// Group name
/// </summary>
- public const uint Name = (uint)PropertyIds.GroupRelationGroupName;
+ public const uint Name = (uint)Property.Id.GroupRelationGroupName;
}
/// <summary>
- /// Describes properies of a Speed dial record.
+ /// Describes properties of a Speed dial record.
/// </summary>
public static class SpeedDial
{
/// <summary>
/// Stored speed dial number
/// </summary>
- public const uint SpeedDialNumber = (uint)PropertyIds.SpeedDialDialNumber;
+ public const uint SpeedDialNumber = (uint)Property.Id.SpeedDialDialNumber;
/// <summary>
/// Number ID that the speed dial belongs to
/// </summary>
- public const uint NumberId = (uint)PropertyIds.SpeedDialNumberId;
+ public const uint NumberId = (uint)Property.Id.SpeedDialNumberId;
/// <summary>
/// Contact number of specified speed dial
/// </summary>
- public const uint Number = (uint)PropertyIds.SpeedDialNumber;
+ public const uint Number = (uint)Property.Id.SpeedDialNumber;
/// <summary>
/// Contact number label of specified speed dial, when the number type is Number.Types.Custom
/// </summary>
- public const uint NumberLabel = (uint)PropertyIds.SpeedDialNumberLabel;
+ public const uint NumberLabel = (uint)Property.Id.SpeedDialNumberLabel;
/// <summary>
/// Contact number type, refer to the Number.Types
/// </summary>
- public const uint NumberType = (uint)PropertyIds.SpeedDialNumberType;
+ public const uint NumberType = (uint)Property.Id.SpeedDialNumberType;
/// <summary>
/// Person ID that the speed dial belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.SpeedDialPersonId;
+ public const uint PersonId = (uint)Property.Id.SpeedDialPersonId;
/// <summary>
/// Display name that the speed dial belongs to
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.SpeedDialDisplayName;
+ public const uint DisplayName = (uint)Property.Id.SpeedDialDisplayName;
/// <summary>
/// Image thumbnail path that the speed dial belongs to
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.SpeedDialThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.SpeedDialThumbnail;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint NormalizedNumber = (uint)PropertyIds.SpeedDialNormalizedNumber;
+ public const uint NormalizedNumber = (uint)Property.Id.SpeedDialNormalizedNumber;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint CleanedNumber = (uint)PropertyIds.SpeedDialCleanedNumber;
+ public const uint CleanedNumber = (uint)Property.Id.SpeedDialCleanedNumber;
/// <summary>
- /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly
+ /// If you add filter with this property, the string will be normalized as minimal match length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly
/// </summary>
- public const uint NumberFilter = (uint)PropertyIds.SpeedDialNumberFilter;
+ public const uint NumberFilter = (uint)Property.Id.SpeedDialNumberFilter;
}
/// <summary>
- /// Describes properies of a Phone log record.
+ /// Describes properties of a Phone log record.
/// </summary>
public static class PhoneLog
{
/// <summary>
/// DB record ID of phone log
/// </summary>
- public const uint Id = (uint)PropertyIds.PhonelogId;
+ public const uint Id = (uint)Property.Id.PhonelogId;
/// <summary>
/// Person ID that the phone log belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PhonelogPersonId;
+ public const uint PersonId = (uint)Property.Id.PhonelogPersonId;
/// <summary>
/// Number or Email that the phone log displays
/// </summary>
- public const uint Address = (uint)PropertyIds.PhonelogAddress;
+ public const uint Address = (uint)Property.Id.PhonelogAddress;
/// <summary>
/// Call end time. The value means number of seconds since 1970-01-01 00:00:00 (UTC)
/// </summary>
- public const uint LogTime = (uint)PropertyIds.PhonelogLogTime;
+ public const uint LogTime = (uint)Property.Id.PhonelogLogTime;
/// <summary>
- /// Log type, refer to the Types
+ /// Log type, refer to the Type
/// </summary>
- public const uint LogType = (uint)PropertyIds.PhonelogLogType;
+ public const uint LogType = (uint)Property.Id.PhonelogLogType;
/// <summary>
/// You can set the related integer data (e.g. message_id, email_id or duration(seconds) of call)
/// </summary>
- public const uint ExtraData1 = (uint)PropertyIds.PhonelogExtraData1;
+ public const uint ExtraData1 = (uint)Property.Id.PhonelogExtraData1;
/// <summary>
/// You can set the related string data (e.g. short message, subject)
/// </summary>
- public const uint ExtraData2 = (uint)PropertyIds.PhonelogExtraData2;
+ public const uint ExtraData2 = (uint)Property.Id.PhonelogExtraData2;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint NormalizedAddress = (uint)PropertyIds.PhonelogNormalizedAddress;
+ public const uint NormalizedAddress = (uint)Property.Id.PhonelogNormalizedAddress;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint CleanedAddress = (uint)PropertyIds.PhonelogCleanedAddress;
+ public const uint CleanedAddress = (uint)Property.Id.PhonelogCleanedAddress;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint AddressFilter = (uint)PropertyIds.PhonelogAddressFilter;
+ public const uint AddressFilter = (uint)Property.Id.PhonelogAddressFilter;
/// <summary>
- /// You can set the related SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init()
+ /// You can set the related SIM slot number. SimSlotNo 0 means first SIM card, SimSlotNo 1 means second SIM.
/// </summary>
- public const uint SimSlotNo = (uint)PropertyIds.PhonelogSIMSlotNo;
+ public const uint SimSlotNo = (uint)Property.Id.PhonelogSIMSlotNo;
/// <summary>
/// Enumeration for Phone log type.
/// </summary>
- public enum Types
+ public enum Type
{
/// <summary>
/// None
/// <summary>
/// Confirmed missed video call
/// </summary>
- VidoeMissedSeen = 8,
+ VideoMissedSeen = 8,
/// <summary>
/// Rejected call
/// </summary>
/// <summary>
/// Incoming MMS
/// </summary>
- MmsIncoming = 101,
+ MMSIncoming = 101,
/// <summary>
/// Outgoing MMS
/// </summary>
- MmsOutgoing = 102,
+ MMSOutgoing = 102,
/// <summary>
/// Incoming SMS
/// </summary>
- SmsIncoming = 103,
+ SMSIncoming = 103,
/// <summary>
/// Outgoing SMS
/// </summary>
- SmsOutgoing = 104,
+ SMSOutgoing = 104,
/// <summary>
/// Blocked SMS
/// </summary>
- SmsBlocked = 105,
+ SMSBlocked = 105,
/// <summary>
/// Blocked MMS
/// </summary>
- MmsBlocked = 106,
+ MMSBlocked = 106,
/// <summary>
/// Received email
/// </summary>
}
/// <summary>
- /// Describes properies of a Contact updated information record.
+ /// Describes properties of a Contact updated information record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class ContactUpdatedInfo
/// <summary>
/// Updated contact ID
/// </summary>
- public const uint ContactId = (uint)PropertyIds.UpdateInfoId;
+ public const uint ContactId = (uint)Property.Id.UpdateInfoId;
/// <summary>
- /// Addressbook ID that the updated contact belongs to
+ /// AddressBook ID that the updated contact belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.UpdateInfoAddressBookId;
/// <summary>
- /// Contact change type, refer to the ContactsViews.ChangeTypes
+ /// Contact change type, refer to the ContactsViews.ChangeType
/// </summary>
- public const uint Type = (uint)PropertyIds.UpdateInfoType;
+ public const uint Type = (uint)Property.Id.UpdateInfoType;
/// <summary>
/// Updated version
/// </summary>
- public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
+ public const uint Version = (uint)Property.Id.UpdateInfoVersion;
/// <summary>
/// Contact image is changed or not
/// </summary>
- public const uint ImageChanged = (uint)PropertyIds.UpdateInfoImageChanged;
+ public const uint ImageChanged = (uint)Property.Id.UpdateInfoImageChanged;
}
/// <summary>
- /// Describes properies of a My profile updated information record.
+ /// Describes properties of a My profile updated information record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class MyProfileUpdatedInfo
/// <summary>
/// Address book ID that the updated my profile belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.UpdateInfoAddressBookId;
/// <summary>
- /// MyProfile change type, refer to the ContactsViews.ChangeTypes
+ /// MyProfile change type, refer to the ContactsViews.ChangeType
/// </summary>
- public const uint LastChangedType = (uint)PropertyIds.UpdateInfoLastChangedType;
+ public const uint LastChangedType = (uint)Property.Id.UpdateInfoLastChangedType;
/// <summary>
/// Updated version
/// </summary>
- public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
+ public const uint Version = (uint)Property.Id.UpdateInfoVersion;
}
/// <summary>
- /// Describes properies of a Group updated information record.
+ /// Describes properties of a Group updated information record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class GroupUpdatedInfo
/// <summary>
/// Updated group ID
/// </summary>
- public const uint GroupId = (uint)PropertyIds.UpdateInfoId;
+ public const uint GroupId = (uint)Property.Id.UpdateInfoId;
/// <summary>
/// Address book ID that the updated group belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.UpdateInfoAddressBookId;
/// <summary>
- /// Group change type, refer to the ContactsViews.ChangeTypes
+ /// Group change type, refer to the ContactsViews.ChangeType
/// </summary>
- public const uint Type = (uint)PropertyIds.UpdateInfoType;
+ public const uint Type = (uint)Property.Id.UpdateInfoType;
/// <summary>
/// Updated version
/// </summary>
- public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
+ public const uint Version = (uint)Property.Id.UpdateInfoVersion;
}
/// <summary>
- /// Describes properies of a Group Member updated information record.
+ /// Describes properties of a Group Member updated information record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class GroupMemberUpdatedInfo
/// <summary>
/// Updated group ID
/// </summary>
- public const uint GroupId = (uint)PropertyIds.UpdateInfoId;
+ public const uint GroupId = (uint)Property.Id.UpdateInfoId;
/// <summary>
/// Address book ID that the updated group belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.UpdateInfoAddressBookId;
/// <summary>
/// Updated version
/// </summary>
- public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
+ public const uint Version = (uint)Property.Id.UpdateInfoVersion;
}
/// <summary>
- /// Describes properies of a Relation updated information record.
+ /// Describes properties of a Relation updated information record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class GroupRelationUpdatedInfo
/// <summary>
/// Group ID of group relation
/// </summary>
- public const uint GroupId = (uint)PropertyIds.GroupId;
+ public const uint GroupId = (uint)Property.Id.GroupId;
/// <summary>
/// Contact ID of the updated group relation
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
/// Address book ID of contact that the updated group relation
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.AddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.AddressBookId;
/// <summary>
- /// Group relation change type, refer to the ContactsViews.ChangeTypes
+ /// Group relation change type, refer to the ContactsViews.ChangeType
/// </summary>
- public const uint Type = (uint)PropertyIds.UpdateInfoType;
+ public const uint Type = (uint)Property.Id.UpdateInfoType;
/// <summary>
/// Updated version
/// </summary>
- public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
+ public const uint Version = (uint)Property.Id.UpdateInfoVersion;
}
/// <summary>
- /// Describes properies of a Person & Contact record.
+ /// Describes properties of a PersonContact record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonContact
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// Status of social account (projection)
/// </summary>
- public const uint Status = (uint)PropertyIds.PersonStatus;
+ public const uint Status = (uint)Property.Id.PersonStatus;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// Link count of contact records (projection)
/// </summary>
- public const uint LinkCount = (uint)PropertyIds.PersonLinkCount;
+ public const uint LinkCount = (uint)Property.Id.PersonLinkCount;
/// <summary>
/// Contact ID that the person belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
- /// Addressbook IDs that the person belongs to (projection)
+ /// AddressBook IDs that the person belongs to (projection)
/// </summary>
- public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds;
+ public const uint AddressBookIds = (uint)Property.Id.PersonAddressBookIds;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
- /// Addressbook ID that the person belongs to
+ /// AddressBook ID that the person belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
- /// Addressbook mode, refer to the Addressbook.Modes
+ /// AddressBook mode, refer to the AddressBook.Mode
/// </summary>
- public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode;
+ public const uint AddressBookMode = (uint)Property.Id.AddressBookMode;
/// <summary>
- /// Addressbook name that the person belongs to
+ /// AddressBook name that the person belongs to
/// </summary>
- public const uint AddressbookName = (uint)PropertyIds.AddressbookName;
+ public const uint AddressBookName = (uint)Property.Id.AddressBookName;
/// <summary>
- /// kerword matched data type, refer to the Contact.DataTypes
+ /// keyword matched data type, refer to the Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Number record.
+ /// Describes properties of a PersonNumber record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonNumber
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
/// Number ID that the person belongs to
/// </summary>
- public const uint NumberId = (uint)PropertyIds.NumberId;
+ public const uint NumberId = (uint)Property.Id.NumberId;
/// <summary>
/// Number type, refer to the Number.Types (projection)
/// </summary>
- public const uint Type = (uint)PropertyIds.NumberType;
+ public const uint Type = (uint)Property.Id.NumberType;
/// <summary>
/// Custom number type label, when the number type is Number.Types.Custom (projection)
/// </summary>
- public const uint Label = (uint)PropertyIds.NumberLabel;
+ public const uint Label = (uint)Property.Id.NumberLabel;
/// <summary>
/// The number is default number or not
/// </summary>
- public const uint IsPrimaryDefault = (uint)PropertyIds.DataIsPrimaryDefault;
+ public const uint IsPrimaryDefault = (uint)Property.Id.DataIsPrimaryDefault;
/// <summary>
/// Number
/// </summary>
- public const uint Number = (uint)PropertyIds.NumberNumber;
+ public const uint Number = (uint)Property.Id.NumberNumber;
/// <summary>
- /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly.
+ /// If you add filter with this property, the string will be normalized as minimal match length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly.
/// </summary>
- public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter;
+ public const uint NumberFilter = (uint)Property.Id.NumberNumberFilter;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber;
+ public const uint NormalizedNumber = (uint)Property.Id.NumberNormalizedNumber;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber;
+ public const uint CleanedNumber = (uint)Property.Id.NumberCleanedNumber;
/// <summary>
- /// kerword matched data type, refer to they Contact.DataTypes
+ /// keyword matched data type, refer to they Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Email record.
+ /// Describes properties of a PersonEmail record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonEmail
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
/// Email ID that the person belongs to
/// </summary>
- public const uint EmailId = (uint)PropertyIds.EmailId;
+ public const uint EmailId = (uint)Property.Id.EmailId;
/// <summary>
/// Email type, refer to the Email.Types (projection)
/// </summary>
- public const uint Type = (uint)PropertyIds.EmailType;
+ public const uint Type = (uint)Property.Id.EmailType;
/// <summary>
/// Custom mail type label, when the email type is Email.Types.Custom (projection)
/// </summary>
- public const uint Label = (uint)PropertyIds.EmailLabel;
+ public const uint Label = (uint)Property.Id.EmailLabel;
/// <summary>
/// The email is default email or not
/// </summary>
- public const uint IsPrimaryDefault = (uint)PropertyIds.DataIsPrimaryDefault;
+ public const uint IsPrimaryDefault = (uint)Property.Id.DataIsPrimaryDefault;
/// <summary>
/// Email address
/// </summary>
- public const uint Email = (uint)PropertyIds.EmailEmail;
+ public const uint Email = (uint)Property.Id.EmailEmail;
/// <summary>
- /// kerword matched data type, refer to they Contact.DataTypes
+ /// keyword matched data type, refer to they Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Group Relation record.
+ /// Describes properties of a PersonGroupRelation record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonGroupRelation
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// Status of social account (projection)
/// </summary>
- public const uint Status = (uint)PropertyIds.PersonStatus;
+ public const uint Status = (uint)Property.Id.PersonStatus;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
- /// Link count of contat records (projection)
+ /// Link count of contact records (projection)
/// </summary>
- public const uint LinkCount = (uint)PropertyIds.PersonLinkCount;
+ public const uint LinkCount = (uint)Property.Id.PersonLinkCount;
/// <summary>
- /// Addressbook IDs that the person belongs to (projection)
+ /// AddressBook IDs that the person belongs to (projection)
/// </summary>
- public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds;
+ public const uint AddressBookIds = (uint)Property.Id.PersonAddressBookIds;
/// <summary>
- /// Addressbook ID that the person belongs to
+ /// AddressBook ID that the person belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
- /// Addressbook name that the person belongs to
+ /// AddressBook name that the person belongs to
/// </summary>
- public const uint AddressbookName = (uint)PropertyIds.AddressbookName;
+ public const uint AddressBookName = (uint)Property.Id.AddressBookName;
/// <summary>
- /// Addressbook mode, refer to the Addressbook.Modes
+ /// AddressBook mode, refer to the AddressBook.Mode
/// </summary>
- public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode;
+ public const uint AddressBookMode = (uint)Property.Id.AddressBookMode;
/// <summary>
/// Group ID that the person belongs to
/// </summary>
- public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId;
+ public const uint GroupId = (uint)Property.Id.GroupRelationGroupId;
/// <summary>
/// Contact ID that the person belongs to (projection)
/// </summary>
- public const uint ContactId = (uint)PropertyIds.GroupRelationContactId;
+ public const uint ContactId = (uint)Property.Id.GroupRelationContactId;
/// <summary>
- /// kerword matched data type, refer to they Contact.DataTypes
+ /// keyword matched data type, refer to they Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Group Assigned record.
+ /// Describes properties of a PersonGroupAssignedrecord.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonGroupAssigned
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// Status of social account (projection)
/// </summary>
- public const uint Status = (uint)PropertyIds.PersonStatus;
+ public const uint Status = (uint)Property.Id.PersonStatus;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
/// Link count of contact records (projection)
/// </summary>
- public const uint LinkCount = (uint)PropertyIds.PersonLinkCount;
+ public const uint LinkCount = (uint)Property.Id.PersonLinkCount;
/// <summary>
- /// Addressbook IDs that the linked person belongs to (projection)
+ /// AddressBook IDs that the linked person belongs to (projection)
/// </summary>
- public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds;
+ public const uint AddressBookIds = (uint)Property.Id.PersonAddressBookIds;
/// <summary>
- /// Addressbook ID that the person belongs to
+ /// AddressBook ID that the person belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
- /// Addressbook mode, refer to the Addressbook.Modes
+ /// AddressBook mode, refer to the AddressBook.Mode
/// </summary>
- public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode;
+ public const uint AddressBookMode = (uint)Property.Id.AddressBookMode;
/// <summary>
/// Group ID that the person belongs to
/// </summary>
- public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId;
+ public const uint GroupId = (uint)Property.Id.GroupRelationGroupId;
/// <summary>
/// Contact ID that the person belongs to (projection)
/// </summary>
- public const uint ContactId = (uint)PropertyIds.GroupRelationContactId;
+ public const uint ContactId = (uint)Property.Id.GroupRelationContactId;
/// <summary>
- /// kerword matched data type, refer to they Contact.DataTypes
+ /// keyword matched data type, refer to they Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Group Not Assigned record.
+ /// Describes properties of a PersonGroupNotAssigned record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonGroupNotAssigned
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// Status of social account (projection)
/// </summary>
- public const uint Status = (uint)PropertyIds.PersonStatus;
+ public const uint Status = (uint)Property.Id.PersonStatus;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
/// Link count of contact records (projection)
/// </summary>
- public const uint LinkCount = (uint)PropertyIds.PersonLinkCount;
+ public const uint LinkCount = (uint)Property.Id.PersonLinkCount;
/// <summary>
- /// Addressbook IDs that the linked person belongs to (projection)
+ /// AddressBook IDs that the linked person belongs to (projection)
/// </summary>
- public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds;
+ public const uint AddressBookIds = (uint)Property.Id.PersonAddressBookIds;
/// <summary>
- /// Addressbook ID that the person belongs to
+ /// AddressBook ID that the person belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
- /// Addressbook mode, refer to the Addressbook.Modes
+ /// AddressBook mode, refer to the AddressBook.Mode
/// </summary>
- public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode;
+ public const uint AddressBookMode = (uint)Property.Id.AddressBookMode;
/// <summary>
/// Contact ID that the person belongs to (projection)
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
- /// kerword matched data type, refer to they Contact.DataTypes
+ /// keyword matched data type, refer to they Contact.DataType
/// </summary>
- public const uint SnippetType = (uint)PropertyIds.PersonSnippetType;
+ public const uint SnippetType = (uint)Property.Id.PersonSnippetType;
/// <summary>
/// keyword matched data string
/// </summary>
- public const uint SnippetString = (uint)PropertyIds.PersonSnippetString;
+ public const uint SnippetString = (uint)Property.Id.PersonSnippetString;
};
/// <summary>
- /// Describes properies of a Person & Phone Log record.
+ /// Describes properties of a PersonPhoneLog record.
/// </summary>
/// <remarks>Read only view</remarks>
- public static class PersonPhonelog
+ public static class PersonPhoneLog
{
/// <summary>
/// Identifier of this phone log view
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// DB record ID of phone log
/// </summary>
- public const uint LogId = (uint)PropertyIds.PhonelogId;
+ public const uint LogId = (uint)Property.Id.PhonelogId;
/// <summary>
/// Number or Email that the phone log displays
/// </summary>
- public const uint Address = (uint)PropertyIds.PhonelogAddress;
+ public const uint Address = (uint)Property.Id.PhonelogAddress;
/// <summary>
/// Number or Email type (projection)
/// </summary>
- public const uint AddressType = (uint)PropertyIds.DataData1;
+ public const uint AddressType = (uint)Property.Id.DataData1;
/// <summary>
/// Call end time. The value means number of seconds since 1970-01-01 00:00:00 (UTC)
/// </summary>
- public const uint LogTime = (uint)PropertyIds.PhonelogLogTime;
+ public const uint LogTime = (uint)Property.Id.PhonelogLogTime;
/// <summary>
/// Log type, refer to the PhoneLog.Types
/// </summary>
- public const uint LogType = (uint)PropertyIds.PhonelogLogType;
+ public const uint LogType = (uint)Property.Id.PhonelogLogType;
/// <summary>
/// You can set the related integer data (e.g. message_id, email_id or duration(seconds) of call) (projection)
/// </summary>
- public const uint ExtraData1 = (uint)PropertyIds.PhonelogExtraData1;
+ public const uint ExtraData1 = (uint)Property.Id.PhonelogExtraData1;
/// <summary>
/// You can set the related string data (e.g. short message, subject) (projection)
/// </summary>
- public const uint ExtraData2 = (uint)PropertyIds.PhonelogExtraData2;
+ public const uint ExtraData2 = (uint)Property.Id.PhonelogExtraData2;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint NormalizedAddress = (uint)PropertyIds.PhonelogNormalizedAddress;
+ public const uint NormalizedAddress = (uint)Property.Id.PhonelogNormalizedAddress;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint CleanedAddress = (uint)PropertyIds.PhonelogCleanedAddress;
+ public const uint CleanedAddress = (uint)Property.Id.PhonelogCleanedAddress;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint AddressFilter = (uint)PropertyIds.PhonelogAddressFilter;
+ public const uint AddressFilter = (uint)Property.Id.PhonelogAddressFilter;
/// <summary>
- /// It is related to the SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init()
+ /// It is related to the SIM slot number. SimSlotNo 0 means first SIM card, SimSlotNo 1 means second SIM.
/// </summary>
- public const uint SIMSlotNo = (uint)PropertyIds.PhonelogSIMSlotNo;
+ public const uint SIMSlotNo = (uint)Property.Id.PhonelogSIMSlotNo;
};
/// <summary>
- /// Describes properies of a Person Usage record.
+ /// Describes properties of a Person Usage record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class PersonUsage
/// <summary>
/// DB record ID of the person
/// </summary>
- public const uint PersonId = (uint)PropertyIds.PersonId;
+ public const uint PersonId = (uint)Property.Id.PersonId;
/// <summary>
/// Display name of the person
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.PersonDisplayName;
+ public const uint DisplayName = (uint)Property.Id.PersonDisplayName;
/// <summary>
- /// The first character of first string for grouping. This is normalized using icu (projection)
+ /// The first character of first string for grouping. This is normalized using ICU (projection)
/// </summary>
- public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex;
+ public const uint DisplayNameIndex = (uint)Property.Id.PersonDisplayNameIndex;
/// <summary>
/// Display contact ID that the person belongs to (projection)
/// </summary>
- public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId;
+ public const uint DisplayContactId = (uint)Property.Id.PersonDisplayContactId;
/// <summary>
/// Ringtone path of the person (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.PersonRingtone;
+ public const uint RingtonePath = (uint)Property.Id.PersonRingtone;
/// <summary>
/// Image thumbnail path of the person (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.PersonThumbnail;
/// <summary>
/// Vibration path of the person (projection)
/// </summary>
- public const uint Vibration = (uint)PropertyIds.PersonVibration;
+ public const uint Vibration = (uint)Property.Id.PersonVibration;
/// <summary>
/// Message alert path of the person (projection)
/// </summary>
- public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert;
+ public const uint MessageAlert = (uint)Property.Id.PersonMessageAlert;
/// <summary>
/// The person is favorite or not
/// </summary>
- public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite;
+ public const uint IsFavorite = (uint)Property.Id.PersonIsFavorite;
/// <summary>
/// The person has phone number or not
/// </summary>
- public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber;
+ public const uint HasPhoneNumber = (uint)Property.Id.PersonHasPhoneNumber;
/// <summary>
/// The person has email or not
/// </summary>
- public const uint HasEmail = (uint)PropertyIds.PersonHasEmail;
+ public const uint HasEmail = (uint)Property.Id.PersonHasEmail;
/// <summary>
- /// Usage type, refer to the UsageTypes
+ /// Usage type, refer to the Type
/// </summary>
- public const uint UsageType = (uint)PropertyIds.PersonUsageType;
+ public const uint UsageType = (uint)Property.Id.PersonUsageType;
/// <summary>
/// Usage number of person
/// </summary>
- public const uint TimesUsed = (uint)PropertyIds.PersonTimesUsed;
+ public const uint TimesUsed = (uint)Property.Id.PersonTimesUsed;
/// <summary>
/// Enumeration for Person usage type.
/// </summary>
- public enum Types
+ public enum Type
{
/// <summary>
/// None
};
/// <summary>
- /// Describes properies of a Contact & Number record.
+ /// Describes properties of a ContactNumber record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class ContactNumber
/// <summary>
/// Contact ID that the number belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
/// Display name of contact that the number belongs to
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.ContactDisplayName;
+ public const uint DisplayName = (uint)Property.Id.ContactDisplayName;
/// <summary>
- /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection)
+ /// The source type of display name, refer to the Contact.DisplayNameSourceType (projection)
/// </summary>
- public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId;
+ public const uint DisplaySourceType = (uint)Property.Id.ContactDisplaySourceDataId;
/// <summary>
- /// Addressbook ID that the number belongs to
+ /// AddressBook ID that the number belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
/// Person ID that the number belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.ContactPersonId;
+ public const uint PersonId = (uint)Property.Id.ContactPersonId;
/// <summary>
/// Ringtone path that the number belongs to (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.ContactRingtone;
+ public const uint RingtonePath = (uint)Property.Id.ContactRingtone;
/// <summary>
/// Image thumbnail path that the number belongs to (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.ContactThumbnail;
/// <summary>
/// DB record ID of the number
/// </summary>
- public const uint NumberId = (uint)PropertyIds.NumberId;
+ public const uint NumberId = (uint)Property.Id.NumberId;
/// <summary>
/// Number type, refer to the Number.Types (projection)
/// </summary>
- public const uint Type = (uint)PropertyIds.NumberType;
+ public const uint Type = (uint)Property.Id.NumberType;
/// <summary>
/// Custom number type label, when the number type is Number.Types.Custom (projection)
/// </summary>
- public const uint Label = (uint)PropertyIds.NumberLabel;
+ public const uint Label = (uint)Property.Id.NumberLabel;
/// <summary>
/// The number is default number or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.NumberIsDefault;
+ public const uint IsDefault = (uint)Property.Id.NumberIsDefault;
/// <summary>
/// Number
/// </summary>
- public const uint Number = (uint)PropertyIds.NumberNumber;
+ public const uint Number = (uint)Property.Id.NumberNumber;
/// <summary>
- /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly
+ /// If you add filter with this property, the string will be normalized as minimal match length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly
/// </summary>
- public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter;
+ public const uint NumberFilter = (uint)Property.Id.NumberNumberFilter;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber;
+ public const uint NormalizedNumber = (uint)Property.Id.NumberNormalizedNumber;
/// <summary>
/// You can only use this property for search filter
/// </summary>
- public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber;
+ public const uint CleanedNumber = (uint)Property.Id.NumberCleanedNumber;
};
/// <summary>
- /// Describes properies of a Contact & Email record.
+ /// Describes properties of a ContactEmail record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class ContactEmail
/// <summary>
/// Contact ID that the number belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
/// Display name of contact that the number belongs to
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.ContactDisplayName;
+ public const uint DisplayName = (uint)Property.Id.ContactDisplayName;
/// <summary>
- /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection)
+ /// The source type of display name, refer to the Contact.DisplayNameSourceType (projection)
/// </summary>
- public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId;
+ public const uint DisplaySourceType = (uint)Property.Id.ContactDisplaySourceDataId;
/// <summary>
- /// Addressbook ID that the number belongs to
+ /// AddressBook ID that the number belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
/// Person ID that the number belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.ContactPersonId;
+ public const uint PersonId = (uint)Property.Id.ContactPersonId;
/// <summary>
/// Ringtone path that the number belongs to (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.ContactRingtone;
+ public const uint RingtonePath = (uint)Property.Id.ContactRingtone;
/// <summary>
/// Image thumbnail path that the number belongs to (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.ContactThumbnail;
/// <summary>
/// DB record ID of the email
/// </summary>
- public const uint EmailId = (uint)PropertyIds.EmailId;
+ public const uint EmailId = (uint)Property.Id.EmailId;
/// <summary>
/// Email type, refer to the Email.Types (projection)
/// </summary>
- public const uint Type = (uint)PropertyIds.EmailType;
+ public const uint Type = (uint)Property.Id.EmailType;
/// <summary>
/// Custom mail type label, when the email type is Email.Types.Custom (projection)
/// </summary>
- public const uint Label = (uint)PropertyIds.EmailLabel;
+ public const uint Label = (uint)Property.Id.EmailLabel;
/// <summary>
/// Email is default email or not
/// </summary>
- public const uint IsDefault = (uint)PropertyIds.EmailIsDefault;
+ public const uint IsDefault = (uint)Property.Id.EmailIsDefault;
/// <summary>
/// Email address
/// </summary>
- public const uint Email = (uint)PropertyIds.EmailEmail;
+ public const uint Email = (uint)Property.Id.EmailEmail;
};
/// <summary>
- /// Describes properies of a Contact & Group Relation record.
+ /// Describes properties of a ContactGroupRelation record.
/// </summary>
/// <remarks>Read only view</remarks>
public static class ContactGroupRelation
{
/// <summary>
- /// Identifier of this contact grouprel view
+ /// Identifier of this contact group relation view
/// </summary>
public const string Uri = "tizen.contacts_view.simple_contact/group";
/// <summary>
/// Contact ID that the number belongs to
/// </summary>
- public const uint ContactId = (uint)PropertyIds.ContactId;
+ public const uint ContactId = (uint)Property.Id.ContactId;
/// <summary>
/// Display name of contact that the number belongs to
/// </summary>
- public const uint DisplayName = (uint)PropertyIds.ContactDisplayName;
+ public const uint DisplayName = (uint)Property.Id.ContactDisplayName;
/// <summary>
- /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection)
+ /// The source type of display name, refer to the Contact.DisplayNameSourceType (projection)
/// </summary>
- public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId;
+ public const uint DisplaySourceType = (uint)Property.Id.ContactDisplaySourceDataId;
/// <summary>
- /// Addressbook ID that the number belongs to
+ /// AddressBook ID that the number belongs to
/// </summary>
- public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId;
+ public const uint AddressBookId = (uint)Property.Id.ContactAddressBookId;
/// <summary>
/// Person ID that the number belongs to
/// </summary>
- public const uint PersonId = (uint)PropertyIds.ContactPersonId;
+ public const uint PersonId = (uint)Property.Id.ContactPersonId;
/// <summary>
/// Ringtone path that the number belongs to (projection)
/// </summary>
- public const uint RingtonePath = (uint)PropertyIds.ContactRingtone;
+ public const uint RingtonePath = (uint)Property.Id.ContactRingtone;
/// <summary>
/// Image thumbnail path that the number belongs to (projection)
/// </summary>
- public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail;
+ public const uint ThumbnailPath = (uint)Property.Id.ContactThumbnail;
/// <summary>
/// DB record ID of the group relation
/// </summary>
- public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId;
+ public const uint GroupId = (uint)Property.Id.GroupRelationGroupId;
/// <summary>
/// Group name (projection)
/// </summary>
- public const uint GroupName = (uint)PropertyIds.GroupRelationGroupName;
+ public const uint GroupName = (uint)Property.Id.GroupRelationGroupName;
};
/// <summary>
- /// Describes properies of a Phone Log Statistics record.
+ /// Describes properties of a Phone Log Statistics record.
/// </summary>
/// <remarks>Read only view</remarks>
- public static class PhonelogStatistics
+ public static class PhoneLogStatistics
{
/// <summary>
/// Identifier of this log statistics view
/// <summary>
/// Log count (projection)
/// </summary>
- public const uint LogCount = (uint)PropertyIds.PhonelogStatLogCount;
+ public const uint LogCount = (uint)Property.Id.PhonelogStatLogCount;
/// <summary>
/// Log type, see the contacts_phone_log_type_e
/// </summary>
- public const uint LogType = (uint)PropertyIds.PhonelogStatLogType;
+ public const uint LogType = (uint)Property.Id.PhonelogStatLogType;
/// <summary>
/// It is related to the SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init()
/// </summary>
- public const uint SIMSlotNo = (uint)PropertyIds.PhonelogStatSIMSlotNo;
+ public const uint SIMSlotNo = (uint)Property.Id.PhonelogStatSIMSlotNo;
};
}
}
* limitations under the License.
*/
+using System;
using static Tizen.Pims.Contacts.ContactsDatabase;
namespace Tizen.Pims.Contacts
/// <summary>
/// Event arguments passed when contacts database status is changed
/// </summary>
- public class DBStatusChangedEventArgs
+ public class DBStatusChangedEventArgs : EventArgs
{
internal DBStatusChangedEventArgs(DBStatus status)
{
this.Status = status;
}
+ /// <summary>
+ /// The contacts database status.
+ /// </summary>
public DBStatus Status
{
get;
* limitations under the License.
*/
+using System;
+
namespace Tizen.Pims.Contacts
{
/// <summary>
/// Event arguments passed when setting value of contacts name display order is changed
/// </summary>
- public class NameDisplayOrderChangedEventArgs
+ public class NameDisplayOrderChangedEventArgs : EventArgs
{
internal NameDisplayOrderChangedEventArgs(ContactDisplayOrder displayOrder)
{
this.NameDisplayOrder = displayOrder;
}
+ /// <summary>
+ /// A setting value of contacts name display order
+ /// </summary>
public ContactDisplayOrder NameDisplayOrder
{
get;
* limitations under the License.
*/
+using System;
+
namespace Tizen.Pims.Contacts
{
/// <summary>
/// Event arguments passed when setting value of contacts name sorting order is changed
/// </summary>
- public class NameSortingOrderChangedEventArgs
+ public class NameSortingOrderChangedEventArgs : EventArgs
{
internal NameSortingOrderChangedEventArgs(ContactSortingOrder SortingOrder)
{
this.NameSortingOrder = SortingOrder;
}
+ /// <summary>
+ /// A setting value of contacts name sorting order
+ /// </summary>
public ContactSortingOrder NameSortingOrder
{
get;
using static Tizen.Telephony.CallHandle;
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Call Interop Class
+ /// The Call Interop class.
/// </summary>
internal static partial class Call
{
*/
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Libraries Interop Class
+ /// The Libraries Interop class.
/// </summary>
internal static partial class Libraries
{
using System.Runtime.InteropServices;
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Modem Interop Class
+ /// The Modem Interop class.
/// </summary>
internal static partial class Modem
{
using System.Runtime.InteropServices;
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Network Interop Class
+ /// The Network Interop class.
/// </summary>
internal static partial class Network
{
using System.Runtime.InteropServices;
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Sim Interop Class
+ /// The SIM Interop class.
/// </summary>
internal static partial class Sim
{
using Tizen.Telephony;
/// <summary>
-/// Partial Interop Class
+/// The Partial Interop class.
/// </summary>
internal static partial class Interop
{
/// <summary>
- /// Telephony Interop Class
+ /// The Telephony Interop class.
/// </summary>
internal static class Telephony
{
namespace Tizen.Telephony
{
/// <summary>
- /// The Call API's allows you to get the voice and video call states.
- /// It provides the List of CallHandle which can be used to get the information about call related actions.
+ /// The Call APIs allow you to get the voice and video call states.
+ /// It provides the list of CallHandle which can be used to get the information about call related actions.
/// </summary>
public class Call
{
private Interop.Call.SafeCallList _safeCallList;
/// <summary>
- /// Public Constructor
+ /// The public constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="handle">
- /// SlotHandle received in the Manager.Init API
+ /// SlotHandle received in the Manager.Init API.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="ArgumentNullException">
- /// This exception occurs if handle provided is null
+ /// This exception occurs if the handle provided is null.
/// </exception>
public Call(SlotHandle handle)
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// List of CallHandle for existing calls.
+ /// The list of the CallHandle for existing calls.
/// </returns>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
- /// <exception cref="ArgumentException">Incase of Invalid parameter</exception>
- /// <exception cref="InvalidOperationException">Incase of any System error</exception>
- /// <exception cref="UnauthorizedAccessException">Incase of Privileges are not defined</exception>
- /// <exception cref="OutOfMemoryException">Incase of Out of Memory</exception>
+ /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">In case of any system error.</exception>
+ /// <exception cref="UnauthorizedAccessException">In case of privileges not defined.</exception>
+ /// <exception cref="OutOfMemoryException">In case of out of memory.</exception>
public IEnumerable<CallHandle> GetCallHandleList()
{
uint count;
namespace Tizen.Telephony
{
/// <summary>
- /// This Class provides API's to get the information about calls.
+ /// This class provides the APIs to get the information about calls.
/// </summary>
public class CallHandle
{
public enum CallStatus
{
/// <summary>
- /// Idle status
+ /// Idle status.
/// </summary>
Idle,
/// <summary>
- /// Active status
+ /// Active status.
/// </summary>
Active,
/// <summary>
- /// Held status
+ /// Held status.
/// </summary>
Held,
/// <summary>
- /// Dialing status
+ /// Dialing status.
/// </summary>
Dialing,
/// <summary>
- /// Alerting status
+ /// Alerting status.
/// </summary>
Alerting,
/// <summary>
- /// Incoming status
+ /// Incoming status.
/// </summary>
Incoming,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
};
public enum CallType
{
/// <summary>
- /// Voice call
+ /// Voice call.
/// </summary>
Voice,
/// <summary>
- /// Video call
+ /// Video call.
/// </summary>
Video,
/// <summary>
- /// Emergency call
+ /// Emergency call.
/// </summary>
E911,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
};
public enum CallDirection
{
/// <summary>
- /// MO(Mobile Originated) call
+ /// MO(Mobile Originated) call.
/// </summary>
Mo,
/// <summary>
- /// MT(Mobile Terminated) call
+ /// MT(Mobile Terminated) call.
/// </summary>
Mt,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
};
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The id of the call handle
- /// 0 if unable to complete the operation
+ /// The ID of the call handle.
+ /// 0 if unable to complete the operation.
/// </value>
public uint HandleId
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The number of the call
- /// empty string if unable to complete the operation
+ /// The number of the call.
+ /// Empty string if unable to complete the operation.
/// </value>
public string Number
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The type of the call
+ /// The type of the call.
/// </value>
public CallType Type
{
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The status of the call
+ /// The status of the call.
/// </value>
public CallStatus Status
{
}
/// <summary>
- /// Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated).
+ /// Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated) call.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The direction of the call
+ /// The direction of the call.
/// </value>
/// <exception cref="InvalidOperationException">
/// This Exception can occur due to:
- /// 1. Operation Not Supported
+ /// 1. Operation Not Supported.
/// </exception>
public CallDirection Direction
{
}
/// <summary>
- /// Gets whether the call is conference call or not.
+ /// Gets whether the call is a conference call or not.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>
- /// The value whether the call is conference call or not. (true: Conference call, false: Single call)
+ /// The value whether the call is a conference call or not (true: Conference call, false: Single call).
/// </value>
public bool ConferenceStatus
{
namespace Tizen.Telephony
{
/// <summary>
- /// This Class contains the data related to the Notification event
+ /// This class contains the data related to the Notification event.
/// </summary>
public class ChangeNotificationEventArgs : EventArgs
{
}
/// <summary>
- /// Enumeration for Telephony notification.
+ /// Enumeration for the Telephony Notification.
/// </summary>
public enum Notification
{
/// <summary>
- /// Notification to be invoked when the SIM card state changes.
- /// SIM.State will be delivered in notification data.
+ /// The notification to be invoked when the SIM card state changes.
+ /// SIM.State will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
SimStatus = 0x10,
/// <summary>
- /// Notification to be invoked when the SIM call forwarding indicator state changes.
- /// 'state(bool)' will be delivered in notification data.
+ /// The notification to be invoked when the SIM call forwarding indicator state changes.
+ /// 'state(bool)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
SimCallForwardingIndicatorState,
/// <summary>
- /// Notification to be invoked when the network service state changes.
- /// Network.ServiceState will be delivered in notification data.
+ /// The notification to be invoked when the network service state changes.
+ /// Network.ServiceState will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkServiceState = 0x20,
/// <summary>
- /// Notification to be invoked when the cell ID changes.
- /// 'cell_id(int)' will be delivered in notification data.
+ /// The notification to be invoked when the cell ID changes.
+ /// 'cell_id(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkCellid,
/// <summary>
- /// Notification to be invoked when the roaming status changes.
- /// 'roaming_status(bool)' will be delivered in notification data.
+ /// The notification to be invoked when the roaming status changes.
+ /// 'roaming_status(bool)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkRoamingStatus,
/// <summary>
- /// Notification to be invoked when the signal strength changes.
- /// Network.Rssi will be delivered in notification data.
+ /// The notification to be invoked when the signal strength changes.
+ /// Network.Rssi will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkSignalstrengthLevel,
/// <summary>
- /// Notification to be invoked when the network name changes.
- /// 'network_name(string)' will be delivered in notification data.
+ /// The notification to be invoked when the network name changes.
+ /// 'network_name(string)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkNetworkName,
/// <summary>
- /// Notification to be invoked when the ps type changes.
- /// Network.PSType will be delivered in notification data.
+ /// The notification to be invoked when the PS type changes.
+ /// Network.PSType will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkPsType,
/// <summary>
- /// Notification to be invoked when the default data subscription changes.
- /// Network.DefaultDataSubscription will be delivered in notification data.
+ /// The notification to be invoked when the default data subscription changes.
+ /// Network.DefaultDataSubscription will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkDefaultDataSubscription,
/// <summary>
- /// Notification to be invoked when the default subscription changes.
- /// Network.DefaultSubscription will be delivered in notification data.
+ /// The notification to be invoked when the default subscription changes.
+ /// Network.DefaultSubscription will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkDefaultSubscription,
/// <summary>
- /// Notification to be invoked when the LAC (Location Area Code) changes.
- /// 'lac(int)' will be delivered in notification data.
+ /// The notification to be invoked when the LAC (Location Area Code) changes.
+ /// 'lac(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkLac,
/// <summary>
- /// Notification to be invoked when the TAC (Tracking Area Code) changes.
- /// 'tac(int)' will be delivered in notification data.
+ /// The notification to be invoked when the TAC (Tracking Area Code) changes.
+ /// 'tac(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkTac,
/// <summary>
- /// Notification to be invoked when the system ID changes.
- /// 'sid(int)' will be delivered in notification data.
+ /// The notification to be invoked when the system ID changes.
+ /// 'sid(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkSystemId,
/// <summary>
- /// Notification to be invoked when the network ID changes.
- /// 'nid(int)' will be delivered in notification data.
+ /// The notification to be invoked when the network ID changes.
+ /// 'nid(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkId,
/// <summary>
- /// Notification to be invoked when the base station ID changes.
- /// 'id(int)' will be delivered in notification data.
+ /// The notification to be invoked when the base station ID changes.
+ /// 'id(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkBsId,
/// <summary>
- /// Notification to be invoked when the base station latitude changes.
- /// 'latitude(int)' will be delivered in notification data.
+ /// The notification to be invoked when the base station latitude changes.
+ /// 'latitude(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkBsLatitude,
/// <summary>
- /// Notification to be invoked when the base station longitude changes.
- /// 'longitue(int)' will be delivered in notification data.
+ /// The notification to be invoked when the base station longitude changes.
+ /// 'longitue(int)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
NetworkBsLongitude,
/// <summary>
- /// Notification to be invoked when a voice call is in idle status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the idle status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusIdle,
/// <summary>
- /// Notification to be invoked when a voice call is in active status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the active status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusActive,
/// <summary>
- /// Notification to be invoked when a voice call is in held status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the held status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusHeld,
/// <summary>
- /// Notification to be invoked when a voice call is in dialing status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the dialing status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusDialing,
/// <summary>
- /// Notification to be invoked when a voice call is in alertingstatus.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the alerting status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusAlerting,
/// <summary>
- /// Notification to be invoked when a voice call is in incoming status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a voice call is in the incoming status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VoiceCallStatusIncoming,
/// <summary>
- /// Notification to be invoked when a video call is in idle status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a video call is in the idle status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VideoCallStatusIdle,
/// <summary>
- /// Notification to be invoked when a video call is in active status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a video call is in the active status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VideoCallStatusActive,
/// <summary>
- /// Notification to be invoked when a video call is in dialing status.
- /// 'handle id(uint)' will be delivered in notification data.
+ /// The notification to be invoked when a video call is in the dialing status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VideoCallStatusDialing,
/// <summary>
- /// Notification to be invoked when a video call is in alerting status.
- /// 'handle id(uint)' will be delivered in notification data
+ /// The notification to be invoked when a video call is in the alerting status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VideoCallStatusAlerting,
/// <summary>
- /// Notification to be invoked when a video call is in incoming status.
- /// 'handle id(uint)' will be delivered in notification data
+ /// The notification to be invoked when a video call is in the incoming status.
+ /// 'handle id(uint)' will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
/// </privilege>
VideoCallStatusIncoming,
/// <summary>
- /// Notification to be invoked when the preferred voice subscription changes.
- /// CallPreferredVoiceSubscription will be delivered in notification data
+ /// The notification to be invoked when the preferred voice subscription changes.
+ /// CallPreferredVoiceSubscription will be delivered in the notification data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>
};
/// <summary>
- /// Telephony notification type
+ /// The Telephony Notification type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public Notification NotificationType
}
/// <summary>
- /// Data as per the Notification type
+ /// The data as per the Notification type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public object NotificationData
namespace Tizen.Telephony
{
/// <summary>
- /// This Class provides API's to obtain information from the modem.
+ /// This class provides APIs to obtain information from the modem.
/// </summary>
public class Modem
{
internal IntPtr _handle;
/// <summary>
- /// Modem Class Constructor
+ /// The Modem class constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="handle">
- /// SlotHandle received in the Manager.Init API
+ /// SlotHandle received in the Manager.Init API.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="ArgumentNullException">
- /// This exception occurs if handle provided is null
+ /// This exception occurs if the handle provided is null.
/// </exception>
public Modem(SlotHandle handle)
{
}
/// <summary>
- /// Enumeration for Modem Power Status.
+ /// Enumeration for the Modem Power Status.
/// </summary>
public enum PowerStatus
{
/// <summary>
- /// Unknown
+ /// Unknown.
/// </summary>
Unknown = -1,
/// <summary>
- /// Modem power ON
+ /// Modem power ON.
/// </summary>
On,
/// <summary>
- /// Modem power OFF
+ /// Modem power OFF.
/// </summary>
Off,
/// <summary>
- /// Modem power RESET
+ /// Modem power RESET.
/// </summary>
Reset,
/// <summary>
- /// Modem power LOW
+ /// Modem power LOW.
/// </summary>
Low
};
/// <summary>
/// Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone.
- /// The IMEI number is used by a GSM network to identify valid devices and therefore can be used for stopping a stolen phone from accessing that network.
+ /// The IMEI number is used by a GSM network to identify valid devices and therefore, can be used for stopping a stolen phone from accessing that network.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The International Mobile Station Equipment Identity
- /// empty string if unable to complete the operation
+ /// The International Mobile Station Equipment Identity.
+ /// Empty string if unable to complete the operation.
/// </value>
public string Imei
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Modem power status (0=on,1=off,2=reset,3=low)
+ /// The Modem power status (0=on,1=off,2=reset,3=low).
/// </value>
public PowerStatus CurrentPowerStatus
{
}
/// <summary>
- /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone. (for CDMA)
+ /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone (for CDMA).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Mobile Equipment Identifier
- /// empty string if unable to complete the operation
+ /// The Mobile Equipment Identifier.
+ /// Empty string if unable to complete the operation.
/// </value>
public string Meid
{
namespace Tizen.Telephony
{
/// <summary>
- /// The Network class provides API's to obtain information about the current telephony service network.
+ /// The Network class provides APIs to obtain information about the current telephony service network.
/// </summary>
public class Network
{
internal IntPtr _handle;
/// <summary>
- /// Network Class Constructor
+ /// The Network class constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="handle">
- /// SlotHandle received in the Manager.Init API
+ /// SlotHandle received in the Manager.Init API.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="ArgumentNullException">
- /// This exception occurs if handle provided is null
+ /// This exception occurs if the handle provided is null.
/// </exception>
public Network(SlotHandle handle)
{
}
/// <summary>
- /// Enumeration for RSSI (Receive Signal Strength Indicator).
+ /// Enumeration for the RSSI (Receive Signal Strength Indicator).
/// Rssi6 indicates the highest strength.
/// </summary>
public enum Rssi
{
/// <summary>
- /// Strength 0
+ /// Strength 0.
/// </summary>
Rssi0,
/// <summary>
- /// Strength 1
+ /// Strength 1.
/// </summary>
Rssi1,
/// <summary>
- /// Strength 2
+ /// Strength 2.
/// </summary>
Rssi2,
/// <summary>
- /// Strength 3
+ /// Strength 3.
/// </summary>
Rssi3,
/// <summary>
- /// Strength 4
+ /// Strength 4.
/// </summary>
Rssi4,
/// <summary>
- /// Strength 5
+ /// Strength 5.
/// </summary>
Rssi5,
/// <summary>
- /// Strength 6
+ /// Strength 6.
/// </summary>
Rssi6,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
}
/// <summary>
- /// Enumeration for Network Type.
+ /// Enumeration for the network types.
/// </summary>
public enum Type
{
/// <summary>
- /// Unknown
+ /// Unknown.
/// </summary>
Unknown,
/// <summary>
- /// 2G GSM network type
+ /// 2G GSM network type.
/// </summary>
Gsm,
/// <summary>
- /// 2.5G GPRS network type
+ /// 2.5G GPRS network type.
/// </summary>
Gprs,
/// <summary>
- /// 2.5G EDGE network type
+ /// 2.5G EDGE network type.
/// </summary>
Edge,
/// <summary>
- /// 3G UMTS network type
+ /// 3G UMTS network type.
/// </summary>
Umts,
/// <summary>
- /// HSDPA network type
+ /// HSDPA network type.
/// </summary>
Hsdpa,
/// <summary>
- /// LTE network type
+ /// LTE network type.
/// </summary>
Lte,
/// <summary>
- /// IS95A network type
+ /// IS95A network type.
/// </summary>
Is95a,
/// <summary>
- /// IS95B network type
+ /// IS95B network type.
/// </summary>
Is95b,
/// <summary>
- /// CDMA 1x network type
+ /// CDMA 1x network type.
/// </summary>
Cdma1X,
/// <summary>
- /// EVDO revision 0 network type
+ /// EVDO revision 0 network type.
/// </summary>
EvdoRev0,
/// <summary>
- /// EVDO revision A network type
+ /// EVDO revision A network type.
/// </summary>
EvdoRevA,
/// <summary>
- /// EVDO revision B network type
+ /// EVDO revision B network type.
/// </summary>
EvdoRevB,
/// <summary>
- /// EVDV network type
+ /// EVDV network type.
/// </summary>
Evdv,
/// <summary>
- /// EHRPD network type
+ /// EHRPD network type.
/// </summary>
Ehrpd
}
/// <summary>
- /// Enumeration for PS Type.
+ /// Enumeration for the PS types.
/// </summary>
public enum PsType
{
/// <summary>
- /// Unknown
+ /// Unknown.
/// </summary>
Unknown,
/// <summary>
- /// HSDPA ps type
+ /// HSDPA PS type.
/// </summary>
Hsdpa,
/// <summary>
- /// HSUPA ps type
+ /// HSUPA PS type.
/// </summary>
Hsupa,
/// <summary>
- /// HSPA ps type
+ /// HSPA PS type.
/// </summary>
Hspa,
/// <summary>
- /// HSPAP ps type
+ /// HSPAP PS type.
/// </summary>
Hspap
}
/// <summary>
- /// Enumeration for Network Service State.
+ /// Enumeration for the network service states.
/// </summary>
public enum ServiceState
{
/// <summary>
- /// In service
+ /// In service.
/// </summary>
InService,
/// <summary>
- /// Out of service
+ /// Out of service.
/// </summary>
OutOfService,
/// <summary>
- /// Only emergency call is allowed
+ /// Only emergency call is allowed.
/// </summary>
EmergencyOnly,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
}
/// <summary>
- /// Enumeration for Network Name Priority.
+ /// Enumeration for the network name priority.
/// </summary>
public enum NameOption
{
/// <summary>
- /// Unknown
+ /// Unknown.
/// </summary>
Unknown,
/// <summary>
- /// Network name displayed by SPN
+ /// The network name displayed by the SPN.
/// </summary>
Spn,
/// <summary>
- /// Network name displayed by Network
+ /// The network name displayed by the Network.
/// </summary>
Network,
/// <summary>
- /// Network name displayed by SPN or Network
+ /// The network name displayed by the SPN or the Network.
/// </summary>
Any
}
/// <summary>
- /// Enumeration for the possible 'default' Data Subscriptions for Packet Switched(PS).
+ /// Enumeration for the possible 'default' Data Subscriptions for the Packet Switched(PS).
/// </summary>
public enum DefaultDataSubscription
{
/// <summary>
- /// Unknown status
+ /// Unknown status.
/// </summary>
Unknown = -1,
/// <summary>
- /// SIM 1
+ /// SIM 1.
/// </summary>
Sim1,
/// <summary>
- /// SIM 2
+ /// SIM 2.
/// </summary>
Sim2
}
/// <summary>
- /// Enumeration defines possible 'default' Subscriptions for Circuit Switched(CS).
+ /// Enumeration for defining the possible 'default' Subscriptions for the Circuit Switched(CS).
/// </summary>
public enum DefaultSubscription
{
/// <summary>
- /// Unknown status
+ /// Unknown status.
/// </summary>
Unknown = -1,
/// <summary>
- /// SIM 1 network
+ /// SIM 1 network.
/// </summary>
Sim1,
/// <summary>
- /// SIM 2 network
+ /// SIM 2 network.
/// </summary>
Sim2
}
/// <summary>
- /// Enumeration for network selection mode.
+ /// Enumeration for the network selection modes.
/// </summary>
public enum SelectionMode
{
/// <summary>
- /// Automatic mode
+ /// Automatic mode.
/// </summary>
Automatic,
/// <summary>
- /// Manual mode
+ /// Manual mode.
/// </summary>
Manual,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
}
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in GSM / WCDMA network.
+ /// This API can be used in the GSM/WCDMA network.
/// </remarks>
/// <value>
- /// The Location Area Code, -1 if unknown
+ /// The Location Area Code, -1 if unknown.
/// </value>
public int Lac
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in GSM / WCDMA / LTE network.
+ /// This API can be used in the GSM/WCDMA/LTE network.
/// </remarks>
/// <value>
- /// The cell identification number, -1 if unknown
+ /// The cell identification number, -1 if unknown.
/// </value>
public int CellId
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Received Signal Strength Indicator
+ /// The Received Signal Strength Indicator.
/// Higher the received number, the stronger the signal strength.
/// </value>
public Rssi CurrentRssi
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// true if roaming, otherwise false if not roaming
+ /// true if roaming, otherwise false if not roaming.
/// </value>
public bool RoamingStatus
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <remarks>
- /// This API can be used in GSM / WCDMA / LTE network.
+ /// This API can be used in the GSM/WCDMA/LTE network.
/// </remarks>
/// <value>
- /// The Mobile Country Code (three digits) Mobile Country Code (MCC) identifies the country where the cell is being used.
- /// empty string if unknown.
+ /// The Mobile Country Code (three digits). The Mobile Country Code (MCC) identifies the country where the cell is being used.
+ /// Empty string if unknown.
/// </value>
public string Mcc
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <remarks>
- /// This API can be used in GSM / WCDMA / LTE network.
+ /// This API can be used in the GSM/WCDMA/LTE network.
/// </remarks>
/// <value>
- /// The Mobile Network Code (three digits) The Mobile Network Code (MNC) identifies the mobile phone operator and network provider.
- /// empty string if unknown.
+ /// The Mobile Network Code (three digits). The Mobile Network Code (MNC) identifies the mobile phone operator and the network provider.
+ /// Empty string if unknown.
/// </value>
public string Mnc
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <remarks>
- /// This API can be used in GSM / WCDMA / LTE network.
+ /// This API can be used in the GSM/WCDMA/LTE network.
/// </remarks>
/// <value>
- /// The name of the current registered network
- /// empty string if unknown.
+ /// The name of the current registered network.
+ /// Empty string if unknown.
/// </value>
public string NetworkName
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <remarks>
- /// This API can be used in case network is in service.
+ /// This API can be used in case the network is in service.
/// </remarks>
/// <value>
- /// The network service type
+ /// The network service type.
/// </value>
public Type NetworkType
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <remarks>
- /// This API can be used in HSDPA network.
+ /// This API can be used in the HSDPA network.
/// </remarks>
/// <value>
- /// The type of packet service
+ /// The type of the packet service.
/// </value>
public PsType NetworkPsType
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The network name display option
+ /// The network name display option.
/// </value>
public NameOption NetworkNameOption
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The current network state
+ /// The current network state.
/// </value>
public ServiceState NetworkServiceState
{
}
/// <summary>
- /// Gets the current default subscription for data service (Packet Switched).
+ /// Gets the current default subscription for the data service (Packet Switched).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The current default data subscription
+ /// The current default data subscription.
/// </value>
public DefaultDataSubscription NetworkDefaultDataSubscription
{
}
/// <summary>
- /// Gets the current default subscription for voice service (Circuit Switched).
+ /// Gets the current default subscription for the voice service (Circuit Switched).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The current default voice subscription
+ /// The current default voice subscription.
/// </value>
public DefaultSubscription NetworkDefaultSubscription
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in LTE network.
+ /// This API can be used in the LTE network.
/// </remarks>
/// <value>
- /// The Tracking Area Code
- /// -1 if unknown
+ /// The Tracking Area Code.
+ /// -1 if unknown.
/// </value>
public int Tac
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in CDMA network.
+ /// This API can be used in the CDMA network.
/// </remarks>
/// <value>
- /// The system ID
- /// -1 if unknown
+ /// The system ID.
+ /// -1 if unknown.
/// </value>
public int SystemId
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in CDMA network.
+ /// This API can be used in the CDMA network.
/// </remarks>
/// <value>
- /// The network ID
- /// -1 if unknown
+ /// The network ID.
+ /// -1 if unknown.
/// </value>
public int NetworkId
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>>
/// <remarks>
- /// This API can be used in CDMA network.
+ /// This API can be used in the CDMA network.
/// </remarks>
/// <value>
- /// The base station ID
- /// -1 if unknown
+ /// The base station ID.
+ /// -1 if unknown.
/// </value>
public int BaseStationId
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in CDMA network.
+ /// This API can be used in the CDMA network.
/// </remarks>
/// <value>
- /// The base station latitude
- /// 0x7FFFFFFF if unknown
+ /// The base station latitude.
+ /// 0x7FFFFFFF if unknown.
/// </value>
public int BaseStationLatitude
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/location.coarse</privilege>
/// <remarks>
- /// This API can be used in CDMA network.
+ /// This API can be used in the CDMA network.
/// </remarks>
/// <value>
- /// The base station latitude
- /// 0x7FFFFFFF if unknown
+ /// The base station latitude.
+ /// 0x7FFFFFFF if unknown.
/// </value>
public int BaseStationLongitude
{
namespace Tizen.Telephony
{
/// <summary>
- /// This Class provides API's that allows you to extract information stored on a SIM card
+ /// This class provides APIs that allow you to extract the information stored on a SIM card.
/// </summary>
public class Sim
{
internal IntPtr _handle;
/// <summary>
- /// Sim Class Constructor
+ /// The SIM class constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="handle">
- /// SlotHandle received in the Manager.Init API
+ /// SlotHandle received in the Manager.Init API.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="ArgumentNullException">
- /// This exception occurs if handle provided is null
+ /// This exception occurs if the handle provided is null.
/// </exception>
public Sim(SlotHandle handle)
{
}
/// <summary>
- /// Enumeration for the state of SIM card.
+ /// Enumeration for the state of the SIM card.
/// </summary>
public enum State
{
/// <summary>
- /// SIM is not available on this device
+ /// The SIM is not available on this device.
/// </summary>
Unavailable,
/// <summary>
- /// SIM is locked
+ /// The SIM is locked.
/// </summary>
Locked,
/// <summary>
- /// SIM is available on this device (SIM is not locked)
+ /// The SIM is available on this device (SIM is not locked).
/// </summary>
Available,
/// <summary>
- /// SIM is in transition between states
+ /// The SIM is in transition between states.
/// </summary>
Unknown
}
/// <summary>
- /// Enumeration for the lock state of SIM card.
+ /// Enumeration for the lock state of the SIM card.
/// </summary>
public enum LockState
{
/// <summary>
- /// SIM is not in lock
+ /// The SIM is not in lock.
/// </summary>
Unknown,
/// <summary>
- /// SIM is PIN(Personal Identification Number) locked
+ /// The SIM is PIN (Personal Identification Number) locked.
/// </summary>
PinRequired,
/// <summary>
- /// SIM is PUK(Personal Unblocking Code) locked
+ /// The SIM is PUK (Personal Unblocking Code) locked.
/// </summary>
PukRequired,
/// <summary>
- /// SIM is permanently blocked(All the attempts for PIN/PUK failed)
+ /// The SIM is permanently blocked (All the attempts for PIN/PUK failed).
/// </summary>
PermLocked,
/// <summary>
- /// SIM is NCK(Network Control Key) locked
+ /// The SIM is NCK (Network Control Key) locked.
/// </summary>
NckRequired
}
/// <summary>
- /// Enumeration for the type of SIM card.
+ /// Enumeration for the type of the SIM card.
/// </summary>
public enum ApplicationType
{
/// <summary>
- /// SIM(GSM) Application
+ /// SIM (GSM) application.
/// </summary>
Sim = 0x01,
/// <summary>
- /// USIM Application
+ /// USIM application.
/// </summary>
Usim = 0x02,
/// <summary>
- /// CDMA Application
+ /// CDMA application.
/// </summary>
Csim = 0x04,
/// <summary>
- /// ISIM Application
+ /// ISIM application.
/// </summary>
Isim = 0x08
}
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Integrated Circuit Card Identification
- /// empty string if unable to complete the operation
+ /// The Integrated Circuit Card Identification.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string IccId
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The SIM Operator
- /// empty string if unable to complete the operation
+ /// The SIM Operator.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string Operator
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Mobile Subscription Identification Number
- /// empty string if unable to complete the operation
+ /// The Mobile Subscription Identification Number.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string Msin
{
/// <summary>
/// Gets the Service Provider Name (SPN) of the SIM card.
- /// Gets Service Provider Name embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned.
+ /// Gets Service Provider Name embedded in the SIM card. If this value is not stored in the SIM card, an empty string will be returned.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The Service Provider Name
- /// empty string if unable to complete the operation
+ /// The Service Provider Name.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string Spn
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// true if the current SIM card is different from the previous SIM card, otherwise false if the SIM card is not changed
+ /// true if the current SIM card is different from the previous SIM card, otherwise false if the SIM card is not changed.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public bool IsChanged
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The current state of the SIM
+ /// The current state of the SIM.
/// </value>
public State CurrentState
{
}
/// <summary>
- /// Gets the count of application on UICC.
+ /// Gets the count of an application on the UICC.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The masking value for below values are provided by the enum ApplicationType
- /// 0 if unable to complete the operation
+ /// The masking value for below values are provided by the enumeration ApplicationType.
+ /// 0 if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public uint ApplicationList
{
}
/// <summary>
- /// Gets subscriber number embedded in the SIM card. This value contains MSISDN related to the subscriber.
- /// If this value is not stored in SIM card, empty string will be returned.
+ /// Gets the subscriber number embedded in the SIM card. This value contains the MSISDN related to the subscriber.
+ /// If this value is not stored in SIM card, an empty string will be returned.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The subscriber number in the SIM
- /// empty string if unable to complete the operation
+ /// The subscriber number in the SIM.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string SubscriberNumber
{
}
/// <summary>
- /// Gets the Subscriber ID.
+ /// Gets the subscriber ID.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The subscriber ID
- /// empty string if unable to complete the operation
+ /// The subscriber ID.
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string SubscriberId
{
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The current lock state of the SIM
+ /// The current lock state of the SIM.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public LockState CurrentLockState
{
/// <summary>
/// Gets the GID1 (Group Identifier Level 1).
- /// Gets Group Identifier Level 1(GID1) embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned.
+ /// Gets Group Identifier Level 1 (GID1) embedded in the SIM card. If this value is not stored in SIM card, an empty string will be returned.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The GID1 (Group Identifier Level 1)
- /// empty string if unable to complete the operation
+ /// The GID1 (Group Identifier Level 1).
+ /// Empty string if unable to complete the operation.
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public string GroupId1
{
/// <summary>
/// Gets the call forwarding indicator state of the SIM.
- /// If the state is true, incoming call will be forwarded to the selected number.state indicates the CFU(Call Forwarding Unconditional) indicator status - Voice. (3GPP TS 31.102 4.2.64 EF CFIS)
+ /// If the state is true, the incoming call will be forwarded to the selected number. State indicates the CFU (Call Forwarding Unconditional) indicator status - Voice (3GPP TS 31.102 4.2.64 EF CFIS).
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <privilege>http://tizen.org/privilege/telephony</privilege>
/// <value>
- /// The value whether incoming call will be forwarded or not. (true: forwarded, false: not forwarded)
+ /// The value whether the incoming call will be forwarded or not (true: forwarded, false: not forwarded).
/// </value>
/// <precondition>
- /// The SIM state must be Available
+ /// The SIM state must be Available.
/// </precondition>
public bool CallForwardingIndicatorState
{
namespace Tizen.Telephony
{
/// <summary>
- /// This Class provides API's that provides functionality related to slot handle.
+ /// This class provides APIs that provide functionality related to the slot handle.
/// </summary>
public class SlotHandle
{
}
/// <summary>
- /// Event Handler for Receiving the Telephony State Changes
- /// this event will be triggered for the NotificationId's given in the SetNotificationId API
+ /// The event handler for receiving the Telephony state changes.
+ /// This event will be triggered for the NotificationIds given in the SetNotificationId API.
/// </summary>
public event EventHandler<ChangeNotificationEventArgs> ChangeNotification;
}
/// <summary>
- /// The Notification Id's for which the ChangeNotification event will be triggered
+ /// The notification IDs for which the ChangeNotification event will be triggered.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="list">
- /// The List of Notification Id's for which the ChangeNotification event will be triggered
+ /// The list of notification IDs for which the ChangeNotification event will be triggered.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="InvalidOperationException">
/// This Exception can occur due to:
- /// 1. Operation Not Supported
- /// 2. Operation Failed
+ /// 1. Operation not supported.
+ /// 2. Operation failed.
/// </exception>
public void SetNotificationId(IEnumerable<ChangeNotificationEventArgs.Notification> list)
{
}
/// <summary>
- /// The Notification Id's for which the ChangeNotification event will not be triggered
+ /// The notification IDs for which the ChangeNotification event will not be triggered.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="list">
- /// The List of Notification Id's for which the ChangeNotification event will be not be triggered
+ /// The list of notification IDs for which the ChangeNotification event will be not be triggered.
/// </param>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="InvalidOperationException">
/// This Exception can occur due to:
- /// 1. Operation Not Supported
- /// 2. Operation Failed
+ /// 1. Operation not supported.
+ /// 2. Operation failed.
/// </exception>
public void RemoveNotificationId(IEnumerable<ChangeNotificationEventArgs.Notification> list)
{
namespace Tizen.Telephony
{
/// <summary>
- /// This class contain the data related to the State changed event
+ /// This class contains the data related to the State changed event.
/// </summary>
public class StateEventArgs : EventArgs
{
}
/// <summary>
- /// The Current State
+ /// The Current State.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public State CurrentState
namespace Tizen.Telephony
{
/// <summary>
- /// Enumeration for the telephony state.
+ /// Enumeration for the telephony states.
/// </summary>
public enum State
{
/// <summary>
- /// Telephony state is not ready
+ /// The telephony state is not ready.
/// </summary>
NotReady,
/// <summary>
- /// Telephony state is ready
+ /// The telephony state is ready.
/// </summary>
Ready,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
Unavailable
};
public enum CallPreferredVoiceSubscription
{
/// <summary>
- /// Unknown status
+ /// Unknown status.
/// </summary>
Unknown = -1,
/// <summary>
- /// Current network
+ /// Current network.
/// </summary>
CurrentNetwork = 0,
/// <summary>
- /// ASK Always
+ /// Ask Always.
/// </summary>
AskAlways,
/// <summary>
- /// SIM 1
+ /// SIM 1.
/// </summary>
Sim1,
/// <summary>
- /// SIM 2
+ /// SIM 2.
/// </summary>
Sim2
};
/// <summary>
- /// This Class provides API's to Initialize and Deinitialize the framework
- /// it also provides API's to get the SlotHandle's which can then be used to get other Network/Sim/Call/Modem Information.
+ /// This class provides APIs to initialize and deinitialize the framework.
+ /// It also provides APIs to get the SlotHandles, which can then be used to get other Network/Sim/Call/Modem information.
/// </summary>
public static class Manager
{
};
/// <summary>
- /// Event Handler to be invoked when the telephony state changes.
+ /// The event handler to be invoked when the telephony state changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static event EventHandler<StateEventArgs> StateChanged
}
/// <summary>
- /// Acquires the Number of available handles to use the telephony API.
+ /// Acquires the number of available handles to use the telephony API.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <returns>
- /// A List of Telephony handles.
- /// You will get 2 SlotHandles in case of dual SIM device.
- /// where,SlotHandle at Index '0' represents Primary SIM and Index '1' represents Secondary SIM.
+ /// A list of telephony handles.
+ /// You will get 2 SlotHandles in case of the dual SIM device.
+ /// Where, SlotHandle at Index '0' represents the primary SIM and Index '1' represents the secondary SIM.
/// </returns>
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="InvalidOperationException">
- /// This Exception can will be generated in the following cases
- /// 1. System is out of memory
- /// 2. If the operation is not supported on device
- /// 3. If the Operation Failed
+ /// This exception will be generated in the following cases:
+ /// 1. The system is out of memory.
+ /// 2. If the operation is not supported on the device.
+ /// 3. If the operation failed.
/// </exception>
public static IEnumerable<SlotHandle> Init()
{
/// <feature>http://tizen.org/feature/network.telephony</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="InvalidOperationException">
- /// This Exception can be generated in the following cases
- /// 1. If the operation is not supported on device
- /// 2. If the Operation Failed
+ /// This exception can be generated in the following cases:
+ /// 1. If the operation is not supported on the device.
+ /// 2. If the operation failed.
/// </exception>
public static void Deinit()
{
--- /dev/null
+using System.Collections.Generic;
+
+namespace ElmSharp.Test
+{
+ class GestureLayerTest2 : TestCaseBase
+ {
+ public override string TestName => "GestureLayerTest2";
+ public override string TestDescription => "GestureLayer feature : Momentum & Rotate Test.";
+
+ private GestureLayer _glayer;
+ private Label _log;
+ private List<string> _logEntries;
+ private Background _background;
+ private Rectangle _box1;
+
+ int _angle = 0;
+ int _prevAngle = 0;
+ int _totalX = 0;
+ int _totalY = 0;
+
+ public override void Run(Window window)
+ {
+ _background = new Background(window);
+ var windowSize = window.ScreenSize;
+ _background.Color = Color.White;
+ _background.Resize(windowSize.Width, windowSize.Height);
+ _background.Show();
+
+ _box1 = new Rectangle(window)
+ {
+ Color = Color.Yellow
+ };
+ _box1.Resize(400, 600);
+ _box1.Move(160, 160);
+ _box1.Show();
+
+ _log = new Label(window);
+ _log.Resize(700, 1280 - 780);
+ _log.Move(10, 770);
+ _log.Show();
+ _logEntries = new List<string>();
+ Log("Momentum & Roate Gesture Test.");
+
+ _glayer = new GestureLayer(_box1);
+ _glayer.Attach(_box1);
+
+ _glayer.RotateStep = 3;
+ _glayer.SetRotateCallback(GestureLayer.GestureState.Start, (rotate) =>
+ {
+ _prevAngle = (int)rotate.BaseAngle;
+ });
+
+ _glayer.SetRotateCallback(GestureLayer.GestureState.Move, (rotate) =>
+ {
+ if (_box1.IsMapEnabled)
+ {
+ _angle += (int)rotate.Angle - _prevAngle;
+ _prevAngle = (int)rotate.Angle;
+ Log($"@@ Rotation XY:({rotate.X},{rotate.Y}) a:{rotate.Angle:F2} ba:{rotate.BaseAngle:F2} total:{_angle}");
+ ApplyTransformation();
+ }
+ });
+
+ int prevX = 0, prevY = 0;
+ _glayer.SetMomentumCallback(GestureLayer.GestureState.Start, (data) =>
+ {
+ if (data.FingersCount == 1)
+ {
+ prevX = _glayer.EvasCanvas.Pointer.X;
+ prevY = _glayer.EvasCanvas.Pointer.Y;
+ }
+ });
+ _glayer.SetMomentumCallback(GestureLayer.GestureState.Move, (data) =>
+ {
+ if (data.FingersCount == 1)
+ {
+ data.X2 = _glayer.EvasCanvas.Pointer.X;
+ data.Y2 = _glayer.EvasCanvas.Pointer.Y;
+ _totalX += (data.X2 - prevX);
+ _totalY += (data.Y2 - prevY);
+ prevX = data.X2;
+ prevY = data.Y2;
+ Log($"@@ Momentum X:({prevX},{data.X2}), Y({prevY},{data.Y2}) = Total:({(data.X2 - prevX)}, {(data.Y2 - prevY)})");
+ ApplyTransformation();
+ }
+ });
+ _glayer.SetMomentumCallback(GestureLayer.GestureState.Abort, (data) =>
+ {
+ Log($"@@ Momentum Abort");
+ });
+ _glayer.SetMomentumCallback(GestureLayer.GestureState.End, (data) =>
+ {
+ Log($"@@ Momentum End");
+ });
+ }
+
+ void ApplyTransformation()
+ {
+ EvasMap map = new EvasMap(4);
+ Rect geometry = _box1.Geometry;
+ map.PopulatePoints(geometry, 0);
+
+ map.Rotate3D(0, 0, _angle, (int)(geometry.X + geometry.Width * 0.5), (int)(geometry.Y + geometry.Height * 0.5), 0);
+
+ Point3D p;
+ for (int i = 0; i < 4; i++)
+ {
+ p = map.GetPointCoordinate(i);
+ p.X += _totalX;
+ p.Y += _totalY;
+ map.SetPointCoordinate(i, p);
+ }
+ _box1.EvasMap = map;
+ _box1.IsMapEnabled = true;
+ }
+
+ private void Log(string format, params object[] args)
+ {
+ var entry = string.Format(format, args);
+ if (_logEntries.Count > 15)
+ _logEntries.RemoveRange(0, _logEntries.Count - 15);
+ _logEntries.Add(entry);
+ _log.Text = string.Join("<br>", _logEntries);
+ }
+ }
+}
\ No newline at end of file