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.settings.bluetooth;
18 
19 import com.android.settings.R;
20 
21 import android.bluetooth.BluetoothClass;
22 import android.bluetooth.BluetoothDevice;
23 import android.bluetooth.BluetoothProfile;
24 
25 /**
26  * OppProfile handles Bluetooth OPP.
27  */
28 final class OppProfile implements LocalBluetoothProfile {
29 
30     static final String NAME = "OPP";
31 
32     // Order of this profile in device profiles list
33     private static final int ORDINAL = 2;
34 
isConnectable()35     public boolean isConnectable() {
36         return false;
37     }
38 
isAutoConnectable()39     public boolean isAutoConnectable() {
40         return false;
41     }
42 
connect(BluetoothDevice device)43     public boolean connect(BluetoothDevice device) {
44         return false;
45     }
46 
disconnect(BluetoothDevice device)47     public boolean disconnect(BluetoothDevice device) {
48         return false;
49     }
50 
getConnectionStatus(BluetoothDevice device)51     public int getConnectionStatus(BluetoothDevice device) {
52         return BluetoothProfile.STATE_DISCONNECTED; // Settings app doesn't handle OPP
53     }
54 
isPreferred(BluetoothDevice device)55     public boolean isPreferred(BluetoothDevice device) {
56         return false;
57     }
58 
getPreferred(BluetoothDevice device)59     public int getPreferred(BluetoothDevice device) {
60         return BluetoothProfile.PRIORITY_OFF; // Settings app doesn't handle OPP
61     }
62 
setPreferred(BluetoothDevice device, boolean preferred)63     public void setPreferred(BluetoothDevice device, boolean preferred) {
64     }
65 
isProfileReady()66     public boolean isProfileReady() {
67         return true;
68     }
69 
toString()70     public String toString() {
71         return NAME;
72     }
73 
getOrdinal()74     public int getOrdinal() {
75         return ORDINAL;
76     }
77 
getNameResource(BluetoothDevice device)78     public int getNameResource(BluetoothDevice device) {
79         return R.string.bluetooth_profile_opp;
80     }
81 
getSummaryResourceForDevice(BluetoothDevice device)82     public int getSummaryResourceForDevice(BluetoothDevice device) {
83         return 0;   // OPP profile not displayed in UI
84     }
85 
getDrawableResource(BluetoothClass btClass)86     public int getDrawableResource(BluetoothClass btClass) {
87         return 0;   // no icon for OPP
88     }
89 }
90