1 // Copyright 2016 by Samsung Electronics, Inc.,
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
11 using Tizen.Internals.Errors;
13 namespace Tizen.Location
15 public static class LocationManagerError
17 public const int Base = -0x02C00000;
18 public const int BoundsBase = -0x02C00000 | 0x20;
22 /// Location Manager error codes
24 public enum LocationError
26 None = ErrorCode.None,/**< Successful */
27 OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
28 InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
29 AcessibilityNotallowed = ErrorCode.PermissionDenied,/**< Permission denied */
30 NotSupported = ErrorCode.NotSupported,/**< Address family not supported */
31 IncorrectMethod = LocationManagerError.Base | 0x01,/**< Location manager contains incorrect method for a given call */
32 NetworkFailed = LocationManagerError.Base | 0x02,/**< Network unavailable */
33 ServiceNotAvailable = LocationManagerError.Base | 0x03,/**< Location service is not available */
34 GPSSettingOff = LocationManagerError.Base | 0x04,/**< GPS/WPS, or MOCK setting is not enabled */
35 SecuirtyRestricted = LocationManagerError.Base | 0x05,/**< Restricted by security system policy */
36 SettingOff = GPSSettingOff/**< GPS/WPS, or MOCK setting is not enabled */
40 /// Location Boundary error codes
42 public enum LocationBoundError
44 None = ErrorCode.None,/**< Successful */
45 OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
46 InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
47 NotSupported = ErrorCode.NotSupported,/**< Not supported */
48 IncorrectType = LocationManagerError.BoundsBase | 0x01,/**< Incorrect bounds type for a given call */
49 IsAdded = LocationManagerError.BoundsBase | 0x02/**< Cannot remove bounds handle from location manager */
52 internal static class LocationErrorFactory
54 internal static Exception ThrowLocationException(int errCode)
56 LocationError error = (LocationError)errCode;
59 case LocationError.AcessibilityNotallowed:
60 return new InvalidOperationException("Accesibility not allowed");
61 case LocationError.SettingOff:
62 return new InvalidOperationException("Current locationtype setting is off");
63 case LocationError.IncorrectMethod:
64 return new InvalidOperationException("Incorrect method used");
65 case LocationError.InvalidParameter:
66 return new ArgumentException("Invalid Parameter passed");
67 case LocationError.NetworkFailed:
68 return new InvalidOperationException("Network failed");
69 case LocationError.NotSupported:
70 return new InvalidOperationException("Operation not supported");
71 case LocationError.OutOfMemoryError:
72 return new InvalidOperationException("Out of memory error");
73 case LocationError.SecuirtyRestricted:
74 return new InvalidOperationException("Security Restricted");
75 case LocationError.ServiceNotAvailable:
76 return new InvalidOperationException("Service not available");
78 return new InvalidOperationException("Unknown Error");
82 internal static Exception ThrowLocationBoundaryException(int errCode)
84 LocationBoundError error = (LocationBoundError)errCode;
87 case LocationBoundError.IncorrectType:
88 return new InvalidOperationException("Incorrect type passed");
89 case LocationBoundError.InvalidParameter:
90 return new ArgumentException("Invalid parameter passed");
91 case LocationBoundError.IsAdded:
92 return new InvalidOperationException("Boundary is not addded");
93 case LocationBoundError.NotSupported:
94 return new InvalidOperationException("Operation Not supported");
95 case LocationBoundError.OutOfMemoryError:
96 return new InvalidOperationException("Out of memory exception");
98 return new InvalidOperationException("Unknown Error");