public class WifiNative extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WifiNative.BucketSettings |
static class |
WifiNative.ChannelSettings |
static interface |
WifiNative.HotlistEventHandler |
static interface |
WifiNative.PnoEventHandler
Handler to notify the occurrence of various events during PNO scan.
|
static class |
WifiNative.PnoNetwork
Network parameters to start PNO scan.
|
static class |
WifiNative.PnoSettings
Parameters to start PNO scan.
|
static class |
WifiNative.RingBufferStatus |
static interface |
WifiNative.RttEventHandler |
static class |
WifiNative.RxFateReport
Represents the fate information for one inbound packet.
|
static class |
WifiNative.ScanCapabilities |
static interface |
WifiNative.ScanEventHandler |
static class |
WifiNative.ScanSettings |
static interface |
WifiNative.SignificantWifiChangeEventHandler |
static class |
WifiNative.TdlsCapabilities |
class |
WifiNative.TdlsEventHandler |
static class |
WifiNative.TdlsStatus |
static class |
WifiNative.TxFateReport
Represents the fate information for one outbound packet.
|
static class |
WifiNative.WifiChannelInfo
Wi-Fi channel information.
|
static interface |
WifiNative.WifiLoggerEventHandler |
static interface |
WifiNative.WifiRssiEventHandler |
Modifier and Type | Field and Description |
---|---|
static int |
BLUETOOTH_COEXISTENCE_MODE_DISABLED |
static int |
BLUETOOTH_COEXISTENCE_MODE_ENABLED |
static int |
BLUETOOTH_COEXISTENCE_MODE_SENSE |
static Object |
sLock
Hold this lock before calling supplicant or HAL methods
it is required to mutually exclude access to the driver
|
static int |
sWlan0Index |
static int |
WIFI_SCAN_FAILED |
static int |
WIFI_SCAN_RESULTS_AVAILABLE |
static int |
WIFI_SCAN_THRESHOLD_NUM_SCANS |
static int |
WIFI_SCAN_THRESHOLD_PERCENT |
static int |
WIFI_SUCCESS |
Modifier and Type | Method and Description |
---|---|
int |
addNetwork() |
boolean |
addToBlacklist(String bssid) |
void |
bssFlush() |
boolean |
cancelRtt(RttManager.RttParams[] params) |
boolean |
cancelWps() |
boolean |
clearBlacklist() |
void |
closeSupplicantConnection() |
boolean |
configureNeighborDiscoveryOffload(boolean enabled) |
boolean |
connectToSupplicant() |
static WifiSsid |
createWifiSsid(byte[] rawSsid) |
boolean |
disableNetwork(int netId)
Disables a network in wpa_supplicant.
|
boolean |
disableRttResponder()
Disable RTT responder role.
|
boolean |
disconnect() |
String |
doCustomSupplicantCommand(String command) |
void |
enableAutoConnect(boolean enable) |
boolean |
enableDisableTdls(boolean enable,
String macAdd,
WifiNative.TdlsEventHandler tdlsCallBack) |
boolean |
enableNetwork(int netId)
Enables a network in wpa_supplicant.
|
boolean |
enableNetworkWithoutConnect(int netId)
Enable a network in wpa_supplicant, do not connect.
|
RttManager.ResponderConfig |
enableRttResponder(int timeoutSeconds)
Enable RTT responder role on the device.
|
void |
enableSaveConfig() |
boolean |
fetchAnqp(String bssid,
String subtypes) |
ApfCapabilities |
getApfCapabilities() |
int[] |
getChannelsForBand(int band) |
byte[] |
getDriverStateDump()
Fetch the driver state, for driver debugging.
|
String |
getDriverVersion() |
String |
getFirmwareVersion() |
String |
getFreqCapability() |
byte[] |
getFwMemoryDump() |
int |
getGroupCapability(String deviceAddress) |
String |
getInterfaceName() |
String |
getInterfaceName(int index) |
LocalLog |
getLocalLog() |
String |
getMacAddress() |
Map<String,String> |
getNetworkExtra(int netId,
String name) |
String |
getNetworkVariable(int netId,
String name) |
String |
getNfcHandoverRequest() |
String |
getNfcHandoverSelect() |
String |
getNfcWpsConfigurationToken(int netId) |
static WifiNative |
getP2pNativeInterface() |
boolean |
getRingBufferData(String ringName) |
WifiNative.RingBufferStatus[] |
getRingBufferStatus() |
RttManager.RttCapabilities |
getRttCapabilities() |
boolean |
getRxPktFates(WifiNative.RxFateReport[] reportBufs)
Fetch the most recent RX packet fates from the HAL.
|
boolean |
getScanCapabilities(WifiNative.ScanCapabilities capabilities) |
ArrayList<ScanDetail> |
getScanResults() |
WifiScanner.ScanData[] |
getScanResults(boolean flush) |
int |
getSupportedFeatureSet() |
static int |
getSupportedFeatureSetNative(int iface) |
int |
getSupportedLoggerFeatureSet() |
WifiNative.TdlsCapabilities |
getTdlsCapabilities() |
WifiNative.TdlsStatus |
getTdlsStatus(String macAdd) |
boolean |
getTxPktFates(WifiNative.TxFateReport[] reportBufs)
Fetch the most recent TX packet fates from the HAL.
|
WifiLinkLayerStats |
getWifiLinkLayerStats(String iface) |
static WifiNative |
getWlanNativeInterface() |
WifiWakeReasonAndCounts |
getWlanWakeReasonCount()
Fetch the host wakeup reasons stats from wlan driver.
|
void |
initContext(Context context) |
boolean |
initiatorReportNfcHandover(String selectMessage) |
boolean |
installPacketFilter(byte[] filter) |
boolean |
isDriverLoaded() |
boolean |
isGetChannelsForBandSupported() |
boolean |
isHalStarted() |
boolean |
killSupplicant(boolean p2pSupported) |
String |
listNetworks() |
String |
listNetworks(int last_id) |
boolean |
loadDriver() |
boolean |
p2pCancelConnect() |
String |
p2pConnect(WifiP2pConfig config,
boolean joinExistingGroup) |
boolean |
p2pExtListen(boolean enable,
int period,
int interval) |
boolean |
p2pFind() |
boolean |
p2pFind(int timeout) |
boolean |
p2pFlush() |
String |
p2pGetDeviceAddress() |
String |
p2pGetSsid(String deviceAddress) |
boolean |
p2pGroupAdd(boolean persistent) |
boolean |
p2pGroupAdd(int netId) |
boolean |
p2pGroupRemove(String iface) |
boolean |
p2pInvite(WifiP2pGroup group,
String deviceAddress) |
boolean |
p2pListen() |
boolean |
p2pListen(int timeout) |
String |
p2pPeer(String deviceAddress) |
boolean |
p2pProvisionDiscovery(WifiP2pConfig config) |
boolean |
p2pReinvoke(int netId,
String deviceAddress) |
boolean |
p2pReject(String deviceAddress) |
boolean |
p2pServDiscCancelReq(String id) |
String |
p2pServDiscReq(String addr,
String query) |
boolean |
p2pServiceAdd(WifiP2pServiceInfo servInfo) |
boolean |
p2pServiceDel(WifiP2pServiceInfo servInfo) |
boolean |
p2pServiceFlush() |
boolean |
p2pSetChannel(int lc,
int oc) |
boolean |
p2pStopFind() |
void |
pauseScan() |
boolean |
ping() |
String |
pktcntPoll()
Example outout:
TXGOOD=396
TXBAD=1
|
int |
queryInterfaceIndex(String interfaceName) |
String |
readKernelLog() |
boolean |
reassociate() |
boolean |
reconnect() |
boolean |
removeNetwork(int netId) |
boolean |
requestRtt(RttManager.RttParams[] params,
WifiNative.RttEventHandler handler) |
void |
resetHotlist() |
boolean |
resetLogHandler() |
boolean |
resetPnoList()
Reset the PNO settings in HAL to stop PNO.
|
boolean |
responderReportNfcHandover(String requestMessage) |
void |
restartScan() |
boolean |
saveConfig() |
boolean |
scan(Set<Integer> freqs,
Set<Integer> hiddenNetworkIds)
Start a scan using wpa_supplicant for the given frequencies.
|
String |
scanResult(String bssid)
Format of result:
id=1016
bssid=00:03:7f:40:84:10
freq=2462
beacon_int=200
capabilities=0x0431
qual=0
noise=0
level=-46
tsf=0000002669008476
age=5
ie=00105143412d485332302d52322d54455354010882848b960c12182403010b0706555...
|
boolean |
selectNetwork(int netId)
Select a network in wpa_supplicant (Disables all others).
|
boolean |
setBand(int band)
Set the operational frequency band
|
boolean |
setBluetoothCoexistenceMode(int mode)
Sets the bluetooth coexistence mode.
|
boolean |
setBluetoothCoexistenceScanMode(boolean setCoexScanMode)
Enable or disable Bluetooth coexistence scan mode.
|
boolean |
setBssidBlacklist(String[] list) |
boolean |
setConcurrencyPriority(String s)
"sta" prioritizes STA connection over P2P and "p2p" prioritizes
P2P connection over STA
|
boolean |
setConfigMethods(String cfg) |
boolean |
setCountryCode(String countryCode) |
boolean |
setCountryCodeHal(String CountryCode) |
boolean |
setDeviceName(String name) |
boolean |
setDeviceType(String type) |
boolean |
setDfsFlag(boolean dfsOn) |
boolean |
setExternalSim(boolean external) |
boolean |
setHotlist(WifiScanner.HotlistSettings settings,
WifiNative.HotlistEventHandler eventHandler) |
void |
setHs20(boolean hs20) |
boolean |
setInterfaceUp(boolean up) |
boolean |
setLoggingEventHandler(WifiNative.WifiLoggerEventHandler handler) |
boolean |
setManufacturer(String value) |
void |
setMiracastMode(int mode) |
boolean |
setModelName(String value) |
boolean |
setModelNumber(String value) |
boolean |
setNetworkExtra(int netId,
String name,
Map<String,String> values) |
boolean |
setNetworkVariable(int netId,
String name,
String value) |
boolean |
setP2pGroupIdle(String iface,
int time) |
boolean |
setP2pPowerSave(String iface,
boolean enabled) |
boolean |
setP2pSsidPostfix(String postfix) |
boolean |
setPersistentReconnect(boolean enabled) |
boolean |
setPnoList(WifiNative.PnoNetwork[] list,
WifiNative.PnoEventHandler eventHandler)
Set the PNO network list in HAL to start PNO.
|
boolean |
setPnoList(WifiNative.PnoSettings settings,
WifiNative.PnoEventHandler eventHandler)
Set the PNO settings & the network list in HAL to start PNO.
|
boolean |
setPnoScan(boolean enable)
Start/Stop PNO scan.
|
void |
setPowerSave(boolean enabled) |
void |
setScanInterval(int scanInterval) |
boolean |
setScanningMacOui(byte[] oui) |
boolean |
setSerialNumber(String value) |
static boolean |
setSsid(byte[] rawSsid,
ScanResult result) |
void |
setSupplicantLogLevel(String level) |
boolean |
setSuspendOptimizations(boolean enabled) |
boolean |
setWfdDeviceInfo(String hex) |
boolean |
setWfdEnable(boolean enable) |
void |
setWifiLinkLayerStats(String iface,
int enable) |
String |
signalPoll()
Example output:
RSSI=-65
LINKSPEED=48
NOISE=9999
FREQUENCY=0
|
boolean |
simAuthFailedResponse(int id) |
boolean |
simAuthResponse(int id,
String type,
String response) |
boolean |
simIdentityResponse(int id,
String response) |
static String |
ssidConvert(byte[] rawSsid) |
boolean |
startDriver() |
boolean |
startFilteringMulticastV4Packets()
Start filtering out Multicast V4 packets
|
boolean |
startFilteringMulticastV6Packets()
Start filtering out Multicast V6 packets
|
boolean |
startHal() |
boolean |
startLoggingRingBuffer(int verboseLevel,
int flags,
int maxInterval,
int minDataSize,
String ringName) |
boolean |
startPktFateMonitoring()
Ask the HAL to enable packet fate monitoring.
|
int |
startRssiMonitoring(byte maxRssi,
byte minRssi,
WifiNative.WifiRssiEventHandler rssiEventHandler) |
boolean |
startScan(WifiNative.ScanSettings settings,
WifiNative.ScanEventHandler eventHandler) |
int |
startSendingOffloadedPacket(int slot,
KeepalivePacketData keepAlivePacket,
int period) |
boolean |
startSupplicant(boolean p2pSupported) |
void |
startTdls(String macAddr,
boolean enable) |
boolean |
startWpsPbc(String bssid) |
boolean |
startWpsPbc(String iface,
String bssid) |
String |
startWpsPinDisplay(String bssid) |
String |
startWpsPinDisplay(String iface,
String bssid) |
boolean |
startWpsPinKeypad(String pin) |
boolean |
startWpsPinKeypad(String iface,
String pin) |
boolean |
startWpsRegistrar(String bssid,
String pin) |
String |
status() |
String |
status(boolean noEvents) |
boolean |
stopDriver() |
boolean |
stopFilteringMulticastV4Packets()
Stop filtering out Multicast V4 packets.
|
boolean |
stopFilteringMulticastV6Packets()
Stop filtering out Multicast V6 packets.
|
void |
stopHal() |
int |
stopRssiMonitoring() |
void |
stopScan() |
int |
stopSendingOffloadedPacket(int slot) |
boolean |
stopSupplicant() |
boolean |
trackSignificantWifiChange(WifiScanner.WifiChangeSettings settings,
WifiNative.SignificantWifiChangeEventHandler handler) |
boolean |
umtsAuthFailedResponse(int id) |
boolean |
unloadDriver() |
void |
untrackSignificantWifiChange() |
String |
waitForEvent() |
public static final int WIFI_SUCCESS
public static final Object sLock
public static final int BLUETOOTH_COEXISTENCE_MODE_ENABLED
public static final int BLUETOOTH_COEXISTENCE_MODE_DISABLED
public static final int BLUETOOTH_COEXISTENCE_MODE_SENSE
public static int sWlan0Index
public static final int WIFI_SCAN_RESULTS_AVAILABLE
public static final int WIFI_SCAN_THRESHOLD_NUM_SCANS
public static final int WIFI_SCAN_THRESHOLD_PERCENT
public static final int WIFI_SCAN_FAILED
public LocalLog getLocalLog()
public static WifiNative getWlanNativeInterface()
public static WifiNative getP2pNativeInterface()
public void initContext(Context context)
public String getInterfaceName()
public boolean loadDriver()
public boolean isDriverLoaded()
public boolean unloadDriver()
public boolean startSupplicant(boolean p2pSupported)
public boolean killSupplicant(boolean p2pSupported)
public boolean connectToSupplicant()
public void closeSupplicantConnection()
public String waitForEvent()
public boolean ping()
public void setSupplicantLogLevel(String level)
public String getFreqCapability()
public boolean scan(Set<Integer> freqs, Set<Integer> hiddenNetworkIds)
freqs
- list of frequencies to scan for, if null scan all supported channels.hiddenNetworkIds
- List of hidden networks to be scanned for.public boolean stopSupplicant()
public String listNetworks()
public String listNetworks(int last_id)
public int addNetwork()
public boolean removeNetwork(int netId)
public boolean enableNetwork(int netId)
netId
- - Network ID of the network to be enabled.public boolean enableNetworkWithoutConnect(int netId)
netId
- - Network ID of the network to be enabled.public boolean disableNetwork(int netId)
netId
- - Network ID of the network to be disabled.public boolean selectNetwork(int netId)
netId
- - Network ID of the network to be selected.public boolean reconnect()
public boolean reassociate()
public boolean disconnect()
public String status()
public String status(boolean noEvents)
public String getMacAddress()
public ArrayList<ScanDetail> getScanResults()
public String scanResult(String bssid)
public boolean startDriver()
public boolean stopDriver()
public boolean startFilteringMulticastV4Packets()
true
if the operation succeeded, false
otherwise
Multicast filtering rules work as follows:
The driver can filter multicast (v4 and/or v6) and broadcast packets when in
a power optimized mode (typically when screen goes off).
In order to prevent the driver from filtering the multicast/broadcast packets, we have to
add a DRIVER RXFILTER-ADD rule followed by DRIVER RXFILTER-START to make the rule effective
DRIVER RXFILTER-ADD Num
where Num = 0 - Unicast, 1 - Broadcast, 2 - Mutil4 or 3 - Multi6
and DRIVER RXFILTER-START
In order to stop the usage of these rules, we do
DRIVER RXFILTER-STOP
DRIVER RXFILTER-REMOVE Num
where Num is as described for RXFILTER-ADD
The SETSUSPENDOPT driver command overrides the filtering rulespublic boolean stopFilteringMulticastV4Packets()
true
if the operation succeeded, false
otherwisepublic boolean startFilteringMulticastV6Packets()
true
if the operation succeeded, false
otherwisepublic boolean stopFilteringMulticastV6Packets()
true
if the operation succeeded, false
otherwisepublic boolean setBand(int band)
band
- One of
WifiManager.WIFI_FREQUENCY_BAND_AUTO
,
WifiManager.WIFI_FREQUENCY_BAND_5GHZ
,
WifiManager.WIFI_FREQUENCY_BAND_2GHZ
,true
if the operation succeeded, false
otherwisepublic boolean setBluetoothCoexistenceMode(int mode)
mode
- One of BLUETOOTH_COEXISTENCE_MODE_DISABLED
,
BLUETOOTH_COEXISTENCE_MODE_ENABLED
, or
BLUETOOTH_COEXISTENCE_MODE_SENSE
.public boolean setBluetoothCoexistenceScanMode(boolean setCoexScanMode)
isSet
- whether to enable or disable this modetrue
if the command succeeded, false
otherwise.public void enableSaveConfig()
public boolean saveConfig()
public boolean addToBlacklist(String bssid)
public boolean clearBlacklist()
public boolean setSuspendOptimizations(boolean enabled)
public boolean setCountryCode(String countryCode)
public boolean setPnoScan(boolean enable)
enable
- boolean indicating whether PNO is being enabled or disabled.public void enableAutoConnect(boolean enable)
public void setScanInterval(int scanInterval)
public void setHs20(boolean hs20)
public void startTdls(String macAddr, boolean enable)
public String signalPoll()
public String pktcntPoll()
public void bssFlush()
public boolean startWpsPbc(String bssid)
public boolean startWpsPinKeypad(String pin)
public boolean setExternalSim(boolean external)
public boolean simAuthFailedResponse(int id)
public boolean umtsAuthFailedResponse(int id)
public boolean simIdentityResponse(int id, String response)
public boolean cancelWps()
public boolean setPersistentReconnect(boolean enabled)
public boolean setDeviceName(String name)
public boolean setDeviceType(String type)
public boolean setConfigMethods(String cfg)
public boolean setManufacturer(String value)
public boolean setModelName(String value)
public boolean setModelNumber(String value)
public boolean setSerialNumber(String value)
public boolean setP2pSsidPostfix(String postfix)
public boolean setP2pGroupIdle(String iface, int time)
public void setPowerSave(boolean enabled)
public boolean setP2pPowerSave(String iface, boolean enabled)
public boolean setWfdEnable(boolean enable)
public boolean setWfdDeviceInfo(String hex)
public boolean setConcurrencyPriority(String s)
public boolean p2pFind()
public boolean p2pFind(int timeout)
public boolean p2pStopFind()
public boolean p2pListen()
public boolean p2pListen(int timeout)
public boolean p2pExtListen(boolean enable, int period, int interval)
public boolean p2pSetChannel(int lc, int oc)
public boolean p2pFlush()
public String p2pConnect(WifiP2pConfig config, boolean joinExistingGroup)
public boolean p2pCancelConnect()
public boolean p2pProvisionDiscovery(WifiP2pConfig config)
public boolean p2pGroupAdd(boolean persistent)
public boolean p2pGroupAdd(int netId)
public boolean p2pGroupRemove(String iface)
public boolean p2pReject(String deviceAddress)
public boolean p2pInvite(WifiP2pGroup group, String deviceAddress)
public boolean p2pReinvoke(int netId, String deviceAddress)
public String p2pGetDeviceAddress()
public int getGroupCapability(String deviceAddress)
public boolean p2pServiceAdd(WifiP2pServiceInfo servInfo)
public boolean p2pServiceDel(WifiP2pServiceInfo servInfo)
public boolean p2pServiceFlush()
public boolean p2pServDiscCancelReq(String id)
public void setMiracastMode(int mode)
public String getNfcWpsConfigurationToken(int netId)
public String getNfcHandoverRequest()
public String getNfcHandoverSelect()
public boolean initiatorReportNfcHandover(String selectMessage)
public boolean responderReportNfcHandover(String requestMessage)
public String readKernelLog()
public boolean startHal()
public void stopHal()
public boolean isHalStarted()
public int queryInterfaceIndex(String interfaceName)
public String getInterfaceName(int index)
public boolean getScanCapabilities(WifiNative.ScanCapabilities capabilities)
public static WifiSsid createWifiSsid(byte[] rawSsid)
public static String ssidConvert(byte[] rawSsid)
public static boolean setSsid(byte[] rawSsid, ScanResult result)
public boolean startScan(WifiNative.ScanSettings settings, WifiNative.ScanEventHandler eventHandler)
public void stopScan()
public void pauseScan()
public void restartScan()
public WifiScanner.ScanData[] getScanResults(boolean flush)
public boolean setHotlist(WifiScanner.HotlistSettings settings, WifiNative.HotlistEventHandler eventHandler)
public void resetHotlist()
public boolean trackSignificantWifiChange(WifiScanner.WifiChangeSettings settings, WifiNative.SignificantWifiChangeEventHandler handler)
public void untrackSignificantWifiChange()
public WifiLinkLayerStats getWifiLinkLayerStats(String iface)
public void setWifiLinkLayerStats(String iface, int enable)
public static int getSupportedFeatureSetNative(int iface)
public int getSupportedFeatureSet()
public boolean requestRtt(RttManager.RttParams[] params, WifiNative.RttEventHandler handler)
public boolean cancelRtt(RttManager.RttParams[] params)
public RttManager.ResponderConfig enableRttResponder(int timeoutSeconds)
RttManager.ResponderConfig
if the responder
role is successfully enabled, null
otherwise.public boolean disableRttResponder()
true
if responder role is successfully disabled,
false
otherwise.public boolean setScanningMacOui(byte[] oui)
public int[] getChannelsForBand(int band)
public boolean isGetChannelsForBandSupported()
public boolean setDfsFlag(boolean dfsOn)
public boolean setInterfaceUp(boolean up)
public RttManager.RttCapabilities getRttCapabilities()
public ApfCapabilities getApfCapabilities()
public boolean installPacketFilter(byte[] filter)
public boolean setCountryCodeHal(String CountryCode)
public boolean enableDisableTdls(boolean enable, String macAdd, WifiNative.TdlsEventHandler tdlsCallBack)
public WifiNative.TdlsStatus getTdlsStatus(String macAdd)
public WifiNative.TdlsCapabilities getTdlsCapabilities()
public boolean setLoggingEventHandler(WifiNative.WifiLoggerEventHandler handler)
public boolean startLoggingRingBuffer(int verboseLevel, int flags, int maxInterval, int minDataSize, String ringName)
public int getSupportedLoggerFeatureSet()
public boolean resetLogHandler()
public String getDriverVersion()
public String getFirmwareVersion()
public WifiNative.RingBufferStatus[] getRingBufferStatus()
public boolean getRingBufferData(String ringName)
public byte[] getFwMemoryDump()
public byte[] getDriverStateDump()
public boolean startPktFateMonitoring()
public boolean getTxPktFates(WifiNative.TxFateReport[] reportBufs)
public boolean getRxPktFates(WifiNative.RxFateReport[] reportBufs)
public boolean setPnoList(WifiNative.PnoSettings settings, WifiNative.PnoEventHandler eventHandler)
settings
- PNO settings and network list.eventHandler
- Handler to receive notifications back during PNO scan.public boolean setPnoList(WifiNative.PnoNetwork[] list, WifiNative.PnoEventHandler eventHandler)
list
- PNO network list.eventHandler
- Handler to receive notifications back during PNO scan.public boolean resetPnoList()
public boolean setBssidBlacklist(String[] list)
public int startSendingOffloadedPacket(int slot, KeepalivePacketData keepAlivePacket, int period)
public int stopSendingOffloadedPacket(int slot)
public int startRssiMonitoring(byte maxRssi, byte minRssi, WifiNative.WifiRssiEventHandler rssiEventHandler)
public int stopRssiMonitoring()
public WifiWakeReasonAndCounts getWlanWakeReasonCount()
public boolean configureNeighborDiscoveryOffload(boolean enabled)