• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 com.android.server.uwb.rftest;
18 
19 import android.os.PersistableBundle;
20 
21 import com.android.server.uwb.util.UwbUtil;
22 
23 import com.google.uwb.support.rftest.RfTestParams;
24 import com.google.uwb.support.rftest.RfTestPeriodicTxResult;
25 
26 public class UwbTestPeriodicTxResult implements RfNotificationEvent {
27     private int mStatus;
28     private byte[] mRawNotificationData;
29 
UwbTestPeriodicTxResult(int status, byte[] rawNotificationData)30     public UwbTestPeriodicTxResult(int status, byte[] rawNotificationData) {
31         this.mStatus = status;
32         this.mRawNotificationData = rawNotificationData;
33     }
34 
35     @Override
getStatus()36     public int getStatus() {
37         return mStatus;
38     }
39 
40     @Override
getRawNotificationData()41     public byte[] getRawNotificationData() {
42         return mRawNotificationData;
43     }
44 
45     @Override
getOperationType()46     public int getOperationType() {
47         return RfTestParams.TEST_PERIODIC_TX;
48     }
49 
50     @Override
toBundle()51     public PersistableBundle toBundle() {
52         RfTestPeriodicTxResult.Builder periodicRxResult = new RfTestPeriodicTxResult.Builder()
53                 .setOperationType(getOperationType())
54                 .setRawNtfData(mRawNotificationData)
55                 .setStatus(mStatus);
56 
57         return periodicRxResult.build().toBundle();
58     }
59 
60     @Override
toString()61     public String toString() {
62         return "UwbTestPeriodicTxResult { "
63                 + " Status = " + mStatus
64                 + ", RfOperationType = " + getOperationType()
65                 + ", RawNotificationData = " + UwbUtil.toHexString(mRawNotificationData)
66                 + '}';
67     }
68 }
69