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.FusedBatchOptions; 20 21 /** 22 * Class that exposes FusedBatchOptions to the GmsCore . 23 */ 24 public class GmsFusedBatchOptions { 25 private FusedBatchOptions mOptions = new FusedBatchOptions(); 26 27 /* 28 * Methods that provide a facade for properties in FusedBatchOptions. 29 */ setMaxPowerAllocationInMW(double value)30 public void setMaxPowerAllocationInMW(double value) { 31 mOptions.setMaxPowerAllocationInMW(value); 32 } 33 getMaxPowerAllocationInMW()34 public double getMaxPowerAllocationInMW() { 35 return mOptions.getMaxPowerAllocationInMW(); 36 } 37 setPeriodInNS(long value)38 public void setPeriodInNS(long value) { 39 mOptions.setPeriodInNS(value); 40 } 41 getPeriodInNS()42 public long getPeriodInNS() { 43 return mOptions.getPeriodInNS(); 44 } 45 setSmallestDisplacementMeters(float value)46 public void setSmallestDisplacementMeters(float value) { 47 mOptions.setSmallestDisplacementMeters(value); 48 } 49 getSmallestDisplacementMeters()50 public float getSmallestDisplacementMeters() { 51 return mOptions.getSmallestDisplacementMeters(); 52 } 53 setSourceToUse(int source)54 public void setSourceToUse(int source) { 55 mOptions.setSourceToUse(source); 56 } 57 resetSourceToUse(int source)58 public void resetSourceToUse(int source) { 59 mOptions.resetSourceToUse(source); 60 } 61 isSourceToUseSet(int source)62 public boolean isSourceToUseSet(int source) { 63 return mOptions.isSourceToUseSet(source); 64 } 65 getSourcesToUse()66 public int getSourcesToUse() { 67 return mOptions.getSourcesToUse(); 68 } 69 setFlag(int flag)70 public void setFlag(int flag) { 71 mOptions.setFlag(flag); 72 } 73 resetFlag(int flag)74 public void resetFlag(int flag) { 75 mOptions.resetFlag(flag); 76 } 77 isFlagSet(int flag)78 public boolean isFlagSet(int flag) { 79 return mOptions.isFlagSet(flag); 80 } 81 getFlags()82 public int getFlags() { 83 return mOptions.getFlags(); 84 } 85 86 /** 87 * Definition of enum flag sets needed by this class. 88 * Such values need to be kept in sync with the ones in fused_location.h 89 */ 90 91 public static final class SourceTechnologies { 92 public static int GNSS = 1<<0; 93 public static int WIFI = 1<<1; 94 public static int SENSORS = 1<<2; 95 public static int CELL = 1<<3; 96 public static int BLUETOOTH = 1<<4; 97 } 98 99 public static final class BatchFlags { 100 public static int WAKEUP_ON_FIFO_FULL = 1<<0; 101 public static int CALLBACK_ON_LOCATION_FIX = 1<<1; 102 } 103 104 /* 105 * Method definitions for internal use. 106 */ 107 108 /* 109 * @hide 110 */ getParcelableOptions()111 public FusedBatchOptions getParcelableOptions() { 112 return mOptions; 113 } 114 } 115