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