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 setSourceToUse(int source)46 public void setSourceToUse(int source) { 47 mOptions.setSourceToUse(source); 48 } 49 resetSourceToUse(int source)50 public void resetSourceToUse(int source) { 51 mOptions.resetSourceToUse(source); 52 } 53 isSourceToUseSet(int source)54 public boolean isSourceToUseSet(int source) { 55 return mOptions.isSourceToUseSet(source); 56 } 57 getSourcesToUse()58 public int getSourcesToUse() { 59 return mOptions.getSourcesToUse(); 60 } 61 setFlag(int flag)62 public void setFlag(int flag) { 63 mOptions.setFlag(flag); 64 } 65 resetFlag(int flag)66 public void resetFlag(int flag) { 67 mOptions.resetFlag(flag); 68 } 69 isFlagSet(int flag)70 public boolean isFlagSet(int flag) { 71 return mOptions.isFlagSet(flag); 72 } 73 getFlags()74 public int getFlags() { 75 return mOptions.getFlags(); 76 } 77 78 /** 79 * Definition of enum flag sets needed by this class. 80 * Such values need to be kept in sync with the ones in fused_location.h 81 */ 82 83 public static final class SourceTechnologies { 84 public static int GNSS = 1<<0; 85 public static int WIFI = 1<<1; 86 public static int SENSORS = 1<<2; 87 public static int CELL = 1<<3; 88 public static int BLUETOOTH = 1<<4; 89 } 90 91 public static final class BatchFlags { 92 public static int WAKEUP_ON_FIFO_FULL = 1<<0; 93 public static int CALLBACK_ON_LOCATION_FIX = 1<<1; 94 } 95 96 /* 97 * Method definitions for internal use. 98 */ 99 100 /* 101 * @hide 102 */ getParcelableOptions()103 public FusedBatchOptions getParcelableOptions() { 104 return mOptions; 105 } 106 } 107