• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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.telephony.data;
18 
19 import android.annotation.NonNull;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 import java.util.Objects;
24 
25 /**
26  * Class that stores information specific to NR QOS.
27  *
28  * @hide
29  */
30 public final class NrQos extends Qos implements Parcelable {
31     int qosFlowId;
32     int fiveQi;
33     int averagingWindowMs;
34 
NrQos(QosBandwidth downlink, QosBandwidth uplink, int qosFlowId, int fiveQi, int averagingWindowMs)35     public NrQos(QosBandwidth downlink, QosBandwidth uplink, int qosFlowId, int fiveQi,
36             int averagingWindowMs) {
37         super(Qos.QOS_TYPE_NR, downlink, uplink);
38         this.qosFlowId = qosFlowId;
39         this.fiveQi = fiveQi;
40         this.averagingWindowMs = averagingWindowMs;
41     }
42 
NrQos(Parcel source)43     private NrQos(Parcel source) {
44         super(source);
45         this.qosFlowId = source.readInt();
46         this.fiveQi = source.readInt();
47         this.averagingWindowMs = source.readInt();
48     }
49 
createFromParcelBody(@onNull Parcel in)50     public static @NonNull NrQos createFromParcelBody(@NonNull Parcel in) {
51         return new NrQos(in);
52     }
53 
get5Qi()54     public int get5Qi() {
55         return fiveQi;
56     }
57 
getQfi()58     public int getQfi() {
59         return qosFlowId;
60     }
61 
getAveragingWindow()62     public int getAveragingWindow() {
63         return averagingWindowMs;
64     }
65 
66     @Override
writeToParcel(@onNull Parcel dest, int flags)67     public void writeToParcel(@NonNull Parcel dest, int flags) {
68         super.writeToParcel(Qos.QOS_TYPE_NR, dest, flags);
69         dest.writeInt(qosFlowId);
70         dest.writeInt(fiveQi);
71         dest.writeInt(averagingWindowMs);
72     }
73 
74     @Override
describeContents()75     public int describeContents() {
76         return 0;
77     }
78 
79     @Override
hashCode()80     public int hashCode() {
81         return Objects.hash(super.hashCode(), qosFlowId, fiveQi, averagingWindowMs);
82     }
83 
84     @Override
equals(Object o)85     public boolean equals(Object o) {
86         if (this == o) return true;
87 
88         if (o == null || !(o instanceof NrQos)) {
89             return false;
90         }
91 
92         NrQos other = (NrQos) o;
93 
94         if (!super.equals(other)) {
95             return false;
96         }
97 
98         return this.qosFlowId == other.qosFlowId
99             && this.fiveQi == other.fiveQi
100             && this.averagingWindowMs == other.averagingWindowMs;
101     }
102 
103     @Override
toString()104     public String toString() {
105         return "NrQos {"
106                 + " fiveQi=" + fiveQi
107                 + " downlink=" + downlink
108                 + " uplink=" + uplink
109                 + " qosFlowId=" + qosFlowId
110                 + " averagingWindowMs=" + averagingWindowMs + "}";
111     }
112 
113     public static final @NonNull Parcelable.Creator<NrQos> CREATOR =
114             new Parcelable.Creator<NrQos>() {
115                 @Override
116                 public NrQos createFromParcel(Parcel source) {
117                     return new NrQos(source);
118                 }
119 
120                 @Override
121                 public NrQos[] newArray(int size) {
122                     return new NrQos[size];
123                 }
124             };
125 }
126