2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 namespace Tizen.Location.Geofence
24 /// Enum to give the type of error occured, if any.
26 /// <since_tizen>3</since_tizen>
27 public enum GeofenceError
32 /// <since_tizen>3</since_tizen>
33 None = Tizen.Internals.Errors.ErrorCode.None,
38 /// <since_tizen>3</since_tizen>
39 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
42 /// Invalid parameter.
44 /// <since_tizen>3</since_tizen>
45 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
48 /// Permission denied.
50 /// <since_tizen>3</since_tizen>
51 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
56 /// <since_tizen>3</since_tizen>
57 NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
60 /// Geofence Manager is not initialized.
62 /// <since_tizen>3</since_tizen>
63 NotInitialized = -0x02C00000 | 0x100 | 0x01,
66 /// Invalid geofence ID.
68 /// <since_tizen>3</since_tizen>
69 InvalidID = -0x02C00000 | 0x100 | 0x02,
74 /// <since_tizen>3</since_tizen>
75 Exception = -0x02C00000 | 0x100 | 0x03,
78 /// Geofencing is already started.
80 /// <since_tizen>3</since_tizen>
81 AlreadyStarted = -0x02C00000 | 0x100 | 0x04,
84 /// Too many geofence.
86 /// <since_tizen>3</since_tizen>
87 TooManyGeofence = -0x02C00000 | 0x100 | 0x05,
90 /// Error in GPS, Wi-Fi, or BT.
92 /// <since_tizen>3</since_tizen>
93 IPC = -0x02C00000 | 0x100 | 0x06,
96 /// DB error in the server side.
98 /// <since_tizen>3</since_tizen>
99 DBFailed = -0x02C00000 | 0x100 | 0x07,
102 /// Access to specified place is denied.
104 /// <since_tizen>3</since_tizen>
105 PlaceAccessDenied = -0x02C00000 | 0x100 | 0x08,
108 /// Access to specified geofence is denied.
110 /// <since_tizen>3</since_tizen>
111 GeofenceAccessDenied = -0x02C00000 | 0x100 | 0x09
114 internal class GeofenceErrorFactory
116 internal const string LogTag = "Tizen.Location.Geofence";
118 internal static Exception CreateException(GeofenceError err, string msg)
120 Log.Info(LogTag, "Got Error " + err + " throwing Exception with msg " + msg);
124 case GeofenceError.InvalidParameter:
126 exp = new ArgumentException(msg + " Invalid Parameters Provided");
130 case GeofenceError.OutOfMemory:
132 exp = new OutOfMemoryException(msg + " Out Of Memory");
136 case GeofenceError.NotInitialized:
138 exp = new InvalidOperationException(msg + " Not initializded");
142 case GeofenceError.NotSupported:
144 exp = new NotSupportedException(msg + " Not supported");
148 case GeofenceError.PermissionDenied:
150 case GeofenceError.GeofenceAccessDenied:
152 case GeofenceError.PlaceAccessDenied:
154 exp = new UnauthorizedAccessException(msg + " Permission Denied");
158 case GeofenceError.DBFailed:
160 exp = new InvalidOperationException(msg + " DataBase Failed");
166 exp = new InvalidOperationException(msg);