FileDocCategorySizeDatePackage
GpsMeasurementsProvider.javaAPI DocAndroid 5.1 API3594Thu Mar 12 22:22:42 GMT 2015com.android.server.location

GpsMeasurementsProvider

public abstract class GpsMeasurementsProvider extends RemoteListenerHelper
An base implementation for GPS measurements provider. It abstracts out the responsibility of handling listeners, while still allowing technology specific implementations to be built.
hide

Fields Summary
private static final String
TAG
Constructors Summary
public GpsMeasurementsProvider(android.os.Handler handler)


       
        super(handler, TAG);
    
Methods Summary
protected ListenerOperationgetHandlerOperation(int result)

        final int status;
        switch (result) {
            case RESULT_SUCCESS:
                status = GpsMeasurementsEvent.STATUS_READY;
                break;
            case RESULT_NOT_AVAILABLE:
            case RESULT_NOT_SUPPORTED:
            case RESULT_INTERNAL_ERROR:
                status = GpsMeasurementsEvent.STATUS_NOT_SUPPORTED;
                break;
            case RESULT_GPS_LOCATION_DISABLED:
                status = GpsMeasurementsEvent.STATUS_GPS_LOCATION_DISABLED;
                break;
            default:
                Log.v(TAG, "Unhandled addListener result: " + result);
                return null;
        }
        return new StatusChangedOperation(status);
    
protected voidhandleGpsEnabledChanged(boolean enabled)

        int status = enabled ?
                GpsMeasurementsEvent.STATUS_READY :
                GpsMeasurementsEvent.STATUS_GPS_LOCATION_DISABLED;
        foreach(new StatusChangedOperation(status));
    
public voidonCapabilitiesUpdated(boolean isGpsMeasurementsSupported)

        int status = isGpsMeasurementsSupported ?
                GpsMeasurementsEvent.STATUS_READY :
                GpsMeasurementsEvent.STATUS_NOT_SUPPORTED;
        setSupported(isGpsMeasurementsSupported, new StatusChangedOperation(status));
    
public voidonMeasurementsAvailable(android.location.GpsMeasurementsEvent event)

        ListenerOperation<IGpsMeasurementsListener> operation =
                new ListenerOperation<IGpsMeasurementsListener>() {
            @Override
            public void execute(IGpsMeasurementsListener listener) throws RemoteException {
                listener.onGpsMeasurementsReceived(event);
            }
        };
        foreach(operation);