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
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);
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);
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);
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")]
[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)]
// 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")]
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;
};
/// <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>
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>
/// <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;
}
}
/// <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;
}
}
}
/// <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;
}
}
/// <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>
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>
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 */
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:
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");
{
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;
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;
_location.Altitude = location.Altitude;
_location.Speed = location.Speed;
_location.Direction = location.Direction;
- _location.HorizontalAccuracy = location.HorizontalAccuracy;
+ _location.Accuracy = location.Accuracy;
}
else
{
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)
/// <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);
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);
}
}
- 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;
{
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))
{
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));
};
}
/// <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
/// <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>
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;
}
}
}
/// <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>
/// <summary>
/// Get the timestamp.
/// </summary>
- public DateTime TimeStamp { get; private set; }
+ public DateTime Timestamp { get; private set; }
}
}
/// <param name="state"> An enumeration of type LocationServiceState.</param>
public ServiceStateChangedEventArgs(ServiceState state)
{
-
ServiceState = state;
}
Latitude = latitude;
Longitude = longitude;
Altitude = altitude;
- TimeStamp = timestamp;
+ Timestamp = timestamp;
}
/// <summary>
/// <summary>
/// Method to get the timestamp.
/// </summary>
- public DateTime TimeStamp { get; private set; }
+ public DateTime Timestamp { get; private set; }
}
}