[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool SearchRouteCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_route_h */ route, IntPtr /* void */ userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void RequestUserConsentwithHandleCallback(bool consented, IntPtr /* void */ userData);
+
[DllImport(Libraries.MapService, EntryPoint = "maps_service_cancel_request")]
internal static extern ErrorCode CancelRequest(this ServiceHandle /* maps_service_h */ maps, int requestId);
[DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route_waypoints")]
internal static extern ErrorCode SearchRouteWaypoints(this ServiceHandle /* maps_service_h */ maps, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] [In] IntPtr[] /* maps_coordinates_h */ waypointList, int waypointNum, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId);
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_user_consent")]
+ internal static extern ErrorCode GetUserConsent(this ServiceHandle /* maps_service_h */ maps, out bool consent);
[DllImport(Libraries.MapService, EntryPoint = "maps_service_set_provider_key")]
internal static extern ErrorCode SetProviderKey(this ServiceHandle /* maps_service_h */ maps, string providerKey);
[DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_data_supported")]
internal static extern ErrorCode IsDataSupported(this ServiceHandle /* maps_service_h */ maps, ServiceData /* maps_service_data_e */ data, out bool supported);
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent_with_handle")]
+ internal static extern ErrorCode RequestUserConsent(this ServiceHandle /* maps_service_h */ maps, RequestUserConsentwithHandleCallback callback, IntPtr /* void */ userData);
+
internal class ServiceHandle : SafeMapsHandle
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void RequestUserConsentCallback(bool consented, string provider, IntPtr /* void */ userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent")]
- internal static extern ErrorCode RequestUserConsent(string provider, RequestUserConsentCallback callback, IntPtr /* void */ userData);
-
[DllImport(Libraries.MapService, EntryPoint = "maps_service_foreach_provider")]
internal static extern ErrorCode ForeachProvider(ProviderInfoCallback callback, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_create")]
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_create_without_user_consent")]
internal static extern ErrorCode Create(string provider, out IntPtr /* maps_service_h */ maps);
[DllImport(Libraries.MapService, EntryPoint = "maps_service_destroy")]
internal static extern ErrorCode Destroy(IntPtr /* maps_service_h */ maps);
+ internal bool UserConsented
+ {
+ get { return NativeGet<bool>(this.GetUserConsent); }
+ }
+
internal string ProviderKey
{
get { return NativeGet(this.GetProviderKey); }
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <Version>1.0.15</Version>
+ <Version>1.0.16</Version>
<Authors>Samsung Electronics</Authors>
<Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
<Description>Map Services API for Tizen .NET</Description>
<ItemGroup>
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="Tizen" Version="1.0.5" />
- <PackageReference Include="ElmSharp" Version="1.2.1" />
+ <PackageReference Include="ElmSharp" Version="1.2.2" />
</ItemGroup>
</Project>
public string Provider { get { return _serviceProvider; } }
/// <summary>
+ /// Gets a user consent for map service provider
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ public bool UserConsented
+ {
+ get
+ {
+ return handle.UserConsented;
+ }
+ }
+
+ /// <summary>
/// Gets and sets a string representing keys for map service provider
/// </summary>
/// <since_tizen>3</since_tizen>
/// <summary>
/// Gets the user's consent to use maps data.
/// </summary>
- /// <since_tizen>3</since_tizen>
- /// <param name="provider">A string which representing the name of maps provider</param>
+ /// <since_tizen> 3 </since_tizen>
/// <returns>Returns true if user agreed that the application can use maps data, otherwise false.</returns>
/// <privilege>http://tizen.org/privilege/mapservice</privilege>
/// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
/// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
- public static async Task<bool> RequestUserConsent(string provider)
+ public async Task<bool> RequestUserConsent()
{
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
- Interop.ServiceHandle.RequestUserConsentCallback cb = (consented, serviceProvider, userData) =>
+ Interop.RequestUserConsentwithHandleCallback cb = (consented, userData) =>
{
tcs.TrySetResult(consented);
};
- var err = Interop.ServiceHandle.RequestUserConsent(provider, cb, IntPtr.Zero);
+ var err = handle.RequestUserConsent(cb, IntPtr.Zero);
if (err.IsFailed())
{
tcs.TrySetException(err.GetException("Failed to get user consent"));