1 /* 2 * Copyright (C) 2017 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.development; 18 19 import android.bluetooth.BluetoothCodecConfig; 20 21 /** 22 * Utility class for storing current Bluetooth A2DP profile values 23 */ 24 public class BluetoothA2dpConfigStore { 25 26 // init default values 27 private int mCodecType = BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID; 28 private int mCodecPriority = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT; 29 private int mSampleRate = BluetoothCodecConfig.SAMPLE_RATE_NONE; 30 private int mBitsPerSample = BluetoothCodecConfig.BITS_PER_SAMPLE_NONE; 31 private int mChannelMode = BluetoothCodecConfig.CHANNEL_MODE_NONE; 32 private long mCodecSpecific1Value; 33 private long mCodecSpecific2Value; 34 private long mCodecSpecific3Value; 35 private long mCodecSpecific4Value; 36 setCodecType(int codecType)37 public void setCodecType(int codecType) { 38 mCodecType = codecType; 39 } 40 setCodecPriority(int codecPriority)41 public void setCodecPriority(int codecPriority) { 42 mCodecPriority = codecPriority; 43 } 44 setSampleRate(int sampleRate)45 public void setSampleRate(int sampleRate) { 46 mSampleRate = sampleRate; 47 } 48 setBitsPerSample(int bitsPerSample)49 public void setBitsPerSample(int bitsPerSample) { 50 mBitsPerSample = bitsPerSample; 51 } 52 setChannelMode(int channelMode)53 public void setChannelMode(int channelMode) { 54 mChannelMode = channelMode; 55 } 56 setCodecSpecific1Value(long codecSpecific1Value)57 public void setCodecSpecific1Value(long codecSpecific1Value) { 58 mCodecSpecific1Value = codecSpecific1Value; 59 } 60 setCodecSpecific2Value(int codecSpecific2Value)61 public void setCodecSpecific2Value(int codecSpecific2Value) { 62 mCodecSpecific2Value = codecSpecific2Value; 63 } 64 setCodecSpecific3Value(int codecSpecific3Value)65 public void setCodecSpecific3Value(int codecSpecific3Value) { 66 mCodecSpecific3Value = codecSpecific3Value; 67 } 68 setCodecSpecific4Value(int codecSpecific4Value)69 public void setCodecSpecific4Value(int codecSpecific4Value) { 70 mCodecSpecific4Value = codecSpecific4Value; 71 } 72 createCodecConfig()73 public BluetoothCodecConfig createCodecConfig() { 74 return new BluetoothCodecConfig(mCodecType, mCodecPriority, 75 mSampleRate, mBitsPerSample, 76 mChannelMode, mCodecSpecific1Value, 77 mCodecSpecific2Value, mCodecSpecific3Value, 78 mCodecSpecific4Value); 79 } 80 } 81