else
{
Log.Error(Globals.LogTag, "Error Setting the Callback Interval");
- LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
}
}
}
private string GetNmea()
{
string value = null;
- Interop.GpsSatellite.GetNMEAData(_handle, out value);
+ int ret = Interop.GpsSatellite.GetNMEAData(_handle, out value);
+ if (((LocationError)ret != LocationError.None))
+ {
+ Log.Error(Globals.LogTag, "Error getting the NMEAData," + (LocationError)ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
+ }
return value;
}
uint numActive = 0;
uint numInView;
int timestamp;
- Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp);
+ int ret = Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp);
+ if (((LocationError)ret != LocationError.None))
+ {
+ Log.Error(Globals.LogTag, "Error getting the satellite" + (LocationError)ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
+ }
return numActive;
}
satelliteList.Add(satellite);
return true;
};
- Interop.GpsSatellite.GetForEachSatelliteInView(_handle, callback, IntPtr.Zero);
+ int ret = Interop.GpsSatellite.GetForEachSatelliteInView(_handle, callback, IntPtr.Zero);
+ if (((LocationError)ret != LocationError.None))
+ {
+ Log.Error(Globals.LogTag, "Error getting the satellite" + (LocationError)ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
+ }
return satelliteList;
}
else
{
Log.Error(Globals.LogTag, "Error constructing GpsSatellite class");
- LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in setting satellite status changed callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Getting Unsetting satellite status changed callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
{
internal static Exception ThrowLocationException(int errCode)
{
+ Log.Error(Globals.LogTag, "Throw Location Exception : " + errCode);
LocationError error = (LocationError)errCode;
switch (error)
{
+ case LocationError.OutOfMemoryError:
+ return new InvalidOperationException("Out of memory error");
+ case LocationError.InvalidParameter:
+ return new ArgumentException("Invalid Parameter passed");
case LocationError.AcessibilityNotallowed:
- return new InvalidOperationException("Accesibility not allowed");
- case LocationError.SettingOff:
- return new InvalidOperationException("Current locationtype setting is off");
+ return new UnauthorizedAccessException("Accesibility not allowed");
+ case LocationError.NotSupported:
+ return new NotSupportedException("Not supported");
case LocationError.IncorrectMethod:
return new InvalidOperationException("Incorrect method used");
- case LocationError.InvalidParameter:
- return new ArgumentException("Invalid Parameter passed");
case LocationError.NetworkFailed:
return new InvalidOperationException("Network failed");
- case LocationError.NotSupported:
- return new InvalidOperationException("Operation not supported");
- case LocationError.OutOfMemoryError:
- return new InvalidOperationException("Out of memory error");
- case LocationError.SecuirtyRestricted:
- return new InvalidOperationException("Security Restricted");
case LocationError.ServiceNotAvailable:
return new InvalidOperationException("Service not available");
+ case LocationError.SettingOff:
+ return new InvalidOperationException("Current locationtype setting is off");
+ case LocationError.SecuirtyRestricted:
+ return new InvalidOperationException("Security Restricted");
default:
return new InvalidOperationException("Unknown Error");
}
LocationBoundError error = (LocationBoundError)errCode;
switch (error)
{
- case LocationBoundError.IncorrectType:
- return new InvalidOperationException("Incorrect type passed");
+ case LocationBoundError.OutOfMemoryError:
+ return new InvalidOperationException("Out of memory exception");
case LocationBoundError.InvalidParameter:
return new ArgumentException("Invalid parameter passed");
+ case LocationBoundError.NotSupported:
+ return new NotSupportedException("Not supported");
+ case LocationBoundError.IncorrectType:
+ return new InvalidOperationException("Incorrect type passed");
case LocationBoundError.IsAdded:
return new InvalidOperationException("Boundary is not addded");
- case LocationBoundError.NotSupported:
- return new InvalidOperationException("Operation Not supported");
- case LocationBoundError.OutOfMemoryError:
- return new InvalidOperationException("Out of memory exception");
default:
return new InvalidOperationException("Unknown Error");
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error creating Location Manager," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
_location = new Location();
_locationType = locationType;
else
{
Log.Error(Globals.LogTag, "Error setting Callback Interval");
- LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
}
}
}
else
{
Log.Error(Globals.LogTag, "Error Setting the StayInterval");
- LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
}
}
}
else
{
Log.Error(Globals.LogTag, "Error Setting the Distance");
- LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
}
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error Set Enable Mock Type," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error Starting Location Manager," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
Locator.s_locatorReference = this;
_isStarted = true;
else
{
Log.Error(Globals.LogTag, "Error, previous instance of Locator should be stopped before starting a new one," + LocationError.NotSupported);
- LocationErrorFactory.ThrowLocationException((int)LocationError.NotSupported);
+ throw LocationErrorFactory.ThrowLocationException((int)LocationError.NotSupported);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error stopping Location Manager," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
Locator.s_locatorReference = null;
_isStarted = false;
else
{
Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in clear up location mocking," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
return task.Task;
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in get current location infomation," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
else
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in get last location information," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if ((LocationBoundError)ret != LocationBoundError.None)
{
Log.Error(Globals.LogTag, "Error Adding Boundary," + (LocationBoundError)ret);
- LocationErrorFactory.ThrowLocationBoundaryException(ret);
+ throw LocationErrorFactory.ThrowLocationBoundaryException(ret);
}
}
if ((LocationBoundError)ret != LocationBoundError.None)
{
Log.Error(Globals.LogTag, "Error Removing Boundary," + (LocationBoundError)ret);
- LocationErrorFactory.ThrowLocationBoundaryException(ret);
+ throw LocationErrorFactory.ThrowLocationBoundaryException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Destroy handle" + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Setting Service State Changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in UnSetting Service State Changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Setting Zone Changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Setting Changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Unsetting Setting's Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Setting Distance based location changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in UnSetting Distance based location changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in Setting location changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}
if (((LocationError)ret != LocationError.None))
{
Log.Error(Globals.LogTag, "Error in UnSetting location changed Callback," + (LocationError)ret);
- LocationErrorFactory.ThrowLocationException(ret);
+ throw LocationErrorFactory.ThrowLocationException(ret);
}
}