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 android.car.vms; 18 19 import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE; 20 21 import android.annotation.SystemApi; 22 import android.car.annotation.AddedInOrBefore; 23 import android.os.Parcel; 24 import android.os.Parcelable; 25 26 import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport; 27 import com.android.car.internal.util.DataClass; 28 29 /** 30 * A Vehicle Map Service layer, which can be offered or subscribed to by clients. 31 * 32 * The full layer definition is used when routing packets, with each layer having the following 33 * properties: 34 * 35 * <ul> 36 * <li>Type: Type of data being published.</li> 37 * <li>Subtype: Type of packet being published.</li> 38 * <li>Version: Major version of the packet format. Different versions are not guaranteed to be 39 * compatible.</li> 40 * </ul> 41 * 42 * See the Vehicle Maps Service partner documentation for the set of valid types and subtypes. 43 * 44 * @hide 45 */ 46 @SystemApi 47 @DataClass(genAidl = true, genEqualsHashCode = true, genToString = true) 48 public final class VmsLayer implements Parcelable { 49 /** 50 * Type of data published on the layer 51 **/ 52 private int mType; 53 54 /** 55 * Type of packet published on the layer 56 */ 57 private int mChannel; 58 59 /** 60 * Major version of layer packet format 61 */ 62 private int mVersion; 63 64 /** 65 * Type of packet published on the layer 66 * 67 * @deprecated Use {@link #getChannel()} instead 68 */ 69 @Deprecated 70 @AddedInOrBefore(majorVersion = 33) getSubtype()71 public int getSubtype() { 72 return mChannel; 73 } 74 75 76 77 // Code below generated by codegen v1.0.14. 78 // 79 // DO NOT MODIFY! 80 // CHECKSTYLE:OFF Generated code 81 // 82 // To regenerate run: 83 // $ codegen $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car/vms/VmsLayer.java 84 // 85 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 86 // Settings > Editor > Code Style > Formatter Control 87 //@formatter:off 88 89 90 /** 91 * Creates a new VmsLayer. 92 * 93 * @param type 94 * Type of data published on the layer 95 * @param channel 96 * Type of packet published on the layer 97 * @param version 98 * Major version of layer packet format 99 */ 100 @DataClass.Generated.Member VmsLayer( int type, int channel, int version)101 public VmsLayer( 102 int type, 103 int channel, 104 int version) { 105 this.mType = type; 106 this.mChannel = channel; 107 this.mVersion = version; 108 109 // onConstructed(); // You can define this method to get a callback 110 } 111 112 /** 113 * Type of data published on the layer 114 */ 115 @DataClass.Generated.Member 116 @AddedInOrBefore(majorVersion = 33) getType()117 public int getType() { 118 return mType; 119 } 120 121 /** 122 * Type of packet published on the layer 123 */ 124 @DataClass.Generated.Member 125 @AddedInOrBefore(majorVersion = 33) getChannel()126 public int getChannel() { 127 return mChannel; 128 } 129 130 /** 131 * Major version of layer packet format 132 */ 133 @DataClass.Generated.Member 134 @AddedInOrBefore(majorVersion = 33) getVersion()135 public int getVersion() { 136 return mVersion; 137 } 138 139 @Override 140 @DataClass.Generated.Member 141 @AddedInOrBefore(majorVersion = 33) toString()142 public String toString() { 143 // You can override field toString logic by defining methods like: 144 // String fieldNameToString() { ... } 145 146 return "VmsLayer { " + 147 "type = " + mType + ", " + 148 "channel = " + mChannel + ", " + 149 "version = " + mVersion + 150 " }"; 151 } 152 153 @Override 154 @DataClass.Generated.Member 155 @AddedInOrBefore(majorVersion = 33) equals(@ndroid.annotation.Nullable Object o)156 public boolean equals(@android.annotation.Nullable Object o) { 157 // You can override field equality logic by defining either of the methods like: 158 // boolean fieldNameEquals(VmsLayer other) { ... } 159 // boolean fieldNameEquals(FieldType otherValue) { ... } 160 161 if (this == o) return true; 162 if (o == null || getClass() != o.getClass()) return false; 163 @SuppressWarnings("unchecked") 164 VmsLayer that = (VmsLayer) o; 165 //noinspection PointlessBooleanExpression 166 return true 167 && mType == that.mType 168 && mChannel == that.mChannel 169 && mVersion == that.mVersion; 170 } 171 172 @Override 173 @DataClass.Generated.Member 174 @AddedInOrBefore(majorVersion = 33) hashCode()175 public int hashCode() { 176 // You can override field hashCode logic by defining methods like: 177 // int fieldNameHashCode() { ... } 178 179 int _hash = 1; 180 _hash = 31 * _hash + mType; 181 _hash = 31 * _hash + mChannel; 182 _hash = 31 * _hash + mVersion; 183 return _hash; 184 } 185 186 @Override 187 @DataClass.Generated.Member 188 @AddedInOrBefore(majorVersion = 33) writeToParcel(@ndroid.annotation.NonNull Parcel dest, int flags)189 public void writeToParcel(@android.annotation.NonNull Parcel dest, int flags) { 190 // You can override field parcelling by defining methods like: 191 // void parcelFieldName(Parcel dest, int flags) { ... } 192 193 dest.writeInt(mType); 194 dest.writeInt(mChannel); 195 dest.writeInt(mVersion); 196 } 197 198 @Override 199 @DataClass.Generated.Member 200 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) 201 @AddedInOrBefore(majorVersion = 33) describeContents()202 public int describeContents() { return 0; } 203 204 /** @hide */ 205 @SuppressWarnings({"unchecked", "RedundantCast"}) 206 @DataClass.Generated.Member VmsLayer(@ndroid.annotation.NonNull Parcel in)207 /* package-private */ VmsLayer(@android.annotation.NonNull Parcel in) { 208 // You can override field unparcelling by defining methods like: 209 // static FieldType unparcelFieldName(Parcel in) { ... } 210 211 int type = in.readInt(); 212 int channel = in.readInt(); 213 int version = in.readInt(); 214 215 this.mType = type; 216 this.mChannel = channel; 217 this.mVersion = version; 218 219 // onConstructed(); // You can define this method to get a callback 220 } 221 222 @DataClass.Generated.Member 223 @AddedInOrBefore(majorVersion = 33) 224 public static final @android.annotation.NonNull Parcelable.Creator<VmsLayer> CREATOR 225 = new Parcelable.Creator<VmsLayer>() { 226 @Override 227 public VmsLayer[] newArray(int size) { 228 return new VmsLayer[size]; 229 } 230 231 @Override 232 public VmsLayer createFromParcel(@android.annotation.NonNull Parcel in) { 233 return new VmsLayer(in); 234 } 235 }; 236 237 @DataClass.Generated( 238 time = 1582065881190L, 239 codegenVersion = "1.0.14", 240 sourceFile = "packages/services/Car/car-lib/src/android/car/vms/VmsLayer.java", 241 inputSignatures = "private int mType\nprivate int mChannel\nprivate int mVersion\npublic @java.lang.Deprecated int getSubtype()\nclass VmsLayer extends java.lang.Object implements [android.os.Parcelable]\n@com.android.car.internal.util.DataClass(genAidl=true, genEqualsHashCode=true, genToString=true)") 242 @Deprecated __metadata()243 private void __metadata() {} 244 245 246 //@formatter:on 247 // End of generated code 248 249 } 250