csharp : location
authorkj7.sung <kj7.sung@samsung.com>
Fri, 10 Feb 2017 06:43:53 +0000 (15:43 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Fri, 10 Feb 2017 06:43:57 +0000 (15:43 +0900)
- Change some parameters
- Remove unused enums

Change-Id: I78924534a0324718c7aeb2d1b28c47d5a69b4b99
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
13 files changed:
packaging/csapi-location.spec
src/Tizen.Location/Interop/Interop.Location.cs
src/Tizen.Location/Properties/AssemblyInfo.cs
src/Tizen.Location/Tizen.Location/GpsSatellite.cs
src/Tizen.Location/Tizen.Location/Location.cs
src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs
src/Tizen.Location/Tizen.Location/LocationError.cs
src/Tizen.Location/Tizen.Location/Locator.cs
src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs
src/Tizen.Location/Tizen.Location/LocatorHelper.cs
src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs
src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs
src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs

index 735128b..286c3a4 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-location
 Summary:    Tizen Location API for C#
-Version:    1.0.4
+Version:    1.0.5
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
index f1172b1..39c918e 100755 (executable)
@@ -47,10 +47,10 @@ internal static partial class Interop
         internal static extern int GetLocationType(IntPtr handle, out LocationType method);
 
         [DllImport(Libraries.Location, EntryPoint = "location_manager_get_location")]
-        internal static extern int GetLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out LocationAccuracy level, out double horizontal, out double vertical, out int timestamp);
+        internal static extern int GetLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out int level, out double horizontal, out double vertical, out int timestamp);
 
         [DllImport(Libraries.Location, EntryPoint = "location_manager_get_last_location")]
-        internal static extern int GetLastLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out LocationAccuracy level, out double horizontal, out double vertical, out int timestamp);
+        internal static extern int GetLastLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out int level, out double horizontal, out double vertical, out int timestamp);
 
         [DllImport(Libraries.Location, EntryPoint = "location_manager_add_boundary")]
         internal static extern int AddBoundary(IntPtr managerHandle, IntPtr boundsHandle);
@@ -86,7 +86,7 @@ internal static partial class Interop
         internal delegate void SettingchangedCallback(LocationType method, bool enable, IntPtr userData);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void LocationchangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double horizontalAcc, int timeStamp, IntPtr userData);
+        internal delegate void LocationchangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double accuracy, int timeStamp, IntPtr userData);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void LocationUpdatedCallback(LocationError error, double latitude, double longitude, double altitude, int timestamp, double speed, double direction, double climb, IntPtr userData);
@@ -161,7 +161,7 @@ internal static partial class Interop
         internal delegate void SatelliteStatuschangedCallback(uint numActive, uint numInView, int timeStamp, IntPtr userData);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate bool SatelliteStatusinfomationCallback(uint azimuth, uint elevation, uint prn, uint snr, bool isActive, IntPtr userData);
+        internal delegate bool SatelliteStatusinfomationCallback(uint azimuth, uint elevation, uint prn, uint snr, bool active, IntPtr userData);
 
         [DllImport(Libraries.Location, EntryPoint = "gps_status_get_nmea")]
         internal static extern int GetNMEAData(IntPtr handle, out string nmea);
index 129ae48..11d3b14 100644 (file)
@@ -2,7 +2,7 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-// General Information about an assembly is controlled through the following 
+// General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("Tizen.Location")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
 // COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
 
@@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version
-//      Minor Version 
+//      Minor Version
 //      Build Number
 //      Revision
 //
-// You can specify all the values or you can default the Build and Revision Numbers 
+// You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
index 6bbec8b..751c456 100755 (executable)
@@ -173,9 +173,9 @@ namespace Tizen.Location
 
             if (_satelliteStatusinfomationCallback == null)
             {
-                _satelliteStatusinfomationCallback = (azimuth, elevation, prn, snr, isActive, userData) =>
+                _satelliteStatusinfomationCallback = (azimuth, elevation, prn, snr, active, userData) =>
                 {
-                    SatelliteInformation satellite = new SatelliteInformation(azimuth, elevation, prn, snr, isActive);
+                    SatelliteInformation satellite = new SatelliteInformation(azimuth, elevation, prn, snr, active);
                     satelliteList.Add(satellite);
                     return true;
                 };
@@ -294,14 +294,14 @@ namespace Tizen.Location
         /// <param name="elevation"> The elevation of the satellite in meters.</param>
         /// <param name="prn"> The Prn value of the satellite.</param>
         /// <param name="snr"> The SNR value of the satellite in dB.</param>
-        /// <param name="isActive"> The flag signaling if satellite is in use.</param>
-        public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool isActive)
+        /// <param name="active"> The flag signaling if satellite is in use.</param>
+        public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool active)
         {
             Azimuth = azimuth;
             Elevation = elevation;
             Prn = prn;
             Snr = snr;
-            Active = isActive;
+            Active = active;
         }
 
         /// <summary>
index 2041895..ae52873 100755 (executable)
@@ -28,9 +28,9 @@ namespace Tizen.Location
         private double _latitude;
         private double _longitude;
         private double _altitude;
-        private double _horizontal;
-        private double _direction;
         private double _speed;
+        private double _direction;
+        private double _accuracy;
         internal int _timestamp;
 
         /// <summary>
@@ -45,19 +45,19 @@ namespace Tizen.Location
         /// <param name="latitude"> Latitude component of the device co-ordinate [-90.0 ~ 90.0] (degrees).</param>
         /// <param name="longitude"> Longitude component of the device co-ordinate[-180.0 ~ 180.0] (degrees).</param>
         /// <param name="altitude"> Altitude value.</param>
-        /// <param name="horizontalAccuracy"> Horizontal Accuracy in meters.</param>
+        /// <param name="accuracy"> Accuracy in meters.</param>
         /// <param name="speed"> Devie Speed.</param>
         /// <param name="direction"> Device direction with respect to north.</param>
         /// <param name="timestamp"> Time when the measurement took place.</param>
         /// </summary>
-        public Location(double latitude, double longitude, double altitude, double horizontalAccuracy, double direction, double speed, int timestamp)
+        public Location(double latitude, double longitude, double altitude, double speed, double direction, double accuracy, int timestamp)
         {
             _latitude = latitude;
             _longitude = longitude;
             _altitude = altitude;
-            _horizontal = horizontalAccuracy;
-            _direction = direction;
             _speed = speed;
+            _direction = direction;
+            _accuracy = accuracy;
             _timestamp = timestamp;
         }
 
@@ -107,17 +107,17 @@ namespace Tizen.Location
         }
 
         /// <summary>
-        /// The horizontal accuracy.
+        /// The Device Speed (km/h).
         /// </summary>
-        public double HorizontalAccuracy
+        public double Speed
         {
             get
             {
-                return _horizontal;
+                return _speed;
             }
             set
             {
-                _horizontal = value;
+                _speed = value;
             }
         }
 
@@ -137,17 +137,17 @@ namespace Tizen.Location
         }
 
         /// <summary>
-        /// The Device Speed (km/h).
+        /// The accuracy.
         /// </summary>
-        public double Speed
+        public double Accuracy
         {
             get
             {
-                return _speed;
+                return _accuracy;
             }
             set
             {
-                _speed = value;
+                _accuracy = value;
             }
         }
 
index 08c2295..2fe4d62 100755 (executable)
@@ -27,10 +27,10 @@ namespace Tizen.Location
         /// <summary>
         /// Class Constructor for LocationUpdatedEventArgs class.
         /// </summary>
-        /// <param name="locationUpdate"> Object of Location class.</param>
-        public LocationChangedEventArgs(Location locationUpdate)
+        /// <param name="location"> Object of Location class.</param>
+        public LocationChangedEventArgs(Location location)
         {
-            Location = locationUpdate;
+            Location = location;
         }
 
         /// <summary>
index 8a85748..459ddd0 100755 (executable)
@@ -31,16 +31,15 @@ namespace Tizen.Location
     public enum LocationError
     {
         None = ErrorCode.None,/**< Successful */
-        OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
+        OutOfMemory = ErrorCode.OutOfMemory,/**< Out of memory error */
         InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
         AcessibilityNotallowed = ErrorCode.PermissionDenied,/**< Permission denied */
         NotSupported = ErrorCode.NotSupported,/**< Address family not supported */
         IncorrectMethod = LocationManagerError.Base | 0x01,/**< Location manager contains incorrect method for a given call */
         NetworkFailed = LocationManagerError.Base | 0x02,/**< Network unavailable */
         ServiceNotAvailable = LocationManagerError.Base | 0x03,/**< Location service is not available */
-        GPSSettingOff = LocationManagerError.Base | 0x04,/**< GPS/WPS, or MOCK setting is not enabled */
+        SettingOff = LocationManagerError.Base | 0x04,/**< GPS/WPS, or MOCK setting is not enabled */
         SecuirtyRestricted = LocationManagerError.Base | 0x05,/**< Restricted by security system policy */
-        SettingOff = GPSSettingOff/**< GPS/WPS, or MOCK setting is not enabled */
     }
 
     /// <summary>
@@ -49,7 +48,7 @@ namespace Tizen.Location
     public enum LocationBoundError
     {
         None = ErrorCode.None,/**< Successful */
-        OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
+        OutOfMemory = ErrorCode.OutOfMemory,/**< Out of memory error */
         InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
         NotSupported = ErrorCode.NotSupported,/**< Not supported */
         IncorrectType = LocationManagerError.BoundsBase | 0x01,/**< Incorrect bounds type for a given call */
@@ -64,8 +63,8 @@ namespace Tizen.Location
             LocationError error = (LocationError)errCode;
             switch (error)
             {
-                case LocationError.OutOfMemoryError:
-                    return new InvalidOperationException("Out of memory error");
+                case LocationError.OutOfMemory:
+                    return new InvalidOperationException("Out of memory");
                 case LocationError.InvalidParameter:
                     return new ArgumentException("Invalid Parameter passed");
                 case LocationError.AcessibilityNotallowed:
@@ -92,7 +91,7 @@ namespace Tizen.Location
             LocationBoundError error = (LocationBoundError)errCode;
             switch (error)
             {
-                case LocationBoundError.OutOfMemoryError:
+                case LocationBoundError.OutOfMemory:
                     return new InvalidOperationException("Out of memory exception");
                 case LocationBoundError.InvalidParameter:
                     return new ArgumentException("Invalid parameter passed");
index 8d6a5d0..8dd4747 100755 (executable)
@@ -36,15 +36,15 @@ namespace Tizen.Location
     {
         private int _interval = 1;
         private int _stayInterval = 120;
+        private int _requestId = 0;
         private double _distance = 120.0;
         private bool _isEnableMock;
+        private bool _disposed = false;
+        private bool _isStarted = false;
         private IntPtr _handle;
         private LocationType _locationType;
         private Location _location = null;
-        private bool _disposed = false;
-        private bool _isStarted = false;
         private static Locator s_locatorReference;
-        private int _requestId = 0;
         private Dictionary<IntPtr, Interop.LocatorEvent.LocationUpdatedCallback> _callback_map = new Dictionary<IntPtr, Interop.LocatorEvent.LocationUpdatedCallback>();
 
         private Interop.LocatorEvent.ServiceStatechangedCallback _serviceStateChangedCallback;
@@ -289,7 +289,7 @@ namespace Tizen.Location
         public void SetMockLocation(Location location)
         {
             Log.Info(Globals.LogTag, "Setting mock location");
-            int ret = Interop.Locator.SetMockLocation(_handle, location.Latitude, location.Longitude, location.Altitude, location.Speed, location.Direction, location.HorizontalAccuracy);
+            int ret = Interop.Locator.SetMockLocation(_handle, location.Latitude, location.Longitude, location.Altitude, location.Speed, location.Direction, location.Accuracy);
             if (((LocationError)ret == LocationError.None))
             {
                 _location.Latitude = location.Latitude;
@@ -297,7 +297,7 @@ namespace Tizen.Location
                 _location.Altitude = location.Altitude;
                 _location.Speed = location.Speed;
                 _location.Direction = location.Direction;
-                _location.HorizontalAccuracy = location.HorizontalAccuracy;
+                _location.Accuracy = location.Accuracy;
             }
             else
             {
@@ -349,7 +349,7 @@ namespace Tizen.Location
                     else
                     {
                         Log.Info(Globals.LogTag, "Creating a current location object");
-                        _location = new Location(latitude, longitude, altitude, 0.0, direction, speed, timestamp);
+                        _location = new Location(latitude, longitude, altitude, speed, direction, 0.0, timestamp);
                         task.SetResult(_location);
                     }
                     lock (_callback_map)
@@ -379,21 +379,21 @@ namespace Tizen.Location
         /// <exception cref="NotSupportedException">Thrown when the location is not supported</exception>
         public Location GetLocation()
         {
-            double altitude = 0;
             double latitude = 0;
             double longitude = 0;
+            double altitude = 0;
             double climb = 0;
-            double direction = 0;
             double speed = 0;
-            LocationAccuracy level = LocationAccuracy.None;
-            double horizontal = 0;
+            double direction = 0;
+            int level = 0;
+            double accuracy = 0;
             double vertical = 0;
             int timestamp = 0;
 
             if (_isStarted)
             {
                 Log.Info(Globals.LogTag, "Get current location information");
-                int ret = Interop.Locator.GetLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out horizontal, out vertical, out timestamp);
+                int ret = Interop.Locator.GetLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out accuracy, out vertical, out timestamp);
                 if (((LocationError)ret != LocationError.None))
                 {
                     Log.Error(Globals.LogTag, "Error in get current location infomation," + (LocationError)ret);
@@ -403,7 +403,7 @@ namespace Tizen.Location
             else
             {
                 Log.Info(Globals.LogTag, "Get last location information");
-                int ret = Interop.Locator.GetLastLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out horizontal, out vertical, out timestamp);
+                int ret = Interop.Locator.GetLastLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out accuracy, out vertical, out timestamp);
                 if (((LocationError)ret != LocationError.None))
                 {
                     Log.Error(Globals.LogTag, "Error in get last location information," + (LocationError)ret);
@@ -411,7 +411,7 @@ namespace Tizen.Location
                 }
             }
 
-            Location location = new Location(latitude, longitude, altitude, horizontal, direction, speed, timestamp);
+            Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp);
             _location = location;
 
             return location;
@@ -711,16 +711,16 @@ namespace Tizen.Location
         {
             Log.Info(Globals.LogTag, "SetDistanceBasedLocationChangedCallback");
             if (_distanceBasedLocationChangedCallback == null) {
-                _distanceBasedLocationChangedCallback = (latitude, longitude, altitude, speed, direction, horizontalAccuracy, timestamp, userData) =>
+                _distanceBasedLocationChangedCallback = (latitude, longitude, altitude, speed, direction, accuracy, timestamp, userData) =>
                 {
                     Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #1");
-                    Location location = new Location(latitude, longitude, altitude, horizontalAccuracy, direction, speed, timestamp);
+                    Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp);
                     Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #2");
                     _distanceBasedLocationChanged?.Invoke(this, new LocationChangedEventArgs(location));
                     Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #3");
                 };
             }
-            
+
             int ret = Interop.LocatorEvent.SetDistanceBasedLocationChangedCallback(_handle, _distanceBasedLocationChangedCallback, _stayInterval, _distance, IntPtr.Zero);
             if (((LocationError)ret != LocationError.None))
             {
@@ -777,10 +777,10 @@ namespace Tizen.Location
             Log.Info(Globals.LogTag, "Calling SetLocationChangedCallback");
 
             if (_locationChangedCallback == null) {
-                _locationChangedCallback = (latitude, longitude, altitude, speed, direction, horizontalAccuracy, timestamp, userData) =>
+                _locationChangedCallback = (latitude, longitude, altitude, speed, direction, accuracy, timestamp, userData) =>
                 {
                     Log.Info(Globals.LogTag, "LocationChangedCallback has been called");
-                    Location location = new Location(latitude, longitude, altitude, horizontalAccuracy, direction, speed, timestamp);
+                    Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp);
                     _location = location;
                     _locationChanged?.Invoke(this, new LocationChangedEventArgs(location));
                 };
index 95c6725..a6da9c4 100755 (executable)
@@ -39,30 +39,6 @@ namespace Tizen.Location
     }
 
     /// <summary>
-    /// Enumeration for Approximate accuracy level of given information.
-    /// </summary>
-    public enum LocationAccuracy
-    {
-        None = 0, /**< Invalid Data */
-        Country, /**< Country accuracy level */
-        Region, /**< Regional accuracy level */
-        Locality, /**< Local accuracy level*/
-        PostalCode, /**< Postal accuracy level */
-        Street, /**< Street accuracy level */
-        Detailed /**< Detailed accuracy level*/
-    }
-
-    /// <summary>
-    /// Enumeration for the location service accessibility state.
-    /// </summary>
-    public enum AccessibilityState
-    {
-        None = 0, /**< Access state is not determined */
-        Denied, /**< Access denied */
-        Allowed /**< Access authorized */
-    }
-
-    /// <summary>
     /// Enumeration for the created boundary type.
     /// </summary>
     public enum BoundaryType
index 7de13b3..d66e591 100755 (executable)
@@ -27,9 +27,9 @@ namespace Tizen.Location
         /// <returns>Returns a boolean value indicating whether or not the specified method is supported.</returns>
         public static bool IsSupportedType(LocationType locationType)
         {
-            bool initStatus = Interop.LocatorHelper.IsSupported((int)locationType);
-            Log.Info(Globals.LogTag, "Checking if the Location Manager type is supported ," + initStatus);
-            return initStatus;
+            bool status = Interop.LocatorHelper.IsSupported((int)locationType);
+            Log.Info(Globals.LogTag, "Checking if the Location Manager type is supported ," + status);
+            return status;
         }
 
         /// <summary>
@@ -43,14 +43,14 @@ namespace Tizen.Location
         public static bool IsEnabledType(LocationType locationType)
         {
             Log.Info(Globals.LogTag, "Checking if the Location Manager type is Enabled");
-            bool initStatus;
-            int ret = Interop.LocatorHelper.IsEnabled((int)locationType, out initStatus);
+            bool status;
+            int ret = Interop.LocatorHelper.IsEnabled((int)locationType, out status);
             if (((LocationError)ret != LocationError.None))
             {
                 Log.Error(Globals.LogTag, "Error Checking the Location Manager type is Enabled," + (LocationError)ret);
                 throw LocationErrorFactory.ThrowLocationException(ret);
             }
-            return initStatus;
+            return status;
         }
     }
 }
index 3d82a04..f76b0df 100755 (executable)
@@ -26,11 +26,11 @@ namespace Tizen.Location
         /// <param name="activeCount"> The number of active satellites.</param>
         /// <param name="inviewCount"> The number of satellites in view.</param>
         /// <param name="timestamp"> The time at which the data has been extracted.</param>
-        public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timeStamp)
+        public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timestamp)
         {
             ActiveCount = activeCount;
             InViewCount = inviewCount;
-            TimeStamp = timeStamp;
+            Timestamp = timestamp;
         }
 
         /// <summary>
@@ -46,6 +46,6 @@ namespace Tizen.Location
         /// <summary>
         /// Get the timestamp.
         /// </summary>
-        public DateTime TimeStamp { get; private set; }
+        public DateTime Timestamp { get; private set; }
     }
 }
index f66e6c6..cf94bab 100755 (executable)
@@ -29,7 +29,6 @@ namespace Tizen.Location
         /// <param name="state"> An enumeration of type LocationServiceState.</param>
         public ServiceStateChangedEventArgs(ServiceState state)
         {
-
             ServiceState = state;
         }
 
index 8ce0842..d17c5b5 100755 (executable)
@@ -34,7 +34,7 @@ namespace Tizen.Location
             Latitude = latitude;
             Longitude = longitude;
             Altitude = altitude;
-            TimeStamp = timestamp;
+            Timestamp = timestamp;
         }
 
         /// <summary>
@@ -60,6 +60,6 @@ namespace Tizen.Location
         /// <summary>
         /// Method to get the timestamp.
         /// </summary>
-        public DateTime TimeStamp { get; private set; }
+        public DateTime Timestamp { get; private set; }
     }
 }