• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package android.wifi.mockwifi.nl80211;
18 
19 import android.net.wifi.nl80211.IClientInterface;
20 import android.net.wifi.nl80211.ISendMgmtFrameEvent;
21 import android.net.wifi.nl80211.IWifiScannerImpl;
22 import android.util.Log;
23 
24 public class IClientInterfaceImp extends IClientInterface.Stub {
25     private static final String TAG = "IClientInterfaceImp";
26 
27     private IWifiScannerImp mIWifiScannerImp;
28     private String mIfaceName = null;
29 
30     private int mCurrentRssiDbm = 0;
31     private int mTxBitrateMbps = 0;
32     private int mRxBitrateMbps = 0;
33     private int mAssociationFrequencyMHz = 0;
34 
IClientInterfaceImp(String ifaceName)35     public IClientInterfaceImp(String ifaceName) {
36         mIfaceName = ifaceName;
37         mIWifiScannerImp = new IWifiScannerImp(ifaceName);
38     }
39 
setRxBitrateMbps(int rxBitrateMbps)40     public void setRxBitrateMbps(int rxBitrateMbps) {
41         mRxBitrateMbps = rxBitrateMbps;
42     }
43 
setTxBitrateMbps(int txBitrateMbps)44     public void setTxBitrateMbps(int txBitrateMbps) {
45         mTxBitrateMbps = txBitrateMbps;
46     }
47 
setCurrentRssiDbm(int currentRssiDbm)48     public void setCurrentRssiDbm(int currentRssiDbm) {
49         mCurrentRssiDbm = currentRssiDbm;
50     }
51 
setAssociationFrequencyMHz(int associationFrequencyMHz)52     public void setAssociationFrequencyMHz(int associationFrequencyMHz) {
53         mAssociationFrequencyMHz = associationFrequencyMHz;
54     }
55 
56     // Supported methods in IClientInterface.aidl
57     @Override
signalPoll()58     public int[] signalPoll() {
59         Log.d(TAG, "signalPoll");
60         return new int[] {mCurrentRssiDbm, mTxBitrateMbps,
61                 mAssociationFrequencyMHz, mRxBitrateMbps};
62     }
63 
64     @Override
getPacketCounters()65     public int[] getPacketCounters() {
66         Log.d(TAG, "getPacketCounters");
67         // TODO: Mock it when we have a use (test) case.
68         return null;
69     }
70 
71     @Override
getMacAddress()72     public byte[] getMacAddress() {
73         Log.d(TAG, "getMacAddress");
74         // TODO: Mock it when we have a use (test) case.
75         return null;
76     }
77 
78     @Override
getInterfaceName()79     public String getInterfaceName() {
80         Log.d(TAG, "getInterfaceName");
81         // TODO: Mock it when we have a use (test) case.
82         return null;
83     }
84 
85     @Override
getWifiScannerImpl()86     public IWifiScannerImpl getWifiScannerImpl() {
87         Log.d(TAG, "getWifiScannerImpl");
88         return mIWifiScannerImp;
89     }
90 
91     // CHECKSTYLE:OFF Generated code
92     @Override
SendMgmtFrame(byte[] frame, ISendMgmtFrameEvent callback, int mcs)93     public void SendMgmtFrame(byte[] frame, ISendMgmtFrameEvent callback, int mcs) {
94         Log.d(TAG, "SendMgmtFrame");
95         // TODO: Mock it when we have a use (test) case.
96     }
97     // CHECKSTYLE:ON Generated code
98 }
99