From: kj7.sung Date: Fri, 10 Feb 2017 06:43:53 +0000 (+0900) Subject: csharp : location X-Git-Tag: submit/trunk/20170823.075128~103^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54198db09edb6e358ce179466041e6af06c88e44;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git csharp : location - Change some parameters - Remove unused enums Change-Id: I78924534a0324718c7aeb2d1b28c47d5a69b4b99 Signed-off-by: kj7.sung --- diff --git a/packaging/csapi-location.spec b/packaging/csapi-location.spec index 735128b..286c3a4 100755 --- a/packaging/csapi-location.spec +++ b/packaging/csapi-location.spec @@ -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 diff --git a/src/Tizen.Location/Interop/Interop.Location.cs b/src/Tizen.Location/Interop/Interop.Location.cs index f1172b1..39c918e 100755 --- a/src/Tizen.Location/Interop/Interop.Location.cs +++ b/src/Tizen.Location/Interop/Interop.Location.cs @@ -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); diff --git a/src/Tizen.Location/Properties/AssemblyInfo.cs b/src/Tizen.Location/Properties/AssemblyInfo.cs index 129ae48..11d3b14 100644 --- a/src/Tizen.Location/Properties/AssemblyInfo.cs +++ b/src/Tizen.Location/Properties/AssemblyInfo.cs @@ -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")] diff --git a/src/Tizen.Location/Tizen.Location/GpsSatellite.cs b/src/Tizen.Location/Tizen.Location/GpsSatellite.cs index 6bbec8b..751c456 100755 --- a/src/Tizen.Location/Tizen.Location/GpsSatellite.cs +++ b/src/Tizen.Location/Tizen.Location/GpsSatellite.cs @@ -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 /// The elevation of the satellite in meters. /// The Prn value of the satellite. /// The SNR value of the satellite in dB. - /// The flag signaling if satellite is in use. - public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool isActive) + /// The flag signaling if satellite is in use. + public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool active) { Azimuth = azimuth; Elevation = elevation; Prn = prn; Snr = snr; - Active = isActive; + Active = active; } /// diff --git a/src/Tizen.Location/Tizen.Location/Location.cs b/src/Tizen.Location/Tizen.Location/Location.cs index 2041895..ae52873 100755 --- a/src/Tizen.Location/Tizen.Location/Location.cs +++ b/src/Tizen.Location/Tizen.Location/Location.cs @@ -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; /// @@ -45,19 +45,19 @@ namespace Tizen.Location /// Latitude component of the device co-ordinate [-90.0 ~ 90.0] (degrees). /// Longitude component of the device co-ordinate[-180.0 ~ 180.0] (degrees). /// Altitude value. - /// Horizontal Accuracy in meters. + /// Accuracy in meters. /// Devie Speed. /// Device direction with respect to north. /// Time when the measurement took place. /// - 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 } /// - /// The horizontal accuracy. + /// The Device Speed (km/h). /// - public double HorizontalAccuracy + public double Speed { get { - return _horizontal; + return _speed; } set { - _horizontal = value; + _speed = value; } } @@ -137,17 +137,17 @@ namespace Tizen.Location } /// - /// The Device Speed (km/h). + /// The accuracy. /// - public double Speed + public double Accuracy { get { - return _speed; + return _accuracy; } set { - _speed = value; + _accuracy = value; } } diff --git a/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs index 08c2295..2fe4d62 100755 --- a/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs +++ b/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs @@ -27,10 +27,10 @@ namespace Tizen.Location /// /// Class Constructor for LocationUpdatedEventArgs class. /// - /// Object of Location class. - public LocationChangedEventArgs(Location locationUpdate) + /// Object of Location class. + public LocationChangedEventArgs(Location location) { - Location = locationUpdate; + Location = location; } /// diff --git a/src/Tizen.Location/Tizen.Location/LocationError.cs b/src/Tizen.Location/Tizen.Location/LocationError.cs index 8a85748..459ddd0 100755 --- a/src/Tizen.Location/Tizen.Location/LocationError.cs +++ b/src/Tizen.Location/Tizen.Location/LocationError.cs @@ -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 */ } /// @@ -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"); diff --git a/src/Tizen.Location/Tizen.Location/Locator.cs b/src/Tizen.Location/Tizen.Location/Locator.cs index 8d6a5d0..8dd4747 100755 --- a/src/Tizen.Location/Tizen.Location/Locator.cs +++ b/src/Tizen.Location/Tizen.Location/Locator.cs @@ -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 _callback_map = new Dictionary(); 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 /// Thrown when the location is not supported 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)); }; diff --git a/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs b/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs index 95c6725..a6da9c4 100755 --- a/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs +++ b/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs @@ -39,30 +39,6 @@ namespace Tizen.Location } /// - /// Enumeration for Approximate accuracy level of given information. - /// - 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*/ - } - - /// - /// Enumeration for the location service accessibility state. - /// - public enum AccessibilityState - { - None = 0, /**< Access state is not determined */ - Denied, /**< Access denied */ - Allowed /**< Access authorized */ - } - - /// /// Enumeration for the created boundary type. /// public enum BoundaryType diff --git a/src/Tizen.Location/Tizen.Location/LocatorHelper.cs b/src/Tizen.Location/Tizen.Location/LocatorHelper.cs index 7de13b3..d66e591 100755 --- a/src/Tizen.Location/Tizen.Location/LocatorHelper.cs +++ b/src/Tizen.Location/Tizen.Location/LocatorHelper.cs @@ -27,9 +27,9 @@ namespace Tizen.Location /// Returns a boolean value indicating whether or not the specified method is supported. 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; } /// @@ -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; } } } diff --git a/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs index 3d82a04..f76b0df 100755 --- a/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs +++ b/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs @@ -26,11 +26,11 @@ namespace Tizen.Location /// The number of active satellites. /// The number of satellites in view. /// The time at which the data has been extracted. - public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timeStamp) + public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timestamp) { ActiveCount = activeCount; InViewCount = inviewCount; - TimeStamp = timeStamp; + Timestamp = timestamp; } /// @@ -46,6 +46,6 @@ namespace Tizen.Location /// /// Get the timestamp. /// - public DateTime TimeStamp { get; private set; } + public DateTime Timestamp { get; private set; } } } diff --git a/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs index f66e6c6..cf94bab 100755 --- a/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs +++ b/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs @@ -29,7 +29,6 @@ namespace Tizen.Location /// An enumeration of type LocationServiceState. public ServiceStateChangedEventArgs(ServiceState state) { - ServiceState = state; } diff --git a/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs index 8ce0842..d17c5b5 100755 --- a/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs +++ b/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs @@ -34,7 +34,7 @@ namespace Tizen.Location Latitude = latitude; Longitude = longitude; Altitude = altitude; - TimeStamp = timestamp; + Timestamp = timestamp; } /// @@ -60,6 +60,6 @@ namespace Tizen.Location /// /// Method to get the timestamp. /// - public DateTime TimeStamp { get; private set; } + public DateTime Timestamp { get; private set; } } }