1 /* 2 * Copyright (C) 2021 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 package com.android.server.uwb.data; 17 18 import java.util.Arrays; 19 import java.util.Objects; 20 21 /** 22 * Stores the response of the UCI CORE_GET_DEVICE_INFO CMD. 23 */ 24 public class UwbDeviceInfoResponse { 25 public int mStatusCode; 26 public int mUciVersion; 27 public int mMacVersion; 28 public int mPhyVersion; 29 public int mUciTestVersion; 30 public byte[] mVendorSpecInfo; 31 UwbDeviceInfoResponse( int statusCode, int uciVersion, int macVersion, int phyVersion, int uciTestVersion, byte[] vendorSpecInfo)32 public UwbDeviceInfoResponse( 33 int statusCode, 34 int uciVersion, 35 int macVersion, 36 int phyVersion, 37 int uciTestVersion, 38 byte[] vendorSpecInfo) { 39 this.mStatusCode = statusCode; 40 this.mUciVersion = uciVersion; 41 this.mMacVersion = macVersion; 42 this.mPhyVersion = phyVersion; 43 this.mUciTestVersion = uciTestVersion; 44 this.mVendorSpecInfo = vendorSpecInfo; 45 } 46 47 @Override equals(Object o)48 public boolean equals(Object o) { 49 if (this == o) return true; 50 if (!(o instanceof UwbDeviceInfoResponse)) return false; 51 UwbDeviceInfoResponse that = (UwbDeviceInfoResponse) o; 52 return mStatusCode == that.mStatusCode 53 && mUciVersion == that.mUciVersion 54 && mMacVersion == that.mMacVersion 55 && mPhyVersion == that.mPhyVersion 56 && mUciTestVersion == that.mUciTestVersion 57 && Arrays.equals(mVendorSpecInfo, that.mVendorSpecInfo); 58 } 59 60 @Override hashCode()61 public int hashCode() { 62 return Objects.hash(mStatusCode, 63 mUciVersion, mMacVersion, mPhyVersion, mUciTestVersion, 64 Arrays.hashCode(mVendorSpecInfo)); 65 } 66 67 @Override toString()68 public String toString() { 69 return "UwbDeviceInfoResponse{" 70 + "statusCode=" + mStatusCode 71 + ", uciVersion=" + mUciVersion 72 + ", macVersion=" + mMacVersion 73 + ", phyVersion=" + mPhyVersion 74 + ", uciTestVersion=" + mUciTestVersion 75 + ", vendorSpecInfo=" + Arrays.toString(mVendorSpecInfo) 76 + '}'; 77 } 78 } 79