1 /* 2 * Copyright (C) 2011 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.settingslib.bluetooth; 18 19 import android.bluetooth.BluetoothClass; 20 import android.bluetooth.BluetoothDevice; 21 22 /** 23 * LocalBluetoothProfile is an interface defining the basic 24 * functionality related to a Bluetooth profile. 25 */ 26 public interface LocalBluetoothProfile { 27 28 /** 29 * Return {@code true} if the user can initiate a connection for this profile in UI. 30 */ accessProfileEnabled()31 boolean accessProfileEnabled(); 32 33 /** 34 * Returns true if the user can enable auto connection for this profile. 35 */ isAutoConnectable()36 boolean isAutoConnectable(); 37 getConnectionStatus(BluetoothDevice device)38 int getConnectionStatus(BluetoothDevice device); 39 40 /** 41 * Return {@code true} if the profile is enabled, otherwise return {@code false}. 42 * @param device the device to query for enable status 43 */ isEnabled(BluetoothDevice device)44 boolean isEnabled(BluetoothDevice device); 45 46 /** 47 * Get the connection policy of the profile. 48 * @param device the device to query for enable status 49 */ getConnectionPolicy(BluetoothDevice device)50 int getConnectionPolicy(BluetoothDevice device); 51 52 /** 53 * Enable the profile if {@code enabled} is {@code true}, otherwise disable profile. 54 * @param device the device to set profile status 55 * @param enabled {@code true} for enable profile, otherwise disable profile. 56 */ setEnabled(BluetoothDevice device, boolean enabled)57 boolean setEnabled(BluetoothDevice device, boolean enabled); 58 isProfileReady()59 boolean isProfileReady(); 60 getProfileId()61 int getProfileId(); 62 63 /** Display order for device profile settings. */ getOrdinal()64 int getOrdinal(); 65 66 /** 67 * Returns the string resource ID for the localized name for this profile. 68 * @param device the Bluetooth device (to distinguish between PAN roles) 69 */ getNameResource(BluetoothDevice device)70 int getNameResource(BluetoothDevice device); 71 72 /** 73 * Returns the string resource ID for the summary text for this profile 74 * for the specified device, e.g. "Use for media audio" or 75 * "Connected to media audio". 76 * @param device the device to query for profile connection status 77 * @return a string resource ID for the profile summary text 78 */ getSummaryResourceForDevice(BluetoothDevice device)79 int getSummaryResourceForDevice(BluetoothDevice device); 80 getDrawableResource(BluetoothClass btClass)81 int getDrawableResource(BluetoothClass btClass); 82 } 83