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