Methods Summary |
---|
protected native void | finalize()
|
private native boolean | getCriteria(java.lang.String name, com.sun.j2me.location.LocationProviderInfo criteria)
|
public int | getDefaultInterval()
return (providerInfo.defaultInterval >= 1000) ?
(providerInfo.defaultInterval / 1000) : 1;
|
public int | getDefaultMaxAge()
return (providerInfo.defaultMaxAge >= 1000) ?
(providerInfo.defaultMaxAge / 1000) : 1;
|
public int | getDefaultTimeout()
return (providerInfo.defaultTimeout >= 1000) ?
(providerInfo.defaultTimeout / 1000) : 1;
|
public static synchronized Location | getLastKnownLocation()
LocationInfo locationInfo = new LocationInfo();
if (getLastKnownLocationImpl(locationInfo)) {
return locationInfo2Location(locationInfo);
}
return null;
|
private static native boolean | getLastKnownLocationImpl(com.sun.j2me.location.LocationInfo locationInfo)
|
public synchronized LocationImpl | getLastLocation()
LocationInfo locationInfo = new LocationInfo();
LocationImpl location = null;
if (getLastLocationImpl(provider, locationInfo)) {
location = locationInfo2Location(locationInfo);
}
return location;
|
private native boolean | getLastLocationImpl(int provider, com.sun.j2me.location.LocationInfo locationInfo)
|
static native java.lang.String | getListOfLocationProviders()
|
LocationImpl | getNewLocationImpl(long timestamp)
if (receiveNewLocationImpl(provider, timestamp)) {
return getLastLocation();
}
return null;
|
public int | getResponseTime()
return (providerInfo.averageResponseTime >= 1000) ?
(providerInfo.averageResponseTime / 1000) : 1;
|
public int | getState()
/* I3Test use only */
if (i3testProviderState != 0) {
return i3testProviderState;
}
/* Real mode */
return getStateImpl(provider);
|
private native int | getStateImpl(int provider)
|
public int | getStateInterval()
return (providerInfo.defaultStateInterval >= 1000) ?
(providerInfo.defaultStateInterval / 1000) : 1;
|
void | i3test_setLocation(LocationImpl location)Set Last Location
I3test use only !!!
i3testLocation = location;
|
void | i3test_setState(int newState)Set provider state.
I3test use only !!!
i3testProviderState = newState;
|
private static LocationImpl | locationInfo2Location(com.sun.j2me.location.LocationInfo locationInfo)
QualifiedCoordinates coordinates = new QualifiedCoordinates(
locationInfo.latitude, locationInfo.longitude,
locationInfo.altitude, locationInfo.horizontalAccuracy,
locationInfo.verticalAccuracy);
AddressInfo address = new AddressInfo();
if (locationInfo.isAddressInfo) {
if (locationInfo.AddressInfo_EXTENSION != null) {
address.setField(AddressInfo.EXTENSION,
locationInfo.AddressInfo_EXTENSION);
}
if (locationInfo.AddressInfo_STREET != null) {
address.setField(AddressInfo.STREET,
locationInfo.AddressInfo_STREET);
}
if (locationInfo.AddressInfo_POSTAL_CODE != null) {
address.setField(AddressInfo.POSTAL_CODE,
locationInfo.AddressInfo_POSTAL_CODE);
}
if (locationInfo.AddressInfo_CITY != null) {
address.setField(AddressInfo.CITY,
locationInfo.AddressInfo_CITY);
}
if (locationInfo.AddressInfo_COUNTY != null) {
address.setField(AddressInfo.COUNTY,
locationInfo.AddressInfo_COUNTY);
}
if (locationInfo.AddressInfo_STATE != null) {
address.setField(AddressInfo.STATE,
locationInfo.AddressInfo_STATE);
}
if (locationInfo.AddressInfo_COUNTRY != null) {
address.setField(AddressInfo.COUNTRY,
locationInfo.AddressInfo_COUNTRY);
}
if (locationInfo.AddressInfo_COUNTRY_CODE != null) {
address.setField(AddressInfo.COUNTRY_CODE,
locationInfo.AddressInfo_COUNTRY_CODE);
}
if (locationInfo.AddressInfo_DISTRICT != null) {
address.setField(AddressInfo.DISTRICT,
locationInfo.AddressInfo_DISTRICT);
}
if (locationInfo.AddressInfo_BUILDING_NAME != null) {
address.setField(AddressInfo.BUILDING_NAME,
locationInfo.AddressInfo_BUILDING_NAME);
}
if (locationInfo.AddressInfo_BUILDING_FLOOR != null) {
address.setField(AddressInfo.BUILDING_FLOOR,
locationInfo.AddressInfo_BUILDING_FLOOR);
}
if (locationInfo.AddressInfo_BUILDING_ROOM != null) {
address.setField(AddressInfo.BUILDING_ROOM,
locationInfo.AddressInfo_BUILDING_ROOM);
}
if (locationInfo.AddressInfo_BUILDING_ZONE != null) {
address.setField(AddressInfo.BUILDING_ZONE,
locationInfo.AddressInfo_BUILDING_ZONE);
}
if (locationInfo.AddressInfo_CROSSING1 != null) {
address.setField(AddressInfo.CROSSING1,
locationInfo.AddressInfo_CROSSING1);
}
if (locationInfo.AddressInfo_CROSSING2 != null) {
address.setField(AddressInfo.CROSSING2,
locationInfo.AddressInfo_CROSSING2);
}
if (locationInfo.AddressInfo_URL != null) {
address.setField(AddressInfo.URL,
locationInfo.AddressInfo_URL);
}
if (locationInfo.AddressInfo_PHONE_NUMBER != null) {
address.setField(AddressInfo.PHONE_NUMBER,
locationInfo.AddressInfo_PHONE_NUMBER);
}
}
LocationImpl location = new LocationImpl(coordinates, locationInfo.speed,
locationInfo.course, locationInfo.method, address,
locationInfo.isValid);
location.extraInfoNMEA = locationInfo.extraInfoNMEA;
location.extraInfoLIF = locationInfo.extraInfoLIF;
location.extraInfoPlain = locationInfo.extraInfoPlain;
location.extraInfoOther = locationInfo.extraInfoOther;
location.extraInfoOtherMIMEType = locationInfo.extraInfoOtherMIMEType;
location.setTimestamp(locationInfo.timestamp);
return location;
|
private native int | open(java.lang.String name)
|
private native boolean | receiveNewLocationImpl(int provider, long timestamp)
|
public void | reset()
resetImpl(provider);
super.reset();
|
private native void | resetImpl(int provider)
|
protected LocationImpl | updateLocation(long timeout)
LocationImpl location = null;
/* request location update */
long startTimestamp = System.currentTimeMillis();
if (i3testLocation == null) {
if (waitForNewLocation(provider, timeout)) {
/* get location and calculate timestamp */
long endTimestamp = System.currentTimeMillis();
long timestamp =
endTimestamp - providerInfo.averageResponseTime;
if (timestamp < startTimestamp) {
timestamp = endTimestamp;
}
location = getNewLocationImpl(timestamp);
}
} else {
location = i3testLocation;
}
return location;
|
private native boolean | waitForNewLocation(int provider, long timeout)
|