mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge changes from topic 'am-076e19197ae1450594f07abb18015a3a'
* changes: wifi: Remove passthrough mode am:23f9f30344am:23baa7c2a8am:1f61ab5b10am:64d33efebbwifi: Stub implementation of WifiNanIface methods am:0c92d446a2am:9fe32608f5am:da29240c74am:7d46028607wifi: Stub implementation of WifiRttController methods am:7913f5e49dam:ee5137a3d1am:2081143b68am:969c1258f5wifi: Stub implementation of WifiStaIface methods am:a04ba3fcb8am:e65ad43046am:542e9b0b90am:5e4acfea27wifi: Stub implementation of WifiChip methods am:7d08d7a16dam:3e8793aadfam:eb00f23344am:374a7051c1wifi: Use hidl_return_util functions in Iface/Rtt am:907d4a234dam:dd5c2b8990am:e3e14bee9cam:c3ecc0d471wifi: Use hidl_return_util functions in WifiChip am:3c86852a2eam:7022158220am:01f66f52f2am:81b9b0661awifi: Helper functions for invoking hidl cont callbacks am:5647665827am:1ab8395a21am:8a9ab30d5cam:5d599a8db9wifi: Make methods deliver status synchronously (3/3) am:734fea0d98am:815e61624fam:8e951f23c6am:0f3073b993wifi: Make methods deliver status synchronously (2/3) am:5c05546fc9am:dbfb6017fbam:611487ebb7am:4473d43587wifi: Make methods deliver status synchronously (1/3) am:503582ed94am:40dac08a47am:f3b2c4ab07am:cbd64bc7cbwifi: Rename failure_reason_util to wifi_status_util am:1922482a5cam:5aaf00608aam:e9d9899587am:af2f0844f1wifi(interface): Add status for all methods am:02caa1b821am:bedd03bc48am:6a908348b3am:487d5662bbwifi(interface): Add wifi host debug wake up reason stats am:e0724f98b0am:3dd396eb5eam:75ea50e963am:1f5a986e30wifi(interface): Add wifi debug packet fate related interface am:fe9ad36cb2am:17fe2cc0e4am:ed5be10c54am:d2ac24a25fwifi(interface): Add wifi debug ring buffer related interface am:e3a02b07b6am:ae8029852eam:4f4a3729afam:1d176f5a9ewifi(interface): Move all StaIface types to types.hal am:5e25466ebfam:c4b36d8100am:80cb8bd1a9am:d2e53fed46wifi(interface): Fix compilation failure am:e03f736ca0am:55aee95115am:219f010a3dam:041db52a91wifi(interface): Rtt controller HIDL interface am:18eec81adcam:4c0a4e5ae4am:b5db64a5c7am:e88ab12895wifi(interface): NAN HIDL interface am:120f94c594am:ea3058f9c1am:9fa7e1ccdbam:90bb209b2fwifi(interface): Link layer stats collection am:18680b7affam:d195f76d21am:f958bb37e7am:10aa798b84wifi(interface): Make methods synchronous am:a52dc7322dam:0f0a37f375am:9658a13c46am:f90a6e422awifi(interface): Add status for every method am:1f9073cfcbam:556482ab99am:c6d8510413am:7faee98fc3wifi(interface): Add gscan/apf related API's am:7b77747bb5am:1f212a6566am:b5e5302fe9am:3e37a67100
This commit is contained in:
committed by
Android (Google) Code Review
commit
c7e7cdebff
@@ -13,9 +13,12 @@ genrule {
|
||||
"IWifiEventCallback.hal",
|
||||
"IWifiIface.hal",
|
||||
"IWifiNanIface.hal",
|
||||
"IWifiNanIfaceEventCallback.hal",
|
||||
"IWifiP2pIface.hal",
|
||||
"IWifiRttController.hal",
|
||||
"IWifiRttControllerEventCallback.hal",
|
||||
"IWifiStaIface.hal",
|
||||
"IWifiStaIfaceEventCallback.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/wifi/1.0/types.cpp",
|
||||
@@ -26,9 +29,12 @@ genrule {
|
||||
"android/hardware/wifi/1.0/WifiEventCallbackAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiIfaceAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiNanIfaceAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiNanIfaceEventCallbackAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiRttControllerAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiRttControllerEventCallbackAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiStaIfaceAll.cpp",
|
||||
"android/hardware/wifi/1.0/WifiStaIfaceEventCallbackAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -45,9 +51,12 @@ genrule {
|
||||
"IWifiEventCallback.hal",
|
||||
"IWifiIface.hal",
|
||||
"IWifiNanIface.hal",
|
||||
"IWifiNanIfaceEventCallback.hal",
|
||||
"IWifiP2pIface.hal",
|
||||
"IWifiRttController.hal",
|
||||
"IWifiRttControllerEventCallback.hal",
|
||||
"IWifiStaIface.hal",
|
||||
"IWifiStaIfaceEventCallback.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/wifi/1.0/types.h",
|
||||
@@ -86,6 +95,11 @@ genrule {
|
||||
"android/hardware/wifi/1.0/BnWifiNanIface.h",
|
||||
"android/hardware/wifi/1.0/BpWifiNanIface.h",
|
||||
"android/hardware/wifi/1.0/BsWifiNanIface.h",
|
||||
"android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/IHwWifiNanIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BnWifiNanIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BpWifiNanIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BsWifiNanIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/IWifiP2pIface.h",
|
||||
"android/hardware/wifi/1.0/IHwWifiP2pIface.h",
|
||||
"android/hardware/wifi/1.0/BnWifiP2pIface.h",
|
||||
@@ -96,11 +110,21 @@ genrule {
|
||||
"android/hardware/wifi/1.0/BnWifiRttController.h",
|
||||
"android/hardware/wifi/1.0/BpWifiRttController.h",
|
||||
"android/hardware/wifi/1.0/BsWifiRttController.h",
|
||||
"android/hardware/wifi/1.0/IWifiRttControllerEventCallback.h",
|
||||
"android/hardware/wifi/1.0/IHwWifiRttControllerEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BnWifiRttControllerEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BpWifiRttControllerEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BsWifiRttControllerEventCallback.h",
|
||||
"android/hardware/wifi/1.0/IWifiStaIface.h",
|
||||
"android/hardware/wifi/1.0/IHwWifiStaIface.h",
|
||||
"android/hardware/wifi/1.0/BnWifiStaIface.h",
|
||||
"android/hardware/wifi/1.0/BpWifiStaIface.h",
|
||||
"android/hardware/wifi/1.0/BsWifiStaIface.h",
|
||||
"android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/IHwWifiStaIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BnWifiStaIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BpWifiStaIfaceEventCallback.h",
|
||||
"android/hardware/wifi/1.0/BsWifiStaIfaceEventCallback.h",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
4184
wifi/1.0/Android.mk
4184
wifi/1.0/Android.mk
File diff suppressed because it is too large
Load Diff
@@ -34,10 +34,15 @@ interface IWifi {
|
||||
*
|
||||
* @param callback An instance of the |IWifiEventCallback| HIDL interface
|
||||
* object.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
*/
|
||||
@entry
|
||||
@callflow(next={"*"})
|
||||
oneway registerEventCallback(IWifiEventCallback callback);
|
||||
registerEventCallback(IWifiEventCallback callback)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get the current state of the HAL.
|
||||
@@ -48,44 +53,66 @@ interface IWifi {
|
||||
|
||||
/**
|
||||
* Perform any setup that is required to make use of the module. If the module
|
||||
* is already started then this must be a noop. The onStart callback must be
|
||||
* called when the setup completes or if the HAL is already started. If the
|
||||
* setup fails then onStartFailure must be called.
|
||||
* is already started then this must be a noop.
|
||||
* Must trigger |IWifiEventCallback.onStart| on success.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
*/
|
||||
@entry
|
||||
@callflow(next={"registerEventCallback", "start", "stop", "getChip"})
|
||||
oneway start();
|
||||
start() generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Tear down any state, ongoing commands, etc. If the module is already
|
||||
* stopped then this must be a noop. If the HAL is already stopped or it
|
||||
* succeeds then onStop must be called. If the teardown fails onFailure must
|
||||
* be called. After calling this all IWifiChip objects will be considered
|
||||
* invalid.
|
||||
* succeeds then onStop must be called. After calling this all IWifiChip
|
||||
* objects will be considered invalid.
|
||||
* Must trigger |IWifiEventCallback.onStop| on success.
|
||||
* Must trigger |IWifiEventCallback.onFailure| on failure.
|
||||
*
|
||||
* Calling stop then start is a valid way of resetting state in the HAL,
|
||||
* driver, firmware.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.NOT_STARTED|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
*/
|
||||
@exit
|
||||
@callflow(next={"registerEventCallback", "start", "stop"})
|
||||
oneway stop();
|
||||
stop() generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Retrieve the list of all chip Id's on the device.
|
||||
* The corresponding |IWifiChip| object for any chip can be
|
||||
* retrieved using |getChip| method.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.NOT_STARTED|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
* @return chipIds List of all chip Id's on the device.
|
||||
*/
|
||||
@callflow(next={"*"})
|
||||
getChipIds() generates (vec<ChipId> chipIds);
|
||||
getChipIds() generates (WifiStatus status, vec<ChipId> chipIds);
|
||||
|
||||
/**
|
||||
* Gets a HIDL interface object for the chip corresponding to the
|
||||
* provided chipId.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.NOT_STARTED|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
* @return chip HIDL interface object representing the chip.
|
||||
*/
|
||||
@callflow(next={"*"})
|
||||
getChip(ChipId chipId) generates (IWifiChip chip);
|
||||
getChip(ChipId chipId) generates (WifiStatus status, IWifiChip chip);
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ interface IWifiChip {
|
||||
* ChipIfaceCombination for examples.
|
||||
*/
|
||||
struct ChipIfaceCombinationLimit {
|
||||
vec<IfaceType> types; // Each IfaceType may occur at most once
|
||||
vec<IfaceType> types; // Each IfaceType must occur at most once.
|
||||
uint32_t maxIfaces;
|
||||
};
|
||||
|
||||
@@ -85,11 +85,11 @@ interface IWifiChip {
|
||||
* [{STA} <=1, {AP} <= 1].
|
||||
*
|
||||
* When switching between two available combinations it is expected that
|
||||
* interfaces only supported by the initial combination will be removed until
|
||||
* interfaces only supported by the initial combination must be removed until
|
||||
* the target combination is also satisfied. At that point new interfaces
|
||||
* satisfying only the target combination can be added (meaning the initial
|
||||
* combination limits will no longer satisfied). The addition of these new
|
||||
* interfaces should not impact the existence of interfaces that satisfy both
|
||||
* interfaces must not impact the existence of interfaces that satisfy both
|
||||
* combinations.
|
||||
*
|
||||
* For example, a chip with available combinations:
|
||||
@@ -98,12 +98,12 @@ interface IWifiChip {
|
||||
* AP interface in place of one of the STAs then first one of the STA
|
||||
* interfaces must be removed and then the AP interface can be created after
|
||||
* the STA had been torn down. During this process the remaining STA and NAN
|
||||
* interfaces should not be removed/recreated.
|
||||
* interfaces must not be removed/recreated.
|
||||
*
|
||||
* If a chip does not support this kind of reconfiguration in this mode then
|
||||
* the combinations should be separated into two separate modes. Before
|
||||
* switching modes all interfaces will be torn down, the mode switch will be
|
||||
* enacted and when it completes the new interfaces will be brought up.
|
||||
* the combinations must be separated into two separate modes. Before
|
||||
* switching modes all interfaces must be torn down, the mode switch must be
|
||||
* enacted and when it completes the new interfaces must be brought up.
|
||||
*/
|
||||
struct ChipMode {
|
||||
/**
|
||||
@@ -118,192 +118,351 @@ interface IWifiChip {
|
||||
vec<ChipIfaceCombination> availableCombinations;
|
||||
};
|
||||
|
||||
/**
|
||||
* Information about the version of the driver and firmware running this chip.
|
||||
*
|
||||
* The information in these ASCII strings are vendor specific and does not
|
||||
* need to follow any particular format. It may be dumped as part of the bug
|
||||
* report.
|
||||
*/
|
||||
struct ChipDebugInfo {
|
||||
string driverDescription;
|
||||
string firmwareDescription;
|
||||
};
|
||||
|
||||
/**
|
||||
* Capabilities exposed by this chip.
|
||||
*/
|
||||
enum ChipCapabilityMask : uint32_t {
|
||||
/**
|
||||
* Memory dump of Firmware.
|
||||
*/
|
||||
DEBUG_MEMORY_FIRMWARE_DUMP_SUPPORTED = 1 << 0,
|
||||
/**
|
||||
* Memory dump of Driver.
|
||||
*/
|
||||
DEBUG_MEMORY_DRIVER_DUMP_SUPPORTED = 1 << 1,
|
||||
/**
|
||||
* Connectivity events reported via debug ring buffer.
|
||||
*/
|
||||
DEBUG_RING_BUFFER_CONNECT_EVENT_SUPPORTED = 1 << 2,
|
||||
/**
|
||||
* Power events reported via debug ring buffer.
|
||||
*/
|
||||
DEBUG_RING_BUFFER_POWER_EVENT_SUPPORTED = 1 << 3,
|
||||
/**
|
||||
* Wakelock events reported via debug ring buffer.
|
||||
*/
|
||||
DEBUG_RING_BUFFER_WAKELOCK_EVENT_SUPPORTED = 1 << 4,
|
||||
/**
|
||||
* Vendor data reported via debug ring buffer.
|
||||
* This mostly contains firmware event logs.
|
||||
*/
|
||||
DEBUG_RING_BUFFER_VENDOR_DATA_SUPPORTED = 1 << 5,
|
||||
/**
|
||||
* Host wake reasons stats collection.
|
||||
*/
|
||||
DEBUG_HOST_WAKE_REASON_STATS = 1 << 6,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the id assigned to this chip.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return id Assigned chip Id.
|
||||
*/
|
||||
getId() generates (ChipId id);
|
||||
getId() generates (WifiStatus status, ChipId id);
|
||||
|
||||
/**
|
||||
* Requests notifications of significant events on this chip. Multiple calls
|
||||
* to this will register multiple callbacks each of which will receive all
|
||||
* to this must register multiple callbacks each of which must receive all
|
||||
* events.
|
||||
*
|
||||
* @param callback An instance of the |IWifiChipEventCallback| HIDL interface
|
||||
* object.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
*/
|
||||
oneway registerEventCallback(IWifiChipEventCallback callback);
|
||||
registerEventCallback(IWifiChipEventCallback callback) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get the capabilities supported by this chip.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Bitset of |ChipCapabilityMask| values.
|
||||
*/
|
||||
getCapabilities() generates (WifiStatus status, uint32_t capabilities);
|
||||
|
||||
/**
|
||||
* Get the set of operation modes that the chip supports.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return modes List of modes supported by the device.
|
||||
*/
|
||||
getAvailableModes() generates (vec<ChipMode> modes);
|
||||
getAvailableModes() generates (WifiStatus status, vec<ChipMode> modes);
|
||||
|
||||
/**
|
||||
* Reconfigure the Chip.
|
||||
* Must trigger |IWifiChipEventCallback.onChipReconfigured| on sucess,
|
||||
* or |IWifiChipEventCallback.onChipReconfigureFailure| on failure.
|
||||
* Any existing |IWifiIface| objects must be marked invalid after this call.
|
||||
* If this fails then the chips is now in an undefined state and
|
||||
* configureChip must be called again.
|
||||
* Must trigger |IWifiChipEventCallback.onChipReconfigured| on success.
|
||||
* Must trigger |IWifiEventCallback.onFailure| on failure.
|
||||
*
|
||||
* @param modeId The mode that the chip should switch to, corresponding to the
|
||||
* @param modeId The mode that the chip must switch to, corresponding to the
|
||||
* id property of the target ChipMode.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
oneway configureChip(ChipModeId modeId);
|
||||
configureChip(ChipModeId modeId) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get the current mode that the chip is in.
|
||||
*
|
||||
* @return modeId The mode that the chip is currently configured to,
|
||||
* corresponding to the id property of the target ChipMode.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
*/
|
||||
getMode() generates (ChipModeId modeId);
|
||||
getMode() generates (WifiStatus status, ChipModeId modeId);
|
||||
|
||||
/**
|
||||
* Request information about the chip.
|
||||
* Must trigger |IWifiChipEventCallback.onChipDebugInfoAvailable| on sucess,
|
||||
* or |IWifiChipEventCallback.onChipDebugInfoFailure| on failure.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return chipDebugInfo Instance of |ChipDebugInfo|.
|
||||
*/
|
||||
oneway requestChipDebugInfo();
|
||||
requestChipDebugInfo() generates (WifiStatus status, ChipDebugInfo chipDebugInfo);
|
||||
|
||||
/**
|
||||
* Request vendor debug info from the driver.
|
||||
* Must trigger |IWifiChipEventCallback.onDriverDebugDumpAvailable| on success,
|
||||
* or |IWifiChipEventCallback.onDriverDebugDumpFailure| on failure.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @param blob Vector of bytes retrieved from the driver.
|
||||
*/
|
||||
oneway requestDriverDebugDump();
|
||||
requestDriverDebugDump() generates (WifiStatus status, vec<uint8_t> blob);
|
||||
|
||||
/**
|
||||
* Request vendor debug info from the firmware.
|
||||
* Must trigger |IWifiChipEventCallback.onFirmwareDebugDumpAvailable| on
|
||||
* success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @param blob Vector of bytes retrieved from the driver.
|
||||
*/
|
||||
oneway requestFirmwareDebugDump();
|
||||
requestFirmwareDebugDump() generates (WifiStatus status, vec<uint8_t> blob);
|
||||
|
||||
/**
|
||||
* Create an AP iface on the chip.
|
||||
*
|
||||
* Depending on the mode the chip is configured in, the interface creation
|
||||
* may fail if we've already reached the maximum allowed
|
||||
* (specified in |ChipIfaceCombination|) number of ifaces of the AP type.
|
||||
* may fail (code: |ERROR_NOT_SUPPORTED|) if we've already reached the maximum
|
||||
* allowed (specified in |ChipIfaceCombination|) number of ifaces of the AP
|
||||
* type.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* successful, null otherwise.
|
||||
*/
|
||||
createApIface() generates (IWifiApIface iface);
|
||||
createApIface() generates (WifiStatus status, IWifiApIface iface);
|
||||
|
||||
/**
|
||||
* List all the AP iface names configured on the chip.
|
||||
* The corresponding |IWifiApIface| object for any iface are
|
||||
* retrieved using |getApIface| method.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return ifnames List of all AP iface names on the chip.
|
||||
*/
|
||||
getApIfaceNames() generates (vec<string> ifnames);
|
||||
getApIfaceNames() generates (WifiStatus status, vec<string> ifnames);
|
||||
|
||||
/**
|
||||
* Gets a HIDL interface object for the AP Iface corresponding
|
||||
* to the provided ifname.
|
||||
*
|
||||
* @param ifname Name of the iface.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* it exists, null otherwise.
|
||||
*/
|
||||
getApIface(string ifname) generates (IWifiApIface iface);
|
||||
getApIface(string ifname) generates (WifiStatus status, IWifiApIface iface);
|
||||
|
||||
/**
|
||||
* Create a NAN iface on the chip.
|
||||
*
|
||||
* Depending on the mode the chip is configured in, the interface creation
|
||||
* may fail if we've already reached the maximum allowed
|
||||
* (specified in |ChipIfaceCombination|) number of ifaces of the NAN type.
|
||||
* may fail (code: |ERROR_NOT_SUPPORTED|) if we've already reached the maximum
|
||||
* allowed (specified in |ChipIfaceCombination|) number of ifaces of the NAN
|
||||
* type.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* successful, null otherwise.
|
||||
*/
|
||||
createNanIface() generates (IWifiNanIface iface);
|
||||
createNanIface() generates (WifiStatus status, IWifiNanIface iface);
|
||||
|
||||
/**
|
||||
* List all the NAN iface names configured on the chip.
|
||||
* The corresponding |IWifiNanIface| object for any iface are
|
||||
* retrieved using |getNanIface| method.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return ifnames List of all NAN iface names on the chip.
|
||||
*/
|
||||
getNanIfaceNames() generates (vec<string> ifnames);
|
||||
getNanIfaceNames() generates (WifiStatus status, vec<string> ifnames);
|
||||
|
||||
/**
|
||||
* Gets a HIDL interface object for the NAN Iface corresponding
|
||||
* to the provided ifname.
|
||||
*
|
||||
* @param ifname Name of the iface.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* it exists, null otherwise.
|
||||
*/
|
||||
getNanIface(string ifname) generates (IWifiNanIface iface);
|
||||
getNanIface(string ifname) generates (WifiStatus status, IWifiNanIface iface);
|
||||
|
||||
/**
|
||||
* Create a P2P iface on the chip.
|
||||
*
|
||||
* Depending on the mode the chip is configured in, the interface creation
|
||||
* may fail if we've already reached the maximum allowed
|
||||
* (specified in |ChipIfaceCombination|) number of ifaces of the P2P type.
|
||||
* may fail (code: |ERROR_NOT_SUPPORTED|) if we've already reached the maximum
|
||||
* allowed (specified in |ChipIfaceCombination|) number of ifaces of the P2P
|
||||
* type.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* successful, null otherwise.
|
||||
*/
|
||||
createP2pIface() generates (IWifiP2pIface iface);
|
||||
createP2pIface() generates (WifiStatus status, IWifiP2pIface iface);
|
||||
|
||||
/**
|
||||
* List all the P2P iface names configured on the chip.
|
||||
* The corresponding |IWifiP2pIface| object for any iface are
|
||||
* retrieved using |getP2pIface| method.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return ifnames List of all P2P iface names on the chip.
|
||||
*/
|
||||
getP2pIfaceNames() generates (vec<string> ifnames);
|
||||
getP2pIfaceNames() generates (WifiStatus status, vec<string> ifnames);
|
||||
|
||||
/**
|
||||
* Gets a HIDL interface object for the P2P Iface corresponding
|
||||
* to the provided ifname.
|
||||
*
|
||||
* @param ifname Name of the iface.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* it exists, null otherwise.
|
||||
*/
|
||||
getP2pIface(string ifname) generates (IWifiP2pIface iface);
|
||||
getP2pIface(string ifname) generates (WifiStatus status, IWifiP2pIface iface);
|
||||
|
||||
/**
|
||||
* Create an STA iface on the chip.
|
||||
*
|
||||
* Depending on the mode the chip is configured in, the interface creation
|
||||
* may fail if we've already reached the maximum allowed
|
||||
* (specified in |ChipIfaceCombination|) number of ifaces of the STA type.
|
||||
* may fail (code: |ERROR_NOT_SUPPORTED|) if we've already reached the maximum
|
||||
* allowed (specified in |ChipIfaceCombination|) number of ifaces of the STA
|
||||
* type.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* successful, null otherwise.
|
||||
*/
|
||||
createStaIface() generates (IWifiStaIface iface);
|
||||
createStaIface() generates (WifiStatus status, IWifiStaIface iface);
|
||||
|
||||
/**
|
||||
* List all the STA iface names configured on the chip.
|
||||
* The corresponding |IWifiStaIface| object for any iface are
|
||||
* retrieved using |getStaIface| method.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return ifnames List of all STA iface names on the chip.
|
||||
*/
|
||||
getStaIfaceNames() generates (vec<string> ifnames);
|
||||
getStaIfaceNames() generates (WifiStatus status, vec<string> ifnames);
|
||||
|
||||
/**
|
||||
* Gets a HIDL interface object for the STA Iface corresponding
|
||||
* to the provided ifname.
|
||||
*
|
||||
* @param ifname Name of the iface.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
* @return iface HIDL interface object representing the iface if
|
||||
* it exists, null otherwise.
|
||||
*/
|
||||
getStaIface(string ifname) generates (IWifiStaIface iface);
|
||||
getStaIface(string ifname) generates (WifiStatus status, IWifiStaIface iface);
|
||||
|
||||
/**
|
||||
* Create a RTTController instance.
|
||||
@@ -316,6 +475,109 @@ interface IWifiChip {
|
||||
*
|
||||
* @param boundIface HIDL interface object representing the iface if
|
||||
* the responder must be bound to a specific iface, null otherwise.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
|
||||
*/
|
||||
createRttController(IWifiIface boundIface) generates (IWifiRttController rtt);
|
||||
createRttController(IWifiIface boundIface)
|
||||
generates (WifiStatus status, IWifiRttController rtt);
|
||||
|
||||
/**
|
||||
* WiFi debug ring buffer life cycle is as follow:
|
||||
* - At initialization time, framework must call |getDebugRingBuffersStatus|.
|
||||
* to obtain the names and list of supported ring buffers.
|
||||
* The driver may expose several different rings each holding a different
|
||||
* type of data (connection events, power events, etc).
|
||||
* - When WiFi operations start framework must call
|
||||
* |startLoggingToDebugRingBuffer| to trigger log collection for a specific
|
||||
* ring. The vebose level for each ring buffer can be specified in this API.
|
||||
* - During wifi operations, driver must periodically report per ring data to
|
||||
* framework by invoking the
|
||||
* |IWifiChipEventCallback.onDebugRingBuffer<Type>EntriesAvailable| callback.
|
||||
* - When capturing a bug report, framework must indicate to driver that all
|
||||
* the data has to be uploaded urgently by calling
|
||||
* |forceDumpToDebugRingBuffer|.
|
||||
*
|
||||
* The data uploaded by driver must be stored by framework in separate files,
|
||||
* with one stream of file per ring. Framework must store the files in pcapng
|
||||
* format, allowing for easy merging and parsing with network analyzer tools.
|
||||
* TODO: Since we're not longer dumping out the raw data, storing in separate
|
||||
* pcapng files for parsing later must not work anymore.
|
||||
*/
|
||||
/**
|
||||
* API to get the status of all ring buffers supported by driver.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
* @return ringBuffers Vector of |WifiDebugRingBufferStatus| corresponding to the
|
||||
* status of each ring bufffer on the device.
|
||||
*/
|
||||
getDebugRingBuffersStatus() generates (WifiStatus status,
|
||||
vec<WifiDebugRingBufferStatus> ringBuffers);
|
||||
|
||||
/**
|
||||
* API to trigger the debug data collection.
|
||||
*
|
||||
* @param ringName represent the name of the ring for which data collection
|
||||
* shall start. This can be retrieved via the corresponding
|
||||
* |WifiDebugRingBufferStatus|.
|
||||
* @parm maxIntervalInSec Maximum interval in seconds for driver to invoke
|
||||
* |onDebugRingBufferData|, ignore if zero.
|
||||
* @parm minDataSizeInBytes: Minimum data size in buffer for driver to invoke
|
||||
* |onDebugRingBufferData|, ignore if zero.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
*/
|
||||
startLoggingToDebugRingBuffer(string ringName,
|
||||
WifiDebugRingBufferVerboseLevel verboseLevel,
|
||||
uint32_t maxIntervalInSec,
|
||||
uint32_t minDataSizeInBytes)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to force dump data into the corresponding ring buffer.
|
||||
* This is to be invoked during bugreport collection.
|
||||
*
|
||||
* @param ringName represent the name of the ring for which data collection
|
||||
* shall be forced. This can be retrieved via the corresponding
|
||||
* |WifiDebugRingBufferStatus|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
*/
|
||||
forceDumpToDebugRingBuffer(string ringName) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to retrieve the wifi wake up reason stats for debugging.
|
||||
* The driver is expected to start maintaining these stats once the chip
|
||||
* is configured using |configureChip|. These stats must be reset whenever
|
||||
* the chip is reconfigured or the HAL is stopped.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.UNKNOWN|
|
||||
* @return stats Instance of |WifiDebugHostWakeReasonStats|.
|
||||
*/
|
||||
getDebugHostWakeReasonStats()
|
||||
generates (WifiStatus status, WifiDebugHostWakeReasonStats stats);
|
||||
};
|
||||
|
||||
@@ -29,68 +29,45 @@ interface IWifiChipEventCallback {
|
||||
oneway onChipReconfigured(ChipModeId modeId);
|
||||
|
||||
/**
|
||||
* If this happens then the chips is now in an undefined state and
|
||||
* configureChip must be called again. Any interface indexes will be
|
||||
* assumed to be invalid.
|
||||
* Callbacks for reporting debug ring buffer data.
|
||||
*
|
||||
* @param modeId The mode that the chip failed switched to, corresponding to
|
||||
* the id property of the target ChipMode.
|
||||
* @param reason Failure reason code.
|
||||
* The ring buffer data collection is event based:
|
||||
* - Driver calls this callback when new records are available, the
|
||||
* |WifiDebugRingBufferStatus| passed up to framework in the callback
|
||||
* indicates to framework if more data is available in the ring buffer.
|
||||
* It is not expected that driver will necessarily always empty the ring
|
||||
* immediately as data is available, instead driver will report data
|
||||
* every X seconds or if N bytes are available based on the parameters
|
||||
* set via |startLoggingToDebugRingBuffer|.
|
||||
* - In the case where a bug report has to be captured, framework will
|
||||
* require driver to upload all data immediately. This is indicated to
|
||||
* driver when framework calls |forceDumpToDebugRingBuffer|. The driver
|
||||
* will start sending all available data in the indicated ring by repeatedly
|
||||
* invoking this callback.
|
||||
*
|
||||
* @return status Status of the corresponding ring buffer. This should
|
||||
* contain the name of the ring buffer on which the data is
|
||||
* available.
|
||||
* @return entries Vector of debug ring buffer data entries. These
|
||||
* should be parsed based on the type of entry.
|
||||
*/
|
||||
oneway onChipReconfigureFailure(ChipModeId modeId, FailureReason reason);
|
||||
/** Connectivity event data callback */
|
||||
oneway onDebugRingBufferConnectivityEventEntriesAvailable(
|
||||
WifiDebugRingBufferStatus status,
|
||||
vec<WifiDebugRingEntryConnectivityEvent> entries);
|
||||
|
||||
/**
|
||||
* Information about the version of the driver and firmware running this chip.
|
||||
*
|
||||
* This information is vendor specific and does not need to take any
|
||||
* particular format. It will be dumped as part of the bug report.
|
||||
*/
|
||||
struct ChipDebugInfo {
|
||||
string driverDescription;
|
||||
string firmwareDescription;
|
||||
};
|
||||
/** Power event data callback */
|
||||
oneway onDebugRingBufferPowerEventEntriesAvailable(
|
||||
WifiDebugRingBufferStatus status,
|
||||
vec<WifiDebugRingEntryPowerEvent> entries);
|
||||
|
||||
/**
|
||||
* Callback with debug information about this chip
|
||||
*
|
||||
* @param info Instance of |ChipDebugInfo|.
|
||||
*/
|
||||
oneway onChipDebugInfoAvailable(ChipDebugInfo info);
|
||||
/** Wakelock event data callback */
|
||||
oneway onDebugRingBufferWakelockEventEntriesAvailable(
|
||||
WifiDebugRingBufferStatus status,
|
||||
vec<WifiDebugRingEntryWakelockEvent> entries);
|
||||
|
||||
/**
|
||||
* Callback to be invoked on failure to fetch debug info about this chip.
|
||||
*
|
||||
* @param reason Failure reason code.
|
||||
*/
|
||||
oneway onChipDebugInfoFailure(FailureReason reason);
|
||||
|
||||
/**
|
||||
* Callback with a vendor specific debug blob from the driver.
|
||||
* This blob will be dumped as part of the bug report.
|
||||
*
|
||||
* @param blob Vector of bytes retrieved from the driver.
|
||||
*/
|
||||
oneway onDriverDebugDumpAvailable(vec<uint8_t> blob);
|
||||
|
||||
/**
|
||||
* Callback to be invoked on failure to fetch debug blob from driver.
|
||||
*
|
||||
* @param reason Failure reason code.
|
||||
*/
|
||||
oneway onDriverDebugDumpFailure(FailureReason reason);
|
||||
|
||||
/**
|
||||
* Callback with a vendor specific debug blob from the driver.
|
||||
* This blob will be dumped as part of the bug report.
|
||||
*
|
||||
* @param blob Vector of bytes retrieved from the driver.
|
||||
*/
|
||||
oneway onFirmwareDebugDumpAvailable(vec<uint8_t> blob);
|
||||
|
||||
/**
|
||||
* Callback to be invoked on failure to fetch debug blob from driver.
|
||||
*
|
||||
* @param reason Failure reason code.
|
||||
*/
|
||||
oneway onFirmwareDebugDumpFailure(FailureReason reason);
|
||||
/** Vendor data event data callback */
|
||||
oneway onDebugRingBufferVendorDataEntriesAvailable(
|
||||
WifiDebugRingBufferStatus status,
|
||||
vec<WifiDebugRingEntryVendorData> entries);
|
||||
};
|
||||
|
||||
@@ -23,16 +23,6 @@ interface IWifiEventCallback {
|
||||
*/
|
||||
oneway onStart();
|
||||
|
||||
/**
|
||||
* Called in response to a call to start indicating that the operation
|
||||
* failed. After this callback the HAL will be considered stopped. Another
|
||||
* call to start will attempt to reinitialize the HAL; however, there is a
|
||||
* chance it may fail again.
|
||||
*
|
||||
* @param reason Failure reason code.
|
||||
*/
|
||||
oneway onStartFailure(FailureReason reason);
|
||||
|
||||
/**
|
||||
* Called in response to a call to stop indicating that the operation
|
||||
* completed. When this event is received all IWifiChip objects retrieved
|
||||
@@ -43,10 +33,10 @@ interface IWifiEventCallback {
|
||||
/**
|
||||
* Called when the Wi-Fi system failed in a way that caused it be disabled.
|
||||
* Calling start again must restart Wi-Fi as if stop then start was called
|
||||
* (full state reset). When this event is received all IWifiChip objects
|
||||
* retrieved after the last call to start will be considered invalid.
|
||||
* (full state reset). When this event is received all IWifiChip & IWifiIface
|
||||
* objects retrieved after the last call to start will be considered invalid.
|
||||
*
|
||||
* @param reason Failure reason code.
|
||||
* @param status Failure reason code.
|
||||
*/
|
||||
oneway onFailure(FailureReason reason);
|
||||
oneway onFailure(WifiStatus status);
|
||||
};
|
||||
|
||||
@@ -23,14 +23,22 @@ interface IWifiIface {
|
||||
/**
|
||||
* Get the type of this iface.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
|
||||
* @return type One of the supported iface types.
|
||||
*/
|
||||
getType() generates (IfaceType type);
|
||||
getType() generates (WifiStatus status, IfaceType type);
|
||||
|
||||
/**
|
||||
* Get the name of this iface.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
|
||||
* @return name Name of the iface.
|
||||
*/
|
||||
getName() generates (string name);
|
||||
getName() generates (WifiStatus status, string name);
|
||||
};
|
||||
|
||||
@@ -17,10 +17,259 @@
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
import IWifiIface;
|
||||
import IWifiNanIfaceEventCallback;
|
||||
|
||||
/**
|
||||
* Interface used to represent a single NAN iface.
|
||||
* Interface used to represent a single NAN(Neighbour Aware Network) iface.
|
||||
*/
|
||||
interface IWifiNanIface extends IWifiIface {
|
||||
/** TODO(rpius): Add methods to the interface. */
|
||||
/**
|
||||
* Requests notifications of significant events on this iface. Multiple calls
|
||||
* to this must register multiple callbacks each of which must receive all
|
||||
* events.
|
||||
*
|
||||
* @param callback An instance of the |IWifiNanIfaceEventCallback| HIDL interface
|
||||
* object.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
|
||||
*/
|
||||
registerEventCallback(IWifiNanIfaceEventCallback callback)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Enable NAN functionality.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanEnableRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
enableRequest(CommandId cmdId, NanEnableRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Disable NAN functionality.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
disableRequest(CommandId cmdId) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Publish request to advertize a service.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanPublishRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
publishRequest(CommandId cmdId, NanPublishRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Cancel previous publish requests.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanPublishCancelRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
publishCancelRequest(CommandId cmdId, NanPublishCancelRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Subscribe request to search for a service.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanSubscribeRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
subscribeRequest(CommandId cmdId, NanSubscribeRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Cancel previous subscribe requests.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanSubscribeCancelRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
subscribeCancelRequest(CommandId cmdId, NanSubscribeCancelRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* NAN transmit follow up request.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanTransmitFollowupRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
transmitFollowupRequest(CommandId cmdId, NanTransmitFollowupRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* NAN configuration request.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanConfigRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
configRequest(CommandId cmdId, NanConfigRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Set NAN Beacon or sdf payload to discovery engine.
|
||||
* This instructs the Discovery Engine to begin publishing the
|
||||
* received payload in any Beacon or Service Discovery Frame transmitted
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanBeaconSdfPayloadRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
beaconSdfPayloadRequest(CommandId cmdId, NanBeaconSdfPayloadRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get NAN HAL version.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @return version Instance of |NanVersion|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
getVersion() generates (WifiStatus status, NanVersion version);
|
||||
|
||||
/**
|
||||
* Get NAN capabilities.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
getCapabilities(CommandId cmdId) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Create NAN Data Interface
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
dataInterfaceCreate(CommandId cmdId, string ifaceName)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Delete NAN Data Interface.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
dataInterfaceDelete(CommandId cmdId, string ifaceName)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Initiate a NDP session: Initiator
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanDataPathInitiatorRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
dataRequestInitiator(CommandId cmdId, NanDataPathInitiatorRequest msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Response to a data indication received corresponding to a NDP session. An indication
|
||||
* is received with a data request and the responder will send a data response.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanDataPathIndicationResponse|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
dataIndicationResponse(CommandId cmdId, NanDataPathIndicationResponse msg)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* NDL termination request: from either Initiator/Responder.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param msg Instance of |NanDataPathEndRequest|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
dataEnd(CommandId cmdId, NanDataPathEndRequest msg)
|
||||
generates (WifiStatus status);
|
||||
};
|
||||
|
||||
81
wifi/1.0/IWifiNanIfaceEventCallback.hal
Normal file
81
wifi/1.0/IWifiNanIfaceEventCallback.hal
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
/**
|
||||
* NAN Response and Event Callbacks.
|
||||
*/
|
||||
interface IWifiNanIfaceEventCallback {
|
||||
/**
|
||||
* Callback invoked to notify the status of the Publish Request.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param rspData Message Data.
|
||||
*/
|
||||
oneway notifyPublishResponse(CommandId id, NanPublishResponseMsg rspData);
|
||||
|
||||
/**
|
||||
* Callback invoked to notify the status of the Subscribe Request.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param rspData Message Data.
|
||||
*/
|
||||
oneway notifySubscribeResponse(CommandId id, NanSubscribeResponseMsg rspData);
|
||||
|
||||
/**
|
||||
* Callback invoked to notify the status of the Data Path Request.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param rspData Message Data.
|
||||
*/
|
||||
oneway notifyDataPathResponse(CommandId id, NanDataPathResponseMsg rspData);
|
||||
|
||||
/**
|
||||
* Callback invoked to notify the status of the Capability Request.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param rspData Message Data.
|
||||
*/
|
||||
oneway notifyCapabilitiesResponse(CommandId id, NanCapabilitiesResponseMsg rspData);
|
||||
|
||||
/**
|
||||
* Callbacks for the various asynchornous NAN Events.
|
||||
*/
|
||||
oneway eventPublishTerminated(NanPublishTerminatedInd event);
|
||||
|
||||
oneway eventMatch(NanMatchInd event);
|
||||
|
||||
oneway eventMatchExpired(NanMatchExpiredInd event);
|
||||
|
||||
oneway eventSubscribeTerminated(NanSubscribeTerminatedInd event);
|
||||
|
||||
oneway eventFollowup(NanFollowupInd event);
|
||||
|
||||
oneway eventDiscEngEvent(NanDiscEngEventInd event);
|
||||
|
||||
oneway eventDisabled(NanDisabledInd event);
|
||||
|
||||
oneway eventBeaconSdfPayload(NanBeaconSdfPayloadInd event);
|
||||
|
||||
oneway eventDataRequest(NanDataPathRequestInd event);
|
||||
|
||||
oneway eventDataConfirm(NanDataPathConfirmInd event);
|
||||
|
||||
oneway eventDataEnd(NanDataPathEndInd event);
|
||||
|
||||
oneway eventTransmitFollowup(NanTransmitFollowupInd event);
|
||||
};
|
||||
@@ -17,16 +17,225 @@
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
import IWifiIface;
|
||||
import IWifiRttControllerEventCallback;
|
||||
|
||||
/**
|
||||
* Interface used to perform RTT operations.
|
||||
* Interface used to perform RTT(Round trip time) operations.
|
||||
*/
|
||||
interface IWifiRttController {
|
||||
/**
|
||||
* Get the iface on which the RTT operations will be performed.
|
||||
* Get the iface on which the RTT operations must be performed.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|
|
||||
* @return boundIface HIDL interface object representing the iface if bound
|
||||
* to a specific iface, null otherwise
|
||||
*/
|
||||
getBoundIface() generates (IWifiIface boundIface);
|
||||
getBoundIface() generates (WifiStatus status, IWifiIface boundIface);
|
||||
|
||||
/**
|
||||
* Requests notifications of significant events on this rtt controller.
|
||||
* Multiple calls to this must register multiple callbacks each of which must
|
||||
* receive all events.
|
||||
*
|
||||
* @param callback An instance of the |IWifiRttControllerEventCallback| HIDL
|
||||
* interface object.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
|
||||
*/
|
||||
registerEventCallback(IWifiRttControllerEventCallback callback)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to request RTT measurement.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param rttConfigs Vector of |RttConfig| parameters.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
rangeRequest(CommandId cmdId, vec<RttConfig> rttConfigs)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to cancel RTT measurements.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param addrs Vector of addresses for which to cancel.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
rangeCancel(CommandId cmdId, vec<MacAddress> addrs)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to start publishing the channel map on responder device in an NBD
|
||||
* cluster.
|
||||
* Responder device must take this request and schedule broadcasting the
|
||||
* channel map in a NBD ranging attribute in a Service Discovery Frame.
|
||||
* DE must automatically remove the ranging attribute from the OTA queue
|
||||
* after number of Discovery Window specified by numDw where each
|
||||
* Discovery Window is 512 TUs apart.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param params Instance of |RttChannelMap|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
setChannelMap(CommandId cmdId, RttChannelMap params, uint32_t numDw)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to clear the channel map on the responder device in an NBD cluster.
|
||||
* Responder device must cancel future ranging channel request, starting from
|
||||
* next Discovery Window interval and must also stop broadcasting NBD
|
||||
* ranging attribute in Service Discovery Frame.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
clearChannelMap(CommandId cmdId) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* RTT capabilities of the device.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Instance of |RttCapabilities|.
|
||||
*/
|
||||
getCapabilities() generates (WifiStatus status, RttCapabilities capabilities);
|
||||
|
||||
/**
|
||||
* Set configuration for debug.
|
||||
*
|
||||
* @param type debug level to be set.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
setDebugCfg(RttDebugType Type) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get the debug information.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return info Instance of |RttDebugInfo|.
|
||||
*/
|
||||
getDebugInfo() generates (WifiStatus status, RttDebugInfo info);
|
||||
|
||||
/**
|
||||
* API to configure the LCI(Location civic information).
|
||||
* Used in RTT Responder mode only.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param lci Instance of |RttLciInformation|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
setLci(CommandId cmdId, RttLciInformation lci) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to configure the LCR(Location civic records).
|
||||
* Used in RTT Responder mode only.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param lcr Instance of |RttLcrInformation|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
setLcr(CommandId cmdId, RttLcrInformation lcr) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get RTT responder information e.g. WiFi channel to enable responder on.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return info Instance of |RttResponderInfo|.
|
||||
*/
|
||||
getResponderInfo() generates (WifiStatus status, RttResponder info);
|
||||
|
||||
/**
|
||||
* Enable RTT responder mode.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @parm channelHint Hint of the channel information where RTT responder must
|
||||
* be enabled on.
|
||||
* @param maxDurationInSeconds Timeout of responder mode.
|
||||
* @param info Instance of |RttResponderInfo|.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
enableResponder(CommandId cmdId,
|
||||
WifiChannelInfo channelHint,
|
||||
uint32_t maxDurationSeconds,
|
||||
RttResponder info)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Disable RTT responder mode.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
disableResponder(CommandId cmdId) generates (WifiStatus status);
|
||||
};
|
||||
|
||||
30
wifi/1.0/IWifiRttControllerEventCallback.hal
Normal file
30
wifi/1.0/IWifiRttControllerEventCallback.hal
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
/**
|
||||
* RTT Response and Event Callbacks.
|
||||
*/
|
||||
interface IWifiRttControllerEventCallback {
|
||||
/**
|
||||
* Invoked when an RTT result is available.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the original request.
|
||||
* @param results Vector of |RttResult| instances.
|
||||
*/
|
||||
oneway onResults(CommandId cmdId, vec<RttResult> results);
|
||||
};
|
||||
@@ -17,10 +17,331 @@
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
import IWifiIface;
|
||||
import IWifiStaIfaceEventCallback;
|
||||
|
||||
/**
|
||||
* Interface used to represent a single STA iface.
|
||||
*/
|
||||
interface IWifiStaIface extends IWifiIface {
|
||||
/** TODO(rpius): Add methods to the interface. */
|
||||
/**
|
||||
* Mask of capabilities suported by this Iface.
|
||||
*/
|
||||
enum StaIfaceCapabilityMask : uint32_t {
|
||||
/**
|
||||
* If set indicates that the APF APIs are supported.
|
||||
* APF (Android Packet Filter) is a BPF like packet filtering
|
||||
* bytecode executed by the firmware.
|
||||
*/
|
||||
APF = 1 << 0,
|
||||
/**
|
||||
* If set indicates that the Background Scan APIs are supported.
|
||||
* Background scan allow the host to send a number of buckets down to the
|
||||
* firmware. Each bucket contains a set of channels, a period, and some
|
||||
* parameters about how and when to report results.
|
||||
*/
|
||||
BACKGROUND_SCAN = 1 << 1,
|
||||
/**
|
||||
* If set indicates that the link layer stats APIs are supported.
|
||||
*/
|
||||
LINK_LAYER_STATS = 1 << 2,
|
||||
/**
|
||||
* Tracks connection packets' fate.
|
||||
*/
|
||||
DEBUG_PACKET_FATE_SUPPORTED = 1 << 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Requests notifications of significant events on this iface. Multiple calls
|
||||
* to this must register multiple callbacks each of which must receive all
|
||||
* events.
|
||||
*
|
||||
* @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
|
||||
* object.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
|
||||
*/
|
||||
registerEventCallback(IWifiStaIfaceEventCallback callback)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Get the capabilities supported by this STA iface.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Bitset of |StaIfaceCapabilityMask| values.
|
||||
*/
|
||||
getCapabilities() generates (WifiStatus status, uint32_t capabilities);
|
||||
|
||||
/**
|
||||
* Used to query additional information about the chip's APF capabilities.
|
||||
* Must fail if |StaIfaceCapabilityMask.APF| is not set.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Instance of |StaApfPacketFilterCapabilities|.
|
||||
*/
|
||||
getApfPacketFilterCapabilities()
|
||||
generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
|
||||
|
||||
/**
|
||||
* Installs an APF program on this iface, replacing an existing
|
||||
* program if present.
|
||||
* Must fail if |StaIfaceCapabilityMask.APF| is not set.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @param APF Program to be set.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Used to query additional information about the chip's Background Scan capabilities.
|
||||
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Instance of |StaBackgroundScanCapabilities|.
|
||||
*/
|
||||
getBackgroundScanCapabilities()
|
||||
generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
|
||||
|
||||
/**
|
||||
* Used to query the list of valid frequencies (depending on country code set)
|
||||
* for the provided band. These channels may be specifed in the
|
||||
* |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
|
||||
* request.
|
||||
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
|
||||
*
|
||||
* @param band Band for which the frequency list is being generated.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return frequencies vector of valid frequencies for the provided band.
|
||||
*/
|
||||
getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
|
||||
generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
|
||||
|
||||
/**
|
||||
* Start a background scan using the given cmdId as an identifier. Only one
|
||||
* active background scan need be supported.
|
||||
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
|
||||
*
|
||||
* When this is called all requested buckets must be scanned, starting the
|
||||
* beginning of the cycle.
|
||||
*
|
||||
* For example:
|
||||
* If there are two buckets specified
|
||||
* - Bucket 1: period=10s
|
||||
* - Bucket 2: period=20s
|
||||
* - Bucket 3: period=30s
|
||||
* Then the following scans must occur
|
||||
* - t=0 buckets 1, 2, and 3 are scanned
|
||||
* - t=10 bucket 1 is scanned
|
||||
* - t=20 bucket 1 and 2 are scanned
|
||||
* - t=30 bucket 1 and 3 are scanned
|
||||
* - t=40 bucket 1 and 2 are scanned
|
||||
* - t=50 bucket 1 is scanned
|
||||
* - t=60 buckets 1, 2, and 3 are scanned
|
||||
* - and the patter repeats
|
||||
*
|
||||
* If any scan does not occur or is incomplete (error, interrupted, etc) then
|
||||
* a cached scan result must still be recorded with the
|
||||
* WIFI_SCAN_FLAG_INTERRUPTED flag set.
|
||||
*
|
||||
* @param cmdId command Id to use for this invocation.
|
||||
* @params Background scan parameters.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_INVALID_ARGS|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Stop the background scan started.
|
||||
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the request.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Enable link layer stats collection.
|
||||
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
|
||||
*
|
||||
* Radio statistics (once started) must not stop until disabled.
|
||||
* Iface statistics (once started) reset and start afresh after each
|
||||
* connection until disabled.
|
||||
*
|
||||
* @param debug Set for field debug mode. Driver must collect all
|
||||
* statistics regardless of performance impact.
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
enableLinkLayerStatsCollection(bool debug)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Disable link layer stats collection.
|
||||
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
disableLinkLayerStatsCollection() generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Retrieve the latest link layer stats.
|
||||
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
|
||||
* link layer stats collection hasn't been explicitly enabled.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return stats Instance of |LinkLayerStats|.
|
||||
*/
|
||||
getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
|
||||
|
||||
/**
|
||||
* API to start packet fate monitoring.
|
||||
* - Once stared, monitoring must remain active until HAL is unloaded.
|
||||
* - When HAL is unloaded, all packet fate buffers must be cleared.
|
||||
* - The packet fates are used to monitor the state of packets transmitted/
|
||||
* received during association.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
startDebugPacketFateMonitoring() generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to stop packet fate monitoring.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
*/
|
||||
stopDebugPacketFateMonitoring() generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* API to retrieve fates of outbound packets.
|
||||
* - HAL implementation must return the fates of
|
||||
* all the frames transmitted for the most recent association.
|
||||
* The fate reports must follow the same order as their respective
|
||||
* packets.
|
||||
* - HAL implementation may choose (but is not required) to include
|
||||
* reports for management frames.
|
||||
* - Packets reported by firmware, but not recognized by driver,
|
||||
* must be included. However, the ordering of the corresponding
|
||||
* reports is at the discretion of HAL implementation.
|
||||
* - Framework must be able to call this API multiple times for the same
|
||||
* association.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
|
||||
* to the packet fates.
|
||||
*/
|
||||
getDebugTxPacketFates()
|
||||
generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);
|
||||
|
||||
/**
|
||||
* API to retrieve fates of inbound packets.
|
||||
* - HAL implementation must return the fates of
|
||||
* all the frames received for the most recent association.
|
||||
* The fate reports must follow the same order as their respective
|
||||
* packets.
|
||||
* - HAL implementation may choose (but is not required) to include
|
||||
* reports for management frames.
|
||||
* - Packets reported by firmware, but not recognized by driver,
|
||||
* must be included. However, the ordering of the corresponding
|
||||
* reports is at the discretion of HAL implementation.
|
||||
* - Framework must be able to call this API multiple times for the same
|
||||
* association.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_STARTED|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
|
||||
* to the packet fates.
|
||||
*/
|
||||
getDebugRxPacketFates()
|
||||
generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
|
||||
};
|
||||
|
||||
46
wifi/1.0/IWifiStaIfaceEventCallback.hal
Normal file
46
wifi/1.0/IWifiStaIfaceEventCallback.hal
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.wifi@1.0;
|
||||
|
||||
interface IWifiStaIfaceEventCallback {
|
||||
/**
|
||||
* Callback indicating that an ongoing background scan request has failed.
|
||||
* The background scan needs to be restarted to continue scanning.
|
||||
*/
|
||||
oneway onBackgroundScanFailure(CommandId cmdId);
|
||||
|
||||
/**
|
||||
* Called for each received beacon/probe response for a scan with the
|
||||
* |REPORT_EVENTS_FULL_RESULTS| flag set in
|
||||
* |StaBackgroundScanBucketParameters.eventReportScheme|.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the request.
|
||||
* @parm result Full scan result for an AP.
|
||||
*/
|
||||
oneway onBackgroundFullScanResult(CommandId cmdId, StaScanResult result);
|
||||
|
||||
/**
|
||||
* Called when the |StaBackgroundScanBucketParameters.eventReportScheme| flags
|
||||
* for at least one bucket that was just scanned was
|
||||
* |REPORT_EVENTS_EACH_SCAN| or one of the configured thresholds was
|
||||
* breached.
|
||||
*
|
||||
* @param cmdId command Id corresponding to the request.
|
||||
* @parm scanDatas List of scan result for all AP's seen since last callback.
|
||||
*/
|
||||
oneway onBackgroundScanResults(CommandId cmdId, vec<StaScanData> scanDatas);
|
||||
};
|
||||
@@ -14,11 +14,11 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.wifi@1.0-impl
|
||||
LOCAL_MODULE := android.hardware.wifi@1.0-service
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
|
||||
LOCAL_SRC_FILES := \
|
||||
failure_reason_util.cpp \
|
||||
service.cpp \
|
||||
wifi.cpp \
|
||||
wifi_ap_iface.cpp \
|
||||
wifi_chip.cpp \
|
||||
@@ -26,7 +26,8 @@ LOCAL_SRC_FILES := \
|
||||
wifi_nan_iface.cpp \
|
||||
wifi_p2p_iface.cpp \
|
||||
wifi_rtt_controller.cpp \
|
||||
wifi_sta_iface.cpp
|
||||
wifi_sta_iface.cpp \
|
||||
wifi_status_util.cpp
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.wifi@1.0 \
|
||||
libbase \
|
||||
@@ -38,25 +39,5 @@ LOCAL_SHARED_LIBRARIES := \
|
||||
libutils \
|
||||
libwifi-system
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(LIB_WIFI_HAL)
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.wifi@1.0-service
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
|
||||
LOCAL_SRC_FILES := \
|
||||
service.cpp
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.wifi@1.0 \
|
||||
android.hardware.wifi@1.0-impl \
|
||||
libbase \
|
||||
libcutils \
|
||||
libhidl \
|
||||
libhwbinder \
|
||||
liblog \
|
||||
libnl \
|
||||
libutils \
|
||||
libwifi-system
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(LIB_WIFI_HAL)
|
||||
LOCAL_INIT_RC := android.hardware.wifi@1.0-service.rc
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
109
wifi/1.0/default/hidl_return_util.h
Normal file
109
wifi/1.0/default/hidl_return_util.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef HIDL_RETURN_UTIL_H_
|
||||
#define HIDL_RETURN_UTIL_H_
|
||||
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
namespace hidl_return_util {
|
||||
|
||||
/**
|
||||
* These utility functions are used to invoke a method on the provided
|
||||
* HIDL interface object.
|
||||
* These functions checks if the provided HIDL interface object is valid.
|
||||
* a) if valid, Invokes the corresponding internal implementation function of
|
||||
* the HIDL method. It then invokes the HIDL continuation callback with
|
||||
* the status and any returned values.
|
||||
* b) if invalid, invokes the HIDL continuation callback with the
|
||||
* provided error status and default values.
|
||||
*/
|
||||
// Use for HIDL methods which return only an instance of WifiStatus.
|
||||
template <typename ObjT, typename WorkFuncT, typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
if (obj->isValid()) {
|
||||
hidl_cb((obj->*work)(std::forward<Args>(args)...));
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid));
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Use for HIDL methods which return instance of WifiStatus and a single return
|
||||
// value.
|
||||
template <typename ObjT, typename WorkFuncT, typename ReturnT, typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&, ReturnT)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_pair = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_pair);
|
||||
const auto& ret_value = std::get<1>(ret_pair);
|
||||
hidl_cb(status, ret_value);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT>::type());
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Use for HIDL methods which return instance of WifiStatus and 2 return
|
||||
// values.
|
||||
template <typename ObjT,
|
||||
typename WorkFuncT,
|
||||
typename ReturnT1,
|
||||
typename ReturnT2,
|
||||
typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&, ReturnT1, ReturnT2)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_tuple = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_tuple);
|
||||
const auto& ret_value1 = std::get<1>(ret_tuple);
|
||||
const auto& ret_value2 = std::get<2>(ret_tuple);
|
||||
hidl_cb(status, ret_value1, ret_value2);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT1>::type(),
|
||||
typename std::remove_reference<ReturnT2>::type());
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace hidl_util
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
#endif // HIDL_RETURN_UTIL_H_
|
||||
@@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "wifi_chip.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace {
|
||||
// Chip ID to use for the only supported chip.
|
||||
@@ -31,63 +30,97 @@ namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
Wifi::Wifi()
|
||||
: legacy_hal_(new WifiLegacyHal()), run_state_(RunState::STOPPED) {}
|
||||
|
||||
bool Wifi::isValid() {
|
||||
// This object is always valid.
|
||||
return true;
|
||||
}
|
||||
|
||||
Return<void> Wifi::registerEventCallback(
|
||||
const sp<IWifiEventCallback>& callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
callbacks_.emplace_back(callback);
|
||||
return Void();
|
||||
const sp<IWifiEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
event_callback);
|
||||
}
|
||||
|
||||
Return<bool> Wifi::isStarted() {
|
||||
return run_state_ != RunState::STOPPED;
|
||||
}
|
||||
|
||||
Return<void> Wifi::start() {
|
||||
Return<void> Wifi::start(start_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::startInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::stop(stop_cb hidl_status_cb) {
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChipIds(getChipIds_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipIdsInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipInternal,
|
||||
hidl_status_cb,
|
||||
chip_id);
|
||||
}
|
||||
|
||||
WifiStatus Wifi::registerEventCallbackInternal(
|
||||
const sp<IWifiEventCallback>& event_callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(event_callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus Wifi::startInternal() {
|
||||
if (run_state_ == RunState::STARTED) {
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onStart();
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onStartFailure(CreateFailureReason(
|
||||
CommandFailureReason::NOT_AVAILABLE, "HAL is stopping"));
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
|
||||
LOG(INFO) << "Starting HAL";
|
||||
wifi_error status = legacy_hal_->start();
|
||||
if (status != WIFI_SUCCESS) {
|
||||
wifi_error legacy_status = legacy_hal_->start();
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to start Wifi HAL";
|
||||
for (auto& callback : callbacks_) {
|
||||
callback->onStartFailure(
|
||||
CreateFailureReasonLegacyError(status, "Failed to start HAL"));
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatusFromLegacyError(legacy_status,
|
||||
"Failed to start HAL");
|
||||
}
|
||||
|
||||
// Create the chip instance once the HAL is started.
|
||||
chip_ = new WifiChip(kChipId, legacy_hal_);
|
||||
run_state_ = RunState::STARTED;
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onStart();
|
||||
for (const auto& callback : event_callbacks_) {
|
||||
if (!callback->onStart().getStatus().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStart callback";
|
||||
};
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
Return<void> Wifi::stop() {
|
||||
WifiStatus Wifi::stopInternal() {
|
||||
if (run_state_ == RunState::STOPPED) {
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onStop();
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
|
||||
LOG(INFO) << "Stopping HAL";
|
||||
@@ -98,41 +131,42 @@ Return<void> Wifi::stop() {
|
||||
}
|
||||
chip_.clear();
|
||||
run_state_ = RunState::STOPPED;
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onStop();
|
||||
for (const auto& callback : event_callbacks_) {
|
||||
if (!callback->onStop().getStatus().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStop callback";
|
||||
};
|
||||
}
|
||||
};
|
||||
wifi_error status = legacy_hal_->stop(on_complete_callback_);
|
||||
if (status != WIFI_SUCCESS) {
|
||||
wifi_error legacy_status = legacy_hal_->stop(on_complete_callback_);
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to stop Wifi HAL";
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onFailure(
|
||||
CreateFailureReasonLegacyError(status, "Failed to stop HAL"));
|
||||
WifiStatus wifi_status =
|
||||
createWifiStatusFromLegacyError(legacy_status, "Failed to stop HAL");
|
||||
for (const auto& callback : event_callbacks_) {
|
||||
callback->onFailure(wifi_status);
|
||||
}
|
||||
return wifi_status;
|
||||
}
|
||||
return Void();
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChipIds(getChipIds_cb cb) {
|
||||
std::pair<WifiStatus, std::vector<ChipId>> Wifi::getChipIdsInternal() {
|
||||
std::vector<ChipId> chip_ids;
|
||||
if (chip_.get()) {
|
||||
chip_ids.emplace_back(kChipId);
|
||||
}
|
||||
hidl_vec<ChipId> hidl_data;
|
||||
hidl_data.setToExternal(chip_ids.data(), chip_ids.size());
|
||||
cb(hidl_data);
|
||||
return Void();
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)};
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChip(ChipId chip_id, getChip_cb cb) {
|
||||
if (chip_.get() && chip_id == kChipId) {
|
||||
cb(chip_);
|
||||
} else {
|
||||
cb(nullptr);
|
||||
std::pair<WifiStatus, sp<IWifiChip>> Wifi::getChipInternal(ChipId chip_id) {
|
||||
if (!chip_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_NOT_STARTED), nullptr};
|
||||
}
|
||||
return Void();
|
||||
if (chip_id != kChipId) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), chip_};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
|
||||
@@ -39,23 +39,34 @@ class Wifi : public IWifi {
|
||||
public:
|
||||
Wifi();
|
||||
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiEventCallback>& callback) override;
|
||||
const sp<IWifiEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<bool> isStarted() override;
|
||||
Return<void> start() override;
|
||||
Return<void> stop() override;
|
||||
Return<void> getChipIds(getChipIds_cb cb) override;
|
||||
Return<void> getChip(ChipId chip_id, getChip_cb cb) override;
|
||||
Return<void> start(start_cb hidl_status_cb) override;
|
||||
Return<void> stop(stop_cb hidl_status_cb) override;
|
||||
Return<void> getChipIds(getChipIds_cb hidl_status_cb) override;
|
||||
Return<void> getChip(ChipId chip_id, getChip_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
enum class RunState { STOPPED, STARTED, STOPPING };
|
||||
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiEventCallback>& event_callback);
|
||||
WifiStatus startInternal();
|
||||
WifiStatus stopInternal();
|
||||
std::pair<WifiStatus, std::vector<ChipId>> getChipIdsInternal();
|
||||
std::pair<WifiStatus, sp<IWifiChip>> getChipInternal(ChipId chip_id);
|
||||
|
||||
// Instance is created in this root level |IWifi| HIDL interface object
|
||||
// and shared with all the child HIDL interface objects.
|
||||
std::shared_ptr<WifiLegacyHal> legacy_hal_;
|
||||
RunState run_state_;
|
||||
std::vector<sp<IWifiEventCallback>> callbacks_;
|
||||
std::vector<sp<IWifiEventCallback>> event_callbacks_;
|
||||
sp<WifiChip> chip_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Wifi);
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_ap_iface.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_ap_iface.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiApIface::WifiApIface(const std::string& ifname,
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal)
|
||||
@@ -35,15 +36,30 @@ void WifiApIface::invalidate() {
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<void> WifiApIface::getName(getName_cb cb) {
|
||||
hidl_string hidl_ifname;
|
||||
hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
|
||||
cb(hidl_ifname);
|
||||
return Void();
|
||||
bool WifiApIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<IfaceType> WifiApIface::getType() {
|
||||
return IfaceType::AP;
|
||||
Return<void> WifiApIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiApIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiApIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiApIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -37,12 +37,17 @@ class WifiApIface : public IWifiApIface {
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb cb) override;
|
||||
Return<IfaceType> getType() override;
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
|
||||
@@ -14,29 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_chip.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_chip.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace {
|
||||
using android::sp;
|
||||
using android::hardware::hidl_vec;
|
||||
using android::hardware::hidl_string;
|
||||
|
||||
hidl_vec<hidl_string> createHidlVecOfIfaceNames(const std::string& ifname) {
|
||||
std::vector<hidl_string> ifnames;
|
||||
if (!ifname.empty()) {
|
||||
hidl_string hidl_ifname;
|
||||
hidl_ifname = ifname.c_str();
|
||||
ifnames.emplace_back(hidl_ifname);
|
||||
}
|
||||
hidl_vec<hidl_string> hidl_ifnames;
|
||||
hidl_ifnames.setToExternal(ifnames.data(), ifnames.size());
|
||||
return hidl_ifnames;
|
||||
}
|
||||
|
||||
template <typename Iface>
|
||||
void invalidateAndClear(sp<Iface>& iface) {
|
||||
if (iface.get()) {
|
||||
@@ -51,6 +39,7 @@ namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiChip::WifiChip(ChipId chip_id,
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal)
|
||||
@@ -59,322 +48,226 @@ WifiChip::WifiChip(ChipId chip_id,
|
||||
void WifiChip::invalidate() {
|
||||
invalidateAndRemoveAllIfaces();
|
||||
legacy_hal_.reset();
|
||||
callbacks_.clear();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<ChipId> WifiChip::getId() {
|
||||
return chip_id_;
|
||||
bool WifiChip::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getId(getId_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getIdInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::registerEventCallback(
|
||||
const sp<IWifiChipEventCallback>& callback) {
|
||||
if (!is_valid_)
|
||||
return Void();
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
callbacks_.emplace_back(callback);
|
||||
return Void();
|
||||
const sp<IWifiChipEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
event_callback);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getAvailableModes(getAvailableModes_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(hidl_vec<ChipMode>());
|
||||
return Void();
|
||||
} else {
|
||||
// TODO add implementation
|
||||
return Void();
|
||||
}
|
||||
Return<void> WifiChip::getCapabilities(getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::configureChip(uint32_t /*mode_id*/) {
|
||||
if (!is_valid_)
|
||||
return Void();
|
||||
|
||||
invalidateAndRemoveAllIfaces();
|
||||
// TODO add implementation
|
||||
return Void();
|
||||
Return<void> WifiChip::getAvailableModes(getAvailableModes_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getAvailableModesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<uint32_t> WifiChip::getMode() {
|
||||
if (!is_valid_)
|
||||
return 0;
|
||||
// TODO add implementation
|
||||
return 0;
|
||||
Return<void> WifiChip::configureChip(uint32_t mode_id,
|
||||
configureChip_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::configureChipInternal,
|
||||
hidl_status_cb,
|
||||
mode_id);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::requestChipDebugInfo() {
|
||||
if (!is_valid_)
|
||||
return Void();
|
||||
|
||||
IWifiChipEventCallback::ChipDebugInfo result;
|
||||
|
||||
std::pair<wifi_error, std::string> ret =
|
||||
legacy_hal_.lock()->getDriverVersion();
|
||||
if (ret.first != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get driver version: "
|
||||
<< LegacyErrorToString(ret.first);
|
||||
FailureReason reason = CreateFailureReasonLegacyError(
|
||||
ret.first, " failed to get driver version");
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onChipDebugInfoFailure(reason);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
result.driverDescription = ret.second.c_str();
|
||||
|
||||
ret = legacy_hal_.lock()->getFirmwareVersion();
|
||||
if (ret.first != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get firmware version: "
|
||||
<< LegacyErrorToString(ret.first);
|
||||
FailureReason reason = CreateFailureReasonLegacyError(
|
||||
ret.first, " failed to get firmware version");
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onChipDebugInfoFailure(reason);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
result.firmwareDescription = ret.second.c_str();
|
||||
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onChipDebugInfoAvailable(result);
|
||||
}
|
||||
return Void();
|
||||
Return<void> WifiChip::getMode(getMode_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getModeInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::requestDriverDebugDump() {
|
||||
if (!is_valid_)
|
||||
return Void();
|
||||
|
||||
std::pair<wifi_error, std::vector<char>> ret =
|
||||
legacy_hal_.lock()->requestDriverMemoryDump();
|
||||
if (ret.first != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get driver debug dump: "
|
||||
<< LegacyErrorToString(ret.first);
|
||||
FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onDriverDebugDumpFailure(reason);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
auto& driver_dump = ret.second;
|
||||
hidl_vec<uint8_t> hidl_data;
|
||||
hidl_data.setToExternal(reinterpret_cast<uint8_t*>(driver_dump.data()),
|
||||
driver_dump.size());
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onDriverDebugDumpAvailable(hidl_data);
|
||||
}
|
||||
return Void();
|
||||
Return<void> WifiChip::requestChipDebugInfo(
|
||||
requestChipDebugInfo_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::requestChipDebugInfoInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::requestFirmwareDebugDump() {
|
||||
if (!is_valid_)
|
||||
return Void();
|
||||
|
||||
std::pair<wifi_error, std::vector<char>> ret =
|
||||
legacy_hal_.lock()->requestFirmwareMemoryDump();
|
||||
if (ret.first != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get firmware debug dump: "
|
||||
<< LegacyErrorToString(ret.first);
|
||||
FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onFirmwareDebugDumpFailure(reason);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
auto& firmware_dump = ret.second;
|
||||
hidl_vec<uint8_t> hidl_data;
|
||||
hidl_data.setToExternal(reinterpret_cast<uint8_t*>(firmware_dump.data()),
|
||||
firmware_dump.size());
|
||||
for (const auto& callback : callbacks_) {
|
||||
callback->onFirmwareDebugDumpAvailable(hidl_data);
|
||||
}
|
||||
return Void();
|
||||
Return<void> WifiChip::requestDriverDebugDump(
|
||||
requestDriverDebugDump_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::requestDriverDebugDumpInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::createApIface(createApIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getApIfaceName();
|
||||
ap_iface_ = new WifiApIface(ifname, legacy_hal_);
|
||||
cb(ap_iface_);
|
||||
return Void();
|
||||
Return<void> WifiChip::requestFirmwareDebugDump(
|
||||
requestFirmwareDebugDump_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::requestFirmwareDebugDumpInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(hidl_vec<hidl_string>());
|
||||
return Void();
|
||||
}
|
||||
|
||||
std::string ifname;
|
||||
if (ap_iface_.get()) {
|
||||
ifname = legacy_hal_.lock()->getApIfaceName().c_str();
|
||||
}
|
||||
cb(createHidlVecOfIfaceNames(ifname));
|
||||
return Void();
|
||||
Return<void> WifiChip::createApIface(createApIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::createApIfaceInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getApIface(const hidl_string& ifname, getApIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (ap_iface_.get() &&
|
||||
(ifname.c_str() == legacy_hal_.lock()->getApIfaceName())) {
|
||||
cb(ap_iface_);
|
||||
} else {
|
||||
cb(nullptr);
|
||||
}
|
||||
return Void();
|
||||
Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getApIfaceNamesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::createNanIface(createNanIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getNanIfaceName();
|
||||
nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
|
||||
cb(nan_iface_);
|
||||
return Void();
|
||||
Return<void> WifiChip::getApIface(const hidl_string& ifname,
|
||||
getApIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getApIfaceInternal,
|
||||
hidl_status_cb,
|
||||
ifname);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(hidl_vec<hidl_string>());
|
||||
return Void();
|
||||
}
|
||||
Return<void> WifiChip::createNanIface(createNanIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::createNanIfaceInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::string ifname;
|
||||
if (nan_iface_.get()) {
|
||||
ifname = legacy_hal_.lock()->getNanIfaceName().c_str();
|
||||
}
|
||||
cb(createHidlVecOfIfaceNames(ifname));
|
||||
return Void();
|
||||
Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getNanIfaceNamesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getNanIface(const hidl_string& ifname,
|
||||
getNanIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (nan_iface_.get() &&
|
||||
(ifname.c_str() == legacy_hal_.lock()->getNanIfaceName())) {
|
||||
cb(nan_iface_);
|
||||
} else {
|
||||
cb(nullptr);
|
||||
}
|
||||
return Void();
|
||||
getNanIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getNanIfaceInternal,
|
||||
hidl_status_cb,
|
||||
ifname);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::createP2pIface(createP2pIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
|
||||
p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
|
||||
cb(p2p_iface_);
|
||||
return Void();
|
||||
Return<void> WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::createP2pIfaceInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(hidl_vec<hidl_string>());
|
||||
return Void();
|
||||
}
|
||||
|
||||
std::string ifname;
|
||||
if (p2p_iface_.get()) {
|
||||
ifname = legacy_hal_.lock()->getP2pIfaceName().c_str();
|
||||
}
|
||||
cb(createHidlVecOfIfaceNames(ifname));
|
||||
return Void();
|
||||
Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getP2pIfaceNamesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getP2pIface(const hidl_string& ifname,
|
||||
getP2pIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (p2p_iface_.get() &&
|
||||
(ifname.c_str() == legacy_hal_.lock()->getP2pIfaceName())) {
|
||||
cb(p2p_iface_);
|
||||
} else {
|
||||
cb(nullptr);
|
||||
}
|
||||
return Void();
|
||||
getP2pIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getP2pIfaceInternal,
|
||||
hidl_status_cb,
|
||||
ifname);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::createStaIface(createStaIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getStaIfaceName();
|
||||
sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
|
||||
cb(sta_iface_);
|
||||
return Void();
|
||||
Return<void> WifiChip::createStaIface(createStaIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::createStaIfaceInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(hidl_vec<hidl_string>());
|
||||
return Void();
|
||||
}
|
||||
|
||||
std::string ifname;
|
||||
if (sta_iface_.get()) {
|
||||
ifname = legacy_hal_.lock()->getStaIfaceName().c_str();
|
||||
}
|
||||
cb(createHidlVecOfIfaceNames(ifname));
|
||||
return Void();
|
||||
Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getStaIfaceNamesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getStaIface(const hidl_string& ifname,
|
||||
getStaIface_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (sta_iface_.get() &&
|
||||
(ifname.c_str() == legacy_hal_.lock()->getStaIfaceName())) {
|
||||
cb(sta_iface_);
|
||||
} else {
|
||||
cb(nullptr);
|
||||
}
|
||||
return Void();
|
||||
getStaIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getStaIfaceInternal,
|
||||
hidl_status_cb,
|
||||
ifname);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::createRttController(const sp<IWifiIface>& bound_iface,
|
||||
createRttController_cb cb) {
|
||||
if (!is_valid_) {
|
||||
cb(nullptr);
|
||||
return Void();
|
||||
}
|
||||
Return<void> WifiChip::createRttController(
|
||||
const sp<IWifiIface>& bound_iface, createRttController_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::createRttControllerInternal,
|
||||
hidl_status_cb,
|
||||
bound_iface);
|
||||
}
|
||||
|
||||
sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
|
||||
rtt_controllers_.emplace_back(rtt);
|
||||
cb(rtt);
|
||||
return Void();
|
||||
Return<void> WifiChip::getDebugRingBuffersStatus(
|
||||
getDebugRingBuffersStatus_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getDebugRingBuffersStatusInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::startLoggingToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec,
|
||||
uint32_t min_data_size_in_bytes,
|
||||
startLoggingToDebugRingBuffer_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::startLoggingToDebugRingBufferInternal,
|
||||
hidl_status_cb,
|
||||
ring_name,
|
||||
verbose_level,
|
||||
max_interval_in_sec,
|
||||
min_data_size_in_bytes);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::forceDumpToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
forceDumpToDebugRingBuffer_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::forceDumpToDebugRingBufferInternal,
|
||||
hidl_status_cb,
|
||||
ring_name);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::getDebugHostWakeReasonStats(
|
||||
getDebugHostWakeReasonStats_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
|
||||
&WifiChip::getDebugHostWakeReasonStatsInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
void WifiChip::invalidateAndRemoveAllIfaces() {
|
||||
@@ -390,6 +283,232 @@ void WifiChip::invalidateAndRemoveAllIfaces() {
|
||||
rtt_controllers_.clear();
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, ChipId> WifiChip::getIdInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), chip_id_};
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::registerEventCallbackInternal(
|
||||
const sp<IWifiChipEventCallback>& event_callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(event_callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal() {
|
||||
// TODO add implementation
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), 0};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<IWifiChip::ChipMode>>
|
||||
WifiChip::getAvailableModesInternal() {
|
||||
// TODO add implementation
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::configureChipInternal(uint32_t /* mode_id */) {
|
||||
invalidateAndRemoveAllIfaces();
|
||||
// TODO add implementation
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiChip::getModeInternal() {
|
||||
// TODO add implementation
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), 0};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IWifiChip::ChipDebugInfo>
|
||||
WifiChip::requestChipDebugInfoInternal() {
|
||||
IWifiChip::ChipDebugInfo result;
|
||||
wifi_error legacy_status;
|
||||
std::string driver_desc;
|
||||
std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion();
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get driver version: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
WifiStatus status = createWifiStatusFromLegacyError(
|
||||
legacy_status, "failed to get driver version");
|
||||
return {status, result};
|
||||
}
|
||||
result.driverDescription = driver_desc.c_str();
|
||||
|
||||
std::string firmware_desc;
|
||||
std::tie(legacy_status, firmware_desc) =
|
||||
legacy_hal_.lock()->getFirmwareVersion();
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get firmware version: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
WifiStatus status = createWifiStatusFromLegacyError(
|
||||
legacy_status, "failed to get firmware version");
|
||||
return {status, result};
|
||||
}
|
||||
result.firmwareDescription = firmware_desc.c_str();
|
||||
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), result};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
WifiChip::requestDriverDebugDumpInternal() {
|
||||
wifi_error legacy_status;
|
||||
std::vector<uint8_t> driver_dump;
|
||||
std::tie(legacy_status, driver_dump) =
|
||||
legacy_hal_.lock()->requestDriverMemoryDump();
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get driver debug dump: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return {createWifiStatusFromLegacyError(legacy_status),
|
||||
std::vector<uint8_t>()};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), driver_dump};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
WifiChip::requestFirmwareDebugDumpInternal() {
|
||||
wifi_error legacy_status;
|
||||
std::vector<uint8_t> firmware_dump;
|
||||
std::tie(legacy_status, firmware_dump) =
|
||||
legacy_hal_.lock()->requestFirmwareMemoryDump();
|
||||
if (legacy_status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get firmware debug dump: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), firmware_dump};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() {
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getApIfaceName();
|
||||
ap_iface_ = new WifiApIface(ifname, legacy_hal_);
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ap_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<hidl_string>>
|
||||
WifiChip::getApIfaceNamesInternal() {
|
||||
if (!ap_iface_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS),
|
||||
{legacy_hal_.lock()->getApIfaceName()}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::getApIfaceInternal(
|
||||
const hidl_string& ifname) {
|
||||
if (!ap_iface_.get() ||
|
||||
(ifname.c_str() != legacy_hal_.lock()->getApIfaceName())) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ap_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getNanIfaceName();
|
||||
nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<hidl_string>>
|
||||
WifiChip::getNanIfaceNamesInternal() {
|
||||
if (!nan_iface_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS),
|
||||
{legacy_hal_.lock()->getNanIfaceName()}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::getNanIfaceInternal(
|
||||
const hidl_string& ifname) {
|
||||
if (!nan_iface_.get() ||
|
||||
(ifname.c_str() != legacy_hal_.lock()->getNanIfaceName())) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::createP2pIfaceInternal() {
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
|
||||
p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), p2p_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<hidl_string>>
|
||||
WifiChip::getP2pIfaceNamesInternal() {
|
||||
if (!p2p_iface_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS),
|
||||
{legacy_hal_.lock()->getP2pIfaceName()}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::getP2pIfaceInternal(
|
||||
const hidl_string& ifname) {
|
||||
if (!p2p_iface_.get() ||
|
||||
(ifname.c_str() != legacy_hal_.lock()->getP2pIfaceName())) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), p2p_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() {
|
||||
// TODO(b/31997422): Disallow this based on the chip combination.
|
||||
std::string ifname = legacy_hal_.lock()->getStaIfaceName();
|
||||
sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), sta_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<hidl_string>>
|
||||
WifiChip::getStaIfaceNamesInternal() {
|
||||
if (!sta_iface_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS),
|
||||
{legacy_hal_.lock()->getStaIfaceName()}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::getStaIfaceInternal(
|
||||
const hidl_string& ifname) {
|
||||
if (!sta_iface_.get() ||
|
||||
(ifname.c_str() != legacy_hal_.lock()->getStaIfaceName())) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), sta_iface_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiRttController>>
|
||||
WifiChip::createRttControllerInternal(const sp<IWifiIface>& bound_iface) {
|
||||
sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
|
||||
rtt_controllers_.emplace_back(rtt);
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), rtt};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>>
|
||||
WifiChip::getDebugRingBuffersStatusInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::startLoggingToDebugRingBufferInternal(
|
||||
const hidl_string& /* ring_name */,
|
||||
WifiDebugRingBufferVerboseLevel /* verbose_level */,
|
||||
uint32_t /* max_interval_in_sec */,
|
||||
uint32_t /* min_data_size_in_bytes */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::forceDumpToDebugRingBufferInternal(
|
||||
const hidl_string& /* ring_name */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
|
||||
WifiChip::getDebugHostWakeReasonStatsInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
|
||||
@@ -57,41 +57,105 @@ class WifiChip : public IWifiChip {
|
||||
// All HIDL method implementations should check if the object is still marked
|
||||
// valid before processing them.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<ChipId> getId() override;
|
||||
Return<void> getId(getId_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiChipEventCallback>& callback) override;
|
||||
Return<void> getAvailableModes(getAvailableModes_cb cb) override;
|
||||
Return<void> configureChip(uint32_t mode_id) override;
|
||||
Return<uint32_t> getMode() override;
|
||||
Return<void> requestChipDebugInfo() override;
|
||||
Return<void> requestDriverDebugDump() override;
|
||||
Return<void> requestFirmwareDebugDump() override;
|
||||
Return<void> createApIface(createApIface_cb cb) override;
|
||||
Return<void> getApIfaceNames(getApIfaceNames_cb cb) override;
|
||||
Return<void> getApIface(const hidl_string& ifname, getApIface_cb cb) override;
|
||||
Return<void> createNanIface(createNanIface_cb cb) override;
|
||||
Return<void> getNanIfaceNames(getNanIfaceNames_cb cb) override;
|
||||
const sp<IWifiChipEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getAvailableModes(getAvailableModes_cb hidl_status_cb) override;
|
||||
Return<void> configureChip(uint32_t mode_id,
|
||||
configureChip_cb hidl_status_cb) override;
|
||||
Return<void> getMode(getMode_cb hidl_status_cb) override;
|
||||
Return<void> requestChipDebugInfo(
|
||||
requestChipDebugInfo_cb hidl_status_cb) override;
|
||||
Return<void> requestDriverDebugDump(
|
||||
requestDriverDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> requestFirmwareDebugDump(
|
||||
requestFirmwareDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> createApIface(createApIface_cb hidl_status_cb) override;
|
||||
Return<void> getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getApIface(const hidl_string& ifname,
|
||||
getApIface_cb hidl_status_cb) override;
|
||||
Return<void> createNanIface(createNanIface_cb hidl_status_cb) override;
|
||||
Return<void> getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getNanIface(const hidl_string& ifname,
|
||||
getNanIface_cb cb) override;
|
||||
Return<void> createP2pIface(createP2pIface_cb cb) override;
|
||||
Return<void> getP2pIfaceNames(getP2pIfaceNames_cb cb) override;
|
||||
getNanIface_cb hidl_status_cb) override;
|
||||
Return<void> createP2pIface(createP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIface(const hidl_string& ifname,
|
||||
getP2pIface_cb cb) override;
|
||||
Return<void> createStaIface(createStaIface_cb cb) override;
|
||||
Return<void> getStaIfaceNames(getStaIfaceNames_cb cb) override;
|
||||
getP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> createStaIface(createStaIface_cb hidl_status_cb) override;
|
||||
Return<void> getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getStaIface(const hidl_string& ifname,
|
||||
getStaIface_cb cb) override;
|
||||
Return<void> createRttController(const sp<IWifiIface>& bound_iface,
|
||||
createRttController_cb cb) override;
|
||||
getStaIface_cb hidl_status_cb) override;
|
||||
Return<void> createRttController(
|
||||
const sp<IWifiIface>& bound_iface,
|
||||
createRttController_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRingBuffersStatus(
|
||||
getDebugRingBuffersStatus_cb hidl_status_cb) override;
|
||||
Return<void> startLoggingToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec,
|
||||
uint32_t min_data_size_in_bytes,
|
||||
startLoggingToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> forceDumpToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
forceDumpToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> getDebugHostWakeReasonStats(
|
||||
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
void invalidateAndRemoveAllIfaces();
|
||||
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, ChipId> getIdInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiChipEventCallback>& event_callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal();
|
||||
WifiStatus configureChipInternal(uint32_t mode_id);
|
||||
std::pair<WifiStatus, uint32_t> getModeInternal();
|
||||
std::pair<WifiStatus, IWifiChip::ChipDebugInfo>
|
||||
requestChipDebugInfoInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>> requestDriverDebugDumpInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
requestFirmwareDebugDumpInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> createApIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getApIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> getApIfaceInternal(
|
||||
const hidl_string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> createNanIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> getNanIfaceInternal(
|
||||
const hidl_string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(
|
||||
const hidl_string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> createStaIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> getStaIfaceInternal(
|
||||
const hidl_string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiRttController>> createRttControllerInternal(
|
||||
const sp<IWifiIface>& bound_iface);
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>>
|
||||
getDebugRingBuffersStatusInternal();
|
||||
WifiStatus startLoggingToDebugRingBufferInternal(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec,
|
||||
uint32_t min_data_size_in_bytes);
|
||||
WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name);
|
||||
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
|
||||
getDebugHostWakeReasonStatsInternal();
|
||||
|
||||
ChipId chip_id_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiChipEventCallback>> callbacks_;
|
||||
std::vector<sp<IWifiChipEventCallback>> event_callbacks_;
|
||||
sp<WifiApIface> ap_iface_;
|
||||
sp<WifiNanIface> nan_iface_;
|
||||
sp<WifiP2pIface> p2p_iface_;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "wifi_legacy_hal.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <cutils/properties.h>
|
||||
@@ -154,12 +154,14 @@ std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion() {
|
||||
return std::make_pair(status, buffer.data());
|
||||
}
|
||||
|
||||
std::pair<wifi_error, std::vector<char>>
|
||||
std::pair<wifi_error, std::vector<uint8_t>>
|
||||
WifiLegacyHal::requestDriverMemoryDump() {
|
||||
std::vector<char> driver_dump;
|
||||
std::vector<uint8_t> driver_dump;
|
||||
on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer,
|
||||
int buffer_size) {
|
||||
driver_dump.insert(driver_dump.end(), buffer, buffer + buffer_size);
|
||||
driver_dump.insert(driver_dump.end(),
|
||||
reinterpret_cast<uint8_t*>(buffer),
|
||||
reinterpret_cast<uint8_t*>(buffer) + buffer_size);
|
||||
};
|
||||
wifi_error status = global_func_table_.wifi_get_driver_memory_dump(
|
||||
wlan_interface_handle_, {onDriverMemoryDump});
|
||||
@@ -167,12 +169,14 @@ WifiLegacyHal::requestDriverMemoryDump() {
|
||||
return std::make_pair(status, std::move(driver_dump));
|
||||
}
|
||||
|
||||
std::pair<wifi_error, std::vector<char>>
|
||||
std::pair<wifi_error, std::vector<uint8_t>>
|
||||
WifiLegacyHal::requestFirmwareMemoryDump() {
|
||||
std::vector<char> firmware_dump;
|
||||
std::vector<uint8_t> firmware_dump;
|
||||
on_firmware_memory_dump_internal_callback = [&firmware_dump](
|
||||
char* buffer, int buffer_size) {
|
||||
firmware_dump.insert(firmware_dump.end(), buffer, buffer + buffer_size);
|
||||
firmware_dump.insert(firmware_dump.end(),
|
||||
reinterpret_cast<uint8_t*>(buffer),
|
||||
reinterpret_cast<uint8_t*>(buffer) + buffer_size);
|
||||
};
|
||||
wifi_error status = global_func_table_.wifi_get_firmware_memory_dump(
|
||||
wlan_interface_handle_, {onFirmwareMemoryDump});
|
||||
@@ -188,7 +192,7 @@ wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
|
||||
global_handle_, &num_iface_handles, &iface_handles);
|
||||
if (status != WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to enumerate interface handles: "
|
||||
<< LegacyErrorToString(status);
|
||||
<< legacyErrorToString(status);
|
||||
return status;
|
||||
}
|
||||
for (int i = 0; i < num_iface_handles; ++i) {
|
||||
@@ -198,7 +202,7 @@ wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
|
||||
iface_handles[i], current_ifname.data(), current_ifname.size());
|
||||
if (status != WIFI_SUCCESS) {
|
||||
LOG(WARNING) << "Failed to get interface handle name: "
|
||||
<< LegacyErrorToString(status);
|
||||
<< legacyErrorToString(status);
|
||||
continue;
|
||||
}
|
||||
if (ifname_to_find == current_ifname.data()) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <hardware_legacy/wifi_hal.h>
|
||||
|
||||
@@ -48,8 +49,8 @@ class WifiLegacyHal {
|
||||
// Wrappers for all the functions in the legacy HAL function table.
|
||||
std::pair<wifi_error, std::string> getDriverVersion();
|
||||
std::pair<wifi_error, std::string> getFirmwareVersion();
|
||||
std::pair<wifi_error, std::vector<char>> requestDriverMemoryDump();
|
||||
std::pair<wifi_error, std::vector<char>> requestFirmwareMemoryDump();
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump();
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump();
|
||||
|
||||
private:
|
||||
static const uint32_t kMaxVersionStringLength;
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_nan_iface.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_nan_iface.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiNanIface::WifiNanIface(const std::string& ifname,
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal)
|
||||
@@ -32,20 +33,310 @@ WifiNanIface::WifiNanIface(const std::string& ifname,
|
||||
|
||||
void WifiNanIface::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::getName(getName_cb cb) {
|
||||
hidl_string hidl_ifname;
|
||||
hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
|
||||
cb(hidl_ifname);
|
||||
return Void();
|
||||
bool WifiNanIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<IfaceType> WifiNanIface::getType() {
|
||||
return IfaceType::NAN;
|
||||
Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::registerEventCallback(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
callback);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::enableRequest(uint32_t cmd_id,
|
||||
const NanEnableRequest& msg,
|
||||
enableRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::enableRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::disableRequest(uint32_t cmd_id,
|
||||
disableRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::disableRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::publishRequest(uint32_t cmd_id,
|
||||
const NanPublishRequest& msg,
|
||||
publishRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::publishRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::publishCancelRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanPublishCancelRequest& msg,
|
||||
publishCancelRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::publishCancelRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::subscribeRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanSubscribeRequest& msg,
|
||||
subscribeRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::subscribeRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::subscribeCancelRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanSubscribeCancelRequest& msg,
|
||||
subscribeCancelRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::subscribeCancelRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::transmitFollowupRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanTransmitFollowupRequest& msg,
|
||||
transmitFollowupRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::transmitFollowupRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::configRequest(uint32_t cmd_id,
|
||||
const NanConfigRequest& msg,
|
||||
configRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::configRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::beaconSdfPayloadRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanBeaconSdfPayloadRequest& msg,
|
||||
beaconSdfPayloadRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::beaconSdfPayloadRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::getVersion(getVersion_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::getVersionInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::getCapabilities(uint32_t cmd_id,
|
||||
getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::getCapabilitiesInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::dataInterfaceCreate(
|
||||
uint32_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
dataInterfaceCreate_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::dataInterfaceCreateInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
iface_name);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::dataInterfaceDelete(
|
||||
uint32_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
dataInterfaceDelete_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::dataInterfaceDeleteInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
iface_name);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::dataRequestInitiator(
|
||||
uint32_t cmd_id,
|
||||
const NanDataPathInitiatorRequest& msg,
|
||||
dataRequestInitiator_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::dataRequestInitiatorInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::dataIndicationResponse(
|
||||
uint32_t cmd_id,
|
||||
const NanDataPathIndicationResponse& msg,
|
||||
dataIndicationResponse_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::dataIndicationResponseInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::dataEnd(uint32_t cmd_id,
|
||||
const NanDataPathEndRequest& msg,
|
||||
dataEnd_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::dataEndInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
msg);
|
||||
}
|
||||
|
||||
Return<void> WifiNanIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiNanIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiNanIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiNanIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::NAN};
|
||||
}
|
||||
|
||||
WifiStatus WifiNanIface::registerEventCallbackInternal(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiNanIface::enableRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanEnableRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiNanIface::disableRequestInternal(uint32_t /* cmd_id */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiNanIface::publishRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanPublishRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiNanIface::publishCancelRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanPublishCancelRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::subscribeRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanSubscribeRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::subscribeCancelRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanSubscribeCancelRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::transmitFollowupRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanTransmitFollowupRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::configRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanConfigRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::beaconSdfPayloadRequestInternal(
|
||||
uint32_t /* cmd_id */, const NanBeaconSdfPayloadRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
std::pair<WifiStatus, NanVersion> WifiNanIface::getVersionInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), 0};
|
||||
}
|
||||
WifiStatus WifiNanIface::getCapabilitiesInternal(uint32_t /* cmd_id */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::dataInterfaceCreateInternal(
|
||||
uint32_t /* cmd_id */, const std::string& /* iface_name */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::dataInterfaceDeleteInternal(
|
||||
uint32_t /* cmd_id */, const std::string& /* iface_name */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::dataRequestInitiatorInternal(
|
||||
uint32_t /* cmd_id */, const NanDataPathInitiatorRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::dataIndicationResponseInternal(
|
||||
uint32_t /* cmd_id */, const NanDataPathIndicationResponse& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
WifiStatus WifiNanIface::dataEndInternal(
|
||||
uint32_t /* cmd_id */, const NanDataPathEndRequest& /* msg */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiNanIface.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
|
||||
|
||||
#include "wifi_legacy_hal.h"
|
||||
|
||||
@@ -37,14 +38,105 @@ class WifiNanIface : public IWifiNanIface {
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb cb) override;
|
||||
Return<IfaceType> getType() override;
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> enableRequest(uint32_t cmd_id,
|
||||
const NanEnableRequest& msg,
|
||||
enableRequest_cb hidl_status_cb) override;
|
||||
Return<void> disableRequest(uint32_t cmd_id,
|
||||
disableRequest_cb hidl_status_cb) override;
|
||||
Return<void> publishRequest(uint32_t cmd_id,
|
||||
const NanPublishRequest& msg,
|
||||
publishRequest_cb hidl_status_cb) override;
|
||||
Return<void> publishCancelRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanPublishCancelRequest& msg,
|
||||
publishCancelRequest_cb hidl_status_cb) override;
|
||||
Return<void> subscribeRequest(uint32_t cmd_id,
|
||||
const NanSubscribeRequest& msg,
|
||||
subscribeRequest_cb hidl_status_cb) override;
|
||||
Return<void> subscribeCancelRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanSubscribeCancelRequest& msg,
|
||||
subscribeCancelRequest_cb hidl_status_cb) override;
|
||||
Return<void> transmitFollowupRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanTransmitFollowupRequest& msg,
|
||||
transmitFollowupRequest_cb hidl_status_cb) override;
|
||||
Return<void> configRequest(uint32_t cmd_id,
|
||||
const NanConfigRequest& msg,
|
||||
configRequest_cb hidl_status_cb) override;
|
||||
Return<void> beaconSdfPayloadRequest(
|
||||
uint32_t cmd_id,
|
||||
const NanBeaconSdfPayloadRequest& msg,
|
||||
beaconSdfPayloadRequest_cb hidl_status_cb) override;
|
||||
Return<void> getVersion(getVersion_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(uint32_t cmd_id,
|
||||
getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> dataInterfaceCreate(
|
||||
uint32_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
dataInterfaceCreate_cb hidl_status_cb) override;
|
||||
Return<void> dataInterfaceDelete(
|
||||
uint32_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
dataInterfaceDelete_cb hidl_status_cb) override;
|
||||
Return<void> dataRequestInitiator(
|
||||
uint32_t cmd_id,
|
||||
const NanDataPathInitiatorRequest& msg,
|
||||
dataRequestInitiator_cb hidl_status_cb) override;
|
||||
Return<void> dataIndicationResponse(
|
||||
uint32_t cmd_id,
|
||||
const NanDataPathIndicationResponse& msg,
|
||||
dataIndicationResponse_cb hidl_status_cb) override;
|
||||
Return<void> dataEnd(uint32_t cmd_id,
|
||||
const NanDataPathEndRequest& msg,
|
||||
dataEnd_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback);
|
||||
WifiStatus enableRequestInternal(uint32_t cmd_id,
|
||||
const NanEnableRequest& msg);
|
||||
WifiStatus disableRequestInternal(uint32_t cmd_id);
|
||||
WifiStatus publishRequestInternal(uint32_t cmd_id,
|
||||
const NanPublishRequest& msg);
|
||||
WifiStatus publishCancelRequestInternal(uint32_t cmd_id,
|
||||
const NanPublishCancelRequest& msg);
|
||||
WifiStatus subscribeRequestInternal(uint32_t cmd_id,
|
||||
const NanSubscribeRequest& msg);
|
||||
WifiStatus subscribeCancelRequestInternal(
|
||||
uint32_t cmd_id, const NanSubscribeCancelRequest& msg);
|
||||
WifiStatus transmitFollowupRequestInternal(
|
||||
uint32_t cmd_id, const NanTransmitFollowupRequest& msg);
|
||||
WifiStatus configRequestInternal(uint32_t cmd_id,
|
||||
const NanConfigRequest& msg);
|
||||
WifiStatus beaconSdfPayloadRequestInternal(
|
||||
uint32_t cmd_id, const NanBeaconSdfPayloadRequest& msg);
|
||||
std::pair<WifiStatus, NanVersion> getVersionInternal();
|
||||
WifiStatus getCapabilitiesInternal(uint32_t cmd_id);
|
||||
WifiStatus dataInterfaceCreateInternal(uint32_t cmd_id,
|
||||
const std::string& iface_name);
|
||||
WifiStatus dataInterfaceDeleteInternal(uint32_t cmd_id,
|
||||
const std::string& iface_name);
|
||||
WifiStatus dataRequestInitiatorInternal(
|
||||
uint32_t cmd_id, const NanDataPathInitiatorRequest& msg);
|
||||
WifiStatus dataIndicationResponseInternal(
|
||||
uint32_t cmd_id, const NanDataPathIndicationResponse& msg);
|
||||
WifiStatus dataEndInternal(uint32_t cmd_id, const NanDataPathEndRequest& msg);
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiNanIfaceEventCallback>> event_callbacks_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_p2p_iface.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_p2p_iface.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiP2pIface::WifiP2pIface(const std::string& ifname,
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal)
|
||||
@@ -35,15 +36,30 @@ void WifiP2pIface::invalidate() {
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<void> WifiP2pIface::getName(getName_cb cb) {
|
||||
hidl_string hidl_ifname;
|
||||
hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
|
||||
cb(hidl_ifname);
|
||||
return Void();
|
||||
bool WifiP2pIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<IfaceType> WifiP2pIface::getType() {
|
||||
return IfaceType::P2P;
|
||||
Return<void> WifiP2pIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiP2pIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiP2pIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiP2pIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -37,12 +37,17 @@ class WifiP2pIface : public IWifiP2pIface {
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb cb) override;
|
||||
Return<IfaceType> getType() override;
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_rtt_controller.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_rtt_controller.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiRttController::WifiRttController(
|
||||
const sp<IWifiIface>& bound_iface,
|
||||
@@ -33,14 +34,241 @@ WifiRttController::WifiRttController(
|
||||
|
||||
void WifiRttController::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getBoundIface(getBoundIface_cb cb) {
|
||||
cb(bound_iface_);
|
||||
return Void();
|
||||
bool WifiRttController::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getBoundIfaceInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::registerEventCallback(
|
||||
const sp<IWifiRttControllerEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
callback);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::rangeRequest(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<RttConfig>& rtt_configs,
|
||||
rangeRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
rtt_configs);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::rangeCancel(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
rangeCancel_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeCancelInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
addrs);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setChannelMap(uint32_t cmd_id,
|
||||
const RttChannelMap& params,
|
||||
uint32_t num_dw,
|
||||
setChannelMap_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setChannelMapInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
params,
|
||||
num_dw);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::clearChannelMap(
|
||||
uint32_t cmd_id, clearChannelMap_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::clearChannelMapInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getCapabilities(
|
||||
getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setDebugCfg(RttDebugType type,
|
||||
setDebugCfg_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setDebugCfgInternal,
|
||||
hidl_status_cb,
|
||||
type);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getDebugInfo(getDebugInfo_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getDebugInfoInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setLci(uint32_t cmd_id,
|
||||
const RttLciInformation& lci,
|
||||
setLci_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLciInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
lci);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setLcr(uint32_t cmd_id,
|
||||
const RttLcrInformation& lcr,
|
||||
setLcr_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLcrInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
lcr);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getResponderInfo(
|
||||
getResponderInfo_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getResponderInfoInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::enableResponder(
|
||||
uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t maxDurationSeconds,
|
||||
const RttResponder& info,
|
||||
enableResponder_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::enableResponderInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
channel_hint,
|
||||
maxDurationSeconds,
|
||||
info);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::disableResponder(
|
||||
uint32_t cmd_id, disableResponder_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::disableResponderInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiIface>>
|
||||
WifiRttController::getBoundIfaceInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::registerEventCallbackInternal(
|
||||
const sp<IWifiRttControllerEventCallback>& callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::rangeRequestInternal(
|
||||
uint32_t /* cmd_id */, const std::vector<RttConfig>& /* rtt_configs */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::rangeCancelInternal(
|
||||
uint32_t /* cmd_id */,
|
||||
const std::vector<hidl_array<uint8_t, 6>>& /* addrs */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setChannelMapInternal(
|
||||
uint32_t /* cmd_id */,
|
||||
const RttChannelMap& /* params */,
|
||||
uint32_t /* num_dw */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::clearChannelMapInternal(uint32_t /* cmd_id */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, RttCapabilities>
|
||||
WifiRttController::getCapabilitiesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setDebugCfgInternal(RttDebugType /* type */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, RttDebugInfo> WifiRttController::getDebugInfoInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setLciInternal(
|
||||
uint32_t /* cmd_id */, const RttLciInformation& /* lci */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setLcrInternal(
|
||||
uint32_t /* cmd_id */, const RttLcrInformation& /* lcr */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, RttResponder>
|
||||
WifiRttController::getResponderInfoInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::enableResponderInternal(
|
||||
uint32_t /* cmd_id */,
|
||||
const WifiChannelInfo& /* channel_hint */,
|
||||
uint32_t /* maxDurationSeconds */,
|
||||
const RttResponder& /* info */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::disableResponderInternal(uint32_t /* cmd_id */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <android-base/macros.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiIface.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiRttController.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiRttControllerEventCallback.h>
|
||||
|
||||
#include "wifi_legacy_hal.h"
|
||||
|
||||
@@ -38,13 +39,72 @@ class WifiRttController : public IWifiRttController {
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getBoundIface(getBoundIface_cb cb) override;
|
||||
Return<void> getBoundIface(getBoundIface_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiRttControllerEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> rangeRequest(uint32_t cmd_id,
|
||||
const hidl_vec<RttConfig>& rtt_configs,
|
||||
rangeRequest_cb hidl_status_cb) override;
|
||||
Return<void> rangeCancel(uint32_t cmd_id,
|
||||
const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
rangeCancel_cb hidl_status_cb) override;
|
||||
Return<void> setChannelMap(uint32_t cmd_id,
|
||||
const RttChannelMap& params,
|
||||
uint32_t num_dw,
|
||||
setChannelMap_cb hidl_status_cb) override;
|
||||
Return<void> clearChannelMap(uint32_t cmd_id,
|
||||
clearChannelMap_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> setDebugCfg(RttDebugType type,
|
||||
setDebugCfg_cb hidl_status_cb) override;
|
||||
Return<void> getDebugInfo(getDebugInfo_cb hidl_status_cb) override;
|
||||
Return<void> setLci(uint32_t cmd_id,
|
||||
const RttLciInformation& lci,
|
||||
setLci_cb hidl_status_cb) override;
|
||||
Return<void> setLcr(uint32_t cmd_id,
|
||||
const RttLcrInformation& lcr,
|
||||
setLcr_cb hidl_status_cb) override;
|
||||
Return<void> getResponderInfo(getResponderInfo_cb hidl_status_cb) override;
|
||||
Return<void> enableResponder(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t maxDurationSeconds,
|
||||
const RttResponder& info,
|
||||
enableResponder_cb hidl_status_cb) override;
|
||||
Return<void> disableResponder(uint32_t cmd_id,
|
||||
disableResponder_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, sp<IWifiIface>> getBoundIfaceInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiRttControllerEventCallback>& callback);
|
||||
WifiStatus rangeRequestInternal(uint32_t cmd_id,
|
||||
const std::vector<RttConfig>& rtt_configs);
|
||||
WifiStatus rangeCancelInternal(
|
||||
uint32_t cmd_id, const std::vector<hidl_array<uint8_t, 6>>& addrs);
|
||||
WifiStatus setChannelMapInternal(uint32_t cmd_id,
|
||||
const RttChannelMap& params,
|
||||
uint32_t num_dw);
|
||||
WifiStatus clearChannelMapInternal(uint32_t cmd_id);
|
||||
std::pair<WifiStatus, RttCapabilities> getCapabilitiesInternal();
|
||||
WifiStatus setDebugCfgInternal(RttDebugType type);
|
||||
std::pair<WifiStatus, RttDebugInfo> getDebugInfoInternal();
|
||||
WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci);
|
||||
WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr);
|
||||
std::pair<WifiStatus, RttResponder> getResponderInfoInternal();
|
||||
WifiStatus enableResponderInternal(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t maxDurationSeconds,
|
||||
const RttResponder& info);
|
||||
WifiStatus disableResponderInternal(uint32_t cmd_id);
|
||||
|
||||
sp<IWifiIface> bound_iface_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiRttController);
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wifi_sta_iface.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "hidl_return_util.h"
|
||||
#include "wifi_sta_iface.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiStaIface::WifiStaIface(const std::string& ifname,
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal)
|
||||
@@ -32,18 +33,255 @@ WifiStaIface::WifiStaIface(const std::string& ifname,
|
||||
|
||||
void WifiStaIface::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getName(getName_cb cb) {
|
||||
hidl_string hidl_ifname;
|
||||
hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
|
||||
cb(hidl_ifname);
|
||||
return Void();
|
||||
bool WifiStaIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
Return<IfaceType> WifiStaIface::getType() {
|
||||
return IfaceType::STA;
|
||||
Return<void> WifiStaIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::registerEventCallback(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
callback);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getCapabilities(getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getApfPacketFilterCapabilities(
|
||||
getApfPacketFilterCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getApfPacketFilterCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::installApfPacketFilter(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::installApfPacketFilterInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
program);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getBackgroundScanCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getValidFrequenciesForBackgroundScan(
|
||||
StaBackgroundScanBand band,
|
||||
getValidFrequenciesForBackgroundScan_cb hidl_status_cb) {
|
||||
return validateAndCall(
|
||||
this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getValidFrequenciesForBackgroundScanInternal,
|
||||
hidl_status_cb,
|
||||
band);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startBackgroundScan(
|
||||
uint32_t cmd_id,
|
||||
const StaBackgroundScanParameters& params,
|
||||
startBackgroundScan_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startBackgroundScanInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
params);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::stopBackgroundScan(
|
||||
uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopBackgroundScanInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::enableLinkLayerStatsCollection(
|
||||
bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::enableLinkLayerStatsCollectionInternal,
|
||||
hidl_status_cb,
|
||||
debug);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::disableLinkLayerStatsCollection(
|
||||
disableLinkLayerStatsCollection_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::disableLinkLayerStatsCollectionInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getLinkLayerStats(
|
||||
getLinkLayerStats_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getLinkLayerStatsInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startDebugPacketFateMonitoring(
|
||||
startDebugPacketFateMonitoring_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startDebugPacketFateMonitoringInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::stopDebugPacketFateMonitoring(
|
||||
stopDebugPacketFateMonitoring_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopDebugPacketFateMonitoringInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getDebugTxPacketFates(
|
||||
getDebugTxPacketFates_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugTxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getDebugRxPacketFates(
|
||||
getDebugRxPacketFates_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugRxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiStaIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::registerEventCallbackInternal(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), 0};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
WifiStaIface::getApfPacketFilterCapabilitiesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::installApfPacketFilterInternal(
|
||||
uint32_t /* cmd_id */, const std::vector<uint8_t>& /* program */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
WifiStaIface::getBackgroundScanCapabilitiesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
WifiStaIface::getValidFrequenciesForBackgroundScanInternal(
|
||||
StaBackgroundScanBand /* band */) {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startBackgroundScanInternal(
|
||||
uint32_t /* cmd_id */, const StaBackgroundScanParameters& /* params */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::stopBackgroundScanInternal(uint32_t /* cmd_id */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(
|
||||
bool /* debug */) {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaLinkLayerStats>
|
||||
WifiStaIface::getLinkLayerStatsInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startDebugPacketFateMonitoringInternal() {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::stopDebugPacketFateMonitoringInternal() {
|
||||
// TODO implement
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
|
||||
WifiStaIface::getDebugTxPacketFatesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
|
||||
WifiStaIface::getDebugRxPacketFatesInternal() {
|
||||
// TODO implement
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), {}};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIface.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
|
||||
|
||||
#include "wifi_legacy_hal.h"
|
||||
|
||||
@@ -37,14 +38,77 @@ class WifiStaIface : public IWifiStaIface {
|
||||
const std::weak_ptr<WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb cb) override;
|
||||
Return<IfaceType> getType() override;
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getApfPacketFilterCapabilities(
|
||||
getApfPacketFilterCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> installApfPacketFilter(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) override;
|
||||
Return<void> getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBackgroundScan(
|
||||
StaBackgroundScanBand band,
|
||||
getValidFrequenciesForBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> startBackgroundScan(
|
||||
uint32_t cmd_id,
|
||||
const StaBackgroundScanParameters& params,
|
||||
startBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> stopBackgroundScan(
|
||||
uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> enableLinkLayerStatsCollection(
|
||||
bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> disableLinkLayerStatsCollection(
|
||||
disableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override;
|
||||
Return<void> startDebugPacketFateMonitoring(
|
||||
startDebugPacketFateMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> stopDebugPacketFateMonitoring(
|
||||
stopDebugPacketFateMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> getDebugTxPacketFates(
|
||||
getDebugTxPacketFates_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRxPacketFates(
|
||||
getDebugRxPacketFates_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
getApfPacketFilterCapabilitiesInternal();
|
||||
WifiStatus installApfPacketFilterInternal(
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& program);
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
getBackgroundScanCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
getValidFrequenciesForBackgroundScanInternal(StaBackgroundScanBand band);
|
||||
WifiStatus startBackgroundScanInternal(
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params);
|
||||
WifiStatus stopBackgroundScanInternal(uint32_t cmd_id);
|
||||
WifiStatus enableLinkLayerStatsCollectionInternal(bool debug);
|
||||
WifiStatus disableLinkLayerStatsCollectionInternal();
|
||||
std::pair<WifiStatus, StaLinkLayerStats> getLinkLayerStatsInternal();
|
||||
WifiStatus startDebugPacketFateMonitoringInternal();
|
||||
WifiStatus stopDebugPacketFateMonitoringInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
|
||||
getDebugTxPacketFatesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
|
||||
getDebugRxPacketFatesInternal();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiStaIfaceEventCallback>> event_callbacks_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -22,7 +22,7 @@ namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
std::string LegacyErrorToString(wifi_error error) {
|
||||
std::string legacyErrorToString(wifi_error error) {
|
||||
switch (error) {
|
||||
case WIFI_SUCCESS:
|
||||
return "SUCCESS";
|
||||
@@ -48,47 +48,54 @@ std::string LegacyErrorToString(wifi_error error) {
|
||||
}
|
||||
}
|
||||
|
||||
FailureReason CreateFailureReason(CommandFailureReason reason,
|
||||
const std::string& description) {
|
||||
FailureReason result;
|
||||
result.reason = reason;
|
||||
result.description = description.data();
|
||||
return result;
|
||||
WifiStatus createWifiStatus(WifiStatusCode code,
|
||||
const std::string& description) {
|
||||
return {code, description};
|
||||
}
|
||||
|
||||
FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
const std::string& desc) {
|
||||
WifiStatus createWifiStatus(WifiStatusCode code) {
|
||||
return createWifiStatus(code, "");
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
|
||||
const std::string& desc) {
|
||||
switch (error) {
|
||||
case WIFI_ERROR_UNINITIALIZED:
|
||||
case WIFI_ERROR_NOT_AVAILABLE:
|
||||
return CreateFailureReason(CommandFailureReason::NOT_AVAILABLE, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc);
|
||||
|
||||
case WIFI_ERROR_NOT_SUPPORTED:
|
||||
return CreateFailureReason(CommandFailureReason::NOT_SUPPORTED, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc);
|
||||
|
||||
case WIFI_ERROR_INVALID_ARGS:
|
||||
case WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return CreateFailureReason(CommandFailureReason::INVALID_ARGS, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc);
|
||||
|
||||
case WIFI_ERROR_TIMED_OUT:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", timed out");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", timed out");
|
||||
|
||||
case WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
|
||||
case WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
|
||||
case WIFI_ERROR_NONE:
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS, desc);
|
||||
|
||||
case WIFI_ERROR_UNKNOWN:
|
||||
default:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN, "unknown");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error) {
|
||||
return createWifiStatusFromLegacyError(error, "");
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FAILURE_REASON_UTIL_H_
|
||||
#define FAILURE_REASON_UTIL_H_
|
||||
#ifndef WIFI_STATUS_UTIL_H_
|
||||
#define WIFI_STATUS_UTIL_H_
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <hardware_legacy/wifi_hal.h>
|
||||
@@ -26,12 +26,13 @@ namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
std::string LegacyErrorToString(wifi_error error);
|
||||
|
||||
FailureReason CreateFailureReason(CommandFailureReason reason,
|
||||
const std::string& description);
|
||||
FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
const std::string& description);
|
||||
std::string legacyErrorToString(wifi_error error);
|
||||
WifiStatus createWifiStatus(WifiStatusCode code,
|
||||
const std::string& description);
|
||||
WifiStatus createWifiStatus(WifiStatusCode code);
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
|
||||
const std::string& description);
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
@@ -39,4 +40,4 @@ FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // FAILURE_REASON_UTIL_H_
|
||||
#endif // WIFI_STATUS_UTIL_H_
|
||||
3134
wifi/1.0/types.hal
3134
wifi/1.0/types.hal
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user