• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.net.wifi;
18 
19 import android.net.wifi.ISendMgmtFrameEvent;
20 import android.net.wifi.IWifiScannerImpl;
21 
22 // IClientInterface represents a network interface that can be used to connect
23 // to access points and obtain internet connectivity.
24 interface IClientInterface {
25   // Get packet counters for this interface.
26   // First element in array is the number of successfully transmitted packets.
27   // Second element in array is the number of tramsmission failure.
28   // This call is valid only when interface is associated with an AP, otherwise
29   // it returns an empty array.
getPacketCounters()30   int[] getPacketCounters();
31 
32   // Do signal poll for this interface.
33   // First element in array is the RSSI value in dBM.
34   // Second element in array is the transmission bit rate in Mbps.
35   // Third element in array is the association frequency in MHz.
36   // Fourth element in array is the last received packet bit rate in Mbps.
37   // This call is valid only when interface is associated with an AP, otherwise
38   // it returns an empty array.
signalPoll()39   int[] signalPoll();
40 
41   // Get the MAC address of this interface.
getMacAddress()42   byte[] getMacAddress();
43 
44   // Retrieve the name of the network interface corresponding to this
45   // IClientInterface instance (e.g. "wlan0")
46   @utf8InCpp
getInterfaceName()47   String getInterfaceName();
48 
49   // Get a WifiScanner interface associated with this interface.
50   // Returns null when the underlying interface object is destroyed.
getWifiScannerImpl()51   @nullable IWifiScannerImpl getWifiScannerImpl();
52 
53   // Set the MAC address of this interface
54   // Returns true if the set was successful
setMacAddress(in byte[] mac)55   boolean setMacAddress(in byte[] mac);
56 
57   // Sends an arbitrary 802.11 management frame on the current channel.
58   // @param frame Bytes of the 802.11 management frame to be sent, including the
59   //     header, but not including the frame check sequence (FCS).
60   // @param Callback triggered when the transmitted frame is ACKed or the
61   //     transmission fails.
62   // @param mcs MCS rate which the management frame will be sent at. If mcs < 0,
63   //     the driver will select the rate automatically. If the device does not
64   //     support sending the frame at a specified MCS rate, the transmission
65   //     will be aborted and ISendMgmtFrameEvent.OnFailure() will be called with
66   //     reason ISendMgmtFrameEvent.SEND_MGMT_FRAME_ERROR_MCS_UNSUPPORTED.
SendMgmtFrame( in byte[] frame, in ISendMgmtFrameEvent callback, int mcs)67   oneway void SendMgmtFrame(
68       in byte[] frame, in ISendMgmtFrameEvent callback, int mcs);
69 }
70