1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.location.provider; 18 19 import android.location.Location; 20 21 /** 22 * Base class for sinks to interact with FusedLocationHardware. 23 * 24 * <p>Default implementations allow new methods to be added without crashing 25 * clients compiled against an old library version. 26 */ 27 public class FusedLocationHardwareSink { 28 /** 29 * Called when one or more locations are available from the FLP 30 * HAL. 31 */ onLocationAvailable(Location[] locations)32 public void onLocationAvailable(Location[] locations) { 33 // default do nothing 34 } 35 36 /** 37 * Called when diagnostic data is available from the FLP HAL. 38 */ onDiagnosticDataAvailable(String data)39 public void onDiagnosticDataAvailable(String data) { 40 // default do nothing 41 } 42 43 /** 44 * Called when capabilities are available from the FLP HAL. 45 * Should be called once right after initialization. 46 * 47 * @param capabilities A bitmask of capabilities defined in 48 * fused_location.h. 49 */ onCapabilities(int capabilities)50 public void onCapabilities(int capabilities) { 51 // default do nothing 52 } 53 54 /** 55 * Called when the status changes in the underlying FLP HAL 56 * implementation (the ability to compute location). This 57 * callback will only be made on version 2 or later 58 * (see {@link FusedLocationHardware#getVersion()}). 59 * 60 * @param status One of FLP_STATUS_LOCATION_AVAILABLE or 61 * FLP_STATUS_LOCATION_UNAVAILABLE as defined in 62 * fused_location.h. 63 */ onStatusChanged(int status)64 public void onStatusChanged(int status) { 65 // default do nothing 66 } 67 }