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 
17 /* NativeUwbRfTestManager is unused now*/
18 /*package com.android.server.uwb.jni;
19 
20 import android.util.Log;
21 
22 import com.android.server.uwb.test.UwbTestLoopBackTestResult;
23 import com.android.server.uwb.test.UwbTestPeriodicTxResult;
24 import com.android.server.uwb.test.UwbTestRxPacketErrorRateResult;
25 import com.android.server.uwb.test.UwbTestRxResult;
26 
27 public class NativeUwbRfTestManager {
28     private static final String TAG = NativeUwbRfTestManager.class.getSimpleName();
29 
30     protected INativeUwbManager.RfTestNotification mRfTestListener;
31 
32     public NativeUwbRfTestManager() {
33         nativeInit();
34     }
35 
36     public void setDeviceListener(INativeUwbManager.RfTestNotification rftestListener) {
37         mRfTestListener = rftestListener;
38     }
39 
40     public void onPeriodicTxDataNotificationReceived(UwbTestPeriodicTxResult periodicTxTestResult) {
41         Log.d(TAG, "onPeriodicTxDataNotificationReceived : " + periodicTxTestResult);
42         mRfTestListener.onPeriodicTxDataNotificationReceived(periodicTxTestResult);
43     }
44 
45     public void onPerRxDataNotificationReceived(UwbTestRxPacketErrorRateResult perRxTestResult) {
46         Log.d(TAG, "onPerRxDataNotificationReceived : " + perRxTestResult);
47         mRfTestListener.onPerRxDataNotificationReceived(perRxTestResult);
48     }
49 
50     public void onLoopBackTestDataNotificationReceived(UwbTestLoopBackTestResult loopBackResult) {
51         Log.d(TAG, "onLoopBackTestDataNotificationReceived : " + loopBackResult);
52         mRfTestListener.onLoopBackTestDataNotificationReceived(loopBackResult);
53     }
54 
55     public void onRxTestDataNotificationReceived(UwbTestRxResult rxTestResult) {
56         Log.d(TAG, "onRxTestDataNotificationReceived : " + rxTestResult);
57         mRfTestListener.onRxTestDataNotificationReceived(rxTestResult);
58     }
59 
60     public synchronized byte[] setRfTestConfigurations(int sessionId, int noOfParams,
61             int testConfigParamLen, byte[] testConfigParams) {
62         return nativeSetTestConfigurations(
63                 sessionId, noOfParams, testConfigParamLen, testConfigParams);
64     }
65 
66     public synchronized byte[] getRfTestConfigurations(int sessionId, int noOfParams,
67             int testConfigParamLen, byte[] testConfigParams) {
68         return nativeGetTestConfigurations(
69                 sessionId, noOfParams, testConfigParamLen, testConfigParams);
70     }
71 
72     public synchronized byte startPeriodicTxTest(byte[] psduData) {
73         return nativeStartPeriodicTxTest(psduData);
74     }
75 
76     public synchronized byte startPerRxTest(byte[] refPsduData) {
77         return nativeStartPerRxTest(refPsduData);
78     }
79 
80     public synchronized byte startUwbLoopBackTest(byte[] psduData) {
81         return nativeStartUwbLoopBackTest(psduData);
82     }
83 
84     public synchronized byte startRxTest() {
85         return nativeStartRxTest();
86     }
87 
88     public synchronized byte stopRfTest() {
89         return nativeStopRfTest();
90     }
91 
92     private native boolean nativeInit();
93     private native byte nativeStopRfTest();
94     private native byte nativeStartPerRxTest(byte[] refPsduData);
95     private native byte nativeStartPeriodicTxTest(byte[] psduData);
96     private native byte nativeStartUwbLoopBackTest(byte[] psduData);
97     private native byte nativeStartRxTest();
98     private native byte[] nativeSetTestConfigurations(int sessionId, int noOfParams,
99             int testConfigParamLen, byte[] testConfigParams);
100     private native byte[] nativeGetTestConfigurations(int sessionId, int noOfParams,
101             int testConfigParamLen, byte[] testConfigParams);
102 }*/
103