1 /*
2  * Copyright (C) 2022 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 com.android.server.uwb.util.UwbUtil;
19 
20 public class UwbOwrAoaMeasurement {
21     public byte[] mMacAddress;
22     public int mStatus;
23     public int mNLoS;
24     public int mFrameSequenceNumber;
25     public int blockIndex;
26     public float mAoaAzimuth;
27     public int mAoaAzimuthFom;
28     public float mAoaElevation;
29     public int mAoaElevationFom;
30 
UwbOwrAoaMeasurement(byte[] macAddress, int status, int nLoS, int frameSeqNumber, int blockIndex, int aoaAzimuth, int aoaAzimuthFom, int aoaElevation, int aoaElevationFom)31     public UwbOwrAoaMeasurement(byte[] macAddress, int status, int nLoS, int frameSeqNumber,
32             int blockIndex, int aoaAzimuth, int aoaAzimuthFom,
33             int aoaElevation, int aoaElevationFom) {
34         this.mMacAddress = macAddress;
35         this.mStatus = status;
36         this.mNLoS = nLoS;
37         this.mFrameSequenceNumber = frameSeqNumber;
38         this.blockIndex = blockIndex;
39         this.mAoaAzimuth = UwbUtil.convertQFormatToFloat(
40                 UwbUtil.twos_compliment(aoaAzimuth, 16), 9, 7);
41         this.mAoaAzimuthFom = aoaAzimuthFom;
42         this.mAoaElevation = UwbUtil.convertQFormatToFloat(
43                 UwbUtil.twos_compliment(aoaElevation, 16), 9, 7);
44         this.mAoaElevationFom = aoaElevationFom;
45     }
46 
getMacAddress()47     public byte[] getMacAddress() {
48         return mMacAddress;
49     }
50 
getRangingStatus()51     public int getRangingStatus() {
52         return mStatus;
53     }
54 
getNLoS()55     public int getNLoS() {
56         return mNLoS;
57     }
58 
getFrameSequenceNumber()59     public int getFrameSequenceNumber() {
60         return mFrameSequenceNumber;
61     }
62 
getBlockIndex()63     public int getBlockIndex() {
64         return blockIndex;
65     }
66 
getAoaAzimuth()67     public float getAoaAzimuth() {
68         return mAoaAzimuth;
69     }
70 
getAoaAzimuthFom()71     public int getAoaAzimuthFom() {
72         return mAoaAzimuthFom;
73     }
74 
getAoaElevation()75     public float getAoaElevation() {
76         return mAoaElevation;
77     }
78 
getAoaElevationFom()79     public int getAoaElevationFom() {
80         return mAoaElevationFom;
81     }
82 
toString()83     public String toString() {
84         return "UwbOwrAoaMeasurement { "
85                 + " MacAddress = " + UwbUtil.toHexString(mMacAddress)
86                 + ", Status = " + mStatus
87                 + ", NLoS = " + mNLoS
88                 + ", FrameSequenceNumber = " + mFrameSequenceNumber
89                 + ", BlockIndex = " + blockIndex
90                 + ", AoaAzimuth = " + mAoaAzimuth
91                 + ", AoaAzimuthFom = " + mAoaAzimuthFom
92                 + ", AoaElevation = " + mAoaElevation
93                 + ", AoaElevationFom = " + mAoaElevationFom
94                 + '}';
95     }
96 }
97