17ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk/* 27ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * Copyright (C) 2011 The Android Open Source Project 37ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * 47ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * Licensed under the Apache License, Version 2.0 (the "License"); 57ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * you may not use this file except in compliance with the License. 67ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * You may obtain a copy of the License at 77ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * 87ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * http://www.apache.org/licenses/LICENSE-2.0 97ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * 107ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * Unless required by applicable law or agreed to in writing, software 117ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * distributed under the License is distributed on an "AS IS" BASIS, 127ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * See the License for the specific language governing permissions and 147ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * limitations under the License. 157ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk */ 167ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 177ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkpackage com.android.settingslib.bluetooth; 187ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 197ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkimport com.android.settingslib.R; 207ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 217ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkimport android.bluetooth.BluetoothClass; 227ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkimport android.bluetooth.BluetoothDevice; 237ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkimport android.bluetooth.BluetoothProfile; 247ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 257ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk/** 267ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk * OppProfile handles Bluetooth OPP. 277ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk */ 287ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monkfinal class OppProfile implements LocalBluetoothProfile { 297ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 307ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk static final String NAME = "OPP"; 317ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 327ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk // Order of this profile in device profiles list 337ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk private static final int ORDINAL = 2; 347ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 357ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean isConnectable() { 367ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return false; 377ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 387ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 397ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean isAutoConnectable() { 407ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return false; 417ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 427ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 437ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean connect(BluetoothDevice device) { 447ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return false; 457ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 467ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 477ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean disconnect(BluetoothDevice device) { 487ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return false; 497ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 507ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 517ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getConnectionStatus(BluetoothDevice device) { 527ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return BluetoothProfile.STATE_DISCONNECTED; // Settings app doesn't handle OPP 537ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 547ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 557ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean isPreferred(BluetoothDevice device) { 567ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return false; 577ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 587ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 597ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getPreferred(BluetoothDevice device) { 607ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return BluetoothProfile.PRIORITY_OFF; // Settings app doesn't handle OPP 617ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 627ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 637ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public void setPreferred(BluetoothDevice device, boolean preferred) { 647ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 657ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 667ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public boolean isProfileReady() { 677ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return true; 687ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 697ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 707ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public String toString() { 717ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return NAME; 727ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 737ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 747ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getOrdinal() { 757ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return ORDINAL; 767ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 777ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 787ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getNameResource(BluetoothDevice device) { 797ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return R.string.bluetooth_profile_opp; 807ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 817ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 827ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getSummaryResourceForDevice(BluetoothDevice device) { 837ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return 0; // OPP profile not displayed in UI 847ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 857ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk 867ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk public int getDrawableResource(BluetoothClass btClass) { 877ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk return 0; // no icon for OPP 887ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk } 897ce96b9e610de2782ec5f2af806e7bc0f90c8578Jason Monk} 90