/* * Copyright 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.bluetooth; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** * This class contains the subgroup settings information for this Broadcast Subgroup. * * @hide */ @SystemApi public final class BluetoothLeBroadcastSubgroupSettings implements Parcelable { private final @Quality int mPreferredQuality; private final BluetoothLeAudioContentMetadata mContentMetadata; /** * Audio quality for this broadcast subgroup * *
Audio quality for this broadcast subgroup.
*
* @hide
*/
@IntDef(
prefix = "QUALITY_",
value = {
QUALITY_STANDARD,
QUALITY_HIGH,
})
@Retention(RetentionPolicy.SOURCE)
public @interface Quality {}
/**
* Indicates standard quality for this subgroup audio configuration.
*
* @hide
*/
@SystemApi public static final int QUALITY_STANDARD = 0;
/**
* Indicates high quality for this subgroup audio configuration.
*
* @hide
*/
@SystemApi public static final int QUALITY_HIGH = 1;
private BluetoothLeBroadcastSubgroupSettings(
int preferredQuality, BluetoothLeAudioContentMetadata contentMetadata) {
mPreferredQuality = preferredQuality;
mContentMetadata = contentMetadata;
}
@Override
public boolean equals(@Nullable Object o) {
if (!(o instanceof BluetoothLeBroadcastSubgroupSettings)) {
return false;
}
final BluetoothLeBroadcastSubgroupSettings other = (BluetoothLeBroadcastSubgroupSettings) o;
return mPreferredQuality == other.getPreferredQuality()
&& mContentMetadata.equals(other.getContentMetadata());
}
@Override
public int hashCode() {
return Objects.hash(mPreferredQuality, mContentMetadata);
}
/**
* Get content metadata for this Broadcast Source subgroup.
*
* @return content metadata for this Broadcast Source subgroup
* @hide
*/
@SystemApi
@NonNull
public BluetoothLeAudioContentMetadata getContentMetadata() {
return mContentMetadata;
}
/**
* Get preferred audio quality for this Broadcast Source subgroup.
*
* @return preferred audio quality for this Broadcast Source subgroup
* @hide
*/
@SystemApi
public @Quality int getPreferredQuality() {
return mPreferredQuality;
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
public int describeContents() {
return 0;
}
/**
* {@inheritDoc}
*
* @hide
*/
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mPreferredQuality);
out.writeTypedObject(mContentMetadata, 0);
}
/**
* A {@link Parcelable.Creator} to create {@link BluetoothLeBroadcastSubgroupSettings} from
* parcel.
*
* @hide
*/
@SystemApi @NonNull
public static final Creator