1 /* 2 * Copyright (C) 2016 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 android.bluetooth; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 import java.util.Random; 23 24 /** @hide */ 25 public final class BluetoothHidDeviceAppQosSettings implements Parcelable { 26 27 final public int serviceType; 28 final public int tokenRate; 29 final public int tokenBucketSize; 30 final public int peakBandwidth; 31 final public int latency; 32 final public int delayVariation; 33 34 final static public int SERVICE_NO_TRAFFIC = 0x00; 35 final static public int SERVICE_BEST_EFFORT = 0x01; 36 final static public int SERVICE_GUARANTEED = 0x02; 37 38 final static public int MAX = (int) 0xffffffff; 39 BluetoothHidDeviceAppQosSettings(int serviceType, int tokenRate, int tokenBucketSize, int peakBandwidth, int latency, int delayVariation)40 public BluetoothHidDeviceAppQosSettings(int serviceType, int tokenRate, int tokenBucketSize, 41 int peakBandwidth, 42 int latency, int delayVariation) { 43 this.serviceType = serviceType; 44 this.tokenRate = tokenRate; 45 this.tokenBucketSize = tokenBucketSize; 46 this.peakBandwidth = peakBandwidth; 47 this.latency = latency; 48 this.delayVariation = delayVariation; 49 } 50 51 @Override equals(Object o)52 public boolean equals(Object o) { 53 if (o instanceof BluetoothHidDeviceAppQosSettings) { 54 BluetoothHidDeviceAppQosSettings qos = (BluetoothHidDeviceAppQosSettings) o; 55 return false; 56 } 57 return false; 58 } 59 60 @Override describeContents()61 public int describeContents() { 62 return 0; 63 } 64 65 public static final Parcelable.Creator<BluetoothHidDeviceAppQosSettings> CREATOR = 66 new Parcelable.Creator<BluetoothHidDeviceAppQosSettings>() { 67 68 @Override 69 public BluetoothHidDeviceAppQosSettings createFromParcel(Parcel in) { 70 71 return new BluetoothHidDeviceAppQosSettings(in.readInt(), in.readInt(), in.readInt(), 72 in.readInt(), 73 in.readInt(), in.readInt()); 74 } 75 76 @Override 77 public BluetoothHidDeviceAppQosSettings[] newArray(int size) { 78 return new BluetoothHidDeviceAppQosSettings[size]; 79 } 80 }; 81 82 @Override writeToParcel(Parcel out, int flags)83 public void writeToParcel(Parcel out, int flags) { 84 out.writeInt(serviceType); 85 out.writeInt(tokenRate); 86 out.writeInt(tokenBucketSize); 87 out.writeInt(peakBandwidth); 88 out.writeInt(latency); 89 out.writeInt(delayVariation); 90 } 91 toArray()92 public int[] toArray() { 93 return new int[] { 94 serviceType, tokenRate, tokenBucketSize, peakBandwidth, latency, delayVariation 95 }; 96 } 97 } 98